0dafa8a12a
undefined Issue (cherry picked from commit f38004219518e901eb736780b181c19fe88ce823) Co-authored-by: smehata <53169014+smehata@users.noreply.github.com>
99 lines
2.2 KiB
JavaScript
99 lines
2.2 KiB
JavaScript
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
frappe.query_reports["Stock Ledger"] = {
|
|
"filters": [
|
|
{
|
|
"fieldname":"company",
|
|
"label": __("Company"),
|
|
"fieldtype": "Link",
|
|
"options": "Company",
|
|
"default": frappe.defaults.get_user_default("Company"),
|
|
"reqd": 1
|
|
},
|
|
{
|
|
"fieldname":"from_date",
|
|
"label": __("From Date"),
|
|
"fieldtype": "Date",
|
|
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
|
|
"reqd": 1
|
|
},
|
|
{
|
|
"fieldname":"to_date",
|
|
"label": __("To Date"),
|
|
"fieldtype": "Date",
|
|
"default": frappe.datetime.get_today(),
|
|
"reqd": 1
|
|
},
|
|
{
|
|
"fieldname":"warehouse",
|
|
"label": __("Warehouse"),
|
|
"fieldtype": "Link",
|
|
"options": "Warehouse",
|
|
"get_query": function() {
|
|
const company = frappe.query_report.get_filter_value('company');
|
|
return {
|
|
filters: { 'company': company }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"fieldname":"item_code",
|
|
"label": __("Item"),
|
|
"fieldtype": "Link",
|
|
"options": "Item",
|
|
"get_query": function() {
|
|
return {
|
|
query: "erpnext.controllers.queries.item_query"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"fieldname":"item_group",
|
|
"label": __("Item Group"),
|
|
"fieldtype": "Link",
|
|
"options": "Item Group"
|
|
},
|
|
{
|
|
"fieldname":"batch_no",
|
|
"label": __("Batch No"),
|
|
"fieldtype": "Link",
|
|
"options": "Batch"
|
|
},
|
|
{
|
|
"fieldname":"brand",
|
|
"label": __("Brand"),
|
|
"fieldtype": "Link",
|
|
"options": "Brand"
|
|
},
|
|
{
|
|
"fieldname":"voucher_no",
|
|
"label": __("Voucher #"),
|
|
"fieldtype": "Data"
|
|
},
|
|
{
|
|
"fieldname":"project",
|
|
"label": __("Project"),
|
|
"fieldtype": "Link",
|
|
"options": "Project"
|
|
},
|
|
{
|
|
"fieldname":"include_uom",
|
|
"label": __("Include UOM"),
|
|
"fieldtype": "Link",
|
|
"options": "UOM"
|
|
}
|
|
],
|
|
"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;
|
|
},
|
|
}
|