mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 13:38:27 +00:00
added sample tests
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
|
||||
cur_frm.cscript.onload=function(doc,dt,dn){if(!doc.posting_date)set_multiple(dt,dn,{posting_date:get_today()});}
|
||||
cur_frm.add_fetch('employee','employee_name','employee_name');cur_frm.cscript.employee=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
|
||||
cur_frm.cscript.leave_type=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
|
||||
cur_frm.cscript.fiscal_year=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
|
||||
cur_frm.cscript.carry_forward=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
|
||||
cur_frm.cscript.carry_forwarded_leaves=function(doc,dt,dn){set_multiple(dt,dn,{total_leaves_allocated:flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});}
|
||||
cur_frm.cscript.new_leaves_allocated=function(doc,dt,dn){set_multiple(dt,dn,{total_leaves_allocated:flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});}
|
||||
calculate_total_leaves_allocated=function(doc,dt,dn){if(cint(doc.carry_forward)==1&&doc.leave_type&&doc.fiscal_year&&doc.employee){var callback=function(){refresh_field('carry_forward');}
|
||||
get_server_fields('get_carry_forwarded_leaves','','',doc,dt,dn,1,callback);}
|
||||
else if(cint(doc.carry_forward)==0){set_multiple(dt,dn,{carry_forwarded_leaves:0,total_leaves_allocated:flt(doc.new_leaves_allocated)});}}
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
cur_frm.cscript.onload=function(doc,dt,dn){if(!doc.posting_date)set_multiple(dt,dn,{posting_date:get_today()});}
|
||||
cur_frm.add_fetch('employee','employee_name','employee_name');cur_frm.cscript.employee=function(doc,dt,dn){get_leave_balance(doc,dt,dn);}
|
||||
cur_frm.cscript.fiscal_year=function(doc,dt,dn){get_leave_balance(doc,dt,dn);}
|
||||
cur_frm.cscript.leave_type=function(doc,dt,dn){get_leave_balance(doc,dt,dn);}
|
||||
cur_frm.cscript.half_day=function(doc,dt,dn){if(doc.from_date){set_multiple(dt,dn,{to_date:doc.from_date});calculate_total_days(doc,dt,dn);}}
|
||||
cur_frm.cscript.from_date=function(doc,dt,dn){if(cint(doc.half_day)==1){set_multiple(dt,dn,{to_date:doc.from_date});}
|
||||
calculate_total_days(doc,dt,dn);}
|
||||
cur_frm.cscript.to_date=function(doc,dt,dn){if(cint(doc.half_day)==1&&doc.from_date&&doc.from_date!=doc.to_date){msgprint("To Date should be same as From Date for Half Day leave");return;}
|
||||
if(cint(doc.half_day)==1){set_multiple(dt,dn,{to_date:doc.from_date});}
|
||||
calculate_total_days(doc,dt,dn);}
|
||||
get_leave_balance=function(doc,dt,dn){if(doc.employee&&doc.leave_type&&doc.fiscal_year)
|
||||
get_server_fields('get_leave_balance','','',doc,dt,dn,1);}
|
||||
calculate_total_days=function(doc,dt,dn){if(doc.from_date&&doc.to_date){if(cint(doc.half_day)==1)set_multiple(dt,dn,{total_leave_days:0.5});else{get_server_fields('get_total_leave_days','','',doc,dt,dn,1);}}}
|
||||
Reference in New Issue
Block a user