Changes in Statement Allocation and Open Sum Calc
This commit is contained in:
@@ -11,32 +11,21 @@ defineShortcuts({
|
|||||||
//console.log(searchinput)
|
//console.log(searchinput)
|
||||||
//searchinput.value.focus()
|
//searchinput.value.focus()
|
||||||
document.getElementById("searchinput").focus()
|
document.getElementById("searchinput").focus()
|
||||||
},
|
|
||||||
'escape': () => {
|
|
||||||
//console.log(searchinput)
|
|
||||||
//searchinput.value.focus()
|
|
||||||
showStatementModal.value = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const dataStore = useDataStore()
|
|
||||||
const profileStore = useProfileStore()
|
const profileStore = useProfileStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
|
|
||||||
const bankstatements = ref([])
|
const bankstatements = ref([])
|
||||||
|
const bankaccounts = ref([])
|
||||||
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
bankstatements.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq('tenant', profileStore.currentTenant).order("date", {ascending:false})).data
|
bankstatements.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq('tenant', profileStore.currentTenant).order("date", {ascending:false})).data
|
||||||
|
bankaccounts.value = await useSupabaseSelect("bankaccounts")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const selectedStatement = ref(null)
|
|
||||||
const showStatementModal = ref(false)
|
|
||||||
|
|
||||||
const templateColumns = [
|
const templateColumns = [
|
||||||
{
|
{
|
||||||
key: "account",
|
key: "account",
|
||||||
@@ -73,35 +62,23 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
|
|||||||
|
|
||||||
|
|
||||||
const searchString = ref('')
|
const searchString = ref('')
|
||||||
const filterAccount = ref(dataStore.bankAccounts || [])
|
const filterAccount = ref(bankaccounts || [])
|
||||||
const showOnlyNotAssigned = ref(true)
|
const showOnlyNotAssigned = ref(true)
|
||||||
|
|
||||||
const displayCurrency = (value, currency = "€") => {
|
const displayCurrency = (value, currency = "€") => {
|
||||||
return `${Number(value).toFixed(2).replace(".",",")} ${currency}`
|
return `${Number(value).toFixed(2).replace(".",",")} ${currency}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDocumentSum = (doc) => {
|
|
||||||
let sum = 0
|
|
||||||
doc.rows.forEach(row => {
|
|
||||||
if(row.mode === "normal" || row.mode === "service" || row.mode === "free") {
|
|
||||||
sum += row.quantity * row.price * (1 - row.discountPercent / 100) * (1 + row.taxPercent / 100)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return sum
|
|
||||||
}
|
|
||||||
|
|
||||||
const calculateOpenSum = (statement) => {
|
const calculateOpenSum = (statement) => {
|
||||||
let startingAmount = statement.amount || 0
|
let startingAmount = 0
|
||||||
|
|
||||||
statement.statementallocations.forEach(item => {
|
statement.statementallocations.forEach(item => {
|
||||||
if(item.cd_id) {
|
startingAmount += Math.abs(item.amount)
|
||||||
startingAmount = startingAmount - item.amount
|
|
||||||
} else if(item.ii_id) {
|
|
||||||
startingAmount = Number(startingAmount) + item.amount
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return startingAmount.toFixed(2)
|
return (Math.abs(statement.amount) - startingAmount).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,11 +111,12 @@ setupPage()
|
|||||||
<UDashboardToolbar>
|
<UDashboardToolbar>
|
||||||
<template #left>
|
<template #left>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
:options="dataStore.bankAccounts"
|
:options="bankaccounts"
|
||||||
v-model="filterAccount"
|
v-model="filterAccount"
|
||||||
option-attribute="iban"
|
option-attribute="iban"
|
||||||
multiple
|
multiple
|
||||||
by="id"
|
by="id"
|
||||||
|
:ui-menu="{ width: 'min-w-max' }"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
Konto
|
Konto
|
||||||
@@ -158,6 +136,7 @@ setupPage()
|
|||||||
multiple
|
multiple
|
||||||
class="hidden lg:block"
|
class="hidden lg:block"
|
||||||
by="key"
|
by="key"
|
||||||
|
:ui-menu="{ width: 'min-w-max' }"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
Spalten
|
Spalten
|
||||||
@@ -175,7 +154,7 @@ setupPage()
|
|||||||
>
|
>
|
||||||
|
|
||||||
<template #account-data="{row}">
|
<template #account-data="{row}">
|
||||||
{{row.account ? (dataStore.getBankAccountById(row.account).name ? dataStore.getBankAccountById(row.account).name :dataStore.getBankAccountById(row.account).iban) : ""}}
|
{{row.account ? bankaccounts.find(i => i.id === row.account).iban : ""}}
|
||||||
</template>
|
</template>
|
||||||
<template #valueDate-data="{row}">
|
<template #valueDate-data="{row}">
|
||||||
{{dayjs(row.valueDate).format("DD.MM.YY")}}
|
{{dayjs(row.valueDate).format("DD.MM.YY")}}
|
||||||
@@ -207,72 +186,7 @@ setupPage()
|
|||||||
</template>
|
</template>
|
||||||
</UTable>
|
</UTable>
|
||||||
|
|
||||||
<UModal
|
|
||||||
v-model="showStatementModal"
|
|
||||||
class="no-doc-sroll"
|
|
||||||
>
|
|
||||||
|
|
||||||
<UCard class="h-full">
|
|
||||||
<template #header>
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<span
|
|
||||||
v-if="selectedStatement.amount > 0"
|
|
||||||
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
|
||||||
>
|
|
||||||
{{selectedStatement.debName}}
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
v-else-if="selectedStatement.amount < 0"
|
|
||||||
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
|
||||||
>
|
|
||||||
{{selectedStatement.credName}}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showStatementModal = false" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
{{selectedStatement.id}}
|
|
||||||
|
|
||||||
<div class="flex flex-row">
|
|
||||||
<div class="w-1/2 truncate">
|
|
||||||
<p>Betrag: {{String(selectedStatement.amount.toFixed(2)).replace(".",",")}} €</p>
|
|
||||||
<p>Buchungsdatum: {{dayjs(selectedStatement.date).format("DD.MM.YYYY")}}</p>
|
|
||||||
<p>Werstellungsdatum: {{dayjs(selectedStatement.valueDate).format("DD.MM.YYYY")}}</p>
|
|
||||||
<p>Partner: {{selectedStatement.amount > 0 ? selectedStatement.debName : selectedStatement.credName}}</p>
|
|
||||||
<p>Partner IBAN: {{selectedStatement.amount > 0 ? selectedStatement.debIban : selectedStatement.credIban}}</p>
|
|
||||||
<p>Konto: {{selectedStatement.account}}</p>
|
|
||||||
<p class="text-wrap">Beschreibung: <br>{{selectedStatement.text}}</p>
|
|
||||||
</div>
|
|
||||||
<div class="w-full p-2 overflow-scroll">
|
|
||||||
<UCard
|
|
||||||
v-for="document in dataStore.getOpenDocuments()"
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
{{document.documentNumber ||document.reference}}
|
|
||||||
<!-- {{document}}-->
|
|
||||||
</UCard>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <UFormGroup>
|
|
||||||
<USelectMenu
|
|
||||||
:options="dataStore.createddocuments"
|
|
||||||
/>
|
|
||||||
</UFormGroup>-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</UCard>
|
|
||||||
|
|
||||||
</UModal>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ const openIncomingInvoices = ref([])
|
|||||||
|
|
||||||
const accounts = ref([])
|
const accounts = ref([])
|
||||||
|
|
||||||
|
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(*)").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(*)").eq("id",route.params.id).single()).data //dataStore.bankstatements.find(i => i.id === Number(route.params.id))
|
||||||
@@ -42,12 +43,13 @@ const setup = async () => {
|
|||||||
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),
|
docTotal: getDocumentSum(i, i.usedAdvanceInvoices.map(i => getDocumentSum(documents.find(x => x.id === i)))),
|
||||||
statementTotal: Number(i.statementallocations.reduce((n,{amount}) => n + amount, 0)),
|
statementTotal: Number(i.statementallocations.reduce((n,{amount}) => n + amount, 0)),
|
||||||
openSum: (Number(getDocumentSum(i)) - Number(i.statementallocations.reduce((n,{amount}) => n + amount, 0))).toFixed(2)
|
openSum: (Number(getDocumentSum(i, i.usedAdvanceInvoices.map(i => getDocumentSum(documents.find(x => x.id === i))))) - Number(i.statementallocations.reduce((n,{amount}) => n + amount, 0))).toFixed(2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ const setup = async () => {
|
|||||||
|
|
||||||
let allocations = (await supabase.from("createddocuments").select(`*, statementallocations(*)`).eq("id",50)).data
|
let allocations = (await supabase.from("createddocuments").select(`*, statementallocations(*)`).eq("id",50)).data
|
||||||
|
|
||||||
|
loading.value = false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,19 +73,36 @@ const displayCurrency = (value, currency = "€") => {
|
|||||||
return `${Number(value).toFixed(2).replace(".",",")} ${currency}`
|
return `${Number(value).toFixed(2).replace(".",",")} ${currency}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const separateIBAN = (input) => {
|
const separateIBAN = (input = "") => {
|
||||||
const separates = input.match(/.{1,4}/g)
|
const separates = input.match(/.{1,4}/g)
|
||||||
return separates.join(" ")
|
return separates.join(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDocumentSum = (doc) => {
|
const getDocumentSum = (doc,advanceInvoices = []) => {
|
||||||
let sum = 0
|
let sum = 0
|
||||||
|
|
||||||
|
console.log(advanceInvoices)
|
||||||
|
|
||||||
doc.rows.forEach(row => {
|
doc.rows.forEach(row => {
|
||||||
if(row.mode === "normal" || row.mode === "service" || row.mode === "free") {
|
if(row.mode === "normal" || row.mode === "service" || row.mode === "free") {
|
||||||
sum += row.quantity * row.price * (1 - row.discountPercent / 100) * (1 + row.taxPercent / 100)
|
sum += row.quantity * row.price * (1 - row.discountPercent / 100) * (1 + row.taxPercent / 100)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return sum
|
|
||||||
|
console.log(sum)
|
||||||
|
|
||||||
|
if(advanceInvoices.length > 0) {
|
||||||
|
advanceInvoices.forEach(i => {
|
||||||
|
console.log(i)
|
||||||
|
sum -= i
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(sum)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Number(sum.toFixed(2))
|
||||||
}
|
}
|
||||||
|
|
||||||
const getInvoiceSum = (invoice) => {
|
const getInvoiceSum = (invoice) => {
|
||||||
@@ -96,38 +115,17 @@ const getInvoiceSum = (invoice) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const calculateOpenSum = computed(() => {
|
const calculateOpenSum = computed(() => {
|
||||||
let startingAmount = itemInfo.value.amount || 0
|
|
||||||
|
|
||||||
itemInfo.value.statementallocations.forEach(item => {
|
|
||||||
if(item.cd_id) {
|
|
||||||
startingAmount = startingAmount - item.amount
|
|
||||||
} else if(item.ii_id) {
|
|
||||||
startingAmount = Number(startingAmount) + item.amount
|
|
||||||
}else if(item.account) {
|
|
||||||
startingAmount = Number(startingAmount) - item.amount
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return startingAmount.toFixed(2)
|
|
||||||
})
|
|
||||||
|
|
||||||
const calculateAllocatedSum = computed(() => {
|
|
||||||
let startingAmount = 0
|
let startingAmount = 0
|
||||||
|
|
||||||
itemInfo.value.statementallocations.forEach(item => {
|
itemInfo.value.statementallocations.forEach(item => {
|
||||||
console.log(item)
|
startingAmount += Math.abs(item.amount)
|
||||||
|
|
||||||
if(item.cd_id) {
|
|
||||||
startingAmount = startingAmount + item.amount
|
|
||||||
} else if(item.ii_id) {
|
|
||||||
startingAmount = Number(startingAmount) + item.amount
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return startingAmount
|
return (Math.abs(itemInfo.value.amount) - startingAmount).toFixed(2)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const saveAllocations = async () => {
|
const saveAllocations = async () => {
|
||||||
let allocationsToBeSaved = itemInfo.value.statementallocations.filter(i => !i.id)
|
let allocationsToBeSaved = itemInfo.value.statementallocations.filter(i => !i.id)
|
||||||
|
|
||||||
@@ -138,6 +136,14 @@ const saveAllocations = async () => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showAccountSelection = ref(false)
|
||||||
|
const accountToSave = ref("")
|
||||||
|
|
||||||
|
const selectAccount = (id) => {
|
||||||
|
accountToSave.value = id
|
||||||
|
showAccountSelection.value = false
|
||||||
|
}
|
||||||
|
|
||||||
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,
|
||||||
@@ -184,37 +190,9 @@ setup()
|
|||||||
</template>
|
</template>
|
||||||
<template #center>
|
<template #center>
|
||||||
<h1
|
<h1
|
||||||
:class="['text-xl','font-medium', Number(calculateOpenSum) === 0 ? ['text-primary-500'] : ['text-rose-600']]"
|
:class="['text-xl','font-medium']"
|
||||||
>Kontobewegung bearbeiten</h1>
|
>Kontobewegung bearbeiten</h1>
|
||||||
</template>
|
</template>
|
||||||
<template #right>
|
|
||||||
<!-- <UButton
|
|
||||||
v-if="mode === 'edit'"
|
|
||||||
@click="saveAllocations"
|
|
||||||
>
|
|
||||||
Speichern
|
|
||||||
</UButton>-->
|
|
||||||
<!--<UButton
|
|
||||||
v-else-if="mode === 'create'"
|
|
||||||
@click="dataStore.createNewItem('customers',itemInfo)"
|
|
||||||
>
|
|
||||||
Erstellen
|
|
||||||
</UButton>
|
|
||||||
<UButton
|
|
||||||
@click="cancelEditorCreate"
|
|
||||||
color="red"
|
|
||||||
class="ml-2"
|
|
||||||
v-if="mode === 'edit' || mode === 'create'"
|
|
||||||
>
|
|
||||||
Abbrechen
|
|
||||||
</UButton>
|
|
||||||
<UButton
|
|
||||||
v-if="mode === 'show'"
|
|
||||||
@click="editItem"
|
|
||||||
>
|
|
||||||
Bearbeiten
|
|
||||||
</UButton>-->
|
|
||||||
</template>
|
|
||||||
<template #badge v-if="itemInfo">
|
<template #badge v-if="itemInfo">
|
||||||
<UBadge
|
<UBadge
|
||||||
v-if="itemInfo.incomingInvoice || itemInfo.createdDocument"
|
v-if="itemInfo.incomingInvoice || itemInfo.createdDocument"
|
||||||
@@ -232,9 +210,10 @@ setup()
|
|||||||
|
|
||||||
<UDashboardPanelContent
|
<UDashboardPanelContent
|
||||||
class="flex flex-row"
|
class="flex flex-row"
|
||||||
|
v-if="!loading"
|
||||||
>
|
>
|
||||||
<UCard
|
<UCard
|
||||||
class="w-2/5 mx-auto mt-5"
|
class="w-2/5 mx-auto "
|
||||||
v-if="itemInfo"
|
v-if="itemInfo"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
@@ -282,7 +261,9 @@ setup()
|
|||||||
<span class="font-semibold">Partner:</span>
|
<span class="font-semibold">Partner:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{itemInfo.amount > 0 ? itemInfo.debName : itemInfo.credName}}
|
<span v-if="itemInfo.debName">{{itemInfo.debName}}</span>
|
||||||
|
<span v-else-if="itemInfo.credName">{{itemInfo.credName}}</span>
|
||||||
|
<span v-else>-</span>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -291,7 +272,9 @@ setup()
|
|||||||
<span class="font-semibold">Partner IBAN:</span>
|
<span class="font-semibold">Partner IBAN:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{itemInfo.amount > 0 ? separateIBAN(itemInfo.debIban) : separateIBAN(itemInfo.credIban)}}
|
<span v-if="itemInfo.debIban">{{itemInfo.debIban}}</span>
|
||||||
|
<span v-else-if="itemInfo.credIban">{{itemInfo.credIban}}</span>
|
||||||
|
<span v-else>-</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="flex-row flex justify-between">
|
<tr class="flex-row flex justify-between">
|
||||||
@@ -356,19 +339,41 @@ setup()
|
|||||||
|
|
||||||
</UCard>
|
</UCard>
|
||||||
|
|
||||||
<!-- <UDivider
|
<div class="w-2/5 mx-auto">
|
||||||
class="mt-5 w-2/5 mx-auto"
|
<UAlert
|
||||||
v-if="!itemInfo.createdDocument && !itemInfo.incomingInvoice"
|
class="mb-3"
|
||||||
/>-->
|
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
||||||
|
variant="outline"
|
||||||
<div
|
:title="calculateOpenSum > 0 ? `${displayCurrency(calculateOpenSum)} von ${displayCurrency(Math.abs(itemInfo.amount))} nicht zugewiesen` : 'Kontobewegung vollständig zugewiesen'"
|
||||||
class="w-2/5 mx-auto"
|
|
||||||
v-if="itemInfo.amount > 0 "
|
|
||||||
>
|
>
|
||||||
|
<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"
|
||||||
|
color="rose"
|
||||||
|
class="mr-3"
|
||||||
|
@click="removeAllocation(itemInfo.statementallocations.find(i => i.account === item.account).id)"
|
||||||
|
/>
|
||||||
|
</UCard>
|
||||||
|
|
||||||
<UDivider v-if="allocatedDocuments.length > 0">
|
|
||||||
<span>Zugewiesene Summe: {{displayCurrency(calculateAllocatedSum)}}</span>
|
|
||||||
</UDivider>
|
|
||||||
<UCard
|
<UCard
|
||||||
class="mt-5"
|
class="mt-5"
|
||||||
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
||||||
@@ -377,7 +382,7 @@ setup()
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex flex-row justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
<span>{{document.customer ? document.customer.name : ""}} - {{document.documentNumber}}</span>
|
<span>{{document.customer ? document.customer.name : ""}} - {{document.documentNumber}}</span>
|
||||||
<span class="font-semibold text-primary-500 text-nowrap">{{displayCurrency(getDocumentSum(document))}}</span>
|
<span class="font-semibold text-nowrap">{{displayCurrency(getDocumentSum(document))}}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<UButton
|
<UButton
|
||||||
@@ -402,28 +407,100 @@ setup()
|
|||||||
@click="router.push(`/createDocument/show/${document.id}`)"
|
@click="router.push(`/createDocument/show/${document.id}`)"
|
||||||
/>
|
/>
|
||||||
</UCard>
|
</UCard>
|
||||||
<UDivider class="mt-3">
|
|
||||||
<span>Offene Summe: {{displayCurrency(calculateOpenSum)}}</span>
|
<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>
|
||||||
|
<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>
|
||||||
|
<UButton
|
||||||
|
@click="showAccountSelection = true"
|
||||||
|
icon="i-heroicons-magnifying-glass"
|
||||||
|
/>
|
||||||
|
<UButton
|
||||||
|
variant="outline"
|
||||||
|
icon="i-heroicons-check"
|
||||||
|
@click="saveAllocation({bs_id: itemInfo.id, amount: Number(itemInfo.amount), account: accountToSave })"
|
||||||
|
>
|
||||||
|
Buchen
|
||||||
|
</UButton>
|
||||||
|
<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>
|
</UDivider>
|
||||||
|
|
||||||
|
<InputGroup
|
||||||
|
class="mt-3 w-full"
|
||||||
|
>
|
||||||
<UInput
|
<UInput
|
||||||
id="searchinput"
|
id="searchinput"
|
||||||
v-model="searchString"
|
v-model="searchString"
|
||||||
icon="i-heroicons-funnel"
|
icon="i-heroicons-funnel"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
placeholder="Suche..."
|
placeholder="Suche..."
|
||||||
class="hidden lg:block mt-3"
|
class="hidden lg:block w-full mr-1"
|
||||||
@keydown.esc="$event.target.blur()"
|
@keydown.esc="$event.target.blur()"
|
||||||
>
|
>
|
||||||
<template #trailing>
|
<template #trailing>
|
||||||
<UKbd value="/" />
|
<UKbd value="/" />
|
||||||
</template>
|
</template>
|
||||||
</UInput>
|
</UInput>
|
||||||
|
|
||||||
<UButton
|
<UButton
|
||||||
@click="saveAllocation({bs_id: itemInfo.id, amount: Number(itemInfo.amount), account: 20 })"
|
variant="outline"
|
||||||
>
|
icon="i-heroicons-x-mark"
|
||||||
Als DP markieren
|
color="rose"
|
||||||
</UButton>
|
@click="searchString = ''"
|
||||||
|
/>
|
||||||
|
</InputGroup>
|
||||||
|
|
||||||
|
|
||||||
<UCard
|
<UCard
|
||||||
class="mt-5"
|
class="mt-5"
|
||||||
@@ -459,14 +536,6 @@ setup()
|
|||||||
/>
|
/>
|
||||||
</UCard>
|
</UCard>
|
||||||
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="w-2/5 mx-auto"
|
|
||||||
v-if="itemInfo.amount < 0 "
|
|
||||||
>
|
|
||||||
<UDivider>
|
|
||||||
<span>Offene Summe: {{displayCurrency(calculateOpenSum)}}</span>
|
|
||||||
</UDivider>
|
|
||||||
<UCard
|
<UCard
|
||||||
class="mt-5"
|
class="mt-5"
|
||||||
:ui="{ring: /*itemInfo.assignments.find(i => i.id === invoice.id)*/ false ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
:ui="{ring: /*itemInfo.assignments.find(i => i.id === invoice.id)*/ false ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
||||||
@@ -474,7 +543,7 @@ setup()
|
|||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex flex-row justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
<span>{{dataStore.getVendorById(item.vendor).name}} - {{item.reference}}</span>
|
<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>
|
<span class="font-semibold text-rose-600 text-nowrap">-{{displayCurrency(getInvoiceSum(item))}}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -501,6 +570,7 @@ setup()
|
|||||||
|
|
||||||
</UCard>
|
</UCard>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</UDashboardPanelContent>
|
</UDashboardPanelContent>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user