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 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(() => { const costCentreMap = computed(() => {
return new Map(costcentres.value.map((costcentre) => [costcentre.id, costcentre])) return new Map(costcentres.value.map((costcentre) => [costcentre.id, costcentre]))
}) })
@@ -30,15 +38,17 @@ const relevantCostCentreIds = computed(() => {
const childrenByParent = new Map() const childrenByParent = new Map()
costcentres.value.forEach((costcentre) => { costcentres.value.forEach((costcentre) => {
if (!costcentre.parentCostcentre) { const parentId = getCostCentreId(costcentre.parentCostcentre)
if (!parentId) {
return return
} }
if (!childrenByParent.has(costcentre.parentCostcentre)) { if (!childrenByParent.has(parentId)) {
childrenByParent.set(costcentre.parentCostcentre, []) childrenByParent.set(parentId, [])
} }
childrenByParent.get(costcentre.parentCostcentre).push(costcentre.id) childrenByParent.get(parentId).push(costcentre.id)
}) })
const collectedIds = new Set([rootId]) const collectedIds = new Set([rootId])
@@ -107,7 +117,7 @@ const reportRows = computed(() => {
const amountNet = Number(account.amountNet || 0) const amountNet = Number(account.amountNet || 0)
const amountTax = Number(account.amountTax || 0) const amountTax = Number(account.amountTax || 0)
const amountGross = Number(account.amountGross || amountNet + 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 { return {
id: `${invoice.id}-${index}`, id: `${invoice.id}-${index}`,