'+++ BUSCAR Articulos ++++
Private Sub btnArticulo_Click
IME1.HideKeyboard
Dim aRegistros, aCampos As List
Dim aCom() As String
Dim MinPro = "00000", MaxPro = "99999" As String
Dim MinLin = "000", MaxLin = "999" As String
Dim MinRub = "000", MaxRub = "999" As String
Dim prove = lblProv.Text.SubString2(0,5) As String
Dim linea = lblLinea.Text.SubString2(0,3) As String
Dim rubro = lblRubro.Text.SubString2(0,3) As String
Dim nCar = 0 As Int
Dim cFiltro = edtArticulo.Text As String
nCar = cFiltro.Length
' If nCar = 0 Then
' Main.beepError.Beep : edtArticulo.RequestFocus : Return
' End If
If prove <> "00000" Then 'Verifico si filtro PROVEDOR
MinPro=prove : MaxPro=prove
End If
If linea <> "000" Then 'Verifico si filtro LINEA
MinLin=linea : MaxLin=linea
End If
If rubro <> "000" Then 'Verifico si filtro RUBRO
MinRub=rubro : MaxRub=rubro
End If
ProgressDialogShow("Buscando Articulos...ESPERE...")
aRegistros.Initialize
aCampos.Initialize
If cFiltro <> "*" And cFiltro <> "" Then
'Trae los primeros 250 registros o menos (segun filtro elegido)
aCom = Array As String(nCar,cFiltro,MinPro,MaxPro,MinLin,MaxLin,MinRub,MaxRub)
Wait For (Main.jConex.GetRecord("select_articulos_precios_filtrada", aCom)) Complete (Respuesta As Map)
Else If cFiltro = "*" Then
'Trae los primeros 5000 registros o menos (segun filtro elegido)
aCom = Array As String(MinPro,MaxPro,MinLin,MaxLin,MinRub,MaxRub)
Wait For (Main.jConex.GetRecord("select_articulos_precios_asterix", aCom)) Complete (Respuesta As Map)
Else
'Trae los primeros 250 registros o menos (segun filtro elegido) Boton Re-Inicio
aCom = Array As String(MinPro,MaxPro,MinLin,MaxLin,MinRub,MaxRub)
Wait For (Main.jConex.GetRecord("select_articulos_precios_vacia", aCom)) Complete (Respuesta As Map)
End If
If Respuesta.Get("Correcto") Then
Dim rs As DBResult
Dim cCod,cDes,cPre1,cPre2,cPre3,cPre4,cPre5,cDol As String
rs = Respuesta.Get("Datos")
Dim Lista As List = rs.Rows
Dim nLineas = Lista.Size, nVez=0 As Int
Log("Registros totales Articulos: " & nLineas)
For Each row() As Object In rs.Rows
cCod = row(0) & Chr(13) & row(1)
cDes = row(2)
cPre1 = row(3)
cPre2 = row(4)
cPre3 = row(5)
cPre4 = row(6)
cPre5 = row(7)
cDol = row(8)
If cDol = "T" Then cDes = "[u$s] " & cDes
aCampos.Initialize
aCampos.Add(cCod)
aCampos.Add(cDes)
aCampos.Add(cPre1)
aCampos.Add(cPre2)
aCampos.Add(cPre3)
aCampos.Add(cPre4)
aCampos.Add(cPre5)
aRegistros.Add(aCampos)
Next
B4XTable1.SetData(aRegistros)
SeteoColumna("Cod", "CENTER", "LEFT",0,-1,-1)
SeteoColumna("Descripción", "CENTER", "LEFT",0,-1,-1)
SeteoColumna("Vta1", "CENTER", "RIGHT",2,2,-1)
SeteoColumna("Vta2", "CENTER", "RIGHT",2,2,-1)
SeteoColumna("Vta3", "CENTER", "RIGHT",2,2,-1)
SeteoColumna("Vta4", "CENTER", "RIGHT",2,2,-1)
SeteoColumna("Vta5", "CENTER", "RIGHT",2,2,-1)
B4XTable1.Refresh
ProgressDialogHide
Else
ProgressDialogHide
MsgboxAsync(Respuesta.Get("Mensaje"),"")
Return
End If
End Sub