[fixes] salary manager #3554
This commit is contained in:
parent
b7219dc698
commit
f9b356992a
@ -1,30 +1,44 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
var display_activity_log = function(msg) {
|
cur_frm.cscript.display_activity_log = function(msg) {
|
||||||
if(!cur_frm.ss_html)
|
if(!cur_frm.ss_html)
|
||||||
cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
|
cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
|
||||||
cur_frm.ss_html.innerHTML =
|
if(msg) {
|
||||||
'<div class="padding"><h4>'+__("Activity Log:")+'</h4>'+msg+'</div>';
|
cur_frm.ss_html.innerHTML =
|
||||||
|
'<div class="padding"><h4>'+__("Activity Log:")+'</h4>'+msg+'</div>';
|
||||||
|
} else {
|
||||||
|
cur_frm.ss_html.innerHTML = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create salary slip
|
//Create salary slip
|
||||||
//-----------------------
|
//-----------------------
|
||||||
cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) {
|
cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) {
|
||||||
|
cur_frm.cscript.display_activity_log("");
|
||||||
var callback = function(r, rt){
|
var callback = function(r, rt){
|
||||||
if (r.message)
|
if (r.message)
|
||||||
display_activity_log(r.message);
|
cur_frm.cscript.display_activity_log(r.message);
|
||||||
}
|
}
|
||||||
return $c('runserverobj', args={'method':'create_sal_slip','docs':doc},callback);
|
return $c('runserverobj', args={'method':'create_sal_slip','docs':doc},callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
|
cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
|
||||||
|
cur_frm.cscript.display_activity_log("");
|
||||||
var check = confirm(__("Do you really want to Submit all Salary Slip for month {0} and year {1}", [doc.month, doc.fiscal_year]));
|
var check = confirm(__("Do you really want to Submit all Salary Slip for month {0} and year {1}", [doc.month, doc.fiscal_year]));
|
||||||
if(check){
|
if(check){
|
||||||
|
// clear all in locals
|
||||||
|
if(locals["Salary Slip"]) {
|
||||||
|
$.each(locals["Salary Slip"], function(name, d) {
|
||||||
|
frappe.model.remove_from_locals("Salary Slip", name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var callback = function(r, rt){
|
var callback = function(r, rt){
|
||||||
if (r.message)
|
if (r.message)
|
||||||
display_activity_log(r.message);
|
cur_frm.cscript.display_activity_log(r.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $c('runserverobj', args={'method':'submit_salary_slip','docs':doc},callback);
|
return $c('runserverobj', args={'method':'submit_salary_slip','docs':doc},callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,4 +61,4 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
|
|||||||
|
|
||||||
frappe.ui.form.on("Salary Manager", "refresh", function(frm) {
|
frappe.ui.form.on("Salary Manager", "refresh", function(frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
});
|
});
|
||||||
|
@ -101,7 +101,7 @@ class SalaryManager(Document):
|
|||||||
log = "<p>No employee for the above selected criteria OR salary slip already created</p>"
|
log = "<p>No employee for the above selected criteria OR salary slip already created</p>"
|
||||||
if ss_list:
|
if ss_list:
|
||||||
log = "<b>Salary Slip Created For</b>\
|
log = "<b>Salary Slip Created For</b>\
|
||||||
<br><br>%s" % '<br>'.join(ss_list)
|
<br><br>%s" % '<br>'.join(self.format_as_links(ss_list))
|
||||||
return log
|
return log
|
||||||
|
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ class SalaryManager(Document):
|
|||||||
else:
|
else:
|
||||||
all_ss = [d[0] for d in all_ss]
|
all_ss = [d[0] for d in all_ss]
|
||||||
|
|
||||||
submitted_ss = list(set(all_ss) - set(not_submitted_ss))
|
submitted_ss = self.format_as_links(list(set(all_ss) - set(not_submitted_ss)))
|
||||||
if submitted_ss:
|
if submitted_ss:
|
||||||
mail_sent_msg = self.send_email and " (Mail has been sent to the employee)" or ""
|
mail_sent_msg = self.send_email and " (Mail has been sent to the employee)" or ""
|
||||||
log = """
|
log = """
|
||||||
@ -164,6 +164,9 @@ class SalaryManager(Document):
|
|||||||
"""% ('<br>'.join(not_submitted_ss))
|
"""% ('<br>'.join(not_submitted_ss))
|
||||||
return log
|
return log
|
||||||
|
|
||||||
|
def format_as_links(self, ss_list):
|
||||||
|
return ['<a href="#Form/Salary Slip/{0}">{0}</a>'.format(s) for s in ss_list]
|
||||||
|
|
||||||
|
|
||||||
def get_total_salary(self):
|
def get_total_salary(self):
|
||||||
"""
|
"""
|
||||||
|
@ -498,9 +498,9 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||||
cur_frm.cscript.validate_items(doc);
|
|
||||||
if($.inArray(cur_frm.doc.purpose, ["Purchase Return", "Sales Return"])!==-1)
|
if($.inArray(cur_frm.doc.purpose, ["Purchase Return", "Sales Return"])!==-1)
|
||||||
validated = cur_frm.cscript.get_doctype_docname() ? true : false;
|
validated = cur_frm.cscript.get_doctype_docname() ? true : false;
|
||||||
|
cur_frm.cscript.validate_items(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.validate_items = function(doc) {
|
cur_frm.cscript.validate_items = function(doc) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user