> hi all
> Acctuly i have using Ms sql server 2000 n Vb.net.
> ma problem is dat i have a customer invoice. When i save the records
> it goes in to CustomerInvoiceMaster table and CustomerInvoiceDetail
> Table. In the form CustomerInvoiceDetail data is entring in a
> listview(and these r products). When the user Save its invoice the
> data saved in CustomerInvoiceDetail and it deduct the product
> Quantity from Stock Table. it going fine no problem till here. When
> the user enter the customerInvoiceNo which he already saved all the
> form populated itself. No Heres the problem begins. User Can change
> the populated data in the list mean the product can be deleted, qty
> may be changed or so on. Now how i can make a store procedure or
> write the code in the .net that add back the already qty in the
> stock table which i deduct When user saved. and add the orignal qty.
Well this gets into the meat of programming and what rules you want to
1) Make a Business Class for inventory and put all inventory code there.
2) Add method to that class ChangeInInventory( invID, ChangeType, Quantity)
3) Your grid action for CRUD to the Detail table now has to reference this
4) For an edit or deletion, you need to know what the starting Quantity
was and add that back in your ChangeType param.
This same class can be used in your inventory PO receiver process :)