Skip to content

Commit

Permalink
better formatting and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
dtxe committed Feb 20, 2024
1 parent d28ef1c commit 853cc5d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@

<h2>Expense Parser</h2>

<textarea id="inputText" rows="10" cols="50" placeholder="Paste your expenses here..."></textarea>
<h4>Paste in data from My Wallet</h4>
<textarea id="inputText" style="width: 100%; height: 8em;" placeholder="Paste your expenses here..."></textarea>
<br>
<button onclick="parseAndDisplay()">Parse Expenses</button>
<br>
<textarea id="outputText" rows="10" cols="50" readonly></textarea>
<h4 style="margin-top: 2em;">Text table for pasting into Excel</h4>
<textarea id="outputText" style="width: 100%; height: 8em;" readonly></textarea>

<h4 style="margin-top: 2em;">Interactive table</h4>
<div id="expensesTable"></div>

<script>
Expand Down Expand Up @@ -60,9 +63,9 @@ <h2>Expense Parser</h2>
if (!lines[i + 1].match(/^\d/)) {
const category = lines[i];
const expenseName = lines[++i];
const amounts = lines[++i].match(/(\d+\.\d+) CAD(\d+\.\d+)? (USD|CAD)?/);
const amountInCAD = amounts[1];
const amountInOriginalCurrency = amounts[3] ? `${amounts[2]} ${amounts[3]}` : '';
const amounts = lines[++i].match(/([\d,]+\.\d+) CAD([\d,]+\.\d+)? ([A-Z]{3})?/);
const amountInCAD = amounts[1].replace(/,/g, '');
const amountInOriginalCurrency = (amounts[3] ? `${amounts[2]} ${amounts[3]}` : '').replace(/,/g, '');
const dateFormatted = formatDate(currentDate);
const filename = `${dateFormatted}_${expenseName.replace(/[^a-zA-Z0-9.\-_]/g, '')}_${amountInCAD}.pdf`;

Expand Down

0 comments on commit 853cc5d

Please sign in to comment.