01.
Dim
product_id
As
String
02.
Dim
descript
As
String
03.
Dim
descripte
As
String
04.
Dim
t_type
As
String
05.
Dim
pro_unit
As
String
06.
Dim
pro_qty
As
Integer
07.
Dim
price_stock
As
Double
08.
Dim
price_amount
As
Double
09.
Dim
percent_dis
As
Double
10.
Dim
amount_dis
As
Double
11.
Dim
amt_after_dis
As
Double
12.
Dim
vat_amt
As
Double
13.
Dim
amt_total
As
Double
14.
Dim
record_id
As
Integer
15.
16.
Private
Sub
btnSave_Click(sender
As
Object
, e
As
EventArgs)
Handles
btnSave.Click
17.
For
i
As
Integer
= 0
To
MyDataGridView1.Rows.Count - 1
18.
product_id = MyDataGridView1.Rows(i).Cells(1).Value
19.
descript = MyDataGridView1.Rows(i).Cells(2).Value
20.
descripte = MyDataGridView1.Rows(i).Cells(3).Value
21.
t_type = MyDataGridView1.Rows(i).Cells(4).Value
22.
pro_unit = MyDataGridView1.Rows(i).Cells(5).Value
23.
pro_qty = MyDataGridView1.Rows(i).Cells(6).Value
24.
price_stock = MyDataGridView1.Rows(i).Cells(7).Value
25.
price_amount = MyDataGridView1.Rows(i).Cells(8).Value
26.
percent_dis = MyDataGridView1.Rows(i).Cells(9).Value
27.
amount_dis = MyDataGridView1.Rows(i).Cells(10).Value
28.
amt_after_dis = MyDataGridView1.Rows(i).Cells(11).Value
29.
vat_amt = MyDataGridView1.Rows(i).Cells(12).Value
30.
amt_total = MyDataGridView1.Rows(i).Cells(13).Value
31.
32.
sql =
"insert into dbo.Sacc_Trans_Item values(@dt,@certify_no,@pd_id,@trans_descrip,@trans_descripe,@type_nm,@unit,@qty,@stock_amt,@amt,@disc_percent,@disc,@amt_disc,@amt_vat,@amt_total)"
33.
cm =
New
SqlCommand(sql, Connt)
34.
cm.Parameters.AddWithValue(
"@dt"
, Format(
CDate
(dtpDate.Text),
"yyyy-MM-dd"
))
35.
cm.Parameters.AddWithValue(
"@certify_no"
, txtcertify_no.Text)
36.
cm.Parameters.AddWithValue(
"@pd_id"
, product_id)
37.
cm.Parameters.AddWithValue(
"@trans_descrip"
, descript)
38.
cm.Parameters.AddWithValue(
"@trans_descripe"
, descripte)
39.
cm.Parameters.AddWithValue(
"@type_nm"
, t_type)
40.
cm.Parameters.AddWithValue(
"@unit"
, pro_unit)
41.
cm.Parameters.AddWithValue(
"@qty"
, pro_qty)
42.
cm.Parameters.AddWithValue(
"@stock_amt"
, price_stock)
43.
cm.Parameters.AddWithValue(
"@amt"
, price_amount)
44.
cm.Parameters.AddWithValue(
"@disc_percent"
, percent_dis)
45.
cm.Parameters.AddWithValue(
"@disc"
, amount_dis)
46.
cm.Parameters.AddWithValue(
"@amt_disc"
, amt_after_dis)
47.
cm.Parameters.AddWithValue(
"@amt_vat"
, vat_amt)
48.
cm.Parameters.AddWithValue(
"@amt_total"
, amt_total)
49.
cm.ExecuteNonQuery()
50.
cm.Dispose()
51.
52.
Next
53.
MsgBox(
"save"
)
54.
End
Sub