Leeren individuellen Aufschlag normalisieren
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user