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",