vault backup: 2023-11-16 11:33:14
This commit is contained in:
parent
8a9102dbca
commit
0219b2d5ce
@ -20,9 +20,14 @@ export function apply_guidance(doc: any) {
|
|||||||
let Source = '';
|
let Source = '';
|
||||||
let Snapped = Infinity;
|
let Snapped = Infinity;
|
||||||
|
|
||||||
|
//console.log(priceObject["targ"][0]);
|
||||||
// Iterate over each property in the object
|
// Iterate over each property in the object
|
||||||
for (let key in priceObject) {
|
for (let key in priceObject) {
|
||||||
if (priceObject.hasOwnProperty(key) && key !== "mark") {
|
// Ignore markPrice unless targPrice is null
|
||||||
|
if (key === "mark" && priceObject["targ"][0] !== null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (priceObject.hasOwnProperty(key)) {
|
||||||
let [cprice, creason, csource, csnap] = priceObject[key];
|
let [cprice, creason, csource, csnap] = priceObject[key];
|
||||||
// Check if the current price is lower than the found so far
|
// Check if the current price is lower than the found so far
|
||||||
if (cprice && cprice < Price) {
|
if (cprice && cprice < Price) {
|
||||||
@ -66,7 +71,7 @@ export function apply_guidance(doc: any) {
|
|||||||
const inflation = Math.max(...Object.keys(iidx).map(Number));
|
const inflation = Math.max(...Object.keys(iidx).map(Number));
|
||||||
const inflationFactor = iidx[inflation];
|
const inflationFactor = iidx[inflation];
|
||||||
const list = doc.pricing?.list && doc.product?.itemrel === "2" ? doc.pricing?.list : null;
|
const list = doc.pricing?.list && doc.product?.itemrel === "2" ? doc.pricing?.list : null;
|
||||||
const listUSD = list ? list / fxrate :null;
|
const listUSD = list ? list * fxrate :null;
|
||||||
|
|
||||||
// ------------------calculate price adders------------------------------------------------------
|
// ------------------calculate price adders------------------------------------------------------
|
||||||
let ltp = qty < pltq ? 0.15 : null;
|
let ltp = qty < pltq ? 0.15 : null;
|
||||||
@ -88,13 +93,13 @@ export function apply_guidance(doc: any) {
|
|||||||
let custSeason = earlyCustSeason;
|
let custSeason = earlyCustSeason;
|
||||||
let custReason = bridgePremium
|
let custReason = bridgePremium
|
||||||
? `${custSeason} (similar ${altHist} price ${pp(earlyCustPrice)} x ${bridgePremium} = ${pp(bridgedPrice)})${custAddReason}`
|
? `${custSeason} (similar ${altHist} price ${pp(earlyCustPrice)} x ${bridgePremium} = ${pp(bridgedPrice)})${custAddReason}`
|
||||||
: `${custSeason} price ${pp(custPrice)}${custAddReason}`;
|
: `${custSeason} price ${pp(bridgedPrice)}${custAddReason}`;
|
||||||
let markPrice = earlyMarkPrice * (1 + markAdder);
|
let markPrice = earlyMarkPrice * (1 + markAdder);
|
||||||
let markReason = `${earlyMarkSeason} ASP ${pp(earlyMarkPrice)}${markAddReason}`;
|
let markReason = `${earlyMarkSeason} ASP ${pp(earlyMarkPrice)}${markAddReason}`;
|
||||||
let targPrice = targetPrice * (1 + markAdder);
|
let targPrice = targetPrice ? targetPrice * (1 + markAdder) : null;
|
||||||
let targReason = `Target price ${pp(targetPrice)}${markAddReason}`;
|
let targReason = `Target price ${pp(targetPrice)}${markAddReason}`;
|
||||||
let listPrice = listUSD;
|
let listPrice = listUSD;
|
||||||
let listReason = "";
|
let listReason = fxrate === 1 ? "" : `list ${pp(list)} CAD ${pp(listUSD)} USD`
|
||||||
|
|
||||||
let prices = {
|
let prices = {
|
||||||
cust: [custPrice, custReason, "cust", ceiling(custPrice,snap)],
|
cust: [custPrice, custReason, "cust", ceiling(custPrice,snap)],
|
||||||
|
Loading…
Reference in New Issue
Block a user