Leeren individuellen Aufschlag normalisieren

This commit is contained in:
2026-07-20 19:35:07 +02:00
parent 37d08ee984
commit 769185cd82
2 changed files with 15 additions and 0 deletions

View File

@@ -239,6 +239,13 @@ function isDateValue(value: any) {
}
function normalizeCreatedDocumentPayload(payload: Record<string, any>) {
if (Object.prototype.hasOwnProperty.call(payload, "customSurchargePercentage")) {
const customSurchargePercentage = Number(payload.customSurchargePercentage)
payload.customSurchargePercentage = Number.isFinite(customSurchargePercentage)
? customSurchargePercentage
: 0
}
const numberRelationFields = [
"customer",
"contact",

View File

@@ -1701,6 +1701,7 @@ const saveSerialInvoice = async () => {
const saveDocument = async (state, resetup = false) => {
itemInfo.value.state = state
normalizeCustomSurchargePercentage()
if (state !== "Entwurf") {
console.log("???")
@@ -1870,7 +1871,14 @@ const checkCompatibilityWithInputPrice = () => {
})
}
const normalizeCustomSurchargePercentage = () => {
const percentage = Number(itemInfo.value.customSurchargePercentage)
itemInfo.value.customSurchargePercentage = Number.isFinite(percentage) ? percentage : 0
}
const updateCustomSurcharge = () => {
normalizeCustomSurchargePercentage()
itemInfo.value.rows.forEach(row => {
if (!["pagebreak", "title", "text"].includes(row.mode) && isImportedAdvanceInvoiceRow(row)) {
row.price = Number(row.inputPrice || 0)