diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js index b6be5d2909..09c5337b50 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.js +++ b/erpnext/hr/doctype/salary_slip/salary_slip.js @@ -129,15 +129,15 @@ var calculate_earning_total = function(doc, dt, dn, reset_amount) { var tbl = doc.earnings || []; var total_earn = 0; for(var i = 0; i < tbl.length; i++){ - 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; - refresh_field('amount', tbl[i].name, 'earnings'); - } else if(reset_amount) { - tbl[i].amount = tbl[i].default_amount; - refresh_field('amount', tbl[i].name, 'earnings'); - } - total_earn += flt(tbl[i].amount); + 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; + refresh_field('amount', tbl[i].name, 'earnings'); + } else if(reset_amount) { + tbl[i].amount = tbl[i].default_amount; + refresh_field('amount', tbl[i].name, 'earnings'); + } + total_earn += flt(tbl[i].amount); } doc.gross_pay = total_earn; refresh_many(['amount','gross_pay']); @@ -149,14 +149,14 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) { var tbl = doc.deductions || []; var total_ded = 0; for(var i = 0; i < tbl.length; i++){ - 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; - refresh_field('amount', tbl[i].name, 'deductions'); - } else if(reset_amount) { - tbl[i].amount = tbl[i].default_amount; - refresh_field('amount', tbl[i].name, 'deductions'); - } - total_ded += flt(tbl[i].amount); + 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; + refresh_field('amount', tbl[i].name, 'deductions'); + } else if(reset_amount) { + tbl[i].amount = tbl[i].default_amount; + refresh_field('amount', tbl[i].name, 'deductions'); + } + total_ded += flt(tbl[i].amount); } doc.total_deduction = total_ded; refresh_field('total_deduction');