Jump to content

Mysql with multiple increments


arginafi

Recommended Posts

Hello,

 

i have a problem, and 3 id's, 1st- primary key, autoincrement, 2nd- autoincrement only when needed, 3rd- autoincrement only when needed.

for example if in a table inserted 6 rows,

ID ID_1 ID_2

1 1 0

2 2 0

3 0 1

4 3 2

5 0 3

6 4 4

 

0- 0 is when increment is no needed.

Link to comment
Share on other sites

Thank you all for help, i figured out.

I created 2 tables, one form_invoices, another form_proforma_invoices. each with a id AI , and id_invoice.

in invoice table a column, form, that is invoice or proforma. and if is invoice, add to form_invoice else add to form_proforma_invoice.

Link to comment
Share on other sites

erm...I'm not trying to be insulting, but if this is for an actual-use piece of software then you're not qualified to build this. There are leagal constaints to the numbering of invoices and quotations that must be strictly adheared to (as well as easily auditable and completly transparent) or else the goverment will - sooner or later - fine the life out of the company using it. You have not displayed in these posts the level of competence that would be required of somone to properly write a system as highly regulated and business critcal as this.

 

If it's a just-for-fun / educational project however, then I wish you the best of luck and the utmost success with it :)

Link to comment
Share on other sites

this is

erm...I'm not trying to be insulting, but if this is for an actual-use piece of software then you're not qualified to build this. There are leagal constaints to the numbering of invoices and quotations that must be strictly adheared to (as well as easily auditable and completly transparent) or else the goverment will - sooner or later - fine the life out of the company using it. You have not displayed in these posts the level of competence that would be required of somone to properly write a system as highly regulated and business critcal as this.

 

If it's a just-for-fun / educational project however, then I wish you the best of luck and the utmost success with it :)

it's ok, i know all legal terms, and i've completed what i needed.

Link to comment
Share on other sites

You don't need 2 tables, a pro forma and an invoice can be put in 1 table - called invoice - with a column called "pro_forma" of type boolean indicating if its pro forma or not.

ideea was that i need serials for each, serials that increments and invoices and proforma invoices to be each with consecutive numers. for example PLAF000001, PLAF000002, etc (1,2 are id from invoice/proforma invoice)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.