From a51d0c700e1993150bd9a0d1430c28313a5a1955 Mon Sep 17 00:00:00 2001 From: Yoginth Date: Wed, 4 Dec 2024 18:26:37 +0530 Subject: [PATCH] Add invoice app --- apps/invoice/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/invoice/src/index.ts b/apps/invoice/src/index.ts index 3c0c8f0c927..eb9a9461ef2 100644 --- a/apps/invoice/src/index.ts +++ b/apps/invoice/src/index.ts @@ -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"]; @@ -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++; } };