vault backup: 2023-11-10 11:25:21

This commit is contained in:
Paul Trowbridge 2023-11-10 11:25:21 -05:00
parent fcc1ade2cf
commit 12b963b22f
3 changed files with 11 additions and 4 deletions

View File

@ -135,8 +135,8 @@ export function apply_guidance(doc: any) {
anchorSource = doc.hist.cust.early_season + ' Similar (' + doc.hist.cust.ds + ') Customer Price ' + earlyPrice + ' x ' + doc.bridgePremium + ' = ' + anchorPrice;
}
} else {
anchorPrice = doc.targetPrice;
anchorSource = 'Target Price';
anchorPrice = targetPrice;
anchorSource = `Target Price ${targetPrice}`;
}
const inflation = Math.max(...Object.keys(doc.iidx).map(Number));
@ -151,9 +151,12 @@ export function apply_guidance(doc: any) {
doc.finalPrice = calcPrice;
finalReason = `${anchorSource} x ${inflationFactor} = ${calcPrice}`;
}
doc.anchorPrice = anchorPrice;
doc.anchorSource = anchorSource;
doc.inflationFactor = inflationFactor;
doc.finalReason = finalReason;
doc.bridgePremium = bridgePremium;
doc.targetPrice = targetPrice;
return doc;
}

View File

@ -13,6 +13,7 @@ DECLARE
_mold text;
_stlc text;
_cust text;
_curr text;
_v1ds text;
_v0ds text;
_v1tp jsonb;
@ -58,7 +59,8 @@ BEGIN
----------------customer------------------------------------
SELECT dba INTO _cust FROM rlarp.cust WHERE code = CASE WHEN _chan = 'DRP' THEN _ship ELSE _bill END ;
_rslt = _rslt||jsonb_build_object('cust',_cust);
SELECT currency INTO _curr FROM rlarp.cust WHERE code = _bill;
_rslt = _rslt||jsonb_build_object('cust',_cust,'curr',_curr);
--RAISE NOTICE 'cust %', _cust;
----------------price history-------------------------------

View File

@ -14,6 +14,7 @@ DECLARE
_mold text;
_item text;
_cust text;
_curr text;
_v1ds text;
_v0ds text;
_v1tp jsonb;
@ -74,7 +75,8 @@ BEGIN
----------------customer------------------------------------
SELECT dba INTO _cust FROM rlarp.cust WHERE code = CASE WHEN _chan = 'DRP' THEN _ship ELSE _bill END ;
_rslt = _rslt||jsonb_build_object('cust',_cust);
SELECT currency INTO _curr FROM rlarp.cust WHERE code = _bill;
_rslt = _rslt||jsonb_build_object('cust',_cust,'curr',_curr);
RAISE NOTICE 'cust %', _cust;
----------------price history-------------------------------