Pushed Serial Invoices
This commit is contained in:
@@ -100,6 +100,10 @@ const links = computed(() => {
|
|||||||
label: "Ausgangsbelege",
|
label: "Ausgangsbelege",
|
||||||
to: "/createDocument",
|
to: "/createDocument",
|
||||||
icon: "i-heroicons-document-text"
|
icon: "i-heroicons-document-text"
|
||||||
|
},{
|
||||||
|
label: "Serienvorlagen",
|
||||||
|
to: "/createDocument/serialInvoice",
|
||||||
|
icon: "i-heroicons-document-text"
|
||||||
},{
|
},{
|
||||||
label: "Eingangsbelege",
|
label: "Eingangsbelege",
|
||||||
to: "/incomingInvoices",
|
to: "/incomingInvoices",
|
||||||
|
|||||||
@@ -44,15 +44,25 @@ const itemInfo = ref({
|
|||||||
contactPersonName: null,
|
contactPersonName: null,
|
||||||
contactTel: null,
|
contactTel: null,
|
||||||
contactEMail: null,
|
contactEMail: null,
|
||||||
|
serialConfig: {
|
||||||
|
firstExecution: "",
|
||||||
|
intervall: "monatlich",
|
||||||
|
executionUntil: "",
|
||||||
|
active: true,
|
||||||
|
dateDirection: "Rückwirkend",
|
||||||
|
},
|
||||||
|
letterhead: null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const letterheads = ref([])
|
const letterheads = ref([])
|
||||||
|
const createdDocuments = ref([])
|
||||||
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
|
|
||||||
letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
|
letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
|
||||||
|
createdDocuments.value = (await useSupabaseSelect("createddocuments","*"))
|
||||||
|
|
||||||
if(route.params) {
|
if(route.params) {
|
||||||
if(route.params.id) itemInfo.value = dataStore.getCreatedDocumentById(Number(route.params.id))
|
if(route.params.id) itemInfo.value = dataStore.getCreatedDocumentById(Number(route.params.id))
|
||||||
@@ -292,6 +302,13 @@ const findDocumentErrors = computed(() => {
|
|||||||
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 ausgewählt`, type: "breaking"})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if(itemInfo.value.type === "serialInvoices") {
|
||||||
|
if(!itemInfo.value.serialConfig.intervall) errors.push({message: `Kein Intervall für die Ausführung festgelegt`, type: "breaking"})
|
||||||
|
if(!itemInfo.value.serialConfig.dateDirection) errors.push({message: `Kein Richtung für die Datierung festgelegt`, type: "breaking"})
|
||||||
|
if(!itemInfo.value.serialConfig.firstExecution) errors.push({message: `Kein Datum für die erste Ausführung festgelegt`, type: "breaking"})
|
||||||
|
if(!itemInfo.value.serialConfig.executionUntil) errors.push({message: `Kein Datum für die letzte Ausführung festgelegt`, type: "info"})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return errors
|
return errors
|
||||||
})
|
})
|
||||||
@@ -460,6 +477,37 @@ const setPosNumbers = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const saveSerialInvoice = async () => {
|
||||||
|
let createData = {
|
||||||
|
type: itemInfo.value.type,
|
||||||
|
state: 'Erstellt',
|
||||||
|
customer: itemInfo.value.customer,
|
||||||
|
contact: itemInfo.value.contact,
|
||||||
|
address: itemInfo.value.address,
|
||||||
|
project: itemInfo.value.project,
|
||||||
|
paymentDays: itemInfo.value.paymentDays,
|
||||||
|
deliveryDateType: itemInfo.value.deliveryDateType,
|
||||||
|
createdBy: itemInfo.value.createdBy,
|
||||||
|
title: itemInfo.value.title,
|
||||||
|
description: itemInfo.value.description,
|
||||||
|
startText: itemInfo.value.startText,
|
||||||
|
endText: itemInfo.value.endText,
|
||||||
|
rows: itemInfo.value.rows,
|
||||||
|
contactPerson: itemInfo.value.contactPerson,
|
||||||
|
serialConfig: itemInfo.value.serialConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = null
|
||||||
|
|
||||||
|
if(route.params.id) {
|
||||||
|
data = await dataStore.updateItem("createddocuments", {...createData, id: itemInfo.value.id})
|
||||||
|
} else {
|
||||||
|
data = await dataStore.createNewItem("createddocuments", createData)
|
||||||
|
}
|
||||||
|
|
||||||
|
await router.push(`/createDocument/edit/${data[0].id}`)
|
||||||
|
}
|
||||||
|
|
||||||
const saveDocument = async () => {
|
const saveDocument = async () => {
|
||||||
let createData = {
|
let createData = {
|
||||||
type: itemInfo.value.type,
|
type: itemInfo.value.type,
|
||||||
@@ -482,7 +530,8 @@ const saveDocument = async () => {
|
|||||||
startText: itemInfo.value.startText,
|
startText: itemInfo.value.startText,
|
||||||
endText: itemInfo.value.endText,
|
endText: itemInfo.value.endText,
|
||||||
rows: itemInfo.value.rows,
|
rows: itemInfo.value.rows,
|
||||||
contactPerson: itemInfo.value.contactPerson
|
contactPerson: itemInfo.value.contactPerson,
|
||||||
|
linkedDocument: itemInfo.value.linkedDocument
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = null
|
let data = null
|
||||||
@@ -547,15 +596,24 @@ setupPage()
|
|||||||
<UButton
|
<UButton
|
||||||
icon="i-mdi-content-save"
|
icon="i-mdi-content-save"
|
||||||
@click="saveDocument"
|
@click="saveDocument"
|
||||||
|
v-if="itemInfo.type !== 'serialInvoices' "
|
||||||
|
:disabled="!itemInfo.customer"
|
||||||
>
|
>
|
||||||
Entwurf
|
Entwurf
|
||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
@click="closeDocument"
|
@click="closeDocument"
|
||||||
v-if="itemInfo.id"
|
v-if="itemInfo.id && itemInfo.type !== 'serialInvoices'"
|
||||||
>
|
>
|
||||||
Fertigstellen
|
Fertigstellen
|
||||||
</UButton>
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
icon="i-mdi-content-save"
|
||||||
|
@click="saveSerialInvoice"
|
||||||
|
v-if="itemInfo.type === 'serialInvoices'"
|
||||||
|
>
|
||||||
|
Serienrechnung
|
||||||
|
</UButton>
|
||||||
</template>
|
</template>
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
|
|
||||||
@@ -586,6 +644,29 @@ setupPage()
|
|||||||
|
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
<div class="w-1/3 mr-5">
|
<div class="w-1/3 mr-5">
|
||||||
|
<UFormGroup
|
||||||
|
v-if="itemInfo.linkedDocument"
|
||||||
|
label="Verknüpftes Dokument:"
|
||||||
|
>
|
||||||
|
<InputGroup class="w-full">
|
||||||
|
<USelectMenu
|
||||||
|
class="flex-auto"
|
||||||
|
:options="createdDocuments"
|
||||||
|
v-model="itemInfo.linkedDocument"
|
||||||
|
option-attribute="documentNumber"
|
||||||
|
value-attribute="id"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
<UButton
|
||||||
|
variant="outline"
|
||||||
|
color="rose"
|
||||||
|
v-if="itemInfo.linkedDocument"
|
||||||
|
icon="i-heroicons-x-mark"
|
||||||
|
@click="itemInfo.linkedDocument = null"
|
||||||
|
/>
|
||||||
|
</InputGroup>
|
||||||
|
|
||||||
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Dokumenttyp:"
|
label="Dokumenttyp:"
|
||||||
>
|
>
|
||||||
@@ -781,6 +862,7 @@ setupPage()
|
|||||||
<div class="w-2/3">
|
<div class="w-2/3">
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
:label="itemInfo.documentNumberTitle + ':'"
|
:label="itemInfo.documentNumberTitle + ':'"
|
||||||
|
v-if="itemInfo.type !== 'serialInvoices'"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
v-model="itemInfo.documentNumber"
|
v-model="itemInfo.documentNumber"
|
||||||
@@ -793,6 +875,7 @@ setupPage()
|
|||||||
<InputGroup class="w-full">
|
<InputGroup class="w-full">
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Datum:"
|
label="Datum:"
|
||||||
|
v-if="itemInfo.type !== 'serialInvoices'"
|
||||||
>
|
>
|
||||||
<UPopover :popper="{ placement: 'bottom-start' }">
|
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||||
<UButton
|
<UButton
|
||||||
@@ -809,6 +892,7 @@ setupPage()
|
|||||||
<UFormGroup
|
<UFormGroup
|
||||||
class="mt-3 w-80"
|
class="mt-3 w-80"
|
||||||
label="Lieferdatumsart:"
|
label="Lieferdatumsart:"
|
||||||
|
v-if="itemInfo.type !== 'serialInvoices'"
|
||||||
>
|
>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
:options="['Lieferdatum'/*,'Lieferzeitraum'*/,'Leistungsdatum'/*,'Leistungszeitraum'*/,'Kein Lieferdatum anzeigen']"
|
:options="['Lieferdatum'/*,'Lieferzeitraum'*/,'Leistungsdatum'/*,'Leistungszeitraum'*/,'Kein Lieferdatum anzeigen']"
|
||||||
@@ -820,6 +904,7 @@ setupPage()
|
|||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
:label="itemInfo.deliveryDateType"
|
:label="itemInfo.deliveryDateType"
|
||||||
|
v-if="itemInfo.type !== 'serialInvoices'"
|
||||||
>
|
>
|
||||||
<UPopover :popper="{ placement: 'bottom-start' }">
|
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||||
<UButton
|
<UButton
|
||||||
@@ -844,13 +929,6 @@ setupPage()
|
|||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Ansprechpartner:"
|
label="Ansprechpartner:"
|
||||||
>
|
>
|
||||||
@@ -936,6 +1014,82 @@ setupPage()
|
|||||||
</div>
|
</div>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
|
|
||||||
|
<div v-if="itemInfo.type === 'serialInvoices'" class="mb-5">
|
||||||
|
<UDivider class="mt-5 mb-3">
|
||||||
|
Einstellungen für die Serienrechnung
|
||||||
|
</UDivider>
|
||||||
|
|
||||||
|
<div class="flex flex-row">
|
||||||
|
<div class="w-1/3">
|
||||||
|
<UFormGroup
|
||||||
|
label="Datum erste Ausführung:"
|
||||||
|
>
|
||||||
|
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||||
|
<UButton
|
||||||
|
icon="i-heroicons-calendar-days-20-solid"
|
||||||
|
:label="itemInfo.serialConfig.firstExecution ? dayjs(itemInfo.serialConfig.firstExecution).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||||
|
variant="outline"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #panel="{ close }">
|
||||||
|
<LazyDatePicker v-model="itemInfo.serialConfig.firstExecution" @close="close" />
|
||||||
|
</template>
|
||||||
|
</UPopover>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Datum letzte Ausführung:"
|
||||||
|
>
|
||||||
|
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||||
|
<UButton
|
||||||
|
icon="i-heroicons-calendar-days-20-solid"
|
||||||
|
:label="itemInfo.serialConfig.executionUntil ? dayjs(itemInfo.serialConfig.executionUntil).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||||
|
variant="outline"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #panel="{ close }">
|
||||||
|
<LazyDatePicker v-model="itemInfo.serialConfig.executionUntil" @close="close" />
|
||||||
|
</template>
|
||||||
|
</UPopover>
|
||||||
|
</UFormGroup>
|
||||||
|
<UCheckbox
|
||||||
|
v-model="itemInfo.serialConfig.active"
|
||||||
|
label="Aktiv"
|
||||||
|
class="mt-3"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="w-2/3">
|
||||||
|
<UFormGroup
|
||||||
|
label="Intervall:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
v-model="itemInfo.serialConfig.intervall"
|
||||||
|
:options="['wöchentlich','2 - wöchentlich', 'monatlich', 'vierteljährlich','halbjährlich', 'jährlich']"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Richtung:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
v-model="itemInfo.serialConfig.dateDirection"
|
||||||
|
:options="['Rückwirkend','Im Voraus']"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UAlert
|
||||||
|
title="Anfangs- und Enddatum"
|
||||||
|
description="Für das Anfangs- und Enddatum werden jeweils der ersten und letzte Tag des ausgewählten Intervalls und der Richtung automatisch ausgewählt"
|
||||||
|
class="mt-5"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<UDivider
|
<UDivider
|
||||||
class="my-3"
|
class="my-3"
|
||||||
/>
|
/>
|
||||||
@@ -969,7 +1123,7 @@ setupPage()
|
|||||||
{{option.name}} - {{option.text}}
|
{{option.name}} - {{option.text}}
|
||||||
</template>
|
</template>
|
||||||
<template #label>
|
<template #label>
|
||||||
{{dataStore.texttemplates.find(i => i.text === itemInfo.startText && i.documentType === itemInfo.type) ? dataStore.texttemplates.find(i => i.text === itemInfo.startText && i.documentType === itemInfo.type).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
{{dataStore.texttemplates.find(i => i.text === itemInfo.startText && (itemInfo.type === "serialInvoices" ? i.documentType === "invoices" : i.documentType === itemInfo.type)) ? dataStore.texttemplates.find(i => i.text === itemInfo.startText && (itemInfo.type === "serialInvoices" ? i.documentType === "invoices" : i.documentType === itemInfo.type)).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
||||||
</template>
|
</template>
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
@@ -1305,7 +1459,7 @@ setupPage()
|
|||||||
{{option.name}} - {{option.text}}
|
{{option.name}} - {{option.text}}
|
||||||
</template>
|
</template>
|
||||||
<template #label>
|
<template #label>
|
||||||
{{dataStore.texttemplates.find(i => i.text === itemInfo.endText) ? dataStore.texttemplates.find(i => i.text === itemInfo.endText).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
{{dataStore.texttemplates.find(i => i.text === itemInfo.endText && (itemInfo.type === "serialInvoices" ? i.documentType === "invoices" : i.documentType === itemInfo.type)) ? dataStore.texttemplates.find(i => i.text === itemInfo.endText && (itemInfo.type === "serialInvoices" ? i.documentType === "invoices" : i.documentType === itemInfo.type)).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
||||||
</template>
|
</template>
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|||||||
@@ -224,6 +224,9 @@ const templateTypes = [
|
|||||||
}, {
|
}, {
|
||||||
key: "deliveryNotes",
|
key: "deliveryNotes",
|
||||||
label: "Lieferscheine"
|
label: "Lieferscheine"
|
||||||
|
}, {
|
||||||
|
key: "confirmationOrders",
|
||||||
|
label: "Auftragsbestätigungen"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
const selectedTypes = ref(templateTypes)
|
const selectedTypes = ref(templateTypes)
|
||||||
@@ -237,12 +240,6 @@ const selectItem = (item) => {
|
|||||||
} else if(item.state !== "Entwurf") {
|
} else if(item.state !== "Entwurf") {
|
||||||
router.push(`/createDocument/show/${item.id}`)
|
router.push(`/createDocument/show/${item.id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const displayCurrency = (value, currency = "€") => {
|
const displayCurrency = (value, currency = "€") => {
|
||||||
@@ -255,6 +252,7 @@ const showDrafts = ref(false)
|
|||||||
const filteredRows = computed(() => {
|
const filteredRows = computed(() => {
|
||||||
|
|
||||||
let temp = items.value.filter(i => types.value.find(x => x.key === i.type))
|
let temp = items.value.filter(i => types.value.find(x => x.key === i.type))
|
||||||
|
temp = temp.filter(i => i.type !== "serialInvoices")
|
||||||
|
|
||||||
/*if(showDrafts.value === true) {
|
/*if(showDrafts.value === true) {
|
||||||
temp = temp.filter(i => i.state === "Entwurf")
|
temp = temp.filter(i => i.state === "Entwurf")
|
||||||
|
|||||||
Reference in New Issue
Block a user