item-wise price list rate, editable report

This commit is contained in:
Nabin Hait
2013-09-25 10:32:51 +05:30
parent 04a3feecf6
commit 625da79e9f
16 changed files with 63 additions and 80 deletions

View File

@@ -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 = {}