mirror of
https://github.com/KeymonSoft/Durakelo.git
synced 2026-04-17 19:36:12 +00:00
12/1/24 - Cambios para la lista de precios de SuperQ
This commit is contained in:
@@ -140,7 +140,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
' B4XPages.AddPage("CheckList", checklist)
|
||||
' ruta = Starter.ruta
|
||||
ruta = File.DirInternal
|
||||
kh.Initialize(Me, "kh")
|
||||
kh.Initialize(Me, "kh", Starter.skmt)
|
||||
Provider.Initialize
|
||||
' If(FirstTime) Then
|
||||
' g.Initialize("GPS")
|
||||
@@ -151,7 +151,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
|
||||
' Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
||||
kh.guardaAppInfo(Starter.skmt)
|
||||
kh.guardaAppInfo
|
||||
Dim sDate, sTime As String
|
||||
DateTime.DateFormat = "yyyyMMdd"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
@@ -293,7 +293,7 @@ Sub B4XPage_Appear
|
||||
Else
|
||||
ToastMessageShow("No permission", True)
|
||||
End If
|
||||
Starter.usuario = kh.traeUsuarioDeDB(Starter.skmt)
|
||||
Starter.usuario = kh.traeUsuarioDeDB
|
||||
' dameUsuario 'Obtenemos el usuario registrado
|
||||
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
|
||||
End Sub
|
||||
|
||||
@@ -360,7 +360,7 @@ Sub Guardar_Click
|
||||
c.Close
|
||||
|
||||
Starter.skmt.ExecNonQuery("delete from pedido3")
|
||||
Starter.skmt.ExecNonQuery("INSERT INTO PEDIDO3 SELECT PE_PRECIO2, PE_TIPO, PE_FOLIO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, SUM(PE_COSTO_TOT) AS PE_COSTO_TOT, PE_COSTOU, SUM(PE_CANT) As PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, 1 As PE_FECHA, PE_USUARIO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) GROUP BY PE_PRECIO2, PE_TIPO, PE_FOLIO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, PE_COSTOU, PE_PRONOMBRE, PE_PROID, PE_CLIENTE ")
|
||||
Starter.skmt.ExecNonQuery("INSERT INTO PEDIDO3 SELECT PE_PRECIO2, PE_TIPO, PE_FOLIO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, SUM(PE_COSTO_TOT) AS PE_COSTO_TOT, PE_COSTOU, SUM(PE_CANT) As PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, 1 As PE_FECHA, PE_USUARIO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) GROUP BY PE_PRECIO2, PE_TIPO, PE_FOLIO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, PE_COSTOU, PE_PRONOMBRE, PE_PROID, PE_CLIENTE")
|
||||
c=Starter.skmt.ExecQuery("select PE_PRECIO2,PE_TIPO,PE_FOLIO,PE_DESC,PE_COSTO_SIN,PE_RUTA,PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE, PE_FECHA,PE_USUARIO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
|
||||
If c.RowCount>0 Then
|
||||
|
||||
@@ -772,7 +772,7 @@ Sub Subir_Click
|
||||
|
||||
t1.Initialize("T1", 20000) ' 1000 = 1 second
|
||||
t1.Enabled = True
|
||||
|
||||
|
||||
img2.Visible =True
|
||||
' ToastMessageShow("Se Actualizaran los datos, Este proceso podria tardar hasta un minuto, gracias "& l_ruta.text , True)
|
||||
If S_CP.Text = "SUBIENDO" Then
|
||||
@@ -840,10 +840,9 @@ Sub cargar_Click
|
||||
c=skmt.ExecQuery("select usuario from usuarioa")
|
||||
c.Position = 0
|
||||
usuario = c.GetString("USUARIO")
|
||||
|
||||
|
||||
|
||||
reqManager.reqsList.Initialize 'inicializamos lista de requests.
|
||||
|
||||
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name ="insert_drop2_DUR"
|
||||
@@ -1016,8 +1015,10 @@ Sub cargar_Click
|
||||
|
||||
ToastMessageShow("Se Actualizaran los datos, Este proceso podria tardar hasta un minuto, gracias" , True)
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
|
||||
LogColor($">>>>>> Llega ${Job.tag}"$, Colors.Blue)
|
||||
If reqManager.reqsList.IndexOf(Job.tag) <> -1 Then
|
||||
reqManager.reqsList.RemoveAt(reqManager.reqsList.IndexOf(Job.tag))
|
||||
LogColor($">>>>>> Quitamos ${Job.tag}"$, Colors.Blue)
|
||||
@@ -1029,7 +1030,6 @@ Sub JobDone(Job As HttpJob)
|
||||
If Job.ErrorMessage = "STREAM" Then
|
||||
If CARGA = "SUBIR" Then
|
||||
PB2.Progress = PB2.Progress + PORCENTAJE
|
||||
|
||||
If S_CP.Text = "EN PROCESO" Then
|
||||
S_CP.Text = "SUBIENDO"
|
||||
End If
|
||||
@@ -1055,7 +1055,6 @@ Sub JobDone(Job As HttpJob)
|
||||
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, Colors.red)
|
||||
End If
|
||||
|
||||
|
||||
If RESULT.Tag = "kmt_datos" Then 'query tag
|
||||
skmt.BeginTransaction
|
||||
Try
|
||||
|
||||
@@ -95,7 +95,9 @@ Sub Class_Globals
|
||||
Dim list_prodsPedido As List
|
||||
' Private b_rmi As Button
|
||||
Private l_mDisponible As Label
|
||||
dim nuevaCantRMI as int
|
||||
Dim nuevaCantRMI As Int
|
||||
Private lv_precio2 As ListView
|
||||
Private cb_precio2 As B4XComboBox
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -110,7 +112,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
' Activity.RemoveAllViews
|
||||
Root.LoadLayout("productos")
|
||||
ruta = File.DirInternal
|
||||
kh.Initialize(Me, "kh")
|
||||
kh.Initialize(Me, "kh", Starter.skmt)
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
@@ -152,8 +154,8 @@ Sub B4XPage_Appear
|
||||
' clv_prods_ll.Initialize(Me, "clv_prods_ll")
|
||||
' list_prodsPedido.Initialize
|
||||
' Log("list_prodsPedido.Initialize")
|
||||
clienteId = kh.traeCliente(Starter.skmt)
|
||||
rutaUsuario = kh.traeRuta(Starter.skmt)
|
||||
clienteId = kh.traeCliente
|
||||
rutaUsuario = kh.traeRuta
|
||||
If p_rmi.Visible Then p_rmi.Visible = False
|
||||
' l_mDisponible.Visible = False
|
||||
' Starter.skmt.ExecNonQuery2("UPDATE CAT_GUNAPROD SET CAT_GP_TIPOPROD = (?) WHERE CAT_GP_TIPOPROD = (?) ",Array As Object("PRIORITARIO","1"))
|
||||
@@ -208,7 +210,7 @@ Sub B4XPage_Appear
|
||||
c = Starter.skmt.ExecQuery("select count(*) as hayPromos from promos_comp")
|
||||
c.Position = 0
|
||||
' Log(Subs.revisaImpresa)
|
||||
If c.GetInt("hayPromos") > 0 And clienteId <> 0 And kh.revisaImpresa(Starter.skmt) = False Then
|
||||
If c.GetInt("hayPromos") > 0 And clienteId <> 0 And kh.revisaImpresa = False Then
|
||||
lv_catalogos.AddSingleLine("PROMOS")
|
||||
End If
|
||||
Sleep(100)
|
||||
@@ -223,7 +225,7 @@ Sub B4XPage_Appear
|
||||
Dim m As Map = Subs.traeTotalesClienteActual
|
||||
prodsPedidoActual = m.Get("productos")
|
||||
montoPedidoActual = m.Get("monto")
|
||||
hayPedido = kh.hayPedido(Starter.skmt)
|
||||
hayPedido = kh.hayPedido
|
||||
' LogColor("Pedido ant? - "&hayPedido, Colors.Magenta)
|
||||
If reiniciarlistaProds Then
|
||||
' Log("Llamamos LlenaProdsLL")
|
||||
@@ -442,6 +444,8 @@ Private Sub B4XPage_CloseRequest As ResumableSub
|
||||
If p_rmi.Visible Then p_rmi.Visible = False
|
||||
If l_info.Visible Then
|
||||
l_info.Visible = False
|
||||
lv_precio2.Visible = False
|
||||
cb_precio2.mBase.Visible = False
|
||||
Return False
|
||||
else if p_vistaPreviaTrans.Visible Then
|
||||
p_vistaPreviaTrans.Visible = False
|
||||
@@ -531,6 +535,7 @@ Sub b_prodMenos_Click
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Private precio2 As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
' Log($"precio|stock:${laCant.tag}"$)
|
||||
' Log("lacant.text="&laCant.text & "|" & buttonTag)
|
||||
If buttonTag = "vendido" And laCant.Text > 0 Then
|
||||
@@ -560,7 +565,7 @@ Sub b_prodMenos_Click
|
||||
precioX = precioX * -1
|
||||
End If
|
||||
Log(">>>>>>> Insertamos prod desde prodMenos")
|
||||
Subs.actualizaProducto(almacenX, precioX, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
||||
Subs.actualizaProducto(almacenX, precioX, precio2, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
||||
cuentaProds
|
||||
If Subs.totalPedido < 1 Then laCant.Text = "0"
|
||||
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
@@ -577,7 +582,9 @@ Sub b_prodMas_Click
|
||||
If laCant.Text = "" Then laCant.Text = 0
|
||||
' Private tmpMap As Map = clv_prods_ll.GetValue(index).As(Map)
|
||||
Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
Private precio2 As String = precio
|
||||
Private inv As Int = clv_prods_ll.GetValue(index).As(Map).Get("almacen")
|
||||
Log(clv_prods_ll.GetValue(index))
|
||||
If buttonTag = "vendido" Then
|
||||
If inv > 0 And (laCant.Text + 1 <= inv) And (Subs.totalPedido - precio > 1) Then
|
||||
' Log(clv_prods_ll.GetValue(index).As(Map))
|
||||
@@ -607,7 +614,7 @@ Sub b_prodMas_Click
|
||||
precioX = precioX * -1
|
||||
End If
|
||||
Log(">>>>>>> Insertamos prod desde prodMas")
|
||||
Subs.actualizaProducto(almacenX, precioX, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
||||
Subs.actualizaProducto(almacenX, precioX, precio2, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
||||
cuentaProds
|
||||
If Subs.totalPedido < 1 Then
|
||||
etCantHasFocus = True
|
||||
@@ -649,6 +656,7 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
' Log(clv_prods_ll.GetValue(index).As(Map))
|
||||
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
private precio2 as string = precio
|
||||
' Log("++++++++++ " & precio)
|
||||
Dim tempTot As String = Subs.totalPedido
|
||||
Dim disp As String = 0
|
||||
@@ -685,7 +693,7 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
' End If
|
||||
If Not(Old = "0" And New = "") And laCant.Text <> Null And laCant.Text <> "" And etCantHasFocus Then
|
||||
Log(">>>>>> Insertamos prod desde et_pCante_TextChanged")
|
||||
Subs.actualizaProducto(almacenX, precioX, laCant.Text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
||||
Subs.actualizaProducto(almacenX, precioX, precio2, laCant.Text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
||||
cuentaProds
|
||||
End If
|
||||
Catch
|
||||
@@ -708,7 +716,7 @@ Sub cuentaProds
|
||||
' LogColor(prodsMap, Colors.Magenta)
|
||||
p_botonesVenta.Visible = True
|
||||
p_botonesVenta.BringToFront
|
||||
c.Position=0
|
||||
c.Position = 0
|
||||
' If Subs.totalPedido > 1 And lfila.Text <> "RMI" And Starter.tipov <> "ABORDO" Then b_rmi.Visible = True Else b_rmi.Visible = False
|
||||
Log(Subs.totalPedido)
|
||||
If lfila.Text = "RMI" Then l_mDisponible.Visible = True Else l_mDisponible.Visible = False
|
||||
@@ -812,6 +820,8 @@ End Sub
|
||||
|
||||
Private Sub l_info_Click
|
||||
l_info.Visible = False
|
||||
lv_precio2.Visible = False
|
||||
cb_precio2.mBase.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub lv_promos_ItemLongClick (Position As Int, Value As Object)
|
||||
@@ -991,8 +1001,42 @@ Sub l_prodX_Click
|
||||
Log("l_prodx clicked")
|
||||
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 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
|
||||
|
||||
Dim Label1, Label2 As Label
|
||||
Label1 = lv_precio2.SingleLineLayout.Label
|
||||
Label1.TextSize = 14
|
||||
Label1.TextColor = Colors.black
|
||||
' Label2 = lv_precio2.TwoLinesLayout.SecondLabel
|
||||
' Label2.TextSize = 14
|
||||
' Label2.TextColor = Colors.DarkGray
|
||||
|
||||
If c.RowCount > 0 Then
|
||||
Private losPreciosList As List
|
||||
losPreciosList.Initialize
|
||||
' l_info.Height = 250dip
|
||||
' lv_precio2.Visible = True
|
||||
cb_precio2.mBase.Visible = True
|
||||
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"))
|
||||
Next
|
||||
cb_precio2.SetItems(losPreciosList)
|
||||
End If
|
||||
l_info.BringToFront
|
||||
l_info.Visible = True
|
||||
cb_precio2.mbase.BringToFront
|
||||
' Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
|
||||
' Private p0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
' Private p As B4XView = p0.GetView(0)
|
||||
@@ -1304,3 +1348,16 @@ Private Sub b_rmi_Click
|
||||
clv_prods_ll.AsView.Visible = True
|
||||
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)
|
||||
l_info.Visible = False
|
||||
lv_precio2.Visible = False
|
||||
cb_precio2.mBase.Visible = False
|
||||
End Sub
|
||||
@@ -382,11 +382,11 @@ Private Sub b_terminar1_Click
|
||||
' Log($"${prodsIds}${CRLF}${prodsCants}${CRLF}${prodsPrecios}"$)
|
||||
For t = 0 To prodsIds.Size - 1 'Guardamos los productos fijos de la promocion en pedido.
|
||||
Private pn As String = Subs.traeProdNombre(prodsIds.Get(t))
|
||||
If prodsCants.Get(t) > 0 Then Subs.guardaProductoSinGestion(estaPromo, prodsPrecios.Get(t), prodsCants.Get(t), pn, prodsIds.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, Starter.tipov)
|
||||
If prodsCants.Get(t) > 0 Then Subs.guardaProductoSinGestion(estaPromo, prodsPrecios.Get(t), prodsPrecios.Get(t), prodsCants.Get(t), pn, prodsIds.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, Starter.tipov)
|
||||
Next
|
||||
For t = 0 To prodsIds2.Size - 1 'Guardamos los productos variables de la promocion en pedido.
|
||||
Private pn As String = Subs.traeProdNombre(prodsIds2.Get(t))
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios2.Get(t), prodsCants2.Get(t), pn, prodsIds2.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, Starter.tipov)
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios2.Get(t), prodsPrecios2.Get(t), prodsCants2.Get(t), pn, prodsIds2.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, Starter.tipov)
|
||||
Next
|
||||
lv_prodsFijos.Clear
|
||||
B4XPages.MainPage.bTerminarClicked = True
|
||||
@@ -400,11 +400,11 @@ Private Sub b_continuar_Click
|
||||
' Log($"${prodsIds}${CRLF}${prodsCants}${CRLF}${prodsPrecios}"$)
|
||||
For t = 0 To prodsIds.Size - 1 'Guardamos los productos fijos de la promocion en pedido.
|
||||
Private pn As String = Subs.traeProdNombre(prodsIds.Get(t))
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios.Get(t), prodsCants.Get(t), pn, prodsIds.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, Starter.tipov)
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios.Get(t), prodsPrecios.Get(t), prodsCants.Get(t), pn, prodsIds.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, Starter.tipov)
|
||||
Next
|
||||
For t = 0 To prodsIds2.Size - 1 'Guardamos los productos variables de la promocion en pedido.
|
||||
Private pn As String = Subs.traeProdNombre(prodsIds2.Get(t))
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios2.Get(t), prodsCants2.Get(t), pn, prodsIds2.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, Starter.tipov)
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios2.Get(t), prodsPrecios2.Get(t), prodsCants2.Get(t), pn, prodsIds2.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, Starter.tipov)
|
||||
Next
|
||||
lv_prodsFijos.Clear
|
||||
' Activity_KeyPress(KeyCodes.KEYCODE_BACK)
|
||||
|
||||
@@ -43,7 +43,7 @@ ModuleBreakpoints7=
|
||||
ModuleBreakpoints8=
|
||||
ModuleBreakpoints9=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=2,3,4,5,6,7
|
||||
ModuleClosedNodes1=2,3,6,7
|
||||
ModuleClosedNodes10=
|
||||
ModuleClosedNodes11=
|
||||
ModuleClosedNodes12=
|
||||
@@ -64,6 +64,6 @@ ModuleClosedNodes6=1
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=Visual Designer,productos.bal,-100,2,C_Productos,et_pCant_FocusChanged,631,1,C_Productos,b_prodMas_Click,613,0,DBRequestManager,Initialize,23,0,DBRequestManager,WriteObject,113,0,DBRequestManager,Class_Globals,12,0,C_Principal,Class_Globals,0,0,DBRequestManager,ExecuteQuery,28,0,C_Principal,cargar_Click,1011,6,C_Principal,JobDone,1021,6
|
||||
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
|
||||
SelectedBuild=0
|
||||
VisibleModules=19,1,8,16,6,3,7,9,20,10
|
||||
VisibleModules=19,1,8,16,6,3,7,9,20,10,21
|
||||
|
||||
Binary file not shown.
@@ -26,7 +26,7 @@ Sub Process_Globals
|
||||
Dim Timer1 As Timer
|
||||
Dim Interval As Int = 300
|
||||
Private flpStarted As Boolean
|
||||
Dim DBReqServer As String = "http://keymon.lat:1782"
|
||||
Dim DBReqServer As String = "http://keymon.lat:1781"
|
||||
Dim FECHA_HOY As String
|
||||
Dim tipov As String = ""
|
||||
Dim rutav As String = "0"
|
||||
@@ -38,15 +38,15 @@ Sub Service_Create
|
||||
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
|
||||
BTAdmin.Initialize("admin")
|
||||
' serial.Initialize("serial")
|
||||
If BTAdmin.IsEnabled = False Then
|
||||
If BTAdmin.Enable = False Then
|
||||
ToastMessageShow("Error enabling Bluetooth adapter.", True)
|
||||
Else
|
||||
ToastMessageShow("Enabling Bluetooth adapter...", False)
|
||||
End If
|
||||
Else
|
||||
BluetoothState = True
|
||||
End If
|
||||
' If BTAdmin.IsEnabled = False Then
|
||||
' If BTAdmin.Enable = False Then
|
||||
' ToastMessageShow("Error enabling Bluetooth adapter.", True)
|
||||
' Else
|
||||
' ToastMessageShow("Enabling Bluetooth adapter...", False)
|
||||
' End If
|
||||
' Else
|
||||
' BluetoothState = True
|
||||
' End If
|
||||
Timer1.Initialize("Timer1", Interval * 1000)
|
||||
Timer1.Enabled = True
|
||||
End Sub
|
||||
|
||||
16
B4A/Subs.bas
16
B4A/Subs.bas
@@ -738,13 +738,13 @@ End Sub
|
||||
'Inserta un producto en la tabla "pedido" y "pedido_cliente" y actualiza "cat_gunaprod".
|
||||
'NO ACTUALIZA LA BANDERA DE GESTION EN LA TABLA "kmt_info".
|
||||
'Si "gestion=2" entonces el sistema considera que el pedido ya se guardó y ya no se debe modificar.
|
||||
Sub guardaProductoSinGestion(cedis As String, costoU As String, cant As String, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
Sub guardaProductoSinGestion(cedis As String, costoU As String, precio2 As String, cant As String, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
If nombre.Length < 6 Then ToastMessageShow("(guardaProductoSinGestion) El nombre del producto no es valido " & nombre, True)
|
||||
LogColor("guardaProductoSinGestion: "&prodId&", cant="&cant&", tipo="&tipoVenta, Colors.Magenta)
|
||||
Private c As Cursor
|
||||
' Private tablaProds As String = "cat_gunaprod2"
|
||||
' If tipoVenta = "ABORDO" Then tablaProds = "cat_gunaprod"
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_FECHA, PE_USUARIO, PE_RUTA, PE_COSTO_SIN, PE_TIPO) VALUES(?,?,?,?,?,?,?,?,?,?,?,?) ", Array As Object (cedis, (cant * costoU), costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS, PE_PRECIO2, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_FECHA, PE_USUARIO, PE_RUTA, PE_COSTO_SIN, PE_TIPO) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?) ", Array As Object (cedis, precio2, (cant * costoU), costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta))
|
||||
'Actualizamos el inventario en cat_gunaprod solo si no es RMI
|
||||
If cedis <> "DUR" Then Starter.skmt.ExecNonQuery2($"update ${traeTablaProds(tipoVenta)} set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "$, Array As Object(cant, prodId))
|
||||
c=Starter.skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
@@ -770,7 +770,7 @@ Sub guardaProductoSin(cedis As String, costoTot As String, costoU As String, can
|
||||
ToastMessageShow("guardaProdSin", False)
|
||||
End Sub
|
||||
|
||||
Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
Sub actualizaProducto(cedis As String, costoU As String, precio2 As String, cant As String, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
If nombre.Length < 6 Then ToastMessageShow("(actualizaProducto) El nombre del producto no es valido " & nombre, True)
|
||||
LogColor($"actualizaProducto, p=${prodId}, nombre=${nombre}, cant=${cant}, cedis=${cedis}, tipo=${tipoVenta}, ${traeTablaProds(tipoVenta)}"$, Colors.Magenta)
|
||||
' Private tablaProds As String = "cat_gunaprod2"
|
||||
@@ -795,7 +795,7 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre
|
||||
Else
|
||||
'INSERTAMOS
|
||||
LogColor("INSERTAMOS PROD", Colors.red)
|
||||
If cant > 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta)
|
||||
If cant > 0 Then guardaProductoSinGestion(cedis, costoU, precio2, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta)
|
||||
End If
|
||||
c.Close
|
||||
End Sub
|
||||
@@ -1302,10 +1302,10 @@ Sub totalPedido As String
|
||||
Private pTotal As String = "0"
|
||||
If cT.RowCount > 0 Then
|
||||
cT.Position = 0
|
||||
' Log("|"&cT.GetLong("total")&"|"&pTotal)
|
||||
Private tempT As String = cT.GetLong("total")
|
||||
If tempT <> "null" And tempT <> Null Then
|
||||
' Log("|"&cT.GetLong("total")&"|")
|
||||
Private tempT As String = cT.GetString("total")
|
||||
' Log("|"&tempT&"|"&pTotal)
|
||||
If tempT <> Null And tempT <> "null" Then
|
||||
' Log("|"&cT.GetString("total")&"|")
|
||||
pTotal = tempT
|
||||
End If
|
||||
' Log($"Cliente actual=${traeCliente}, hayPedido=${hay}"$)
|
||||
|
||||
@@ -21,12 +21,14 @@ Sub Class_Globals
|
||||
' Private mesEventName As String
|
||||
Dim RD_Init_IsInitialized As Boolean = False
|
||||
Dim btAdmin As BluetoothAdmin
|
||||
Private khdb As SQL
|
||||
End Sub
|
||||
|
||||
'Inicializa la clase "kms_helperSubs".
|
||||
Public Sub Initialize (vCallback As Object, vEventName As String) As Object
|
||||
Public Sub Initialize (vCallback As Object, vEventName As String, db As SQL) As Object
|
||||
EventName = vEventName
|
||||
CallBack = vCallback
|
||||
khdb = db
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
@@ -278,10 +280,10 @@ Sub centraProgressBar(elemento As ProgressBar, anchoElementoSuperior As Int) 'ig
|
||||
End Sub
|
||||
|
||||
'Regresa el usuario de la tabla USUARIOA, si no lo encuentra regresa "SinUsuario"
|
||||
Sub traeUsuarioDeDB(db As SQL) As String 'ignore
|
||||
Sub traeUsuarioDeDB As String 'ignore
|
||||
Private c As Cursor
|
||||
Private u As String = "SinUsuario"
|
||||
c = db.ExecQuery("select USUARIO from usuarioa")
|
||||
c = khdb.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
If c.RowCount > 0 Then u = c.GetString("USUARIO")
|
||||
c.Close
|
||||
@@ -289,10 +291,10 @@ Sub traeUsuarioDeDB(db As SQL) As String 'ignore
|
||||
End Sub
|
||||
|
||||
'Regresa el almacen actual de la base de datos.
|
||||
Sub traeAlmacen(db As SQL) As String 'ignore
|
||||
Sub traeAlmacen As String 'ignore
|
||||
Private c As Cursor
|
||||
Private a As String
|
||||
c = db.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
|
||||
c = khdb.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
|
||||
c.Position = 0
|
||||
a = c.GetString("ID_ALMACEN")
|
||||
c.Close
|
||||
@@ -300,10 +302,10 @@ Sub traeAlmacen(db As SQL) As String 'ignore
|
||||
End Sub
|
||||
|
||||
'Regresa el nombre del producto desde CAT_GUNAPROD.
|
||||
Sub traeProdNombre(db As SQL, id As String) As String 'ignore
|
||||
Sub traeProdNombre(id As String) As String 'ignore
|
||||
Private h As Cursor
|
||||
Private n As String
|
||||
h = db.ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ", Array As String(id.Trim))
|
||||
h = khdb.ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ", Array As String(id.Trim))
|
||||
If h.RowCount > 0 Then
|
||||
h.Position = 0
|
||||
n = h.GetString("CAT_GP_NOMBRE")
|
||||
@@ -316,10 +318,10 @@ Sub traeProdNombre(db As SQL, id As String) As String 'ignore
|
||||
End Sub
|
||||
|
||||
'Regresa la ruta actual de la base de datos.
|
||||
Sub traeRuta(db As SQL) As String 'ignore
|
||||
Sub traeRuta As String 'ignore
|
||||
Private c As Cursor
|
||||
Private r As String
|
||||
c = db.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c = khdb.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
r = "0"
|
||||
If c.RowCount > 0 Then
|
||||
c.Position=0
|
||||
@@ -330,10 +332,10 @@ Sub traeRuta(db As SQL) As String 'ignore
|
||||
End Sub
|
||||
|
||||
'Regresa el cliente actual de la base de dtos (CUENTAA).
|
||||
Sub traeCliente(db As SQL) As String 'ignore
|
||||
Sub traeCliente As String 'ignore
|
||||
Private c As Cursor
|
||||
Private cl As String
|
||||
c = db.ExecQuery("Select CUENTA from cuentaa")
|
||||
c = khdb.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
cl = c.GetString("CUENTA")
|
||||
c.Close
|
||||
@@ -342,10 +344,10 @@ End Sub
|
||||
|
||||
'Regresa en un mapa el total de productos y monto del pedido del cliente actual
|
||||
'resultado = {"productos":"antidad_de_productos", "monto":"costo_total"}
|
||||
Sub traeTotalesClienteActual(db As SQL) As Map 'ignore
|
||||
Sub traeTotalesClienteActual As Map 'ignore
|
||||
Private m As Map
|
||||
m.Initialize
|
||||
Private c_prodsX As Cursor = db.ExecQuery("select ifnull(sum(PE_CANT), 0) as cantProds, ifnull(sum(PE_COSTO_TOT), 0) as costoTotal FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")
|
||||
Private c_prodsX As Cursor = khdb.ExecQuery("select ifnull(sum(PE_CANT), 0) as cantProds, ifnull(sum(PE_COSTO_TOT), 0) as costoTotal FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")
|
||||
c_prodsX.Position = 0
|
||||
' LogColor($"Productos de la orden: ${c_prodsX.GetString("cantProds")}, Total: ${c_prodsX.GetString("costoTotal")}"$, Colors.red)
|
||||
m = CreateMap("productos": c_prodsX.GetString("cantProds"), "monto" : c_prodsX.GetString("costoTotal"))
|
||||
@@ -355,27 +357,27 @@ End Sub
|
||||
'Borra el pedido del cliente actual.
|
||||
'Borra los registros de la tabla "PEDIDO" y "PEDIDO_CLIENTE"
|
||||
'Actualiza las tablas "cat_gunaprod" y "kmt_info".
|
||||
Sub borraPedidoClienteActual(db As SQL) As String 'ignore
|
||||
Sub borraPedidoClienteActual As String 'ignore
|
||||
Private thisC As Cursor
|
||||
thisC = db.ExecQuery("select PE_PROID,PE_CANT FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
thisC = khdb.ExecQuery("select PE_PROID,PE_CANT FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
If thisC.RowCount>0 Then
|
||||
For i=0 To thisC.RowCount -1
|
||||
thisC.Position=i
|
||||
db.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?", Array As Object(thisC.GetString("PE_CANT"),thisC.GetString("PE_PROID")))
|
||||
db.ExecNonQuery2("INSERT INTO INVENT_X_ENVIAR (ALMACEN , PROID , CANTIDAD ) VALUES(?,?,?) ", Array As Object (traeAlmacen(db), thisC.GetString("PE_PROID"),thisC.GetString("PE_CANT")* -1))
|
||||
khdb.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?", Array As Object(thisC.GetString("PE_CANT"),thisC.GetString("PE_PROID")))
|
||||
khdb.ExecNonQuery2("INSERT INTO INVENT_X_ENVIAR (ALMACEN , PROID , CANTIDAD ) VALUES(?,?,?) ", Array As Object (traeAlmacen, thisC.GetString("PE_PROID"),thisC.GetString("PE_CANT")* -1))
|
||||
Next
|
||||
End If
|
||||
db.ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
db.ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)")
|
||||
db.ExecNonQuery("UPDATE kmt_info set gestion = 0 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
khdb.ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
khdb.ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)")
|
||||
khdb.ExecNonQuery("UPDATE kmt_info set gestion = 0 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Return 1
|
||||
End Sub
|
||||
|
||||
'Regresa verdadero si la columna gestion en la tabla "kmt_info" tene valor 2.
|
||||
'si no, entonces regresa falso.
|
||||
Sub pedidoGuardado(db As SQL) As Boolean 'ignore
|
||||
Sub pedidoGuardado As Boolean 'ignore
|
||||
Private guardado As Boolean = False
|
||||
Private g As Cursor = db.ExecQuery("select gestion from kmt_info where CAT_CL_CODIGO in (Select CUENTA from cuentaa)")
|
||||
Private g As Cursor = khdb.ExecQuery("select gestion from kmt_info where CAT_CL_CODIGO in (Select CUENTA from cuentaa)")
|
||||
If g.RowCount > 0 Then
|
||||
g.Position=0
|
||||
If g.GetString("gestion") = "2" Then guardado = True
|
||||
@@ -385,8 +387,8 @@ Sub pedidoGuardado(db As SQL) As Boolean 'ignore
|
||||
End Sub
|
||||
|
||||
'Regresa verdadero si hay pedido en la tabla "PEDIDO" del cliente actual.
|
||||
Sub hayPedido(db As SQL) As Boolean 'ignore
|
||||
Private thisC As Cursor = db.ExecQuery($"select count(PE_CLIENTE) as hayPedido from PEDIDO where PE_CLIENTE = '${traeCliente(db)}'"$)
|
||||
Sub hayPedido As Boolean 'ignore
|
||||
Private thisC As Cursor = khdb.ExecQuery($"select count(PE_CLIENTE) as hayPedido from PEDIDO where PE_CLIENTE = '${traeCliente}'"$)
|
||||
thisC.Position = 0
|
||||
Private hay As Boolean = False
|
||||
If thisC.GetInt("hayPedido") > 0 Then hay = True
|
||||
@@ -395,19 +397,38 @@ Sub hayPedido(db As SQL) As Boolean 'ignore
|
||||
End Sub
|
||||
|
||||
'Regresa verdadero si el usuario actual ya imprimio su venta
|
||||
Sub revisaImpresa (db As SQL) As Boolean
|
||||
Sub revisaImpresa As Boolean
|
||||
Dim imp As Boolean = False
|
||||
Dim i As Cursor = db.ExecQuery("select count(*) as CUANTOS from kmt_info where (impresion = 1 or cat_cl_codigo in (select ci_cuenta from cliente_impreso)) and CAT_CL_CODIGO in (Select CUENTA from cuentaa)")
|
||||
Dim i As Cursor = khdb.ExecQuery("select count(*) as CUANTOS from kmt_info where (impresion = 1 or cat_cl_codigo in (select ci_cuenta from cliente_impreso)) and CAT_CL_CODIGO in (Select CUENTA from cuentaa)")
|
||||
i.Position = 0
|
||||
If i.GetString("CUANTOS") > 0 Then imp = True Else imp = False
|
||||
Return imp
|
||||
End Sub
|
||||
|
||||
'Guarda el nombre y version de la app en CAT_VARIABLES.
|
||||
Sub guardaAppInfo(db As SQL) 'ignore
|
||||
db.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'EMPRESA' or CAT_VA_DESCRIPCION = 'APP_NAME' or CAT_VA_DESCRIPCION = 'APP_VERSION'")
|
||||
db.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_NAME', '${Application.LabelName}')"$)
|
||||
db.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_VERSION', '${Application.VersionName}')"$)
|
||||
Sub guardaAppInfo 'ignore
|
||||
khdb.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'EMPRESA' or CAT_VA_DESCRIPCION = 'APP_NAME' or CAT_VA_DESCRIPCION = 'APP_VERSION'")
|
||||
khdb.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_NAME', '${Application.LabelName}')"$)
|
||||
khdb.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_VERSION', '${Application.VersionName}')"$)
|
||||
End Sub
|
||||
|
||||
'Regresa el Id del producto con el nombre dado y el tipo de venta dado.
|
||||
Sub traeProdIdConNombre(n As String, tipoVenta As String) As String
|
||||
Private elId As String = "N/A"
|
||||
Private n0 As Cursor = khdb.ExecQuery($"select CAT_GP_ID from ${traeTablaProds(tipoVenta)} where CAT_GP_NOMBRE = '${n}'"$)
|
||||
If n0.RowCount > 0 Then
|
||||
n0.Position = 0
|
||||
elId = n0.GetString("CAT_GP_ID")
|
||||
End If
|
||||
Return elId
|
||||
End Sub
|
||||
|
||||
'Regresa la tabla de productos (cat_gunaprod o cat_gunaprod2) dependiendo del tipo de venta.
|
||||
Sub traeTablaProds(tipoventa As String) As String 'ignore
|
||||
Private tablaProds As String = "cat_gunaprod2"
|
||||
If tipoventa = "ABORDO" Or tipoventa = "PREVENTA" Then tablaProds = "cat_gunaprod"
|
||||
' LogColor($"Tipo= ${tipoventa}, tabla=${tablaProds}"$, Colors.RGB(200,136,0))
|
||||
Return tablaProds
|
||||
End Sub
|
||||
|
||||
'Muestra en el Log los campos y valores que regresan en el JobDone.
|
||||
|
||||
Reference in New Issue
Block a user