KI-AGENT: Individuellen Aufschlag bei importierten Abschlagsrechnungen verhindern
This commit is contained in:
@@ -351,6 +351,10 @@ const normalizeCreatedDocumentRow = (row) => {
|
|||||||
const normalizeCreatedDocumentRows = (rows) => Array.isArray(rows)
|
const normalizeCreatedDocumentRows = (rows) => Array.isArray(rows)
|
||||||
? rows.map((row) => normalizeCreatedDocumentRow(row))
|
? rows.map((row) => normalizeCreatedDocumentRow(row))
|
||||||
: []
|
: []
|
||||||
|
const isImportedAdvanceInvoiceRow = (row) => {
|
||||||
|
return Array.isArray(row.linkedEntitys)
|
||||||
|
&& row.linkedEntitys.some(i => i.type === "createddocuments" && i.subtype === "advanceInvoices")
|
||||||
|
}
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
|
|
||||||
await setupData()
|
await setupData()
|
||||||
@@ -507,6 +511,8 @@ const setupPage = async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
for await (const doc of linkedDocuments.filter(i => i.type === "advanceInvoices")) {
|
for await (const doc of linkedDocuments.filter(i => i.type === "advanceInvoices")) {
|
||||||
|
const advanceInvoiceNet = useSum().getCreatedDocumentSumDetailed(doc).totalNet * -1
|
||||||
|
|
||||||
itemInfo.value.rows.push({
|
itemInfo.value.rows.push({
|
||||||
mode: "free",
|
mode: "free",
|
||||||
text: `Abschlagsrechnung ${doc.documentNumber}`,
|
text: `Abschlagsrechnung ${doc.documentNumber}`,
|
||||||
@@ -514,7 +520,8 @@ const setupPage = async () => {
|
|||||||
taxPercent: 19, // TODO TAX PERCENTAGE
|
taxPercent: 19, // TODO TAX PERCENTAGE
|
||||||
discountPercent: 0,
|
discountPercent: 0,
|
||||||
unit: 10,
|
unit: 10,
|
||||||
inputPrice: useSum().getCreatedDocumentSumDetailed(doc).totalNet * -1,
|
inputPrice: advanceInvoiceNet,
|
||||||
|
price: advanceInvoiceNet,
|
||||||
linkedEntitys: [
|
linkedEntitys: [
|
||||||
{
|
{
|
||||||
type: "createddocuments",
|
type: "createddocuments",
|
||||||
@@ -1799,15 +1806,15 @@ const checkCompatibilityWithInputPrice = () => {
|
|||||||
|
|
||||||
const updateCustomSurcharge = () => {
|
const updateCustomSurcharge = () => {
|
||||||
itemInfo.value.rows.forEach(row => {
|
itemInfo.value.rows.forEach(row => {
|
||||||
if (!["pagebreak", "title", "text"].includes(row.mode) /*&& !row.linkedEntitys.find(i => i.type === "createddocuments" && i.subtype === "advanceInvoices")*/) {
|
if (!["pagebreak", "title", "text"].includes(row.mode) && isImportedAdvanceInvoiceRow(row)) {
|
||||||
|
row.price = Number(row.inputPrice || 0)
|
||||||
|
} else if (!["pagebreak", "title", "text"].includes(row.mode)) {
|
||||||
//setRowData(row)
|
//setRowData(row)
|
||||||
|
|
||||||
row.price = Number((row.inputPrice * (1 + itemInfo.value.customSurchargePercentage / 100)).toFixed(2))
|
row.price = Number((row.inputPrice * (1 + itemInfo.value.customSurchargePercentage / 100)).toFixed(2))
|
||||||
|
|
||||||
|
|
||||||
}/* else if(!["pagebreak","title","text"].includes(row.mode) /!*&& row.linkedEntitys.find(i => i.type === "createddocuments" && i.subtype === "advanceInvoices")*!/) {
|
}
|
||||||
row.price = row.inputPrice
|
|
||||||
}*/
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3289,7 +3296,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
</InputGroup>
|
</InputGroup>
|
||||||
|
|
||||||
<UAlert
|
<UAlert
|
||||||
v-if="row.linkedEntitys && row.linkedEntitys.find(i => i.type === 'createddocuments' && i.subtype === 'advanceInvoices')"
|
v-if="isImportedAdvanceInvoiceRow(row)"
|
||||||
title="Berechnung des Individuellen Aufschlags für die Zeile gesperrt"
|
title="Berechnung des Individuellen Aufschlags für die Zeile gesperrt"
|
||||||
color="orange"
|
color="orange"
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
|
|||||||
Reference in New Issue
Block a user