[report] add total row
This commit is contained in:
parent
98cfe688a8
commit
84e2af2212
@ -19,7 +19,6 @@ def execute(filters=None):
|
|||||||
and nowdate() or filters.get("report_date")
|
and nowdate() or filters.get("report_date")
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
total_invoiced_amount = total_paid = total_outstanding = 0
|
|
||||||
for gle in entries:
|
for gle in entries:
|
||||||
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
|
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
|
||||||
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
|
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
|
||||||
@ -36,7 +35,7 @@ def execute(filters=None):
|
|||||||
paid_amount = get_paid_amount(gle, filters.get("report_date") or nowdate(),
|
paid_amount = get_paid_amount(gle, filters.get("report_date") or nowdate(),
|
||||||
entries_after_report_date)
|
entries_after_report_date)
|
||||||
outstanding_amount = invoiced_amount - paid_amount
|
outstanding_amount = invoiced_amount - paid_amount
|
||||||
|
|
||||||
if abs(flt(outstanding_amount)) > 0.01:
|
if abs(flt(outstanding_amount)) > 0.01:
|
||||||
row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no,
|
row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no,
|
||||||
gle.remarks, account_supplier_type_map.get(gle.account), due_date, bill_no,
|
gle.remarks, account_supplier_type_map.get(gle.account), due_date, bill_no,
|
||||||
@ -47,16 +46,9 @@ def execute(filters=None):
|
|||||||
ageing_based_on_date = due_date
|
ageing_based_on_date = due_date
|
||||||
else:
|
else:
|
||||||
ageing_based_on_date = gle.posting_date
|
ageing_based_on_date = gle.posting_date
|
||||||
|
|
||||||
row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
|
row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
|
||||||
|
|
||||||
# Add to total
|
|
||||||
total_invoiced_amount += flt(invoiced_amount)
|
|
||||||
total_paid += flt(paid_amount)
|
|
||||||
total_outstanding += flt(outstanding_amount)
|
|
||||||
data.append(row)
|
data.append(row)
|
||||||
if data:
|
|
||||||
data.append(["", "", "", "", "", "", "", "Total", "", total_invoiced_amount, total_paid,
|
|
||||||
total_outstanding, "", "", "", ""])
|
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-04-22 16:16:03",
|
"creation": "2013-04-22 16:16:03",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-04-23 14:54:27",
|
"modified": "2013-04-30 17:55:54",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"add_total_row": 1,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
|
@ -18,7 +18,6 @@ def execute(filters=None):
|
|||||||
and nowdate() or filters.get("report_date")
|
and nowdate() or filters.get("report_date")
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
total_invoiced_amount = total_payment = total_outstanding = 0
|
|
||||||
for gle in entries:
|
for gle in entries:
|
||||||
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
|
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
|
||||||
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
|
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
|
||||||
@ -41,17 +40,9 @@ def execute(filters=None):
|
|||||||
else:
|
else:
|
||||||
ageing_based_on_date = gle.posting_date
|
ageing_based_on_date = gle.posting_date
|
||||||
row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
|
row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
|
||||||
|
|
||||||
# Add to total
|
|
||||||
total_invoiced_amount += flt(invoiced_amount)
|
|
||||||
total_payment += flt(payment_amount)
|
|
||||||
total_outstanding += flt(outstanding_amount)
|
|
||||||
|
|
||||||
data.append(row)
|
data.append(row)
|
||||||
if data:
|
|
||||||
data.append(["", "", "", "", "", "", "Total", total_invoiced_amount, total_payment,
|
|
||||||
total_outstanding, "", "", "", ""])
|
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-04-16 11:31:13",
|
"creation": "2013-04-16 11:31:13",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-04-16 11:31:13",
|
"modified": "2013-04-30 17:54:47",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"add_total_row": 1,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
wn.query_reports["Purchase Register"] = {
|
wn.query_reports["Purchase Register"] = {
|
||||||
"add_total_row": true,
|
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname":"from_date",
|
"fieldname":"from_date",
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-04-29 16:13:11",
|
"creation": "2013-04-29 16:13:11",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-04-29 16:13:11",
|
"modified": "2013-04-30 17:51:19",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"add_total_row": 1,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
wn.query_reports["Sales Register"] = {
|
wn.query_reports["Sales Register"] = {
|
||||||
"add_total_row": true,
|
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname":"from_date",
|
"fieldname":"from_date",
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-04-23 18:15:29",
|
"creation": "2013-04-23 18:15:29",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-04-23 18:15:29",
|
"modified": "2013-04-30 17:53:10",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"add_total_row": 1,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user