Jump to content

Help with monitoring year week and sales figures


marksie1988

Recommended Posts

Hi,

 

i am looking into creating an application in php mysql that we could put sales figures in for the week etc.

 

i am a bit confused though as to how i could go about working out the weeks e.g. there are 52 weeks in a year, i need the application to know what week it is (how would i achieve this?) and also say i went from 2009 to 2010 i would need it to go back to week 1.

 

the main issue that i have is that i do need to keep the history of sales etc so that we can do a YTD figure and a weekly figure.

 

all i need is some help or ideas or code snipets that would allow me to have 2009 week 1 to week 52 then move to 2010 week 1 to week 52 if you need more explanation please dont hesitate to ask.

 

 

any help is much appreciated

 

Regards

Steve

Mysql has a large number of date/time functions that you can use to query for the data you are interested in, for example you could GROUP BY using the WEEK() function to get weekly figures for a range of dates - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_week (see the page that link is part of for more useful date/time functions.)

ahh yes i never thought of doing it that way, so i could basically create an entry for each sale made and then each on having a date i would be able to use php to create charts and reports etc.

 

thankyou

 

Steve

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.