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": [
|
|
|
|
{
|
|
|
|
"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
|
|
|
{
|
|
|
|
"fieldname":"from_date",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("From Date"),
|
2013-03-22 13:16:10 +05:30
|
|
|
"fieldtype": "Date",
|
2022-02-10 13:07:51 +05:30
|
|
|
"default": frappe.defaults.get_user_default("year_start_date"),
|
|
|
|
"reqd": 1
|
2013-03-22 13:16:10 +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",
|
2022-02-10 13:07:51 +05:30
|
|
|
"default": frappe.defaults.get_user_default("year_end_date"),
|
|
|
|
"reqd": 1
|
2013-03-22 13:16:10 +05:30
|
|
|
},
|
2019-04-23 18:33:01 +05:30
|
|
|
{
|
|
|
|
"fieldname":"sales_invoice",
|
|
|
|
"label": __("Sales Invoice"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Sales Invoice"
|
|
|
|
},
|
2014-11-24 15:12:37 +05:30
|
|
|
{
|
|
|
|
"fieldname":"group_by",
|
|
|
|
"label": __("Group By"),
|
|
|
|
"fieldtype": "Select",
|
|
|
|
"options": "Invoice\nItem Code\nItem Group\nBrand\nWarehouse\nCustomer\nCustomer Group\nTerritory\nSales Person\nProject",
|
|
|
|
"default": "Invoice"
|
|
|
|
},
|
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-02-11 12:32:45 +05:30
|
|
|
if (column.fieldname == "sales_invoice" && column.options == "Item" && data.indent == 0) {
|
|
|
|
column._options = "Sales Invoice";
|
|
|
|
} else {
|
|
|
|
column._options = "Item";
|
|
|
|
}
|
2021-08-20 02:38:34 +05:30
|
|
|
value = default_formatter(value, row, column, data);
|
|
|
|
|
2021-11-16 03:22:04 +05:30
|
|
|
if (data && (data.indent == 0.0 || 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
|
|
|
}
|