get_payroll_period return name, fix hard coded leave period

This commit is contained in:
Ranjith 2018-05-17 10:00:33 +05:30
parent 31eeff00f7
commit 58363e6bbd
2 changed files with 3 additions and 3 deletions

View File

@ -493,9 +493,9 @@ class SalarySlip(TransactionBase):
# Calculate total exemption declaration
exemption_amount = 0
if frappe.db.exists("Employee Tax Exemption Declaration", {"employee": self.employee,
"payroll_period": payroll_period.parent, "docstatus": 1}):
"payroll_period": payroll_period.name, "docstatus": 1}):
exemption_amount = frappe.db.get_value("Employee Tax Exemption Declaration",
{"employee": self.employee, "payroll_period": "2018", "docstatus": 1}, #fix period
{"employee": self.employee, "payroll_period": payroll_period.name, "docstatus": 1}, #fix period
"total_exemption_amount")
annual_earning = annual_earning - exemption_amount

View File

@ -236,7 +236,7 @@ def get_leave_period(from_date, to_date, company):
return leave_period
def get_payroll_period(from_date, to_date, company):
payroll_period = frappe.db.sql("""select pd.parent, pd.start_date, pd.end_date from
payroll_period = frappe.db.sql("""select pp.name, pd.start_date, pd.end_date from
`tabPayroll Period Date` pd join `tabPayroll Period` pp on
pd.parent=pp.name where pd.start_date<=%s and pd.end_date>= %s
and pp.company=%s""", (from_date, to_date, company), as_dict=1)