Sunday, 25 August 2013

Show next date based on criteria

Show next date based on criteria

In perl I have the following database query:
my $list = $db->SelectARef("SELECT p.*, u.usr_login, u.usr_money,
u.usr_email, u.usr_pay_email, u.usr_pay_type
FROM Payments p, Users u
WHERE status='PENDING'
AND p.usr_id=u.usr_id
ORDER BY u.usr_pay_type");
Within the array result there is a field named "created".
What I want to do is add another element to the array for each row as
"next payment".
Payments are processed after 30 full days from the datetime value but only
on the 6th day of every month. Basically I want each result to have a
"next payment" element stating which day and month they should get paid
on.
e.g created = 2013-07-29 18:55:37 30 days from this is the 28th August
2013 Therefore the next payment date would be the 6th September
I have no idea where to start with this, any help anyone can provide would
be greatly appreciated!
Thanks

No comments:

Post a Comment