Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / process / one-off / set-orders-matched.p
blobd5b10b375522469e94925702cbb8b93bdee9f364
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. */
10 paid-to-date = 0.0 .
11 has-vouchers = No.
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:
16 has-vouchers = Yes.
17 paid-to-date = paid-to-date + Voucher.GoodsValue .
18 END.
19 END.
20 IF has-vouchers THEN DO:
21 Order.OverridePaid = paid-to-date .
22 END.
23 END.
24 END.