mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-30 17:42:32 +02:00
fix: use get_all instead of get_value as get_value api dont supports between condition
This commit is contained in:
@@ -1063,27 +1063,26 @@ class SalarySlip(TransactionBase):
|
|||||||
)
|
)
|
||||||
exempted_amount = flt(exempted_amount[0][0]) if exempted_amount else 0
|
exempted_amount = flt(exempted_amount[0][0]) if exempted_amount else 0
|
||||||
|
|
||||||
opening_taxable_earning = self.get_opening_for(
|
opening_taxable_earning = self.get_opening_balance_for(
|
||||||
"taxable_earnings_till_date", start_date, end_date
|
"taxable_earnings_till_date", start_date, end_date
|
||||||
)
|
)
|
||||||
|
|
||||||
return (taxable_earnings + opening_taxable_earning) - exempted_amount
|
return (taxable_earnings + opening_taxable_earning) - exempted_amount
|
||||||
|
|
||||||
def get_opening_for(self, field_to_select, start_date, end_date):
|
def get_opening_balance_for(self, field_to_select, start_date, end_date):
|
||||||
return (
|
opening_balance = frappe.db.get_all(
|
||||||
frappe.db.get_value(
|
"Salary Structure Assignment",
|
||||||
"Salary Structure Assignment",
|
{
|
||||||
{
|
"employee": self.employee,
|
||||||
"employee": self.employee,
|
"salary_structure": self.salary_structure,
|
||||||
"salary_structure": self.salary_structure,
|
"from_date": ["between", (start_date, end_date)],
|
||||||
"from_date": ["between", [start_date, end_date]],
|
"docstatus": 1,
|
||||||
"docstatus": 1,
|
},
|
||||||
},
|
field_to_select,
|
||||||
field_to_select,
|
|
||||||
)
|
|
||||||
or 0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return opening_balance[0].get(field_to_select) if opening_balance else 0.0
|
||||||
|
|
||||||
def get_tax_paid_in_period(self, start_date, end_date, tax_component):
|
def get_tax_paid_in_period(self, start_date, end_date, tax_component):
|
||||||
# find total_tax_paid, tax paid for benefit, additional_salary
|
# find total_tax_paid, tax paid for benefit, additional_salary
|
||||||
total_tax_paid = flt(
|
total_tax_paid = flt(
|
||||||
@@ -1111,7 +1110,9 @@ class SalarySlip(TransactionBase):
|
|||||||
)[0][0]
|
)[0][0]
|
||||||
)
|
)
|
||||||
|
|
||||||
tax_deducted_till_date = self.get_opening_for("tax_deducted_till_date", start_date, end_date)
|
tax_deducted_till_date = self.get_opening_balance_for(
|
||||||
|
"tax_deducted_till_date", start_date, end_date
|
||||||
|
)
|
||||||
|
|
||||||
return total_tax_paid + tax_deducted_till_date
|
return total_tax_paid + tax_deducted_till_date
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user