-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbb9942
commit 83146c4
Showing
61 changed files
with
2,815 additions
and
5,005 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
159 changes: 159 additions & 0 deletions
159
erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors | ||
// For license information, please see license.txt | ||
frappe.provide("erpnext.accounts.bank_reconciliation"); | ||
|
||
frappe.ui.form.on("Bank Reconciliation Tool", { | ||
setup: function (frm) { | ||
frm.set_query("bank_account", function () { | ||
return { | ||
filters: { | ||
company: ["in", frm.doc.company], | ||
}, | ||
}; | ||
}); | ||
}, | ||
|
||
refresh: function (frm) { | ||
frappe.require("assets/js/bank-reconciliation-tool.min.js", () => | ||
frm.trigger("make_reconciliation_tool") | ||
); | ||
frm.upload_statement_button = frm.page.set_secondary_action( | ||
__("Upload Bank Statement"), | ||
() => | ||
frappe.call({ | ||
method: | ||
"erpnext.accounts.doctype.bank_statement_import.bank_statement_import.upload_bank_statement", | ||
args: { | ||
dt: me.frm.doc.doctype, | ||
dn: me.frm.doc.name, | ||
company: me.frm.doc.company, | ||
bank_account: me.frm.doc.bank_account, | ||
}, | ||
callback: function (r) { | ||
if (!r.exc) { | ||
var doc = frappe.model.sync(r.message); | ||
frappe.set_route( | ||
"Form", | ||
r.message.doctype, | ||
r.message.name | ||
); | ||
} | ||
}, | ||
}) | ||
); | ||
}, | ||
|
||
after_save: function (frm) { | ||
frm.trigger("make_reconciliation_tool"); | ||
}, | ||
|
||
bank_account: function (frm) { | ||
frappe.db.get_value( | ||
"Bank Account", | ||
frm.bank_account, | ||
"account", | ||
(r) => { | ||
frappe.db.get_value( | ||
"Account", | ||
r.account, | ||
"account_currency", | ||
(r) => { | ||
frm.currency = r.account_currency; | ||
} | ||
); | ||
} | ||
); | ||
frm.trigger("get_account_opening_balance"); | ||
}, | ||
|
||
bank_statement_from_date: function (frm) { | ||
frm.trigger("get_account_opening_balance"); | ||
}, | ||
|
||
make_reconciliation_tool(frm) { | ||
frm.get_field("reconciliation_tool_cards").$wrapper.empty(); | ||
if (frm.doc.bank_account && frm.doc.bank_statement_to_date) { | ||
frm.trigger("get_cleared_balance").then(() => { | ||
if ( | ||
frm.doc.bank_account && | ||
frm.doc.bank_statement_from_date && | ||
frm.doc.bank_statement_to_date && | ||
frm.doc.bank_statement_closing_balance | ||
) { | ||
frm.trigger("render_chart"); | ||
frm.trigger("render"); | ||
frappe.utils.scroll_to( | ||
frm.get_field("reconciliation_tool_cards").$wrapper, | ||
true, | ||
30 | ||
); | ||
} | ||
}); | ||
} | ||
}, | ||
|
||
get_account_opening_balance(frm) { | ||
if (frm.doc.bank_account && frm.doc.bank_statement_from_date) { | ||
frappe.call({ | ||
method: | ||
"erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_account_balance", | ||
args: { | ||
bank_account: frm.doc.bank_account, | ||
till_date: frm.doc.bank_statement_from_date, | ||
}, | ||
callback: (response) => { | ||
frm.set_value("account_opening_balance", response.message); | ||
}, | ||
}); | ||
} | ||
}, | ||
|
||
get_cleared_balance(frm) { | ||
if (frm.doc.bank_account && frm.doc.bank_statement_to_date) { | ||
return frappe.call({ | ||
method: | ||
"erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_account_balance", | ||
args: { | ||
bank_account: frm.doc.bank_account, | ||
till_date: frm.doc.bank_statement_to_date, | ||
}, | ||
callback: (response) => { | ||
frm.cleared_balance = response.message; | ||
}, | ||
}); | ||
} | ||
}, | ||
|
||
render_chart(frm) { | ||
frm.cards_manager = new erpnext.accounts.bank_reconciliation.NumberCardManager( | ||
{ | ||
$reconciliation_tool_cards: frm.get_field( | ||
"reconciliation_tool_cards" | ||
).$wrapper, | ||
bank_statement_closing_balance: | ||
frm.doc.bank_statement_closing_balance, | ||
cleared_balance: frm.cleared_balance, | ||
currency: frm.currency, | ||
} | ||
); | ||
}, | ||
|
||
render(frm) { | ||
if (frm.doc.bank_account) { | ||
frm.bank_reconciliation_data_table_manager = new erpnext.accounts.bank_reconciliation.DataTableManager( | ||
{ | ||
company: frm.doc.company, | ||
bank_account: frm.doc.bank_account, | ||
$reconciliation_tool_dt: frm.get_field( | ||
"reconciliation_tool_dt" | ||
).$wrapper, | ||
bank_statement_from_date: frm.doc.bank_statement_from_date, | ||
bank_statement_to_date: frm.doc.bank_statement_to_date, | ||
bank_statement_closing_balance: | ||
frm.doc.bank_statement_closing_balance, | ||
cards_manager: frm.cards_manager, | ||
} | ||
); | ||
} | ||
}, | ||
}); |
107 changes: 107 additions & 0 deletions
107
erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{ | ||
"actions": [], | ||
"creation": "2020-12-02 10:13:02.148040", | ||
"doctype": "DocType", | ||
"editable_grid": 1, | ||
"engine": "InnoDB", | ||
"field_order": [ | ||
"company", | ||
"bank_account", | ||
"column_break_1", | ||
"bank_statement_from_date", | ||
"bank_statement_to_date", | ||
"column_break_2", | ||
"account_opening_balance", | ||
"bank_statement_closing_balance", | ||
"section_break_1", | ||
"reconciliation_tool_cards", | ||
"reconciliation_tool_dt" | ||
], | ||
"fields": [ | ||
{ | ||
"fieldname": "company", | ||
"fieldtype": "Link", | ||
"label": "Company", | ||
"options": "Company" | ||
}, | ||
{ | ||
"fieldname": "bank_account", | ||
"fieldtype": "Link", | ||
"label": "Bank Account", | ||
"options": "Bank Account" | ||
}, | ||
{ | ||
"fieldname": "column_break_1", | ||
"fieldtype": "Column Break" | ||
}, | ||
{ | ||
"depends_on": "eval: doc.bank_account", | ||
"fieldname": "bank_statement_from_date", | ||
"fieldtype": "Date", | ||
"label": "Bank Statement From Date" | ||
}, | ||
{ | ||
"depends_on": "eval: doc.bank_statement_from_date", | ||
"fieldname": "bank_statement_to_date", | ||
"fieldtype": "Date", | ||
"label": "Bank Statement To Date" | ||
}, | ||
{ | ||
"fieldname": "column_break_2", | ||
"fieldtype": "Column Break" | ||
}, | ||
{ | ||
"depends_on": "eval: doc.bank_statement_from_date", | ||
"fieldname": "account_opening_balance", | ||
"fieldtype": "Currency", | ||
"label": "Account Opening Balance", | ||
"options": "Currency", | ||
"read_only": 1 | ||
}, | ||
{ | ||
"depends_on": "eval: doc.bank_statement_to_date", | ||
"fieldname": "bank_statement_closing_balance", | ||
"fieldtype": "Currency", | ||
"label": "Bank Statement Closing Balance", | ||
"options": "Currency" | ||
}, | ||
{ | ||
"depends_on": "eval: doc.bank_statement_closing_balance", | ||
"fieldname": "section_break_1", | ||
"fieldtype": "Section Break", | ||
"label": "Reconcile" | ||
}, | ||
{ | ||
"fieldname": "reconciliation_tool_cards", | ||
"fieldtype": "HTML" | ||
}, | ||
{ | ||
"fieldname": "reconciliation_tool_dt", | ||
"fieldtype": "HTML" | ||
} | ||
], | ||
"hide_toolbar": 1, | ||
"index_web_pages_for_search": 1, | ||
"issingle": 1, | ||
"links": [], | ||
"modified": "2020-12-02 10:45:03.322811", | ||
"modified_by": "Administrator", | ||
"module": "Accounts", | ||
"name": "Bank Reconciliation Tool", | ||
"owner": "Administrator", | ||
"permissions": [ | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"print": 1, | ||
"read": 1, | ||
"role": "System Manager", | ||
"share": 1, | ||
"write": 1 | ||
} | ||
], | ||
"quick_entry": 1, | ||
"sort_field": "modified", | ||
"sort_order": "DESC" | ||
} |
Oops, something went wrong.