Fix ABA output

This commit is contained in:
Yingtong Li 2020-04-08 16:50:10 +10:00
parent fbe0396a8e
commit 3168b52479
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -43,21 +43,21 @@ def write_detail(f, dest_bsb='', dest_account='', indicator=' ', transaction_cod
f.write('{: >9}'.format(dest_account).encode('ascii')) # Account Number f.write('{: >9}'.format(dest_account).encode('ascii')) # Account Number
f.write(indicator.encode('ascii')) # Indicator f.write(indicator.encode('ascii')) # Indicator
f.write('{:02}'.format(transaction_code).encode('ascii')) # Transaction Code f.write('{:02}'.format(transaction_code).encode('ascii')) # Transaction Code
f.write('{:010}'.format(cents).encode('ascii')) # Amount f.write('{:010}'.format(round(cents)).encode('ascii')) # Amount
f.write('{: <32}'.format(dest_name).encode('ascii')) # Title of Account f.write('{: <32}'.format(dest_name).encode('ascii')) # Title of Account
f.write('{: <18}'.format(reference).encode('ascii')) # Lodgement Reference f.write('{: <18}'.format(reference).encode('ascii')) # Lodgement Reference
f.write('{}-{}'.format(src_bsb[:3], src_bsb[-3:]).encode('ascii')) # Trace BSB f.write('{}-{}'.format(src_bsb[:3], src_bsb[-3:]).encode('ascii')) # Trace BSB
f.write('{: >9}'.format(src_account).encode('ascii')) # Trace Account Number f.write('{: >9}'.format(src_account).encode('ascii')) # Trace Account Number
f.write('{: <16}'.format(src_name).encode('ascii')) # Name of Remitter f.write('{: <16}'.format(src_name).encode('ascii')) # Name of Remitter
f.write('{:08}'.format(tax_withheld).encode('ascii')) # Amount of Withholding Tax f.write('{:08}'.format(round(tax_withheld)).encode('ascii')) # Amount of Withholding Tax
f.write(b'\r\n') f.write(b'\r\n')
def write_total(f, credit_cents=0, num_detail_records=0): def write_total(f, credit_cents=0, num_detail_records=0):
f.write(b'7') # Record Type 7 f.write(b'7') # Record Type 7
f.write(b'999-999') # BSB Format Filler f.write(b'999-999') # BSB Format Filler
f.write(b' ' * 12) # Blank f.write(b' ' * 12) # Blank
f.write('{:010}'.format(credit_cents).encode('ascii')) # File (User) Net Total Amount f.write('{:010}'.format(round(credit_cents)).encode('ascii')) # File (User) Net Total Amount
f.write('{:010}'.format(credit_cents).encode('ascii')) # File (User) Credit Total Amount f.write('{:010}'.format(round(credit_cents)).encode('ascii')) # File (User) Credit Total Amount
f.write(b'0' * 10) # File (User) Debit Total Amount f.write(b'0' * 10) # File (User) Debit Total Amount
f.write(b' ' * 24) # Blank f.write(b' ' * 24) # Blank
f.write('{:06}'.format(num_detail_records).encode('ascii')) # File (user) count of Records Type 1 f.write('{:06}'.format(num_detail_records).encode('ascii')) # File (user) count of Records Type 1