Restructured Banking Allocation
This commit is contained in:
@@ -26,6 +26,7 @@ const oldItemInfo = ref({})
|
|||||||
const openDocuments = ref([])
|
const openDocuments = ref([])
|
||||||
const allocatedDocuments = ref([])
|
const allocatedDocuments = ref([])
|
||||||
const openIncomingInvoices = ref([])
|
const openIncomingInvoices = ref([])
|
||||||
|
const allocatedIncomingInvoices = ref([])
|
||||||
|
|
||||||
const accounts = ref([])
|
const accounts = ref([])
|
||||||
|
|
||||||
@@ -36,15 +37,16 @@ const setup = async () => {
|
|||||||
}
|
}
|
||||||
if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
|
if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
|
||||||
|
|
||||||
|
manualAllocationSum.value = calculateOpenSum.value
|
||||||
|
|
||||||
const documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices")
|
const documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices")
|
||||||
|
const incominginvoices = (await useSupabaseSelect("incominginvoices","*, statementallocations(*), vendor(id,name)"))
|
||||||
|
|
||||||
accounts.value = (await supabase.from("accounts").select()).data
|
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 = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getDocumentSum(i).toFixed(2))
|
||||||
openDocuments.value = openDocuments.value.map(i => {
|
openDocuments.value = openDocuments.value.map(i => {
|
||||||
|
|
||||||
console.log()
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...i,
|
...i,
|
||||||
docTotal: getDocumentSum(i, i.usedAdvanceInvoices.map(i => getDocumentSum(documents.find(x => x.id === i)))),
|
docTotal: getDocumentSum(i, i.usedAdvanceInvoices.map(i => getDocumentSum(documents.find(x => x.id === i)))),
|
||||||
@@ -56,8 +58,10 @@ const setup = async () => {
|
|||||||
console.log(openDocuments.value)
|
console.log(openDocuments.value)
|
||||||
|
|
||||||
allocatedDocuments.value = documents.filter(i => i.statementallocations.find(x => x.bs_id === itemInfo.value.id))
|
allocatedDocuments.value = documents.filter(i => i.statementallocations.find(x => x.bs_id === itemInfo.value.id))
|
||||||
|
allocatedIncomingInvoices.value = incominginvoices.filter(i => i.statementallocations.find(x => x.bs_id === itemInfo.value.id))
|
||||||
console.log(allocatedDocuments.value)
|
console.log(allocatedDocuments.value)
|
||||||
openIncomingInvoices.value = (await useSupabaseSelect("incominginvoices","*, statementallocations(*)")).filter(i => i.statementallocations.length === 0 || i.statementallocations.find(x => x.bs_id === itemInfo.value.id))
|
console.log(allocatedIncomingInvoices.value)
|
||||||
|
openIncomingInvoices.value = (await useSupabaseSelect("incominginvoices","*, statementallocations(*), vendor(*)")).filter(i => i.statementallocations.length === 0 )
|
||||||
//console.log(openIncomingInvoices.value)
|
//console.log(openIncomingInvoices.value)
|
||||||
|
|
||||||
// return incominginvoices.value.filter(i => bankstatements.value.filter(x => x.assignments.find(y => y.type === 'incomingInvoice' && y.id === i.id)).length === 0)
|
// return incominginvoices.value.filter(i => bankstatements.value.filter(x => x.assignments.find(y => y.type === 'incomingInvoice' && y.id === i.id)).length === 0)
|
||||||
@@ -144,6 +148,9 @@ const selectAccount = (id) => {
|
|||||||
showAccountSelection.value = false
|
showAccountSelection.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const manualAllocationSum = ref(itemInfo.value.amount || 0)
|
||||||
|
|
||||||
const saveAllocation = async (allocation) => {
|
const saveAllocation = async (allocation) => {
|
||||||
const {data,error} = await supabase.from("statementallocations").insert({
|
const {data,error} = await supabase.from("statementallocations").insert({
|
||||||
...allocation,
|
...allocation,
|
||||||
@@ -152,8 +159,11 @@ const saveAllocation = async (allocation) => {
|
|||||||
|
|
||||||
if(data) {
|
if(data) {
|
||||||
await setup()
|
await setup()
|
||||||
|
accountToSave.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const removeAllocation = async (allocationId) => {
|
const removeAllocation = async (allocationId) => {
|
||||||
@@ -163,13 +173,20 @@ const removeAllocation = async (allocationId) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const searchString = ref("")
|
const searchString = ref("")
|
||||||
const filteredRows = computed(() => {
|
const filteredDocuments = computed(() => {
|
||||||
|
|
||||||
|
|
||||||
return useSearch(searchString.value, openDocuments.value)
|
return useSearch(searchString.value, openDocuments.value)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const filteredIncomingInvoices = computed(() => {
|
||||||
|
|
||||||
|
|
||||||
|
return useSearch(searchString.value, openIncomingInvoices.value)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
setup()
|
setup()
|
||||||
|
|
||||||
@@ -209,371 +226,411 @@ setup()
|
|||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
|
|
||||||
<UDashboardPanelContent
|
<UDashboardPanelContent
|
||||||
class="flex flex-row"
|
class="flex flex-row workingContainer"
|
||||||
v-if="!loading"
|
v-if="!loading"
|
||||||
>
|
>
|
||||||
<UCard
|
<div
|
||||||
class="w-2/5 mx-auto "
|
class="mx-auto w-2/5"
|
||||||
v-if="itemInfo"
|
|
||||||
>
|
>
|
||||||
<template #header>
|
<div class="px-2">
|
||||||
<div class="flex flex-row justify-between">
|
<UCard
|
||||||
<span
|
v-if="itemInfo"
|
||||||
v-if="itemInfo.amount > 0"
|
|
||||||
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
|
||||||
>
|
>
|
||||||
{{itemInfo.debName}}
|
<template #header>
|
||||||
</span>
|
<div class="flex flex-row justify-between">
|
||||||
<span
|
<span
|
||||||
v-else-if="itemInfo.amount < 0"
|
v-if="itemInfo.amount > 0"
|
||||||
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
||||||
>
|
>
|
||||||
{{itemInfo.credName}}
|
{{itemInfo.debName}}
|
||||||
</span>
|
</span>
|
||||||
|
<span
|
||||||
|
v-else-if="itemInfo.amount < 0"
|
||||||
|
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
||||||
|
>
|
||||||
|
{{itemInfo.credName}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
<span v-if="itemInfo.amount > 0" class="text-primary-500 font-semibold text-nowrap">{{displayCurrency(itemInfo.amount)}}</span>
|
<span v-if="itemInfo.amount > 0" class="text-primary-500 font-semibold text-nowrap">{{displayCurrency(itemInfo.amount)}}</span>
|
||||||
<span v-else-if="itemInfo.amount < 0" class="text-rose-600 font-semibold text-nowrap">{{displayCurrency(itemInfo.amount)}}</span>
|
<span v-else-if="itemInfo.amount < 0" class="text-rose-600 font-semibold text-nowrap">{{displayCurrency(itemInfo.amount)}}</span>
|
||||||
<span v-else>{{displayCurrency(itemInfo.amount)}}</span>
|
<span v-else>{{displayCurrency(itemInfo.amount)}}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<table class="w-full" v-if="itemInfo.id">
|
<table class="w-full" v-if="itemInfo.id">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="flex-row flex justify-between">
|
<tr class="flex-row flex justify-between">
|
||||||
<td>
|
<td>
|
||||||
<span class="font-semibold">Buchungsdatum:</span>
|
<span class="font-semibold">Buchungsdatum:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{dayjs(itemInfo.date).format("DD.MM.YYYY")}}
|
{{dayjs(itemInfo.date).format("DD.MM.YYYY")}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="flex-row flex justify-between">
|
<tr class="flex-row flex justify-between">
|
||||||
<td>
|
<td>
|
||||||
<span class="font-semibold">Wertstellungsdatum:</span>
|
<span class="font-semibold">Wertstellungsdatum:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{dayjs(itemInfo.valueDate).format("DD.MM.YYYY")}}
|
{{dayjs(itemInfo.valueDate).format("DD.MM.YYYY")}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="flex-row flex justify-between text-right">
|
<tr class="flex-row flex justify-between text-right">
|
||||||
<td>
|
<td>
|
||||||
<span class="font-semibold">Partner:</span>
|
<span class="font-semibold">Partner:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="itemInfo.debName">{{itemInfo.debName}}</span>
|
<span v-if="itemInfo.debName">{{itemInfo.debName}}</span>
|
||||||
<span v-else-if="itemInfo.credName">{{itemInfo.credName}}</span>
|
<span v-else-if="itemInfo.credName">{{itemInfo.credName}}</span>
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="flex-row flex justify-between">
|
<tr class="flex-row flex justify-between">
|
||||||
<td>
|
<td>
|
||||||
<span class="font-semibold">Partner IBAN:</span>
|
<span class="font-semibold">Partner IBAN:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="itemInfo.debIban">{{itemInfo.debIban}}</span>
|
<span v-if="itemInfo.debIban">{{separateIBAN(itemInfo.debIban)}}</span>
|
||||||
<span v-else-if="itemInfo.credIban">{{itemInfo.credIban}}</span>
|
<span v-else-if="itemInfo.credIban">{{separateIBAN(itemInfo.credIban)}}</span>
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="flex-row flex justify-between">
|
<tr class="flex-row flex justify-between">
|
||||||
<td>
|
<td>
|
||||||
<span class="font-semibold">Konto:</span>
|
<span class="font-semibold">Konto:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{dataStore.getBankAccountById(itemInfo.account) ? dataStore.getBankAccountById(itemInfo.account).name || separateIBAN(dataStore.getBankAccountById(itemInfo.account).iban) : ""}}
|
{{dataStore.getBankAccountById(itemInfo.account) ? dataStore.getBankAccountById(itemInfo.account).name || separateIBAN(dataStore.getBankAccountById(itemInfo.account).iban) : ""}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="flex-row flex justify-between">
|
<!-- <tr class="flex-row flex justify-between">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<span class="font-semibold">Buchungen:</span>
|
<span class="font-semibold">Buchungen:</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="flex-row flex justify-between mb-3"
|
class="flex-row flex justify-between mb-3"
|
||||||
v-for="item in itemInfo.statementallocations"
|
v-for="item in itemInfo.statementallocations"
|
||||||
>
|
>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<!-- <span v-if="itemInfo.createdDocument"><nuxt-link :to="`/createDocument/show/${itemInfo.createdDocument}`">{{dataStore.createddocuments.find(i => i.id === itemInfo.createdDocument).documentNumber}}</nuxt-link></span>
|
<!– <span v-if="itemInfo.createdDocument"><nuxt-link :to="`/createDocument/show/${itemInfo.createdDocument}`">{{dataStore.createddocuments.find(i => i.id === itemInfo.createdDocument).documentNumber}}</nuxt-link></span>
|
||||||
<span v-else-if="itemInfo.incomingInvoice"><nuxt-link :to="`/incominInvoices/show/${itemInfo.incomingInvoice}`">{{dataStore.getIncomingInvoiceById(itemInfo.incomingInvoice).reference}}</nuxt-link></span>-->
|
<span v-else-if="itemInfo.incomingInvoice"><nuxt-link :to="`/incominInvoices/show/${itemInfo.incomingInvoice}`">{{dataStore.getIncomingInvoiceById(itemInfo.incomingInvoice).reference}}</nuxt-link></span>–>
|
||||||
<span v-if="item.cd_id">
|
<span v-if="item.cd_id">
|
||||||
{{dataStore.getCreatedDocumentById(item.cd_id).documentNumber}}
|
{{dataStore.getCreatedDocumentById(item.cd_id).documentNumber}}
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.ii_id">
|
<span v-else-if="item.ii_id">
|
||||||
{{dataStore.getVendorById(dataStore.getIncomingInvoiceById(item.ii_id).vendor).name}} - {{dataStore.getIncomingInvoiceById(item.ii_id).reference}}
|
<!– {{dataStore.getVendorById(dataStore.getIncomingInvoiceById(item.ii_id).vendor).name}} - {{dataStore.getIncomingInvoiceById(item.ii_id).reference}}–>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.account">
|
<span v-else-if="item.account">
|
||||||
Buchungskonto: {{accounts.find(i => i.id === item.account).number}} {{accounts.find(i => i.id === item.account).label}}
|
Buchungskonto: {{accounts.find(i => i.id === item.account).number}} {{accounts.find(i => i.id === item.account).label}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<UButton
|
<UButton
|
||||||
variant="outline"
|
variant="outline"
|
||||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||||
@click="router.push(`/createDocument/show/${item.cd_id}`)"
|
@click="router.push(`/createDocument/show/${item.cd_id}`)"
|
||||||
v-if="item.cd_id"
|
v-if="item.cd_id"
|
||||||
/>
|
/>
|
||||||
<UButton
|
<UButton
|
||||||
variant="outline"
|
variant="outline"
|
||||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||||
@click="router.push(`/incominginvoices/show/${item.ii_id}`)"
|
@click="router.push(`/incominginvoices/show/${item.ii_id}`)"
|
||||||
v-else-if="item.ii_id"
|
v-else-if="item.ii_id"
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>-->
|
||||||
<tr class="flex-row flex justify-between">
|
<tr class="flex-row flex justify-between">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<span class="font-semibold">Beschreibung:</span>
|
<span class="font-semibold">Beschreibung:</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
{{itemInfo.text}}
|
{{itemInfo.text}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</UCard>
|
</UCard>
|
||||||
|
|
||||||
<div class="w-2/5 mx-auto">
|
<UAlert
|
||||||
<UAlert
|
class="mb-3 mt-3"
|
||||||
class="mb-3"
|
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
||||||
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
|
||||||
variant="outline"
|
|
||||||
:title="calculateOpenSum > 0 ? `${displayCurrency(calculateOpenSum)} von ${displayCurrency(Math.abs(itemInfo.amount))} nicht zugewiesen` : 'Kontobewegung vollständig zugewiesen'"
|
|
||||||
>
|
|
||||||
<template #description>
|
|
||||||
<UProgress
|
|
||||||
:value="Math.abs(itemInfo.amount) - calculateOpenSum"
|
|
||||||
:max="Math.abs(itemInfo.amount)"
|
|
||||||
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</UAlert>
|
|
||||||
|
|
||||||
<UCard
|
|
||||||
class="mt-5"
|
|
||||||
v-for="item in itemInfo.statementallocations.filter(i => i.account)"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<div class="flex flex-row justify-between">
|
|
||||||
<span>{{accounts.find(i => i.id === item.account).number}} - {{accounts.find(i => i.id === item.account).label}}</span>
|
|
||||||
<span class="font-semibold text-nowrap">{{displayCurrency(item.amount)}}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<UButton
|
|
||||||
icon="i-heroicons-x-mark"
|
|
||||||
variant="outline"
|
variant="outline"
|
||||||
color="rose"
|
:title="calculateOpenSum > 0 ? `${displayCurrency(calculateOpenSum)} von ${displayCurrency(Math.abs(itemInfo.amount))} nicht zugewiesen` : 'Kontobewegung vollständig zugewiesen'"
|
||||||
class="mr-3"
|
|
||||||
@click="removeAllocation(itemInfo.statementallocations.find(i => i.account === item.account).id)"
|
|
||||||
/>
|
|
||||||
</UCard>
|
|
||||||
|
|
||||||
<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'}"
|
|
||||||
v-for="document in allocatedDocuments"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<div class="flex flex-row justify-between">
|
|
||||||
<span>{{document.customer ? document.customer.name : ""}} - {{document.documentNumber}}</span>
|
|
||||||
<span class="font-semibold text-nowrap">{{displayCurrency(getDocumentSum(document))}}</span>
|
|
||||||
</div>
|
|
||||||
</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(getDocumentSum(document))})"
|
|
||||||
/>
|
|
||||||
<UButton
|
|
||||||
icon="i-heroicons-x-mark"
|
|
||||||
variant="outline"
|
|
||||||
color="rose"
|
|
||||||
class="mr-3"
|
|
||||||
v-if="itemInfo.statementallocations.find(i => i.cd_id === document.id)"
|
|
||||||
@click="removeAllocation(itemInfo.statementallocations.find(i => i.cd_id === document.id).id)"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<UButton
|
|
||||||
variant="outline"
|
|
||||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
|
||||||
@click="router.push(`/createDocument/show/${document.id}`)"
|
|
||||||
/>
|
|
||||||
</UCard>
|
|
||||||
|
|
||||||
<UDivider class="my-3">Ohne Beleg buchen</UDivider>
|
|
||||||
|
|
||||||
<InputGroup class="mt-3 w-full">
|
|
||||||
<USelectMenu
|
|
||||||
class="w-full"
|
|
||||||
:options="accounts"
|
|
||||||
value-attribute="id"
|
|
||||||
option-attribute="label"
|
|
||||||
:ui-menu="{ width: 'min-w-max' }"
|
|
||||||
v-model="accountToSave"
|
|
||||||
searchable
|
|
||||||
:search-attributes="['number','label']"
|
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #description>
|
||||||
<span v-if="accountToSave">{{accounts.find(i => i.id === accountToSave).number}} - {{accounts.find(i => i.id === accountToSave).label}}</span>
|
<UProgress
|
||||||
<span v-else>Kein Konto ausgewählt</span>
|
:value="Math.abs(itemInfo.amount) - calculateOpenSum"
|
||||||
|
:max="Math.abs(itemInfo.amount)"
|
||||||
|
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #option="{option}">
|
</UAlert>
|
||||||
{{option.number}} - {{option.label}}
|
</div>
|
||||||
</template>
|
|
||||||
</USelectMenu>
|
|
||||||
<UButton
|
<div class="scrollList mt-3 px-2">
|
||||||
@click="showAccountSelection = true"
|
<UDivider>Vorhandene Buchungen</UDivider>
|
||||||
icon="i-heroicons-magnifying-glass"
|
|
||||||
/>
|
<UCard
|
||||||
<UButton
|
class="mt-5"
|
||||||
variant="outline"
|
v-for="item in itemInfo.statementallocations.filter(i => i.account)"
|
||||||
icon="i-heroicons-check"
|
|
||||||
@click="saveAllocation({bs_id: itemInfo.id, amount: Number(calculateOpenSum), account: accountToSave })"
|
|
||||||
>
|
>
|
||||||
Buchen
|
|
||||||
</UButton>
|
|
||||||
<UButton
|
|
||||||
@click="accountToSave = ''"
|
|
||||||
icon="i-heroicons-x-mark"
|
|
||||||
variant="outline"
|
|
||||||
color="rose"
|
|
||||||
/>
|
|
||||||
</InputGroup>
|
|
||||||
<UModal
|
|
||||||
v-model="showAccountSelection"
|
|
||||||
>
|
|
||||||
<UCard>
|
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
|
<span>{{accounts.find(i => i.id === item.account).number}} - {{accounts.find(i => i.id === item.account).label}}</span>
|
||||||
Konto auswählen
|
<span class="font-semibold text-nowrap">{{displayCurrency(item.amount)}}</span>
|
||||||
</h3>
|
|
||||||
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showAccountSelection = false" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<UButton
|
<UButton
|
||||||
v-for="selectableAccount in accounts"
|
icon="i-heroicons-x-mark"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
class="m-3"
|
color="rose"
|
||||||
@click="selectAccount(selectableAccount.id)"
|
class="mr-3"
|
||||||
|
@click="removeAllocation(itemInfo.statementallocations.find(i => i.account === item.account).id)"
|
||||||
|
/>
|
||||||
|
</UCard>
|
||||||
|
<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'}"
|
||||||
|
v-for="document in allocatedDocuments"
|
||||||
|
>
|
||||||
|
<template #header>
|
||||||
|
<div class="flex flex-row justify-between">
|
||||||
|
<span>{{document.customer ? document.customer.name : ""}} - {{document.documentNumber}}</span>
|
||||||
|
<span class="font-semibold text-nowrap">{{displayCurrency(getDocumentSum(document))}}</span>
|
||||||
|
</div>
|
||||||
|
</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(getDocumentSum(document))})"
|
||||||
|
/>
|
||||||
|
<UButton
|
||||||
|
icon="i-heroicons-x-mark"
|
||||||
|
variant="outline"
|
||||||
|
color="rose"
|
||||||
|
class="mr-3"
|
||||||
|
v-if="itemInfo.statementallocations.find(i => i.cd_id === document.id)"
|
||||||
|
@click="removeAllocation(itemInfo.statementallocations.find(i => i.cd_id === document.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))})"
|
||||||
|
/>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="w-2/5 mx-auto">
|
||||||
|
<div class="px-2">
|
||||||
|
<UDivider class="my-3">Ohne Beleg buchen</UDivider>
|
||||||
|
|
||||||
|
<InputGroup class="mt-3 w-full">
|
||||||
|
<USelectMenu
|
||||||
|
class="w-full"
|
||||||
|
:options="accounts"
|
||||||
|
value-attribute="id"
|
||||||
|
option-attribute="label"
|
||||||
|
:ui-menu="{ width: 'min-w-max' }"
|
||||||
|
v-model="accountToSave"
|
||||||
|
searchable
|
||||||
|
:search-attributes="['number','label']"
|
||||||
>
|
>
|
||||||
{{selectableAccount.label}}
|
<template #label>
|
||||||
</UButton>
|
<span v-if="accountToSave">{{accounts.find(i => i.id === accountToSave).number}} - {{accounts.find(i => i.id === accountToSave).label}}</span>
|
||||||
|
<span v-else>Kein Konto ausgewählt</span>
|
||||||
|
</template>
|
||||||
|
<template #option="{option}">
|
||||||
|
{{option.number}} - {{option.label}}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
<UInput
|
||||||
|
v-model="manualAllocationSum"
|
||||||
|
type="number"
|
||||||
|
step="0.01"
|
||||||
|
>
|
||||||
|
<template #trailing>
|
||||||
|
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
||||||
|
</template>
|
||||||
|
</UInput>
|
||||||
|
<UButton
|
||||||
|
@click="showAccountSelection = true"
|
||||||
|
icon="i-heroicons-magnifying-glass"
|
||||||
|
variant="outline"
|
||||||
|
/>
|
||||||
|
<UButton
|
||||||
|
variant="outline"
|
||||||
|
icon="i-heroicons-check"
|
||||||
|
:disabled="!accountToSave"
|
||||||
|
@click="saveAllocation({bs_id: itemInfo.id, amount: manualAllocationSum, account: accountToSave })"
|
||||||
|
/>
|
||||||
|
<UButton
|
||||||
|
@click="accountToSave = ''"
|
||||||
|
icon="i-heroicons-x-mark"
|
||||||
|
variant="outline"
|
||||||
|
color="rose"
|
||||||
|
/>
|
||||||
|
</InputGroup>
|
||||||
|
<UModal
|
||||||
|
v-model="showAccountSelection"
|
||||||
|
>
|
||||||
|
<UCard>
|
||||||
|
<template #header>
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
|
||||||
|
Konto auswählen
|
||||||
|
</h3>
|
||||||
|
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showAccountSelection = false" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<UButton
|
||||||
|
v-for="selectableAccount in accounts"
|
||||||
|
variant="outline"
|
||||||
|
class="m-3"
|
||||||
|
@click="selectAccount(selectableAccount.id)"
|
||||||
|
>
|
||||||
|
{{selectableAccount.label}}
|
||||||
|
</UButton>
|
||||||
|
</UCard>
|
||||||
|
|
||||||
|
</UModal>
|
||||||
|
|
||||||
|
<UDivider
|
||||||
|
class="my-3"
|
||||||
|
>
|
||||||
|
Auf Beleg buchen
|
||||||
|
</UDivider>
|
||||||
|
<InputGroup
|
||||||
|
class="mt-3 w-full"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
id="searchinput"
|
||||||
|
v-model="searchString"
|
||||||
|
icon="i-heroicons-funnel"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="Suche..."
|
||||||
|
class="hidden lg:block w-full mr-1"
|
||||||
|
@keydown.esc="$event.target.blur()"
|
||||||
|
>
|
||||||
|
<template #trailing>
|
||||||
|
<UKbd value="/" />
|
||||||
|
</template>
|
||||||
|
</UInput>
|
||||||
|
<UButton
|
||||||
|
variant="outline"
|
||||||
|
icon="i-heroicons-x-mark"
|
||||||
|
color="rose"
|
||||||
|
@click="searchString = ''"
|
||||||
|
/>
|
||||||
|
</InputGroup>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="scrollList mt-3 px-2" style="height: 70vh;">
|
||||||
|
|
||||||
|
<UCard
|
||||||
|
class="mt-5"
|
||||||
|
v-for="document in filteredDocuments"
|
||||||
|
>
|
||||||
|
<template #header>
|
||||||
|
<div class="flex flex-row justify-between">
|
||||||
|
<span>{{document.customer ? document.customer.name : ""}} - {{document.documentNumber}}</span>
|
||||||
|
<span class="font-semibold text-primary-500 text-nowrap">{{displayCurrency(document.openSum)}}</span>
|
||||||
|
</div>
|
||||||
|
</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(document.openSum)})"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<UButton
|
||||||
|
variant="outline"
|
||||||
|
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||||
|
@click="router.push(`/createDocument/show/${document.id}`)"
|
||||||
|
/>
|
||||||
</UCard>
|
</UCard>
|
||||||
|
|
||||||
</UModal>
|
<UCard
|
||||||
|
class="mt-5"
|
||||||
<UDivider
|
v-for="item in filteredIncomingInvoices"
|
||||||
class="my-3"
|
|
||||||
>
|
|
||||||
Auf Beleg buchen
|
|
||||||
</UDivider>
|
|
||||||
|
|
||||||
<InputGroup
|
|
||||||
class="mt-3 w-full"
|
|
||||||
>
|
|
||||||
<UInput
|
|
||||||
id="searchinput"
|
|
||||||
v-model="searchString"
|
|
||||||
icon="i-heroicons-funnel"
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder="Suche..."
|
|
||||||
class="hidden lg:block w-full mr-1"
|
|
||||||
@keydown.esc="$event.target.blur()"
|
|
||||||
>
|
>
|
||||||
<template #trailing>
|
<template #header>
|
||||||
<UKbd value="/" />
|
<div class="flex flex-row justify-between">
|
||||||
|
<span>{{item.vendor ? item.vendor.name : ''}} - {{item.reference}}</span>
|
||||||
|
<span class="font-semibold text-rose-600 text-nowrap">-{{displayCurrency(getInvoiceSum(item))}}</span>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</UInput>
|
<UButton
|
||||||
<UButton
|
icon="i-heroicons-check"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
icon="i-heroicons-x-mark"
|
class="mr-3"
|
||||||
color="rose"
|
v-if="!itemInfo.statementallocations.find(i => i.ii_id === item.id)"
|
||||||
@click="searchString = ''"
|
@click="saveAllocation({ii_id: item.id, bs_id: itemInfo.id, amount: Number(itemInfo.amount)})"
|
||||||
/>
|
/>
|
||||||
</InputGroup>
|
<UButton
|
||||||
|
variant="outline"
|
||||||
|
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||||
|
@click="router.push(`/incominginvoices/show/${item.id}`)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</UCard>
|
||||||
<UCard
|
</div>
|
||||||
class="mt-5"
|
|
||||||
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
|
||||||
v-for="document in filteredRows"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<div class="flex flex-row justify-between">
|
|
||||||
<span>{{document.customer ? document.customer.name : ""}} - {{document.documentNumber}}</span>
|
|
||||||
<span class="font-semibold text-primary-500 text-nowrap">{{displayCurrency(document.openSum)}}</span>
|
|
||||||
</div>
|
|
||||||
</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(document.openSum)})"
|
|
||||||
/>
|
|
||||||
<UButton
|
|
||||||
icon="i-heroicons-x-mark"
|
|
||||||
variant="outline"
|
|
||||||
color="rose"
|
|
||||||
class="mr-3"
|
|
||||||
v-if="itemInfo.statementallocations.find(i => i.cd_id === document.id)"
|
|
||||||
@click="removeAllocation(itemInfo.statementallocations.find(i => i.ii_id === document.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.assignments.find(i => i.id === invoice.id)*/ false ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
|
||||||
v-for="item in openIncomingInvoices"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<div class="flex flex-row justify-between">
|
|
||||||
<span>{{dataStore.getVendorById(item.vendor) ? dataStore.getVendorById(item.vendor).name : ''}} - {{item.reference}}</span>
|
|
||||||
<span class="font-semibold text-rose-600 text-nowrap">-{{displayCurrency(getInvoiceSum(item))}}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<UButton
|
|
||||||
icon="i-heroicons-check"
|
|
||||||
variant="outline"
|
|
||||||
class="mr-3"
|
|
||||||
v-if="!itemInfo.statementallocations.find(i => i.ii_id === item.id)"
|
|
||||||
@click="saveAllocation({ii_id: item.id, bs_id: itemInfo.id, amount: Number(itemInfo.amount)})"
|
|
||||||
/>
|
|
||||||
<UButton
|
|
||||||
icon="i-heroicons-x-mark"
|
|
||||||
variant="outline"
|
|
||||||
color="rose"
|
|
||||||
class="mr-3"
|
|
||||||
v-if="itemInfo.statementallocations.find(i => i.ii_id === item.id)"
|
|
||||||
@click="removeAllocation(itemInfo.statementallocations.find(i => i.ii_id === item.id).id)"
|
|
||||||
/>
|
|
||||||
<UButton
|
|
||||||
variant="outline"
|
|
||||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
|
||||||
@click="router.push(`/incominginvoices/show/${item.id}`)"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</UCard>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</UDashboardPanelContent>
|
</UDashboardPanelContent>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.workingContainer {
|
||||||
|
height: 90vh;
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user