The tool can now update the payment history.
This commit is contained in:
@@ -203,7 +203,7 @@ def amortizeLoan(loan):
|
|||||||
|
|
||||||
|
|
||||||
def transformTemplate(template_fileName, loanModel):
|
def transformTemplate(template_fileName, loanModel):
|
||||||
# template_filename = "statement.txt.jinja"
|
# template_filename = "statement.text.jinja"
|
||||||
# setup jinja for creating the statement
|
# setup jinja for creating the statement
|
||||||
env = Environment(loader=FileSystemLoader('.'))
|
env = Environment(loader=FileSystemLoader('.'))
|
||||||
template = env.get_template(template_fileName)
|
template = env.get_template(template_fileName)
|
||||||
@@ -242,6 +242,30 @@ def generateEmail(from_address, to_address, subject, body, pdfAttachment, txtAtt
|
|||||||
|
|
||||||
return msg
|
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):
|
def sendEmail(msg, from_address, to_address, passwd):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -12,7 +12,11 @@
|
|||||||
<body>
|
<body>
|
||||||
<p id="header" align="center"><font face="Arial" size=+2 >Web Mortgage Manager</font></p>
|
<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>.
|
<a href="/?loan={{filename}}">Return to Main Screen</a>.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -151,11 +151,21 @@
|
|||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td><button>Send Statement</button></td></tr>
|
<tr><td><button>Send Statement</button></td></tr>
|
||||||
</table>
|
</table>
|
||||||
<input hidden="loan" name='loan' value="{{filename}}" />
|
<input type="hidden" name='loan' value="{{filename}}" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="add_payment">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
167
testloan.json
167
testloan.json
@@ -1,65 +1,114 @@
|
|||||||
{
|
{
|
||||||
"htmlTemplate": "statement.pdf.jinja",
|
"htmlTemplate": "statement.pdf.jinja",
|
||||||
"txtTemplate": "statement.txt.jinja",
|
"parameters": {
|
||||||
"format": "html",
|
"monthly_payment": 589.0,
|
||||||
"email": {
|
"interest_rate": 6.5,
|
||||||
"from_address": "jkent3rd@gmail.com",
|
"start_interest_date": "2017-12-05",
|
||||||
"to_address": "jkent3rd@gmail.com",
|
"payment_day_of_month": "15",
|
||||||
"server": "smtp.gmail.com",
|
"first_payment_month": "2018-01-15",
|
||||||
"password": "pvyrbcnzrjoizprn",
|
"account_number": "100100",
|
||||||
"template": "./template.txt",
|
"principal": 10020.0,
|
||||||
"send_pdf": "true",
|
"start_date": "2017-12-05",
|
||||||
"send_text": "true",
|
"periods_per_year": 12,
|
||||||
"subject": "Your loan statement...",
|
"periods": 18
|
||||||
"body": "Your loan statement is attached.",
|
|
||||||
"text": "Please see your most recent account statement."
|
|
||||||
},
|
},
|
||||||
"parameters": {
|
"format": "html",
|
||||||
"account_number": "100100",
|
"txtTemplate": "statement.txt.jinja",
|
||||||
"principal": 10020.00,
|
"lender": {
|
||||||
"interest_rate": 6.5,
|
"city": "Washington",
|
||||||
"periods_per_year": 12,
|
"name": "Test Lender",
|
||||||
"periods": 18,
|
"zip": "20011",
|
||||||
"start_date": "2017-12-05",
|
"phone": "703.343.0782",
|
||||||
"start_interest_date": "2017-12-05",
|
"state": "DC",
|
||||||
"first_payment_month": "2018-01-15",
|
"address": "743 Madison St NW"
|
||||||
"monthly_payment": 589.00,
|
|
||||||
"payment_day_of_month": "15"
|
|
||||||
},
|
},
|
||||||
"payments": [
|
"header": {
|
||||||
["2018-01-16", "589.00"],
|
"date": "Today",
|
||||||
["2018-03-30", "589.00"],
|
"title": "Installment Loan Test Statement"
|
||||||
["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"
|
|
||||||
},
|
},
|
||||||
"lender": {
|
"payments": [
|
||||||
"name": "John Kent",
|
[
|
||||||
"phone": "703.343.0782",
|
"2018-01-16",
|
||||||
"address": "743 Madison St NW",
|
"589.00"
|
||||||
"city": "Washington",
|
],
|
||||||
"state": "DC",
|
[
|
||||||
"zip": "20011"
|
"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": {
|
"email": {
|
||||||
"title": "Installment Loan Statement",
|
"body": "Your test loan statement is attached.",
|
||||||
"date": "Today"
|
"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..."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user