Dim row As DataRow = dsempty.Tables("ets_empty_table").NewRow
row("รหัสสินค้า") = id
row("รุ่นสินค้า") = Model
....
row("ราคาต่อหน่วย") = FormatNumber(price, 0)
dsempty.Tables("ets_empty_table").Rows.Add(row)
Sub INSERT_DataOn_G()
Dim count_row As Integer = 0
Dim count As Integer = 0
Dim find As Boolean = False
If txt_amount.Text.Length = 0 Then
MsgBox("ยังไม่ได้ป้อนจำนวนสินค้า ", vbCritical, "เตือนการทำงาน")
txt_amount.Focus()
Exit Sub
End If
'If TextBox6.Text.Length <> 15 Then
' MsgBox("กรอก IME ไม่ถูกต้อง ", vbCritical, "เตือนการทำงาน")
' TextBox6.Focus()
' Exit Sub
'End If
If txt_ID_Pro.Text = "" Then
MsgBox("ยังไม่ได้เลือกสินค้า ", vbCritical, "เตือนการทำงาน")
Exit Sub
End If
If CDbl(txt_All.Text) < CDbl(txt_amount.Text) Then
MsgBox("สินค้ามีจำนวนไม่พอ ", vbCritical, "เตือนการทำงาน")
txt_amount.Focus()
Exit Sub
End If
If txt_sn.Text = "1" Then
M_ConnStr.c_Name_Pro_Key = txt_Name_pro.Text
M_ConnStr.c_Name_Number_Key = txt_amount.Text
frm_Sale_Serial_No_Key.ShowDialog()
If M_ConnStr.c_Name_CH_Key = "0" Then
Exit Sub
End If
Else
End If
If CH_ITEM(txt_ID_Pro.Text) = True Then
' MsgBox("รายการสินค้าซ้ำ ", vbCritical, "เตือนการทำงาน")
' Exit Sub
End If
If txt_sn.Text = "1" Then
For i = 0 To UBound(M_ConnStr.c_Serial_key)
If M_ConnStr.c_Serial_key(i) = "" Then
Exit For
End If
' MessageBox.Show(M_ConnStr.c_Serial_key(i))
count = DataGrid_Pro.Rows.Count
count_row = DataGrid_Pro.Rows.Count
DataGrid_Pro.Rows.Add()
DataGrid_Pro.Rows(count_row).Cells(0).Value = txt_ID_Pro.Text
DataGrid_Pro.Rows(count_row).Cells(1).Value = txt_Name_pro.Text
DataGrid_Pro.Rows(count_row).Cells(2).Value = TextBox4.Text
DataGrid_Pro.Rows(count_row).Cells(3).Value = TextBox7.Text
DataGrid_Pro.Rows(count_row).Cells(4).Value = TextBox5.Text
DataGrid_Pro.Rows(count_row).Cells(7).Value = "1"
DataGrid_Pro.Rows(count_row).Cells(6).Value = txt_prices.Text
DataGrid_Pro.Rows(count_row).Cells(8).Value = CDbl(1) * CDbl(txt_prices.Text)
DataGrid_Pro.Rows(count_row).Cells(10).Value = M_ConnStr.c_Serial_key(i)
DataGrid_Pro.Rows(count_row).Cells(10).Style.BackColor = Color.Green
DataGrid_Pro.Rows(count_row).Cells(11).Value = txt_Pro_Warrant.Text
DataGrid_Pro.Rows(count_row).Cells(12).Value = Date.Today.AddMonths(CInt(txt_Pro_Warrant.Text))
SUM_AMOUNT()
txt_All.Text = CDbl(txt_All.Text) - CDbl(1)
TextBox6.Text = ""
Next
Else
count = DataGrid_Pro.Rows.Count
count_row = DataGrid_Pro.Rows.Count
DataGrid_Pro.Rows.Add()
DataGrid_Pro.Rows(count_row).Cells(0).Value = txt_ID_Pro.Text
DataGrid_Pro.Rows(count_row).Cells(1).Value = txt_Name_pro.Text
DataGrid_Pro.Rows(count_row).Cells(2).Value = TextBox4.Text
DataGrid_Pro.Rows(count_row).Cells(3).Value = TextBox7.Text
DataGrid_Pro.Rows(count_row).Cells(4).Value = TextBox5.Text
DataGrid_Pro.Rows(count_row).Cells(7).Value = txt_amount.Text
DataGrid_Pro.Rows(count_row).Cells(6).Value = txt_prices.Text
DataGrid_Pro.Rows(count_row).Cells(8).Value = CDbl(txt_amount.Text) * CDbl(txt_prices.Text)
DataGrid_Pro.Rows(count_row).Cells(10).Value = ""
DataGrid_Pro.Rows(count_row).Cells(11).Value = ""
DataGrid_Pro.Rows(count_row).Cells(12).Value = Date.Today.AddMonths(CInt(0))
SUM_AMOUNT()
txt_All.Text = CDbl(txt_All.Text) - CDbl(txt_amount.Text)
TextBox6.Text = ""
'txt_amount.Text = ""
End If
End Sub