Merge pull request #25575 from rohitwaghchaure/fixed-stock-balance-report-and-batchwise-report
fix: stock balance and batch-wise balance history report showing different closing stock
This commit is contained in:
commit
8be414873b
@ -70,7 +70,7 @@ def get_stock_ledger_entries(filters):
|
|||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select item_code, batch_no, warehouse, posting_date, sum(actual_qty) as actual_qty
|
select item_code, batch_no, warehouse, posting_date, sum(actual_qty) as actual_qty
|
||||||
from `tabStock Ledger Entry`
|
from `tabStock Ledger Entry`
|
||||||
where docstatus < 2 and ifnull(batch_no, '') != '' %s
|
where is_cancelled = 0 and docstatus < 2 and ifnull(batch_no, '') != '' %s
|
||||||
group by voucher_no, batch_no, item_code, warehouse
|
group by voucher_no, batch_no, item_code, warehouse
|
||||||
order by item_code, warehouse""" %
|
order by item_code, warehouse""" %
|
||||||
conditions, as_dict=1)
|
conditions, as_dict=1)
|
||||||
|
@ -165,7 +165,7 @@ def get_stock_ledger_entries(filters, items):
|
|||||||
select
|
select
|
||||||
sle.item_code, warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate,
|
sle.item_code, warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate,
|
||||||
sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference,
|
sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference,
|
||||||
sle.item_code as name, sle.voucher_no, sle.stock_value
|
sle.item_code as name, sle.voucher_no, sle.stock_value, sle.batch_no
|
||||||
from
|
from
|
||||||
`tabStock Ledger Entry` sle force index (posting_sort_index)
|
`tabStock Ledger Entry` sle force index (posting_sort_index)
|
||||||
where sle.docstatus < 2 %s %s
|
where sle.docstatus < 2 %s %s
|
||||||
@ -193,7 +193,7 @@ def get_item_warehouse_map(filters, sle):
|
|||||||
|
|
||||||
qty_dict = iwb_map[(d.company, d.item_code, d.warehouse)]
|
qty_dict = iwb_map[(d.company, d.item_code, d.warehouse)]
|
||||||
|
|
||||||
if d.voucher_type == "Stock Reconciliation":
|
if d.voucher_type == "Stock Reconciliation" and not d.batch_no:
|
||||||
qty_diff = flt(d.qty_after_transaction) - flt(qty_dict.bal_qty)
|
qty_diff = flt(d.qty_after_transaction) - flt(qty_dict.bal_qty)
|
||||||
else:
|
else:
|
||||||
qty_diff = flt(d.actual_qty)
|
qty_diff = flt(d.actual_qty)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user