mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 21:19:19 +00:00
item-wise price list rate, editable report
This commit is contained in:
@@ -10,26 +10,24 @@ from webnotes.utils.email_lib import sendmail
|
||||
|
||||
class UserNotAllowedForWarehouse(webnotes.ValidationError): pass
|
||||
|
||||
def get_stock_balance_on(warehouse_list, posting_date=None):
|
||||
def get_stock_balance_on(warehouse, posting_date=None):
|
||||
if not posting_date: posting_date = nowdate()
|
||||
|
||||
stock_ledger_entries = webnotes.conn.sql("""
|
||||
SELECT
|
||||
item_code, warehouse, stock_value
|
||||
item_code, stock_value
|
||||
FROM
|
||||
`tabStock Ledger Entry`
|
||||
WHERE
|
||||
warehouse in (%s)
|
||||
AND posting_date <= %s
|
||||
warehouse=%s AND posting_date <= %s
|
||||
ORDER BY timestamp(posting_date, posting_time) DESC, name DESC
|
||||
""" % (', '.join(['%s']*len(warehouse_list)), '%s'),
|
||||
tuple(warehouse_list + [posting_date]), as_dict=1)
|
||||
""", (warehouse, posting_date), as_dict=1)
|
||||
|
||||
sle_map = {}
|
||||
for sle in stock_ledger_entries:
|
||||
sle_map.setdefault(sle.warehouse, {}).setdefault(sle.item_code, flt(sle.stock_value))
|
||||
sle_map.setdefault(sle.item_code, flt(sle.stock_value))
|
||||
|
||||
return sum([sum(item_dict.values()) for item_dict in sle_map.values()])
|
||||
return sum(sle_map.values())
|
||||
|
||||
def get_latest_stock_balance():
|
||||
bin_map = {}
|
||||
|
||||
Reference in New Issue
Block a user