Added Kostenschätzung und Packschein
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 22s
Build and Push Docker Images / build-frontend (push) Successful in 59s

This commit is contained in:
2026-03-25 15:38:28 +01:00
parent 01b4d0f973
commit eb718021fd
11 changed files with 176 additions and 68 deletions

View File

@@ -128,8 +128,11 @@ export const tenants = pgTable(
customers: { prefix: "", suffix: "", nextNumber: 10000 },
products: { prefix: "AT-", suffix: "", nextNumber: 1000 },
quotes: { prefix: "AN-", suffix: "", nextNumber: 1000 },
costEstimates: { prefix: "KS-", suffix: "", nextNumber: 1000 },
confirmationOrders: { prefix: "AB-", suffix: "", nextNumber: 1000 },
invoices: { prefix: "RE-", suffix: "", nextNumber: 1000 },
deliveryNotes: { prefix: "LS-", suffix: "", nextNumber: 1000 },
packingSlips: { prefix: "PS-", suffix: "", nextNumber: 1000 },
spaces: { prefix: "LP-", suffix: "", nextNumber: 1000 },
customerspaces: { prefix: "KLP-", suffix: "", nextNumber: 1000 },
inventoryitems: { prefix: "IA-", suffix: "", nextNumber: 1000 },

View File

@@ -12,6 +12,13 @@ export const useNextNumberRangeNumber = async (
tenantId: number,
numberRange: string
) => {
const numberRangeFallbacks: Record<string, string> = {
costEstimates: "quotes",
packingSlips: "deliveryNotes",
advanceInvoices: "invoices",
cancellationInvoices: "invoices",
}
const [tenant] = await server.db
.select()
.from(tenants)
@@ -23,11 +30,15 @@ export const useNextNumberRangeNumber = async (
const numberRanges = tenant.numberRanges || {}
if (!numberRanges[numberRange]) {
const resolvedNumberRange = numberRanges[numberRange]
? numberRange
: numberRangeFallbacks[numberRange]
if (!resolvedNumberRange || !numberRanges[resolvedNumberRange]) {
throw new Error(`Number range '${numberRange}' not found`)
}
const current = numberRanges[numberRange]
const current = numberRanges[resolvedNumberRange]
const usedNumber =
(current.prefix || "") +
@@ -37,7 +48,7 @@ export const useNextNumberRangeNumber = async (
const updatedRanges = {
// @ts-ignore
...numberRanges,
[numberRange]: {
[resolvedNumberRange]: {
...current,
nextNumber: current.nextNumber + 1,
},

View File

@@ -58,6 +58,8 @@ const getDuration = (time) => {
export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoiceData, backgroundPath:string) => {
const deliveryNoteLikeDocumentTypes = ["deliveryNotes", "packingSlips"]
const isPackingSlip = invoiceData?.type === "packingSlips"
const genPDF = async (invoiceData, backgroundSourceBuffer) => {
const pdfDoc = await PDFDocument.create()
@@ -347,7 +349,19 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
font: fontBold
})
if (invoiceData.type !== "deliveryNotes") {
if (isPackingSlip) {
pages[pageCounter - 1].drawText("Check", {
...getCoordinatesForPDFLib(180, 137, page1),
size: 12,
color: rgb(0, 0, 0),
lineHeight: 12,
opacity: 1,
maxWidth: 240,
font: fontBold
})
}
if (!deliveryNoteLikeDocumentTypes.includes(invoiceData.type)) {
pages[pageCounter - 1].drawText("Steuer", {
...getCoordinatesForPDFLib(135, 137, page1),
size: 12,
@@ -414,9 +428,21 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
maxWidth: 240
})
if (isPackingSlip) {
pages[pageCounter - 1].drawRectangle({
...getCoordinatesForPDFLib(182, rowHeight + 1, page1),
width: 12,
height: 12,
borderColor: rgb(0, 0, 0),
borderWidth: 0.8,
opacity: 1,
borderOpacity: 1,
})
}
let rowTextLines = 0
if (invoiceData.type !== "deliveryNotes") {
if (!deliveryNoteLikeDocumentTypes.includes(invoiceData.type)) {
pages[pageCounter - 1].drawText(splitStringBySpace(row.text, 35).join("\n"), {
...getCoordinatesForPDFLib(52, rowHeight, page1),
size: 10,
@@ -428,7 +454,7 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
rowTextLines = splitStringBySpace(row.text, 35).length
} else {
pages[pageCounter - 1].drawText(splitStringBySpace(row.text, 80).join("\n"), {
pages[pageCounter - 1].drawText(splitStringBySpace(row.text, isPackingSlip ? 68 : 80).join("\n"), {
...getCoordinatesForPDFLib(52, rowHeight, page1),
size: 10,
color: rgb(0, 0, 0),
@@ -437,13 +463,13 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
font: fontBold
})
rowTextLines = splitStringBySpace(row.text, 80).length
rowTextLines = splitStringBySpace(row.text, isPackingSlip ? 68 : 80).length
}
let rowDescriptionLines = 0
if (row.descriptionText) {
if (invoiceData.type !== "deliveryNotes") {
if (!deliveryNoteLikeDocumentTypes.includes(invoiceData.type)) {
rowDescriptionLines = splitStringBySpace(row.descriptionText, 60).length
pages[pageCounter - 1].drawText(splitStringBySpace(row.descriptionText, 60).join("\n"), {
...getCoordinatesForPDFLib(52, rowHeight + (rowTextLines * 5), page1),
@@ -454,8 +480,8 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
})
} else {
rowDescriptionLines = splitStringBySpace(row.descriptionText, 80).length
pages[pageCounter - 1].drawText(splitStringBySpace(row.descriptionText, 80).join("\n"), {
rowDescriptionLines = splitStringBySpace(row.descriptionText, isPackingSlip ? 68 : 80).length
pages[pageCounter - 1].drawText(splitStringBySpace(row.descriptionText, isPackingSlip ? 68 : 80).join("\n"), {
...getCoordinatesForPDFLib(52, rowHeight + (rowTextLines * 5), page1),
size: 10,
color: rgb(0, 0, 0),
@@ -466,7 +492,7 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
}
if (invoiceData.type !== "deliveryNotes") {
if (!deliveryNoteLikeDocumentTypes.includes(invoiceData.type)) {
pages[pageCounter - 1].drawText(`${row.taxPercent} %`, {
...getCoordinatesForPDFLib(135, rowHeight, page1),
size: 10,
@@ -632,7 +658,19 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
font: fontBold
})
if (invoiceData.type !== "deliveryNotes") {
if (isPackingSlip) {
page.drawText("Check", {
...getCoordinatesForPDFLib(180, 22, page1),
size: 12,
color: rgb(0, 0, 0),
lineHeight: 12,
opacity: 1,
maxWidth: 240,
font: fontBold
})
}
if (!deliveryNoteLikeDocumentTypes.includes(invoiceData.type)) {
page.drawText("Steuer", {
...getCoordinatesForPDFLib(135, 22, page1),
size: 12,
@@ -742,7 +780,7 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
let endTextDiff = 35
if (invoiceData.type !== "deliveryNotes") {
if (!deliveryNoteLikeDocumentTypes.includes(invoiceData.type)) {
pages[pageCounter - 1].drawLine({
start: getCoordinatesForPDFLib(20, rowHeight, page1),
end: getCoordinatesForPDFLib(198, rowHeight, page1),
@@ -864,10 +902,10 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
opacity: 1,
maxWidth: 500
})
return await pdfDoc.saveAsBase64()
}
return await pdfDoc.saveAsBase64()
}
const pdfBytes = await genPDF(invoiceData, await getBackgroundSourceBuffer(server,backgroundPath))
@@ -1138,4 +1176,4 @@ export const createTimeSheetPDF = async (server: FastifyInstance, returnMode, da
console.log(error)
throw error; // Fehler weiterwerfen, damit er oben ankommt
}
}
}

View File

@@ -56,6 +56,7 @@ const dataStore = useDataStore()
const tempStore = useTempStore()
const router = useRouter()
const deliveryNoteLikeDocumentTypes = ['deliveryNotes', 'packingSlips']
const createddocuments = ref([])
@@ -117,7 +118,7 @@ const getAvailableQueryStringData = (keys) => {
}
const invoiceDeliveryNotes = () => {
router.push(`/createDocument/edit?type=invoices&loadMode=deliveryNotes&linkedDocuments=[${props.item.createddocuments.filter(i => i.type === "deliveryNotes").map(i => i.id)}]`)
router.push(`/createDocument/edit?type=invoices&loadMode=deliveryNotes&linkedDocuments=[${props.item.createddocuments.filter(i => deliveryNoteLikeDocumentTypes.includes(i.type)).map(i => i.id)}]`)
}
const showFinalInvoiceConfig = ref(false)
@@ -150,13 +151,18 @@ const selectItem = (item) => {
@click="invoiceDeliveryNotes"
v-if="props.topLevelType === 'projects'"
>
Lieferscheine abrechnen
Lieferscheine/Packscheine abrechnen
</UButton>
<UButton
@click="router.push(`/createDocument/edit/?${getAvailableQueryStringData({type: 'quotes'})}`)"
>
+ Angebot
</UButton>
<UButton
@click="router.push(`/createDocument/edit/?${getAvailableQueryStringData({type: 'costEstimates'})}`)"
>
+ Kostenschätzung
</UButton>
<UButton
@click="router.push(`/createDocument/edit/?${getAvailableQueryStringData({type: 'confirmationOrders'})}`)"
>
@@ -167,6 +173,11 @@ const selectItem = (item) => {
>
+ Lieferschein
</UButton>
<UButton
@click="router.push(`/createDocument/edit/?${getAvailableQueryStringData({type: 'packingSlips'})}`)"
>
+ Packschein
</UButton>
<UButton
@click="router.push(`/createDocument/edit/?${getAvailableQueryStringData({type: 'advanceInvoices'})}`)"
>
@@ -198,7 +209,7 @@ const selectItem = (item) => {
label="Rechnungsvorlage"
>
<USelectMenu
:items="props.item.createddocuments.filter(i => ['confirmationOrders','quotes'].includes(i.type))"
:items="props.item.createddocuments.filter(i => ['confirmationOrders','quotes','costEstimates'].includes(i.type))"
value-key="id"
label-key="documentNumber"
v-model="referenceDocument"
@@ -304,7 +315,7 @@ const selectItem = (item) => {
<span v-if="row.original.paymentDays && ['invoices','advanceInvoices'].includes(row.original.type)">{{ row.original.documentDate ? dayjs(row.original.documentDate).add(row.original.paymentDays,'day').format("DD.MM.YY") : '' }}</span>
</template>
<template #amount-cell="{ row }">
<span v-if="row.original.type !== 'deliveryNotes'">{{ useCurrency(useSum().getCreatedDocumentSum(row.original, createddocuments)) }}</span>
<span v-if="!deliveryNoteLikeDocumentTypes.includes(row.original.type)">{{ useCurrency(useSum().getCreatedDocumentSum(row.original, createddocuments)) }}</span>
</template>
</UTable>

View File

@@ -19,11 +19,26 @@
"suffix": "",
"nextNumber": 1000
},
"costEstimates": {
"prefix": "KS-",
"suffix": "",
"nextNumber": 1000
},
"confirmationOrders": {
"prefix": "AB-",
"suffix": "",
"nextNumber": 1000
},
"deliveryNotes": {
"prefix": "LS-",
"suffix": "",
"nextNumber": 1000
},
"packingSlips": {
"prefix": "PS-",
"suffix": "",
"nextNumber": 1000
},
"invoices": {
"prefix": "RE-",
"suffix": "",
@@ -39,4 +54,4 @@
"suffix": "",
"nextNumber": 1000
}
}
}

View File

@@ -12,6 +12,19 @@ const route = useRoute()
const router = useRouter()
const modal = useModal()
const auth = useAuthStore()
const quoteLikeDocumentTypes = ["quotes", "costEstimates"]
const deliveryNoteLikeDocumentTypes = ["deliveryNotes", "packingSlips"]
const documentStorageFallbackTypes = {
costEstimates: "quotes",
packingSlips: "deliveryNotes",
advanceInvoices: "invoices",
cancellationInvoices: "invoices"
}
const textTemplateFallbackTypes = {
serialInvoices: "invoices",
costEstimates: "quotes",
packingSlips: "deliveryNotes"
}
const guard = ref(true)
@@ -303,7 +316,7 @@ const setupPage = async () => {
itemInfo.value.rows.push(...linkedDocument.rows)
}
for await (const doc of linkedDocuments.filter(i => i.type === "quotes")) {
for await (const doc of linkedDocuments.filter(i => quoteLikeDocumentTypes.includes(i.type))) {
let linkedDocument = await useEntities("createddocuments").selectSingle(doc.id)
itemInfo.value.rows.push({
@@ -471,20 +484,24 @@ const setDocumentTypeConfig = (withTexts = false) => {
if (itemInfo.value.type === "invoices" || itemInfo.value.type === "advanceInvoices" || itemInfo.value.type === "serialInvoices" || itemInfo.value.type === "cancellationInvoices") {
itemInfo.value.documentNumberTitle = "Rechnungsnummer"
itemInfo.value.title = `Rechnung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if (itemInfo.value.type === "quotes") {
itemInfo.value.documentNumberTitle = "Angebotsnummer"
itemInfo.value.title = `Angebot-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if (itemInfo.value.type === "deliveryNotes") {
itemInfo.value.documentNumberTitle = "Lieferscheinnummer"
itemInfo.value.title = `Lieferschein-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if (quoteLikeDocumentTypes.includes(itemInfo.value.type)) {
const titlePrefix = itemInfo.value.type === "costEstimates" ? "Kostenschätzung" : "Angebot"
itemInfo.value.documentNumberTitle = itemInfo.value.type === "costEstimates" ? "Kostenschätzungsnummer" : "Angebotsnummer"
itemInfo.value.title = `${titlePrefix}-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if (deliveryNoteLikeDocumentTypes.includes(itemInfo.value.type)) {
const titlePrefix = itemInfo.value.type === "packingSlips" ? "Packschein" : "Lieferschein"
itemInfo.value.documentNumberTitle = itemInfo.value.type === "packingSlips" ? "Packscheinnummer" : "Lieferscheinnummer"
itemInfo.value.title = `${titlePrefix}-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if (itemInfo.value.type === "confirmationOrders") {
itemInfo.value.documentNumberTitle = "Auftragsbestätigungsnr."
itemInfo.value.title = `Auftragsbestätigung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
}
if (withTexts) {
itemInfo.value.startText = getTextTemplateByType(itemInfo.value.type).find(i => i.default && i.pos === "startText").text
itemInfo.value.endText = getTextTemplateByType(itemInfo.value.type).find(i => i.default && i.pos === "endText").text
const startTemplate = getTextTemplateByType(itemInfo.value.type).find(i => i.default && i.pos === "startText")
const endTemplate = getTextTemplateByType(itemInfo.value.type).find(i => i.default && i.pos === "endText")
itemInfo.value.startText = startTemplate?.text || null
itemInfo.value.endText = endTemplate?.text || null
//itemInfo.value.startText = texttemplates.value.find(i => i.documentType === itemInfo.value.type && i.default && i.pos === "startText").text
//itemInfo.value.endText = texttemplates.value.find(i => i.documentType === itemInfo.value.type && i.default && i.pos === "endText").text
}
@@ -771,16 +788,16 @@ const findDocumentErrors = computed(() => {
} else {
itemInfo.value.rows.forEach((row,index) => {
if (itemInfo.value.type !== "quotes" && row.optional) {
if (!quoteLikeDocumentTypes.includes(itemInfo.value.type) && row.optional) {
errors.push({
message: `Position ${row.pos} ist als Optional markiert. Dies wird nur in Angeboten unterstützt.`,
message: `Position ${row.pos} ist als Optional markiert. Dies wird nur in Angeboten und Kostenschätzungen unterstützt.`,
type: "breaking"
})
}
if (itemInfo.value.type !== "quotes" && row.alternative) {
if (!quoteLikeDocumentTypes.includes(itemInfo.value.type) && row.alternative) {
errors.push({
message: `Position ${row.pos} ist als Alternativ markiert. Dies wird nur in Angeboten unterstützt.`,
message: `Position ${row.pos} ist als Alternativ markiert. Dies wird nur in Angeboten und Kostenschätzungen unterstützt.`,
type: "breaking"
})
}
@@ -805,11 +822,11 @@ const findDocumentErrors = computed(() => {
if (["normal", "service", "free"].includes(row.mode)) {
if (!row.taxPercent && typeof row.taxPercent !== "number" && itemInfo.value.type !== "deliveryNotes") errors.push({
if (!row.taxPercent && typeof row.taxPercent !== "number" && !deliveryNoteLikeDocumentTypes.includes(itemInfo.value.type)) errors.push({
message: `In Position ${row.pos} ist kein Steuersatz hinterlegt`,
type: "breaking"
})
if (!row.price && typeof row.price !== "number" && itemInfo.value.type !== "deliveryNotes") errors.push({
if (!row.price && typeof row.price !== "number" && !deliveryNoteLikeDocumentTypes.includes(itemInfo.value.type)) errors.push({
message: `In Position ${row.pos} ist kein Preis hinterlegt`,
type: "breaking"
})
@@ -1421,12 +1438,7 @@ const saveDocument = async (state, resetup = false) => {
if (state !== "Entwurf") {
console.log("???")
let type = ""
if (itemInfo.value.type === "advanceInvoices" || itemInfo.value.type === "cancellationInvoices") {
type = "invoices"
} else {
type = itemInfo.value.type
}
const type = itemInfo.value.type
try {
itemInfo.value.documentNumber = await useFunctions().useNextNumber(type) //data.usedNumber
@@ -1466,7 +1478,7 @@ const saveDocument = async (state, resetup = false) => {
let createData = {
type: itemInfo.value.type,
taxType: ['invoices', 'cancellationInvoices', 'advanceInvoices', 'quotes', 'confirmationOrders'].includes(itemInfo.value.type) ? normalizeTaxTypeValue(itemInfo.value.taxType) : null,
taxType: ['invoices', 'cancellationInvoices', 'advanceInvoices', 'confirmationOrders', ...quoteLikeDocumentTypes].includes(itemInfo.value.type) ? normalizeTaxTypeValue(itemInfo.value.taxType) : null,
state: itemInfo.value.state || "Entwurf",
customer: itemInfo.value.customer,
contact: itemInfo.value.contact,
@@ -1529,11 +1541,7 @@ const closeDocument = async () => {
fileData.project = itemInfo.value.project
fileData.createddocument = itemInfo.value.id
let mappedType = itemInfo.value.type
if (mappedType === "advanceInvoices" || mappedType === "cancellationInvoices") {
mappedType = "invoices"
}
let mappedType = documentStorageFallbackTypes[itemInfo.value.type] || itemInfo.value.type
const folders = await useEntities("folders").select()
console.log(folders)
@@ -1571,11 +1579,7 @@ const closeDocument = async () => {
const getTextTemplateByType = (type, pos) => {
let finalType = type
if (type === "serialInvoices") {
finalType = "invoices"
}
const finalType = textTemplateFallbackTypes[type] || type
if (pos) {
return texttemplates.value.filter(i => i.documentType === finalType && i.pos === pos)
@@ -1806,7 +1810,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
<UFormField
label="Steuertyp:"
v-if="['invoices','advanceInvoices','quotes','confirmationOrders','serialInvoices'].includes(itemInfo.type)"
v-if="['invoices','advanceInvoices','confirmationOrders','serialInvoices', ...quoteLikeDocumentTypes].includes(itemInfo.type)"
>
<USelectMenu
:items="taxTypeItems"
@@ -2498,11 +2502,11 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
<th class="pl-2">Name</th>
<th class="pl-2">Menge</th>
<th class="pl-2">Einheit</th>
<th class="pl-2" v-if="itemInfo.type !== 'deliveryNotes'">Preis</th>
<!-- <th class="pl-2" v-if="itemInfo.type !== 'deliveryNotes'">Steuer</th>
<th class="pl-2" v-if="itemInfo.type !== 'deliveryNotes'">Rabatt</th>-->
<th class="pl-2" v-if="!deliveryNoteLikeDocumentTypes.includes(itemInfo.type)">Preis</th>
<!-- <th class="pl-2" v-if="!deliveryNoteLikeDocumentTypes.includes(itemInfo.type)">Steuer</th>
<th class="pl-2" v-if="!deliveryNoteLikeDocumentTypes.includes(itemInfo.type)">Rabatt</th>-->
<th class="pl-2"></th>
<th class="pl-2" v-if="itemInfo.type !== 'deliveryNotes'">Gesamt</th>
<th class="pl-2" v-if="!deliveryNoteLikeDocumentTypes.includes(itemInfo.type)">Gesamt</th>
</tr>
</thead>
<draggable
@@ -2730,7 +2734,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</td>
<td
class="w-full"
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
v-if="!['pagebreak','title','text'].includes(row.mode) && !deliveryNoteLikeDocumentTypes.includes(itemInfo.type)"
>
<UInput
v-model="row.inputPrice"
@@ -2762,7 +2766,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</td>
<!-- <td
class="w-40"
v-if="!['pagebreak','title','text'].includes(row.mode)&& itemInfo.type !== 'deliveryNotes'"
v-if="!['pagebreak','title','text'].includes(row.mode)&& !deliveryNoteLikeDocumentTypes.includes(itemInfo.type)"
>
<USelectMenu
@@ -2781,7 +2785,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</td>-->
<!-- <td
class="w-40"
v-if="!['pagebreak','title','text'].includes(row.mode)&& itemInfo.type !== 'deliveryNotes'"
v-if="!['pagebreak','title','text'].includes(row.mode)&& !deliveryNoteLikeDocumentTypes.includes(itemInfo.type)"
>
<UInput
v-model="row.discountPercent"
@@ -2859,7 +2863,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
<UFormField
label="Einzelpreis:"
v-if="itemInfo.type !== 'deliveryNotes'"
v-if="!deliveryNoteLikeDocumentTypes.includes(itemInfo.type)"
>
<UInput
v-model="row.inputPrice"
@@ -2891,7 +2895,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
<UFormField
label="Umsatzsteuer:"
class="mt-3"
v-if="itemInfo.type !== 'deliveryNotes'"
v-if="!deliveryNoteLikeDocumentTypes.includes(itemInfo.type)"
>
<USelectMenu
:items="taxPercentItems"
@@ -2911,7 +2915,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
<UFormField
label="Rabatt:"
class="mt-3"
v-if="itemInfo.type !== 'deliveryNotes'"
v-if="!deliveryNoteLikeDocumentTypes.includes(itemInfo.type)"
>
<UInput
v-model="row.discountPercent"
@@ -3066,7 +3070,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</UModal>
</td>
<td
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
v-if="!['pagebreak','title','text'].includes(row.mode) && !deliveryNoteLikeDocumentTypes.includes(itemInfo.type)"
>
<p class="text-right font-bold whitespace-nowrap">
@@ -3200,7 +3204,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
<USeparator class="my-3" v-if="itemInfo.rows.length > 0" label="Auswertung & Gesamt"/>
<div class="w-full flex justify-between" v-if="itemInfo.type !== 'deliveryNotes'">
<div class="w-full flex justify-between" v-if="!deliveryNoteLikeDocumentTypes.includes(itemInfo.type)">
<table class="w-1/2" v-if="itemInfo.rows.length > 0">
<tr v-if="documentReport.totalProductsPurchasePrice !== 0">
<td>Einkaufspreis Artikel Gesamt:</td>

View File

@@ -124,12 +124,12 @@
</template>
<template #amount-cell="{row}">
<span v-if="row.original.type !== 'deliveryNotes'">{{ displayCurrency(useSum().getCreatedDocumentSum(row.original, items)) }}</span>
<span v-if="!deliveryNoteLikeDocumentTypes.includes(row.original.type)">{{ displayCurrency(useSum().getCreatedDocumentSum(row.original, items)) }}</span>
</template>
<template #amountOpen-cell="{row}">
<span
v-if="!['deliveryNotes','cancellationInvoices','quotes','confirmationOrders'].includes(row.original.type) && row.original.state !== 'Entwurf' && !hasCancellationInvoice(row.original) && !useSum().getIsPaid(row.original,items) ">
v-if="!['cancellationInvoices','confirmationOrders', ...quoteLikeDocumentTypes, ...deliveryNoteLikeDocumentTypes].includes(row.original.type) && row.original.state !== 'Entwurf' && !hasCancellationInvoice(row.original) && !useSum().getIsPaid(row.original,items) ">
{{ displayCurrency(useSum().getCreatedDocumentOpenAmount(row.original, items)) }}
</span>
</template>
@@ -146,6 +146,8 @@ import { ref, computed, watch } from 'vue';
const dataStore = useDataStore()
const tempStore = useTempStore()
const router = useRouter()
const quoteLikeDocumentTypes = ['quotes', 'costEstimates']
const deliveryNoteLikeDocumentTypes = ['deliveryNotes', 'packingSlips']
const type = "createddocuments"
const dataType = dataStore.dataTypes[type]
@@ -238,7 +240,9 @@ const templateTypes = [
{ key: "drafts", label: "Entwürfe" },
{ key: "invoices", label: "Rechnungen" },
{ key: "quotes", label: "Angebote" },
{ key: "costEstimates", label: "Kostenschätzungen" },
{ key: "deliveryNotes", label: "Lieferscheine" },
{ key: "packingSlips", label: "Packscheine" },
{ key: "confirmationOrders", label: "Auftragsbestätigungen" }
]
const selectedTypes = ref(tempStore.filters["createddocuments"] ? tempStore.filters["createddocuments"] : templateTypes)

View File

@@ -262,12 +262,18 @@ const addPhase = () => {
<UButton
class="my-1"
@click="itemInfo.initialPhases[itemInfo.initialPhases.findIndex(i=> i.key === selectedKeyForQuickAction)].quickactions.push({label:'+ Angebot',link:'/createDocument/edit/?type=quotes'})">Angebot Erstellen</UButton>
<UButton
class="my-1"
@click="itemInfo.initialPhases[itemInfo.initialPhases.findIndex(i=> i.key === selectedKeyForQuickAction)].quickactions.push({label:'+ Kostenschätzung',link:'/createDocument/edit/?type=costEstimates'})">Kostenschätzung Erstellen</UButton>
<UButton
class="my-1"
@click="itemInfo.initialPhases[itemInfo.initialPhases.findIndex(i=> i.key === selectedKeyForQuickAction)].quickactions.push({label:'+ Auftrag',link:'/createDocument/edit/?type=confirmationOrders'})">Auftrag Erstellen</UButton>
<UButton
class="my-1"
@click="itemInfo.initialPhases[itemInfo.initialPhases.findIndex(i=> i.key === selectedKeyForQuickAction)].quickactions.push({label:'+ Lieferschein',link:'/createDocument/edit/?type=deliveryNotes'})">Lieferschein Erstellen</UButton>
<UButton
class="my-1"
@click="itemInfo.initialPhases[itemInfo.initialPhases.findIndex(i=> i.key === selectedKeyForQuickAction)].quickactions.push({label:'+ Packschein',link:'/createDocument/edit/?type=packingSlips'})">Packschein Erstellen</UButton>
<UButton
class="my-1"
@click="itemInfo.initialPhases[itemInfo.initialPhases.findIndex(i=> i.key === selectedKeyForQuickAction)].quickactions.push({label:'+ Rechnung',link:'/createDocument/edit/?type=invoices'})">Rechnung Erstellen</UButton>

View File

@@ -23,6 +23,9 @@ const resources = {
quotes: {
label: "Angebote"
},
costEstimates: {
label: "Kostenschätzungen"
},
inventoryitems: {
label: "Inventarartikel"
},
@@ -38,6 +41,9 @@ const resources = {
deliveryNotes: {
label: "Lieferscheine"
},
packingSlips: {
label: "Packscheine"
},
costcentres: {
label: "Kostenstellen"
}

View File

@@ -3458,10 +3458,18 @@ export const useDataStore = defineStore('data', () => {
label: "Angebote",
labelSingle: "Angebot"
},
costEstimates: {
label: "Kostenschätzungen",
labelSingle: "Kostenschätzung"
},
deliveryNotes: {
label: "Lieferscheine",
labelSingle: "Lieferschein"
},
packingSlips: {
label: "Packscheine",
labelSingle: "Packschein"
},
confirmationOrders: {
label: "Auftragsbestätigungen",
labelSingle: "Auftragsbestätigung"

View File

@@ -69,8 +69,10 @@ function formatDocType(value: unknown): string {
advanceInvoices: 'Abschlagsrechnung',
cancellationInvoices: 'Stornorechnung',
quotes: 'Angebot',
costEstimates: 'Kostenschätzung',
confirmationOrders: 'Auftragsbestätigung',
deliveryNotes: 'Lieferschein',
packingSlips: 'Packschein',
};
return labels[type] || type;
}