feat(banking): add cost centres and VAT to account allocations
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs"
|
||||
import { getBankAllocationTaxBreakdown } from "~/utils/bankAllocationTax"
|
||||
import {
|
||||
getCreatedDocumentTaxBreakdown,
|
||||
getIncomingInvoiceTaxBreakdown
|
||||
@@ -125,6 +126,12 @@ const loadSummary = async () => {
|
||||
return sum + breakdown.tax19 + breakdown.tax7
|
||||
}, 0)
|
||||
|
||||
const bankTaxBalance = (allocations || []).reduce((sum: number, allocation: any) => {
|
||||
const date = dayjs(allocation.bankstatement?.date || allocation.bankstatement?.valueDate)
|
||||
if (!date.isValid() || date.isBefore(bounds.start, "day") || date.isAfter(bounds.end, "day")) return sum
|
||||
const { output, input } = getBankAllocationTaxBreakdown(allocation)
|
||||
return sum + output.tax19 + output.tax7 - input.tax19 - input.tax7
|
||||
}, 0)
|
||||
const expenses = invoiceExpenses + directAccountExpenses + depreciations
|
||||
|
||||
summary.value = {
|
||||
@@ -133,7 +140,7 @@ const loadSummary = async () => {
|
||||
expenses: Number(expenses.toFixed(2)),
|
||||
depreciations: Number(depreciations.toFixed(2)),
|
||||
result: Number((income - Math.abs(expenses)).toFixed(2)),
|
||||
taxBalance: Number((outputTax - inputTax).toFixed(2)),
|
||||
taxBalance: Number((outputTax - inputTax + bankTaxBalance).toFixed(2)),
|
||||
incomeCount: outputDocs.length,
|
||||
expenseCount: inputDocs.filter((invoice: any) => getIncomingInvoiceImmediateExpenseNet(invoice) > 0).length + directAccountAllocations.filter((allocation: any) => getStatementAllocationImmediateExpenseAmount(allocation) > 0).length,
|
||||
depreciationCount: depreciationRows.length
|
||||
|
||||
Reference in New Issue
Block a user