mirror of
https://github.com/KeymonSoft/Durakelo.git
synced 2026-04-17 19:36:12 +00:00
Cambios para visualizar las listas de precios en productos (Perfiles)
This commit is contained in:
@@ -96,7 +96,7 @@ Sub B4XPage_Appear
|
||||
C.Position=0
|
||||
Existe = C.GetString("EXISTE")
|
||||
C.Close
|
||||
c=Starter.skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, PE_CANT, PE_FOLIO, PE_TIPO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")
|
||||
c=Starter.skmt.ExecQuery("select PE_PRONOMBRE, PE_CEDIS, PE_COSTO_TOT, PE_CANT, PE_FOLIO, PE_TIPO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_TIPO desc, PE_CEDIS, PE_COSTO_TOT, PE_PRONOMBRE")
|
||||
ListView1.Clear
|
||||
Private cs As CSBuilder
|
||||
If c.RowCount>0 Then
|
||||
@@ -112,8 +112,9 @@ Sub B4XPage_Appear
|
||||
label2.TextColor = Colors.Blue
|
||||
cs.Initialize
|
||||
Private elColor = Colors.Black
|
||||
If c.GetString("PE_TIPO") = "PREVENTA" Then elColor = Colors.RGB(200,95,20)
|
||||
Log(c.GetString("PE_PRONOMBRE") & "|" & elColor)
|
||||
If c.GetString("PE_TIPO") = "PREVENTA" Then elColor = Colors.RGB(200,95,20) 'Si es preventa, cambiamos el color del texto.
|
||||
If Not(IsNumber(c.GetString("PE_CEDIS"))) Then elColor = Colors.red 'Si es promo, cambiamos el color del texto.
|
||||
' Log(c.GetString("PE_PRONOMBRE") & "|" & elColor)
|
||||
ListView1.AddTwoLines(cs.Color(elColor).append(c.GetString("PE_PRONOMBRE")).Pop,"Cantidad #"& c.GetString("PE_CANT")& " SubTotal $"& c.GetString("PE_COSTO_TOT")& " Folio "& c.GetString("PE_FOLIO"))
|
||||
folio = c.GetString("PE_FOLIO")
|
||||
Next
|
||||
|
||||
@@ -613,18 +613,13 @@ Sub Subir_Click
|
||||
' cmd.Name = "update_folio"
|
||||
' cmd.Parameters = Array As Object(armafolio,l_ruta.Text , "1")
|
||||
' reqManager.ExecuteQuery(cmd , 0, "folio")
|
||||
|
||||
|
||||
If PERFIL = "V-ESPECIAL" Then
|
||||
|
||||
|
||||
c=skmt.ExecQuery("SELECT PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO, PE_COSTO_SIN, PE_RUTA, PE_DESC, PE_FOLIO,PE_TIPO FROM PEDIDO ORDER BY PE_CLIENTE")
|
||||
d=skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO")
|
||||
d.Position=0
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "insert_pedido_esp_DUR"
|
||||
@@ -642,7 +637,6 @@ Sub Subir_Click
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
TIEMPO = TIEMPO + 1
|
||||
|
||||
If TIEMPO > 20 Then
|
||||
If L_P_2.Text = "Envio de Pedidos" Then
|
||||
L_P_2.Text = "Envio de Pedidos --"
|
||||
@@ -659,7 +653,6 @@ Sub Subir_Click
|
||||
T3.Enabled = True
|
||||
Wait For t3_tick
|
||||
TIEMPO = 0
|
||||
|
||||
End If
|
||||
conteo = conteo + 1
|
||||
cuantos_ped = D.GetString("CUANTOS_PEDIDO")
|
||||
@@ -669,13 +662,10 @@ Sub Subir_Click
|
||||
cmd.Name = "insert_pedido_DUR"
|
||||
cmd.Parameters = Array As Object(C.GetString("PE_CEDIS"),ALMACEN,C.GetString("PE_COSTO_TOT"),C.GetString("PE_COSTOU"),C.GetString("PE_CANT"),C.GetString("PE_PRONOMBRE"),C.GetString("PE_PROID"),C.GetString("PE_CLIENTE"),C.GetString("PE_FECHA"),C.GetString("PE_USUARIO"),C.GetString("PE_RUTA"), C.GetString("PE_COSTO_SIN"),C.GetString("PE_DESC"),c.GetString("PE_FOLIO"), c.GetString("PE_TIPO"))
|
||||
reqManager.ExecuteQuery(cmd , 0, "ins_pedido")
|
||||
|
||||
Next
|
||||
c.Close
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
cuantos_pedido = D.GetString("CUANTOS_PEDIDO")
|
||||
d.Close
|
||||
|
||||
|
||||
@@ -98,6 +98,8 @@ Sub Class_Globals
|
||||
Dim nuevaCantRMI As Int
|
||||
Private lv_precio2 As ListView
|
||||
Private cb_precio2 As B4XComboBox
|
||||
Private PERFIL As String
|
||||
Private prodAct As label
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -255,6 +257,17 @@ Sub B4XPage_Appear
|
||||
' l_mDisponible.Visible = True
|
||||
' End If
|
||||
' Log(Starter.tipov)
|
||||
c = Starter.skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("PERFIL"))
|
||||
c.Position =0
|
||||
If c.RowCount > 0 Then
|
||||
PERFIL = c.GetString("CAT_VA_VALOR")
|
||||
Else
|
||||
PERFIL = 0
|
||||
End If
|
||||
c.Close
|
||||
If PERFIL = "V-COSTO" Then
|
||||
skmt.ExecNonQuery("DELETE FROM CAT_GUNAPROD WHERE CAT_GP_ID IN (SELECT CAT_GP_ID FROM LISTA_PRECIOS WHERE NLISTA = '9' AND PRECIO = '0')")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub PCLV_AddProds
|
||||
@@ -608,6 +621,12 @@ Sub b_prodMas_Click
|
||||
Private almacenX As String = Subs.traeAlmacen
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Private precioX As String = precio
|
||||
|
||||
|
||||
'Aqui va el cambio de precio de acuerdo al perfil.
|
||||
' if perfil = xx then precioX = xxx
|
||||
|
||||
|
||||
If lfila.Text = "RMI" Then
|
||||
almacenX = "DUR"
|
||||
nombreX = "CAMBIO"&Subs.traeRMINombre(id)
|
||||
@@ -732,11 +751,13 @@ Sub b_terminar1_Click
|
||||
Private cantPedido As String = 0
|
||||
lv_promos.Visible = False
|
||||
clv_prods_ll.AsView.Visible = False
|
||||
cb_precio2.mBase.Visible = False
|
||||
l_info.Visible = False
|
||||
lv_catalogos.Visible = True
|
||||
Subs.agrupador
|
||||
lv_prodsPedido.Clear
|
||||
list_prodsPedido.Initialize
|
||||
Private c_prods As Cursor=Starter.skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, ifnull(PE_COSTOU, 0) as PE_COSTOU, PE_CANT, PE_FOLIO, PE_CEDIS, PE_PROID, PE_TIPO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_PRONOMBRE")
|
||||
Private c_prods As Cursor=Starter.skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, ifnull(PE_COSTOU, 0) as PE_COSTOU, PE_CANT, PE_FOLIO, PE_CEDIS, PE_PROID, PE_TIPO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_TIPO desc, PE_CEDIS, PE_COSTO_TOT, PE_PRONOMBRE")
|
||||
' Log(c_prods.RowCount)
|
||||
If c_prods.RowCount > 0 Then
|
||||
c_prods.Position = 0
|
||||
@@ -755,8 +776,9 @@ Sub b_terminar1_Click
|
||||
label1.Height = 30dip
|
||||
Private textColor As Int = Colors.black
|
||||
' Log(c_prods.GetString("PE_CEDIS"))
|
||||
If Not(IsNumber(c_prods.GetString("PE_CEDIS"))) Then textColor = Colors.RGB(210,105,30) 'Si es promo, cambiamos el color del texto.
|
||||
If c_prods.GetString("PE_CEDIS") = "DUR" Then textColor = Colors.red 'Si es promo, cambiamos el color del texto.
|
||||
' If c_prods.GetString("PE_CEDIS") = "DUR" Then textColor = Colors.red
|
||||
If c_prods.GetString("PE_TIPO") = "PREVENTA" Then textColor = Colors.RGB(200,95,20) 'Si es preventa, cambiamos el color del texto.
|
||||
If Not(IsNumber(c_prods.GetString("PE_CEDIS"))) Then textColor = Colors.red 'Si es promo, cambiamos el color del texto.
|
||||
Dim label2 As Label
|
||||
label2 = lv_prodsPedido.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
@@ -805,6 +827,8 @@ Private Sub b_continuar_Click
|
||||
' End If
|
||||
' Next
|
||||
' Log("promos-inv, prods-inv, cat-vis")
|
||||
cb_precio2.mBase.Visible = False
|
||||
l_info.Visible = False
|
||||
lv_promos.Visible = False
|
||||
clv_prods_ll.AsView.Visible = False
|
||||
lv_subtipo.Visible = False
|
||||
@@ -999,18 +1023,15 @@ End Sub
|
||||
|
||||
Sub l_prodX_Click
|
||||
Log("l_prodx clicked")
|
||||
prodAct = Sender
|
||||
Log(prodAct.Text)
|
||||
l_info.Text = Sender.as(Label).text
|
||||
Log(Sender.as(Label).tag)
|
||||
Private x() As String
|
||||
x = Regex.Split(CRLF, Sender.as(Label).text)
|
||||
Log(x(0))
|
||||
|
||||
Private id As String = kh.traeProdIdConNombre(x(0), Starter.tipov)
|
||||
|
||||
Private id As String = Sender.as(Label).tag.As(Map).Get("id")
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select PRECIO, NLISTA FROM LISTA_PRECIOS WHERE NLISTA IN ('1','10') AND CAT_GP_ID = '${id}' ORDER BY NLISTA ASC"$)
|
||||
|
||||
Log(c.RowCount)
|
||||
lv_precio2.Clear
|
||||
' lv_precio2.Clear
|
||||
|
||||
Dim Label1, Label2 As Label
|
||||
Label1 = lv_precio2.SingleLineLayout.Label
|
||||
@@ -1019,7 +1040,7 @@ Sub l_prodX_Click
|
||||
' Label2 = lv_precio2.TwoLinesLayout.SecondLabel
|
||||
' Label2.TextSize = 14
|
||||
' Label2.TextColor = Colors.DarkGray
|
||||
|
||||
cb_precio2.Tag = Sender.as(Label).tag
|
||||
If c.RowCount > 0 Then
|
||||
Private losPreciosList As List
|
||||
losPreciosList.Initialize
|
||||
@@ -1029,8 +1050,8 @@ Sub l_prodX_Click
|
||||
losPreciosList.Add("-= Seleccione Precio =-")
|
||||
For i = 0 To c.RowCount - 1
|
||||
c.Position = i
|
||||
losPreciosList.Add(c.GetString("NLISTA") & " - " & c.GetString("PRECIO"))
|
||||
lv_precio2.AddSingleLine2(c.GetString("NLISTA") & " - " & c.GetString("PRECIO"), c.GetString("PRECIO"))
|
||||
losPreciosList.Add(c.GetString("NLISTA") & " - " & NumberFormat2(c.GetDouble("PRECIO"), 1, 2, 2, False))
|
||||
' lv_precio2.AddSingleLine2(c.GetString("NLISTA") & " - " & c.GetString("PRECIO"), c.GetString("PRECIO"))
|
||||
Next
|
||||
cb_precio2.SetItems(losPreciosList)
|
||||
End If
|
||||
@@ -1129,7 +1150,7 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
Private precio As String=NumberFormat2(clv_prods_ll.GetValue(i).As(Map).Get("precio").As(Double),1,2,2,False)
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("cant") <> Null Then et_pCant.Text = clv_prods_ll.GetValue(i).As(Map).Get("cant")
|
||||
l_prodX.Text = cs.Color(Colors.red).append(clv_prods_ll.GetValue(i).As(Map).Get("prod")).pop.append(CRLF).Append("Existencias: " & clv_prods_ll.GetValue(i).As(Map).Get("almacen")).Color(0xFF017F01).Append($" $${precio}"$).Popall
|
||||
l_prodX.Tag = clv_prods_ll.GetValue(i).As(Map).Get("almacen")
|
||||
l_prodX.Tag = clv_prods_ll.GetValue(i).As(Map)
|
||||
l_pCant.Tag = clv_prods_ll.GetValue(i).As(Map).Get("id")
|
||||
End If
|
||||
' Log($"${i}, ${FirstIndex}, ${LastIndex}, ${Pnl.NumberOfViews}. ${clv_prods_ll.Size}"$)
|
||||
@@ -1193,12 +1214,13 @@ Sub LlenaProdsLL(p As ResultSet, extra As String)
|
||||
hayPedido = Subs.hayPedido
|
||||
Log($"HAYPEDIDO: ${hayPedido}"$)
|
||||
If hayPedido Then 'Si hay pedido obtenemos las cantidades de los productos para agregarlos al CLV.
|
||||
Dim cantsMap, tiposMap As Map
|
||||
Dim cantsMap, tiposMap, preciosMap As Map
|
||||
cantsMap.Initialize
|
||||
tiposMap.Initialize
|
||||
Dim pe As ResultSet = Starter.skmt.ExecQuery($"select PE_PROID, PE_CANT, PE_TIPO from PEDIDO where PE_CLIENTE = '${clienteId}' and PE_CEDIS = '${Subs.traeAlmacen}'"$)
|
||||
preciosMap.Initialize
|
||||
Dim pe As ResultSet = Starter.skmt.ExecQuery($"select PE_PROID, PE_CANT, PE_TIPO, PE_COSTOU from PEDIDO where PE_CLIENTE = '${clienteId}' and PE_CEDIS = '${Subs.traeAlmacen}'"$)
|
||||
'Si EXTRA es igual a rmi, entonces regresamos los RMIs existentes.
|
||||
If extra = "rmi" Then pe = Starter.skmt.ExecQuery($"select PE_PROID, PE_CANT from PEDIDO where PE_CLIENTE = '${clienteId}' and PE_CEDIS = 'DUR'"$)
|
||||
If extra = "rmi" Then pe = Starter.skmt.ExecQuery($"select PE_PROID, PE_CANT, PE_COSTOU from PEDIDO where PE_CLIENTE = '${clienteId}' and PE_CEDIS = 'DUR'"$)
|
||||
|
||||
LogColor("Ponemos productos de pedido anterior: "&pe.RowCount, Colors.red)
|
||||
Do While pe.NextRow
|
||||
@@ -1206,10 +1228,12 @@ Sub LlenaProdsLL(p As ResultSet, extra As String)
|
||||
Private tipo As String = ""
|
||||
cantsMap.put(pe.GetString("PE_PROID"), pe.GetString("PE_CANT"))
|
||||
tiposMap.put(pe.GetString("PE_PROID"), pe.GetString("PE_TIPO"))
|
||||
preciosMap.put(pe.GetString("PE_PROID"), pe.GetString("PE_COSTOU"))
|
||||
Loop
|
||||
Log($"Con pedido: ${pe.RowCount}"$)
|
||||
Log("CANTSMAP: " & cantsMap)
|
||||
Log("TIPOSMAP: " & tiposMap)
|
||||
Log("PRECIOSMAP: " & preciosMap)
|
||||
pe.Close
|
||||
End If
|
||||
' Log(p.IsInitialized)
|
||||
@@ -1224,9 +1248,14 @@ Sub LlenaProdsLL(p As ResultSet, extra As String)
|
||||
Do While p.NextRow
|
||||
Private cant As Int = 0
|
||||
Private tipoV As String = ""
|
||||
Private precioX As String = p.GetString("CAT_GP_PRECIO")
|
||||
' Log(p.GetString("CAT_GP_ID"))
|
||||
If hayPedido And cantsMap.ContainsKey(p.GetString("CAT_GP_ID")) Then cant = cantsMap.Get(p.GetString("CAT_GP_ID"))
|
||||
If hayPedido And tiposMap.ContainsKey(p.GetString("CAT_GP_ID")) Then tipoV = tiposMap.Get(p.GetString("CAT_GP_ID"))
|
||||
Dim tempMap As Map = CreateMap("prod":p.GetString("CAT_GP_NOMBRE"), "precio":p.GetString("CAT_GP_PRECIO"), "almacen":p.GetString("CAT_GP_ALMACEN"), "id":p.GetString("CAT_GP_ID"), "cant":cant, "tipo":tipoV)
|
||||
If hayPedido And preciosMap.ContainsKey(p.GetString("CAT_GP_ID")) Then precioX = preciosMap.Get(p.GetString("CAT_GP_ID"))
|
||||
' Log(precioX)
|
||||
' Log(">>>>>> preciosMap: " & preciosMap)
|
||||
Dim tempMap As Map = CreateMap("prod":p.GetString("CAT_GP_NOMBRE"), "precio":precioX, "almacen":p.GetString("CAT_GP_ALMACEN"), "id":p.GetString("CAT_GP_ID"), "cant":cant, "tipo":tipoV)
|
||||
' Log($"tipo: |${tempMap.Get("tipo")}|${Starter.tipov}| - tempMap: ${tempMap}"$)
|
||||
If tempMap.Get("tipo") = "" Or tempMap.Get("tipo") = Starter.tipov Then listaProds.Add(tempMap) 'Si el tipo de venta del producto es igual al actual, mostramos el producto en la lista.
|
||||
' Log($"${p.GetString("CAT_GP_ID")}, ${p.GetString("CAT_GP_NOMBRE")}, ${cant}"$)
|
||||
@@ -1349,14 +1378,22 @@ Private Sub b_rmi_Click
|
||||
l_mDisponible.Visible = True
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub lv_precio2_ItemClick (Position As Int, Value As Object)
|
||||
Log(Value)
|
||||
End Sub
|
||||
|
||||
Private Sub cb_precio2_SelectedIndexChanged (Index As Int)
|
||||
Log(cb_precio2.SelectedItem.Trim)
|
||||
Log(cb_precio2.Tag)
|
||||
' Log(cb_precio2.SelectedItem.Trim)
|
||||
' Log(cb_precio2.Tag)
|
||||
Private m As Map = cb_precio2.Tag
|
||||
Private p() As String
|
||||
p = Regex.Split("-", cb_precio2.SelectedItem)
|
||||
Private p2 As String = p(1).trim 'Obtenemos el precio
|
||||
' Log("|" & p(1).trim & "|")
|
||||
Private cs As CSBuilder
|
||||
cs.Initialize
|
||||
prodAct.Text = cs.Color(Colors.red).append(m.Get("prod")).pop.append(CRLF).Append("Existencias: " & m.Get("almacen")).Color(0xFF017F01).Append($" $${p2}"$).Popall
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_COSTOU = '${p2}', PE_COSTO_TOT = '${(p2 * m.Get("cant"))}' where PE_TIPO = '${m.Get("tipo")}' and PE_COSTOU = '${m.Get("precio")}' and PE_PROID = '${m.Get("id")}' and PE_CLIENTE = '${kh.traeCliente}'"$)
|
||||
l_info.Visible = False
|
||||
lv_precio2.Visible = False
|
||||
cb_precio2.mBase.Visible = False
|
||||
|
||||
@@ -64,6 +64,6 @@ ModuleClosedNodes6=1
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Productos,cb_precio2_SelectedIndexChanged,1352,6,C_Productos,b_rmi_Click,1328,0,C_Productos,Class_Globals,94,0,C_Productos,b_rmi_mas_Click,1324,0,C_Productos,lv_precio2_ItemClick,1339,2,C_Productos,l_info_Click,815,0,C_Productos,lv_promos_ItemLongClick,829,0,C_Productos,B4XPage_CloseRequest,439,4,Visual Designer,productos.bal,-100,6,C_Productos,l_prodX_Click,1003,6,B4XMainPage,B4XPage_Created,147,0
|
||||
NavigationStack=C_Productos,b_continuar_Click,823,0,C_Nota,Class_Globals,0,0,Visual Designer,proditem.bal,-100,1,C_Productos,l_prodX_Click,1047,2,C_Nota,B4XPage_Created,64,0,Visual Designer,productos.bal,-100,2,Subs,borraPedidoClienteActual,1258,0,C_Nota,B4XPage_Appear,114,2,C_Productos,b_terminar1_Click,753,6,C_Productos,cb_precio2_SelectedIndexChanged,1384,6
|
||||
SelectedBuild=0
|
||||
VisibleModules=19,1,8,16,6,3,7,9,20,10,21
|
||||
VisibleModules=19,1,8,16,6,3,9,20,10,21
|
||||
|
||||
Reference in New Issue
Block a user