1 DEF VAR paid-to-date
AS DEC NO-UNDO INITIAL 0.0 .
2 DEF VAR has-vouchers
AS LOGI
NO-UNDO INITIAL No.
3 DEF BUFFER ForOrder
FOR Order.
5 FOR EACH ForOrder
WHERE ForOrder.OrderDate
< (TODAY - 380) NO-LOCK:
6 IF ForOrder.OverridePaid
= ?
THEN DO TRANSACTION:
7 FIND Order
WHERE RECID(Order
) = RECID(ForOrder
) EXCLUSIVE-LOCK.
8 Order.OverridePaid
= Order.OrderAmount.
9 /* DISPLAY Order
EXCEPT Description.
*/
12 FOR EACH Voucher
WHERE Voucher.EntityType
= Order.EntityType
13 AND Voucher.EntityCode
= Order.EntityCode
14 AND Voucher.OrderCode
= Order.OrderCode
NO-LOCK:
15 IF Voucher.VoucherStatus
= "P" OR Voucher.VoucherStatus
= "A" THEN DO:
17 paid-to-date
= paid-to-date
+ Voucher.GoodsValue .
20 IF has-vouchers
THEN DO:
21 Order.OverridePaid
= paid-to-date .