Sub btnProducto_Click
If Table1.Visible = True Then
' btnExistencia.Color = Colors.Blue
Table1.ClearAll
Table1.RefreshTable
Table1.Visible = Not(Table1.Visible)
edtPRODUCTO.Text = txt2
edtPRODUCTO_FINTEXTO
edtPRODUCTO.RequestFocus
Else
Table1.clearAll
Table1.RefreshTable
Table1.Visible = False
txt2=""
' btnExistencia.Color = Colors.Red
ConsultaProducto
End If
' edtEXISTENCIAS.Visible = False
End Sub
Sub ConsultaProducto
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("select_catinven", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
'work with result
req.PrintTable(res)
Dim x As Int=1
Dim AProducto As String
Dim ANombre As String
Dim ATienda As String
Dim AExistencia As String
Dim ALinea As String
Dim AAlterna As String
Dim APrecio1, APrecio2,APrecio3 As String
Table1.Visible = True
Table1.MultiSelect = True
' Table1.Initialize(Me, "Table1", 3, Gravity.CENTER_HORIZONTAL, True)
' Table1.CellAlignment = Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)
' Table1.HeaderColor = Colors.Gray
' Table1.HeaderTextColor = Colors.Black
' Table1.TextColor = Colors.Blue
' Table1.TableColor = Colors.Red
Table1.RowHeight = 20dip
Table1.MultiSelect = False
Table1.SortColumn = True
Table1.SingleLine = True
Table1.LineWidth = 3dip
Table1.TextSize = 11
Table1.FastScroll = True
Table1.FastScrollMinItems = 15
Table1.FastScrollColumnIndex = 0
Dim Alignments() As Int
Alignments = Array As Int(Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.RIGHT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.RIGHT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.RIGHT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.RIGHT, Gravity.CENTER_VERTICAL))
' Table1.SetHeaderAlignments(Alignments)
Table1.SetCellAlignments(Alignments)
Dim tf() As Typeface
tf = Array As Typeface(Typeface.DEFAULT, Typeface.DEFAULT, Typeface.DEFAULT, Typeface.DEFAULT, Typeface.DEFAULT,Typeface.DEFAULT,Typeface.DEFAULT,Typeface.DEFAULT)
Table1.SetTypeFaces(tf)
Table1.SetHeaderTypeFaces(tf)
Table1.SetHeader(Array As String("Clave", "Producto", "Linea", "Codigo GS1", "Existencia", "Precio1", "Precio2", "Precio3"))
Table1.SetColumnsWidths(Array As Int(25%x, 80%x, 20%x, 26%x, 20%x, 20%x, 20%x, 20%x))
Table1.ClearAll
For Each records() As Object In res.Rows
AProducto=records(0)
ANombre=records(1)
ALinea = records(2)
AAlterna = records(3)
AExistencia=NumberFormat(records(4),0,0)
APrecio1="$ "&NumberFormat2(records(5),1,2,2,True)
APrecio2="$ "&NumberFormat2(records(6),1,2,2,True)
APrecio3="$ "&NumberFormat2(records(7),1,2,2,True)
Table1.AddRow(Array As String(AProducto,ANombre,ALinea,AAlterna,AExistencia,APrecio1, APrecio2, APrecio3))
Next
j.Release
Else
Msgbox("NO HAY CONEXION CON EL SERVIDOR DE DATOS.","ALERTA !!!!!")
Log("ERROR: " & j.ErrorMessage)
j.Release
End If
' j.Release
End Sub