Chris,
Pretty straightforward then via a VB customization of order entry.
Enter customization mode and open order entry. If you're already customized, select the active customization. If not, just select the base app.
Once order entry is open, go to the Tools menu and click on customization.
Click on the Script Editor tab and drag the code pane open so you can see it.
After
"Module Script" add:
Private withEvents edvOrderDtl As EpiDataView
After
"Sub InitializeCustomCode()" add:
edvOrderDtl = CType(oTrans. EpiDataViews( "OrderDtl" ),
EpiDataView)
After
"Sub DestroyCustomCode()" add:
edvOrderDtl = Nothing
Now you can enter the Subroutine to auto default date to 12/12/2012 (or whatever you want):
'------
Private Sub OrderDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles OrderDtl_Column.ColumnChanged
'
Dim DefDate As Date = #12/12/2012#
Select Case args.Column.ColumnName
Case "PartNum"
if len(trim(edvOrderDtl.dataview(edvOrderDtl.Row)("PartNum"))) <> 0 Then
edvOrderDtl.dataview(edvOrderDtl.Row)("RequestDate") = DefDate
' Verify you want to change OrderDtl.RequestDate & not NeedByDate
' Different companies can use these two dates to mean different
' things in their process. (Perhaps you want to set them BOTH.)
end if
Case Else
End Select
End Sub
'------
Go to Tools and Test Code. Other than typos, this code should be error free. Correct any errors reported on specific lines.
Go to File, Save As and give it a unique customization name and description.
For safety, also export/save to xml for a back up.
Close customization editor and the application and reopen order entry (selecting your unique customization name).
Try entering an order and verify it is doing what you want. If not, go back into cusotmization mode, tweak as needed, retest code until clean and resave (and re-export to xml).
Close aditor & app, reopen order entry and test again - repeating process until it works as desired.
Go to Menu Maintenance and make the customization the active app on the menu.
Save room for all the free coffee & donuts you're going to get from you inside sales people the next day {;o
Seriously: WARN the users to report ANY weird beahvior to you IMMEDIATELY(stopping as soon as an error box pops up etc) so you can RUN over there (before they can no longer resit urge to push buttons)and then you can read the details of any erro messageboxes and see where I lead you astray and have to tweak code further.
You'll be OK. It doesn't get much simpler than this (and, fortunately, only rarely gets much more complex...
Only problems are poor documentation and an envirnment with no variable watch boxes - so it often takes much longer than needed to select the correct event trigger of your subroutine.
(In this case, we waited for a change in value of OrderDtl.PartNum, verified whether it was wiped out and now null, and if not null, set "RequestDate" (or perhaps "NeedByDate" in your process) to 12/12/2012 - a date you can change simply by changing the value used in the "Dim DefDate As Date = (your chosen default date in #MM/DD/YYYY# format).
Have a donut for me.
Rob
Pretty straightforward then via a VB customization of order entry.
Enter customization mode and open order entry. If you're already customized, select the active customization. If not, just select the base app.
Once order entry is open, go to the Tools menu and click on customization.
Click on the Script Editor tab and drag the code pane open so you can see it.
After
"Module Script" add:
Private withEvents edvOrderDtl As EpiDataView
After
"Sub InitializeCustomCode()" add:
edvOrderDtl = CType(oTrans. EpiDataViews( "OrderDtl" ),
EpiDataView)
After
"Sub DestroyCustomCode()" add:
edvOrderDtl = Nothing
Now you can enter the Subroutine to auto default date to 12/12/2012 (or whatever you want):
'------
Private Sub OrderDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles OrderDtl_Column.ColumnChanged
'
Dim DefDate As Date = #12/12/2012#
Select Case args.Column.ColumnName
Case "PartNum"
if len(trim(edvOrderDtl.dataview(edvOrderDtl.Row)("PartNum"))) <> 0 Then
edvOrderDtl.dataview(edvOrderDtl.Row)("RequestDate") = DefDate
' Verify you want to change OrderDtl.RequestDate & not NeedByDate
' Different companies can use these two dates to mean different
' things in their process. (Perhaps you want to set them BOTH.)
end if
Case Else
End Select
End Sub
'------
Go to Tools and Test Code. Other than typos, this code should be error free. Correct any errors reported on specific lines.
Go to File, Save As and give it a unique customization name and description.
For safety, also export/save to xml for a back up.
Close customization editor and the application and reopen order entry (selecting your unique customization name).
Try entering an order and verify it is doing what you want. If not, go back into cusotmization mode, tweak as needed, retest code until clean and resave (and re-export to xml).
Close aditor & app, reopen order entry and test again - repeating process until it works as desired.
Go to Menu Maintenance and make the customization the active app on the menu.
Save room for all the free coffee & donuts you're going to get from you inside sales people the next day {;o
Seriously: WARN the users to report ANY weird beahvior to you IMMEDIATELY(stopping as soon as an error box pops up etc) so you can RUN over there (before they can no longer resit urge to push buttons)and then you can read the details of any erro messageboxes and see where I lead you astray and have to tweak code further.
You'll be OK. It doesn't get much simpler than this (and, fortunately, only rarely gets much more complex...
Only problems are poor documentation and an envirnment with no variable watch boxes - so it often takes much longer than needed to select the correct event trigger of your subroutine.
(In this case, we waited for a change in value of OrderDtl.PartNum, verified whether it was wiped out and now null, and if not null, set "RequestDate" (or perhaps "NeedByDate" in your process) to 12/12/2012 - a date you can change simply by changing the value used in the "Dim DefDate As Date = (your chosen default date in #MM/DD/YYYY# format).
Have a donut for me.
Rob
--- On Tue, 12/2/08, Chris <chris.ryhal@...> wrote:
From: Chris <chris.ryhal@...>
Subject: [Vantage] Re: Static Date in SO Entry
To: vantage@yahoogroups.com
Date: Tuesday, December 2, 2008, 8:32 AM
Robert,
12/12/2012 will work as the default date. Confused a little bit on
the trigger your discussing though, but that date will work out just
fine.
Considered doing a BAM and creating a custom 4GL .p file but I don't
think its needed in this case.
Like I said, any help with just defaulting to the 12/12/2012 would
work great.
--- In vantage@yahoogroups .com, Robert Brown <robertb_versa@ ...>
wrote:
>
> Declare a module level variable:
>
> Private withEvents edvOrderDtl As EpiDataView
>
> In the InitializeCustomCod e() Sub, tell the app how to use it:
>
> edvOrderDtl = CType(oTrans. EpiDataViews( "OrderDtl" ),
EpiDataView)
>
> For good housekeeping, in the DestroyCustomCode( ) Sub, destroy the
variable:
>
> edvOrderDtl = Nothing
>
> I can't tell you what is a suitable event trigger to use to auto-
populate some default OrderDtl.RequestDat e. A pretty useful one for
order line detail creation is to use an After_Change EpiNotification
on OrderDtl.PartNum. .. However, YOU will have to determine what is
suitable for YOUR process.
>
> Once you have a reliable trigger subroutine, stick this inside it:
>
> edvOrderDtl. dataview( edvOrderDtl. Row)("RequestDat e") = (your
default date)
>
> You may need to follow that with an otrans.update( ) statement if
your code defaulted value doesn't 'stick'. (Returns to null after a
refresh.)
>
> WHAT that code defaulted RequestDate value is (and how to calc) is
up to you. On our legacy system, we did something akin to this and
always used a 12/12/2012 date (as it acted as a signal that the order
line was not yet reviewed and it also pushed these new unreviewed
requirements WAY out into the future to make it easier to plan each
order line - and in our case also associated make to order job).
>
> On Vantage, we were able to imbed VERY complex rules based upon
market desired lead times for each sold product line, customer data
(example: some of our customer/shipto combos are associated with
calendars and we consolidate & ship, at their direction, on specific
days each month...), avoid weekends & holidays, etc.,.
>
> I get why you wouldn't want it to be NOW. How about
(system.datetime. now + 14) - or some other increment of 7 days to get
it out of your active schedule window (whatever that is for you)?
>
> Rob
>
> --- On Mon, 12/1/08, Chris <chris.ryhal@ ...> wrote:
>
> From: Chris <chris.ryhal@ ...>
> Subject: [Vantage] Static Date in SO Entry
> To: vantage@yahoogroups .com
> Date: Monday, December 1, 2008, 7:50 PM
>
>
>
>
>
>
> how can I static the dteRequestDate or "Ship By" date to a certain
> value? I have to have a value, but I don't want it null. Just
trying
> to learn how to make everything a static value when creating a new
> entry, and it CANNOT be today or in .NET system.datetime. now
>