Changes
This commit is contained in:
@@ -76,6 +76,9 @@
|
||||
class="text-rose-500"
|
||||
>{{String(row.amount.toFixed(2)).replace(".",",")}} €</span>
|
||||
</template>
|
||||
<template #openAmount-data="{row}">
|
||||
{{displayCurrency(calculateOpenSum(row))}}
|
||||
</template>
|
||||
<template #partner-data="{row}">
|
||||
<span
|
||||
v-if="row.amount < 0"
|
||||
@@ -200,6 +203,11 @@ const templateColumns = [
|
||||
label: "Betrag",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: "openAmount",
|
||||
label: "Offener Betrag",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: "partner",
|
||||
label: "Name",
|
||||
@@ -219,9 +227,36 @@ const searchString = ref('')
|
||||
const filterAccount = ref(dataStore.bankAccounts || [])
|
||||
const showOnlyNotAssigned = ref(true)
|
||||
|
||||
const displayCurrency = (value, 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) => {
|
||||
let startingAmount = statement.amount
|
||||
|
||||
statement.assignments.forEach(item => {
|
||||
if(item.type === "createdDocument") {
|
||||
let doc = dataStore.getCreatedDocumentById(item.id)
|
||||
startingAmount = startingAmount - getDocumentSum(doc)
|
||||
}
|
||||
})
|
||||
|
||||
return startingAmount.toFixed(2)
|
||||
}
|
||||
|
||||
|
||||
const filteredRows = computed(() => {
|
||||
return useSearch(searchString.value, dataStore.bankstatements.filter(i => filterAccount.value.find(x => x.id === i.account) && (showOnlyNotAssigned.value ? (!i.createdDocument && !i.incomingInvoice) : true)))
|
||||
return useSearch(searchString.value, dataStore.bankstatements.filter(i => filterAccount.value.find(x => x.id === i.account) && (showOnlyNotAssigned.value ? Number(calculateOpenSum(i)) !== 0 : true)))
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -53,9 +53,23 @@ const getInvoiceSum = (invoice) => {
|
||||
sum += account.amountTax
|
||||
sum += account.amountNet
|
||||
})
|
||||
return sum
|
||||
return sum.toFixed(2)
|
||||
}
|
||||
|
||||
const calculateOpenSum = computed(() => {
|
||||
let startingAmount = itemInfo.value.amount
|
||||
|
||||
itemInfo.value.assignments.forEach(item => {
|
||||
if(item.type === "createdDocument") {
|
||||
let doc = dataStore.getCreatedDocumentById(item.id)
|
||||
startingAmount = startingAmount - getDocumentSum(doc)
|
||||
}
|
||||
})
|
||||
|
||||
return startingAmount.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
setup()
|
||||
|
||||
</script>
|
||||
@@ -121,9 +135,11 @@ setup()
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
|
||||
<UDashboardPanelContent>
|
||||
<UDashboardPanelContent
|
||||
class="flex flex-row"
|
||||
>
|
||||
<UCard
|
||||
class="w-4/5 mx-auto mt-10"
|
||||
class="w-2/5 mx-auto mt-5"
|
||||
v-if="itemInfo"
|
||||
>
|
||||
<template #header>
|
||||
@@ -190,12 +206,28 @@ setup()
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="flex-row flex justify-between">
|
||||
<td>
|
||||
<td colspan="2">
|
||||
<span class="font-semibold">Verknüpftes Dokument:</span>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr
|
||||
class="flex-row flex justify-between mb-3"
|
||||
v-for="item in itemInfo.assignments"
|
||||
>
|
||||
<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-else-if="itemInfo.incomingInvoice"><nuxt-link :to="`/incominInvoices/show/${itemInfo.incomingInvoice}`">{{dataStore.getIncomingInvoiceById(itemInfo.incomingInvoice).reference}}</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-if="item.type === 'createdDocument'">
|
||||
{{dataStore.getCreatedDocumentById(item.id).documentNumber}}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<UButton
|
||||
variant="outline"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/createDocument/show/${item.id}`)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="flex-row flex justify-between">
|
||||
@@ -209,32 +241,53 @@ setup()
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</UCard>
|
||||
|
||||
<UDivider
|
||||
class="mt-5 w-4/5 mx-auto"
|
||||
<!-- <UDivider
|
||||
class="mt-5 w-2/5 mx-auto"
|
||||
v-if="!itemInfo.createdDocument && !itemInfo.incomingInvoice"
|
||||
/>
|
||||
/>-->
|
||||
|
||||
<UCard
|
||||
class="w-4/5 mx-auto mt-5"
|
||||
v-if="itemInfo.amount > 0 && !itemInfo.createdDocument"
|
||||
:ui="{ring: itemInfo.createdDocument === document.id ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
||||
v-for="document in dataStore.getOpenDocuments()"
|
||||
<div
|
||||
class="w-2/5 mx-auto"
|
||||
v-if="itemInfo.amount > 0 "
|
||||
>
|
||||
<template #header>
|
||||
<div class="flex flex-row justify-between">
|
||||
<span>{{dataStore.getCustomerById(document.customer).name}} - {{document.documentNumber}}</span>
|
||||
<span class="font-semibold text-primary-500">{{displayCurrency(getDocumentSum(document))}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<UButton
|
||||
icon="i-heroicons-check"
|
||||
variant="outline"
|
||||
v-if="Number(getDocumentSum(document)) === itemInfo.amount"
|
||||
@click="itemInfo.createdDocument = document.id"
|
||||
/>
|
||||
</UCard>
|
||||
<UDivider
|
||||
label="Test"
|
||||
>
|
||||
<span>Offene Summe: {{displayCurrency(calculateOpenSum)}}</span>
|
||||
</UDivider>
|
||||
<UCard
|
||||
class="mt-5"
|
||||
:ui="{ring: itemInfo.assignments.find(i => i.id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
||||
v-for="document in dataStore.getOpenDocuments()"
|
||||
>
|
||||
<template #header>
|
||||
<div class="flex flex-row justify-between">
|
||||
<span>{{dataStore.getCustomerById(document.customer).name}} - {{document.documentNumber}}</span>
|
||||
<span class="font-semibold text-primary-500">{{displayCurrency(getDocumentSum(document))}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<UButton
|
||||
icon="i-heroicons-check"
|
||||
variant="outline"
|
||||
class="mr-3"
|
||||
v-if="!itemInfo.assignments.find(i => i.id === document.id)"
|
||||
@click="itemInfo.assignments.push({type: 'createdDocument',id: document.id})"
|
||||
/>
|
||||
<UButton
|
||||
icon="i-heroicons-x-mark"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
v-if="itemInfo.assignments.find(i => i.id === document.id)"
|
||||
@click="itemInfo.assignments = itemInfo.assignments.filter(i => i.id !== document.id)"
|
||||
/>
|
||||
</UCard>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user