3.0.0 #220

Merged
flfeders merged 676 commits from dev into main 2026-09-20 16:10:48 +00:00
Showing only changes of commit bb61caed6d - Show all commits

View File

@@ -16,6 +16,14 @@ const selectedMonth = ref("all")
const currency = (value) => `${Number(value || 0).toFixed(2).replace(".", ",")} EUR`
const getCostCentreId = (value) => {
if (!value) {
return null
}
return typeof value === "object" ? value.id : value
}
const costCentreMap = computed(() => {
return new Map(costcentres.value.map((costcentre) => [costcentre.id, costcentre]))
})
@@ -30,15 +38,17 @@ const relevantCostCentreIds = computed(() => {
const childrenByParent = new Map()
costcentres.value.forEach((costcentre) => {
if (!costcentre.parentCostcentre) {
const parentId = getCostCentreId(costcentre.parentCostcentre)
if (!parentId) {
return
}
if (!childrenByParent.has(costcentre.parentCostcentre)) {
childrenByParent.set(costcentre.parentCostcentre, [])
if (!childrenByParent.has(parentId)) {
childrenByParent.set(parentId, [])
}
childrenByParent.get(costcentre.parentCostcentre).push(costcentre.id)
childrenByParent.get(parentId).push(costcentre.id)
})
const collectedIds = new Set([rootId])
@@ -107,7 +117,7 @@ const reportRows = computed(() => {
const amountNet = Number(account.amountNet || 0)
const amountTax = Number(account.amountTax || 0)
const amountGross = Number(account.amountGross || amountNet + amountTax || 0)
const accountCostCentre = costCentreMap.value.get(account.costCentre)
const accountCostCentre = costCentreMap.value.get(getCostCentreId(account.costCentre))
return {
id: `${invoice.id}-${index}`,