u
This commit is contained in:
@@ -249,7 +249,11 @@ export async function recordStockAdjustmentHistory(runner, { articleId, companyu
|
|||||||
|
|
||||||
/** Records price changes in article history. */
|
/** Records price changes in article history. */
|
||||||
export async function recordPriceChangeHistory(runner, { articleId, companyuserId, date, oldPrices, newPrices }) {
|
export async function recordPriceChangeHistory(runner, { articleId, companyuserId, date, oldPrices, newPrices }) {
|
||||||
const fmtPrice = (p) => `${p.net ?? p.price}@${p.taxRate ?? p.tax ?? 0}%`;
|
const fmtPrice = (p) => {
|
||||||
|
const net = p.net ?? p.price;
|
||||||
|
const tax = p.taxRate ?? p.tax ?? 0;
|
||||||
|
return `${formatCurrencyDe(calculateGross(net, 0, tax))}@${tax}%`;
|
||||||
|
};
|
||||||
const oldStr = (oldPrices || []).map(fmtPrice).join(', ');
|
const oldStr = (oldPrices || []).map(fmtPrice).join(', ');
|
||||||
const newStr = (newPrices || []).map(fmtPrice).join(', ');
|
const newStr = (newPrices || []).map(fmtPrice).join(', ');
|
||||||
if (oldStr === newStr) return;
|
if (oldStr === newStr) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user