shellybabber
3rd March 2011, 08:08
Hi,
I am not able to write code for calculating no of days.I need to print difference(days) between tdsls401.dldt and tdsls401.ddta excluding non working days.
I am consdering Display Actual Calendar session(tcccp0530m000) based on calendar code & availability type.
I know how loop will work but not able to write the code.To my undersatnding,loop will continue until Delivery date(tdsls401.dldt) becomes equal to Planned deliver date(tdsls401.ddta) and on every cycle delivery date will be reduced by one and if new date lies between the start date(tcccp030.stdt) & end date(tcccp030.endt) according to the availability type of calendar,counter for counting no of days will be increased by one.
Can anyone help me to generate correct code for this?
My Code:-
function cal_days()
{
for tdsls401.dldt=tdsls401.ddat
select tcccp030.* from tcccp030
where tcccp030.ccal=100 |Calender Code
and tcccp030.ract=001 | Availability type as normal working days excluding Sat & sun
and tcccp030.stdt>=:dt between tcccp030.endt<=:dt
selectdo
no_of_days=no_of_days+1
selectempty
endselect
dt=tdsls401.dldt-1
end for
}
Thanks
Shelly
I am not able to write code for calculating no of days.I need to print difference(days) between tdsls401.dldt and tdsls401.ddta excluding non working days.
I am consdering Display Actual Calendar session(tcccp0530m000) based on calendar code & availability type.
I know how loop will work but not able to write the code.To my undersatnding,loop will continue until Delivery date(tdsls401.dldt) becomes equal to Planned deliver date(tdsls401.ddta) and on every cycle delivery date will be reduced by one and if new date lies between the start date(tcccp030.stdt) & end date(tcccp030.endt) according to the availability type of calendar,counter for counting no of days will be increased by one.
Can anyone help me to generate correct code for this?
My Code:-
function cal_days()
{
for tdsls401.dldt=tdsls401.ddat
select tcccp030.* from tcccp030
where tcccp030.ccal=100 |Calender Code
and tcccp030.ract=001 | Availability type as normal working days excluding Sat & sun
and tcccp030.stdt>=:dt between tcccp030.endt<=:dt
selectdo
no_of_days=no_of_days+1
selectempty
endselect
dt=tdsls401.dldt-1
end for
}
Thanks
Shelly