So Far this is the working code. ttorderrel.number10 is the custid from the a previous BPM.
For Each ttOrderRel Where (ttOrderRel.rowmod ="a" or ttOrderRel.rowmod ="u").
If available ttOrderRel Then Do:
Find First ShipTo Where
ShipTo.Company = ttOrderRel.Company and
INT(ShipTo.Custnum) = ttOrderRel.Number10 and
Shipto.ShipToNum = ttOrderRel.ShipToNum.
If available shipto Then Do:
if ttOrderRel.Plant = "mfgsys" then ttorderrel.ReqDate = ttOrderRel.NeedByDate - shipto.number01.
if ttOrderRel.Plant = "05" then ttorderrel.ReqDate = ttOrderRel.NeedByDate - shipto.number02.
if ttOrderRel.Plant = "06" then ttorderrel.ReqDate = ttOrderRel.NeedByDate - shipto.number03.
if Weekday(ttorderrel.ReqDate) = 1 then assign ttOrderRel.ReqDate = ttorderrel.ReqDate + 1.
if Weekday(ttorderrel.ReqDate) = 7 then assign ttOrderRel.ReqDate = ttorderrel.ReqDate - 1.
End.
End.
End.
For Each ttOrderRel Where (ttOrderRel.rowmod ="a" or ttOrderRel.rowmod ="u").
If available ttOrderRel Then Do:
Find First ShipTo Where
ShipTo.Company = ttOrderRel.Company and
INT(ShipTo.Custnum) = ttOrderRel.Number10 and
Shipto.ShipToNum = ttOrderRel.ShipToNum.
If available shipto Then Do:
if ttOrderRel.Plant = "mfgsys" then ttorderrel.ReqDate = ttOrderRel.NeedByDate - shipto.number01.
if ttOrderRel.Plant = "05" then ttorderrel.ReqDate = ttOrderRel.NeedByDate - shipto.number02.
if ttOrderRel.Plant = "06" then ttorderrel.ReqDate = ttOrderRel.NeedByDate - shipto.number03.
if Weekday(ttorderrel.ReqDate) = 1 then assign ttOrderRel.ReqDate = ttorderrel.ReqDate + 1.
if Weekday(ttorderrel.ReqDate) = 7 then assign ttOrderRel.ReqDate = ttorderrel.ReqDate - 1.
End.
End.
End.
--- In vantage@yahoogroups.com, "scottinct78" <spare@...> wrote:
>
> I found something like this yesterday while trying to speed read the progress manuals. But could not figure out the sytax. Fortuantly this did work with minimal adjustments. Thank you very much fot this. I am getting much closer to figuring out this BPM. Hopefully I can post the finished product later today.
>
>
>
> --- In vantage@yahoogroups.com, "Nathan" <bonner.n@> wrote:
> >
> > Entry(Weekday(OrderRel.NeedByDate),2,2,3,4,5,6,6) or
> > Entry(Weekday(OrderRel.NeedByDate),Monday,Monday,Tuesday,Wednesday,Thursday,Friday,Friday)
> >
> >
> > --- In vantage@yahoogroups.com, "scottinct78" <spare@> wrote:
> > >
> > > I have a working BPM that subtracts shiping days from the OrderRel.ReqDate and stores the answer in the OrderRel.NeedByDate. This helps SalesOrder data entry to not have to look up ship to lead times for any of our 3 plants (MFYSYS, 05, 06) with all of the multipule shiptos. So on the ShipTo.Detail I used Number10, Number09, Number08 to hold the shipto time in days. After the SO Release is (add/update) it changes it recals the date.
> > >
> > > The only issue I have is, how do I round or adjust to weekdays? If the OrderRel.NeedByDate = Sunday it should round/change to Monday. ElseIf = Saturday, round to Friday.
> > >
> > > or
> > >
> > > If DayOfWeek(OrderRel.NeedByDate) = "Sunday" then +1
> > > If OrderRel.NeedByDate = Saturday then -1
> > >
> > > I just can't figure out how to code this. Any help would be greatly appriciated.
> > >
> > >
> > >
> > >
> > > This is the code that updates the NeedByDate and ReqDate (bassed on a UDF in the shipto table and the specific plant).
> > >
> > > For Each ttOrderRel Where (ttOrderRel.rowmod ="a" or ttOrderRel.rowmod ="u").
> > > If available ttOrderRel Then Do:
> > > Find First ShipTo Where
> > > ShipTo.Company = ttOrderRel.Company and
> > > INT(ShipTo.Custnum) = ttOrderRel.Number10 and
> > > Shipto.ShipToNum = ttOrderRel.ShipToNum.
> > > If available shipto Then Do:
> > > if ttOrderRel.Plant = "mfgsys" then ttorderrel.ReqDate = ttOrderRel.NeedByDate - shipto.number01.
> > > if ttOrderRel.Plant = "05" then ttorderrel.ReqDate = ttOrderRel.NeedByDate - shipto.number02.
> > > if ttOrderRel.Plant = "06" then {lib\publishinfomsg.i &infomsg = "'The Ship By Date should be '"ttOrderRel.NeedByDate - shipto.number03}.
> > >
> >
>