I have a application for the device that allows the user to sale and print invoices for a store.
The application prints the invoice and then updates the inventory table.
The code that I am having a problem with is below in step 2.
Step 1. text = "Update Sohead set soprt= "&numbprt&",sohpost = 'Y' where ROWID = "&sohrec
cmd.CommandText = text
cmd.ExecuteNonQuery
reader.Close
Step 2. text = "update Inventory set UnitsSold = UnitsSold+ (select sobody.soshipqty from sobody where sobody.sobnum = '"&sonumb&"'and sobody.soprod = inventory.ProductCode and sobpost = 'N')"
cmd.CommandText = text
cmd.ExecuteNonQuery
reader.Close
Step 3. Text = "update Sobody set sobpost = 'Y' where sobnum ="&sonumb&" and sobpost = 'N'"
cmd.CommandText = text
cmd.ExecuteNonQuery
reader.Close
Step 1 is to set the number of times the user printed the invoice.
Step 2 is to set the inventory quantity sold.
Step 3 is to set the sales order body indicator as posted to inventory
The sobody.soshipqty is quantity sold to a customer.
The update inventory part works great if the user prints the invoice one time. However if the user prints the invoice a second time, the UnitsSold field is set to zero.
Does anyone have any ideals on what is wrong with this code and any suggested fixes.
Thanks:sign0085:
The application prints the invoice and then updates the inventory table.
The code that I am having a problem with is below in step 2.
Step 1. text = "Update Sohead set soprt= "&numbprt&",sohpost = 'Y' where ROWID = "&sohrec
cmd.CommandText = text
cmd.ExecuteNonQuery
reader.Close
Step 2. text = "update Inventory set UnitsSold = UnitsSold+ (select sobody.soshipqty from sobody where sobody.sobnum = '"&sonumb&"'and sobody.soprod = inventory.ProductCode and sobpost = 'N')"
cmd.CommandText = text
cmd.ExecuteNonQuery
reader.Close
Step 3. Text = "update Sobody set sobpost = 'Y' where sobnum ="&sonumb&" and sobpost = 'N'"
cmd.CommandText = text
cmd.ExecuteNonQuery
reader.Close
Step 1 is to set the number of times the user printed the invoice.
Step 2 is to set the inventory quantity sold.
Step 3 is to set the sales order body indicator as posted to inventory
The sobody.soshipqty is quantity sold to a customer.
The update inventory part works great if the user prints the invoice one time. However if the user prints the invoice a second time, the UnitsSold field is set to zero.
Does anyone have any ideals on what is wrong with this code and any suggested fixes.
Thanks:sign0085: