Corrected Markup Calc in Products

This commit is contained in:
2025-06-03 16:35:10 +02:00
parent ef8e0d0e83
commit dd89a70789

View File

@@ -471,10 +471,16 @@ export const useDataStore = defineStore('data', () => {
key: "salutation", key: "salutation",
label: "Anrede", label: "Anrede",
inputType: "text", inputType: "text",
inputChangeFunction: function (row) {
row.fullName = `${row.firstName} ${row.lastName}`
}
},{ },{
key: "title", key: "title",
label: "Titel", label: "Titel",
inputType: "text", inputType: "text",
inputChangeFunction: function (row) {
row.fullName = `${row.firstName} ${row.lastName}`
}
},{ },{
key: "firstName", key: "firstName",
label: "Vorname", label: "Vorname",
@@ -505,6 +511,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "customers", selectDataType: "customers",
selectOptionAttribute: "name", selectOptionAttribute: "name",
selectSearchAttributes: ['name'], selectSearchAttributes: ['name'],
secondInfo: true,
secondInfoKey: "name"
}, },
{ {
key: "vendor", key: "vendor",
@@ -514,6 +522,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "vendors", selectDataType: "vendors",
selectOptionAttribute: "name", selectOptionAttribute: "name",
selectSearchAttributes: ['name'], selectSearchAttributes: ['name'],
secondInfo: true,
secondInfoKey: "name"
}, },
{ {
key: "role", key: "role",
@@ -906,9 +916,9 @@ export const useDataStore = defineStore('data', () => {
inputTrailing: "EUR", inputTrailing: "EUR",
inputChangeFunction: function (row) { inputChangeFunction: function (row) {
if(row.markupPercentage) { if(row.markupPercentage) {
row.sellingPrice = row.purchasePrice * (1+row.markupPercentage/100); row.sellingPrice = (row.purchasePrice * (1+row.markupPercentage/100)).toFixed(4)
} else { } else {
row.sellingPrice = row.purchasePrice; row.sellingPrice = row.purchasePrice.toFixed(4)
} }
} }
},{ },{
@@ -917,8 +927,12 @@ export const useDataStore = defineStore('data', () => {
inputType: "number", inputType: "number",
inputTrailing: "%", inputTrailing: "%",
inputChangeFunction: function (row) { inputChangeFunction: function (row) {
if(row.sellingPrice) { if(row.purchasePrice && ! row.sellingPrice) {
row.sellingPrice = row.purchasePrice * (1+row.markupPercentage/100); row.sellingPrice = (row.purchasePrice * (1+row.markupPercentage/100)).toFixed(4)
} else if(row.sellingPrice && !row.purchasePrice) {
row.purchasePrice = (row.sellingPrice / (1+row.markupPercentage/100)).toFixed(4)
} else {
row.sellingPrice = (row.purchasePrice * (1+row.markupPercentage/100)).toFixed(4)
} }
} }
},{ },{
@@ -929,8 +943,10 @@ export const useDataStore = defineStore('data', () => {
inputType: "number", inputType: "number",
inputTrailing: "EUR", inputTrailing: "EUR",
inputChangeFunction: function (row) { inputChangeFunction: function (row) {
if(row.markupPercentage) { if(row.purchasePrice ) {
row.purchasePrice = (row.sellingPrice / (1+row.markupPercentage/100)).toFixed(4); row.markupPercentage = ((row.sellingPrice / row.purchasePrice - 1) * 100 ).toFixed(2)
} else{
row.purchasePrice = (row.sellingPrice / (1+row.markupPercentage/100)).toFixed(4)
} }
} }
},{ },{