Incoming rate in stock ledger and valuation rate in stock balance report. Fixes #1706
This commit is contained in:
parent
c3cbe2a30c
commit
732a7e81a0
@ -51,6 +51,8 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
|
|||||||
formatter: this.currency_formatter},
|
formatter: this.currency_formatter},
|
||||||
{id: "closing_value", name: __("Closing Value"), field: "closing_value", width: 100,
|
{id: "closing_value", name: __("Closing Value"), field: "closing_value", width: 100,
|
||||||
formatter: this.currency_formatter},
|
formatter: this.currency_formatter},
|
||||||
|
{id: "valuation_rate", name: __("Valuation Rate"), field: "valuation_rate", width: 100,
|
||||||
|
formatter: this.currency_formatter},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -142,6 +144,11 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
|
|||||||
$.each(me.item_by_name, function(key, item) {
|
$.each(me.item_by_name, function(key, item) {
|
||||||
item.closing_qty += item.opening_qty;
|
item.closing_qty += item.opening_qty;
|
||||||
item.closing_value += item.opening_value;
|
item.closing_value += item.opening_value;
|
||||||
|
|
||||||
|
// valuation rate
|
||||||
|
if(!item.is_group && flt(item.closing_qty) > 0)
|
||||||
|
item.valuation_rate = flt(item.closing_value) / flt(item.closing_qty);
|
||||||
|
else item.valuation_rate = 0.0
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -155,10 +162,8 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
|
|||||||
while(parent) {
|
while(parent) {
|
||||||
parent_group = me.item_by_name[parent];
|
parent_group = me.item_by_name[parent];
|
||||||
$.each(me.columns, function(c, col) {
|
$.each(me.columns, function(c, col) {
|
||||||
if (col.formatter == me.currency_formatter) {
|
if (col.formatter == me.currency_formatter && col.field != "valuation_rate") {
|
||||||
parent_group[col.field] =
|
parent_group[col.field] = flt(parent_group[col.field]) + flt(item[col.field]);
|
||||||
flt(parent_group[col.field])
|
|
||||||
+ flt(item[col.field]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -17,23 +17,25 @@ def execute(filters=None):
|
|||||||
% ("/".join(["#Form", sle.voucher_type, sle.voucher_no]),)
|
% ("/".join(["#Form", sle.voucher_type, sle.voucher_no]),)
|
||||||
|
|
||||||
data.append([sle.date, sle.item_code, item_detail.item_name, item_detail.item_group,
|
data.append([sle.date, sle.item_code, item_detail.item_name, item_detail.item_group,
|
||||||
item_detail.brand, item_detail.description, sle.warehouse, item_detail.stock_uom,
|
item_detail.brand, item_detail.description, sle.warehouse,
|
||||||
sle.actual_qty, sle.qty_after_transaction, sle.valuation_rate, sle.stock_value,
|
item_detail.stock_uom, sle.actual_qty, sle.qty_after_transaction,
|
||||||
sle.voucher_type, sle.voucher_no, voucher_link_icon, sle.batch_no, sle.serial_no, sle.company])
|
(sle.incoming_rate if sle.actual_qty > 0 else 0.0),
|
||||||
|
sle.valuation_rate, sle.stock_value, sle.voucher_type, sle.voucher_no,
|
||||||
|
voucher_link_icon, sle.batch_no, sle.serial_no, sle.company])
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
return ["Date:Datetime:95", "Item:Link/Item:130", "Item Name::100",
|
return ["Date:Datetime:95", "Item:Link/Item:130", "Item Name::100", "Item Group:Link/Item Group:100",
|
||||||
"Item Group:Link/Item Group:100", "Brand:Link/Brand:100",
|
"Brand:Link/Brand:100", "Description::200", "Warehouse:Link/Warehouse:100",
|
||||||
"Description::200", "Warehouse:Link/Warehouse:100",
|
"Stock UOM:Link/UOM:100", "Qty:Float:50", "Balance Qty:Float:100",
|
||||||
"Stock UOM:Link/UOM:100", "Qty:Float:50", "Balance Qty:Float:100", "Valuation Rate:Currency:110",
|
"Incoming Rate:Currency:110", "Valuation Rate:Currency:110", "Balance Value:Currency:110",
|
||||||
"Balance Value:Currency:110", "Voucher Type::110", "Voucher #::100", "Link::30",
|
"Voucher Type::110", "Voucher #::100", "Link::30", "Batch:Link/Batch:100",
|
||||||
"Batch:Link/Batch:100", "Serial #:Link/Serial No:100", "Company:Link/Company:100"]
|
"Serial #:Link/Serial No:100", "Company:Link/Company:100"]
|
||||||
|
|
||||||
def get_stock_ledger_entries(filters):
|
def get_stock_ledger_entries(filters):
|
||||||
return frappe.db.sql("""select concat_ws(" ", posting_date, posting_time) as date,
|
return frappe.db.sql("""select concat_ws(" ", posting_date, posting_time) as date,
|
||||||
item_code, warehouse, actual_qty, qty_after_transaction, valuation_rate,
|
item_code, warehouse, actual_qty, qty_after_transaction, incoming_rate, valuation_rate,
|
||||||
stock_value, voucher_type, voucher_no, batch_no, serial_no, company
|
stock_value, voucher_type, voucher_no, batch_no, serial_no, company
|
||||||
from `tabStock Ledger Entry`
|
from `tabStock Ledger Entry`
|
||||||
where company = %(company)s and
|
where company = %(company)s and
|
||||||
|
Loading…
Reference in New Issue
Block a user