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