From 34e6fb7b6452d4f7155616faa459c23599a33aa5 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 23 Mar 2025 13:08:45 +0100 Subject: [PATCH 1/6] Added Customer to Events --- stores/data.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stores/data.js b/stores/data.js index e00361e..42b06a8 100644 --- a/stores/data.js +++ b/stores/data.js @@ -155,7 +155,7 @@ export const useDataStore = defineStore('data', () => { numberRangeHolder: "customerNumber", historyItemHolder: "customer", supabaseSortColumn: "customerNumber", - supabaseSelectWithInformation: "*, projects(*), plants(*), contracts(*), contacts(*), createddocuments(*), files(*)", + supabaseSelectWithInformation: "*, projects(*), plants(*), contracts(*), contacts(*), createddocuments(*), files(*), events(*)", filters: [{ name: "Archivierte ausblenden", default: true, @@ -309,7 +309,7 @@ export const useDataStore = defineStore('data', () => { component: profiles }, ], - showTabs: [{label: 'Informationen'},{label: 'Ansprechpartner'},{label: 'Dateien'},{label: 'Ausgangsbelege'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}] + showTabs: [{label: 'Informationen'},{label: 'Ansprechpartner'},{label: 'Dateien'},{label: 'Ausgangsbelege'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Termine'},{label: 'Verträge'}] }, contacts: { isArchivable: true, @@ -1647,7 +1647,7 @@ export const useDataStore = defineStore('data', () => { labelSingle: "Termin", isStandardEntity: true, historyItemHolder: "event", - supabaseSelectWithInformation: "*, project(id,name)", + supabaseSelectWithInformation: "*, project(id,name), customer(*)", redirect: true, filters:[{ name: "Archivierte ausblenden", @@ -1737,6 +1737,7 @@ export const useDataStore = defineStore('data', () => { selectDataType: "customers", selectOptionAttribute: "name", selectSearchAttributes: ['name'], + component: customer, },{ key: "vendor", label: "Lieferant", From 19a5d906da6c964e6dd282d18e7c528ffd8613fc Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 23 Mar 2025 13:08:56 +0100 Subject: [PATCH 2/6] Removed temp Store in Datastore --- stores/data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stores/data.js b/stores/data.js index 42b06a8..952a4e7 100644 --- a/stores/data.js +++ b/stores/data.js @@ -2624,9 +2624,9 @@ export const useDataStore = defineStore('data', () => { await generateHistoryItems(dataType, supabaseData[0]) - if(!["statementallocations","absencerequests", "productcategories", "servicecategories", "projecttypes", "checks", "profiles","services", "inventoryitems", "inventoryitemgroups", "incominginvoices"].includes(dataType) ){ + /*if(!["statementallocations","absencerequests", "productcategories", "servicecategories", "projecttypes", "checks", "profiles","services", "inventoryitems", "inventoryitemgroups", "incominginvoices", "costcentres", "ownaccounts"].includes(dataType) ){ await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')') - } + }*/ toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`}) From b5b1741f211486761d35d2e6302180c6d9a71375 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 23 Mar 2025 13:09:56 +0100 Subject: [PATCH 3/6] Added Ability to Book to Customers and Vendors --- pages/banking/statements/[mode]/[[id]].vue | 161 +++++++++++++++++++-- 1 file changed, 146 insertions(+), 15 deletions(-) diff --git a/pages/banking/statements/[mode]/[[id]].vue b/pages/banking/statements/[mode]/[[id]].vue index ddb9878..5cde083 100644 --- a/pages/banking/statements/[mode]/[[id]].vue +++ b/pages/banking/statements/[mode]/[[id]].vue @@ -28,6 +28,9 @@ const allocatedDocuments = ref([]) const openIncomingInvoices = ref([]) const allocatedIncomingInvoices = ref([]) +const customers = ref([]) +const vendors = ref([]) + const createddocuments = ref([]) const accounts = ref([]) @@ -48,6 +51,8 @@ const setup = async () => { accounts.value = (await supabase.from("accounts").select()).data ownaccounts.value = (await supabase.from("ownaccounts").select()).data + customers.value = (await supabase.from("customers").select()).data + vendors.value = (await supabase.from("vendors").select()).data openDocuments.value = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== useSum().getCreatedDocumentSum(i,createddocuments.value).toFixed(2)) openDocuments.value = openDocuments.value.map(i => { @@ -121,6 +126,8 @@ const saveAllocations = async () => { const showAccountSelection = ref(false) const accountToSave = ref("") const ownAccountToSave = ref("") +const customerAccountToSave = ref("") +const vendorAccountToSave = ref("") const selectAccount = (id) => { accountToSave.value = id @@ -129,6 +136,7 @@ const selectAccount = (id) => { const manualAllocationSum = ref(itemInfo.value.amount || 0) +const allocationDescription = ref("") const saveAllocation = async (allocation) => { @@ -397,6 +405,42 @@ setup() @click="removeAllocation(item.id)" /> + + + + + + + +
- Buchungssumme - - Buchungsdaten + - - + + + + + + + + Ohne Beleg buchen @@ -519,7 +576,7 @@ setup() variant="outline" icon="i-heroicons-check" :disabled="!accountToSave" - @click="saveAllocation({bs_id: itemInfo.id, amount: manualAllocationSum, account: accountToSave })" + @click="saveAllocation({bs_id: itemInfo.id, amount: manualAllocationSum, account: accountToSave, description: allocationDescription })" /> + + + + + + + + + + + + + + + + + + + + @@ -639,7 +770,7 @@ setup() variant="outline" class="mr-3" v-if="!itemInfo.statementallocations.find(i => i.cd_id === document.id)" - @click="saveAllocation({cd_id: document.id, bs_id: itemInfo.id, amount: Number(document.openSum < maunualAllocationSum ? document.openSum : manualAllocationSum)})" + @click="saveAllocation({cd_id: document.id, bs_id: itemInfo.id, amount: Number(document.openSum < maunualAllocationSum ? document.openSum : manualAllocationSum), description: allocationDescription})" /> Date: Mon, 24 Mar 2025 13:33:39 +0100 Subject: [PATCH 4/6] Changed Booking Changed Columns in Incoming Invoices --- pages/banking/statements/[mode]/[[id]].vue | 103 ++++++++------------- pages/incomingInvoices/index.vue | 4 + 2 files changed, 42 insertions(+), 65 deletions(-) diff --git a/pages/banking/statements/[mode]/[[id]].vue b/pages/banking/statements/[mode]/[[id]].vue index 5cde083..d714154 100644 --- a/pages/banking/statements/[mode]/[[id]].vue +++ b/pages/banking/statements/[mode]/[[id]].vue @@ -39,7 +39,7 @@ const ownaccounts = ref([]) const loading = ref(true) const setup = async () => { if(route.params.id) { - itemInfo.value = (await supabase.from("bankstatements").select("*, statementallocations(*, cd_id(*, customer(*)), ii_id(*))").eq("id",route.params.id).single()).data //dataStore.bankstatements.find(i => i.id === Number(route.params.id)) + itemInfo.value = (await supabase.from("bankstatements").select("*, statementallocations(*, cd_id(*), ii_id(*))").eq("id",route.params.id).single()).data //dataStore.bankstatements.find(i => i.id === Number(route.params.id)) } if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value)) @@ -98,17 +98,23 @@ const getInvoiceSum = (invoice) => { sum += account.amountTax sum += account.amountNet }) - return sum.toFixed(2) + console.log(sum) + + if(invoice.expense) { + return (sum * -1).toFixed(2) + } else { + return sum.toFixed(2) + } } const calculateOpenSum = computed(() => { let startingAmount = 0 itemInfo.value.statementallocations.forEach(item => { - startingAmount += Math.abs(item.amount) + startingAmount += item.amount }) - return (Math.abs(itemInfo.value.amount) - startingAmount).toFixed(2) + return (itemInfo.value.amount - startingAmount).toFixed(2) }) @@ -150,6 +156,10 @@ const saveAllocation = async (allocation) => { if(data) { await setup() accountToSave.value = null + vendorAccountToSave.value = null + customerAccountToSave.value = null + ownAccountToSave.value = null + allocationDescription.value = null } @@ -351,15 +361,15 @@ setup() @@ -443,74 +453,39 @@ setup() + + + + - - - - - - - - - - -
@@ -721,8 +696,6 @@ setup() - - @@ -787,7 +760,7 @@ setup() Date: Mon, 24 Mar 2025 18:54:39 +0100 Subject: [PATCH 5/6] Corrected Spacing on Right Side --- pages/banking/statements/[mode]/[[id]].vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pages/banking/statements/[mode]/[[id]].vue b/pages/banking/statements/[mode]/[[id]].vue index d714154..7260c62 100644 --- a/pages/banking/statements/[mode]/[[id]].vue +++ b/pages/banking/statements/[mode]/[[id]].vue @@ -143,6 +143,7 @@ const selectAccount = (id) => { const manualAllocationSum = ref(itemInfo.value.amount || 0) const allocationDescription = ref("") +const showMoreWithoutRecipe = ref(false) const saveAllocation = async (allocation) => { @@ -512,7 +513,7 @@ setup() > @@ -584,7 +585,13 @@ setup() + {{ showMoreWithoutRecipe ? "Weniger anzeigen" : "Mehr anzeigen" }} @@ -622,6 +629,7 @@ setup() @@ -659,6 +667,7 @@ setup() @@ -726,7 +735,7 @@ setup() -
+
Date: Mon, 24 Mar 2025 19:07:26 +0100 Subject: [PATCH 6/6] Added Archiving --- pages/banking/statements/[mode]/[[id]].vue | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pages/banking/statements/[mode]/[[id]].vue b/pages/banking/statements/[mode]/[[id]].vue index 7260c62..381120f 100644 --- a/pages/banking/statements/[mode]/[[id]].vue +++ b/pages/banking/statements/[mode]/[[id]].vue @@ -191,6 +191,23 @@ const filteredIncomingInvoices = computed(() => { setup() + +const archiveStatement = async () => { + + let temp = itemInfo.value + delete temp.statementallocations + + await dataStore.updateItem("bankstatements", {...temp,archived:true}) + + + const {data,error} = await supabase.from("historyitems").insert({ + createdBy: useProfileStore().activeProfile.id, + tenant: useProfileStore().currentTenant, + text: "Bankbuchung archiviert", + bankStatement: itemInfo.value.id + }) +} + + + +