changes made
This commit is contained in:
parent
cc73999497
commit
e1f21682fb
@ -429,7 +429,7 @@ class JournalVoucher(AccountsController):
|
|||||||
if d.against_expense_claim:
|
if d.against_expense_claim:
|
||||||
amt = frappe.db.sql("""select sum(debit) as amt from `tabJournal Voucher Detail`
|
amt = frappe.db.sql("""select sum(debit) as amt from `tabJournal Voucher Detail`
|
||||||
where against_expense_claim = %s and docstatus = 1""", d.against_expense_claim ,as_dict=1)[0].amt
|
where against_expense_claim = %s and docstatus = 1""", d.against_expense_claim ,as_dict=1)[0].amt
|
||||||
frappe.db.sql("update `tabExpense Claim` set total_amount_reimbursed = %s where name = %s",(amt, d.against_expense_claim))
|
frappe.db.set_value("Expense Claim", d.against_expense_claim , "total_amount_reimbursed", amt)
|
||||||
|
|
||||||
def validate_expense_claim(self):
|
def validate_expense_claim(self):
|
||||||
for d in self.entries:
|
for d in self.entries:
|
||||||
|
|||||||
@ -22,10 +22,12 @@ erpnext.hr.ExpenseClaimController = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
var d1 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var d1 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
d1.debit = cur_frm.doc.total_sanctioned_amount;
|
d1.debit = cur_frm.doc.total_sanctioned_amount;
|
||||||
|
d1.against_expense_claim = cur_frm.doc.name;
|
||||||
|
|
||||||
// credit to bank
|
// credit to bank
|
||||||
var d1 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var d1 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
d1.credit = cur_frm.doc.total_sanctioned_amount;
|
d1.credit = cur_frm.doc.total_sanctioned_amount;
|
||||||
|
d1.against_expense_claim = cur_frm.doc.name;
|
||||||
if(r.message) {
|
if(r.message) {
|
||||||
d1.account = r.message.account;
|
d1.account = r.message.account;
|
||||||
d1.balance = r.message.balance;
|
d1.balance = r.message.balance;
|
||||||
@ -89,7 +91,8 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
|||||||
if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
|
if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
|
||||||
cur_frm.savesubmit();
|
cur_frm.savesubmit();
|
||||||
|
|
||||||
if(doc.docstatus==1 && frappe.model.can_create("Journal Voucher") && doc.total_amount_reimbursed < doc.total_sanctioned_amount)
|
if(doc.docstatus==1 && frappe.model.can_create("Journal Voucher") &&
|
||||||
|
cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount))
|
||||||
cur_frm.add_custom_button(__("Make Bank Voucher"),
|
cur_frm.add_custom_button(__("Make Bank Voucher"),
|
||||||
cur_frm.cscript.make_bank_voucher, frappe.boot.doctype_icons["Journal Voucher"]);
|
cur_frm.cscript.make_bank_voucher, frappe.boot.doctype_icons["Journal Voucher"]);
|
||||||
}
|
}
|
||||||
@ -109,7 +112,7 @@ cur_frm.cscript.set_help = function(doc) {
|
|||||||
} else {
|
} else {
|
||||||
if(doc.approval_status=="Approved") {
|
if(doc.approval_status=="Approved") {
|
||||||
cur_frm.set_intro(__("Expense Claim has been approved."));
|
cur_frm.set_intro(__("Expense Claim has been approved."));
|
||||||
if(doc.total_amount_reimbursed== doc.total_sanctioned_amount){
|
if(Math.abs(cint(doc.total_amount_reimbursed) - cint(doc.total_sanctioned_amount)) < .001){
|
||||||
cur_frm.set_intro(__("Expense Claim has been reimbursed."));
|
cur_frm.set_intro(__("Expense Claim has been reimbursed."));
|
||||||
}
|
}
|
||||||
} else if(doc.approval_status=="Rejected") {
|
} else if(doc.approval_status=="Rejected") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user