-- Paul Trebbien enscribed
> I always use
> OCONV and ICONV statement to control rounding and number of
> decimal places.
> Here's an example:
>       ITEM.DISCOUNT=OCONV(ITEM<41>,"MD2")
>       UNIT.PRICE=OCONV(ITEM<20>,"MD2")*(1-(ITEM.DISCOUNT/100))

Hmmmm, the above is not a very good example then because you _aren't_ using
OCONV for your rounding of the item discount :} It's my opinion that code
should try to clearly* represent the business rule. I think the above
expression would be more simply written as:

ITEM.DISCOUNT = ITEM<41>
BASE.PRICE = ITEM<20>
UNIT.PRICE = BASE.PRICE - OCONV(BASE.PRICE * ITEM.DISCOUNT,'MD02')

* Clarity is of course subjective, but given a business rule that says:
price = base - discount, the above formula more closely (and in my view,
simply) resembles the business rule.

Cheers,
Stuart








**********************************************************************
This email message and any files transmitted with it are confidential
and intended solely for the use of addressed recipient(s). If you have 
received this email in error please notify the Spotless IS Support Centre (61 3 9269 
7555) immediately who will advise further action.

This footnote also confirms that this email message has been scanned
for the presence of computer viruses.
**********************************************************************
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to