|
#!/usr/bin/python3
|
|
import sys
|
|
|
|
# This script is for creating rows for the repayment schedule page:
|
|
# https://phalanx.homelinuxserver.org/schedule.html
|
|
|
|
PAYMENT_AMOUNT = 500
|
|
ROW_TEMPLATE = ' <tr{:s}>\n <td class="align-center">{:d}</td>'\
|
|
'<td class="align-center">{:s}</td>'\
|
|
'<td class="align-right">{:s}</td>'\
|
|
'<td class="align-right">{:s}</td>'\
|
|
'<td class="align-right">{:s}</td>'\
|
|
'<td>{:s}</td>\n </tr>'
|
|
|
|
def main():
|
|
num_rows = 40
|
|
row_idx = 38
|
|
month_idx = 11
|
|
year_idx = 2021
|
|
principal = 19000
|
|
|
|
for idx in range(num_rows):
|
|
row = ((row_idx % 2 == 0) and ' class="even_row"' or '',
|
|
row_idx,
|
|
'{:02d}/{:d}'.format(month_idx, year_idx),
|
|
'${:,.2f}'.format(PAYMENT_AMOUNT),
|
|
'${:,.2f}'.format(principal - PAYMENT_AMOUNT),
|
|
' ',
|
|
' ')
|
|
print(ROW_TEMPLATE.format(*row))
|
|
|
|
row_idx += 1
|
|
month_idx += 1
|
|
if month_idx > 12:
|
|
month_idx = 1
|
|
year_idx += 1
|
|
principal -= PAYMENT_AMOUNT
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|