Skip to content

Commit

Permalink
Add invoice app
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoginth committed Dec 4, 2024
1 parent fee218f commit a51d0c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/invoice/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const forYogi = true;
const month = "1";
const year = "2024";

const lastInvoiceNumber = 1;
const amountPerAccount = 33.87;
const accounts = ["1", "2", "3"];

Expand Down Expand Up @@ -35,18 +36,21 @@ const data: InvoiceData = {
};

const generateInvoice = () => {
let invoiceNumber = lastInvoiceNumber;
for (const account of accounts) {
const dueDate = `${month}/${Math.floor(Math.random() * 30) + 1}/${year}`;

const injectedData: InvoiceData = {
...data,
client: { company: account },
information: { number: "1", dueDate }
information: { number: invoiceNumber.toString(), dueDate }
};

easyinvoice.createInvoice(injectedData, (result) => {
fs.writeFileSync(`${account}.pdf`, result.pdf);
});

invoiceNumber++;
}
};

Expand Down

0 comments on commit a51d0c7

Please sign in to comment.