Include manual tax accounts in VAT evaluation
All checks were successful
Build and Push Docker Images / build-central-services-api (push) Successful in 35s
Build and Push Docker Images / build-central-services-admin (push) Successful in 35s
Build and Push Docker Images / build-backend (push) Successful in 57s
Build and Push Docker Images / build-frontend (push) Successful in 1m58s
Build and Push Docker Images / build-website (push) Successful in 36s
Build and Push Docker Images / build-docs (push) Successful in 34s
All checks were successful
Build and Push Docker Images / build-central-services-api (push) Successful in 35s
Build and Push Docker Images / build-central-services-admin (push) Successful in 35s
Build and Push Docker Images / build-backend (push) Successful in 57s
Build and Push Docker Images / build-frontend (push) Successful in 1m58s
Build and Push Docker Images / build-website (push) Successful in 36s
Build and Push Docker Images / build-docs (push) Successful in 34s
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
formatTaxEvaluationPeriodRange,
|
||||
getCreatedDocumentTaxBreakdown,
|
||||
getIncomingInvoiceTaxBreakdown,
|
||||
getManualBookingTaxBreakdown,
|
||||
getTaxEvaluationPeriodBounds,
|
||||
normalizeTaxEvaluationPeriod
|
||||
} from "~/composables/useTaxEvaluation"
|
||||
@@ -40,7 +41,10 @@ const loadSummary = async () => {
|
||||
const periodType = normalizeTaxEvaluationPeriod(auth.activeTenantData?.taxEvaluationPeriod)
|
||||
const bounds = getTaxEvaluationPeriodBounds(dayjs(), periodType)
|
||||
|
||||
const { createdDocuments: docs, incomingInvoices: incoming } = await loadCoreData()
|
||||
const [{ createdDocuments: docs, incomingInvoices: incoming }, manualBookings] = await Promise.all([
|
||||
loadCoreData(),
|
||||
useNuxtApp().$api("/api/banking/manual-bookings") as Promise<any[]>
|
||||
])
|
||||
|
||||
const outputDocs = (docs || []).filter((doc: any) => {
|
||||
if (doc?.state !== "Gebucht") return false
|
||||
@@ -67,12 +71,28 @@ const loadSummary = async () => {
|
||||
return sum + breakdown.tax19 + breakdown.tax7
|
||||
}, 0)
|
||||
|
||||
const manualTax = (manualBookings || [])
|
||||
.filter((booking: any) => {
|
||||
const date = dayjs(booking.manualBookingDate)
|
||||
return date.isValid() && !date.isBefore(bounds.start, "day") && !date.isAfter(bounds.end, "day")
|
||||
})
|
||||
.reduce((sum: { outputTax19: number; inputTax19: number }, booking: any) => {
|
||||
const breakdown = getManualBookingTaxBreakdown(booking)
|
||||
return {
|
||||
outputTax19: sum.outputTax19 + breakdown.outputTax19,
|
||||
inputTax19: sum.inputTax19 + breakdown.inputTax19,
|
||||
}
|
||||
}, { outputTax19: 0, inputTax19: 0 })
|
||||
|
||||
const totalOutputTax = outputTax + manualTax.outputTax19
|
||||
const totalInputTax = inputTax + manualTax.inputTax19
|
||||
|
||||
summary.value = {
|
||||
label: formatTaxEvaluationPeriodLabel(bounds.start, periodType),
|
||||
range: formatTaxEvaluationPeriodRange(bounds.start, periodType),
|
||||
outputTax: Number(outputTax.toFixed(2)),
|
||||
inputTax: Number(inputTax.toFixed(2)),
|
||||
balance: Number((outputTax - inputTax).toFixed(2)),
|
||||
outputTax: Number(totalOutputTax.toFixed(2)),
|
||||
inputTax: Number(totalInputTax.toFixed(2)),
|
||||
balance: Number((totalOutputTax - totalInputTax).toFixed(2)),
|
||||
outputCount: outputDocs.length,
|
||||
inputCount: inputDocs.length,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user