2015-03-03 09:25:30 +00:00
|
|
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2013-08-05 09:29:54 +00:00
|
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
|
2014-02-14 10:17:51 +00:00
|
|
|
frappe.query_reports["Accounts Payable"] = {
|
2013-04-23 10:06:26 +00:00
|
|
|
"filters": [
|
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "company",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Company"),
|
2013-04-23 10:06:26 +00:00
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Company",
|
2019-07-01 06:24:11 +00:00
|
|
|
"reqd": 1,
|
2015-12-23 11:07:00 +00:00
|
|
|
"default": frappe.defaults.get_user_default("Company")
|
2013-04-23 10:06:26 +00:00
|
|
|
},
|
2020-03-02 13:40:29 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "report_date",
|
2020-03-02 13:40:29 +00:00
|
|
|
"label": __("Posting Date"),
|
|
|
|
"fieldtype": "Date",
|
|
|
|
"default": frappe.datetime.get_today()
|
|
|
|
},
|
2018-12-10 12:26:42 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "finance_book",
|
2018-12-10 12:26:42 +00:00
|
|
|
"label": __("Finance Book"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Finance Book"
|
|
|
|
},
|
2019-03-18 06:23:04 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "cost_center",
|
2019-03-18 06:23:04 +00:00
|
|
|
"label": __("Cost Center"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Cost Center",
|
|
|
|
get_query: () => {
|
|
|
|
var company = frappe.query_report.get_filter_value('company');
|
|
|
|
return {
|
|
|
|
filters: {
|
|
|
|
'company': company
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-12-10 12:26:42 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "supplier",
|
2018-12-10 12:26:42 +00:00
|
|
|
"label": __("Supplier"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Supplier",
|
|
|
|
on_change: () => {
|
|
|
|
var supplier = frappe.query_report.get_filter_value('supplier');
|
|
|
|
if (supplier) {
|
|
|
|
frappe.db.get_value('Supplier', supplier, "tax_id", function(value) {
|
|
|
|
frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
frappe.query_report.set_filter_value('tax_id', "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-03-30 09:30:16 +00:00
|
|
|
{
|
|
|
|
"fieldname": "party_account",
|
|
|
|
"label": __("Payable Account"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Account",
|
|
|
|
get_query: () => {
|
|
|
|
var company = frappe.query_report.get_filter_value('company');
|
|
|
|
return {
|
|
|
|
filters: {
|
|
|
|
'company': company,
|
|
|
|
'account_type': 'Payable',
|
|
|
|
'is_group': 0
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
2020-07-10 05:55:39 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "ageing_based_on",
|
2020-07-10 05:55:39 +00:00
|
|
|
"label": __("Ageing Based On"),
|
|
|
|
"fieldtype": "Select",
|
|
|
|
"options": 'Posting Date\nDue Date\nSupplier Invoice Date',
|
|
|
|
"default": "Due Date"
|
|
|
|
},
|
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "range1",
|
2020-07-10 05:55:39 +00:00
|
|
|
"label": __("Ageing Range 1"),
|
|
|
|
"fieldtype": "Int",
|
|
|
|
"default": "30",
|
|
|
|
"reqd": 1
|
|
|
|
},
|
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "range2",
|
2020-07-10 05:55:39 +00:00
|
|
|
"label": __("Ageing Range 2"),
|
|
|
|
"fieldtype": "Int",
|
|
|
|
"default": "60",
|
|
|
|
"reqd": 1
|
|
|
|
},
|
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "range3",
|
2020-07-10 05:55:39 +00:00
|
|
|
"label": __("Ageing Range 3"),
|
|
|
|
"fieldtype": "Int",
|
|
|
|
"default": "90",
|
|
|
|
"reqd": 1
|
|
|
|
},
|
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "range4",
|
2020-07-10 05:55:39 +00:00
|
|
|
"label": __("Ageing Range 4"),
|
|
|
|
"fieldtype": "Int",
|
|
|
|
"default": "120",
|
|
|
|
"reqd": 1
|
|
|
|
},
|
2019-07-15 20:22:03 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "payment_terms_template",
|
2019-07-15 20:22:03 +00:00
|
|
|
"label": __("Payment Terms Template"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Payment Terms Template"
|
|
|
|
},
|
2018-12-10 12:26:42 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "supplier_group",
|
2018-12-10 12:26:42 +00:00
|
|
|
"label": __("Supplier Group"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Supplier Group"
|
|
|
|
},
|
2020-02-18 10:37:34 +00:00
|
|
|
{
|
|
|
|
"fieldname": "group_by_party",
|
|
|
|
"label": __("Group By Supplier"),
|
|
|
|
"fieldtype": "Check"
|
|
|
|
},
|
2019-11-29 11:26:27 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "based_on_payment_terms",
|
2019-11-29 11:26:27 +00:00
|
|
|
"label": __("Based On Payment Terms"),
|
|
|
|
"fieldtype": "Check",
|
|
|
|
},
|
2018-03-23 09:34:37 +00:00
|
|
|
{
|
2021-09-09 06:27:29 +00:00
|
|
|
"fieldname": "show_remarks",
|
|
|
|
"label": __("Show Remarks"),
|
|
|
|
"fieldtype": "Check",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "tax_id",
|
2018-03-23 09:34:37 +00:00
|
|
|
"label": __("Tax Id"),
|
|
|
|
"fieldtype": "Data",
|
|
|
|
"hidden": 1
|
2022-06-08 12:06:42 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "show_future_payments",
|
|
|
|
"label": __("Show Future Payments"),
|
|
|
|
"fieldtype": "Check",
|
2013-04-23 10:06:26 +00:00
|
|
|
}
|
2017-01-03 10:59:41 +00:00
|
|
|
],
|
2020-02-18 10:37:34 +00:00
|
|
|
|
|
|
|
"formatter": function(value, row, column, data, default_formatter) {
|
|
|
|
value = default_formatter(value, row, column, data);
|
|
|
|
if (data && data.bold) {
|
|
|
|
value = value.bold();
|
|
|
|
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
},
|
|
|
|
|
2017-01-03 10:59:41 +00:00
|
|
|
onload: function(report) {
|
|
|
|
report.page.add_inner_button(__("Accounts Payable Summary"), function() {
|
|
|
|
var filters = report.get_values();
|
|
|
|
frappe.set_route('query-report', 'Accounts Payable Summary', {company: filters.company});
|
|
|
|
});
|
|
|
|
}
|
2014-04-25 13:05:45 +00:00
|
|
|
}
|
2019-07-07 15:54:45 +00:00
|
|
|
|
2020-05-26 13:53:45 +00:00
|
|
|
erpnext.utils.add_dimensions('Accounts Payable', 9);
|