From f93eb9ec713c1a48f35bcc8262f28b1d5a41892d Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sat, 31 May 2025 20:10:14 +0200 Subject: [PATCH] Added Markup Percentage for Products --- stores/data.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/stores/data.js b/stores/data.js index 41c7753..cb9ee8f 100644 --- a/stores/data.js +++ b/stores/data.js @@ -903,14 +903,36 @@ export const useDataStore = defineStore('data', () => { label: "Einkaufspreis", component: purchasePrice, inputType: "number", - inputTrailing: "EUR" + inputTrailing: "EUR", + inputChangeFunction: function (row) { + if(row.markupPercentage) { + row.sellingPrice = row.purchasePrice * (1+row.markupPercentage/100); + } else { + row.sellingPrice = row.purchasePrice; + } + } + },{ + key: "markupPercentage", + label: "Aufschlag", + inputType: "number", + inputTrailing: "%", + inputChangeFunction: function (row) { + if(row.sellingPrice) { + row.sellingPrice = row.purchasePrice * (1+row.markupPercentage/100); + } + } },{ key: "sellingPrice", label: "Verkaufpreispreis", required: true, component: sellingPrice, inputType: "number", - inputTrailing: "EUR" + inputTrailing: "EUR", + inputChangeFunction: function (row) { + if(row.markupPercentage) { + row.purchasePrice = (row.sellingPrice / (1+row.markupPercentage/100)).toFixed(4); + } + } },{ key: "taxPercentage", label: "Umsatzsteuer",