Changed Booking
Changed Columns in Incoming Invoices
This commit is contained in:
@@ -39,7 +39,7 @@ const ownaccounts = ref([])
|
|||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const setup = async () => {
|
const setup = async () => {
|
||||||
if(route.params.id) {
|
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))
|
if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
|
||||||
|
|
||||||
@@ -98,17 +98,23 @@ const getInvoiceSum = (invoice) => {
|
|||||||
sum += account.amountTax
|
sum += account.amountTax
|
||||||
sum += account.amountNet
|
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(() => {
|
const calculateOpenSum = computed(() => {
|
||||||
let startingAmount = 0
|
let startingAmount = 0
|
||||||
|
|
||||||
itemInfo.value.statementallocations.forEach(item => {
|
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) {
|
if(data) {
|
||||||
await setup()
|
await setup()
|
||||||
accountToSave.value = null
|
accountToSave.value = null
|
||||||
|
vendorAccountToSave.value = null
|
||||||
|
customerAccountToSave.value = null
|
||||||
|
ownAccountToSave.value = null
|
||||||
|
allocationDescription.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -351,15 +361,15 @@ setup()
|
|||||||
|
|
||||||
<UAlert
|
<UAlert
|
||||||
class="mb-3 mt-3"
|
class="mb-3 mt-3"
|
||||||
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
:color="calculateOpenSum != 0 ? 'rose' : 'primary'"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
:title="calculateOpenSum > 0 ? `${displayCurrency(calculateOpenSum)} von ${displayCurrency(Math.abs(itemInfo.amount))} nicht zugewiesen` : 'Kontobewegung vollständig zugewiesen'"
|
:title="calculateOpenSum != 0 ? `${displayCurrency(Math.abs(calculateOpenSum))} von ${displayCurrency(Math.abs(itemInfo.amount))} nicht zugewiesen` : 'Kontobewegung vollständig zugewiesen'"
|
||||||
>
|
>
|
||||||
<template #description>
|
<template #description>
|
||||||
<UProgress
|
<UProgress
|
||||||
:value="Math.abs(itemInfo.amount) - calculateOpenSum"
|
:value="Math.abs(itemInfo.amount) - calculateOpenSum"
|
||||||
:max="Math.abs(itemInfo.amount)"
|
:max="Math.abs(itemInfo.amount)"
|
||||||
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
:color="calculateOpenSum != 0 ? 'rose' : 'primary'"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</UAlert>
|
</UAlert>
|
||||||
@@ -443,74 +453,39 @@ setup()
|
|||||||
</UCard>
|
</UCard>
|
||||||
<UCard
|
<UCard
|
||||||
class="mt-5"
|
class="mt-5"
|
||||||
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === item.cd_id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
v-for="item in itemInfo.statementallocations.filter(i => i.ii_id)"
|
||||||
|
>
|
||||||
|
<template #header>
|
||||||
|
<div class="flex flex-row justify-between">
|
||||||
|
<span>{{vendors.find(i => i.id === item.ii_id.vendor).vendorNumber}} - {{vendors.find(i => i.id === item.ii_id.vendor).name}}</span>
|
||||||
|
<span class="font-semibold text-nowrap">{{displayCurrency(item.amount)}}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<UButton
|
||||||
|
icon="i-heroicons-x-mark"
|
||||||
|
variant="outline"
|
||||||
|
color="rose"
|
||||||
|
class="mr-3"
|
||||||
|
@click="removeAllocation(item.id)"
|
||||||
|
/>
|
||||||
|
</UCard>
|
||||||
|
<UCard
|
||||||
|
class="mt-5"
|
||||||
v-for="item in itemInfo.statementallocations.filter(i => i.cd_id)"
|
v-for="item in itemInfo.statementallocations.filter(i => i.cd_id)"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex flex-row justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
<span>{{item.cd_id.customer ? item.cd_id.customer.name : ""}} - {{item.cd_id.documentNumber}}</span>
|
<span v-if="customers.find(i => i.id === item.cd_id.customer)">{{customers.find(i => i.id === item.cd_id.customer).customerNumber}} - {{customers.find(i => i.id === item.cd_id.customer).name}}</span>
|
||||||
<span class="font-semibold text-nowrap">{{displayCurrency(item.amount)}}</span>
|
<span class="font-semibold text-nowrap">{{displayCurrency(item.amount)}}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- <UButton
|
|
||||||
icon="i-heroicons-check"
|
|
||||||
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(useSum().getCreatedDocumentSum(document,createddocuments))})"
|
|
||||||
/>-->
|
|
||||||
<UButton
|
<UButton
|
||||||
icon="i-heroicons-x-mark"
|
icon="i-heroicons-x-mark"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
color="rose"
|
color="rose"
|
||||||
class=""
|
class="mr-3"
|
||||||
@click="removeAllocation(item.id)"
|
@click="removeAllocation(item.id)"
|
||||||
/>
|
/>
|
||||||
<!-- <EntityModalButtons
|
|
||||||
:button-create="false"
|
|
||||||
:button-edit="false"
|
|
||||||
:id="item.cd_id.id"
|
|
||||||
type="createddocuments"/>
|
|
||||||
{{item.cd_id.id}}-->
|
|
||||||
|
|
||||||
<!-- <UButton
|
|
||||||
variant="outline"
|
|
||||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
|
||||||
@click="router.push(`/createDocument/show/${document.id}`)"
|
|
||||||
/>-->
|
|
||||||
</UCard>
|
|
||||||
<UCard
|
|
||||||
class="mt-5"
|
|
||||||
:ui="{ring: itemInfo.statementallocations.find(i => i.ii_id === invoice.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
|
||||||
v-for="invoice in allocatedIncomingInvoices"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<div class="flex flex-row justify-between">
|
|
||||||
<span>{{invoice.vendor ? invoice.vendor.name : ""}} - {{invoice.reference}}</span>
|
|
||||||
<span class="font-semibold text-nowrap">{{displayCurrency(getInvoiceSum(invoice))}}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<UButton
|
|
||||||
icon="i-heroicons-check"
|
|
||||||
variant="outline"
|
|
||||||
class="mr-3"
|
|
||||||
v-if="!itemInfo.statementallocations.find(i => i.ii_id === invoice.id)"
|
|
||||||
@click="saveAllocation({ii_id: document.id, bs_id: itemInfo.id, amount: Number(getInvoiceSum(invoice)), description: allocationDescription})"
|
|
||||||
/>
|
|
||||||
<UButton
|
|
||||||
icon="i-heroicons-x-mark"
|
|
||||||
variant="outline"
|
|
||||||
color="rose"
|
|
||||||
class="mr-3"
|
|
||||||
v-if="itemInfo.statementallocations.find(i => i.ii_id === invoice.id)"
|
|
||||||
@click="removeAllocation(itemInfo.statementallocations.find(i => i.ii_id === invoice.id).id)"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<UButton
|
|
||||||
variant="outline"
|
|
||||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
|
||||||
@click="router.push(`/createDocument/show/${document.id}`)"
|
|
||||||
/>
|
|
||||||
</UCard>
|
</UCard>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -721,8 +696,6 @@ setup()
|
|||||||
</InputGroup>
|
</InputGroup>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<UDivider
|
<UDivider
|
||||||
class="my-3"
|
class="my-3"
|
||||||
>
|
>
|
||||||
@@ -787,7 +760,7 @@ setup()
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex flex-row justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
<span>{{item.vendor ? item.vendor.name : ''}} - {{item.reference}}</span>
|
<span>{{item.vendor ? item.vendor.name : ''}} - {{item.reference}}</span>
|
||||||
<span class="font-semibold text-rose-600 text-nowrap">-{{displayCurrency(getInvoiceSum(item))}}</span>
|
<span class="font-semibold text-rose-600 text-nowrap">{{displayCurrency(getInvoiceSum(item))}}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<UButton
|
<UButton
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ const templateColumns = [
|
|||||||
{
|
{
|
||||||
key: "paymentType",
|
key: "paymentType",
|
||||||
label: "Zahlart"
|
label: "Zahlart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "description",
|
||||||
|
label: "Beschreibung"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
const selectedColumns = ref(templateColumns)
|
const selectedColumns = ref(templateColumns)
|
||||||
|
|||||||
Reference in New Issue
Block a user