considered half day lwp in sal slip

This commit is contained in:
Nabin Hait 2011-08-08 14:58:38 +05:30
parent 2c0ab73948
commit 3cb7b165d1
4 changed files with 209 additions and 201 deletions

View File

@ -51,7 +51,6 @@ for r in res:
q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
if ch:
qur = q1+cond2+cond1+" and t2.name = '%s'"
ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))

View File

@ -52,12 +52,12 @@ cur_frm.cscript.from_date = function(doc, dt, dn) {
// to date
// --------
cur_frm.cscript.to_date = function(doc, dt, dn) {
if(cint(doc.half_day) == 1 && doc.from_date && doc.from_date != doc.to_date){
if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
msgprint("To Date should be same as From Date for Half Day leave");
return;
set_multiple(dt,dn,{to_date:doc.from_date});
}
if(cint(doc.half_day) == 1){
set_multiple(dt,dn,{to_date:doc.from_date});
}
calculate_total_days(doc, dt, dn);
}

View File

@ -29,7 +29,7 @@ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
// Calculate total if lwp exists
// ------------------------------------------------------------------------
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
doc.payment_days = cint(doc.total_days_in_month) - cint(doc.leave_without_pay);
doc.payment_days = flt(doc.total_days_in_month) - flt(doc.leave_without_pay);
refresh_field('payment_days');
calculate_all(doc, dt, dn);
}

View File

@ -101,8 +101,17 @@ class DocType(TransactionBase):
for d in range(m[3]):
dt = add_days(cstr(m[1]), d)
if dt not in holidays:
if sql("select t1.name from `tabLeave Application` t1, `tabLeave Type` t2 where t2.name = t1.leave_type and ifnull(t2.is_lwp, 0) = 1 and t1.docstatus = 1 and t1.employee = '%s' and '%s' between from_date and to_date"%(self.doc.employee, dt)):
lwp += 1
leave = sql("""
select t1.name, t1.half_day
from `tabLeave Application` t1, `tabLeave Type` t2
where t2.name = t1.leave_type
and ifnull(t2.is_lwp, 0) = 1
and t1.docstatus = 1
and t1.employee = '%s'
and '%s' between from_date and to_date
"""%(self.doc.employee, dt))
if leave:
lwp = cint(leave[0][1]) and lwp + 0.5 or lwp + 1
return lwp
# Check existing