2015-03-03 14:55:30 +05:30
|
|
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2013-08-05 14:59:54 +05:30
|
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
|
2014-02-14 15:47:51 +05:30
|
|
|
frappe.query_reports["Gross Profit"] = {
|
2013-02-25 18:17:51 +05:30
|
|
|
"filters": [
|
|
|
|
{
|
2022-09-04 13:15:59 +05:30
|
|
|
"fieldname": "company",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("Company"),
|
2013-02-25 18:17:51 +05:30
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Company",
|
2022-02-10 13:07:51 +05:30
|
|
|
"default": frappe.defaults.get_user_default("Company"),
|
|
|
|
"reqd": 1
|
2013-03-21 20:24:10 +05:30
|
|
|
},
|
2013-03-22 13:16:10 +05:30
|
|
|
{
|
2022-09-04 13:15:59 +05:30
|
|
|
"fieldname": "from_date",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("From Date"),
|
2013-03-22 13:16:10 +05:30
|
|
|
"fieldtype": "Date",
|
2023-07-27 21:03:32 +05:30
|
|
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
|
2022-02-10 13:07:51 +05:30
|
|
|
"reqd": 1
|
2013-03-22 13:16:10 +05:30
|
|
|
},
|
|
|
|
{
|
2022-09-04 13:15:59 +05:30
|
|
|
"fieldname": "to_date",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("To Date"),
|
2013-03-22 13:16:10 +05:30
|
|
|
"fieldtype": "Date",
|
2023-07-27 21:03:32 +05:30
|
|
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
|
2022-02-10 13:07:51 +05:30
|
|
|
"reqd": 1
|
2013-03-22 13:16:10 +05:30
|
|
|
},
|
2019-04-23 18:33:01 +05:30
|
|
|
{
|
2022-09-04 13:15:59 +05:30
|
|
|
"fieldname": "sales_invoice",
|
2019-04-23 18:33:01 +05:30
|
|
|
"label": __("Sales Invoice"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Sales Invoice"
|
|
|
|
},
|
2014-11-24 15:12:37 +05:30
|
|
|
{
|
2022-09-04 13:15:59 +05:30
|
|
|
"fieldname": "group_by",
|
2014-11-24 15:12:37 +05:30
|
|
|
"label": __("Group By"),
|
|
|
|
"fieldtype": "Select",
|
2022-05-31 10:46:56 -03:00
|
|
|
"options": "Invoice\nItem Code\nItem Group\nBrand\nWarehouse\nCustomer\nCustomer Group\nTerritory\nSales Person\nProject\nMonthly\nPayment Term",
|
2014-11-24 15:12:37 +05:30
|
|
|
"default": "Invoice"
|
|
|
|
},
|
2022-08-15 09:14:23 -03:00
|
|
|
{
|
2022-09-04 13:15:59 +05:30
|
|
|
"fieldname": "item_group",
|
2022-08-15 09:14:23 -03:00
|
|
|
"label": __("Item Group"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Item Group"
|
|
|
|
},
|
|
|
|
{
|
2022-09-04 13:15:59 +05:30
|
|
|
"fieldname": "sales_person",
|
2022-08-15 09:14:23 -03:00
|
|
|
"label": __("Sales Person"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Sales Person"
|
|
|
|
},
|
2023-02-01 18:44:15 +05:30
|
|
|
{
|
|
|
|
"fieldname": "warehouse",
|
|
|
|
"label": __("Warehouse"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Warehouse",
|
|
|
|
"get_query": function () {
|
|
|
|
var company = frappe.query_report.get_filter_value('company');
|
|
|
|
return {
|
|
|
|
filters: [
|
|
|
|
["Warehouse", "company", "=", company]
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
2021-08-20 02:19:18 +05:30
|
|
|
],
|
|
|
|
"tree": true,
|
|
|
|
"name_field": "parent",
|
|
|
|
"parent_field": "parent_invoice",
|
2021-08-20 06:06:47 +05:30
|
|
|
"initial_depth": 3,
|
2021-08-20 02:38:34 +05:30
|
|
|
"formatter": function(value, row, column, data, default_formatter) {
|
2022-08-03 02:51:30 -03:00
|
|
|
if (column.fieldname == "sales_invoice" && column.options == "Item" && data && data.indent == 0) {
|
2022-02-11 12:32:45 +05:30
|
|
|
column._options = "Sales Invoice";
|
|
|
|
} else {
|
2023-04-27 15:04:50 +05:30
|
|
|
column._options = "";
|
2022-02-11 12:32:45 +05:30
|
|
|
}
|
2021-08-20 02:38:34 +05:30
|
|
|
value = default_formatter(value, row, column, data);
|
|
|
|
|
2022-08-03 02:51:30 -03:00
|
|
|
if (data && (data.indent == 0.0 || (row[1] && row[1].content == "Total"))) {
|
2021-08-20 02:38:34 +05:30
|
|
|
value = $(`<span>${value}</span>`);
|
|
|
|
var $value = $(value).css("font-weight", "bold");
|
|
|
|
value = $value.wrap("<p></p>").parent().html();
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
},
|
2014-11-24 15:12:37 +05:30
|
|
|
}
|