I have two tables in a set.
PO_header.dbf and Orders.dbf. PO_header is the parent, Orders is the child, one to many linked on Vendor Name.
When the operator wants to order items, they get "appended" to the Orders.dbf and just sit there. This works fine and am not looking to change this.
Now: The PO_header table has an auto increment field called PO Number.
It also has a vendor name field.
I want a utility that will open the PO_header table, generate a new PO number with the auto increment feature, then go into the Orders table, find all the items with a field called "po_created" set to .f. and take each unique vendor name and post it to the PO_header, creating a new PO_header record for each unique vendor name with a PO_created = .f. Then, the PO_number created in PO_header should be added to the PO_NR field in the orders table and the PO_created field set to .t.
So, create a new PO_header record, take the resulting PO_NR, go into ORDERS, find records with no PO_NR and PO_Created set to false, add the PO_number while taking the vendor name from ORDERS and posting it to PO_Header. Then, find the next set of records in ORDERS with a different vendor name and do the same until there are no more records in ORDERS that match the criteria of no PO_NR and no po created.
If I can do that, I think I can take care of the dates, etc.
Perhaps I'm trying to do it backwards?? If I could create the PO_NR in ORDERS, it would be easy. But, I can't use an auto increment field in a table with mutiple records matching the same criteria.
I've asked for help with this before and only got confused with the generous offers. So, I'm asking again.
I used to use the julien date for a PO number with the vendor ID appended to it. I created the PO number in both the ORDERS table and the PO_Header table. That worked fine unless the operator tried to place a second PO with the same vendor on the same day. then, the PO numbers were identical.
PO_header.dbf and Orders.dbf. PO_header is the parent, Orders is the child, one to many linked on Vendor Name.
When the operator wants to order items, they get "appended" to the Orders.dbf and just sit there. This works fine and am not looking to change this.
Now: The PO_header table has an auto increment field called PO Number.
It also has a vendor name field.
I want a utility that will open the PO_header table, generate a new PO number with the auto increment feature, then go into the Orders table, find all the items with a field called "po_created" set to .f. and take each unique vendor name and post it to the PO_header, creating a new PO_header record for each unique vendor name with a PO_created = .f. Then, the PO_number created in PO_header should be added to the PO_NR field in the orders table and the PO_created field set to .t.
So, create a new PO_header record, take the resulting PO_NR, go into ORDERS, find records with no PO_NR and PO_Created set to false, add the PO_number while taking the vendor name from ORDERS and posting it to PO_Header. Then, find the next set of records in ORDERS with a different vendor name and do the same until there are no more records in ORDERS that match the criteria of no PO_NR and no po created.
If I can do that, I think I can take care of the dates, etc.
Perhaps I'm trying to do it backwards?? If I could create the PO_NR in ORDERS, it would be easy. But, I can't use an auto increment field in a table with mutiple records matching the same criteria.
I've asked for help with this before and only got confused with the generous offers. So, I'm asking again.
I used to use the julien date for a PO number with the vendor ID appended to it. I created the PO number in both the ORDERS table and the PO_Header table. That worked fine unless the operator tried to place a second PO with the same vendor on the same day. then, the PO numbers were identical.
Comment