function D(curpos) { n=5; disc=100; num=0; position=frontol.currentDocument.position; for ( position.index = 1; position.index <= position.count; position.index++ ) { if (position.sum>curpos.sum) num=num+1; if (position.sum==curpos.sum)&&(position.index>curpos.index) num=num+1; } num=position.count-num; maxnum=position.count/n; if (num>=maxnum) return disc; return 0; }
function D(curpos) { n=5; disc=100; num=0; quantity=0; position=frontol.currentDocument.position; for ( position.index = 1; position.index <= position.count; position.index++ ) { quantity=quantity+position.quantity; if (position.price>curpos.price) num=num+position.quantity; if (position.price==curpos.price)&&(position.index>curpos.index) num=num+position.quantity; } num=quantity-num; maxnum=quantity/n; if (num>=maxnum) return disc; for (index=1; index<curpos.quantity; index++) { num=num-1; if (num>=maxnum) return disc*index/curpos.quantity; } return 0; }
function D(curpos) { n=5; disc=100; num=0; quantity=0; position=frontol.currentDocument.position; for ( position.index = 1; position.index <= position.count; position.index++ ) { quantity=quantity+position.quantity; if (position.price>curpos.price) num=num+position.quantity; if (position.price==curpos.price)&&(position.index>curpos.index) num=num+position.quantity; } num=quantity-num; maxnum=quantity/n; if (num>=maxnum) return disc; for (index=1; index<curpos.quantity; index++) { num=num-1; if (num>=maxnum) return disc*index/curpos.quantity; } return 0; }