The tool can now update the payment history.

This commit is contained in:
JohnKent
2019-07-10 22:57:23 -04:00
parent e9fefb1a1a
commit 717210636d
4 changed files with 150 additions and 63 deletions

View File

@@ -203,7 +203,7 @@ def amortizeLoan(loan):
def transformTemplate(template_fileName, loanModel):
# template_filename = "statement.txt.jinja"
# template_filename = "statement.text.jinja"
# setup jinja for creating the statement
env = Environment(loader=FileSystemLoader('.'))
template = env.get_template(template_fileName)
@@ -242,6 +242,30 @@ def generateEmail(from_address, to_address, subject, body, pdfAttachment, txtAtt
return msg
def generateEmailWithAttachments(from_address, to_address, subject, body, pdfAttachment, htmlAttachment, txtAttachment):
msg = MIMEMultipart()
msg['Subject'] = subject
msg['From'] = from_address
msg['To'] = to_address
msg.attach(MIMEText(body))
if (pdfAttachment != None):
part = MIMEBase("application", "octet-stream")
part.set_payload(pdfAttachment)
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="statement.pdf"')
msg.attach(part)
if (txtAttachment != None):
part = MIMEBase("text", "html")
part.set_payload(txtAttachment)
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="statement.html"')
msg.attach(part)
return msg
def sendEmail(msg, from_address, to_address, passwd):
try:

View File

@@ -12,7 +12,11 @@
<body>
<p id="header" align="center"><font face="Arial" size=+2 >Web Mortgage Manager</font></p>
<table border="1px">
{% for message in messages %}
<tr><td>{{message}}</td></tr>
{% endfor %}
</table>
<a href="/?loan={{filename}}">Return to Main Screen</a>.
</body>
</html>

View File

@@ -151,11 +151,21 @@
</td></tr>
<tr><td><button>Send Statement</button></td></tr>
</table>
<input hidden="loan" name='loan' value="{{filename}}" />
<input type="hidden" name='loan' value="{{filename}}" />
</form>
</div>
<div id="add_payment">
<p>Add Loan Payment Tab</p>
<form name="AddPayment" method="post" action="/update_file">
<input type="hidden" name="loan" value="{{filename}}" />
<table align="center" border="1px" width="75%">
<tr><td align="center" bgcolor="darkgrey">Record a Payment</td></tr>
<tr><td bgcolor="beige">Payment Date:</td></tr>
<tr><td><input type="date" name="date"</td></tr>
<tr><td bgcolor="beige">Payment Amount:</td></tr>
<tr><td><input type="text" name="amount"></td></tr>
<tr><td><button>Record Payment</button></td></tr>
</table>
</form>
</div>
</div>
</body>

View File

@@ -1,65 +1,114 @@
{
"htmlTemplate": "statement.pdf.jinja",
"txtTemplate": "statement.txt.jinja",
"format": "html",
"email": {
"from_address": "jkent3rd@gmail.com",
"to_address": "jkent3rd@gmail.com",
"server": "smtp.gmail.com",
"password": "pvyrbcnzrjoizprn",
"template": "./template.txt",
"send_pdf": "true",
"send_text": "true",
"subject": "Your loan statement...",
"body": "Your loan statement is attached.",
"text": "Please see your most recent account statement."
"htmlTemplate": "statement.pdf.jinja",
"parameters": {
"monthly_payment": 589.0,
"interest_rate": 6.5,
"start_interest_date": "2017-12-05",
"payment_day_of_month": "15",
"first_payment_month": "2018-01-15",
"account_number": "100100",
"principal": 10020.0,
"start_date": "2017-12-05",
"periods_per_year": 12,
"periods": 18
},
"parameters": {
"account_number": "100100",
"principal": 10020.00,
"interest_rate": 6.5,
"periods_per_year": 12,
"periods": 18,
"start_date": "2017-12-05",
"start_interest_date": "2017-12-05",
"first_payment_month": "2018-01-15",
"monthly_payment": 589.00,
"payment_day_of_month": "15"
"format": "html",
"txtTemplate": "statement.txt.jinja",
"lender": {
"city": "Washington",
"name": "Test Lender",
"zip": "20011",
"phone": "703.343.0782",
"state": "DC",
"address": "743 Madison St NW"
},
"payments": [
["2018-01-16", "589.00"],
["2018-03-30", "589.00"],
["2018-04-06", "589.00"],
["2018-04-12", "589.00"],
["2018-05-28", "589.00"],
["2018-06-12", "589.00"],
["2018-07-13", "589.00"],
["2018-08-14", "589.00"],
["2018-09-26", "589.00"],
["2018-10-15", "0"],
["2018-11-29", "589.00"],
["2018-12-31", "589.00"],
["2019-01-28", "589.00"],
["2019-03-15", "589.00"]
],
"borrower": {
"name": "Bear Houses, LLC",
"address": "301 N Beauregard St Apt 203",
"city": "Alexandria",
"state": "VA",
"zip": "22312"
"header": {
"date": "Today",
"title": "Installment Loan Test Statement"
},
"lender": {
"name": "John Kent",
"phone": "703.343.0782",
"address": "743 Madison St NW",
"city": "Washington",
"state": "DC",
"zip": "20011"
"payments": [
[
"2018-01-16",
"589.00"
],
[
"2018-03-30",
"589.00"
],
[
"2018-04-06",
"589.00"
],
[
"2018-04-12",
"589.00"
],
[
"2018-05-28",
"589.00"
],
[
"2018-06-12",
"589.00"
],
[
"2018-07-13",
"589.00"
],
[
"2018-08-14",
"589.00"
],
[
"2018-09-26",
"589.00"
],
[
"2018-10-15",
"0"
],
[
"2018-11-29",
"589.00"
],
[
"2018-12-31",
"589.00"
],
[
"2019-01-28",
"589.00"
],
[
"2019-03-15",
"589.00"
],
[
"2019-07-10",
"123.12"
],
[
"2019-07-10",
"120"
]
],
"borrower": {
"city": "Alexandria",
"state": "VA",
"name": "Test Borrower Houses, LLC",
"zip": "22312",
"address": "301 N Beauregard St Apt 203"
},
"header": {
"title": "Installment Loan Statement",
"date": "Today"
"email": {
"body": "Your test loan statement is attached.",
"to_address": "jkent3rd@gmail.com",
"from_address": "jkent3rd@gmail.com",
"text": "Please see your most recent test account statement.",
"server": "smtp.gmail.com",
"send_text": "true",
"template": "./template.txt",
"send_pdf": "true",
"password": "pvyrbcnzrjoizprn",
"subject": "Your test loan statement..."
}
}
}