From e459c0a4e56994d818ac0f8409918dec2dbaf5ed Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 2 Feb 2025 18:30:37 +0100 Subject: [PATCH] Added Taxtypes Added 13b Added Error Check for Timespan --- pages/createDocument/edit/[[id]].vue | 35 +++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index 12feb41..c253ca0 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -21,6 +21,7 @@ const showServiceSelectionModal = ref(false) const itemInfo = ref({ type: "invoices", + taxType: "Standard", customer: null, contact: null, address: { @@ -34,6 +35,7 @@ const itemInfo = ref({ documentNumberTitle: "Rechnungsnummer", documentDate: dayjs(), deliveryDate: dayjs(), + deliveryDateEnd: null, deliveryDateType: "Lieferdatum", dateOfPerformance: null, paymentDays: profileStore.ownTenant.standardPaymentDays, @@ -447,6 +449,11 @@ const findDocumentErrors = computed(() => { if(itemInfo.value.project === null) errors.push({message: "Es ist kein Projekt ausgewählt", type: "info"}) + if(['Lieferzeitraum','Leistungszeitraum'].includes(itemInfo.value.deliveryDateType)) { + if(itemInfo.value.deliveryDateEnd === null) errors.push({message: `Es ist kein Enddatum für den ${itemInfo.value.deliveryDateType} angegeben`, type: "breaking"}) + } + + if(itemInfo.value.rows.length === 0) { errors.push({message: "Es sind keine Positionen angegeben", type: "breaking"}) } else { @@ -610,7 +617,19 @@ const getDocumentData = () => { }) } - let rows = itemInfo.value.rows.map(row => { + let rows = itemInfo.value.rows + + if(itemInfo.value.taxType === "13b UStG") { + rows = rows.map(row => { + return { + ...row, + taxPercent: 0 + } + }) + } + + + rows = itemInfo.value.rows.map(row => { let unit = dataStore.units.find(i => i.id === row.unit) @@ -663,6 +682,7 @@ const getDocumentData = () => { const returnData = { type: itemInfo.value.type, + taxType: itemInfo.value.taxType, adressLine: `${businessInfo.name}, ${businessInfo.street}, ${businessInfo.zip} ${businessInfo.city}`, recipient: { name: customerData.name, @@ -877,6 +897,7 @@ const saveDocument = async (state,resetup = false) => { let createData = { type: itemInfo.value.type, + taxType: itemInfo.value.type === "invoices" ? itemInfo.value.taxType : null, state: itemInfo.value.state || "Entwurf", customer: itemInfo.value.customer, contact: itemInfo.value.contact, @@ -1129,6 +1150,17 @@ const setRowData = (row) => { + + + + @@ -1834,6 +1866,7 @@ const setRowData = (row) => {