Rebuild Banking Integration to Function Server

This commit is contained in:
2025-01-23 16:03:17 +01:00
parent 06c775f563
commit 00e7e7e01e
3 changed files with 76 additions and 10 deletions

View File

@@ -27,6 +27,8 @@ const openDocuments = ref([])
const allocatedDocuments = ref([])
const openIncomingInvoices = ref([])
const accounts = ref([])
const setup = async () => {
if(route.params.id) {
itemInfo.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq("id",route.params.id).single()).data //dataStore.bankstatements.find(i => i.id === Number(route.params.id))
@@ -35,6 +37,8 @@ const setup = async () => {
const documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices")
accounts.value = (await supabase.from("accounts").select()).data
openDocuments.value = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getDocumentSum(i).toFixed(2))
openDocuments.value = openDocuments.value.map(i => {
@@ -99,6 +103,8 @@ const calculateOpenSum = computed(() => {
startingAmount = startingAmount - item.amount
} else if(item.ii_id) {
startingAmount = Number(startingAmount) + item.amount
}else if(item.account) {
startingAmount = Number(startingAmount) - item.amount
}
})
@@ -298,7 +304,7 @@ setup()
</tr>
<tr class="flex-row flex justify-between">
<td colspan="2">
<span class="font-semibold">Verknüpfte Dokumente:</span>
<span class="font-semibold">Buchungen:</span>
</td>
</tr>
<tr
@@ -315,6 +321,9 @@ setup()
<span v-else-if="item.ii_id">
{{dataStore.getVendorById(dataStore.getIncomingInvoiceById(item.ii_id).vendor).name}} - {{dataStore.getIncomingInvoiceById(item.ii_id).reference}}
</span>
<span v-else-if="item.account">
Buchungskonto: {{accounts.find(i => i.id === item.account).number}} {{accounts.find(i => i.id === item.account).label}}
</span>
</td>
<td>
<UButton
@@ -409,6 +418,13 @@ setup()
<UKbd value="/" />
</template>
</UInput>
<UButton
@click="saveAllocation({bs_id: itemInfo.id, amount: Number(itemInfo.amount), account: 20 })"
>
Als DP markieren
</UButton>
<UCard
class="mt-5"
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"