In Acumatica I want to compute a "Quote Expires" date on the Sales Order Entry form based on the date a new order of type "QT" is created. This date would be computed by adding a default "Default Quote Expiry Days" as set up in the Sales Order Preferences. For example if the default expiry days = 45 (setup) and the order is created on April 1, 2015 then the default date for "Quote Expires" on the Sales Order Entry form would be May 16, 2015 (April 1, 2015 plus 45 days). The expiry date may be overridden by the user.
Any examples would be appreciated.
protected virtual void SOOrder_UsrExpiredDate_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
{
SOOrder row = e.Row as SOOrder;
if (row.OrderDate.HasValue)
{
e.NewValue = row.OrderDate.Value.AddDays(45);
}
}
For example I added custom field to SOOrder called UsrExpiredDate, feel free to replace number 45 with any kind of setup.
Related
I have a Google Sheet with data like this:
Date
In
Out
July 13
£40
July 21
£60
etc.
I'd like to add another column "month" which specifies what month the entry was made in. Only problem is I can't use the standard MONTH() function because for accounting purposes, the tax month is 16th - 15th. So July 13 would be considered to be in the June/July tax month, while July 21 would be considered to be in the July/August tax month.
I'm assuming I will need to maintain a table of the specific cut off dates like so:
Month
Start
End
Jun/July
16th June
15th July
etc.
But I can't work out how to use this as a lookup table to achieve what I want. Any thoughts appreciated.
I think this should work if your date is in A1:
=IF(DAY(A1)>15,TEXT(A1,"MMMM")&"/"&TEXT(A1+20,"MMMM"),TEXT(A1-20,"MMMM")&"/"&TEXT(A1,"MMMM"))
If sort order is important (e.g. in a subsequent pivot table) I would use this:
=IF(DAY(A1)>15,TEXT(A1,"MM MMMM")&"/"&TEXT(A1+20,"MMMM"),TEXT(A1-20,"MM MMMM")&"/"&TEXT(A1,"MMMM"))
Another way to specify the sort order is maintaining a separate table with sort order column. It's a completely different approach.
use:
=ARRAYFORMULA(IF(A2:A="",,IF(DAY(A2:A)<16,
TEXT("1/"&MONTH(A2:A)-1, "mmmm")&"/"&TEXT("1/"&MONTH(A2:A), "mmmm"),
TEXT("1/"&MONTH(A2:A), "mmmm")&"/"&TEXT("1/"&MONTH(A2:A)+1, "mmmm"))))
Informix-SE 4.10 with isql 4.10 DD6:
I have a DATE column, BirthDate, linked to a perform field tag "dob". When users enter the dob, I am doing the following date arithmetic:
age = (TODAY - dob ) / 365.25
field tag age is DISPLAYONLY TYPE DECIMAL field, with FORMAT="##.##".
This method is not producing accurate results.
Business Rule: Example, If a person true age is not 18 years old the day before their 18th birthday, I need to display 17 in the age field tag, and abort insertion of the customer row. Person must be >=18 years old.
DATETIME and INTERVAL datatypes are supported in this ifx version, but users are only comfortable entering dates in MMDDYYYY format.
In order to determine if the birthday has happened this year, you must be sure not to generate a non-valid date in the case where dob is February 29 and TODAY is in a non leap-year. Since 2000 is a leap-year, you can avoid the problem making the subtraction always for the year 2000.
MDY(MONTH(dob), DAY(dob), 2000) > MDY(MONTH(TODAY), DAY(TODAY), 2000)
Finally, subtract one from the year difference if so:
age = (YEAR(TODAY) - YEAR(dob) -
CASE WHEN MDY(MONTH(dob), DAY(dob), 2000) > MDY(MONTH(TODAY), DAY(TODAY), 2000)
THEN 1 ELSE 0 END)::int
I am trying to build a timetable setup to work in conjunction with one of my Models. Before I state my question, I will give some context into the problem.
I have a Model called Appointments with the following columns:
Name(String)
Start_time(time)
End_time(time)
Appt_Date(date)
Now I can have multiple appointments in 1 day.
For Example, let's say I have the following 2 Appointment objects:
Appointment 1:
Name: Makeup Appointment
Start_time: 11:00 am
End_time: 1:00 pm
Date: March 30, 2016
Appointment 2:
Name: Daily Meetup
Start-time: 2:00 pm
End_time: 3:00 pm
Date: March 30, 2016
I would like to implement a date-picker form where you can select a date and it would render 24 rows(1 for each hour of the day) and fill in the rows with the times not available based on the appointments on that day.
For example, if I select March 30, 2016 from the date-picker, I would like to render the 24 rows and have the rows for 11am-1pm and 2:00pm-3:00pm shaded out.
The setup is like google calendars(how time slots are colored in) but with a day-to-day basis. I don't need to be able to edit these rows. I just need to view them and have them rendered with colored cells based on Appointment objects for that specific day.
My issue is, I don't know where to begin to be able to design these 24 rows that interact with appointment objects. I was thinking that perhaps I build a helper method, however even that I am pretty lost. I would appreciate some guidance on how to approach this.
Below will help you:
1.Create a file in initializer which contains list of available time slots like 10 am to 10 pm.
2.For displaying date time field , use some jquery date time picker plugin.
3.Fire an ajax when clicked on datetime picker.
4.Ajax request will come on the controller & where you have to create an active record query which will fetch all apointments according to the particular date.
5.MAke an array variable & store the time which are already booked in the above appointments.
6.Compare the available time with the booked time & edit datetimepikcer.js to shaded the booked date.
I understand how to access an object's modification date using the Last Modified On attribute. Is there any hidden / undocumented way to access the modification time with DOORS 9.5? In my case, I want to identify changes since a certain daytime, thus the date is not precise enough.
According to this post at the IBM forum, the attribute was supposed to return date and time. However, the output of this statement:
Date lastModified = obj."Last Modified On"
print "dateAndTime = " (dateAndTime(lastModified)) "\tlastModified = " lastModified "\tdateOnly = " dateOnly(lastModified) "\n"
is in my case
dateAndTime = 08/04/14 00:00:00 lastModified = 04 August 2014 dateOnly = 04 August 2014
and I guess that this means that the change time was not provided (correctly).
Section "History" of the DXL manual describes the function Date lastModifiedTime({Module|Object|Link}) which provides the desired time.
Unfortunately the Last Modified On attribute is only storing the date without a time. In order to get the time of the last modification, you would need to step through the history records on the object and get the time from the last record. This will also be an issue because any object that hasn't changed since the baseline will have no history records against it.
Im trying to add constraints to a user submitted text field, which is there Date of Birth. I need the user to be at least 18 but cant be over 113 years old.
final static Date MIN_DATE = new Date(Calendar.YEAR-18)
final static Date MAX_DATE = new Date(Calendar.YEAR-100)
static constraints = {
dob(nullabe: false, min: MIN_DATE, max: MAX_DATE
}
When I,
System.out.println('Year Max Date: ' + person.MAX_DATE)
it gives me,
Year Max Date: Wed Dec 31 17:59:59 CST 1969
and so does the min date.
I tried doing
final static Date MIN_DATE = new Date().getAt(Calendar.YEAR)-18
but that didn't work at all. I also tried doing it without the -18 and got the correct answer but it was 7 hours off. When I tried to relaunch the app from local it crashed it. And I cant recreate it ever since.
I have come to the understanding that the date its giving is the "Epoch" date or the date right before Unix was launched. Im just not sure how to get around it.
Any ideas/suggestions/concerns/experience with this problem?
Any Help would be greatly appreciated.
I don't agree with these constraints, firstly as they seem arbitrary (why should someone not be older than 100? And why can't I just lie if I am 16?)
And secondly, if the webserver is up for a couple of years, these static dates will slowly drift
But anyway (these concerns aside), I believe what you want is:
final static Date MIN_DATE = Calendar.instance.with { add( YEAR, -18 ) ; it }.time
final static Date MAX_DATE = Calendar.instance.with { add( YEAR, -100 ) ; it }.time
The issue is that Date constructor expects an argument representing milliseconds since January 1, 1970, 00:00:00 GMT. Since Calendar.YEAR is a constant that is used to represent the year field from a Calendar structure and equal to 1 you are getting the above values.
You need to convert the user submitted text field (a String) to a Date object with SimpleDateFormat. Then create a Calendar with the Date object and check the Year field.
Alternatively you can just parse the text field (String) yourself and pick the year, convert to int and do the check.