Beispiel #1
0
def get_stock_and_account_difference(account_list=None, posting_date=None):
    from erpnext.stock.utils import get_stock_balance_on

    if not posting_date:
        posting_date = nowdate()

    difference = {}

    account_warehouse = dict(
        frappe.db.sql(
            """select name, master_name from tabAccount
		where account_type = 'Warehouse' and ifnull(master_name, '') != ''
		and name in (%s)"""
            % ", ".join(["%s"] * len(account_list)),
            account_list,
        )
    )

    for account, warehouse in account_warehouse.items():
        account_balance = get_balance_on(account, posting_date)
        stock_value = get_stock_balance_on(warehouse, posting_date)
        if abs(flt(stock_value) - flt(account_balance)) > 0.005:
            difference.setdefault(account, flt(stock_value) - flt(account_balance))

    return difference
Beispiel #2
0
def get_stock_and_account_difference(account_list=None, posting_date=None):
	from erpnext.stock.utils import get_stock_balance_on

	if not posting_date: posting_date = nowdate()

	difference = {}

	account_warehouse = dict(frappe.db.sql("""select name, master_name from tabAccount
		where account_type = 'Warehouse' and ifnull(master_name, '') != ''
		and name in (%s)""" % ', '.join(['%s']*len(account_list)), account_list))

	for account, warehouse in account_warehouse.items():
		account_balance = get_balance_on(account, posting_date)
		stock_value = get_stock_balance_on(warehouse, posting_date)
		if abs(flt(stock_value) - flt(account_balance)) > 0.005:
			difference.setdefault(account, flt(stock_value) - flt(account_balance))

	return difference