2015-03-03 09:25:30 +00:00
|
|
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
|
2014-10-10 12:32:23 +00:00
|
|
|
// For license information, please see license.txt
|
2013-08-05 09:29:54 +00:00
|
|
|
|
2014-10-10 12:32:23 +00:00
|
|
|
frappe.query_reports["Stock Balance"] = {
|
2013-06-05 06:06:24 +00:00
|
|
|
"filters": [
|
2020-04-30 18:31:37 +00:00
|
|
|
{
|
|
|
|
"fieldname": "company",
|
|
|
|
"label": __("Company"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"width": "80",
|
|
|
|
"options": "Company",
|
|
|
|
"default": frappe.defaults.get_default("company")
|
|
|
|
},
|
2013-06-05 06:06:24 +00:00
|
|
|
{
|
|
|
|
"fieldname":"from_date",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("From Date"),
|
2013-06-05 06:06:24 +00:00
|
|
|
"fieldtype": "Date",
|
|
|
|
"width": "80",
|
2016-11-16 05:46:44 +00:00
|
|
|
"reqd": 1,
|
2018-04-12 07:55:03 +00:00
|
|
|
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
|
2013-06-05 06:06:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"to_date",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("To Date"),
|
2013-06-05 06:06:24 +00:00
|
|
|
"fieldtype": "Date",
|
|
|
|
"width": "80",
|
2016-11-16 05:46:44 +00:00
|
|
|
"reqd": 1,
|
2014-02-14 10:17:51 +00:00
|
|
|
"default": frappe.datetime.get_today()
|
2015-02-18 14:21:48 +00:00
|
|
|
},
|
2018-06-20 12:11:29 +00:00
|
|
|
{
|
2020-04-30 08:26:49 +00:00
|
|
|
"fieldname": "item_group",
|
|
|
|
"label": __("Item Group"),
|
2018-06-20 12:11:29 +00:00
|
|
|
"fieldtype": "Link",
|
2020-04-30 08:26:49 +00:00
|
|
|
"width": "80",
|
|
|
|
"options": "Item Group"
|
2018-06-20 12:11:29 +00:00
|
|
|
},
|
2015-02-18 14:21:48 +00:00
|
|
|
{
|
|
|
|
"fieldname": "item_code",
|
|
|
|
"label": __("Item"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"width": "80",
|
2018-04-12 07:55:03 +00:00
|
|
|
"options": "Item",
|
|
|
|
"get_query": function() {
|
|
|
|
return {
|
2019-06-12 13:39:51 +00:00
|
|
|
query: "erpnext.controllers.queries.item_query",
|
2019-09-16 14:27:04 +00:00
|
|
|
};
|
2018-04-12 07:55:03 +00:00
|
|
|
}
|
2016-03-07 07:41:59 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "warehouse",
|
|
|
|
"label": __("Warehouse"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"width": "80",
|
2019-05-22 05:59:01 +00:00
|
|
|
"options": "Warehouse",
|
|
|
|
get_query: () => {
|
2021-09-12 11:08:18 +00:00
|
|
|
let warehouse_type = frappe.query_report.get_filter_value("warehouse_type");
|
|
|
|
let company = frappe.query_report.get_filter_value("company");
|
|
|
|
|
|
|
|
return {
|
|
|
|
filters: {
|
|
|
|
...warehouse_type && {warehouse_type},
|
|
|
|
...company && {company}
|
|
|
|
}
|
2019-05-22 05:59:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "warehouse_type",
|
|
|
|
"label": __("Warehouse Type"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"width": "80",
|
|
|
|
"options": "Warehouse Type"
|
2016-03-07 07:41:59 +00:00
|
|
|
},
|
2018-10-18 12:29:47 +00:00
|
|
|
{
|
|
|
|
"fieldname":"include_uom",
|
|
|
|
"label": __("Include UOM"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "UOM"
|
|
|
|
},
|
2017-10-22 21:58:44 +00:00
|
|
|
{
|
2017-11-15 09:13:06 +00:00
|
|
|
"fieldname": "show_variant_attributes",
|
|
|
|
"label": __("Show Variant Attributes"),
|
2017-10-22 21:58:44 +00:00
|
|
|
"fieldtype": "Check"
|
|
|
|
},
|
2019-09-16 14:27:04 +00:00
|
|
|
{
|
|
|
|
"fieldname": 'show_stock_ageing_data',
|
|
|
|
"label": __('Show Stock Ageing Data'),
|
|
|
|
"fieldtype": 'Check'
|
|
|
|
},
|
2020-04-30 08:26:49 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
"formatter": function (value, row, column, data, default_formatter) {
|
|
|
|
value = default_formatter(value, row, column, data);
|
|
|
|
|
|
|
|
if (column.fieldname == "out_qty" && data && data.out_qty > 0) {
|
|
|
|
value = "<span style='color:red'>" + value + "</span>";
|
|
|
|
}
|
|
|
|
else if (column.fieldname == "in_qty" && data && data.in_qty > 0) {
|
|
|
|
value = "<span style='color:green'>" + value + "</span>";
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
2019-09-16 14:27:04 +00:00
|
|
|
};
|
2022-06-22 06:54:08 +00:00
|
|
|
|
|
|
|
erpnext.utils.add_inventory_dimensions('Stock Balance', 8);
|