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 Receivable"] = {
|
2013-04-22 07:44:52 +00:00
|
|
|
"filters": [
|
|
|
|
{
|
|
|
|
"fieldname":"company",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Company"),
|
2013-04-22 07:44:52 +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-22 07:44:52 +00:00
|
|
|
},
|
2018-12-10 12:26:42 +00:00
|
|
|
{
|
|
|
|
"fieldname":"ageing_based_on",
|
|
|
|
"label": __("Ageing Based On"),
|
|
|
|
"fieldtype": "Select",
|
|
|
|
"options": 'Posting Date\nDue Date',
|
|
|
|
"default": "Posting Date"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"report_date",
|
|
|
|
"label": __("As on Date"),
|
|
|
|
"fieldtype": "Date",
|
|
|
|
"default": frappe.datetime.get_today()
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"range1",
|
|
|
|
"label": __("Ageing Range 1"),
|
|
|
|
"fieldtype": "Int",
|
|
|
|
"default": "30",
|
|
|
|
"reqd": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"range2",
|
|
|
|
"label": __("Ageing Range 2"),
|
|
|
|
"fieldtype": "Int",
|
|
|
|
"default": "60",
|
|
|
|
"reqd": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"range3",
|
|
|
|
"label": __("Ageing Range 3"),
|
|
|
|
"fieldtype": "Int",
|
|
|
|
"default": "90",
|
|
|
|
"reqd": 1
|
2019-05-23 09:57:47 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"range4",
|
|
|
|
"label": __("Ageing Range 4"),
|
|
|
|
"fieldtype": "Int",
|
|
|
|
"default": "120",
|
|
|
|
"reqd": 1
|
2018-12-10 12:26:42 +00:00
|
|
|
},
|
2018-04-22 21:26:50 +00:00
|
|
|
{
|
|
|
|
"fieldname":"finance_book",
|
|
|
|
"label": __("Finance Book"),
|
|
|
|
"fieldtype": "Link",
|
2018-05-09 09:40:29 +00:00
|
|
|
"options": "Finance Book"
|
2018-04-22 21:26:50 +00:00
|
|
|
},
|
2019-03-18 06:23:04 +00:00
|
|
|
{
|
|
|
|
"fieldname":"cost_center",
|
|
|
|
"label": __("Cost Center"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Cost Center",
|
|
|
|
get_query: () => {
|
|
|
|
var company = frappe.query_report.get_filter_value('company');
|
|
|
|
return {
|
|
|
|
filters: {
|
|
|
|
'company': company
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2013-04-22 07:44:52 +00:00
|
|
|
{
|
2014-09-11 13:57:24 +00:00
|
|
|
"fieldname":"customer",
|
|
|
|
"label": __("Customer"),
|
2013-04-22 07:44:52 +00:00
|
|
|
"fieldtype": "Link",
|
2018-03-23 09:34:37 +00:00
|
|
|
"options": "Customer",
|
|
|
|
on_change: () => {
|
2018-07-18 03:58:44 +00:00
|
|
|
var customer = frappe.query_report.get_filter_value('customer');
|
2018-12-10 12:26:42 +00:00
|
|
|
if (customer) {
|
|
|
|
frappe.db.get_value('Customer', customer, ["tax_id", "customer_name", "credit_limit", "payment_terms"], function(value) {
|
|
|
|
frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
|
|
|
|
frappe.query_report.set_filter_value('customer_name', value["customer_name"]);
|
|
|
|
frappe.query_report.set_filter_value('credit_limit', value["credit_limit"]);
|
|
|
|
frappe.query_report.set_filter_value('payment_terms', value["payment_terms"]);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
frappe.query_report.set_filter_value('tax_id', "");
|
|
|
|
frappe.query_report.set_filter_value('customer_name', "");
|
|
|
|
frappe.query_report.set_filter_value('credit_limit', "");
|
|
|
|
frappe.query_report.set_filter_value('payment_terms', "");
|
|
|
|
}
|
2018-03-23 09:34:37 +00:00
|
|
|
}
|
2013-04-22 07:44:52 +00:00
|
|
|
},
|
2017-04-24 11:33:50 +00:00
|
|
|
{
|
|
|
|
"fieldname":"customer_group",
|
|
|
|
"label": __("Customer Group"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Customer Group"
|
|
|
|
},
|
|
|
|
{
|
2018-01-09 10:09:35 +00:00
|
|
|
"fieldname":"payment_terms_template",
|
|
|
|
"label": __("Payment Terms Template"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Payment Terms Template"
|
2017-04-24 11:33:50 +00:00
|
|
|
},
|
2018-01-24 12:46:08 +00:00
|
|
|
{
|
|
|
|
"fieldname":"territory",
|
|
|
|
"label": __("Territory"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Territory"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"sales_partner",
|
|
|
|
"label": __("Sales Partner"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Sales Partner"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"sales_person",
|
|
|
|
"label": __("Sales Person"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Sales Person"
|
|
|
|
},
|
2019-04-01 10:54:23 +00:00
|
|
|
{
|
|
|
|
"fieldname":"based_on_payment_terms",
|
|
|
|
"label": __("Based On Payment Terms"),
|
|
|
|
"fieldtype": "Check",
|
|
|
|
},
|
2018-02-07 13:02:51 +00:00
|
|
|
{
|
|
|
|
"fieldname":"show_pdc_in_print",
|
|
|
|
"label": __("Show PDC in Print"),
|
|
|
|
"fieldtype": "Check",
|
2018-03-23 09:34:37 +00:00
|
|
|
},
|
2018-11-12 05:47:39 +00:00
|
|
|
{
|
2019-04-01 10:54:23 +00:00
|
|
|
"fieldname":"show_sales_person_in_print",
|
|
|
|
"label": __("Show Sales Person in Print"),
|
2018-11-12 05:47:39 +00:00
|
|
|
"fieldtype": "Check",
|
|
|
|
},
|
2018-03-23 09:34:37 +00:00
|
|
|
{
|
|
|
|
"fieldname":"tax_id",
|
|
|
|
"label": __("Tax Id"),
|
|
|
|
"fieldtype": "Data",
|
|
|
|
"hidden": 1
|
2018-04-30 14:10:18 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"customer_name",
|
|
|
|
"label": __("Customer Name"),
|
|
|
|
"fieldtype": "Data",
|
|
|
|
"hidden": 1
|
2018-12-10 12:26:42 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"payment_terms",
|
|
|
|
"label": __("Payment Tems"),
|
|
|
|
"fieldtype": "Data",
|
|
|
|
"hidden": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"credit_limit",
|
|
|
|
"label": __("Credit Limit"),
|
|
|
|
"fieldtype": "Currency",
|
|
|
|
"hidden": 1
|
2013-04-22 07:44:52 +00:00
|
|
|
}
|
2017-01-03 10:59:41 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
onload: function(report) {
|
|
|
|
report.page.add_inner_button(__("Accounts Receivable Summary"), function() {
|
|
|
|
var filters = report.get_values();
|
|
|
|
frappe.set_route('query-report', 'Accounts Receivable Summary', {company: filters.company});
|
|
|
|
});
|
|
|
|
}
|
2014-09-11 13:57:24 +00:00
|
|
|
}
|
2019-07-07 15:54:45 +00:00
|
|
|
|
2019-07-17 10:08:21 +00:00
|
|
|
frappe.boot.dimension_filters.forEach((dimension) => {
|
|
|
|
frappe.query_reports["Accounts Receivable"].filters.splice(9, 0 ,{
|
|
|
|
"fieldname": dimension["fieldname"],
|
|
|
|
"label": __(dimension["label"]),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": dimension["document_type"]
|
2019-07-07 15:54:45 +00:00
|
|
|
});
|
|
|
|
});
|
2019-07-17 10:08:21 +00:00
|
|
|
|