mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
fix: Bank reconciliation cleanup
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "ACC-BTN-.YYYY.-",
|
"default": "ACC-BTN-.YYYY.-",
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "naming_series",
|
"fieldname": "naming_series",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
@@ -55,6 +56,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "date",
|
"fieldname": "date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -87,6 +89,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "column_break_2",
|
"fieldname": "column_break_2",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -119,6 +122,7 @@
|
|||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "Settled",
|
"default": "Settled",
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "status",
|
"fieldname": "status",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -152,6 +156,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "bank_account",
|
"fieldname": "bank_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -185,6 +190,43 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"default": "",
|
||||||
|
"fetch_from": "bank_account.company",
|
||||||
|
"fetch_if_empty": 0,
|
||||||
|
"fieldname": "company",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Company",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"options": "Company",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "section_break_4",
|
"fieldname": "section_break_4",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -216,6 +258,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "debit",
|
"fieldname": "debit",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -248,6 +291,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "credit",
|
"fieldname": "credit",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -280,6 +324,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "column_break_7",
|
"fieldname": "column_break_7",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -311,6 +356,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "currency",
|
"fieldname": "currency",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -344,6 +390,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "section_break_10",
|
"fieldname": "section_break_10",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -375,6 +422,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -407,6 +455,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "section_break_14",
|
"fieldname": "section_break_14",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -438,6 +487,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "reference_number",
|
"fieldname": "reference_number",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -470,6 +520,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "transaction_id",
|
"fieldname": "transaction_id",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -502,6 +553,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "payment_entries",
|
"fieldname": "payment_entries",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -535,6 +587,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "column_break_17",
|
"fieldname": "column_break_17",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -566,6 +619,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "allocated_amount",
|
"fieldname": "allocated_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -598,6 +652,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "unallocated_amount",
|
"fieldname": "unallocated_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -630,6 +685,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "amended_from",
|
"fieldname": "amended_from",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -666,7 +722,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-11-28 11:05:05.087606",
|
"modified": "2019-03-22 10:52:04.540756",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Bank Transaction",
|
"name": "Bank Transaction",
|
||||||
|
|||||||
@@ -295,7 +295,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2019-03-06 15:58:37.839241",
|
"modified": "2019-03-19 14:54:56.524556",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice Payment",
|
"name": "Sales Invoice Payment",
|
||||||
|
|||||||
@@ -23,13 +23,41 @@ erpnext.accounts.bankReconciliation = class BankReconciliation {
|
|||||||
|
|
||||||
me.$main_section = $(`<div class="reconciliation page-main-content"></div>`).appendTo(me.page.main);
|
me.$main_section = $(`<div class="reconciliation page-main-content"></div>`).appendTo(me.page.main);
|
||||||
const empty_state = __("Upload a bank statement, link or reconcile a bank account")
|
const empty_state = __("Upload a bank statement, link or reconcile a bank account")
|
||||||
me.$main_section.append(`<div class="flex justify-center align-center text-muted" style="height: 50vh; display: flex;"><h5 class="text-muted">${empty_state}</h5></div>`)
|
me.$main_section.append(`<div class="flex justify-center align-center text-muted"
|
||||||
|
style="height: 50vh; display: flex;"><h5 class="text-muted">${empty_state}</h5></div>`)
|
||||||
|
|
||||||
|
me.page.add_field({
|
||||||
|
fieldtype: 'Link',
|
||||||
|
label: __('Company'),
|
||||||
|
fieldname: 'company',
|
||||||
|
options: "Company",
|
||||||
|
onchange: function() {
|
||||||
|
console.log(this.value)
|
||||||
|
if (this.value) {
|
||||||
|
me.company = this.value;
|
||||||
|
} else {
|
||||||
|
me.company = null;
|
||||||
|
me.bank_account = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
me.page.add_field({
|
me.page.add_field({
|
||||||
fieldtype: 'Link',
|
fieldtype: 'Link',
|
||||||
label: __('Bank Account'),
|
label: __('Bank Account'),
|
||||||
fieldname: 'bank_account',
|
fieldname: 'bank_account',
|
||||||
options: "Bank Account",
|
options: "Bank Account",
|
||||||
|
get_query: function() {
|
||||||
|
if(!me.company) {
|
||||||
|
frappe.throw(__("Please select company first"));
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
"company": me.company
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
onchange: function() {
|
onchange: function() {
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
me.bank_account = this.value;
|
me.bank_account = this.value;
|
||||||
@@ -344,7 +372,7 @@ erpnext.accounts.ReconciliationRow = class ReconciliationRow {
|
|||||||
frappe.new_doc(invoice_type)
|
frappe.new_doc(invoice_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
new_invoice() {
|
new_expense() {
|
||||||
frappe.new_doc("Expense Claim")
|
frappe.new_doc("Expense Claim")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +421,7 @@ erpnext.accounts.ReconciliationRow = class ReconciliationRow {
|
|||||||
"name": ["in", ["Payment Entry", "Journal Entry", "Sales Invoice", "Purchase Invoice", "Expense Claim"]]
|
"name": ["in", ["Payment Entry", "Journal Entry", "Sales Invoice", "Purchase Invoice", "Expense Claim"]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldtype: 'Column Break',
|
fieldtype: 'Column Break',
|
||||||
@@ -408,16 +436,18 @@ erpnext.accounts.ReconciliationRow = class ReconciliationRow {
|
|||||||
let dt = this.dialog.fields_dict.payment_doctype.value;
|
let dt = this.dialog.fields_dict.payment_doctype.value;
|
||||||
if (dt === "Payment Entry") {
|
if (dt === "Payment Entry") {
|
||||||
return {
|
return {
|
||||||
filters : [
|
query: "erpnext.accounts.page.bank_reconciliation.bank_reconciliation.payment_entry_query",
|
||||||
["Payment Entry", "ifnull(clearance_date, '')", "=", ""],
|
filters : {
|
||||||
["Payment Entry", "docstatus", "=", 1]
|
"bank_account": this.data.bank_account,
|
||||||
]
|
"company": this.data.company
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (dt === "Journal Entry") {
|
} else if (dt === "Journal Entry") {
|
||||||
return {
|
return {
|
||||||
query: "erpnext.accounts.page.bank_reconciliation.bank_reconciliation.journal_entry_query",
|
query: "erpnext.accounts.page.bank_reconciliation.bank_reconciliation.journal_entry_query",
|
||||||
filters : {
|
filters : {
|
||||||
"bank_account": this.data.bank_account
|
"bank_account": this.data.bank_account,
|
||||||
|
"company": this.data.company
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (dt === "Sales Invoice") {
|
} else if (dt === "Sales Invoice") {
|
||||||
@@ -428,14 +458,16 @@ erpnext.accounts.ReconciliationRow = class ReconciliationRow {
|
|||||||
return {
|
return {
|
||||||
filters : [
|
filters : [
|
||||||
["Purchase Invoice", "ifnull(clearance_date, '')", "=", ""],
|
["Purchase Invoice", "ifnull(clearance_date, '')", "=", ""],
|
||||||
["Purchase Invoice", "docstatus", "=", 1]
|
["Purchase Invoice", "docstatus", "=", 1],
|
||||||
|
["Purchase Invoice", "company", "=", this.data.company]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
} else if (dt === "Expense Claim") {
|
} else if (dt === "Expense Claim") {
|
||||||
return {
|
return {
|
||||||
filters : [
|
filters : [
|
||||||
["Expense Claim", "ifnull(clearance_date, '')", "=", ""],
|
["Expense Claim", "ifnull(clearance_date, '')", "=", ""],
|
||||||
["Expense Claim", "docstatus", "=", 1]
|
["Expense Claim", "docstatus", "=", 1],
|
||||||
|
["Expense Claim", "company", "=", this.data.company]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ def reconcile(bank_transaction, payment_doctype, payment_name):
|
|||||||
frappe.throw(_("This bank transaction is already fully reconciled"))
|
frappe.throw(_("This bank transaction is already fully reconciled"))
|
||||||
|
|
||||||
if transaction.credit > 0 and gl_entry.credit > 0:
|
if transaction.credit > 0 and gl_entry.credit > 0:
|
||||||
frappe.throw(_("The selected payment entry should be linked with a debitor bank transaction"))
|
frappe.throw(_("The selected payment entry should be linked with a debtor bank transaction"))
|
||||||
|
|
||||||
if transaction.debit > 0 and gl_entry.debit > 0:
|
if transaction.debit > 0 and gl_entry.debit > 0:
|
||||||
frappe.throw(_("The selected payment entry should be linked with a creditor bank transaction"))
|
frappe.throw(_("The selected payment entry should be linked with a creditor bank transaction"))
|
||||||
@@ -59,27 +59,18 @@ def clear_payment_entry(transaction, payment_entry, gl_entry):
|
|||||||
amount_cleared = (flt(linked_bank_transactions[0].credit) - flt(linked_bank_transactions[0].debit))
|
amount_cleared = (flt(linked_bank_transactions[0].credit) - flt(linked_bank_transactions[0].debit))
|
||||||
amount_to_be_cleared = (flt(gl_entry.debit) - flt(gl_entry.credit))
|
amount_to_be_cleared = (flt(gl_entry.debit) - flt(gl_entry.credit))
|
||||||
|
|
||||||
if payment_entry.doctype == "Payment Entry":
|
if payment_entry.doctype in ("Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"):
|
||||||
clear_simple_entry(amount_cleared, amount_to_be_cleared, payment_entry, transaction)
|
|
||||||
|
|
||||||
elif payment_entry.doctype == "Journal Entry":
|
|
||||||
clear_simple_entry(amount_cleared, amount_to_be_cleared, payment_entry, transaction)
|
clear_simple_entry(amount_cleared, amount_to_be_cleared, payment_entry, transaction)
|
||||||
|
|
||||||
elif payment_entry.doctype == "Sales Invoice":
|
elif payment_entry.doctype == "Sales Invoice":
|
||||||
clear_sales_invoice(amount_cleared, amount_to_be_cleared, payment_entry, transaction)
|
clear_sales_invoice(amount_cleared, amount_to_be_cleared, payment_entry, transaction)
|
||||||
|
|
||||||
elif payment_entry.doctype == "Purchase Invoice":
|
|
||||||
clear_simple_entry(amount_cleared, amount_to_be_cleared, payment_entry, transaction)
|
|
||||||
|
|
||||||
elif payment_entry.doctype == "Expense Claim":
|
|
||||||
clear_simple_entry(amount_cleared, amount_to_be_cleared, payment_entry, transaction)
|
|
||||||
|
|
||||||
def clear_simple_entry(amount_cleared, amount_to_be_cleared, payment_entry, transaction):
|
def clear_simple_entry(amount_cleared, amount_to_be_cleared, payment_entry, transaction):
|
||||||
if amount_cleared == amount_to_be_cleared:
|
if amount_cleared >= amount_to_be_cleared:
|
||||||
frappe.db.set_value(payment_entry.doctype, payment_entry.name, "clearance_date", transaction.date)
|
frappe.db.set_value(payment_entry.doctype, payment_entry.name, "clearance_date", transaction.date)
|
||||||
|
|
||||||
def clear_sales_invoice(amount_cleared, amount_to_be_cleared, payment_entry, transaction):
|
def clear_sales_invoice(amount_cleared, amount_to_be_cleared, payment_entry, transaction):
|
||||||
if amount_cleared == amount_to_be_cleared:
|
if amount_cleared >= amount_to_be_cleared:
|
||||||
frappe.db.set_value("Sales Invoice Payment", dict(parenttype=payment_entry.doctype,
|
frappe.db.set_value("Sales Invoice Payment", dict(parenttype=payment_entry.doctype,
|
||||||
parent=payment_entry.name), "clearance_date", transaction.date)
|
parent=payment_entry.name), "clearance_date", transaction.date)
|
||||||
|
|
||||||
@@ -180,16 +171,33 @@ def check_matching_amount(bank_account, company, transaction):
|
|||||||
sales_invoices = []
|
sales_invoices = []
|
||||||
|
|
||||||
if transaction.debit > 0:
|
if transaction.debit > 0:
|
||||||
purchase_invoices = frappe.get_all("Purchase Invoice", fields=["'Purchase Invoice' as doctype", "name", "paid_amount",
|
purchase_invoices = frappe.get_all("Purchase Invoice",
|
||||||
"supplier as party", "posting_date", "currency"], filters=[["paid_amount", "like", "{0}%".format(amount)],
|
fields = ["'Purchase Invoice' as doctype", "name", "paid_amount", "supplier as party", "posting_date", "currency"],
|
||||||
["docstatus", "=", "1"], ["is_paid", "=", "1"], ["ifnull(clearance_date, '')", "=", ""], ["cash_bank_account", "=", "{0}".format(bank_account)]])
|
filters=[
|
||||||
|
["paid_amount", "like", "{0}%".format(amount)],
|
||||||
|
["docstatus", "=", "1"],
|
||||||
|
["is_paid", "=", "1"],
|
||||||
|
["ifnull(clearance_date, '')", "=", ""],
|
||||||
|
["cash_bank_account", "=", "{0}".format(bank_account)]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
mode_of_payments = [x["parent"] for x in frappe.db.get_list("Mode of Payment Account",
|
||||||
|
filters={"default_account": bank_account}, fields=["parent"])]
|
||||||
|
|
||||||
mode_of_payments = [x["parent"] for x in frappe.db.get_list("Mode of Payment Account", filters={"default_account": bank_account}, fields=["parent"])]
|
|
||||||
company_currency = get_company_currency(company)
|
company_currency = get_company_currency(company)
|
||||||
|
|
||||||
expense_claims = frappe.get_all("Expense Claim", fields=["'Expense Claim' as doctype", "name", "total_sanctioned_amount as paid_amount",
|
expense_claims = frappe.get_all("Expense Claim",
|
||||||
"employee as party", "posting_date", "'{0}' as currency".format(company_currency)], filters=[["total_sanctioned_amount", "like", "{0}%".format(amount)],
|
fields=["'Expense Claim' as doctype", "name", "total_sanctioned_amount as paid_amount",
|
||||||
["docstatus", "=", "1"], ["is_paid", "=", "1"], ["ifnull(clearance_date, '')", "=", ""], ["mode_of_payment", "in", "{0}".format(tuple(mode_of_payments))]])
|
"employee as party", "posting_date", "'{0}' as currency".format(company_currency)],
|
||||||
|
filters=[
|
||||||
|
["total_sanctioned_amount", "like", "{0}%".format(amount)],
|
||||||
|
["docstatus", "=", "1"],
|
||||||
|
["is_paid", "=", "1"],
|
||||||
|
["ifnull(clearance_date, '')", "=", ""],
|
||||||
|
["mode_of_payment", "in", "{0}".format(tuple(mode_of_payments))]
|
||||||
|
]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
purchase_invoices = expense_claims = []
|
purchase_invoices = expense_claims = []
|
||||||
|
|
||||||
@@ -286,6 +294,34 @@ def get_matching_transactions_payments(description_matching):
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def payment_entry_query(doctype, txt, searchfield, start, page_len, filters):
|
||||||
|
account = frappe.db.get_value("Bank Account", filters.get("bank_account"), "account")
|
||||||
|
if not account:
|
||||||
|
return
|
||||||
|
|
||||||
|
return frappe.db.sql("""
|
||||||
|
SELECT
|
||||||
|
name, party, paid_amount, received_amount, reference_no
|
||||||
|
FROM
|
||||||
|
`tabPayment Entry`
|
||||||
|
WHERE
|
||||||
|
(clearance_date is null or clearance_date='0000-00-00')
|
||||||
|
AND (paid_from = %(account)s or paid_to = %(account)s)
|
||||||
|
AND (name like %(txt)s or party like %(txt)s)
|
||||||
|
AND docstatus = 1
|
||||||
|
ORDER BY
|
||||||
|
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999), name
|
||||||
|
LIMIT
|
||||||
|
%(start)s, %(page_len)s""",
|
||||||
|
{
|
||||||
|
'txt': "%%%s%%" % txt,
|
||||||
|
'_txt': txt.replace("%", ""),
|
||||||
|
'start': start,
|
||||||
|
'page_len': page_len,
|
||||||
|
'account': account
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def journal_entry_query(doctype, txt, searchfield, start, page_len, filters):
|
def journal_entry_query(doctype, txt, searchfield, start, page_len, filters):
|
||||||
account = frappe.db.get_value("Bank Account", filters.get("bank_account"), "account")
|
account = frappe.db.get_value("Bank Account", filters.get("bank_account"), "account")
|
||||||
|
|
||||||
|
|||||||
@@ -1186,7 +1186,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2019-01-30 11:28:10.324137",
|
"modified": "2019-01-31 11:28:10.324137",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Expense Claim",
|
"name": "Expense Claim",
|
||||||
|
|||||||
Reference in New Issue
Block a user