mirror of
https://github.com/KeymonSoft/MarketPlace.git
synced 2026-04-18 05:09:22 +00:00
723 lines
32 KiB
QBasic
723 lines
32 KiB
QBasic
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Class
|
|
Version=12.2
|
|
@EndOfDesignText@
|
|
Sub Class_Globals
|
|
Private Root As B4XView 'ignore
|
|
Private xui As XUI 'ignore
|
|
Private p_principal As Panel
|
|
Private WobbleMenu1 As WobbleMenu
|
|
Dim PCLV As PreoptimizedCLV
|
|
Private p_productos As Panel
|
|
Private clv_prods_ll, clv_carrito, clv As CustomListView
|
|
Dim prodsMap As Map
|
|
Private p_botonesVenta As Panel
|
|
Private b_continuar As Button
|
|
Private lfila As Label
|
|
Private et_busca As EditText
|
|
Private b_buscar As Button
|
|
Dim etCantHasFocus, hayPedido As Boolean
|
|
Dim clienteId As String
|
|
Dim rutaUsuario, folio As String
|
|
Dim query As String
|
|
Dim listaProds, listaHints, list_prodsPedido As List
|
|
Dim reiniciarlistaProds As Boolean= False
|
|
Dim forzarBusqueda As Boolean = False
|
|
Private lv_promos As ListView
|
|
Private b_prodMenos As Button
|
|
Private et_pCant As EditText
|
|
Private l_pCant As Label
|
|
Private b_prodMas As Button
|
|
Private p_botMasMen As Panel
|
|
Private l_prodX As Label
|
|
Private i_prod As ImageView
|
|
Private p_prods As Panel
|
|
Private p_promos As Panel
|
|
' Private lv_carrito As ListView
|
|
Private p_carrito As Panel
|
|
Private p_botonesCarrito As Panel
|
|
Private b_continuar2 As Button
|
|
Private p_botonesPromo As Panel
|
|
Private b_terminar As Button
|
|
Private p_historial As Panel
|
|
Private p_botonesHist As Panel
|
|
Private l_compraTerminada As Label
|
|
Private l_carritoVacio As Label
|
|
Private b_borrar As Button
|
|
Private l_totalCarrito As Label
|
|
Private l_historialVacio As Label
|
|
Private lv_historial As ListView
|
|
End Sub
|
|
|
|
'You can add more parameters here.
|
|
Public Sub Initialize As Object
|
|
Return Me
|
|
End Sub
|
|
|
|
'This event will be called once, before the page becomes visible.
|
|
Private Sub B4XPage_Created (Root1 As B4XView)
|
|
Root = Root1
|
|
'load the layout to Root
|
|
Root.LoadLayout("principal")
|
|
p_principal.Width = Root.Width
|
|
p_principal.Height = Root.Height
|
|
If File.Exists(Starter.ruta, "kmt.db") = False Then
|
|
File.Copy(File.DirAssets, "kmt.db", Starter.ruta, "kmt.db")
|
|
End If
|
|
PCLV.Initialize(Me, "PCLV", clv_prods_ll)
|
|
WobbleMenu1.SetTabTextIcon(1,"Productos", Chr(0xF0C0), Typeface.FONTAWESOME)
|
|
WobbleMenu1.SetTabTextIcon(2,"Promociones", Chr(0xF007), Typeface.FONTAWESOME)
|
|
WobbleMenu1.SetTabTextIcon(3,"Carrito", Chr(0xF2BE), Typeface.FONTAWESOME)
|
|
WobbleMenu1.SetTabTextIcon(4,"Historial", Chr(0xF21B), Typeface.FONTAWESOME)
|
|
' WobbleMenu1.SetTabTextIcon(5,"Cinco", Chr(0xF29D), Typeface.FONTAWESOME)
|
|
p_carrito.Width = Root.Width
|
|
p_carrito.Height = Root.Height - WobbleMenu1.Height
|
|
p_promos.Width = Root.Width
|
|
p_promos.Height = Root.Height - WobbleMenu1.Height
|
|
p_historial.Width = Root.Width
|
|
p_historial.Height = Root.Height - WobbleMenu1.Height
|
|
p_botonesVenta.Top = Root.Height - p_botonesVenta.Height - WobbleMenu1.Height + 10
|
|
p_botonesPromo.Top = Root.Height - p_botonesPromo.Height - WobbleMenu1.Height + 10
|
|
' p_botonesHist.Top = Root.Height - p_botonesHist.Height - WobbleMenu1.Height + 10
|
|
p_botonesPromo.Width = p_promos.Width
|
|
p_botonesCarrito.Top = Root.Height - p_botonesCarrito.Height - WobbleMenu1.Height + 10
|
|
Dim ri As Cursor = Starter.skmt.ExecQuery($"select count(*) as cuantos from cat_gunaprod"$)
|
|
ri.Position = 0
|
|
If ri.GetString("cuantos") = "0" Then 'Si no hay productos, los descargamos
|
|
Starter.reqManager.Initialize(Me, Starter.server)
|
|
Dim cmd As DBCommand
|
|
cmd.Initialize
|
|
cmd.Name = "selectPedigree"
|
|
cmd.Parameters = Array As Object(DateTime.Date(DateTime.Now))
|
|
Log($"Traemos productos, ${DateTime.Date(DateTime.Now)}"$)
|
|
Starter.reqManager.ExecuteQuery(cmd , 0, "descargaProds")
|
|
End If
|
|
query = "cat_gunaprod"
|
|
prodsMap.Initialize
|
|
listaProds.Initialize
|
|
listaHints.Initialize
|
|
p_productos.Width = Root.Width
|
|
' Log(p_productos.Width)
|
|
Subs.panelVisible(p_productos, 0, 0)
|
|
End Sub
|
|
|
|
Sub B4XPage_Appear
|
|
clienteId = Subs.traeCliente
|
|
rutaUsuario = Subs.traeRuta
|
|
p_principal.Width = Root.Width
|
|
p_principal.Height = Root.Height
|
|
clv_prods_ll.GetBase.SetLayoutAnimated(0, 5dip, 130dip, Root.Width + 10, Root.Height * 0.65) 'Cambiamos el tamaño y posición de la lista de productos.
|
|
clv_prods_ll.Base_Resize(clv_prods_ll.GetBase.Width, clv_prods_ll.GetBase.Height) 'Cambiamos el tamaño del panel interno de la lista para que se ajuste al nuevo tamaño.
|
|
clv_carrito.GetBase.SetLayoutAnimated(0, 5dip, 80dip, Root.Width - 20, Root.Height * 0.65) 'Cambiamos el tamaño y posición de la lista del carrito.
|
|
clv_carrito.Base_Resize(clv_prods_ll.GetBase.Width, clv_prods_ll.GetBase.Height) 'Cambiamos el tamaño del panel interno del carrito para que se ajuste al nuevo tamaño.
|
|
' Log($"${clv_carrito.AsView.Width}, ${Root.Width}"$)
|
|
clv = clv_prods_ll
|
|
cuentaProds
|
|
LlenaProdsLL(Null, Null)
|
|
If clv_prods_ll.Size > 0 Then
|
|
clv_prods_ll.JumpToItem(0) 'Vamos al primer artículo de la lista.
|
|
PCLV.lblHint.SetTextSizeAnimated(0,13)
|
|
PCLV.B4XSeekBar1.Color1=Colors.DarkGray
|
|
PCLV.B4XSeekBar1.Color2=Colors.DarkGray
|
|
PCLV.B4XSeekBar1.ThumbColor=Colors.red
|
|
PCLV.B4XSeekBar1.Radius1 = 20
|
|
PCLV.B4XSeekBar1.Radius2 = 30
|
|
PCLV.B4XSeekBar1.mBase.Left=Root.Width *0.90
|
|
' PCLV.B4XSeekBar1.mBase.Top=-50
|
|
PCLV.B4XSeekBar1.mBase.Height=clv_prods_ll.AsView.Height
|
|
PCLV.pnlOverlay.Height = clv_prods_ll.AsView.Height
|
|
PCLV.pnlOverlay.Width = clv_prods_ll.AsView.Width - 100
|
|
PCLV.B4XSeekBar1.Update
|
|
Else
|
|
PCLV.B4XSeekBar1.mBase.Left=Root.Width *1.5 'Si no hay productos, que NO se vea la barra de busqueda.
|
|
End If
|
|
p_productos.Height = Root.Height - WobbleMenu1.Height
|
|
If et_busca.Text <> "" Then et_busca.Text =""
|
|
End Sub
|
|
|
|
Sub JobDone(Job As HttpJob)
|
|
If Starter.Logger Then LogColor("Principal - JobDone", Colors.Magenta)
|
|
If Job.Success = False Then
|
|
' ToastMessageShow("Error: " & Job.ErrorMessage, True)
|
|
Else
|
|
If Starter.Logger Then LogColor("JobDone: '" & Starter.reqManager.HandleJob(Job).tag & "' - Registros: " & Starter.reqManager.HandleJob(Job).Rows.Size, Colors.Green) 'Mod por CHV - 211110
|
|
If Job.JobName = "DBRequest" Then
|
|
Dim result As DBResult = Starter.reqManager.HandleJob(Job)
|
|
If result.Tag = "descargaProds" Then 'query tag
|
|
' If Starter.Logger Then Subs.logJobDoneResultados(result)
|
|
Starter.skmt.BeginTransaction
|
|
For Each records() As Object In result.Rows
|
|
Log($"ID: ${records(result.Columns.Get("CAT_GP_ID"))}, NOM: ${records(result.Columns.Get("CAT_GP_NOMBRE"))}"$)
|
|
Dim CAT_GP_ID As String = records(result.Columns.Get("CAT_GP_ID"))
|
|
Dim CAT_GP_NOMBRE As String = records(result.Columns.Get("CAT_GP_NOMBRE"))
|
|
Dim CAT_GP_PRECIO As String = records(result.Columns.Get("CAT_GP_PRECIO"))
|
|
Dim CAT_GP_ALMACEN As String = records(result.Columns.Get("CAT_GP_ALMACEN"))
|
|
Dim CAT_PT_DESC As String = records(result.Columns.Get("CAT_PT_DESC"))
|
|
Dim CAT_PS_DESC As String = records(result.Columns.Get("CAT_PS_DESC"))
|
|
Dim CAT_GP_IMG() As Byte = records(result.Columns.Get("CAT_GP_IMG"))
|
|
Dim CAT_GP_FECHA As String = records(result.Columns.Get("CAT_GP_FECHA"))
|
|
Dim CAT_GP_FECHA_MOD As String = records(result.Columns.Get("CAT_GP_FECHA_MOD"))
|
|
Dim CAT_GP_CLASIF As String = records(result.Columns.Get("CAT_GP_CLASIF"))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_PRECIO,CAT_GP_ALMACEN,CAT_PT_DESC,CAT_PS_DESC,CAT_GP_IMG,CAT_GP_FECHA,CAT_GP_FECHA_MOD, CAT_GP_CLASIF) VALUES (?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_PRECIO,CAT_GP_ALMACEN,CAT_PT_DESC,CAT_PS_DESC,CAT_GP_IMG,CAT_GP_FECHA,CAT_GP_FECHA_MOD,CAT_GP_CLASIF))
|
|
Next
|
|
' Starter.skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_BFACTURA,CAT_CL_BCREDITO,CAT_CL_MTOCOMPRA,CAT_CL_NUM_SERIEFISICO,CAT_CL_DIAS_VISITA, gestion, IMPRESION) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0,0,?,0,0) ",Array As Object ("0",e_ruta.TEXT, "VENTA ABORDO","null","null","null","null","null","null","null","null","null","null","null","null","NULL","null","null","NULL","NULL"))
|
|
Starter.skmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
|
Starter.skmt.EndTransaction
|
|
LlenaProdsLL(Null, Null)
|
|
End If
|
|
End If
|
|
End If
|
|
Job.Release
|
|
End Sub
|
|
|
|
Sub b_prodMenos_Click
|
|
etCantHasFocus = False
|
|
If WobbleMenu1.GetCurrentTab = 3 Then clv = clv_carrito Else clv = clv_prods_ll
|
|
' Log(Sender.As(Button).text & "|" & Sender.As(Button).tag)
|
|
Private buttonTag As String = Sender.As(Button).tag
|
|
LogColor("b_prodMenos_Click", Colors.Magenta)
|
|
Dim index As Int = clv.GetItemFromView(Sender)
|
|
LogColor(clv.GetValue(index), Colors.Magenta)
|
|
Private inv As Int = clv.GetValue(index).As(Map).Get("almacen")
|
|
Dim pnl0 As B4XView = clv.GetPanel(index)
|
|
Log(pnl0.As(Panel))
|
|
Dim pnl As B4XView = pnl0.GetView(0)
|
|
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
|
' Log(pnl.GetView(0).NumberOfViews)
|
|
Dim elNombre As B4XView = pnl.GetView(1)
|
|
If WobbleMenu1.GetCurrentTab = 3 Then laCant = pnl.GetView(2).GetView(4)
|
|
Log($"${pnl.GetView(1)}${CRLF}${pnl.GetView(2).GetView(2)}${CRLF}${pnl.GetView(2).GetView(3)}${CRLF}${pnl.GetView(2).GetView(4)}"$)
|
|
' Log($"precio|stock:${laCant.tag}"$)
|
|
' Log("lacant.text="&laCant.text & "|" & buttonTag)
|
|
If buttonTag = "vendido" And laCant.Text > 0 Then
|
|
Log(clv.GetValue(index).As(Map))
|
|
clv.GetValue(index).As(Map).Put("almacen",inv + 1)
|
|
Log(clv.GetValue(index).As(Map))
|
|
' clv.GetValue(index).As(Map).Get("almacen") = clv.GetValue(index).As(Map).Get("almacen") + 1
|
|
End If
|
|
If laCant.Text = "" Then laCant.Text = 0
|
|
Log($"|${laCant.Text}|"$)
|
|
laCant.Text = $"$1.0{laCant.Text-1}"$
|
|
If laCant.Text < 0 Then laCant.Text = 0
|
|
Private tmpMap As Map = clv.GetValue(index).As(Map)
|
|
Private precio As String = clv.GetValue(index).As(Map).Get("precio")
|
|
Private id As String=clv.GetValue(index).As(Map).Get("id")
|
|
Private tmpMap As Map = CreateMap("precio":precio, "cant":laCant.Text, "almacen":Subs.traeAlmacen)
|
|
' Log(tmpMap)
|
|
prodsMap.Put(id, tmpMap)
|
|
If laCant.Text = 0 Then prodsMap.Remove(id)
|
|
' LogColor("prodsMap="&prodsMap, Colors.blue)
|
|
' (Subs.traeAlmacen, p1.Get("precio"), p1.Get("cant"), pn, p, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
|
Private almacenX As String = Subs.traeAlmacen
|
|
Private nombreX As String = Subs.traeProdNombre(id)
|
|
Subs.actualizaProducto(almacenX, precio, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
|
cuentaProds
|
|
Dim cs As CSBuilder
|
|
cs.Initialize
|
|
If WobbleMenu1.GetCurrentTab = 3 Then
|
|
Private elTexto As String = clv.GetValue(index).As(Map).Get("prod")
|
|
Private elPrecioU As String = clv.GetValue(index).As(Map).Get("precio")
|
|
Private elTotal As String = elPrecioU * laCant.text
|
|
elNombre.Text = cs.Color(Colors.red).append(elTexto).pop.append(CRLF).Color(0xFF017F01).Append($"Precio $${NumberFormat2(elTotal, 1, 2, 2, True)}"$).Popall
|
|
End If
|
|
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
|
End Sub
|
|
|
|
Sub b_prodMas_Click
|
|
etCantHasFocus = False
|
|
If WobbleMenu1.GetCurrentTab = 3 Then clv = clv_carrito Else clv = clv_prods_ll
|
|
Private buttonTag As String = Sender.As(Button).tag
|
|
Dim index As Int = clv.GetItemFromView(Sender)
|
|
LogColor("b_prodMas_Click", Colors.Magenta)
|
|
Dim pnl0 As B4XView = clv.GetPanel(index)
|
|
Dim pnl As B4XView = pnl0.GetView(0)
|
|
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
|
Dim elNombre As B4XView = pnl.GetView(1)
|
|
If WobbleMenu1.GetCurrentTab = 3 Then laCant = pnl.GetView(2).GetView(4)
|
|
Log($"${pnl.GetView(2).GetView(1)}${CRLF}${pnl.GetView(2).GetView(2)}${CRLF}${pnl.GetView(2).GetView(3)}${CRLF}${pnl.GetView(2).GetView(4)}"$)
|
|
If laCant.Text = "" Then laCant.Text = 0
|
|
' Private tmpMap As Map = clv.GetValue(index).As(Map)
|
|
Private precio As String=clv.GetValue(index).As(Map).Get("precio")
|
|
Private inv As Int = clv.GetValue(index).As(Map).Get("almacen")
|
|
Log($"|${laCant.Text}, ${inv}"$)
|
|
If buttonTag = "vendido" Then
|
|
If inv > 0 And (laCant.Text + 1 <= inv) Then
|
|
' Log(clv.GetValue(index).As(Map))
|
|
clv.GetValue(index).As(Map).Put("almacen", (inv - 1))
|
|
inv = inv - 1
|
|
laCant.Text = $"$1.0{laCant.Text+1}"$
|
|
' Log(clv.GetValue(index).As(Map))
|
|
End If
|
|
else If laCant.Text + 1 <= inv And lfila.Text = "PRODUCTOS" Then
|
|
' LogColor(inv, Colors.blue)
|
|
laCant.Text = $"$1.0{laCant.Text + 1}"$
|
|
Log(Subs.totalPedido)
|
|
End If
|
|
Private id As String=clv.GetValue(index).As(Map).Get("id")
|
|
Private almacenX As String = Subs.traeAlmacen
|
|
Private nombreX As String = Subs.traeProdNombre(id)
|
|
Private precioX As String = precio
|
|
Subs.actualizaProducto(almacenX, precioX, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
|
cuentaProds
|
|
Dim cs As CSBuilder
|
|
cs.Initialize
|
|
If WobbleMenu1.GetCurrentTab = 3 Then
|
|
Private elTexto As String = clv.GetValue(index).As(Map).Get("prod")
|
|
Private elPrecioU As String = clv.GetValue(index).As(Map).Get("precio")
|
|
Private elTotal As String = elPrecioU * laCant.text
|
|
elNombre.Text = cs.Color(Colors.red).append(elTexto).pop.append(CRLF).Color(0xFF017F01).Append($"Precio $${NumberFormat2(elTotal, 1, 2, 2, True)}"$).Popall
|
|
End If
|
|
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
|
End Sub
|
|
|
|
Sub cuentaProds
|
|
'LogColor($"Productos de la orden: ${c_prodsX.GetString("cantProds")}, Total: ${c_prodsX.GetString("costoTotal")}"$, Colors.red)
|
|
' Log("===========================")
|
|
Private c As Cursor = Starter.skmt.ExecQuery($"select sum(PE_COSTO_TOT) as total, sum(PE_CANT) as cant from PEDIDO where PE_CLIENTE IN (Select cuenta from cuentaa)"$)
|
|
' LogColor("TIEMPO cuentaProds =" & ((DateTime.Now-inicioContador)/1000), Colors.Red)
|
|
' LogColor(prodsMap, Colors.Magenta)
|
|
p_botonesVenta.Visible = True
|
|
p_botonesVenta.BringToFront
|
|
c.Position=0
|
|
' Log(Subs.totalPedido)
|
|
Private cant0 As String = "0"
|
|
Private total0 As String = "0"
|
|
|
|
If c.GetString("cant") <> Null And c.GetString("cant") <> "null" Then cant0 = c.GetString("cant")
|
|
If c.GetString("total") <> Null And c.GetString("total") <> "null" Then total0 = c.GetString("total")
|
|
|
|
Log($"Total Prods: ${cant0}, Total Compra: $$1.2{total0}"$)
|
|
l_totalCarrito.text = $"Total: $${NumberFormat2(total0,1,2,2,True)}"$
|
|
c.Close
|
|
If WobbleMenu1.GetCurrentTab = 3 Then LlenaProdsLL(Null, Null)
|
|
If Subs.hayPedido Then WobbleMenu1.SetBadge(3, 1, Colors.white, Colors.red) Else WobbleMenu1.RemoveBadge(3)
|
|
End Sub
|
|
|
|
Sub LlenaProdsLL(p As ResultSet, extra As String)
|
|
' Log("LlenaProdsLL")
|
|
listaProds.Initialize
|
|
hayPedido = Subs.hayPedido
|
|
' Log($"HAYPEDIDO: ${hayPedido}"$)
|
|
If hayPedido Then 'Si hay pedido obtenemos las cantidades de los productos para agregarlos al CLV.
|
|
Dim cantsMap As Map
|
|
cantsMap.Initialize
|
|
Dim pe As ResultSet = Starter.skmt.ExecQuery($"select PE_PROID, PE_CANT 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'"$)
|
|
' LogColor("Ponemos productos de pedido anterior: "&pe.RowCount, Colors.red)
|
|
Do While pe.NextRow
|
|
Private cant As Int = 0
|
|
cantsMap.put(pe.GetString("PE_PROID"), pe.GetString("PE_CANT"))
|
|
Loop
|
|
' Log($"Con pedido: ${pe.RowCount}"$)
|
|
' Log("CANTSMAP: " & cantsMap)
|
|
pe.Close
|
|
End If
|
|
' Log(p.IsInitialized)
|
|
If query = "" Or query = Null Then query = "cat_gunaprod2"
|
|
If p.IsInitialized Then
|
|
Log($"YA HAY RESULSET ${p.RowCount}"$)
|
|
Else
|
|
' Log("NO HAY RESULSET")
|
|
Dim p As ResultSet = Starter.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_GP_IMG from cat_gunaprod where CAT_GP_PRECIO > 0 And CAT_GP_CLASIF <> 'PROMOS' order by CAT_GP_NOMBRE"$)
|
|
End If
|
|
' Log(p.RowCount)
|
|
Do While p.NextRow
|
|
Private cant As Int = 0
|
|
Dim ins As InputStream
|
|
Dim bmp As Bitmap
|
|
Dim jpeg() As Byte
|
|
jpeg = p.GetBlob("CAT_GP_IMG")
|
|
ins.InitializeFromBytesArray(jpeg, 0, jpeg.Length)
|
|
bmp.Initialize2(ins)
|
|
If hayPedido And cantsMap.ContainsKey(p.GetString("CAT_GP_ID")) Then cant = cantsMap.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, "img":bmp)
|
|
listaProds.Add(tempMap)
|
|
' Log($"${p.GetString("CAT_GP_ID")}, ${p.GetString("CAT_GP_NOMBRE")}, ${cant}"$)
|
|
Loop
|
|
p.Close
|
|
|
|
' Log("LISTAPRODS: " & listaProds)
|
|
PCLV.Commit
|
|
clv_prods_ll.Clear
|
|
Private listaProdsConCant, listaProdsConCantIndex As List
|
|
listaProdsConCant.Initialize
|
|
listaProdsConCantIndex.Initialize
|
|
listaHints.Initialize
|
|
' Log(listaProds)
|
|
For q = 0 To listaProds.Size - 1' Sacamos los productos con cantidad previa.
|
|
If listaProds.Get(q).As(Map).Get("cant").As(Int) <> 0 Then
|
|
' Log(listaProds.Get(q).As(Map).Get("prod"))
|
|
listaProdsConCant.Add(listaProds.Get(q))
|
|
listaProdsConCantIndex.Add(q)
|
|
End If
|
|
Next
|
|
' Log("PRODCONCANT: " & listaProdsConCant)
|
|
' Log(listaProdsConCantIndex)
|
|
Private cont As Int = 0
|
|
For pr0=0 To listaProdsConCant.Size - 1 'Agregamos los productos con cantidad previa.
|
|
Private Pnl As B4XView = xui.CreatePanel("")
|
|
Pnl.SetLayoutAnimated(0, 0, 0, clv_prods_ll.AsView.Width, 120dip)
|
|
clv_prods_ll.Add(Pnl, listaProdsConCant.Get(pr0))
|
|
listaHints.Add(listaProdsConCant.get(pr0).As(Map).Get("prod"))
|
|
cont = cont + 1
|
|
Next
|
|
' LogColor(clv_prods_ll.Size, Colors.red)
|
|
' Log(listaProds.Size)
|
|
For pr = 0 To listaProds.Size - 1
|
|
If listaProdsConCantIndex.IndexOf(pr) = -1 Then
|
|
Private Pnl As B4XView = xui.CreatePanel("")
|
|
If listaProds.Get(pr).As(Map).Get("almacen") < 1 Then
|
|
' Log("EN CERO" & listaProds.Get(pr).As(Map).Get("prod") & "|" & listaProds.Get(pr).As(Map).Get("almacen"))
|
|
Else
|
|
Pnl.SetLayoutAnimated(0, 0, 0, clv_prods_ll.AsView.Width, 120dip)
|
|
' Log(listaProds.Get(pr))
|
|
clv_prods_ll.Add(Pnl, listaProds.Get(pr))
|
|
listaHints.Add(listaProds.get(pr).As(Map).Get("prod"))
|
|
cont = cont + 1
|
|
End If
|
|
End If
|
|
Next
|
|
' LogColor(clv_prods_ll.Size, Colors.red)
|
|
' PCLV.Commit
|
|
' Log("CONT=" & cont)
|
|
' Log("CLV_PRODSLL="&clv_prods_ll.Size)
|
|
PCLV.B4XSeekBar1.MaxValue = clv_prods_ll.Size
|
|
PCLV.B4XSeekBar1.MinValue = 0
|
|
PCLV.B4XSeekBar1.Interval = clv_prods_ll.Size/20
|
|
PCLV.B4XSeekBar1.Value = clv_prods_ll.Size
|
|
PCLV.B4XSeekBar1.Update
|
|
' Log($"Min:0, max:${clv_prods_ll.Size}, Interval:${clv_prods_ll.Size/20}"$)
|
|
reiniciarlistaProds = False
|
|
End Sub
|
|
|
|
Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
|
|
' Private inicioContador As String = DateTime.Now
|
|
' Log($"clv_prods_ll_VisibleRangeChanged : ${FirstIndex}, ${LastIndex} "$)
|
|
Dim ExtraSize As Int = 30 'List size
|
|
For i = Max(0, FirstIndex - ExtraSize) To Min(LastIndex + ExtraSize, clv_prods_ll.Size - 1)
|
|
Dim Pnl As B4XView = clv_prods_ll.GetPanel(i)
|
|
If i > FirstIndex - ExtraSize And i < LastIndex + ExtraSize Then
|
|
' Log(listaRenglones)
|
|
If Pnl.NumberOfViews = 0 Then 'Add each item/layout to the list/main layout
|
|
Pnl.LoadLayout("proditem")
|
|
' p_botMasMen.Left = (p_prods.Width * 0.66) - (p_botMasMen.Width / 2)
|
|
p_prods.Width = Root.Width * 0.92
|
|
' p_botMasMen.Left = p_prods.Width - (p_botMasMen.Width + 5)
|
|
' Log(Root.Width)
|
|
p_botMasMen.Left = (p_prods.Width - i_prod.Width) - (p_botMasMen.Width / 2)
|
|
' Log(p_botMasMen.left)
|
|
Private cs As CSBuilder
|
|
cs.Initialize
|
|
l_prodX.SetTextSizeAnimated(0, 13)
|
|
If clv_prods_ll.GetValue(i).As(Map).Get("cant") <> Null And clv_prods_ll.GetValue(i).As(Map).Get("cant") > 0 Then
|
|
p_prods.Color=0xFFE2EEFF
|
|
et_pCant.TextColor=Colors.Red
|
|
' Log("VENDIDO ")
|
|
b_prodMenos.Tag = "vendido"
|
|
b_prodMas.Tag = "vendido"
|
|
End If
|
|
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).Color(0xFF017F01).Append($"Precio $${NumberFormat2(precio, 1, 2, 2, True)}"$).Popall
|
|
l_prodX.Tag = clv_prods_ll.GetValue(i).As(Map).Get("almacen")
|
|
l_pCant.Tag = clv_prods_ll.GetValue(i).As(Map).Get("id")
|
|
' Log(clv_prods_ll.GetValue(i).As(Map).Get("id"))
|
|
' Private rs_img As ResultSet = Starter.skmt.ExecQuery($"select CAT_GP_IMG from cat_gunaprod where CAT_GP_ID = '${clv_prods_ll.GetValue(i).As(Map).Get("id")}'"$)
|
|
i_prod.Bitmap = clv_prods_ll.GetValue(i).As(Map).Get("img")
|
|
End If
|
|
' Log($"${i}, ${FirstIndex}, ${LastIndex}, ${Pnl.NumberOfViews}. ${clv_prods_ll.Size}"$)
|
|
Else 'Not visible
|
|
' If Pnl.NumberOfViews > 0 Then
|
|
' Pnl.RemoveAllViews 'Remove none visable item/layouts from the list/main layout
|
|
' End If
|
|
End If
|
|
PCLV.B4XSeekBar1.Value = clv_prods_ll.Size - FirstIndex
|
|
' Log($"Bar value: ${PCLV.B4XSeekBar1.Value}"$)
|
|
Next
|
|
End Sub
|
|
|
|
Sub et_busca_TextChanged (Old As String, New As String)
|
|
' Private inicioContador As String = DateTime.Now
|
|
If (New.Length = 1 Or New.Length = 2) And Not(forzarBusqueda) Then Return
|
|
forzarBusqueda = False
|
|
If lfila.text = "PROMOCIONES" Then
|
|
If Not(lv_promos.Visible) Then lv_promos.Visible = True
|
|
Private cPromo As Cursor=Starter.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_PRECIO, CAT_GP_ALMACEN, CAT_GP_IMG from ${query} where CAT_GP_NOMBRE like '%${New}%' and CAT_GP_ALMACEN > 0 AND CAT_GP_TIPO = 'PROMOS' AND CAT_GP_SUBTIPO = 'PROMOS' AND CAT_GP_TIPOPROD <> 1 and (length(CAT_GP_CODPROMO) = 1 OR CAT_GP_CODPROMO = CAT_GP_ID)"$)
|
|
Log($"res:${cPromo.RowCount}"$)
|
|
If cPromo.RowCount > 0 Then
|
|
lv_promos.Clear
|
|
For i=0 To cPromo.RowCount -1
|
|
cPromo.Position=i
|
|
Private tm As Map = Subs.procesaPromocion(cPromo.GetString("CAT_GP_ID"), clienteId)
|
|
If tm.Get("status") = "ok" Then 'Solo muestrala si hay producto.
|
|
lv_promos.AddTwoLines(cPromo.GetString("CAT_GP_NOMBRE"),"# " & cPromo.GetString("CAT_GP_ALMACEN") & " $ " & cPromo.GetString("CAT_GP_PRECIO") & " F:" & tm.Get("mp").As(Map).Get("prodsFijosCant") & " V:" & tm.Get("mp").As(Map).Get("prodsVariablesCant"))
|
|
End If
|
|
Next
|
|
Else
|
|
ToastMessageShow("No hay promociones disponibles.", False)
|
|
End If
|
|
cPromo.Close
|
|
Else
|
|
If Not(clv_prods_ll.AsView.Visible) Then clv_prods_ll.AsView.Visible = True
|
|
clv_prods_ll.Clear
|
|
listaProds.Initialize
|
|
listaHints.Initialize
|
|
Sleep(0)
|
|
Dim p As ResultSet = Starter.skmt.ExecQuery($"Select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_GP_IMG from cat_gunaprod where CAT_GP_NOMBRE like '%${New}%' and CAT_GP_PRECIO > 0 And CAT_GP_CLASIF <> 'PROMOS' order by CAT_GP_NOMBRE"$)
|
|
Log($"Llamamos LlenaProdsLL con ${p.RowCount} registros"$)
|
|
LlenaProdsLL(p, Null)
|
|
p.Close
|
|
End If
|
|
End Sub
|
|
|
|
Sub llenaCarrito
|
|
Private totalPedido As String = 0
|
|
Private cantPedido As String = 0
|
|
lv_promos.Visible = False
|
|
Subs.agrupador
|
|
' lv_carrito.Clear
|
|
clv_carrito.Clear
|
|
list_prodsPedido.Initialize
|
|
Private c_prods As Cursor=Starter.skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_FOLIO, PE_CEDIS, PE_PROID FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_PRONOMBRE")
|
|
' Log(c_prods.RowCount)
|
|
If c_prods.RowCount > 0 Then
|
|
c_prods.Position = 0
|
|
' lv_carrito.BringToFront
|
|
clv_carrito.AsView.BringToFront
|
|
Private cs As CSBuilder
|
|
For i = 0 To c_prods.RowCount -1
|
|
cs.Initialize
|
|
c_prods.Position = i
|
|
' Dim label1 As Label
|
|
' lv_carrito.TwoLinesLayout.ItemHeight = 50dip
|
|
' label1 = lv_carrito.TwoLinesLayout.Label
|
|
' label1.TextSize = 15
|
|
' label1.TextColor = Colors.Black
|
|
' label1.color = Colors.White
|
|
' 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.
|
|
' Dim label2 As Label
|
|
' label2 = lv_carrito.TwoLinesLayout.SecondLabel
|
|
' label2.TextSize = 10
|
|
' label2.TextColor = Colors.Blue
|
|
' label2.Tag = i
|
|
' Log(c_prods.GetString("PE_PRONOMBRE"))
|
|
' lv_carrito.AddTwoLines(cs.Color(textColor).append(c_prods.GetString("PE_PRONOMBRE")).pop,"Cantidad #"& c_prods.GetString("PE_CANT")& " SubTotal $"& c_prods.GetString("PE_COSTO_TOT")& " Folio "& c_prods.GetString("PE_FOLIO"))
|
|
Private tempMap As Map = CreateMap("prod":c_prods.GetString("PE_PRONOMBRE"), "almacen":1000, "id": c_prods.GetString("PE_PROID"), "cant": c_prods.GetString("PE_CANT"), "precio": c_prods.GetString("PE_COSTOU"), "precioT": c_prods.GetString("PE_COSTO_TOT"))
|
|
list_prodsPedido.Add(tempMap)
|
|
Private bmp As Bitmap = Subs.traeImgDeDB(c_prods.GetString("PE_PROID"))
|
|
' Private elTexto As String = cs.Color(Colors.red).append(c_prods.GetString("PE_PRONOMBRE")).pop.append(CRLF).Color(0xFF017F01).Append($"Precio $${NumberFormat2(c_prods.GetString("PE_COSTO_TOT"), 1, 2, 2, True)}"$).Popall
|
|
clv_carrito.Add(CreateListItem(c_prods.GetString("PE_PRONOMBRE"), c_prods.GetString("PE_CANT"), c_prods.GetString("PE_COSTO_TOT"), 1000, clv_carrito.AsView.Width, 150dip, bmp, c_prods.GetString("PE_PROID")), tempMap)
|
|
folio = 0
|
|
totalPedido = totalPedido + (c_prods.GetString("PE_COSTOU") * c_prods.GetString("PE_CANT"))
|
|
cantPedido = cantPedido + c_prods.GetString("PE_CANT")
|
|
If c_prods.GetString("PE_FOLIO") <> Null Then folio = c_prods.GetString("PE_FOLIO")
|
|
Next
|
|
Else
|
|
l_carritoVacio.Visible = True
|
|
l_carritoVacio.Text = "No hay productos en tu carrito."
|
|
End If
|
|
' Log(list_prodsPedido)
|
|
c_prods.Close
|
|
' l_total2.Text = $"$1.2{totalPedido}"$
|
|
' l_cant.Text = cantPedido
|
|
' If Subs.revisaImpresa Then b_rechazar.Visible = False Else b_rechazar.Visible = True
|
|
' p_vistaPreviaTrans.Width = Root.Width
|
|
' p_vistaPreviaTrans.Height = Root.Height
|
|
' Subs.centraPanel(p_vistaPrevia, Root.Width)
|
|
' p_vistaPrevia.Visible=True
|
|
' p_vistaPreviaTrans.Visible=True
|
|
End Sub
|
|
|
|
'Return the hint that will be displayed when the user fast scrolls the list. It can be a string or CSBuilder.
|
|
Sub PCLV_HintRequested(Index As Int) As Object
|
|
Dim word As String = listaHints.get(Index)
|
|
Return word
|
|
End Sub
|
|
|
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
|
|
|
Private Sub WobbleMenu1_Tab1Click
|
|
Subs.panelVisible(p_productos, 0, 0)
|
|
p_productos.Height = Root.Height - WobbleMenu1.Height
|
|
p_promos.Visible = False
|
|
p_carrito.Visible = False
|
|
p_historial.Visible = False
|
|
End Sub
|
|
|
|
Private Sub WobbleMenu1_Tab2Click
|
|
Subs.panelVisible(p_promos, 0, 0)
|
|
p_productos.Visible = False
|
|
p_carrito.Visible = False
|
|
p_historial.Visible = False
|
|
End Sub
|
|
|
|
Private Sub WobbleMenu1_Tab3Click
|
|
Subs.panelVisible(p_carrito, 0, 0)
|
|
' p_carrito.BringToFront
|
|
p_productos.Visible = False
|
|
p_promos.Visible = False
|
|
p_historial.Visible = False
|
|
l_carritoVacio.Visible = False
|
|
l_compraTerminada.Visible = False
|
|
llenaCarrito
|
|
If clv_carrito.Size > 0 Then p_botonesCarrito.Visible = True Else p_botonesCarrito.Visible = False
|
|
End Sub
|
|
|
|
Private Sub WobbleMenu1_Tab4Click
|
|
Subs.panelVisible(p_historial, 0, 0)
|
|
p_productos.Visible = False
|
|
p_carrito.Visible = False
|
|
p_promos.Visible = False
|
|
llenaHistorial
|
|
End Sub
|
|
|
|
Private Sub b_continuar_Click
|
|
WobbleMenu1.SetCurrentTab(2)
|
|
End Sub
|
|
|
|
Private Sub p_botonesVenta_Click
|
|
|
|
End Sub
|
|
|
|
Private Sub lv_promos_ItemClick (Position As Int, Value As Object)
|
|
|
|
End Sub
|
|
|
|
Private Sub p_promos_Click
|
|
'Para evitar que el clic en pantalla no se siga hacia atras
|
|
End Sub
|
|
|
|
Private Sub p_historial_Click
|
|
'Para evitar que el clic en pantalla no se siga hacia atras
|
|
End Sub
|
|
|
|
Private Sub p_carrito_Click
|
|
'Para evitar que el clic en pantalla no se siga hacia atras
|
|
End Sub
|
|
|
|
Private Sub b_buscar_Click
|
|
forzarBusqueda = True
|
|
et_busca_TextChanged("",et_busca.Text)
|
|
End Sub
|
|
|
|
Private Sub b_continuar2_Click
|
|
WobbleMenu1.SetCurrentTab(3)
|
|
End Sub
|
|
|
|
Private Sub b_terminar_Click
|
|
DateTime.DateFormat= $"yyMMdd-HHmmss-${clienteId}"$
|
|
Private id As String = DateTime.Date(DateTime.Now)
|
|
Starter.skmt.ExecNonQuery($"insert into cat_hist_compras (H_IDCOMPRA, H_FOLIO, H_RUTA, H_CEDIS, H_COSTO_TOT, H_COSTOU, H_CANT, H_PRONOMBRE, H_PROID, H_CLIENTE, H_FECHA) select '${id}', PE_FOLIO, PE_RUTA, PE_CEDIS, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_FECHA from pedido where pe_cliente = '${clienteId}'"$)
|
|
Starter.skmt.ExecNonQuery($"delete from pedido where pe_cliente = '${clienteId}'"$)
|
|
' lv_carrito.Clear
|
|
clv_carrito.Clear
|
|
' et_busca_TextChanged("", et_busca.Text)
|
|
LlenaProdsLL(Null, Null)
|
|
l_compraTerminada.Text = $"¡Felicidades!${CRLF}${CRLF}Tu compra con número de orden ${id} ha sido registrada.${CRLF}${CRLF}Llegará en tu siguiente día de entrega."$
|
|
l_compraTerminada.Visible = True
|
|
l_compraTerminada.BringToFront
|
|
l_totalCarrito.Text = ""
|
|
End Sub
|
|
|
|
Sub llenaHistorial
|
|
Dim rs_hist As ResultSet = Starter.skmt.ExecQuery($"Select h_idcompra, sum(h_costo_tot) as total, sum(h_cant) as cantidad, h_fecha from cat_hist_compras group by h_idcompra"$)
|
|
If rs_hist.RowCount > 0 Then
|
|
' c_prods.Position = 0
|
|
' l_total2.Text = c_prods.GetString("PE_COSTO_TOT")
|
|
' lv_historial.BringToFront
|
|
Private cs As CSBuilder
|
|
Do While rs_hist.NextRow
|
|
' Private rs_do As ResultSet = Starter.skmt.ExecQuery($"select * from CAT_HIST_COMPRAS where H_IDCOMPRA = '${rs_hist.GetString("H_IDCOMPRA")}'"$)
|
|
cs.Initialize
|
|
Dim label1 As Label
|
|
' lv_historial.TwoLinesLayout.ItemHeight = 50dip
|
|
label1 = lv_historial.TwoLinesLayout.Label
|
|
label1.TextSize = 16
|
|
label1.TextColor = Colors.red
|
|
label1.color = Colors.White
|
|
label1.Height = 30dip
|
|
' Private textColor As Int = Colors.black
|
|
Dim label2 As Label
|
|
label2 = lv_historial.TwoLinesLayout.SecondLabel
|
|
label2.TextSize = 14
|
|
label2.TextColor = Colors.RGB(1,127,1)
|
|
' Do While rs_do.NextRow
|
|
' Log($"${rs_do.GetString("H_IDCOMPRA")}, ${rs_do.GetString("H_PRONOMBRE")}, ${rs_do.GetString("H_CANT")}"$)
|
|
' Loop
|
|
Private fecha = rs_hist.GetString("H_FECHA")
|
|
fecha = fecha.SubString2(1,10)
|
|
lv_historial.AddTwoLines("Orden: " & rs_hist.GetString("H_IDCOMPRA"), $"Fecha: ${fecha}, Productos: ${rs_hist.GetString("cantidad")}, Total: $${NumberFormat2(rs_hist.GetString("total"), 1, 2, 2, True)}"$)
|
|
' totalPedido = totalPedido + (rs_hist.GetString("PE_COSTOU") * rs_hist.GetString("PE_CANT"))
|
|
' cantPedido = cantPedido + rs_hist.GetString("PE_CANT")
|
|
Loop
|
|
' Private c As Cursor = Starter.skmt.ExecQuery("select pc_noart, pc_monto from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
|
' c.Position=0
|
|
'' l_cant.Text = c.GetString("PC_NOART")
|
|
' c.Close
|
|
Else
|
|
l_historialVacio.Visible = True
|
|
l_historialVacio.Text = "No hay ordenes en tu historial."
|
|
End If
|
|
rs_hist.Close
|
|
End Sub
|
|
|
|
Sub CreateListItem(Text As String, cant As Int, precioU As String, inv As Int, Width As Int, Height As Int, img As Bitmap, prodId As String) As Panel
|
|
Dim p As B4XView = xui.CreatePanel("")
|
|
Dim cs As CSBuilder
|
|
cs.Initialize
|
|
p.SetLayoutAnimated(0, 0, 0, Width, Height)
|
|
p.LoadLayout("prodItemCarrito")
|
|
i_prod.Bitmap = img
|
|
l_prodX.TextSize = 15
|
|
p_prods.Height = Height
|
|
p_prods.Width = Width - 10
|
|
' Log($"${clv_carrito.AsView.Width}, ${Root.Width}, ${p_prods.Width}"$)
|
|
p_botMasMen.Left = p_prods.Width - (p_botMasMen.Width + 30)
|
|
l_prodX.Height = Height
|
|
l_prodX.Text = Text&CRLF&"# " & inv & " $ " & precioU
|
|
l_prodX.Text = cs.Color(Colors.red).append(Text).pop.append(CRLF).Color(0xFF017F01).Append($"Precio $${NumberFormat2(precioU, 1, 2, 2, True)}"$).Popall
|
|
l_prodX.Tag = $"ID: ${prodId}${CRLF}${Text}${CRLF}Precio: $$1.2{precioU}${CRLF}Inv: ${inv} pzs"$
|
|
l_pCant.Tag = precioU&"|"&inv&"|"&prodId
|
|
et_pCant.Tag = precioU&"|"&inv&"|"&prodId
|
|
et_pCant.Text = cant
|
|
et_pCant.BringToFront
|
|
Return p
|
|
End Sub
|
|
|
|
Private Sub b_borrar_Click
|
|
clv = clv_carrito
|
|
Private buttonTag As String = Sender.As(Button).tag
|
|
Dim index As Int = clv.GetItemFromView(Sender)
|
|
Msgbox2Async("¿Seguro que deseas borrar este producto?", "Borrar Producto", "Si", "", "No", Null, False)
|
|
Wait For Msgbox_Result (Result As Int)
|
|
If Result = DialogResponse.POSITIVE Then
|
|
LogColor("b_borrar_Click", Colors.Magenta)
|
|
Private precio As String=clv.GetValue(index).As(Map).Get("precio")
|
|
Private inv As Int = clv.GetValue(index).As(Map).Get("almacen")
|
|
Dim pnl0 As B4XView = clv.GetPanel(index)
|
|
Dim pnl As B4XView = pnl0.GetView(0)
|
|
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
|
If WobbleMenu1.GetCurrentTab = 3 Then laCant = pnl.GetView(2).GetView(4)
|
|
Log(laCant.text)
|
|
laCant.Text = "0"
|
|
Private id As String=clv.GetValue(index).As(Map).Get("id")
|
|
Private almacenX As String = Subs.traeAlmacen
|
|
Private nombreX As String = Subs.traeProdNombre(id)
|
|
Private precioX As String = precio
|
|
Subs.actualizaProducto(almacenX, precioX, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
|
' Log($"${almacenX}, ${precioX}, ${laCant.text}, ${nombreX}, ${id}, ${clienteId}, ${Subs.traeFecha}, ${Subs.traeUsuarioDeBD}, ${rutaUsuario}, 0, ${Starter.tipov}"$)
|
|
cuentaProds
|
|
llenaCarrito
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub lv_historial_ItemClick (Position As Int, Value As Object)
|
|
|
|
End Sub |