brucegregory Posted August 7, 2012 Share Posted August 7, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/266771-please-help-duplicating-rows-from-msql-vi-php/ Share on other sites More sharing options...
mikosiko Posted August 7, 2012 Share Posted August 7, 2012 I don't see the problem... "he" is going to decide which items "he" want, either before the duplication or after... I will duplicate everything and allow the user to eliminate/add/modify items after the duplication Quote Link to comment https://forums.phpfreaks.com/topic/266771-please-help-duplicating-rows-from-msql-vi-php/#findComment-1367514 Share on other sites More sharing options...
DavidAM Posted August 7, 2012 Share Posted August 7, 2012 ... 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. Quote Link to comment https://forums.phpfreaks.com/topic/266771-please-help-duplicating-rows-from-msql-vi-php/#findComment-1367551 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.