hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : PHP Question.
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

PHP Question.

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 06-01-2003, 07:32 PM
NickDev NickDev is offline
WHT Addict
 
Join Date: Sep 2002
Location: US
Posts: 133

PHP Question.


I am making some billing software and im stuck on this..

when the user orders i need to put the date they order then in 30 days or 365 days i need to be able to tell they need to pay again any ideas.? thanks

Reply With Quote


Sponsored Links
  #2  
Old 06-01-2003, 10:14 PM
mpope mpope is offline
Web Hosting Master
 
Join Date: May 2001
Posts: 697
seems like more of a logic question than a php question.

What I would do is set each account to have a renew date, and then run a script that checks renew dates every day or month or whatever time interval you want. You can set the script up in cron so you won't have to run it manually!

Reply With Quote
  #3  
Old 06-02-2003, 12:52 AM
worldhive worldhive is offline
Junior Guru Wannabe
 
Join Date: May 2003
Location: Ohio
Posts: 63
I too am working on billing software and have had the worst time doing exactly what you describe. I ended up using builtin SQL functions for time-shifting, but I played around with just adding 30 days (in seconds) to the unix timestamp. The problem is, I wanted to use calendar months, not 30 day months.

I've since put the project on hold until I can justify it with more customers. Now I'm just tracking with paper invoices and reports from 2CO.

--Paul

__________________
-------------------------------
Paul Henrich
http://www.worldhive.net
Email/SMS Blogging. Robust Business Hosting.

Reply With Quote
Sponsored Links
  #4  
Old 06-02-2003, 09:52 AM
nainil nainil is offline
Disabled
 
Join Date: Jun 2002
Posts: 119
paste the code in here. We will try to figure out the solution
How do u expect us to know what code you have written?

Reply With Quote
  #5  
Old 06-02-2003, 10:32 AM
worldhive worldhive is offline
Junior Guru Wannabe
 
Join Date: May 2003
Location: Ohio
Posts: 63
Here it is... sometimes it works, sometimes it doesn't

PHP Code:
if ($invoice['cycle']== 'monthly'){ 
            
$end_timestampmktime(0,0,0,$time_parts[2]+01,$time_parts[3],$time_parts[1]);
            
$period 1;


This is time_parts:

PHP Code:
$begin_period $invoice['paidthru'];
        
$time_parts   explode("-",$begin_period); 
I test for each billing cycle and add the appropriate time.

Any ideas? My system is rather slick and other than the issue of not tracking time well (which admittedly is a big issue)... right now however, you can correct its guesses about when to bill next via a textbox. I'd like to remove this bug to actually make it functional

__________________
-------------------------------
Paul Henrich
http://www.worldhive.net
Email/SMS Blogging. Robust Business Hosting.


Last edited by worldhive; 06-02-2003 at 11:32 AM.
Reply With Quote
  #6  
Old 06-03-2003, 03:05 AM
pphillips pphillips is online now
Web Hosting Master
 
Join Date: May 2003
Location: California, USA, Earth
Posts: 932
I designed our AC4 software that manages billing, instant activation of services, trouble ticket system, etc.

The billing system works basically like this. As a note, this may not be the best way of doing this, but it has worked perfectly since October when we released the software.

When the customer signs up, a "start date" and "term" is logged in the database. Every day cron runs a PHP script that calculates the number of days left until everyones term renews. If the term renews in say 30 days, then it's time to create an invoice. Vague, I know, but those are the basics and it works well for us. Of course, this method requires that cron doesn't "stop working" for a day or invoices may be forgotten about unless you implement some failsafes and double checks.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
The Value of Your Intellectual Property Blog 2013-05-06 17:43:13
Joomla Hosting Study Shows Speed, Uptime Top Selling Points of a Web Host Web Hosting News 2012-11-07 15:06:36
10-14-2012 Roswell, NM - The Hosting Shift Blog 2012-10-24 15:14:40
Rackspace Blog Looks at Easy Outsourcing for App Development Blog 2012-03-05 19:07:48
Blackberry the UnCloud Blog 2011-10-14 15:28:54


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?