mirror of
https://github.com/KeymonSoft/DBCheck.git
synced 2026-04-20 20:59:17 +00:00
Se agregó´codigp para seleccionar base de datos, para editar almacen, ruta y ver clientes.
This commit is contained in:
@@ -22,6 +22,7 @@ Sub Class_Globals
|
||||
Private xui As XUI
|
||||
' Private b_cargar As Button
|
||||
Private b_enviar As Button
|
||||
Dim ime As IME
|
||||
Dim skmt As SQL
|
||||
Dim reqManager As DBRequestManager
|
||||
Private l_pedidos2 As Label
|
||||
@@ -49,6 +50,13 @@ Sub Class_Globals
|
||||
Private p_principal As Panel
|
||||
Private l_appInfo As Label
|
||||
Dim empresa, appVersion As String
|
||||
Private et_nuevaRuta As EditText
|
||||
Private et_nuevoAlmacen As EditText
|
||||
Private p_clientes As Panel
|
||||
Private lv_clientes As ListView
|
||||
Private clv_clientes As CustomListView
|
||||
Private p_item As Panel
|
||||
Private l_item As Label
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
@@ -67,14 +75,13 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Subs.centraPanel(p_progressDialog, Root.Width)
|
||||
Subs.centraPanel(p_editaRuta, Root.Width)
|
||||
Subs.centraPanel(p_editaAlmacen, Root.Width)
|
||||
' Subs.centraPanel(p_progressDialog, Root.Width)
|
||||
Subs.centraPanel(p_clientes, Root.Width)
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub B4XPage_Appear
|
||||
Log("INICIO")
|
||||
' Dim usuario As String = c.GetString("USUARIO")
|
||||
Dim in As Intent = B4XPages.GetNativeParent(Me).GetStartingIntent
|
||||
If in <> Null Then
|
||||
Log(in.GetData)
|
||||
@@ -108,7 +115,7 @@ Sub B4XPage_Appear
|
||||
Next
|
||||
l_appInfo.Text = $"${empresa} ${appVersion}"$
|
||||
End If
|
||||
Dim c As Cursor = skmt.ExecQuery($"select count(distinct pe_cliente) as pedidos, group_concat(distinct substr(pe_fecha, 4,2)) as diasVenta, sum(pe_costo_tot) as total, (select PE_CANT from pedido where PE_CANT = 0) as cantsEnCero, (select count(PE_CLIENTE) from pedido where printf("%d", PE_CLIENTE) <> PE_CLIENTE ) as clienteNoNumerico from pedido"$)
|
||||
Dim c As Cursor = skmt.ExecQuery($"select count(distinct pe_cliente) as pedidos, group_concat(distinct substr(pe_fecha, 4,2)) as diasVenta, sum(pe_costo_tot) as total, (select PE_CANT from pedido where PE_CANT = 0) as cantsEnCero, (select count(distinct PE_CLIENTE) from pedido where printf("%d", PE_CLIENTE) <> PE_CLIENTE ) as clienteNoNumerico from pedido"$)
|
||||
Log(c.RowCount)
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
@@ -408,9 +415,15 @@ Private Sub b_cargarBD_Click
|
||||
Private FH As FileHandler
|
||||
FH.Initialize
|
||||
Wait For (FH.Load) Complete (Result As LoadResult) 'Abre un fileManager para seleccionar la base de datos a importar.
|
||||
File.Copy(Result.Dir, Result.FileName, File.DirInternal, "kmt.db") 'Copia la base de datos seleccionada al directorio interno.
|
||||
skmt.Initialize(File.DirInternal,"kmt.db", True) 'Reiniciliza la base de datos con la recien importada.
|
||||
ToastMessageShow("¡BD importada!", False)
|
||||
Log("|" & Result.FileName & "|")
|
||||
If Result.FileName <> "" And Result.FileName <> Null Then
|
||||
p_clientes.Visible = False
|
||||
p_editaAlmacen.Visible = False
|
||||
p_editaRuta.Visible = False
|
||||
File.Copy(Result.Dir, Result.FileName, File.DirInternal, "kmt.db") 'Copia la base de datos seleccionada al directorio interno.
|
||||
skmt.Initialize(File.DirInternal,"kmt.db", True) 'Reiniciliza la base de datos con la recien importada.
|
||||
ToastMessageShow("¡BD importada!", False)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub l_ruta2_LongClick
|
||||
@@ -424,19 +437,54 @@ Private Sub l_almacen2_LongClick
|
||||
End Sub
|
||||
|
||||
Private Sub l_usuario2_LongClick
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub l_clienteNoNumerico_LongClick
|
||||
Private c As Cursor = skmt.ExecQuery($"select distinct pe_cliente as cliente from pedido"$)
|
||||
If c.RowCount > 0 Then
|
||||
clv_clientes.Clear
|
||||
For i = 0 To c.RowCount - 1
|
||||
c.Position = i
|
||||
clv_clientes.Add(CreateListItem(c.GetString("cliente")),i)
|
||||
Next
|
||||
End If
|
||||
p_clientes.Top = l_totalVenta.top
|
||||
p_clientes.BringToFront
|
||||
p_clientes.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub b_guardaRuta_Click
|
||||
p_editaRuta.Visible = False
|
||||
skmt.ExecNonQuery($"update "$)
|
||||
skmt.ExecNonQuery($"update pedido set pe_ruta = '${et_nuevaRuta.Text}' where pe_ruta = '${ruta}'"$)
|
||||
l_ruta2.Text = et_nuevaRuta.text
|
||||
End Sub
|
||||
|
||||
Private Sub b_guardaAlmacen_Click
|
||||
skmt.ExecNonQuery($"delete from cat_almacen"$)
|
||||
skmt.ExecNonQuery($"insert into cat_almacen (id_almacen) values ('${et_nuevoAlmacen.Text}')"$)
|
||||
l_almacen2.Text = et_nuevoAlmacen.text
|
||||
p_editaAlmacen.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub p_principal_Click
|
||||
p_editaAlmacen.Visible = False
|
||||
p_editaRuta.Visible = False
|
||||
p_clientes.Visible = False
|
||||
ime.HideKeyboard
|
||||
End Sub
|
||||
|
||||
Sub CreateListItem(mostrar As String) As Panel
|
||||
Dim p As B4XView = xui.CreatePanel("")
|
||||
p.SetLayoutAnimated(0, 0, 0, 1, 10)
|
||||
p.LoadLayout("listItem")
|
||||
p.Height= 36dip
|
||||
p.Width = clv_clientes.GetBase.Width
|
||||
p_item.Height = p.Height
|
||||
p_item.Width = p.Width
|
||||
l_item.Height = p.Height
|
||||
l_item.Width = p.Width
|
||||
l_item.Text = mostrar
|
||||
' cxc.Text = mostrar3
|
||||
' Log(p.Width)
|
||||
Return p
|
||||
End Sub
|
||||
Reference in New Issue
Block a user