Fixed pdf
This commit is contained in:
parent
11e572c414
commit
10dd5b7fa9
1 changed files with 61 additions and 55 deletions
|
|
@ -25,9 +25,9 @@ export default async () => {
|
||||||
const APPROVERID = 276
|
const APPROVERID = 276
|
||||||
|
|
||||||
const doc = new jsPDF({
|
const doc = new jsPDF({
|
||||||
orientation: 'l',
|
orientation: 'p',
|
||||||
unit: 'mm',
|
unit: 'mm',
|
||||||
format: [150.03, 215.9],
|
format: [215.9, 279.4],
|
||||||
})
|
})
|
||||||
|
|
||||||
const arial =
|
const arial =
|
||||||
|
|
@ -57,7 +57,7 @@ export default async () => {
|
||||||
fontSize: 32,
|
fontSize: 32,
|
||||||
textColor: '#000000',
|
textColor: '#000000',
|
||||||
x: pageWidth - 35,
|
x: pageWidth - 35,
|
||||||
y: 40,
|
y: 38,
|
||||||
textOptions: { align: 'center' },
|
textOptions: { align: 'center' },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -118,131 +118,137 @@ export default async () => {
|
||||||
const opTextX = (pageWidth - opTextWidth) / 2
|
const opTextX = (pageWidth - opTextWidth) / 2
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.setFontSize(9)
|
doc.setFontSize(9)
|
||||||
doc.text(opText, opTextX, 36)
|
doc.text(opText, opTextX, 34)
|
||||||
|
|
||||||
const divisionText = 'ELECTRICAL PERMIT'
|
const divisionText = 'ELECTRICAL PERMIT'
|
||||||
const divisionTextWidth = getTextWidth(divisionText, 7.25)
|
const divisionTextWidth = getTextWidth(divisionText, 7.25)
|
||||||
const divisionTextX = (pageWidth - divisionTextWidth) / 2
|
const divisionTextX = (pageWidth - divisionTextWidth) / 2
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
doc.setFontSize(8)
|
doc.setFontSize(8)
|
||||||
doc.text(divisionText, divisionTextX, 40)
|
doc.text(divisionText, divisionTextX, 38)
|
||||||
|
|
||||||
const optnText = 'OPTN:'
|
const optnText = 'OPTN:'
|
||||||
const optnTextX = 16
|
const optnTextX = 16
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.setFontSize(8)
|
doc.setFontSize(8)
|
||||||
doc.text(optnText, optnTextX, 48)
|
doc.text(optnText, optnTextX, 38)
|
||||||
|
|
||||||
const optnContentX = 25
|
const optnContentX = 25
|
||||||
doc.setFontSize(8)
|
doc.setFontSize(8)
|
||||||
doc.text(OPTN, optnContentX, 48)
|
doc.text(OPTN, optnContentX, 38)
|
||||||
|
|
||||||
const toText = `TO: The City Treasurer's Office`
|
const toText = `TO: The City Treasurer's Office`
|
||||||
const toTextX = 16
|
const toTextX = 16
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
doc.setFontSize(8)
|
doc.setFontSize(8)
|
||||||
doc.text(toText, toTextX, 52)
|
doc.text(toText, toTextX, 46)
|
||||||
|
|
||||||
doc.text('Please accept payment for fee specified herunder', 16, 56)
|
doc.text('Please accept payment for fee specified herunder', 16, 50)
|
||||||
|
|
||||||
doc.text('Application No. :', pageWidth - 60, 48)
|
doc.text('Application No. :', pageWidth - 60, 46)
|
||||||
|
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.text(APPLICATION, pageWidth - 38, 48)
|
doc.text(APPLICATION, pageWidth - 38, 46)
|
||||||
|
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
doc.text('Approved Date :', pageWidth - 60, 52)
|
doc.text('Approved Date :', pageWidth - 60, 50)
|
||||||
|
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.text(DATE, pageWidth - 38, 52)
|
doc.text(DATE, pageWidth - 38, 50)
|
||||||
|
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
doc.text('Name of Applicant :', 23.4, 64)
|
doc.text('Name of Applicant :', 23.4, 58)
|
||||||
|
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.text(NAME, 50, 64)
|
doc.text(NAME, 50, 58)
|
||||||
|
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
doc.text('Location of Construction :', 16, 68)
|
doc.text('Location of Construction :', 16, 62)
|
||||||
|
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.text(LOCATION, 50, 68)
|
doc.text(LOCATION, 50, 62)
|
||||||
|
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
doc.text('Type of Use :', 31.2, 72)
|
doc.text('Type of Use :', 31.2, 66)
|
||||||
|
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.text(TYPE, 50, 72)
|
doc.text(TYPE, 50, 66)
|
||||||
|
|
||||||
doc.text('ACCOUNT DESCRIPTION', 16, 84)
|
doc.text('ACCOUNT DESCRIPTION', 16, 74)
|
||||||
doc.text('ACCOUNT CODE', getTextWidth('ACCOUNT DESCRIPTION', 8) + 40, 84)
|
doc.text('ACCOUNT CODE', getTextWidth('ACCOUNT DESCRIPTION', 8) + 40, 74)
|
||||||
doc.text('AMOUNT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 65, 84)
|
doc.text('AMOUNT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 65, 74)
|
||||||
|
doc.text('UNIT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 82, 74)
|
||||||
|
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
// doc.text('SAMPLE FEE', 16, 92)
|
|
||||||
// doc.text('ANOTHER SAMPLE FEE', 16, 96)
|
|
||||||
|
|
||||||
let yPosition = 92
|
let yPosition = 82
|
||||||
FEES.forEach((fee) => {
|
FEES.forEach((fee) => {
|
||||||
doc.text(fee, 16, yPosition)
|
doc.text(fee, 16, yPosition)
|
||||||
yPosition += 4
|
yPosition += 4
|
||||||
})
|
})
|
||||||
|
|
||||||
yPosition = 92
|
yPosition = 82
|
||||||
CODES.forEach((code) => {
|
CODES.forEach((code) => {
|
||||||
doc.text(code, 76, yPosition)
|
doc.text(code, 76, yPosition)
|
||||||
yPosition += 4
|
yPosition += 4
|
||||||
})
|
})
|
||||||
|
|
||||||
yPosition = 92
|
yPosition = 82
|
||||||
AMOUNTS.forEach((amount) => {
|
AMOUNTS.forEach((amount) => {
|
||||||
doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 122, yPosition)
|
doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 122, yPosition)
|
||||||
yPosition += 4
|
yPosition += 4
|
||||||
})
|
})
|
||||||
|
|
||||||
doc.text('x1', 140, 92)
|
doc.text('x1', 140, 82)
|
||||||
doc.text('x1', 140, 96)
|
doc.text('x1', 140, 86)
|
||||||
doc.text('=', 148, 92)
|
doc.text('=', 148, 82)
|
||||||
doc.text('=', 148, 96)
|
doc.text('=', 148, 86)
|
||||||
|
|
||||||
yPosition = 92
|
yPosition = 82
|
||||||
AMOUNTS.forEach((amount) => {
|
AMOUNTS.forEach((amount) => {
|
||||||
doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 156, yPosition)
|
doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 156, yPosition)
|
||||||
yPosition += 4
|
yPosition += 4
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let newYPosition = yPosition
|
||||||
|
console.log(newYPosition)
|
||||||
|
|
||||||
|
doc.line(156, newYPosition, 170, newYPosition)
|
||||||
|
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.text('Assessed By :', 16, 108)
|
doc.text('Total :', 146, newYPosition + 4)
|
||||||
doc.text('Approved By :', 142, 108)
|
const totalAmount = AMOUNTS.reduce((sum, amount) => sum + parseFloat(amount), 0)
|
||||||
|
doc.text(`${PESO} ${totalAmount.toFixed(2)}`, 156, newYPosition + 4)
|
||||||
|
|
||||||
doc.text(ASSESSOR, 16, 126)
|
doc.text('Assessed By :', 16, newYPosition + 12)
|
||||||
doc.text(APPROVER, 142, 126)
|
doc.text('Approved By :', 142, newYPosition + 12)
|
||||||
|
|
||||||
|
doc.text(ASSESSOR, 16, newYPosition + 30)
|
||||||
|
doc.text(APPROVER, 142, newYPosition + 30)
|
||||||
|
|
||||||
|
doc.addImage(assessorQr, 'PNG', 16, newYPosition + 14, 14, 14, 'assessorQr', 'NONE', 0)
|
||||||
|
doc.addImage(_signatureAssessor.get(), 'PNG', 30, newYPosition + 14, 10, 5.9, 'signatureAssessor', 'NONE', 0)
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
doc.setFontSize(6)
|
doc.setFontSize(4)
|
||||||
doc.text('Officer-in-Charge', 154, 129)
|
doc.text('Digitally signed by :', 30, newYPosition + 22)
|
||||||
// doc.text(CODE, 76, 96)
|
doc.text(ASSESSOR, 30, newYPosition + 24)
|
||||||
|
doc.text('Date: ' + dayjs(_assessedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 30, newYPosition + 26)
|
||||||
|
|
||||||
|
doc.addImage(approverQr, 'PNG', 142, newYPosition + 14, 14, 14, 'approverQr', 'NONE', 0)
|
||||||
|
doc.addImage(_signatureApprover.get(), 'PNG', 156, newYPosition + 14, 41.4, 5.9, 'signatureApprover', 'NONE', 0)
|
||||||
|
doc.text('Digitally signed by :', 156, newYPosition + 22)
|
||||||
|
doc.text(APPROVER, 156, newYPosition + 24)
|
||||||
|
doc.text('Date: ' + dayjs(_approvedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 156, newYPosition + 26)
|
||||||
|
|
||||||
doc.setFont('arial-bold', 'bold')
|
doc.setFont('arial-bold', 'bold')
|
||||||
doc.setFontSize(7)
|
doc.setFontSize(7)
|
||||||
doc.text('Please use the OPTN when paying online.', 16, 140)
|
doc.text('Please use the OPTN when paying online.', 16, newYPosition + 40)
|
||||||
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)
|
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.', newYPosition + 44)
|
||||||
doc.text(note, 16, 144)
|
doc.text(note, 16, newYPosition + 44)
|
||||||
|
|
||||||
doc.addImage(_signatureAssessor.get(), 'PNG', 30, 110, 10, 5.9, 'signatureAssessor', 'NONE', 0)
|
|
||||||
doc.setFont('arial', 'normal')
|
doc.setFont('arial', 'normal')
|
||||||
doc.setFontSize(4)
|
doc.setFontSize(6)
|
||||||
doc.text('Digitally signed by :', 30, 118)
|
doc.text('Officer-in-Charge', 154, newYPosition + 33)
|
||||||
doc.text(ASSESSOR, 30, 120)
|
|
||||||
doc.text('Date: ' + dayjs(_assessedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 30, 122)
|
|
||||||
|
|
||||||
doc.addImage(_signatureApprover.get(), 'PNG', 156, 110, 41.4, 5.9, 'signatureApprover', 'NONE', 0)
|
|
||||||
doc.text('Digitally signed by :', 156, 118)
|
|
||||||
doc.text(APPROVER, 156, 120)
|
|
||||||
doc.text('Date: ' + dayjs(_approvedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 156, 122)
|
|
||||||
|
|
||||||
doc.addImage(assessorQr, 'PNG', 16, 110, 14, 14, 'assessorQr', 'NONE', 0)
|
|
||||||
doc.addImage(approverQr, 'PNG', 142, 110, 14, 14, 'approverQr', 'NONE', 0)
|
|
||||||
|
|
||||||
doc.save(`OP-${APPLICATION}.pdf`)
|
doc.save(`OP-${APPLICATION}.pdf`)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue