Re: Creating an autonumber setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Richi Watts <richiwatts@hotmail.com> wrote:
> Hi,
> 
> Could someone explain to me how this could be done? I have seen
> something similar using Access on a local machine and would like to
> know if it is posible to do it in PHP and Mysql
> In a project management web based applicaton using PHP and Mysql I
> would need to allow the user to create
> 
> Quote
> Project
> Customer
> Supplier
> Invoice
> 
> Each time one of the above will be created it needs to be assigned
> an autonumber. So If 3 quotes were created today each quote would
> receive an autonumber, maybe something like the fllowing:
> yy/MM/dd-01
> yy/MM/dd-02
> yy/MM/dd-03
> 
> Creating the autonumber isn't the problem if I want to have a set
> way of numbering, however, is it possible for me to allow the user
> to enter a setup page or something and define the way the
> autonumbers will look like and be created for quotes, projects,
> customers, suppliers or invoice. 
> 
> let's say I have five Project Managers each working with a seperate
> version of the app. The app currently sets each new project created
> with a default autonumber (let's say yy/MM/dd-01, -02, 03 and so
> on), however, each Project Manager wants their database to number
> new projects differently:
> 
> PM1 = yy/MM/dd-a
> PM2 = dd/MM/yy-01
> PM3=  YY-2222 (Number being the amount of projects this year)
> PM4 = PROJ-2222 (Number being the amount of projects ever)
> PM5 = P-yyMMdd1
> 
> Instead of me creating a different application for each project
> manager can I allow them to setup their own number system in a set
> up page?
> 
> Many thanks for any ideas
> Richi
> 

I'd suggest not mixing display with data storage. That is, use
MySQL's autoincrement function to give each row in the table a unique
ID. Then have a prefix/suffix combo for each proect manager. So if
they want their numbering to be "Fred's project #234 for this year",
the prefix could be "Fred's project #" and the suffix would be " for
this year". You could have variables in there as well, and you can do
number-> text translation if necessary (a,b,c rather than 1,2,3). But
do the translation in the application (or your query), not within the
database.

That way if a project manager takes over another one's work, you
don't need to change the data, just the function that handles the
numbering schemes.


=====
Mark Weinstock
mark_weinstock@yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
***************************************

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux