Jump to content

Please help duplicating rows from MSQL vi PHP.


brucegregory

Recommended Posts

I am developing a purchase ordering system for a factory. A new feature is to allow someone to duplicate a purchase order. I have divided the system into two parts: purchase order, and purchase order items. I have made it where someone can duplicate the purchase order, but I cannot figure out how to duplicate the items because their are usually more than 1 item per purchase order, but sometimes when they are duplicated he only wants some of the items. I am not expecting you to code this for me, I just need a general flow chart.

 

Please Help,

 

Thanks

Link to comment
Share on other sites

... I have made it where someone can duplicate the purchase order, but I cannot figure out how to duplicate the items ...

 

Without knowing what approach you took to duplicating the Header, it is difficult to suggest how you can duplicate the lines.

 

One approach is to use SQL to INSERT INTO ... SELECT ... FROM ... to copy the header and then the lines. Be sure to set whatever columns need to be adjusted for a "New" PO (i.e. OrderDate, OrderedBy, Qty Receied, etc.). Then ship the user off to the Edit PO Screen.

 

A different approach is to send the user to the New PO Screen and populate all of the fields from the original PO (with adjustments as we did above) just as if they were editing a PO; but when you save, its an INSERT instead of an UPDATE. One advantage of this process is you don't have PO's in the database if the user decides "nevermind, that's not what I wanted to do".

 

Which approach you take, will depend heavily on how your Create and Edit PO processes exist today and how much they may need to be modified to work with either approach. The first approach should require less changes to the existing system, but may produce more garbage in the database if the user changes their mind before they save.

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.