I am using progress procedure editor 8.38...and here is the code for the procedure
def var RcsId as char init "$Header: ar/ar03-r.p,v 1.27 1998/03/10 16:47:27 phigro V50 $".
def var tc-amt-age-bal as dec format "->,>>>,>>9.99" extent 5.
def var tc-amt-tran like artran.amount.
def var tc-amt-tranb like artran.amount.
def buffer x-artran for symix.artran.
{lib/rpt-def.i &new-shared="new shared" &name="TWAR01-R"}
{lib/permit.i """Accounts Receivable"""}
{menu/can-run.i}
find symix.arparms 0 no-lock.
assign
record-desc =
'@customer'
menu-id = "AR-RPT-MENU".
{lib/rpt-opt.i
&new-shared="new shared"
&opt3=symex.ex-beg.cust-num &type3=ch &at3="colon 40"
&opt4=symex.ex-end.cust-num &type4=ch &at4="colon 40"
&dest29="colon 40"
&opt30=symex.ex-optac.age-days-1 &type30=in &at30="colon 40 label 'Days Outstanding'"
}
PROCEDURE do-PROCESS:
DEFINE INPUT PARAMETER p-text AS CHARACTER NO-UNDO.
{lib/curr-def.i}
find first symglbl.glblparms no-lock.
DO ON ERROR UNDO, RETURN:
RUN validate-destination.
END.
{lib/rpt-open.i}
display
symtext.sys-text.txt[1] + symtext.sys-text.txt[3] format "x(196)"
symtext.sys-text.txt[2] + symtext.sys-text.txt[4] format "x(196)"
with PAGE-TOP width 210 no-labels no-box stream-io frame f-label132.
for each symix.customer no-lock where symix.customer.cust-seq = 0 and
{lib/rangcond.i &file=symix.customer &field=cust-num &type=ch &low=""~~001""},
each symcust.custaddr of symix.customer no-lock /* where custaddr.posted-bal <> 0 */:
assign
tc-amt-age-bal = 0
tc-amt-tranb = 0.
for each artran no-lock use-index si-active where artran.active and
artran.cust-num = customer.cust-num:
tc-amt-tran = 0.
if index("PC",artran.type) <> 0 then
tc-amt-tran = - (artran.amount + artran.freight +
artran.misc-charges + artran.sales-tax).
else
tc-amt-tran = (artran.amount + artran.freight +
artran.misc-charges + artran.sales-tax).
tc-amt-tranb = tc-amt-tranb + tc-amt-tran.
find x-artran where x-artran.cust-num = artran.cust-num
and x-artran.inv-num = artran.inv-num
and x-artran.type = "I"
no-lock no-error.
if not available x-artran then
find first x-artran where recid(x-artran) = recid(artran) no-lock no-error.
/* if not available x-artran then next. */
if (today - x-artran.inv-date) <= 30 then
tc-amt-age-bal[1] = tc-amt-age-bal[1] + tc-amt-tran.
else if (today - x-artran.inv-date) <= 60 then
tc-amt-age-bal[2] = tc-amt-age-bal[2] + tc-amt-tran.
else if (today - x-artran.inv-date) <= 90 then
tc-amt-age-bal[3] = tc-amt-age-bal[3] + tc-amt-tran.
else if (today - x-artran.inv-date) <= 120 then
tc-amt-age-bal[4] = tc-amt-age-bal[4] + tc-amt-tran.
else
tc-amt-age-bal[5] = tc-amt-age-bal[5] + tc-amt-tran.
end.
/* Phillip Smith BTA 07/31/2000 Removed for non zero balances <= 1 */
if ABS(tc-amt-age-bal[1]) +
ABS(tc-amt-age-bal[2]) +
ABS(tc-amt-age-bal[3]) +
ABS(tc-amt-age-bal[4]) +
ABS(tc-amt-age-bal[5]) = 0 then next.
/*
if (tc-amt-age-bal[1] > 1 and (INPUT symex.ex-optac.age-days-1 <= 30)) or
(tc-amt-age-bal[2] > 1 and (INPUT symex.ex-optac.age-days-1 <= 60)) or
(tc-amt-age-bal[3] > 1 and (INPUT symex.ex-optac.age-days-1 <= 90)) or
(tc-amt-age-bal[4] > 1 and (INPUT symex.ex-optac.age-days-1 <= 120)) or
(tc-amt-age-bal[5] > 1 and (INPUT symex.ex-optac.age-days-1 <= 9999)) then do:
if (tc-amt-age-bal[1] <> 0 and (INPUT symex.ex-optac.age-days-1 <= 30)) or
(tc-amt-age-bal[2] <> 0 and (INPUT symex.ex-optac.age-days-1 <= 60)) or
(tc-amt-age-bal[3] <> 0 and (INPUT symex.ex-optac.age-days-1 <= 90)) or
(tc-amt-age-bal[4] <> 0 and (INPUT symex.ex-optac.age-days-1 <= 120)) or
(tc-amt-age-bal[5] <> 0 and (INPUT symex.ex-optac.age-days-1 <= 9999)) then do:
*/
{lib/counter.i}
find terms of symix.customer.
display
symcust.custaddr.cust-num
symcust.custaddr.name
symix.customer.slsman
(tc-amt-age-bal[1] + tc-amt-age-bal[2] + tc-amt-age-bal[3] +
tc-amt-age-bal[4] + tc-amt-age-bal[5])
format "->>>,>>>,>>9.99"
tc-amt-age-bal
symcust.custaddr.credit-limit
(symcust.custaddr.credit-limit - tc-amt-tranb)
format "->>>,>>>,>>9.99"
symcust.custaddr.credit-hold
symcust.custaddr.credit-hold-reason
terms.description
with no-box no-labels width 210 frame f-custage stream-io.
/*
end.
*/
end.
{lib/rpt-cloz.i}
end.