Hi All,
I have the below code that is somewhat confusing to me - being new to the 4GL world. I'd like to get and explanation and also ideas of how to bucket this up from monthly to weekly. I rem'd some of the monthly code out and substituted weekly. I tried to cut it down to make it more manageable, so I may have left something out. Using Progress 9.1E. Any suggestions would be greatly appreciated.
I have the below code that is somewhat confusing to me - being new to the 4GL world. I'd like to get and explanation and also ideas of how to bucket this up from monthly to weekly. I rem'd some of the monthly code out and substituted weekly. I tried to cut it down to make it more manageable, so I may have left something out. Using Progress 9.1E. Any suggestions would be greatly appreciated.
Code:
def var v-this-month as int no-undo.
def var v-this-date as date no-undo.
def var net_req as dec no-undo.
def temp-table result-temp no-undo
field result-out as dec format "->>,>>>,>>9" extent 12.
if v-begin-date eq ? or day(v-begin-date) ne 1 then do:
/*v-begin-date = date(month(v-begin-date),1,year(v-begin-date)).*/
v-begin-date = today - weekday(today).
display v-begin-date with frame a.
end.
v-end-date = v-begin-date + 65.
for each schd_det no-lock
where schd_type eq sch_type
and schd_nbr eq sch_nbr
and schd_line eq sch_line
and schd_rlse_id eq sch_rlse_id
and schd_date ge v-begin-date
and schd_date le v-end-date:
assign
net_req = cum_net_req - prior_cum_net_req
end.
v-this-month = month(schd_date).
[COLOR=darkred][B] v-this-month = (13 - month(v-begin-date)) + v-this-month. <-- What does this do?
[/B][/COLOR] [COLOR=darkred]if v-this-month gt 12 then v-this-month = v-this-month - 12.[/COLOR]
[COLOR=darkred][B]result-out[v-this-month] = result-out[v-this-month] + net_req. <--Calcuates net_reg by month now. Need weekly.
[/B][/COLOR] end.