diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue
index c031e21..725db60 100644
--- a/pages/createDocument/edit/[[id]].vue
+++ b/pages/createDocument/edit/[[id]].vue
@@ -696,6 +696,74 @@ const documentTotal = computed(() => {
}
})
+const documentReport = computed(() => {
+
+ let totalProductsPurchasePrice = 0
+ let totalProductsFromServicesPurchasePrice = 0
+ let totalHoursFromServices = {
+ total: 0,
+ totalPurchasePrice: 0,
+ byName: {}
+ }
+ let totalHoursSellingPrice = 0
+
+
+ itemInfo.value.rows.forEach(row => {
+ if(row.product) {
+ let product = products.value.find(i => i.id === row.product)
+ console.log(product)
+
+ totalProductsPurchasePrice += product.purchasePrice * row.quantity
+
+ } else if(row.service) {
+ let service = services.value.find(i => i.id === row.service)
+ console.log(service)
+
+ if(service.materialComposition) {
+ service.materialComposition.forEach(entry => {
+ let productData = products.value.find(i => i.id === entry.product)
+ console.log(productData)
+
+ totalProductsFromServicesPurchasePrice += productData.purchasePrice * entry.quantity * row.quantity
+ })
+ }
+
+ if(service.personalComposition) {
+ service.personalComposition.forEach(entry => {
+ totalHoursFromServices.total += entry.quantity
+
+ totalHoursFromServices.totalPurchasePrice += entry.quantity * entry.purchasePrice
+ totalHoursSellingPrice += entry.quantity * entry.price
+
+ if(totalHoursFromServices.byName[entry.name]) {
+ totalHoursFromServices.byName[entry.name] += entry.quantity
+ } else {
+ totalHoursFromServices.byName[entry.name] = entry.quantity
+ }
+
+
+
+ })
+ }
+
+ //totalProductsPurchasePrice += product.purchasePrice * row.quantity
+
+ }
+ })
+
+ let totalMargin = documentTotal.value.totalNet - totalProductsPurchasePrice - totalProductsFromServicesPurchasePrice - totalHoursFromServices.totalPurchasePrice
+
+
+ return {
+ totalProductsPurchasePrice,
+ totalProductsFromServicesPurchasePrice,
+ totalMargin,
+ totalHoursFromServices,
+ totalHoursSellingPrice,
+ }
+
+})
+
const processDieselPosition = () => {
let agricultureData = {
dieselUsageTotal: 0,
@@ -2499,11 +2567,41 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
- Gesamt
+ Auswertung & Gesamt
-
-
+
+
+
+ | Einkaufspreis Artikel Gesamt: |
+ {{useCurrency(documentReport.totalProductsPurchasePrice)}} |
+
+
+ | Einkaufspreis Artikel aus Leistungen Gesamt: |
+ {{useCurrency(documentReport.totalProductsFromServicesPurchasePrice)}} |
+
+
+ | Einkaufspreis Personal aus Leistungen Gesamt: |
+ {{useCurrency(documentReport.totalHoursFromServices.totalPurchasePrice)}} |
+
+
+ | Gewinn Gesamt: |
+ {{useCurrency(documentReport.totalMargin)}} |
+
+
+ | Lohnkosten Verkauf: |
+ {{useCurrency(documentReport.totalHoursSellingPrice)}} |
+
+
+ | {{key}} |
+ {{documentReport.totalHoursFromServices.byName[key]}} h |
+
+
+ | Stunden Gesamt: |
+ {{documentReport.totalHoursFromServices.total}} h |
+
+
+
| Netto: |
{{renderCurrency(documentTotal.totalNet)}} |
@@ -2527,6 +2625,45 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
+
+
+
+