I think that's a risky strategy. If you start to create an invoice or if a save fails, you could use up an auto-incremented id - so the invoice number might not match the id. That might not be important, of course. I suggest doing it after save; check to see if the invoice number field is empty - if it is, create it and save again. The afterSave will fire again but this time the invoice number will be there. Or (probably a better solution) just use the actual id of the row but use a helper to format it.
Jeremy Burns Class Outfit http://www.classoutfit.com On 3 Aug 2012, at 07:02:15, "Mr. Manager" <lyda...@gmail.com> wrote: > Dear All, > > Current I want to generate invoice number like INV00001 and so I would like > to get the last value of filed no (stand for invoice number) in order to > generator one increment when we create a new invoice. > > I am looking forward to hearing from you as soon as possible. > > Best Regard, > Mr. Manager, > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php