Added CustomSurchargePercentage

Added RowEdit Modal
This commit is contained in:
2025-03-03 11:31:44 +01:00
parent 57b631ad72
commit c96ff65bc7
2 changed files with 83 additions and 16 deletions

View File

@@ -1030,7 +1030,8 @@ const saveDocument = async (state,resetup = false) => {
linkedDocument: itemInfo.value.linkedDocument,
agriculture: itemInfo.value.agriculture,
letterhead: itemInfo.value.letterhead,
usedAdvanceInvoices: itemInfo.value.usedAdvanceInvoices
usedAdvanceInvoices: itemInfo.value.usedAdvanceInvoices,
customSurchargePercentage: itemInfo.value.customSurchargePercentage,
}
if(route.params.id) {
@@ -1104,18 +1105,26 @@ const getTextTemplateByType = (type, pos) => {
}
const updateCustomSurcharge = () => {
itemInfo.value.rows.forEach(row => {
if(!["pagebreak","title","free","text"].includes(row.mode)) {
setRowData(row)
}
})
}
const setRowData = (row) => {
console.log(row)
if(row.service) {
row.unit = services.value.find(i => i.id === row.service).unit
row.price = services.value.find(i => i.id === row.service).sellingPriceComposed.total || services.value.find(i => i.id === row.service).sellingPrice
row.price = (services.value.find(i => i.id === row.service).sellingPriceComposed.total || services.value.find(i => i.id === row.service).sellingPrice) * (1 + itemInfo.value.customSurchargePercentage /100)
row.description = services.value.find(i => i.id === row.service).description
row.taxPercent = services.value.find(i => i.id === row.service).taxPercentage
}
if(row.product) {
row.unit = products.value.find(i => i.id === row.product).unit
row.price = products.value.find(i => i.id === row.product).sellingPrice
row.price = products.value.find(i => i.id === row.product).sellingPrice * (1 + itemInfo.value.customSurchargePercentage /100)
row.description = products.value.find(i => i.id === row.product).description
row.taxPercent = products.value.find(i => i.id === row.product).taxPercentage
}
@@ -1519,6 +1528,20 @@ const setRowData = (row) => {
v-model="itemInfo.paymentDays"
/>
</UFormGroup>
<UFormGroup
class="w-full"
label="Individueller Aufschlag:"
>
<UInput
type="number"
v-model="itemInfo.customSurchargePercentage"
@change="updateCustomSurcharge"
>
<template #trailing>
<span class="text-gray-500 dark:text-gray-400 text-xs">%</span>
</template>
</UInput>
</UFormGroup>
</InputGroup>
<UFormGroup
label="Ansprechpartner:"
@@ -1758,14 +1781,14 @@ const setRowData = (row) => {
<tr>
<th></th>
<th>Pos.</th>
<th>Name</th>
<th>Menge</th>
<th>Einheit</th>
<th v-if="itemInfo.type !== 'deliveryNotes'">Preis</th>
<th v-if="itemInfo.type !== 'deliveryNotes'">Steuer</th>
<th v-if="itemInfo.type !== 'deliveryNotes'">Rabatt</th>
<th>Beschreibung</th>
<th v-if="itemInfo.type !== 'deliveryNotes'">Gesamt</th>
<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"> </th>
<th class="pl-2" v-if="itemInfo.type !== 'deliveryNotes'">Gesamt</th>
</tr>
</thead>
<draggable
@@ -2033,14 +2056,51 @@ const setRowData = (row) => {
<UModal v-model="row.showEdit">
<UCard>
<template #header>
Beschreibung bearbeiten
Zeile bearbeiten
</template>
<UTextarea
v-model="row.description"
<UFormGroup
label="Umsatzsteuer:"
v-if="itemInfo.type !== 'deliveryNotes'"
>
<USelectMenu
:options="[19,7,0]"
v-model="row.taxPercent"
:disabled="itemInfo.taxType === '13b UStG' || itemInfo.taxType === '19 UStG'"
>
<template #option="{option}">
{{option}} %
</template>
<template #label>
{{row.taxPercent}} %
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Rabatt:"
v-if="itemInfo.type !== 'deliveryNotes'"
>
<UInput
v-model="row.discountPercent"
type="number"
step="0.01"
placeholder="0"
>
<template #trailing>
<span class="text-gray-500 dark:text-gray-400 text-xs">%</span>
</template>
</UInput>
</UFormGroup>
<UFormGroup
label="Beschreibung:"
>
<UTextarea
v-model="row.description"
>
</UTextarea>
</UFormGroup>
</UTextarea>
<template #footer>
<UButton
@click="row.showEdit = false"