round after ceiling
This commit is contained in:
parent
eb0c969ec7
commit
885a2982ee
2
api.ts
2
api.ts
@ -60,7 +60,7 @@ router.get('/dseg_reason/:billcode/:shipcode/:stlc/:dseg/:qty', async (ctx) => {
|
||||
const { billcode, shipcode, stlc, dseg, qty } = ctx.params;
|
||||
const result = await client.queryObject({args: [billcode, shipcode, stlc, dseg, qty], text: query_dseg} );
|
||||
const ag = apply_guidance(result.rows[0]["doc"]);
|
||||
ctx.response.body = ag.guidance.finalPrice.Reason;
|
||||
ctx.response.body = ag.guidance.finalPrice.Snapped + ' (' + ag.guidance.finalPrice.Reason + ')';
|
||||
});
|
||||
|
||||
app.use(router.routes());
|
||||
|
@ -123,10 +123,10 @@ export function apply_guidance(doc: any) {
|
||||
let listReason = fxrate === 1 ? `list ${pp(list)}` : `list ${pp(list)} CAD ${pp(listUSD)} USD`;
|
||||
|
||||
let prices = {
|
||||
cust: [custPrice, custReason, "cust", ceiling(custPrice,snap)],
|
||||
mark: [markPrice, markReason, "mark", ceiling(markPrice,snap)],
|
||||
targ: [targPrice, targReason, "targ", ceiling(targPrice,snap)],
|
||||
list: [listPrice, listReason, "list", ceiling(listPrice,snap)]
|
||||
cust: [custPrice, custReason, "cust", r5(ceiling(custPrice,snap))],
|
||||
mark: [markPrice, markReason, "mark", r5(ceiling(markPrice,snap))],
|
||||
targ: [targPrice, targReason, "targ", r5(ceiling(targPrice,snap))],
|
||||
list: [listPrice, listReason, "list", r5(ceiling(listPrice,snap))]
|
||||
}
|
||||
|
||||
let finalPrice = lowestPrice(prices);
|
||||
|
@ -110,10 +110,10 @@ AS $function$
|
||||
let listReason = fxrate === 1 ? `list ${pp(list)}` : `list ${pp(list)} CAD ${pp(listUSD)} USD`;
|
||||
|
||||
let prices = {
|
||||
cust: [custPrice, custReason, "cust", ceiling(custPrice,snap)],
|
||||
mark: [markPrice, markReason, "mark", ceiling(markPrice,snap)],
|
||||
targ: [targPrice, targReason, "targ", ceiling(targPrice,snap)],
|
||||
list: [listPrice, listReason, "list", ceiling(listPrice,snap)]
|
||||
cust: [custPrice, custReason, "cust", r5(ceiling(custPrice,snap))],
|
||||
mark: [markPrice, markReason, "mark", r5(ceiling(markPrice,snap))],
|
||||
targ: [targPrice, targReason, "targ", r5(ceiling(targPrice,snap))],
|
||||
list: [listPrice, listReason, "list", r5(ceiling(listPrice,snap))]
|
||||
}
|
||||
|
||||
let finalPrice = lowestPrice(prices);
|
||||
|
Loading…
Reference in New Issue
Block a user