2015-03-03 09:25:30 +00:00
|
|
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2013-11-29 13:45:26 +00:00
|
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
|
2014-02-14 10:17:51 +00:00
|
|
|
frappe.query_reports["Stock Ledger"] = {
|
2013-11-29 13:45:26 +00:00
|
|
|
"filters": [
|
|
|
|
{
|
|
|
|
"fieldname":"company",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Company"),
|
2013-11-29 13:45:26 +00:00
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Company",
|
2015-12-23 11:07:00 +00:00
|
|
|
"default": frappe.defaults.get_user_default("Company"),
|
2013-11-29 13:45:26 +00:00
|
|
|
"reqd": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"from_date",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("From Date"),
|
2013-11-29 13:45:26 +00:00
|
|
|
"fieldtype": "Date",
|
2014-02-14 10:17:51 +00:00
|
|
|
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
|
2013-11-29 13:45:26 +00:00
|
|
|
"reqd": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"to_date",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("To Date"),
|
2013-11-29 13:45:26 +00:00
|
|
|
"fieldtype": "Date",
|
2014-02-14 10:17:51 +00:00
|
|
|
"default": frappe.datetime.get_today(),
|
2013-11-29 13:45:26 +00:00
|
|
|
"reqd": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"warehouse",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Warehouse"),
|
2013-11-29 13:45:26 +00:00
|
|
|
"fieldtype": "Link",
|
2020-03-28 13:42:59 +00:00
|
|
|
"options": "Warehouse",
|
|
|
|
"get_query": function() {
|
|
|
|
const company = frappe.query_report.get_filter_value('company');
|
2020-04-30 05:08:58 +00:00
|
|
|
return {
|
2020-03-28 13:42:59 +00:00
|
|
|
filters: { 'company': company }
|
|
|
|
}
|
|
|
|
}
|
2013-11-29 13:45:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"item_code",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Item"),
|
2013-11-29 13:45:26 +00:00
|
|
|
"fieldtype": "Link",
|
2018-04-12 07:55:03 +00:00
|
|
|
"options": "Item",
|
|
|
|
"get_query": function() {
|
|
|
|
return {
|
|
|
|
query: "erpnext.controllers.queries.item_query"
|
|
|
|
}
|
|
|
|
}
|
2013-11-29 13:45:26 +00:00
|
|
|
},
|
2017-08-16 06:05:04 +00:00
|
|
|
{
|
|
|
|
"fieldname":"item_group",
|
|
|
|
"label": __("Item Group"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Item Group"
|
|
|
|
},
|
2017-04-20 09:51:01 +00:00
|
|
|
{
|
|
|
|
"fieldname":"batch_no",
|
|
|
|
"label": __("Batch No"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Batch"
|
|
|
|
},
|
2013-11-29 13:45:26 +00:00
|
|
|
{
|
|
|
|
"fieldname":"brand",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Brand"),
|
2013-11-29 13:45:26 +00:00
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Brand"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"voucher_no",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Voucher #"),
|
2013-11-29 13:45:26 +00:00
|
|
|
"fieldtype": "Data"
|
2018-03-21 12:22:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"project",
|
|
|
|
"label": __("Project"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Project"
|
2018-10-18 12:29:47 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"include_uom",
|
|
|
|
"label": __("Include UOM"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "UOM"
|
2020-04-30 05:08:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "show_cancelled_entries",
|
|
|
|
"label": __("Show Cancelled Entries"),
|
|
|
|
"fieldtype": "Check"
|
2013-11-29 13:45:26 +00:00
|
|
|
}
|
2019-11-27 11:28:06 +00:00
|
|
|
],
|
|
|
|
"formatter": function (value, row, column, data, default_formatter) {
|
|
|
|
value = default_formatter(value, row, column, data);
|
|
|
|
if (column.fieldname == "out_qty" && data.out_qty < 0) {
|
|
|
|
value = "<span style='color:red'>" + value + "</span>";
|
|
|
|
}
|
2020-01-28 10:34:49 +00:00
|
|
|
else if (column.fieldname == "in_qty" && data.in_qty > 0) {
|
|
|
|
value = "<span style='color:green'>" + value + "</span>";
|
|
|
|
}
|
2019-11-27 11:28:06 +00:00
|
|
|
|
|
|
|
return value;
|
|
|
|
},
|
2013-11-29 13:45:26 +00:00
|
|
|
}
|