Epicor 9.04 Need By Date Event Code

Here is some example 9.05 code to do the same type of date check, from
the PO entry screen. This code goes in a rule with a custom condition
(the code below) with an action of changing the order date to warning
status - bright yellow on the screen. For us, that's enough to prevent
the typos. You'll need to modify this code to change the table
(POHeader -> OrderHed) and remove the approval status bit.



Brian.



private static bool
POHeaderOrderDateOLD_CustomRuleCondition(object Arg1, object Arg2)

{

EpiDataView edvPOHeader =
(EpiDataView)oTrans.EpiDataViews["POHeader"];

string approvalstatus =
Convert.ToString(edvPOHeader.dataView[edvPOHeader.Row]["ApprovalStatus"]
);

DateTime orderdate =
Convert.ToDateTime(edvPOHeader.dataView[edvPOHeader.Row]["OrderDate"]);

// warn if PO is unapproved and date is more
than one month in the past

// (so no warning is a historical approved PO
from last month is opened)

if (approvalstatus == "U" && orderdate <
System.DateTime.Today.AddMonths(-1))

return true;

// warn if PO date is more than one year in the
future (approved or not)

if (orderdate >=
System.DateTime.Today.AddYears(1))

return true;

// date in a reasonable range

return false;

}



________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Krista
Sent: Wednesday, March 07, 2012 5:00 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Epicor 9.04 Need By Date Event Code





I would like create a form event for the Need By Date field in Order
Entry to warn our users that they are entering a date that is outside
the current calendar year. I've found an example of the code to use if
you want to display a warning for orders that exceeds one year, but we
seem to have users that put on orders using dates as far back as 2001
and as far into the future as 2015. I need to be able to handle the
extremes going both directions. I don't write code at all, but would
really appreciate it if someone could help me out. Thanks.





[Non-text portions of this message have been removed]
I would like create a form event for the Need By Date field in Order Entry to warn our users that they are entering a date that is outside the current calendar year. I've found an example of the code to use if you want to display a warning for orders that exceeds one year, but we seem to have users that put on orders using dates as far back as 2001 and as far into the future as 2015. I need to be able to handle the extremes going both directions. I don't write code at all, but would really appreciate it if someone could help me out. Thanks.