Got something cool to share with AppGini users? Feel free to post it here!
-
dragon
- Veteran Member
- Posts: 44
- Joined: 2015-09-29 00:06
Post
by dragon » 2015-10-14 18:27
In my table I have a test_date and due_dates field.
I would like to do something like this:
Code: Select all
<%%endOfMonth%%> // this would be due the last day of every month
<%%in42days%%> // these items would be due in 42 days from the last test_date
<%%eom3%%> // this would be due at the end of every 3rd month // example: 3/31, 6/30, 9/30, 12/31
<%%eom6%%> // this would be due every 6 months // example: 6/30 and 12/31
Thank you guys and gals.
Appgini 5.50, Revision 835. Mac OSX 10.11 running Windows 10 on VMWare.
-
dragon
- Veteran Member
- Posts: 44
- Joined: 2015-09-29 00:06
Post
by dragon » 2015-10-14 19:52
I tried adding this in the incCommon.php file, but it isn't working.
Code: Select all
'<%%eom3%%>' => ($rawData ? @date('Y-m-d, INTERVAL 1 QUARTER') : @date('n/j/Y')),
Appgini 5.50, Revision 835. Mac OSX 10.11 running Windows 10 on VMWare.
-
dragon
- Veteran Member
- Posts: 44
- Joined: 2015-09-29 00:06
Post
by dragon » 2015-10-14 20:09
This is what I'm looking for. Been trying various sql statements in the incCommon.php file, no luck yet.
Code: Select all
<%%endofday1%%> // due 1 day from the last test date
<%%endofday7%%> // due 7 days from the last test date
<%%endOfMonth%%> // this would be due the last day of every month
<%%in42days%%> // these items would be due in 42 days from the last test_date
<%%eom3%%> // this would be due at the end of every 3rd month // example: 3/31, 6/30, 9/30, 12/31
<%%eom6%%> // this would be due every 6 months // example: 6/30 and 12/31
Appgini 5.50, Revision 835. Mac OSX 10.11 running Windows 10 on VMWare.
-
ahmed hamdy
- Posts: 3
- Joined: 2015-10-31 18:33
Post
by ahmed hamdy » 2015-11-10 19:05
i think you can use the before_insert hook then
adding the following code instead
Code: Select all
1- <%%endOfMonth%%>
date('t');
2- <%%in42days%%>
echo date('Y-m-d',strtotime($data['test_date'])+(42*60*60*24));
3- <%%eom3%%>
$t=date('Y-m-d',strtotime(date('Y',strtotime($data['test_date'])).'-1-1'));
$y=date('t',strtotime($t)+(25*3*60*60*24));
$n=date('n',strtotime($t)+(25*3*60*60*24));
$yy=date('Y',strtotime($t)+(25*3*60*60*24));
echo date('Y-m-d',strtotime($yy.'-'.$n.'-'.$y));
4- <%%eom6%%>
$t=date('Y-m-d',strtotime(date('Y',strtotime($data['test_date'])).'-1-1'));
$y=date('t',strtotime($t)+(25*6*60*60*24));
$n=date('n',strtotime($t)+(25*6*60*60*24));
$yy=date('Y',strtotime($t)+(25*6*60*60*24));
echo date('Y-m-d',strtotime($yy.'-'.$n.'-'.$y));