Merge pull request #1927 from anandpdoshi/anand-july-10

Bank Reconciliation Statement Print Format
This commit is contained in:
Rushabh Mehta 2014-07-10 21:59:05 +05:30
commit 8e4a9ba831
2 changed files with 56 additions and 9 deletions

View File

@ -0,0 +1,46 @@
<h2 class="text-center">{%= __("Bank Reconciliation Statement") %}</h2>
<h4 class="text-center">{%= filters.account %}</h3>
<hr>
<table class="table table-bordered">
<thead>
<tr>
<th style="width: 15%">{%= __("Posting Date") %}</th>
<th style="width: 15%">{%= __("Journal Voucher") %}</th>
<th style="width: 40%">{%= __("Reference") %}</th>
<th style="width: 15%; text-align: right;">{%= __("Debit") %}</th>
<th style="width: 15%; text-align: right;">{%= __("Credit") %}</th>
</tr>
</thead>
<tbody>
{% for(var i=0, l=data.length; i<l; i++) { %}
{% if (data[i].posting_date) { %}
<tr>
<td>{%= dateutil.str_to_user(data[i].posting_date) %}</td>
<td>{%= data[i].journal_voucher %}</td>
<td>{%= __("Against") %}: {%= data[i].against_account %}
{% if (data[i].reference) { %}
<br>{%= __("Reference") %}: {%= data[i].reference %}
{% if (data[i].ref_date) { %}
<br>{%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i].ref_date) %}
{% } %}
{% } %}
{% if (data[i].clearance_date) { %}
<br>{%= __("Clearance Date") %}: {%= dateutil.str_to_user(data[i].clearance_date) %}
{% } %}
</td>
<td style="text-align: right">{%= format_currency(data[i].debit) %}</td>
<td style="text-align: right">{%= format_currency(data[i].credit) %}</td>
</tr>
{% } else { %}
<tr>
<td></td>
<td></td>
<td>{%= data[i].journal_voucher %}</td>
<td style="text-align: right">{%= format_currency(data[i].debit) %}</td>
<td style="text-align: right">{%= format_currency(data[i].credit) %}</td>
</tr>
{% } %}
{% } %}
</tbody>
</table>
<p class="text-right text-muted">Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>

View File

@ -19,28 +19,29 @@ def execute(filters=None):
total_debit, total_credit = 0,0
for d in data:
total_debit += flt(d[4])
total_credit += flt(d[5])
total_debit += flt(d[2])
total_credit += flt(d[3])
bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit)
data += [
get_balance_row("Balance as per company books", balance_as_per_company),
["", "", "", "Amounts not reflected in bank", total_debit, total_credit],
["", "Amounts not reflected in bank", total_debit, total_credit, "", "", "", ""],
get_balance_row("Balance as per bank", bank_bal)
]
return columns, data
def get_columns():
return ["Journal Voucher:Link/Journal Voucher:140", "Posting Date:Date:100",
"Clearance Date:Date:110", "Against Account:Link/Account:200",
"Debit:Currency:120", "Credit:Currency:120"
return ["Posting Date:Date:100", "Journal Voucher:Link/Journal Voucher:200",
"Debit:Currency:120", "Credit:Currency:120",
"Against Account:Link/Account:200", "Reference::100", "Ref Date:Date:110", "Clearance Date:Date:110"
]
def get_entries(filters):
entries = frappe.db.sql("""select
jv.name, jv.posting_date, jv.clearance_date, jvd.against_account, jvd.debit, jvd.credit
jv.posting_date, jv.name, jvd.debit, jvd.credit,
jvd.against_account, jv.cheque_no, jv.cheque_date, jv.clearance_date
from
`tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
where jvd.parent = jv.name and jv.docstatus=1
@ -52,6 +53,6 @@ def get_entries(filters):
def get_balance_row(label, amount):
if amount > 0:
return ["", "", "", label, amount, 0]
return ["", label, amount, 0, "", "", "", ""]
else:
return ["", "", "", label, 0, amount]
return ["", label, 0, amount, "", "", "", ""]