brotherton-erpnext/erpnext/accounts/report/gross_profit/gross_profit.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.7 KiB
JavaScript
Raw Normal View History

// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
2014-02-14 10:17:51 +00:00
frappe.query_reports["Gross Profit"] = {
"filters": [
{
"fieldname":"company",
2014-04-14 10:55:30 +00:00
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
},
2013-03-22 07:46:10 +00:00
{
"fieldname":"from_date",
2014-04-14 10:55:30 +00:00
"label": __("From Date"),
2013-03-22 07:46:10 +00:00
"fieldtype": "Date",
"default": frappe.defaults.get_user_default("year_start_date"),
"reqd": 1
2013-03-22 07:46:10 +00:00
},
{
"fieldname":"to_date",
2014-04-14 10:55:30 +00:00
"label": __("To Date"),
2013-03-22 07:46:10 +00:00
"fieldtype": "Date",
"default": frappe.defaults.get_user_default("year_end_date"),
"reqd": 1
2013-03-22 07:46:10 +00:00
},
{
"fieldname":"sales_invoice",
"label": __("Sales Invoice"),
"fieldtype": "Link",
"options": "Sales Invoice"
},
{
"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-19 20:49:18 +00:00
],
"tree": true,
"name_field": "parent",
"parent_field": "parent_invoice",
2021-08-20 00:36:47 +00:00
"initial_depth": 3,
2021-08-19 21:08:34 +00:00
"formatter": function(value, row, column, data, default_formatter) {
if (column.fieldname == "sales_invoice" && column.options == "Item" && data.indent == 0) {
column._options = "Sales Invoice";
} else {
column._options = "Item";
}
2021-08-19 21:08:34 +00:00
value = default_formatter(value, row, column, data);
2021-11-15 21:52:04 +00:00
if (data && (data.indent == 0.0 || row[1].content == "Total")) {
2021-08-19 21:08:34 +00:00
value = $(`<span>${value}</span>`);
var $value = $(value).css("font-weight", "bold");
value = $value.wrap("<p></p>").parent().html();
}
return value;
},
}