fix: exclude hidden orphan lines from totals [order-total-fix]
This commit is contained in:
parent
e232a6d419
commit
657273a6ca
@ -7149,8 +7149,8 @@ body.sun-splitting *{cursor:col-resize!important}
|
|||||||
pane?.classList.add('sun-order-pane');
|
pane?.classList.add('sun-order-pane');
|
||||||
|
|
||||||
// Correct calculations: custom per-order item price is preferred over catalog price.
|
// Correct calculations: custom per-order item price is preferred over catalog price.
|
||||||
calcOrderTotal=function(){return (draft.lines||[]).reduce((sum,line)=>sum+unitPrice(line)*Math.max(0,Number(line.qty||0)),0)};
|
calcOrderTotal=function(){return (draft.lines||[]).reduce((sum,line)=>itemById(line.id)?sum+unitPrice(line)*Math.max(0,Number(line.qty||0)):sum,0)};
|
||||||
orderTotalValue=function(order){return (order?.lines||[]).reduce((sum,line)=>sum+unitPrice(line)*Math.max(0,Number(line.qty||0)),0)};
|
orderTotalValue=function(order){return (order?.lines||[]).reduce((sum,line)=>itemById(line.id)?sum+unitPrice(line)*Math.max(0,Number(line.qty||0)):sum,0)};
|
||||||
updateOrderSummary=function(){
|
updateOrderSummary=function(){
|
||||||
const total=calcOrderTotal(),paid=Math.max(0,Number(prepayment.value||0)),rest=Math.max(0,total-paid);
|
const total=calcOrderTotal(),paid=Math.max(0,Number(prepayment.value||0)),rest=Math.max(0,total-paid);
|
||||||
orderTotal.value=Math.round(total);balance.value=Math.round(rest);
|
orderTotal.value=Math.round(total);balance.value=Math.round(rest);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user