[hotfix] Salary slip, leave considered in amount calculation even if depends on lwp is disabled in salary slip (#11507)

This commit is contained in:
rohitwaghchaure 2017-11-10 15:06:58 +05:30 committed by Nabin Hait
parent cdf8016bcd
commit cc97ec9202
2 changed files with 4 additions and 8 deletions

View File

@ -161,18 +161,15 @@ var calculate_earning_total = function(doc, dt, dn, reset_amount) {
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) / tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) /
cint(doc.total_working_days)*100)/100; cint(doc.total_working_days)*100)/100;
refresh_field('amount', tbl[i].name, 'earnings');
} else if(reset_amount) { } else if(reset_amount) {
tbl[i].amount = tbl[i].default_amount; tbl[i].amount = tbl[i].default_amount;
refresh_field('amount', tbl[i].name, 'earnings');
} }
if(!tbl[i].do_not_include_in_total) { if(!tbl[i].do_not_include_in_total) {
total_earn += flt(tbl[i].amount); total_earn += flt(tbl[i].amount);
} }
} }
doc.gross_pay = total_earn; doc.gross_pay = total_earn;
refresh_many(['amount','gross_pay']); refresh_many(['earnings', 'amount','gross_pay']);
} }
// Calculate deduction total // Calculate deduction total
@ -183,17 +180,15 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) {
for(var i = 0; i < tbl.length; i++){ for(var i = 0; i < tbl.length; i++){
if(cint(tbl[i].depends_on_lwp) == 1) { if(cint(tbl[i].depends_on_lwp) == 1) {
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100; tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100;
refresh_field('amount', tbl[i].name, 'deductions');
} else if(reset_amount) { } else if(reset_amount) {
tbl[i].amount = tbl[i].default_amount; tbl[i].amount = tbl[i].default_amount;
refresh_field('amount', tbl[i].name, 'deductions');
} }
if(!tbl[i].do_not_include_in_total) { if(!tbl[i].do_not_include_in_total) {
total_ded += flt(tbl[i].amount); total_ded += flt(tbl[i].amount);
} }
} }
doc.total_deduction = total_ded; doc.total_deduction = total_ded;
refresh_field('total_deduction'); refresh_many(['deductions', 'total_deduction']);
} }
// Calculate net payable amount // Calculate net payable amount

View File

@ -348,7 +348,8 @@ class SalarySlip(TransactionBase):
/ cint(self.total_working_days)), self.precision("amount", component_type) / cint(self.total_working_days)), self.precision("amount", component_type)
) )
elif not self.payment_days and not self.salary_slip_based_on_timesheet: elif not self.payment_days and not self.salary_slip_based_on_timesheet and \
cint(d.depends_on_lwp):
d.amount = 0 d.amount = 0
elif not d.amount: elif not d.amount:
d.amount = d.default_amount d.amount = d.default_amount