Minor Changes in Invoice Creation

This commit is contained in:
2024-09-19 19:34:41 +02:00
parent c546e2cf3c
commit 93a2d96c21
2 changed files with 25 additions and 13 deletions

View File

@@ -595,6 +595,8 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
if(row.mode !== 'pagebreak' && row.mode !== 'title'){
console.log(row)
pages[pageCounter - 1].drawText(String(row.pos), {
...getCoordinatesForPDFLib(21,rowHeight, page1),
size:10,
@@ -613,19 +615,24 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
maxWidth: 240
})
pages[pageCounter - 1].drawText(row.text, {
pages[pageCounter - 1].drawText(row.text.match(/.{1,35}/g).join("\n"), {
...getCoordinatesForPDFLib(52,rowHeight, page1),
size:10,
color:rgb(0,0,0),
lineHeight:10,
opacity: 1,
maxWidth: 240,
maxWidth: 10,
font: fontBold
})
//let textLineBreaks = (row.text.match(/\n/g) || []).length
let textAutoLines = (row.text.match(/.{1,35}/g) || []).length
console.log(textAutoLines)
if(row.description) {
pages[pageCounter - 1].drawText(row.description, {
...getCoordinatesForPDFLib(52,rowHeight + 5, page1),
pages[pageCounter - 1].drawText(row.description.match(/.{1,70}/g).join("\n"), {
...getCoordinatesForPDFLib(52,rowHeight + ( textAutoLines * 4), page1),
size:10,
color:rgb(0,0,0),
lineHeight:10,
@@ -671,8 +678,8 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
if(row.description) {
let lineBreaks = (row.description.match(/\n/g) || []).length
let autoLines = (row.description.match(/.{1,50}/g) || []).length
rowHeight += 14 + (lineBreaks + autoLines) * 2.5
let autoLines = (row.description.match(/.{1,70}/g) || []).length
rowHeight += 14 + (lineBreaks + autoLines + textAutoLines) * 2.5
} else {
rowHeight += 10
}

View File

@@ -207,7 +207,8 @@ const addPosition = (mode) => {
quantity: 1,
price: 0,
taxPercent: 19,
discountPercent: 0
discountPercent: 0,
unit: 1
})
} else if(mode === 'service'){
itemInfo.value.rows.push({
@@ -216,7 +217,8 @@ const addPosition = (mode) => {
quantity: 1,
price: 0,
taxPercent: 19,
discountPercent: 0
discountPercent: 0,
unit: 1
})
} else if(mode === "pagebreak") {
itemInfo.value.rows.push({
@@ -515,7 +517,7 @@ setupPage()
<div v-if="item.label === 'Editor'">
<InputGroup>
<div class="flex-auto mr-5">
<div class="w-1/3 mr-5">
<UFormGroup
label="Dokumenttyp:"
>
@@ -708,7 +710,7 @@ setupPage()
</InputGroup>
</UFormGroup>
</div>
<div class="flex-auto">
<div class="w-2/3">
<UFormGroup
:label="itemInfo.documentNumberTitle + ':'"
>
@@ -977,7 +979,6 @@ setupPage()
>
<UInput
v-model="row.text"
maxlength="40"
placeholder="Name"
/>
</td>
@@ -986,7 +987,9 @@ setupPage()
v-else-if="row.mode === 'normal'"
>
<USelectMenu
class="w-40"
:options="dataStore.products"
:color="row.product ? 'primary' : 'rose'"
option-attribute="name"
value-attribute="id"
searchable
@@ -994,7 +997,7 @@ setupPage()
:search-attributes="['name']"
v-model="row.product"
@change="row.unit = dataStore.getProductById(row.product).unit,
row.price = dataStore.getProductById(row.product).sellingPrice || 0,
row.price = (dataStore.getProductById(row.product).sellingPrice || 0),
row.description = dataStore.getProductById(row.product).description"
>
<template #label>
@@ -1010,7 +1013,9 @@ setupPage()
v-else-if="row.mode === 'service'"
>
<USelectMenu
class="w-40"
:options="dataStore.services"
:color="row.service ? 'primary' : 'rose'"
option-attribute="name"
value-attribute="id"
searchable
@@ -1022,7 +1027,7 @@ setupPage()
row.description = dataStore.getServiceById(row.service).description"
>
<template #label>
{{dataStore.getServiceById(row.service) ? dataStore.getServiceById(row.service).name : "Keine Leistung ausgewählt" }}
<span class="truncate">{{dataStore.getServiceById(row.service) ? dataStore.getServiceById(row.service).name : "Keine Leistung ausgewählt" }}</span>
</template>
</USelectMenu>
</td>