mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-17 18:26:11 +00:00
84 lines
2.2 KiB
QBasic
84 lines
2.2 KiB
QBasic
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Class
|
|
Version=12.8
|
|
@EndOfDesignText@
|
|
Sub Class_Globals
|
|
Dim audb As SQL
|
|
Dim ruta As String = File.DirInternal
|
|
End Sub
|
|
|
|
'You can add more parameters here.
|
|
Public Sub Initialize(db As SQL) As Object
|
|
If Not(audb.IsInitialized) Then audb.Initialize(ruta,"kmt.db", True)
|
|
audb = db
|
|
audb.ExecNonQuery("CREATE TABLE IF NOT EXISTS auditoria(almacen text, ruta text, usuario text, cliente text, evento text, fecha text, lat text, lon text)")
|
|
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
|
|
End Sub
|
|
|
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
|
|
|
Sub guarda(evento As String)
|
|
DateTime.DateFormat = "yyyy-MM-dd HH:mm:ss"
|
|
audb.ExecNonQuery2("insert into auditoria (almacen, ruta, usuario, cliente, evento, fecha, lat, lon) values (?, ?, ?, ?, ?, ?, ?, ?)", Array As String(traeAlmacen, traeRuta, traeUsuarioDeBD, traeCliente, evento, DateTime.Date(DateTime.Now)))
|
|
End Sub
|
|
|
|
'Regresa el almacen actual de la base de datos.
|
|
Sub traeAlmacen As String 'ignore
|
|
Private c As Cursor
|
|
Private a As String = ""
|
|
c = audb.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
|
|
If c.RowCount > 0 Then
|
|
c.Position = 0
|
|
a = C.GetString("ID_ALMACEN")
|
|
End If
|
|
c.Close
|
|
Return a
|
|
End Sub
|
|
|
|
'Regresa la ruta actual de la base de datos.
|
|
Sub traeRuta As String 'ignore
|
|
Private c As Cursor
|
|
Private r As String
|
|
c = audb.ExecQuery("select CAT_CL_RUTA from kmt_info limit 1")
|
|
r = "0"
|
|
If c.RowCount > 0 Then
|
|
c.Position = 0
|
|
r = c.GetString("CAT_CL_RUTA")
|
|
End If
|
|
c.Close
|
|
Return r
|
|
End Sub
|
|
|
|
'Regresa el usuario de la tabla USUARIOA
|
|
Sub traeUsuarioDeBD As String 'ignore
|
|
Private c As Cursor
|
|
Private u As String = "SinUsuario"
|
|
c = audb.ExecQuery("select USUARIO from usuarioa")
|
|
If c.RowCount > 0 Then
|
|
c.Position = 0
|
|
u = c.GetString("USUARIO")
|
|
End If
|
|
c.Close
|
|
Return u
|
|
End Sub
|
|
|
|
'Trae el cliente de CUENTAA
|
|
Sub traeCliente As String 'ignore
|
|
Private c As Cursor
|
|
Private cl As String = ""
|
|
c = audb.ExecQuery("Select CUENTA from cuentaa")
|
|
If c.RowCount > 0 Then
|
|
c.Position = 0
|
|
cl = c.GetString("CUENTA")
|
|
End If
|
|
c.Close
|
|
Return cl
|
|
End Sub |