Merge pull request #5034 from rmehta/letter-head-in-salary
[fix] default letter in salary slip comes from customized default or company and optimized boot for curreny
This commit is contained in:
commit
76db1d702f
@ -2,7 +2,16 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
cur_frm.add_fetch('employee', 'company', 'company');
|
cur_frm.add_fetch('employee', 'company', 'company');
|
||||||
cur_frm.add_fetch('company', 'default_letter_head', 'letter_head');
|
|
||||||
|
frappe.ui.form.on("Salary Slip", {
|
||||||
|
company: function(frm) {
|
||||||
|
var company = locals[':Company'][frm.doc.company];
|
||||||
|
if(!frm.doc.letter_head && company.default_letter_head) {
|
||||||
|
frm.set_value('letter_head', company.default_letter_head);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// On load
|
// On load
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
@ -76,8 +85,8 @@ var calculate_earning_total = function(doc, dt, dn, reset_amount) {
|
|||||||
var total_earn = 0;
|
var total_earn = 0;
|
||||||
for(var i = 0; i < tbl.length; i++){
|
for(var i = 0; i < tbl.length; i++){
|
||||||
if(cint(tbl[i].e_depends_on_lwp) == 1) {
|
if(cint(tbl[i].e_depends_on_lwp) == 1) {
|
||||||
tbl[i].e_modified_amount = Math.round(tbl[i].e_amount)*(flt(doc.payment_days) /
|
tbl[i].e_modified_amount = Math.round(tbl[i].e_amount)*(flt(doc.payment_days) /
|
||||||
cint(doc.total_days_in_month)*100)/100;
|
cint(doc.total_days_in_month)*100)/100;
|
||||||
refresh_field('e_modified_amount', tbl[i].name, 'earnings');
|
refresh_field('e_modified_amount', tbl[i].name, 'earnings');
|
||||||
} else if(reset_amount) {
|
} else if(reset_amount) {
|
||||||
tbl[i].e_modified_amount = tbl[i].e_amount;
|
tbl[i].e_modified_amount = tbl[i].e_amount;
|
||||||
@ -106,7 +115,7 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) {
|
|||||||
total_ded += flt(tbl[i].d_modified_amount);
|
total_ded += flt(tbl[i].d_modified_amount);
|
||||||
}
|
}
|
||||||
doc.total_deduction = total_ded;
|
doc.total_deduction = total_ded;
|
||||||
refresh_field('total_deduction');
|
refresh_field('total_deduction');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate net payable amount
|
// Calculate net payable amount
|
||||||
@ -137,5 +146,5 @@ cur_frm.cscript.validate = function(doc, dt, dn) {
|
|||||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||||
return{
|
return{
|
||||||
query: "erpnext.controllers.queries.employee_query"
|
query: "erpnext.controllers.queries.employee_query"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,8 @@ def load_country_and_currency(bootinfo):
|
|||||||
if country and frappe.db.exists("Country", country):
|
if country and frappe.db.exists("Country", country):
|
||||||
bootinfo.docs += [frappe.get_doc("Country", country)]
|
bootinfo.docs += [frappe.get_doc("Country", country)]
|
||||||
|
|
||||||
bootinfo.docs += frappe.db.sql("""select * from tabCurrency
|
bootinfo.docs += frappe.db.sql("""select name, fraction, fraction_units,
|
||||||
|
number_format, smallest_currency_fraction_value, symbol from tabCurrency
|
||||||
where enabled=1""", as_dict=1, update={"doctype":":Currency"})
|
where enabled=1""", as_dict=1, update={"doctype":":Currency"})
|
||||||
|
|
||||||
def get_letter_heads():
|
def get_letter_heads():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user