I'm unsure what exactly you want to do, but this should get you what I think you need.
numbervar i:= 14; //number of days to add onto enddate in case of early contract finish
datevar startdate:= {rsp.StartDate};
datevar enddate:= {rsp.EndDate};
numbervar monthdiff:= datediff("m",startdate,dateadd("d",i,enddate));
numbervar rate:=
if monthdiff >= 24 then Rate5?? else
if monthdiff >= 18 then Rate4?? else
if monthdiff >= 12 then Rate3?? else
if monthdiff >= 6 then Rate2?? else
Rate1??;
numbervar weekdays:= Datediff("d", startdate, enddate) -
Datediff("ww", startdate, enddate, crSaturday)-
Datediff("ww", startdate, enddate, crSunday);
rate*weekdays //I'm not sure what exactly you want to do here.
I'm not sure where your rate information is coming from but I'm sure you will. Also, you may want to change the >= to just > in rate variable.
Regards,
Ryan.
Edited by rkrowland - 14 Jun 2012 at 5:40am