mirror of
https://github.com/KeymonSoft/DBCheck.git
synced 2026-04-17 19:37:09 +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
|
||||
@@ -1,30 +1,34 @@
|
||||
Build1=Default,dbcheck.keymon.lat,HU2_PUBLIC
|
||||
File1=MainPage.bal
|
||||
File1=listItem.bal
|
||||
File2=MainPage.bal
|
||||
FileGroup1=Default Group
|
||||
FileGroup2=Default Group
|
||||
Group=Default Group
|
||||
Library1=b4xpages
|
||||
Library2=byteconverter
|
||||
Library3=contentresolver
|
||||
Library4=core
|
||||
Library5=okhttputils2
|
||||
Library6=randomaccessfile
|
||||
Library7=sql
|
||||
Library8=appupdating
|
||||
Library1=appupdating
|
||||
Library10=xcustomlistview
|
||||
Library2=b4xpages
|
||||
Library3=byteconverter
|
||||
Library4=contentresolver
|
||||
Library5=core
|
||||
Library6=ime
|
||||
Library7=okhttputils2
|
||||
Library8=randomaccessfile
|
||||
Library9=sql
|
||||
ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="31"/>~\n~<supports-screens android:largeScreens="true" ~\n~ android:normalScreens="true" ~\n~ android:smallScreens="true" ~\n~ android:anyDensity="true"/>)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~CreateResourceFromFile(Macro, Themes.LightTheme)~\n~'End of default text.~\n~~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")~\n~AddPermission(android.permission.INTERNET)~\n~AddPermission(android.permission.READ_EXTERNAL_STORAGE)~\n~AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)~\n~SetApplicationAttribute(android:allowBackup, "false")~\n~~\n~AddActivityText(main,~\n~<intent-filter>~\n~<action android:name="android.intent.action.VIEW" />~\n~<category android:name="android.intent.category.DEFAULT" />~\n~<data android:mimeType="application/octet-stream" />~\n~</intent-filter>)
|
||||
Module1=B4XMainPage
|
||||
Module2=DBRequestManager
|
||||
Module3=FileHandler
|
||||
Module4=Starter
|
||||
Module5=Subs
|
||||
NumberOfFiles=1
|
||||
NumberOfLibraries=8
|
||||
NumberOfFiles=2
|
||||
NumberOfLibraries=10
|
||||
NumberOfModules=5
|
||||
Version=12.2
|
||||
@EndOfDesignText@
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: DBCheck
|
||||
#VersionCode: 1
|
||||
#VersionName: 3.08.31
|
||||
#VersionName: 3.09.03
|
||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
|
||||
BIN
B4A/Files/listitem.bal
Normal file
BIN
B4A/Files/listitem.bal
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user