Start for Dev Branch

This commit is contained in:
2024-12-20 18:46:52 +01:00
parent a6c1eaf69f
commit acf5d1c2ea
16 changed files with 599 additions and 171 deletions

View File

@@ -622,7 +622,7 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
maxWidth: 240
})
console.log(row.text.match(/.{1,35}/g))
console.log(row)
if(invoiceData.type !== "deliveryNotes") {
pages[pageCounter - 1].drawText(row.text.match(/.{1,35}/g).join("\n"), {
@@ -933,6 +933,8 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
//console.log(rowHeight)
//rowHeight += 25
let endTextDiff = 45
if(invoiceData.type !== "deliveryNotes"){
pages[pageCounter - 1].drawRectangle({
...getCoordinatesForPDFLib(20,rowHeight, page1),
@@ -1012,11 +1014,86 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
maxWidth: 240,
font:fontBold
})
if(invoiceData.total.totalGrossAlreadyPaid !== "0,00 €") {
pages[pageCounter - 1].drawText("Bereits bezahlt:", {
...getCoordinatesForPDFLib(21,rowHeight+21, page1),
size:11,
color:rgb(0,0,0),
lineHeight:11,
opacity: 1,
maxWidth: 240,
font: fontBold
})
pages[pageCounter - 1].drawText(invoiceData.total.totalGrossAlreadyPaid, {
y: getCoordinatesForPDFLib(21,rowHeight+21,page1).y,
x: getCoordinatesForPDFLib(21,rowHeight+21,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.totalGrossAlreadyPaid,11),
size:11,
color:rgb(0,0,0),
lineHeight:11,
opacity: 1,
maxWidth: 240,
font:fontBold
})
pages[pageCounter - 1].drawRectangle({
...getCoordinatesForPDFLib(20,rowHeight +32, page1),
width: 180 * 2.83,
height: 8 * 2.83,
color: rgb(0,0,0),
opacity: 0.25
})
pages[pageCounter - 1].drawText("Offene Summe:", {
...getCoordinatesForPDFLib(21,rowHeight+29, page1),
size:11,
color:rgb(0,0,0),
lineHeight:11,
opacity: 1,
maxWidth: 240,
font: fontBold
})
pages[pageCounter - 1].drawText(invoiceData.total.totalSumToPay, {
y: getCoordinatesForPDFLib(21,rowHeight+29,page1).y,
x: getCoordinatesForPDFLib(21,rowHeight+29,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.totalSumToPay,11),
size:11,
color:rgb(0,0,0),
lineHeight:11,
opacity: 1,
maxWidth: 240,
font:fontBold
})
invoiceData.usedAdvanceInvoices.forEach((advanceInvoice,index) => {
//For Each Advance Invoice
pages[pageCounter - 1].drawText(String(advanceInvoice.documentNumber), {
...getCoordinatesForPDFLib(21,rowHeight+36+5*index, page1),
size:11,
color:rgb(0,0,0),
lineHeight:11,
opacity: 1,
maxWidth: 240
})
})
} else {
endTextDiff = 22
}
}
pages[pageCounter - 1].drawText(invoiceData.endText,{
...getCoordinatesForPDFLib(20,rowHeight+22, page1),
...getCoordinatesForPDFLib(20,rowHeight+endTextDiff, page1),
size: 10,
color: rgb(0,0,0),
lineHeight: 10,