Added TitleSims
This commit is contained in:
@@ -540,6 +540,23 @@ const documentTotal = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
//Title Sum
|
||||
|
||||
let titleSums = {}
|
||||
let lastTitle = ""
|
||||
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
if(row.mode === 'title'){
|
||||
titleSums[`${row.pos} - ${row.text}`] = 0
|
||||
lastTitle = `${row.pos} - ${row.text}`
|
||||
} else if(!['pagebreak','text'].includes(row.mode)){
|
||||
titleSums[lastTitle] = Number(titleSums[lastTitle]) + Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) )
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
let totalGross = Number(totalNet.toFixed(2)) + Number(total19.toFixed(2)) + Number(total7.toFixed(2))
|
||||
|
||||
let totalGrossAlreadyPaid = 0
|
||||
@@ -559,6 +576,7 @@ const documentTotal = computed(() => {
|
||||
let sumToPay = totalGross - totalGrossAlreadyPaid
|
||||
|
||||
return {
|
||||
titleSums: titleSums,
|
||||
totalNet: totalNet,
|
||||
total19: total19,
|
||||
total7: total7,
|
||||
@@ -688,6 +706,14 @@ const getDocumentData = () => {
|
||||
|
||||
let contactPerson = profileStore.getProfileById(itemInfo.value.contactPerson)
|
||||
|
||||
let returnTitleSums = {}
|
||||
Object.keys(documentTotal.value.titleSums).forEach(key => {
|
||||
returnTitleSums[key] = renderCurrency(documentTotal.value.titleSums[key])
|
||||
})
|
||||
|
||||
console.log(returnTitleSums)
|
||||
|
||||
|
||||
const returnData = {
|
||||
type: itemInfo.value.type,
|
||||
taxType: itemInfo.value.taxType,
|
||||
@@ -758,7 +784,8 @@ const getDocumentData = () => {
|
||||
total19: renderCurrency(documentTotal.value.total19),
|
||||
totalGross: renderCurrency(documentTotal.value.totalGross),
|
||||
totalGrossAlreadyPaid: renderCurrency(documentTotal.value.totalGrossAlreadyPaid),
|
||||
totalSumToPay: renderCurrency(documentTotal.value.totalSumToPay)
|
||||
totalSumToPay: renderCurrency(documentTotal.value.totalSumToPay),
|
||||
titleSums: returnTitleSums
|
||||
},
|
||||
agriculture: itemInfo.value.agriculture,
|
||||
usedAdvanceInvoices: itemInfo.value.usedAdvanceInvoices.map(i => {
|
||||
@@ -2101,7 +2128,16 @@ const setRowData = (row) => {
|
||||
</InputGroup>
|
||||
</div>
|
||||
|
||||
<UDivider class="my-3" v-if="itemInfo.rows.length > 0"/>
|
||||
<UDivider class="my-3" v-if="Object.keys(documentTotal.titleSums).length > 0">Überschriften</UDivider>
|
||||
|
||||
<table>
|
||||
<tr v-for="sumKey in Object.keys(documentTotal.titleSums) ">
|
||||
<td>{{sumKey}}</td>
|
||||
<td>{{useCurrency(documentTotal.titleSums[sumKey])}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<UDivider class="my-3" v-if="itemInfo.rows.length > 0">Gesamt</UDivider>
|
||||
|
||||
|
||||
<div class="w-full flex justify-end" v-if="itemInfo.type !== 'deliveryNotes'">
|
||||
|
||||
Reference in New Issue
Block a user