corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » PHP Function Needed (Will Pay)


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author PHP Function Needed (Will Pay)
Nismo
Member

Registered: 12th Sep 02
User status: Offline
16th Mar 12 at 12:08   View User's Profile U2U Member Reply With Quote

I am in the process of creating an Invoice Manager / Diary.

I need to be able to add an entry to a table and choose the reoccurring billing interval from a defined date, i.e 1 week, 1 month, quarterly, 6 monthly or annually.

this just populates all the dates, then i can add them to the db.

Then the user goes to a list each day and it lists the invoices to be sent out on that day.

Anyone fancy creating this function, simply name your price
Paul_J
Member

Registered: 6th Jun 02
Location: London
User status: Offline
16th Mar 12 at 15:24   View User's Profile U2U Member Reply With Quote

Does it have to be php?

Sounds pretty simple.
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
16th Mar 12 at 15:27   View Garage View User's Profile U2U Member Reply With Quote

So you have a current date, you want to add a time period and give you another date?

Loads of inbuilt functions to do that.
Dom
Member

Registered: 13th Sep 03
User status: Offline
16th Mar 12 at 15:49   View User's Profile U2U Member Reply With Quote

Messy and rough as hell, no doubt Ian & co could better it (especially for efficiency) -

code:

function GenDateList($initDate, $interval) {
$calculate_years = 5; // Number of years to generate

$return_array = array();
$loopDate = date("d-m-Y", $initDate);
$stopYear = intVal(Date("Y", $initDate)) + $calculate_years;
$loopYear = 0;
$arrayPointer = 0;
while ($loopYear <= $stopYear) {
$return_array[$arrayPointer] = $loopDate;
$loopDate = date("d-m-Y", strtotime($loopDate." ".$interval));
$loopYear = intVal(date("Y", strtotime($loopDate)));
$arrayPointer++;
}
return $return_array;
}

$rtrn_arr = GenDateList(strtotime("16-03-2012 00:00:00"), "+1 Months");
print_r($rtrn_arr);



[Edited on 16-03-2012 by Dom]

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
PHP and sendmail ed Geek Day 2 159
5th Jun 06 at 23:55
by Ian
 
any web designers here??? KITcorsa Geek Day 7 1601
12th Jul 06 at 19:16
by Dom
 
Anyone know PHP? Bit of help needed... liamC Geek Day 38 1430
24th Nov 06 at 23:02
by MarkPW
 
PHP Day - Class Functions Laney Geek Day 3 156
29th Jan 08 at 21:23
by Laney
 
Search option Terry12 General Chat 19 284
10th Dec 08 at 15:32
by Terry12
 

Corsa Sport » Message Board » Off Day » Geek Day » PHP Function Needed (Will Pay) 29 database queries in 0.0181611 seconds