From a75506b183e1f5093cfdc455744d89d0dd893a6d Mon Sep 17 00:00:00 2001 From: flfeders Date: Sun, 29 Sep 2024 19:17:26 +0200 Subject: [PATCH] Some Serial Invoice Free Text Pos Minor Changes --- composables/usePDFGenerator.js | 10 +- pages/createDocument/edit/[[id]].vue | 16 ++- pages/createDocument/serialInvoice.vue | 162 +++++++++++++++++++++++++ 3 files changed, 179 insertions(+), 9 deletions(-) create mode 100644 pages/createDocument/serialInvoice.vue diff --git a/composables/usePDFGenerator.js b/composables/usePDFGenerator.js index b305ff2..9fe402e 100644 --- a/composables/usePDFGenerator.js +++ b/composables/usePDFGenerator.js @@ -837,17 +837,17 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => { rowHeight += 3 } - let textAutoLines = (row.text.match(/.{1,70}/g) || []).length + let textAutoLines = (row.text.match(/.{1,60}/g) || []).length pages[pageCounter - 1].drawRectangle({ ...getCoordinatesForPDFLib(20,rowHeight, page1), width: 180 * 2.83, - height: 8 * 3, + height: 8 * 2.83, color: rgb(0,0,0), opacity: 0.25 }) - pages[pageCounter - 1].drawText(row.text.match(/.{1,70}/g).join("\n"), { + pages[pageCounter - 1].drawText(row.text.match(/.{1,60}/g).join("\n"), { ...getCoordinatesForPDFLib(21,rowHeight - 3, page1), size:12, color:rgb(0,0,0), @@ -861,7 +861,7 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => { if(row.description) { - pages[pageCounter - 1].drawText(row.description.match(/.{1,85}/g).join("\n"), { + pages[pageCounter - 1].drawText(row.description.match(/.{1,80}/g).join("\n"), { ...getCoordinatesForPDFLib(21,rowHeight + ( textAutoLines * 4), page1), size:10, color:rgb(0,0,0), @@ -870,7 +870,7 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => { }) } - let addHeight = ((row.description.match(/.{1,85}/g) || []).length + textAutoLines) * 8 + let addHeight = (row.description.match(/.{1,80}/g) || []).length * 4 + 10 console.log(addHeight) rowHeight += addHeight diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index fd049a6..16b9024 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -290,16 +290,17 @@ const findDocumentErrors = computed(() => { if(itemInfo.value.customer === null) errors.push({message: "Es ist kein Kunde ausgewählt", type: "breaking"}) if(itemInfo.value.letterhead === null) errors.push({message: "Es ist kein Briefpapier ausgewählt", type: "breaking"}) - if(itemInfo.value.address.street === null) errors.push({message: "Es ist keine Straße im Adressat angegeben ausgewählt", type: "breaking"}) - if(itemInfo.value.address.zip === null) errors.push({message: "Es ist keine Postleitzahl im Adressat angegeben ausgewählt", type: "breaking"}) - if(itemInfo.value.address.city === null) errors.push({message: "Es ist keine Stadt im Adressat angegeben ausgewählt", type: "breaking"}) + if(itemInfo.value.address.street === null) errors.push({message: "Es ist keine Straße im Adressat angegeben", type: "breaking"}) + if(itemInfo.value.address.zip === null) errors.push({message: "Es ist keine Postleitzahl im Adressat angegeben", type: "breaking"}) + if(itemInfo.value.address.city === null) errors.push({message: "Es ist keine Stadt im Adressat angegeben", type: "breaking"}) if(itemInfo.value.project === null) errors.push({message: "Es ist kein Projekt ausgewählt", type: "info"}) itemInfo.value.rows.forEach(row => { if(row.mode === "normal" && !row.product) errors.push({message: `In Position ${row.pos} ist kein Artikel ausgewählt`, type: "breaking"}) if(row.mode === "service" && !row.service) errors.push({message: `In Position ${row.pos} ist keine Leistung ausgewählt`, type: "breaking"}) - if(row.mode === "title" && !row.text) errors.push({message: `In Position ${row.pos} ist kein Titel hinterlegt ausgewählt`, type: "breaking"}) + if(row.mode === "title" && !row.text) errors.push({message: `In Position ${row.pos} ist kein Titel hinterlegt`, type: "breaking"}) + if(row.mode === "text" && !row.text) errors.push({message: `In einer Freitext Position ist kein Titel hinterlegt`, type: "breaking"}) }) if(itemInfo.value.type === "serialInvoices") { @@ -1190,6 +1191,7 @@ setupPage() + Titel + + + Freitext +
diff --git a/pages/createDocument/serialInvoice.vue b/pages/createDocument/serialInvoice.vue new file mode 100644 index 0000000..3e7ca37 --- /dev/null +++ b/pages/createDocument/serialInvoice.vue @@ -0,0 +1,162 @@ + + + + + + + \ No newline at end of file