Error in loading JV fixed

This commit is contained in:
Nabin Hait 2011-08-25 13:51:21 +05:30
parent 781b3eeb81
commit 6d121b3faa
2 changed files with 7 additions and 7 deletions

View File

@ -46,10 +46,10 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
var jv = LocalDB.create('Journal Voucher');
jv = locals['Journal Voucher'][jv];
jv.voucher_type = 'Bank Voucher';
jv.remark = 'Payment of salary for month: ' + doc.month + 'and fiscal year: ' + doc.fiscal_year;
jv.user_remark = 'Payment of salary for the month: ' + doc.month + 'and fiscal year: ' + doc.fiscal_year;
jv.fiscal_year = doc.fiscal_year;
jv.company = doc.company;
jv.posting_date = new Date();
jv.posting_date = dateutil.obj_to_str(new Date());
// credit to bank
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
@ -60,7 +60,7 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
d2.account = r.message['default_salary_account'];
d2.debit = r.message['amount']
loaddoc('Journal Voucher', jv.name);
}
$c_obj(make_doclist(dt,dn),'get_acc_details','',call_back);

View File

@ -140,10 +140,10 @@ class DocType:
cond = self.get_filter_condition()
tot = sql("""
select sum(rounded_total) from `tabSalary Slip` t1
where t1.docstatus = 0 and month = '%s' and fiscal_year = '%s' %s
where t1.docstatus = 1 and month = '%s' and fiscal_year = '%s' %s
""" % (self.doc.month, self.doc.fiscal_year, cond))
return flt(tot)
return flt(tot[0][0])
def get_acc_details(self):
@ -151,10 +151,10 @@ class DocType:
get default bank account,default salary acount from company
"""
amt = self.get_total_salary()
com = sql("select default_bank_account,default_salary_acount from `tabCompany` where name = '%s'" % self.doc.company)
com = sql("select default_bank_account from `tabCompany` where name = '%s'" % self.doc.company)
if not com[0][0] or not com[0][1]:
msgprint("You can set Default Salary Head and Default Bank Account in Setup --> Global Defaults.")
msgprint("You can set Default Bank Account in Company master.")
ret = {
'def_bank_acc' : com and com[0][0] or '',