From 7e0bc1f666acaee5557f75eb91b67b259924c8ac Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Thu, 9 Oct 2025 18:05:42 +0800 Subject: [PATCH] Updated pdf --- src/utils/functions/createPdf.ts | 58 ++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/src/utils/functions/createPdf.ts b/src/utils/functions/createPdf.ts index f3e0166..7e506a3 100644 --- a/src/utils/functions/createPdf.ts +++ b/src/utils/functions/createPdf.ts @@ -1,9 +1,7 @@ import jsPDF from 'jspdf' // @ts-ignore import jspdfBarcode from 'jspdf-barcode' -// import { ofetch } from 'ofetch' -// import dayjs from 'dayjs' -import { _optn, _applicationNo, _date, _name, _type, _location } from '../../stores/pdfinfo' +import { _optn, _applicationNo, _date, _name, _type, _location, _assessor, _feeList, _codeList, _amountList } from '../../stores/pdfinfo' export default async () => { const PESO = import.meta.env.VITE_PESO @@ -17,9 +15,11 @@ export default async () => { const TYPE = _type.get() const CODE = '40201010-5-3' const AMOUNT = 100 - - // const ASSESSOR = 'ENGR. BATMAN' - // const APPROVER = 'AR. KHASHAYAR L. TOGHYANI' + const ASSESSOR = _assessor.get() + const APPROVER = 'AR. KHASHAYAR L. TOGHYANI' + const FEES = _feeList.get() + const CODES = _codeList.get() + const AMOUNTS = _amountList.get() const doc = new jsPDF({ orientation: 'l', @@ -158,29 +158,53 @@ export default async () => { doc.text('AMOUNT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 65, 84) doc.setFont('arial', 'normal') - doc.text('SAMPLE FEE', 16, 92) - doc.text('ANOTHER SAMPLE FEE', 16, 96) + // doc.text('SAMPLE FEE', 16, 92) + // doc.text('ANOTHER SAMPLE FEE', 16, 96) - doc.text(CODE, 76, 92) - doc.text(CODE, 76, 96) + let yPosition = 92 + FEES.forEach((fee) => { + doc.text(fee, 16, yPosition) + yPosition += 4 + }) + + yPosition = 92 + CODES.forEach((code) => { + doc.text(code, 76, yPosition) + yPosition += 4 + }) + + yPosition = 92 + AMOUNTS.forEach((amount) => { + doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 122, yPosition) + yPosition += 4 + }) - doc.text(`P ${AMOUNT.toFixed(2)}`, 122, 92) - doc.text(`P ${AMOUNT.toFixed(2)}`, 122, 96) doc.text('x1', 140, 92) doc.text('x1', 140, 96) doc.text('=', 148, 92) doc.text('=', 148, 96) - doc.setFont('arial-bold', 'bold') - doc.text(`P ${AMOUNT.toFixed(2)}`, 156, 92) - doc.text(`P ${AMOUNT.toFixed(2)}`, 156, 96) + + yPosition = 92 + AMOUNTS.forEach((amount) => { + doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 156, yPosition) + yPosition += 4 + }) doc.setFont('arial-bold', 'bold') doc.text('Assessed By :', 16, 112) doc.text('Approved By :', 142, 112) + + doc.text(ASSESSOR, 16, 128) + doc.text(APPROVER, 142, 128) + + doc.setFont('arial', 'normal') + doc.setFontSize(6) + doc.text('Officer-in-Charge', 154, 132) // doc.text(CODE, 76, 96) - // doc.setFont('arial', 'normal') - doc.text('Please use the OPTN when paying online.', 16, 136) + doc.setFont('arial-bold', 'bold') + doc.setFontSize(7) + doc.text('Please use the OPTN when paying online.', 16, 140) const note = doc.splitTextToSize('Note: The 72 Hours Transaction Policy of the City Mayor, shall commence upon submission of the Bureau of Fire Protection clearance/certificate and other requirement stated in the notice to comply to be issued by this office.', 185) doc.text(note, 16, 144)