08-09-21, 05:03 PM
السلام عليكم
اخواني الاعزاء :
هذا كود لإذراج المنتج عن طريق الباركود إلى قاعدة البيانات ، فهل يمكن تحويله الى تقنية الديف إكسربرس ، فإنني حاولت كثيرا ولم أستطع .
اخواني الاعزاء :
هذا كود لإذراج المنتج عن طريق الباركود إلى قاعدة البيانات ، فهل يمكن تحويله الى تقنية الديف إكسربرس ، فإنني حاولت كثيرا ولم أستطع .
كود :
Try
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
If Trim(InvoiceBarcode.Text) = "" Then Exit Sub
For i = 0 To Dgvsearch.Rows.Count - 1
If Dgvsearch.Rows(i).Cells(9).Value = InvoiceBarcode.Text Then
Dgvsearch.Rows(i).Cells(5).Value += 1
Dgvsearch.Rows(i).Cells(7).Value = Val(Dgvsearch.Rows(i).Cells(5).Value) * Val(Dgvsearch.Rows(i).Cells(3).Value)
InvoiceBarcode.Text = Nothing
picBarcode.BackgroundImage = Nothing
CalcSalatax()
GoTo EOS
End If
Next
Dim Sql = ""
Dim Barc = ""
If GetFieldName("FirstUnitBarcode") = True Then
Sql = "select * from Items where FirstUnitBarcode=N'" & InvoiceBarcode.Text.Trim & "'"
Barc = 1
ElseIf GetFieldName("SecondUnitBarcode") = True Then
Sql = "select * from Items where SecondUnitBarcode=N'" & InvoiceBarcode.Text.Trim & "'"
Barc = 2
ElseIf GetFieldName("ThirdUnitBarcode") = True Then
Sql = "select * from Items where ThirdUnitBarcode=N'" & InvoiceBarcode.Text.Trim & "'"
Barc = 3
Else
GoTo EOS
End If
Dim x = Split(GetDef_UnitAndPriceBuy(itmcod), "|")
If Conn.State = 1 Then Conn.Close()
Conn.Open()
Dim Adp As New SqlClient.SqlDataAdapter(Sql, Conn)
Dim Ds = New DataSet
Adp.Fill(Ds)
Dim Dt = Ds.Tables(0)
If Dt.Rows.Count > 0 Then
Dgvsearch.ClearSelection()
Dgvsearch.Rows.Add()
Dim RowIndex = Dgvsearch.Rows.Count - 1
Dgvsearch.Rows(RowIndex).Selected = True
Dgvsearch.Rows(RowIndex).Cells(0).Value = Dt.Rows(0).Item("ItemsCode")
Dgvsearch.Rows(RowIndex).Cells(1).Value = Dt.Rows(0).Item("ItemsName")
itmcod = Dgvsearch.CurrentRow.Cells(1).Value
Dgvsearch.Rows(RowIndex).Cells(9).Value = InvoiceBarcode.Text
If Barc = 1 Then Dgvsearch.Rows(RowIndex).Cells(2).Value = Dt.Rows(0).Item("FirstUnit")
If Barc = 2 Then Dgvsearch.Rows(RowIndex).Cells(2).Value = Dt.Rows(0).Item("SecondUnit")
If Barc = 3 Then Dgvsearch.Rows(RowIndex).Cells(2).Value = Dt.Rows(0).Item("ThirdUnit")
Dgvsearch.Rows(RowIndex).Cells(5).Value = 1
Dgvsearch.Rows(RowIndex).Cells(3).Value = Format(GetDef_FullPrice(Dt.Rows(0).Item("ItemsCode"), Barc), "0.00")
Dgvsearch.Rows(RowIndex).Cells(4).Value = Format(GetDef_FullPriceBuy(Dt.Rows(0).Item("ItemsCode"), Barc), "0.00")
Dgvsearch.Rows(RowIndex).Cells(6).Value = "0.00"
If Barc = 1 Then Dgvsearch.Rows(RowIndex).Cells(10).Value = "1"
If Barc = 1 Then Dgvsearch.Rows(RowIndex).Cells(11).Value = "1"
If Barc = 2 Then Dgvsearch.Rows(RowIndex).Cells(10).Value = "2"
If Barc = 2 Then Dgvsearch.Rows(RowIndex).Cells(11).Value = "2"
If Barc = 3 Then Dgvsearch.Rows(RowIndex).Cells(10).Value = "3"
If Barc = 3 Then Dgvsearch.Rows(RowIndex).Cells(11).Value = "3"
Dgvsearch.Rows(RowIndex).Cells(14).Value = Dt.Rows(0).Item("CategorizationName")
Dgvsearch.Rows(RowIndex).Cells(7).Value = Format(Val(Dgvsearch.Rows(RowIndex).Cells(5).Value) * Val(Dgvsearch.Rows(RowIndex).Cells(3).Value), "0.00") - Format(Val(Dgvsearch.Rows(RowIndex).Cells(6).Value), "0.00")
'Dgvsearch.ClearSelection()
InvoiceBarcode.Text = ""
End If
CalcSalatax()
Conn.Close()
End If
EOS:
Catch ex As Exception
Conn.Close()
MsgBox(ex.Message, vbCritical)
End Try