accounts receivable fixed
This commit is contained in:
parent
b4eba77f7b
commit
8a0b7cece1
@ -15,26 +15,28 @@ class AccountsReceivableReport(object):
|
|||||||
else self.filters.report_date
|
else self.filters.report_date
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
return self.get_columns(), self.get_data()
|
customer_naming_by = webnotes.conn.get_value("Selling Settings", None, "cust_master_name")
|
||||||
|
return self.get_columns(customer_naming_by), self.get_data(customer_naming_by)
|
||||||
|
|
||||||
def get_columns(self):
|
def get_columns(self, customer_naming_by):
|
||||||
columns = [
|
columns = [
|
||||||
"Posting Date:Date:80", "Account:Link/Account:150",
|
"Posting Date:Date:80", "Account:Link/Account:150",
|
||||||
"Voucher Type::110", "Voucher No::120", "::30",
|
"Voucher Type::110", "Voucher No::120", "::30",
|
||||||
"Due Date:Date:80",
|
"Due Date:Date:80",
|
||||||
"Invoiced Amount:Currency:100", "Payment Received:Currency:100",
|
"Invoiced Amount:Currency:100", "Payment Received:Currency:100",
|
||||||
"Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100",
|
"Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100",
|
||||||
"30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
|
"30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100",
|
||||||
|
"Customer:Link/Customer:200"
|
||||||
]
|
]
|
||||||
|
|
||||||
if self.get_customer_naming() == "Naming Series":
|
if customer_naming_by == "Naming Series":
|
||||||
columns += ["Customer:Link/Customer:200"]
|
columns += ["Customer Name::110"]
|
||||||
|
|
||||||
columns += ["Customer Name::110", "Territory:Link/Territory:80", "Remarks::200"]
|
columns += ["Territory:Link/Territory:80", "Remarks::200"]
|
||||||
|
|
||||||
return columns
|
return columns
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self, customer_naming_by):
|
||||||
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):
|
||||||
@ -50,23 +52,21 @@ class AccountsReceivableReport(object):
|
|||||||
outstanding_amount]
|
outstanding_amount]
|
||||||
entry_date = due_date if self.filters.ageing_based_on == "Due Date" \
|
entry_date = due_date if self.filters.ageing_based_on == "Due Date" \
|
||||||
else gle.posting_date
|
else gle.posting_date
|
||||||
row += get_ageing_data(self.age_as_on, entry_date, outstanding_amount)
|
row += get_ageing_data(self.age_as_on, entry_date, outstanding_amount) + \
|
||||||
|
[self.get_customer(gle.account)]
|
||||||
|
|
||||||
if self.get_customer_naming() == "Naming Series":
|
if customer_naming_by == "Naming Series":
|
||||||
row += [self.get_customer(gle.account)]
|
row += [self.get_customer_name(gle.account)]
|
||||||
|
|
||||||
row += [self.get_customer_name(gle.account), self.get_territory(gle.account), gle.remarks]
|
row += [self.get_territory(gle.account), gle.remarks]
|
||||||
data.append(row)
|
data.append(row)
|
||||||
|
|
||||||
for i in range(0,len(data)):
|
for i in range(0, len(data)):
|
||||||
data[i].insert(4, """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \
|
data[i].insert(4, """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \
|
||||||
% ("/".join(["#Form", data[i][2], data[i][3]]),))
|
% ("/".join(["#Form", data[i][2], data[i][3]]),))
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_customer_naming(self):
|
|
||||||
return webnotes.conn.get_value("Selling Settings", None, "cust_master_name")
|
|
||||||
|
|
||||||
def get_entries_after(self, report_date):
|
def get_entries_after(self, report_date):
|
||||||
# returns a distinct list
|
# returns a distinct list
|
||||||
return list(set([(e.voucher_type, e.voucher_no) for e in self.get_gl_entries()
|
return list(set([(e.voucher_type, e.voucher_no) for e in self.get_gl_entries()
|
||||||
@ -163,7 +163,7 @@ class AccountsReceivableReport(object):
|
|||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
return AccountsReceivableReport(filters).run()
|
return AccountsReceivableReport(filters).run()
|
||||||
|
|
||||||
def get_ageing_data(age_as_on, entry_date, outstanding_amount):
|
def get_ageing_data(age_as_on, entry_date, outstanding_amount):
|
||||||
# [0-30, 30-60, 60-90, 90-above]
|
# [0-30, 30-60, 60-90, 90-above]
|
||||||
outstanding_range = [0.0, 0.0, 0.0, 0.0]
|
outstanding_range = [0.0, 0.0, 0.0, 0.0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user