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