Some Serial Invoice
Free Text Pos Minor Changes
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
<UInput
|
||||
v-model="row.text"
|
||||
placeholder="Titel"
|
||||
maxlength="60"
|
||||
/>
|
||||
<UTextarea
|
||||
class="mt-2"
|
||||
@@ -1420,6 +1422,12 @@ setupPage()
|
||||
>
|
||||
+ Titel
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="addPosition('text')"
|
||||
class="mt-3"
|
||||
>
|
||||
+ Freitext
|
||||
</UButton>
|
||||
</InputGroup>
|
||||
|
||||
<div class="w-full flex justify-end">
|
||||
|
||||
162
pages/createDocument/serialInvoice.vue
Normal file
162
pages/createDocument/serialInvoice.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
|
||||
|
||||
<template>
|
||||
<UDashboardNavbar title="Serienrechnungen">
|
||||
<template #right>
|
||||
<UButton
|
||||
@click="router.push(`/createDocument/edit?type=serialInvoices`)"
|
||||
>
|
||||
+ Serienrechnung
|
||||
</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
<UDashboardToolbar>
|
||||
<template #right>
|
||||
<USelectMenu
|
||||
v-model="selectedColumns"
|
||||
icon="i-heroicons-adjustments-horizontal-solid"
|
||||
:options="templateColumns"
|
||||
multiple
|
||||
class="hidden lg:block"
|
||||
by="key"
|
||||
>
|
||||
<template #label>
|
||||
Spalten
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</template>
|
||||
</UDashboardToolbar>
|
||||
|
||||
<UTable
|
||||
:rows="filteredRows"
|
||||
:columns="columns"
|
||||
class="w-full"
|
||||
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
||||
@select="(row) => router.push(`/createDocument/edit/${row.id}`)"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Belege anzuzeigen' }"
|
||||
>
|
||||
<template #type-data="{row}">
|
||||
{{dataStore.documentTypesForCreation[row.type].labelSingle}}
|
||||
</template>
|
||||
<template #state-data="{row}">
|
||||
<span
|
||||
v-if="row.state === 'Entwurf'"
|
||||
class="text-rose-500"
|
||||
>
|
||||
{{row.state}}
|
||||
</span>
|
||||
<span
|
||||
v-if="row.state === 'Gebucht'"
|
||||
class="text-cyan-500"
|
||||
>
|
||||
{{row.state}}
|
||||
</span>
|
||||
<span
|
||||
v-if="row.state === 'Abgeschlossen'"
|
||||
class="text-primary-500"
|
||||
>
|
||||
{{row.state}}
|
||||
</span>
|
||||
</template>
|
||||
<template #partner-data="{row}">
|
||||
<span v-if="row.customer">{{row.customer ? row.customer.name : ""}}</span>
|
||||
|
||||
</template>
|
||||
<!--<template #reference-data="{row}">
|
||||
<span v-if="row === filteredRows[selectedItem]" class="text-primary-500 font-bold">{{row.documentNumber}}</span>
|
||||
<span v-else>{{row.documentNumber}}</span>
|
||||
</template>
|
||||
<template #date-data="{row}">
|
||||
<span v-if="row.date">{{row.date ? dayjs(row.date).format("DD.MM.YY") : ''}}</span>
|
||||
<span v-if="row.documentDate">{{row.documentDate ? dayjs(row.documentDate).format("DD.MM.YY") : ''}}</span>
|
||||
</template>
|
||||
<template #dueDate-data="{row}">
|
||||
<span :class="dayjs(row.dueDate).diff(dayjs()) <= 0 ? ['text-rose-500'] : '' ">{{row.dueDate ? dayjs(row.dueDate).format("DD.MM.YY") : ''}}</span>
|
||||
</template>
|
||||
<template #paid-data="{row}">
|
||||
<div v-if="row.type === 'invoices' ||row.type === 'advanceInvoices'">
|
||||
<span v-if="isPaid(row)" class="text-primary-500">Bezahlt</span>
|
||||
<span v-else class="text-rose-600">Offen</span>
|
||||
</div>
|
||||
</template>-->
|
||||
<template #amount-data="{row}">
|
||||
{{displayCurrency(calculateDocSum(row))}}
|
||||
</template>
|
||||
</UTable>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const router = useRouter()
|
||||
const dataStore = useDataStore()
|
||||
const items = ref([])
|
||||
const selectedItem = ref(0)
|
||||
|
||||
const setupPage = async () => {
|
||||
items.value = await useSupabaseSelect("createddocuments","*, customer(id,name)","documentDate")
|
||||
}
|
||||
|
||||
const searchString = ref("")
|
||||
const filteredRows = computed(() => {
|
||||
|
||||
let temp = items.value.filter(i => i.type === "serialInvoices")
|
||||
|
||||
/*if(showDrafts.value === true) {
|
||||
temp = temp.filter(i => i.state === "Entwurf")
|
||||
} else {
|
||||
temp = temp.filter(i => i.state !== "Entwurf")
|
||||
}*/
|
||||
|
||||
return useSearch(searchString.value, temp.slice().reverse())
|
||||
|
||||
})
|
||||
|
||||
const templateColumns = [
|
||||
{
|
||||
key: 'type',
|
||||
label: "Typ",
|
||||
sortable: true
|
||||
},{
|
||||
key: 'state',
|
||||
label: "Status.",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: "amount",
|
||||
label: "Betrag",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: 'partner',
|
||||
label: "Kunde",
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
const selectedColumns = ref(templateColumns)
|
||||
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
|
||||
|
||||
|
||||
const displayCurrency = (value, currency = "€") => {
|
||||
return `${Number(value).toFixed(2).replace(".",",")} ${currency}`
|
||||
}
|
||||
|
||||
const calculateDocSum = (row) => {
|
||||
let sum = 0
|
||||
|
||||
row.rows.forEach(row => {
|
||||
if(row.mode === "normal" || row.mode === "service" || row.mode === "free") {
|
||||
sum += row.quantity * row.price * (1 - row.discountPercent / 100) * (1 + row.taxPercent / 100)
|
||||
}
|
||||
})
|
||||
|
||||
return sum.toFixed(2)
|
||||
}
|
||||
|
||||
setupPage()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user