Rebuild Inventory
Added Advance Invoices
This commit is contained in:
@@ -88,7 +88,7 @@ const setupPage = () => {
|
||||
}
|
||||
|
||||
const setDocumentTypeConfig = () => {
|
||||
if(itemInfo.value.type === "invoices") {
|
||||
if(itemInfo.value.type === "invoices" ||itemInfo.value.type === "advanceInvoices") {
|
||||
itemInfo.value.documentNumberTitle = "Rechnungsnummer"
|
||||
itemInfo.value.title = `Rechnung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
|
||||
} else if(itemInfo.value.type === "quotes") {
|
||||
@@ -120,7 +120,7 @@ const setCustomerData = () => {
|
||||
|
||||
const setContactPersonData = () => {
|
||||
let profile = dataStore.activeProfile
|
||||
console.log(profile)
|
||||
//console.log(profile)
|
||||
|
||||
if(!itemInfo.value.contactPerson) itemInfo.value.contactPerson = profile.id
|
||||
|
||||
@@ -132,6 +132,40 @@ const setContactPersonData = () => {
|
||||
|
||||
}
|
||||
|
||||
const showAdvanceInvoiceCalcModal = ref(false)
|
||||
const advanceInvoiceData = ref({
|
||||
totalSumNet: 0,
|
||||
partPerPecentage: 0,
|
||||
part: 0
|
||||
})
|
||||
const importPositions = () => {
|
||||
if(itemInfo.value.type === 'advanceInvoices') {
|
||||
if(advanceInvoiceData.value.totalSumNet !== 0 && advanceInvoiceData.value.partPerPecentage !== 0 && advanceInvoiceData.value.part !== 0) {
|
||||
showAdvanceInvoiceCalcModal.value = false
|
||||
|
||||
let lastId = 0
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
if(row.id > lastId) lastId = row.id
|
||||
})
|
||||
|
||||
itemInfo.value.rows.push({
|
||||
id: lastId +1,
|
||||
mode: "free",
|
||||
text: "Abschlagszahlung",
|
||||
quantity: 1,
|
||||
unit: 10,
|
||||
price: advanceInvoiceData.value.part,
|
||||
taxPercent: 19,
|
||||
discountPercent: 0,
|
||||
advanceInvoiceData: advanceInvoiceData.value
|
||||
})
|
||||
setPosNumbers()
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const getRowAmount = (row) => {
|
||||
@@ -465,17 +499,73 @@ setupPage()
|
||||
<UFormGroup
|
||||
label="Dokumenttyp:"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="Object.keys(dataStore.documentTypesForCreation).map(i => {return {label: dataStore.documentTypesForCreation[i].labelSingle, type: i }})"
|
||||
v-model="itemInfo.type"
|
||||
value-attribute="type"
|
||||
option-attribute="label"
|
||||
@change="setDocumentTypeConfig"
|
||||
<InputGroup>
|
||||
<USelectMenu
|
||||
:options="Object.keys(dataStore.documentTypesForCreation).map(i => {return {label: dataStore.documentTypesForCreation[i].labelSingle, type: i }})"
|
||||
v-model="itemInfo.type"
|
||||
value-attribute="type"
|
||||
option-attribute="label"
|
||||
@change="setDocumentTypeConfig"
|
||||
class="flex-auto"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.documentTypesForCreation[itemInfo.type].labelSingle}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
variant="outline"
|
||||
v-if="itemInfo.type === 'advanceInvoices'"
|
||||
icon="i-heroicons-arrow-down-tray"
|
||||
@click="showAdvanceInvoiceCalcModal = true"
|
||||
>Auto Positionen</UButton>
|
||||
</InputGroup>
|
||||
|
||||
<USlideover
|
||||
v-model="showAdvanceInvoiceCalcModal"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.documentTypesForCreation[itemInfo.type].labelSingle}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UCard class="h-full">
|
||||
<template #header>
|
||||
<UButton @click="importPositions">Übernehmen</UButton>
|
||||
</template>
|
||||
|
||||
<UFormGroup
|
||||
label="Gesamtsumme:"
|
||||
>
|
||||
<UInput
|
||||
type="number"
|
||||
:step="0.01"
|
||||
v-model="advanceInvoiceData.totalSumNet"
|
||||
@focusout="advanceInvoiceData.part = advanceInvoiceData.totalSumNet / 100 * advanceInvoiceData.partPerPecentage"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Prozent:"
|
||||
>
|
||||
<UInput
|
||||
type="number"
|
||||
:step="0.01"
|
||||
v-model="advanceInvoiceData.partPerPecentage"
|
||||
@focusout="advanceInvoiceData.part = advanceInvoiceData.totalSumNet / 100 * advanceInvoiceData.partPerPecentage"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
label="Abzurechnender Anteil:"
|
||||
>
|
||||
<UInput
|
||||
type="number"
|
||||
:step="0.01"
|
||||
v-model="advanceInvoiceData.part"
|
||||
@focusout="advanceInvoiceData.partPerPecentage = Number((advanceInvoiceData.part / advanceInvoiceData.totalSumNet * 100).toFixed(2))"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
|
||||
|
||||
</UCard>
|
||||
|
||||
</USlideover>
|
||||
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Kunde:"
|
||||
@@ -747,7 +837,7 @@ setupPage()
|
||||
{{option.name}} - {{option.text}}
|
||||
</template>
|
||||
<template #label>
|
||||
{{dataStore.texttemplates.find(i => i.text === itemInfo.startText) ? dataStore.texttemplates.find(i => i.text === itemInfo.startText).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
||||
{{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"}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
|
||||
@@ -193,6 +193,9 @@ const templateTypes = [
|
||||
{
|
||||
key: "invoices",
|
||||
label: "Rechnungen"
|
||||
},{
|
||||
key: "advanceInvoices",
|
||||
label: "Abschlagsrechnungen"
|
||||
}, {
|
||||
key: "quotes",
|
||||
label: "Angebote"
|
||||
|
||||
Reference in New Issue
Block a user