mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 18:21:22 +00:00
@@ -37,12 +37,15 @@ class AccountsReceivableReport(object):
|
|||||||
return columns
|
return columns
|
||||||
|
|
||||||
def get_data(self, customer_naming_by):
|
def get_data(self, customer_naming_by):
|
||||||
|
from accounts.utils import get_currency_precision
|
||||||
|
currency_precision = get_currency_precision() or 2
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
future_vouchers = self.get_entries_after(self.filters.report_date)
|
future_vouchers = self.get_entries_after(self.filters.report_date)
|
||||||
for gle in self.get_entries_till(self.filters.report_date):
|
for gle in self.get_entries_till(self.filters.report_date):
|
||||||
if self.is_receivable(gle, future_vouchers):
|
if self.is_receivable(gle, future_vouchers):
|
||||||
outstanding_amount = self.get_outstanding_amount(gle, self.filters.report_date)
|
outstanding_amount = self.get_outstanding_amount(gle, self.filters.report_date)
|
||||||
if abs(outstanding_amount) > 0.0:
|
if abs(outstanding_amount) > 0.1/10**currency_precision:
|
||||||
due_date = self.get_due_date(gle)
|
due_date = self.get_due_date(gle)
|
||||||
invoiced_amount = gle.debit if (gle.debit > 0) else 0
|
invoiced_amount = gle.debit if (gle.debit > 0) else 0
|
||||||
payment_received = invoiced_amount - outstanding_amount
|
payment_received = invoiced_amount - outstanding_amount
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ def get_gl_entries(filters):
|
|||||||
|
|
||||||
gl_entries = webnotes.conn.sql("""select posting_date, account,
|
gl_entries = webnotes.conn.sql("""select posting_date, account,
|
||||||
sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit,
|
sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit,
|
||||||
voucher_type, voucher_no, cost_center, remarks, is_advance, against
|
voucher_type, voucher_no, cost_center, remarks, is_opening, against
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where company=%(company)s {conditions}
|
where company=%(company)s {conditions}
|
||||||
{group_by_condition}
|
{group_by_condition}
|
||||||
|
|||||||
@@ -378,4 +378,13 @@ def get_account_for(account_for_doctype, account_for):
|
|||||||
account_for_field = "account_type"
|
account_for_field = "account_type"
|
||||||
|
|
||||||
return webnotes.conn.get_value("Account", {account_for_field: account_for_doctype,
|
return webnotes.conn.get_value("Account", {account_for_field: account_for_doctype,
|
||||||
"master_name": account_for})
|
"master_name": account_for})
|
||||||
|
|
||||||
|
def get_currency_precision(currency=None):
|
||||||
|
if not currency:
|
||||||
|
currency = webnotes.conn.get_value("Company",
|
||||||
|
webnotes.conn.get_default("company"), "default_currency")
|
||||||
|
currency_format = webnotes.conn.get_value("Currency", currency, "number_format")
|
||||||
|
|
||||||
|
from webnotes.utils import get_number_format_info
|
||||||
|
return get_number_format_info(currency_format)[2]
|
||||||
@@ -92,23 +92,19 @@ class DocType:
|
|||||||
exists for this warehouse."""))
|
exists for this warehouse."""))
|
||||||
|
|
||||||
def before_rename(self, olddn, newdn, merge=False):
|
def before_rename(self, olddn, newdn, merge=False):
|
||||||
# Add company abbr if not provided
|
|
||||||
from setup.doctype.company.company import get_name_with_abbr
|
|
||||||
new_warehouse = get_name_with_abbr(newdn, self.doc.company)
|
|
||||||
|
|
||||||
if merge:
|
if merge:
|
||||||
if not webnotes.conn.exists("Warehouse", newdn):
|
if not webnotes.conn.exists("Warehouse", newdn):
|
||||||
webnotes.throw(_("Warehouse ") + newdn +_(" does not exists"))
|
webnotes.throw(_("Warehouse ") + newdn +_(" does not exists"))
|
||||||
|
|
||||||
if self.doc.company != webnotes.conn.get_value("Warehouse", new_warehouse, "company"):
|
if self.doc.company != webnotes.conn.get_value("Warehouse", newdn, "company"):
|
||||||
webnotes.throw(_("Both Warehouse must belong to same Company"))
|
webnotes.throw(_("Both Warehouse must belong to same Company"))
|
||||||
|
|
||||||
webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
|
webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
|
||||||
|
|
||||||
from accounts.utils import rename_account_for
|
from accounts.utils import rename_account_for
|
||||||
rename_account_for("Warehouse", olddn, new_warehouse, merge)
|
rename_account_for("Warehouse", olddn, newdn, merge)
|
||||||
|
|
||||||
return new_warehouse
|
return newdn
|
||||||
|
|
||||||
def after_rename(self, olddn, newdn, merge=False):
|
def after_rename(self, olddn, newdn, merge=False):
|
||||||
if merge:
|
if merge:
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ def execute(filters=None):
|
|||||||
bom_rate = get_item_bom_rate()
|
bom_rate = get_item_bom_rate()
|
||||||
val_rate_map = get_valuation_rate()
|
val_rate_map = get_valuation_rate()
|
||||||
|
|
||||||
|
from accounts.utils import get_currency_precision
|
||||||
precision = get_currency_precision() or 2
|
precision = get_currency_precision() or 2
|
||||||
data = []
|
data = []
|
||||||
for item in sorted(item_map):
|
for item in sorted(item_map):
|
||||||
@@ -29,14 +30,6 @@ def execute(filters=None):
|
|||||||
])
|
])
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
def get_currency_precision():
|
|
||||||
company_currency = webnotes.conn.get_value("Company",
|
|
||||||
webnotes.conn.get_default("company"), "default_currency")
|
|
||||||
currency_format = webnotes.conn.get_value("Currency", company_currency, "number_format")
|
|
||||||
|
|
||||||
from webnotes.utils import get_number_format_info
|
|
||||||
return get_number_format_info(currency_format)[2]
|
|
||||||
|
|
||||||
def get_columns(filters):
|
def get_columns(filters):
|
||||||
"""return columns based on filters"""
|
"""return columns based on filters"""
|
||||||
|
|||||||
Reference in New Issue
Block a user