mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 04:09:11 +00:00
fix: Salary Structure Fixes (#19923)
This commit is contained in:
committed by
Nabin Hait
parent
2b3482d5dd
commit
bd5f5dabbd
@@ -119,6 +119,10 @@ frappe.ui.form.on('Salary Structure', {
|
|||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
var employees = r.message;
|
var employees = r.message;
|
||||||
|
if(!employees) return;
|
||||||
|
if (employees.length == 1){
|
||||||
|
frm.events.open_salary_slip(frm, employees[0]);
|
||||||
|
} else {
|
||||||
var d = new frappe.ui.Dialog({
|
var d = new frappe.ui.Dialog({
|
||||||
title: __("Preview Salary Slip"),
|
title: __("Preview Salary Slip"),
|
||||||
fields: [
|
fields: [
|
||||||
@@ -138,16 +142,22 @@ frappe.ui.form.on('Salary Structure', {
|
|||||||
d.get_input("fetch").on("click", function() {
|
d.get_input("fetch").on("click", function() {
|
||||||
var values = d.get_values();
|
var values = d.get_values();
|
||||||
if(!values) return;
|
if(!values) return;
|
||||||
var print_format;
|
frm.events.open_salary_slip(frm, values.employee)
|
||||||
frm.doc.salary_slip_based_on_timesheet ?
|
|
||||||
print_format="Salary Slip based on Timesheet" :
|
|
||||||
print_format="Salary Slip Standard";
|
|
||||||
|
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
open_salary_slip: function(frm, employee){
|
||||||
|
var print_format = frm.doc.salary_slip_based_on_timesheet ? "Salary Slip based on Timesheet" : "Salary Slip Standard";
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.hr.doctype.salary_structure.salary_structure.make_salary_slip",
|
method: "erpnext.hr.doctype.salary_structure.salary_structure.make_salary_slip",
|
||||||
args: {
|
args: {
|
||||||
source_name: frm.doc.name,
|
source_name: frm.doc.name,
|
||||||
employee: values.employee,
|
employee: employee,
|
||||||
as_print: 1,
|
as_print: 1,
|
||||||
print_format: print_format,
|
print_format: print_format,
|
||||||
for_preview: 1
|
for_preview: 1
|
||||||
@@ -155,11 +165,6 @@ frappe.ui.form.on('Salary Structure', {
|
|||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
var new_window = window.open();
|
var new_window = window.open();
|
||||||
new_window.document.write(r.message);
|
new_window.document.write(r.message);
|
||||||
// frappe.msgprint(r.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user