Copy Purchase orders

Oct 08, 2006 4 Replies

Does any one know how to copy a purchase order?



We do booking orders and have different ship dates. I would like to break up my PO and not have to enter items 2 - 3 times. Thanks


No-one answered this one yet. Shame, because I could do with knowing. We very often want to produce a PO for 8 branch, all identical.

Please help.

Run the following sql statement

***************************************************** /*You have to specify 2 things the PONumber of the order to be copied and the PONumber of the order to be created*/ begin transaction declare @OldPONo varchar(20) declare @NewPONo varchar(20) declare @OldPOID int declare @NewPOID int

set @OldPONo='' --SPECIFY PONUMBER set @NewPONo='' --SPECIFY PONUMBER

select @OldPOID=ID FROM PurchaseOrder WHERE PONumber=@OldPONo

INSERT INTO PurchaseOrder([POTitle], [POType], [StoreID], [WorksheetID], [PONumber], [Status], [DateCreated], [To], [ShipTo], [Requisitioner], [ShipVia], [FOBPoint], [Terms], [TaxRate], [Shipping], [Freight], [RequiredDate], [ConfirmingTo], [Remarks], [SupplierID], [OtherStoreID], [CurrencyID], [ExchangeRate], [OtherPOID], [InventoryLocation], [IsPlaced], [DatePlaced], [BatchNumber]) select [POTitle], [POType], [StoreID], [WorksheetID], @NewPONo as PONumber,

0 as [Status], getdate(), [To], [ShipTo], [Requisitioner], [ShipVia], [FOBPoint], [Terms], [TaxRate], [Shipping], [Freight], [RequiredDate], [ConfirmingTo], [Remarks], [SupplierID], [OtherStoreID], [CurrencyID], [ExchangeRate], [OtherPOID], [InventoryLocation], [IsPlaced], [DatePlaced], [BatchNumber] from PurchaseOrder where ponumber=@oldpono

if @@error0 begin rollback transaction return end

select @NewPOID=@@identity

INSERT INTO PurchaseOrderEntry ([ItemDescription], [LastUpdated], [QuantityReceivedToDate], [StoreID], [PurchaseOrderID], [QuantityOrdered], [QuantityReceived], [ItemID], [OrderNumber], [Price], [TaxRate], [InventoryOfflineID]) select [ItemDescription], getdate() as [LastUpdated], 0 as [QuantityReceivedToDate], [StoreID], @NewPOID as [PurchaseOrderID], [QuantityOrdered], 0 as [QuantityReceived], [ItemID], [OrderNumber], [Price], [TaxRate], [InventoryOfflineID] from PurchaseOrderEntry WHERE PurchaseOrderID=@OldPOID

commit transaction

****************************************************

Run the following sql statement

***************************************************** /*You have to specify 2 things the PONumber of the order to be copied and the PONumber of the order to be created*/ begin transaction declare @OldPONo varchar(20) declare @NewPONo varchar(20) declare @OldPOID int declare @NewPOID int

set @OldPONo='' --SPECIFY PONUMBER set @NewPONo='' --SPECIFY PONUMBER

select @OldPOID=ID FROM PurchaseOrder WHERE PONumber=@OldPONo

INSERT INTO PurchaseOrder([POTitle], [POType], [StoreID], [WorksheetID], [PONumber], [Status], [DateCreated], [To], [ShipTo], [Requisitioner], [ShipVia], [FOBPoint], [Terms], [TaxRate], [Shipping], [Freight], [RequiredDate], [ConfirmingTo], [Remarks], [SupplierID], [OtherStoreID], [CurrencyID], [ExchangeRate], [OtherPOID], [InventoryLocation], [IsPlaced], [DatePlaced], [BatchNumber]) select [POTitle], [POType], [StoreID], [WorksheetID], @NewPONo as PONumber,

0 as [Status], getdate(), [To], [ShipTo], [Requisitioner], [ShipVia], [FOBPoint], [Terms], [TaxRate], [Shipping], [Freight], [RequiredDate], [ConfirmingTo], [Remarks], [SupplierID], [OtherStoreID], [CurrencyID], [ExchangeRate], [OtherPOID], [InventoryLocation], [IsPlaced], [DatePlaced], [BatchNumber] from PurchaseOrder where ponumber=@oldpono

if @@error0 begin rollback transaction return end

select @NewPOID=@@identity

INSERT INTO PurchaseOrderEntry ([ItemDescription], [LastUpdated], [QuantityReceivedToDate], [StoreID], [PurchaseOrderID], [QuantityOrdered], [QuantityReceived], [ItemID], [OrderNumber], [Price], [TaxRate], [InventoryOfflineID]) select [ItemDescription], getdate() as [LastUpdated], 0 as [QuantityReceivedToDate], [StoreID], @NewPOID as [PurchaseOrderID], [QuantityOrdered], 0 as [QuantityReceived], [ItemID], [OrderNumber], [Price], [TaxRate], [InventoryOfflineID] from PurchaseOrderEntry WHERE PurchaseOrderID=@OldPOID

commit transaction

****************************************************

"chris alls> No-one answered this one yet. Shame, because I could do with knowing. We

No-one answered this one yet. Shame, because I could do with knowing. We very often want to produce a PO for 8 branch, all identical.

Please help.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required