mirror of
https://github.com/KeymonSoft/Estacionamiento.git
synced 2026-04-17 19:37:01 +00:00
- VERSION 1.01.01
- Commit inicial
This commit is contained in:
16
.gitattributes
vendored
Normal file
16
.gitattributes
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# linguist-language
|
||||
*.b4a linguist-language=B4X
|
||||
*.b4i linguist-language=B4X
|
||||
*.b4j linguist-language=B4X
|
||||
*.b4r linguist-language=B4X
|
||||
*.bas linguist-language=B4X
|
||||
|
||||
# linguist-detectable
|
||||
*.b4a linguist-detectable=true
|
||||
*.b4i linguist-detectable=true
|
||||
*.b4j linguist-detectable=true
|
||||
*.b4r linguist-detectable=true
|
||||
*.bas linguist-detectable=true
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
**/Objects
|
||||
**/AutoBackups
|
||||
24
B4A/C_Principal.bas
Normal file
24
B4A/C_Principal.bas
Normal file
@@ -0,0 +1,24 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
Sub Class_Globals
|
||||
Private Root As B4XView 'ignore
|
||||
Private xui As XUI 'ignore
|
||||
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
|
||||
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
272
B4A/DBRequestManager.bas
Normal file
272
B4A/DBRequestManager.bas
Normal file
@@ -0,0 +1,272 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
'Necesita la libreria RandomAccessFile
|
||||
|
||||
'Class module
|
||||
Sub Class_Globals
|
||||
Private mTarget As Object
|
||||
Type DBResult (Tag As Object, Columns As Map, Rows As List)
|
||||
Type DBCommand (Name As String, Parameters() As Object)
|
||||
Private link As String
|
||||
Private bc As ByteConverter
|
||||
Private T_NULL = 0, T_STRING = 1, T_SHORT = 2, T_INT = 3, T_LONG = 4, T_FLOAT = 5 _
|
||||
,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte
|
||||
Private VERSION As Float = 0.9
|
||||
Private tempArray(1) As Object
|
||||
Dim jobTagAnterior As String = "" 'Mod por CHV - 211027
|
||||
End Sub
|
||||
|
||||
'Target - The module that handles JobDone (usually Me).
|
||||
'ConnectorLink - URL of the Java server.
|
||||
Public Sub Initialize (Target As Object, ConnectorLink As String)
|
||||
mTarget = Target
|
||||
link = ConnectorLink
|
||||
End Sub
|
||||
|
||||
'Sends a query request.
|
||||
'Command - Query name and parameters.
|
||||
'Limit - Maximum rows to return or 0 for no limit.
|
||||
'Tag - An object that will be returned in the result.
|
||||
Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
||||
Dim j As HttpJob
|
||||
Dim ms As OutputStream
|
||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||
|
||||
WriteObject(Command.Name, out2)
|
||||
WriteInt(Limit, out2)
|
||||
WriteList(Command.Parameters, out2)
|
||||
out2.Close
|
||||
j.PostBytes(link & "?method=query", ms.ToBytesArray)
|
||||
End Sub
|
||||
|
||||
'Executes a batch of (non-select) commands.
|
||||
'ListOfCommands - List of the commands that will be executes.
|
||||
'Tag - An object that will be returned in the result.
|
||||
Public Sub ExecuteBatch(ListOfCommands As List, Tag As Object)
|
||||
Dim j As HttpJob
|
||||
Dim ms As OutputStream
|
||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||
WriteInt(ListOfCommands.Size, out2)
|
||||
For Each Command As DBCommand In ListOfCommands
|
||||
WriteObject(Command.Name, out2)
|
||||
WriteList(Command.Parameters, out2)
|
||||
Next
|
||||
out2.Close
|
||||
j.PostBytes(link & "?method=batch", ms.ToBytesArray)
|
||||
End Sub
|
||||
|
||||
'Similar to ExecuteBatch. Sends a single command.
|
||||
Public Sub ExecuteCommand(Command As DBCommand, Tag As Object)
|
||||
ExecuteBatch(Array As DBCommand(Command), Tag)
|
||||
End Sub
|
||||
|
||||
Private Sub StartJob(j As HttpJob, MemoryStream As OutputStream, Tag As Object) As OutputStream
|
||||
j.Initialize("DBRequest", mTarget)
|
||||
j.Tag = Tag
|
||||
MemoryStream.InitializeToBytesArray(0)
|
||||
Dim compress As CompressedStreams
|
||||
Dim out As OutputStream = compress.WrapOutputStream(MemoryStream, "gzip")
|
||||
WriteObject(VERSION, out)
|
||||
Return out
|
||||
End Sub
|
||||
|
||||
Private Sub WriteList(Parameters As List, out As OutputStream)
|
||||
Dim data() As Byte
|
||||
If Parameters = Null Or Parameters.IsInitialized = False Then
|
||||
Dim Parameters As List
|
||||
Parameters.Initialize
|
||||
End If
|
||||
data = bc.IntsToBytes(Array As Int(Parameters.Size))
|
||||
out.WriteBytes(data, 0, data.Length)
|
||||
For Each o As Object In Parameters
|
||||
WriteObject(o, out)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub WriteObject(o As Object, out As OutputStream)
|
||||
Dim data() As Byte
|
||||
tempArray(0) = o
|
||||
If tempArray(0) = Null Then
|
||||
out.WriteBytes(Array As Byte(T_NULL), 0, 1)
|
||||
Else If tempArray(0) Is Short Then
|
||||
out.WriteBytes(Array As Byte(T_SHORT), 0, 1)
|
||||
data = bc.ShortsToBytes(Array As Short(o))
|
||||
Else If tempArray(0) Is Int Then
|
||||
out.WriteBytes(Array As Byte(T_INT), 0, 1)
|
||||
data = bc.IntsToBytes(Array As Int(o))
|
||||
Else If tempArray(0) Is Float Then
|
||||
out.WriteBytes(Array As Byte(T_FLOAT), 0, 1)
|
||||
data = bc.FloatsToBytes(Array As Float(o))
|
||||
Else If tempArray(0) Is Double Then
|
||||
out.WriteBytes(Array As Byte(T_DOUBLE), 0, 1)
|
||||
data = bc.DoublesToBytes(Array As Double(o))
|
||||
Else If tempArray(0) Is Long Then
|
||||
out.WriteBytes(Array As Byte(T_LONG), 0, 1)
|
||||
data = bc.LongsToBytes(Array As Long(o))
|
||||
Else If tempArray(0) Is Boolean Then
|
||||
out.WriteBytes(Array As Byte(T_BOOLEAN), 0, 1)
|
||||
Dim b As Boolean = 0
|
||||
Dim data(1) As Byte
|
||||
If b Then data(0) = 1 Else data(0) = 0
|
||||
Else If GetType(tempArray(0)) = "[B" Then
|
||||
data = o
|
||||
out.WriteBytes(Array As Byte(T_BLOB), 0, 1)
|
||||
WriteInt(data.Length, out)
|
||||
Else 'If o Is String Then (treat all other values as string)
|
||||
out.WriteBytes(Array As Byte(T_STRING), 0, 1)
|
||||
data = bc.StringToBytes(o, "UTF8")
|
||||
WriteInt(data.Length, out)
|
||||
End If
|
||||
If data.Length > 0 Then out.WriteBytes(data, 0, data.Length)
|
||||
End Sub
|
||||
|
||||
Private Sub ReadObject(In As InputStream) As Object
|
||||
Dim data(1) As Byte
|
||||
In.ReadBytes(data, 0, 1)
|
||||
Select data(0)
|
||||
Case T_NULL
|
||||
Return Null
|
||||
Case T_SHORT
|
||||
Dim data(2) As Byte
|
||||
Return bc.ShortsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_INT
|
||||
Dim data(4) As Byte
|
||||
Return bc.IntsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_LONG
|
||||
Dim data(8) As Byte
|
||||
Return bc.LongsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_FLOAT
|
||||
Dim data(4) As Byte
|
||||
Return bc.FloatsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_DOUBLE
|
||||
Dim data(8) As Byte
|
||||
Return bc.DoublesFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_BOOLEAN
|
||||
Dim b As Byte = ReadByte(In)
|
||||
Return b = 1
|
||||
Case T_BLOB
|
||||
Dim len As Int = ReadInt(In)
|
||||
Dim data(len) As Byte
|
||||
Return ReadBytesFully(In, data, data.Length)
|
||||
Case Else
|
||||
Dim len As Int = ReadInt(In)
|
||||
Dim data(len) As Byte
|
||||
ReadBytesFully(In, data, data.Length)
|
||||
Return BytesToString(data, 0, data.Length, "UTF8")
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub ReadBytesFully(In As InputStream, Data() As Byte, Len As Int) As Byte()
|
||||
Dim count = 0, read As Int
|
||||
Do While count < Len And read > -1
|
||||
read = In.ReadBytes(Data, count, Len - count)
|
||||
count = count + read
|
||||
Loop
|
||||
Return Data
|
||||
End Sub
|
||||
|
||||
Private Sub WriteInt(i As Int, out As OutputStream)
|
||||
Dim data() As Byte
|
||||
data = bc.IntsToBytes(Array As Int(i))
|
||||
out.WriteBytes(data, 0, data.Length)
|
||||
End Sub
|
||||
|
||||
Private Sub ReadInt(In As InputStream) As Int
|
||||
Dim data(4) As Byte
|
||||
Return bc.IntsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
End Sub
|
||||
|
||||
Private Sub ReadByte(In As InputStream) As Byte
|
||||
Dim data(1) As Byte
|
||||
In.ReadBytes(data, 0, 1)
|
||||
Return data(0)
|
||||
End Sub
|
||||
|
||||
'Handles the Job result and returns a DBResult.
|
||||
Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
Dim start As Long = DateTime.Now
|
||||
Dim In As InputStream = Job.GetInputStream
|
||||
Dim cs As CompressedStreams
|
||||
In = cs.WrapInputStream(In, "gzip")
|
||||
Dim serverVersion As Float = ReadObject(In) 'ignore
|
||||
Dim method As String = ReadObject(In)
|
||||
Dim table As DBResult
|
||||
table.Initialize
|
||||
table.Columns.Initialize
|
||||
table.rows.Initialize
|
||||
table.Tag = Job.Tag
|
||||
If jobTagAnterior <> Job.Tag Then LogColor("HandleJob: '"&Job.Tag&"'", Colors.Blue) 'Mod por CHV - 211023
|
||||
jobTagAnterior = Job.Tag 'Mod por CHV - 211023
|
||||
If method = "query" Then
|
||||
Dim numberOfColumns As Int = ReadInt(In)
|
||||
For i = 0 To numberOfColumns - 1
|
||||
table.Columns.Put(ReadObject(In), i)
|
||||
Next
|
||||
Do While ReadByte(In) = 1
|
||||
Dim rowObjects(numberOfColumns) As Object
|
||||
table.rows.Add(rowObjects)
|
||||
For col = 0 To numberOfColumns - 1
|
||||
Dim o As Object = ReadObject(In)
|
||||
rowObjects(col) = o
|
||||
Next
|
||||
Loop
|
||||
Else If method = "batch" Then
|
||||
table.Columns.Put("AffectedRows", 0)
|
||||
Dim rows As Int = ReadInt(In)
|
||||
For i = 0 To rows - 1
|
||||
table.rows.Add(Array As Object(ReadInt(In)))
|
||||
Next
|
||||
End If
|
||||
In.Close
|
||||
' Log("HandleJob: " & (DateTime.Now - start))
|
||||
Return table
|
||||
End Sub
|
||||
'Reads a file and returns the file as a bytes array.
|
||||
Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
||||
Dim out As OutputStream
|
||||
out.InitializeToBytesArray(0)
|
||||
Dim In As InputStream = File.OpenInput(Dir, FileName)
|
||||
File.Copy2(In, out)
|
||||
out.Close
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
'Converts an image to a bytes array (for BLOB fields).
|
||||
Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
||||
Dim out As OutputStream
|
||||
out.InitializeToBytesArray(0)
|
||||
Image.WriteToStream(out, 100, "JPEG")
|
||||
out.Close
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
'Converts a bytes array to an image (for BLOB fields).
|
||||
Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
||||
Dim In As InputStream
|
||||
In.InitializeFromBytesArray(bytes, 0, bytes.Length)
|
||||
Dim bmp As Bitmap
|
||||
bmp.Initialize2(In)
|
||||
Return bmp
|
||||
End Sub
|
||||
'Prints the table to the logs.
|
||||
Public Sub PrintTable(Table As DBResult)
|
||||
Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
|
||||
Dim sb As StringBuilder
|
||||
sb.Initialize
|
||||
For Each col In Table.Columns.Keys
|
||||
sb.Append(col).Append(TAB)
|
||||
Next
|
||||
Log(sb.ToString)
|
||||
For Each row() As Object In Table.Rows
|
||||
Dim sb As StringBuilder
|
||||
sb.Initialize
|
||||
For Each record As Object In row
|
||||
sb.Append(record).Append(TAB)
|
||||
Next
|
||||
ToastMessageShow(sb.ToString, True)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
|
||||
1158
B4A/EscPosPrinter.bas
Normal file
1158
B4A/EscPosPrinter.bas
Normal file
File diff suppressed because it is too large
Load Diff
105
B4A/Estacionamiento.b4a
Normal file
105
B4A/Estacionamiento.b4a
Normal file
File diff suppressed because one or more lines are too long
24
B4A/Estacionamiento.b4a.meta
Normal file
24
B4A/Estacionamiento.b4a.meta
Normal file
@@ -0,0 +1,24 @@
|
||||
ModuleBookmarks0=
|
||||
ModuleBookmarks1=
|
||||
ModuleBookmarks2=
|
||||
ModuleBookmarks3=
|
||||
ModuleBookmarks4=
|
||||
ModuleBookmarks5=
|
||||
ModuleBookmarks6=
|
||||
ModuleBreakpoints0=
|
||||
ModuleBreakpoints1=
|
||||
ModuleBreakpoints2=
|
||||
ModuleBreakpoints3=
|
||||
ModuleBreakpoints4=
|
||||
ModuleBreakpoints5=
|
||||
ModuleBreakpoints6=
|
||||
ModuleClosedNodes0=6
|
||||
ModuleClosedNodes1=
|
||||
ModuleClosedNodes2=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
ModuleClosedNodes6=
|
||||
NavigationStack=B4XMainPage,AjustarInterfaz,111,6,B4XMainPage,b_rescan_Click,654,2,B4XMainPage,b_tar_in_Click,619,6,B4XMainPage,b_resacep_Click,668,0,B4XMainPage,b_resdia_Click,661,6,B4XMainPage,b_salida_LongClick,188,0,Diseñador Visual,MainPage.bal,-100,6,B4XMainPage,b_entrada_Click,145,2,B4XMainPage,b_salida_Click,163,6,B4XMainPage,b_Tarifa_Click,607,4,B4XMainPage,b_tar_can_Click,614,1
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,3,6,2,5,4
|
||||
BIN
B4A/Files/alert2.png
Normal file
BIN
B4A/Files/alert2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 632 B |
BIN
B4A/Files/logoestacionamiento.png
Normal file
BIN
B4A/Files/logoestacionamiento.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
BIN
B4A/Files/mainpage.bal
Normal file
BIN
B4A/Files/mainpage.bal
Normal file
Binary file not shown.
226
B4A/FirebaseMessaging.bas
Normal file
226
B4A/FirebaseMessaging.bas
Normal file
@@ -0,0 +1,226 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Service
|
||||
Version=10.2
|
||||
@EndOfDesignText@
|
||||
'///////////////////////////////////////////////////////////////////////////////////////
|
||||
'/// Agregar estas lineas al editor de manifiestos
|
||||
'
|
||||
' CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
|
||||
' CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
|
||||
' CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
|
||||
' CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
|
||||
'
|
||||
'/// Agregar modulo de servicio nuevo FirebaseMessaging y copiar este modulo
|
||||
'
|
||||
'/// Bajar el archivo google-services.json de la consola de Firebase (https://console.firebase.google.com/)
|
||||
'/// El nombre de la app en el archivo json tiene que ser el mismo que el nombre del paquete (Proyecto/Conf de Compilacion/Paquete)
|
||||
'
|
||||
'/// En Starter agregar esta linea
|
||||
'
|
||||
' Sub Service_Create
|
||||
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
|
||||
' End Sub
|
||||
'
|
||||
'/// En Main en Sub Process_Globals agregar esta linea
|
||||
'
|
||||
' Private const API_KEY As String = "AAAAv__xxxxxxxxxxxxx-xxxxxxxxxxxxxx-xxxxxxxxxxxx"
|
||||
'
|
||||
'/// Esta llave se consigue igualmente en la consola de Firebase, configuracion de proyecto, Cloud Messaging,
|
||||
'/// es la clave de servidor.
|
||||
'///
|
||||
'/// Se necesitan agregar las librerías: FirebaseAnalitics, FirebaseNotifications, JSON y OkHttpUtils2
|
||||
'/// ... JSON es necesario si se van a enviar mensajes, si solo se van a recibir, no es necesario.
|
||||
'
|
||||
'///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Sub Process_Globals
|
||||
Private fm As FirebaseMessaging
|
||||
Private const API_KEY As String = "AAAAv1qt3Lk:APA91bECIR-pHn6ul53eYyoVlpPuOo85RO-0zcAgEXwE7vqw8DFSbBtCaCINiqWQAkBBZXxHtQMdpU6B-jHIqgFKVL196UgwHv0Gw6_IgmipfV_NiItjzlH9d2QNpGLp9y_JUKVjUEhP" 'Api_Key cheveguerra@gmail.com/Pusher
|
||||
Dim locRequest As String
|
||||
' Dim phn As Phone
|
||||
Dim pe As PhoneEvents
|
||||
Dim c As Cursor
|
||||
Public GZip As GZipStrings
|
||||
Dim Sprvsr As String = "Sprv-Cedex" ' El topico al que se mandan los mensajes push
|
||||
Dim Subscrito As String
|
||||
Dim au As String 'ignore
|
||||
End Sub
|
||||
|
||||
Sub Service_Create
|
||||
fm.Initialize("fm") 'Inicializamos FirebaseMessaging
|
||||
pe.Initialize("pe") 'Para obtener la bateria
|
||||
End Sub
|
||||
|
||||
Public Sub SubscribeToTopics
|
||||
' fm.SubscribeToTopic("Trckr") 'Topico general Keymon
|
||||
fm.SubscribeToTopic("Trckr") 'Tracker Global
|
||||
' Log("Suscrito al tracker global")
|
||||
fm.SubscribeToTopic("Trckr-Cedex") 'Topico de Guna
|
||||
If "Cdx_"&B4XPages.MainPage.usuario <> Subscrito Then
|
||||
fm.SubscribeToTopic("Cdx_"&B4XPages.MainPage.usuario) 'Propio (you can subscribe to more topics)
|
||||
fm.UnsubscribeFromTopic(Subscrito) 'Unsubscribe from topic
|
||||
End If
|
||||
' Log("Subscrito a "&"Cdx_"&B4XPages.MainPage.usuario)
|
||||
Subscrito = "Cdx_"&B4XPages.MainPage.usuario
|
||||
' Log(fm.token)
|
||||
' fm.UnsubscribeFromTopic("Sprvsr") 'Unsubscribe from topic
|
||||
End Sub
|
||||
|
||||
Sub Service_Start (StartingIntent As Intent)
|
||||
If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
|
||||
Sleep(0)
|
||||
Service.StopAutomaticForeground 'remove if not using B4A v8+.
|
||||
StartServiceAt(Me, DateTime.Now + 15 * DateTime.TicksPerMinute, True) 'Iniciamos servicio cada XX minutos
|
||||
End Sub
|
||||
|
||||
Sub fm_MessageArrived (Message As RemoteMessage)
|
||||
Log("Message arrived")
|
||||
Log($"Message data: ${Message.GetData}"$)
|
||||
' getPhnId
|
||||
If Message.GetData.ContainsKey("t") Then
|
||||
Dim tipos As List = Regex.Split(",",Message.GetData.Get("t"))
|
||||
If tipos.IndexOf("pu") <> -1 Or tipos.IndexOf("au") <> -1 Then 'Si es una peticion de ubicacion
|
||||
Log("Es una peticion de ubicacion")
|
||||
locRequest="Activa"
|
||||
Log("Llamamos StartFLPSmall")
|
||||
CallSubDelayed(Tracker, "StartFLPSmall")
|
||||
CallSubDelayed(Tracker, "StartFLP")
|
||||
End If
|
||||
If tipos.IndexOf("au") <> -1 Then 'Si es una actualizacion de ubicacion
|
||||
au = 1
|
||||
End If
|
||||
If tipos.IndexOf("ping") <> -1 Then 'Si es un ping
|
||||
Log("Es un ping")
|
||||
Log("Mandamos pong")
|
||||
Dim params As Map = CreateMap("topic":Sprvsr,"title":"pong", "body":B4XPages.MainPage.usuario&" - Recibi mensaje "&Message.GetData.Get("title"), "t":"pong")
|
||||
SendMessage(params)
|
||||
End If
|
||||
If tipos.IndexOf("bgps") <> -1 Then 'Si es una instruccion de borrar archivo gps
|
||||
Log("Es una instruccion de borrar archivo gps")
|
||||
Log("Borramos archivo gps")
|
||||
borramosArchivoGPS
|
||||
End If
|
||||
If tipos.IndexOf("dr") <> -1 Then 'Si es una peticion de ruta gps
|
||||
Log("Es una peticion de Ruta GPS")
|
||||
Dim rutaGpsCmp As String = dameRuta
|
||||
Dim params As Map = CreateMap("topic":Sprvsr,"title":"ruta", "body":B4XPages.MainPage.usuario&" - Recibi mensaje "&Message.GetData.Get("title"), "t":"ruta", "r":rutaGpsCmp)
|
||||
SendMessage(params)
|
||||
End If
|
||||
If tipos.IndexOf("bgps2") <> -1 Then 'Si es una instruccion de borrar DB gps
|
||||
Log("Es una instruccion de borrar BD gps")
|
||||
Log("Borramos BD gps")
|
||||
borraGPSHist
|
||||
End If
|
||||
If tipos.IndexOf("pu") = -1 And tipos.IndexOf("au") = -1 And tipos.IndexOf("ping") = -1 And tipos.IndexOf("dr") = -1 Then
|
||||
Log("No es ping ni solicitud de ubicacion o ruta, entonces no hacemos nada")
|
||||
End If
|
||||
End If
|
||||
' Dim n As Notification
|
||||
' n.Initialize
|
||||
' n.Icon = "icon"
|
||||
' n.SetInfo("Guna", "Guna", Main)
|
||||
' n.Notify(1)
|
||||
End Sub
|
||||
|
||||
Sub Service_Destroy
|
||||
|
||||
End Sub
|
||||
|
||||
Sub SendMessage(params As Map)
|
||||
Dim topic As String= params.Get("topic")
|
||||
Dim title As String= params.Get("title")
|
||||
Dim body As String= params.Get("body")
|
||||
Dim tipo As String= params.Get("t")
|
||||
If params.ContainsKey("r") Then
|
||||
Log("Con ruta")
|
||||
Dim rutaGpsCmp As String= params.Get("r")
|
||||
Else
|
||||
Log("Sin ruta")
|
||||
Dim rutaGpsCmp As String = ""
|
||||
End If
|
||||
Dim Job As HttpJob
|
||||
Job.Initialize("fcm", Me)
|
||||
Dim m As Map = CreateMap("to": $"/topics/${topic}"$)
|
||||
Dim data As Map = CreateMap("title":title, "body":body, "d":B4XPages.MainPage.usuario, "t":tipo, "b":B4XPages.MainPage.batt, "mt":B4XPages.MainPage.montoActual, "r":rutaGpsCmp, "v":B4XPages.MainPage.v)
|
||||
m.Put("data", data)
|
||||
Dim jg As JSONGenerator
|
||||
jg.Initialize(m)
|
||||
Job.PostString("https://fcm.googleapis.com/fcm/send", jg.ToString)
|
||||
Job.GetRequest.SetContentType("application/json;charset=UTF-8")
|
||||
Job.GetRequest.SetHeader("Authorization", "key=" & API_KEY)
|
||||
Log(m) 'ignore
|
||||
End Sub
|
||||
|
||||
Sub mandamosLoc(coords As String)
|
||||
' Log("Iniciamos mandamosLoc "&coords)
|
||||
' Log("locRequest="&locRequest)
|
||||
If locRequest="Activa" Then 'Si hay solicitud de ubicacion, entonces la mandamos ...
|
||||
Dim params As Map = CreateMap("topic":Sprvsr,"title":"ubicacionRecibida", "body":coords, "t":"u")
|
||||
SendMessage(params)
|
||||
locRequest="Enviada"
|
||||
CallSubDelayed(Tracker,"CreateLocationRequest")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub guardaInfoEnArchivo(coords As String) 'ignore 'Escribimos coordenadas y fecha a un archivo de texto
|
||||
Log("Guardamos ubicacion en BD")
|
||||
Dim latlon() As String = Regex.Split(",", coords)
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO RUTA_GPS(FECHA, LAT, LON) VALUES (?,?,?)", Array As Object (latlon(2),latlon(0),latlon(1)))
|
||||
End Sub
|
||||
|
||||
Sub borramosArchivoGPS
|
||||
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "gps.txt", False)
|
||||
Dim s As String = ""
|
||||
Dim t() As Byte = s.GetBytes("UTF-8")
|
||||
out.WriteBytes(t, 0, t.Length)
|
||||
out.Close
|
||||
End Sub
|
||||
|
||||
Sub pe_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
|
||||
B4XPages.MainPage.batt=Level
|
||||
End Sub
|
||||
|
||||
Sub compress(str As String) As String
|
||||
' Compression
|
||||
Private su As StringUtils
|
||||
Dim compressed() As Byte = GZip.compress(str)
|
||||
Log($"CompressedBytesLength: ${compressed.Length}"$)
|
||||
Dim base64 As String = su.EncodeBase64(compressed)
|
||||
Log($"CompressedBytes converted to base64 Length: ${base64.Length}"$)
|
||||
Log($"CompressedBytes converted to base64: ${base64}"$)
|
||||
Return base64
|
||||
End Sub
|
||||
|
||||
Sub decompress(base64 As String) As String 'ignore
|
||||
' Decompression
|
||||
Private su As StringUtils
|
||||
Dim decompressedbytes() As Byte = su.DecodeBase64(base64)
|
||||
Log($"decompressedbytesLength: ${decompressedbytes.Length}"$)
|
||||
Dim bc As ByteConverter
|
||||
Dim uncompressed As String = bc.StringFromBytes(decompressedbytes,"UTF8")
|
||||
Log($"uncompressedLength: ${uncompressed.Length}"$) ' 6163 Bytes
|
||||
Log($"Decompressed String = ${uncompressed}"$)
|
||||
Return uncompressed
|
||||
End Sub
|
||||
|
||||
Sub dameRuta As String
|
||||
Log("dameRuta")
|
||||
Dim c As Cursor
|
||||
c = B4XPages.MainPage.skmt.ExecQuery("select LAT, LON from RUTA_GPS order by FECHA desc limit 390")
|
||||
c.Position = 0
|
||||
Dim ruta2 As String = ""
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
ruta2=ruta2&CRLF&c.GetString("LAT")&","&c.GetString("LON")
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
Return compress(ruta2)
|
||||
End Sub
|
||||
|
||||
Sub borraGPSHist
|
||||
c = B4XPages.MainPage.skmt.ExecQuery("delete FROM RUTA_GPS")
|
||||
End Sub
|
||||
128
B4A/Starter.bas
Normal file
128
B4A/Starter.bas
Normal file
@@ -0,0 +1,128 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Service
|
||||
Version=9.85
|
||||
@EndOfDesignText@
|
||||
#Region Service Attributes
|
||||
#StartAtBoot: False
|
||||
#ExcludeFromLibrary: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Public gps As GPS
|
||||
Dim ph As Phone
|
||||
Public rp As RuntimePermissions
|
||||
Public FLP As FusedLocationProvider
|
||||
' Private flpStarted As Boolean
|
||||
Dim reqManager As DBRequestManager
|
||||
Dim server As String = "http://187.189.244.154:1782"
|
||||
' Dim server As String = "http://10.0.0.205:1782"
|
||||
Dim Timer1 As Timer
|
||||
Dim Interval As Int = 30
|
||||
Dim ruta As String = File.DirInternal
|
||||
'Para los Logs
|
||||
Private logs As StringBuilder
|
||||
Private logcat As LogCat
|
||||
Dim logger As Boolean = False
|
||||
Dim marcaCel As String = ph.manufacturer
|
||||
Dim muestraProgreso = 0
|
||||
Private BTAdmin As BluetoothAdmin
|
||||
Dim MAC_IMPRESORA As String
|
||||
Dim ubicacionActual As Location
|
||||
Dim enVenta As Boolean = False
|
||||
Dim VarX As Int = 0
|
||||
Private BTAdmin As BluetoothAdmin
|
||||
Public BluetoothState As Boolean
|
||||
End Sub
|
||||
|
||||
'Sub Service_Create
|
||||
' 'This is the program entry point.
|
||||
' 'This is a good place to load resources that are not specific to a single activity.
|
||||
' gps.Initialize("GPS")
|
||||
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") 'Para Push FirebaseMessaging
|
||||
' BTAdmin.Initialize("admin")
|
||||
' Timer1.Initialize("Timer1", Interval * 1000)
|
||||
' Timer1.Enabled = True
|
||||
'' 'Para los Logs
|
||||
' #if RELEASE
|
||||
' logcat.LogCatStart(Array As String("-v","raw","*:F","B4A:v"), "logcat")
|
||||
' #end if
|
||||
' logs.Initialize
|
||||
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") 'Para Push FirebaseMessaging
|
||||
' ubicacionActual.Initialize
|
||||
'End Sub
|
||||
|
||||
Private Sub BTAdmin_StateChanged (NewState As Int, OldState As Int)
|
||||
If logger Then Log("BT state changed: " & NewState)
|
||||
BluetoothState = NewState = BTAdmin.STATE_ON
|
||||
' StateChanged
|
||||
End Sub
|
||||
|
||||
|
||||
'Sub Service_Start (StartingIntent As Intent)
|
||||
' Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
|
||||
' Subs.revisaBD
|
||||
' Log(marcaCel)
|
||||
' reqManager.Initialize(Me, server)
|
||||
'End Sub
|
||||
|
||||
'Private Sub Timer1_Tick
|
||||
'' Log("Next run " & DateTime.Time(DateTime.Now + Interval * 1000))
|
||||
' ENVIA_ULTIMA_GPS
|
||||
'End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
' CallSub2(Main, "GPS_LocationChanged", Location1)
|
||||
End Sub
|
||||
|
||||
Sub Service_TaskRemoved
|
||||
'This event will be raised when the user removes the app from the recent apps list.
|
||||
End Sub
|
||||
|
||||
Sub Service_Destroy
|
||||
|
||||
End Sub
|
||||
|
||||
'Sub ENVIA_ULTIMA_GPS
|
||||
' LogColor("Iniciamos ENVIA_ULTIMA_GPS", Colors.Magenta)
|
||||
' Dim skmt As SQL
|
||||
' Dim cmd As DBCommand
|
||||
' skmt.Initialize(ruta,"kmt.db", True)
|
||||
'' cmd.Initialize
|
||||
'' cmd.Name = "select_fechat"
|
||||
'' B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "fechat")
|
||||
' Dim cmd As DBCommand
|
||||
' cmd.Initialize
|
||||
' cmd.Name = "UPDATE_GUNA_ACTUAL2_GPS"
|
||||
' cmd.Parameters = Array As Object(B4XPages.MainPage.montoActual, B4XPages.MainPage.clientestotal, B4XPages.MainPage.clientesventa,B4XPages.MainPage.clientesvisitados,B4XPages.MainPage.lat_gps,B4XPages.MainPage.lon_gps,B4XPages.MainPage.batt,0, 0, 0,B4XPages.MainPage.ALMACEN,B4XPages.MainPage.rutapreventa)
|
||||
'' Log($"montoActual: ${B4XPages.MainPage.montoActual}, cTotal: ${B4XPages.MainPage.clientestotal}, cVenta: ${B4XPages.MainPage.clientesventa}, cVisitados: ${B4XPages.MainPage.clientesvisitados}, ${B4XPages.MainPage.lat_gps}, ${B4XPages.MainPage.lon_gps}, Batt: ${B4XPages.MainPage.batt}, 0, 0, 0, Almacen: ${B4XPages.MainPage.ALMACEN}, Ruta: ${B4XPages.MainPage.rutapreventa}"$)
|
||||
' reqManager.ExecuteCommand(cmd, "inst_visitas")
|
||||
' skmt.ExecNonQuery2("Update cat_variables set CAT_VA_VALOR = ? WHERE CAT_VA_DESCRIPCION = ?" , Array As String(DateTime.Time(DateTime.Now),"HoraIngreso"))
|
||||
' 'Reiniciamos el timer para cuando llamamos el Sub desde "seleccion"
|
||||
' Timer1.Enabled = False
|
||||
' Timer1.Interval = Interval * 1000
|
||||
' Timer1.Enabled = True
|
||||
'End Sub
|
||||
|
||||
'Para los Logs
|
||||
Private Sub logcat_LogCatData (Buffer() As Byte, Length As Int)
|
||||
logs.Append(BytesToString(Buffer, 0, Length, "utf8"))
|
||||
If logs.Length > 4000 Then
|
||||
logs.Remove(0, logs.Length - 2000) 'Obtenemos log de 2000 ~ 4000 chars
|
||||
End If
|
||||
End Sub
|
||||
|
||||
''Return true to allow the OS default exceptions handler to handle the uncaught exception. 'Para los Logs
|
||||
'Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
|
||||
' 'wait for 500ms to allow the logs to be updated.
|
||||
' Dim jo As JavaObject
|
||||
' Dim l As Long = 500: jo.InitializeStatic("java.lang.Thread").RunMethod("sleep", Array(l)) 'Sleep 500ms
|
||||
' logcat.LogCatStop
|
||||
' logs.Append(StackTrace)
|
||||
' Subs.revisaBD
|
||||
' Subs.errorLog.ExecNonQuery2("INSERT INTO errores(fecha, error) VALUES (?,?)", Array As Object (Subs.fechaKMT(DateTime.now), logs))
|
||||
' Return True
|
||||
'End Sub
|
||||
1388
B4A/Subs.bas
Normal file
1388
B4A/Subs.bas
Normal file
File diff suppressed because it is too large
Load Diff
697
B4XMainPage.bas
Normal file
697
B4XMainPage.bas
Normal file
@@ -0,0 +1,697 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=9.85
|
||||
@EndOfDesignText@
|
||||
#Region Shared Files
|
||||
'#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
|
||||
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
|
||||
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
|
||||
'###########################################################################################################
|
||||
'###################### PULL #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=git&Args=pull
|
||||
'###########################################################################################################
|
||||
'###################### PUSH #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=github&Args=..\..\
|
||||
'###########################################################################################################
|
||||
'###################### PUSH TORTOISE GIT #########################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=TortoiseGitProc&Args=/command:commit&Args=/path:"./../../"&Args=/closeonend:2
|
||||
'###########################################################################################################
|
||||
#End Region
|
||||
|
||||
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
|
||||
|
||||
Sub Class_Globals
|
||||
Private b_salida As Button
|
||||
Private b_entrada As Button
|
||||
Private b_cancelar As Button
|
||||
Private b_guardar As Button
|
||||
Private b_regresar As Button
|
||||
Dim c As Cursor
|
||||
Dim t As Cursor
|
||||
Dim cmd As DBCommand
|
||||
Private et_placa As EditText
|
||||
Private Root As B4XView
|
||||
Dim RES As String
|
||||
Dim RES3 As String
|
||||
Dim RES5 As String
|
||||
Private p_estacionamiento As Panel
|
||||
Private p_guarda_info As Panel
|
||||
Private p_sal_esta As Panel
|
||||
Public Provider As FileProvider
|
||||
' Private xui As XUI
|
||||
Dim skmt As SQL
|
||||
Private lv_Lis_Placa As ListView
|
||||
Dim TAMANO As Int
|
||||
Dim ESPACIO As Int
|
||||
Dim BLANCO As String
|
||||
Dim printer As TextWriter
|
||||
Dim cmp20 As Serial
|
||||
Dim btAdmin As BluetoothAdmin
|
||||
Dim Printer1 As EscPosPrinter
|
||||
Dim impresoraConectada As Boolean = False
|
||||
Dim errorImpresora As Int = 0
|
||||
Dim p As Int
|
||||
Dim v As Object
|
||||
Private LogoEst As ImageView
|
||||
Private LogEst_lv As ImageView
|
||||
Private LogoEst_placa As ImageView
|
||||
Private b_Tarifa As Button
|
||||
Private p_tar_f As Panel
|
||||
Private et_tar_f As EditText
|
||||
Private b_tar_can As Button
|
||||
Private b_tar_in As Button
|
||||
Private b_resdia As Button
|
||||
Private LogEst_res As ImageView
|
||||
Private p_res As Panel
|
||||
Private l_totales As Label
|
||||
Private l_totalsal As Label
|
||||
Private l_montoto As Label
|
||||
Private b_resacep As Button
|
||||
Private b_rescan As Button
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
' B4XPages.GetManager.LogEvents = True
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Provider.Initialize
|
||||
skmt.Initialize(File.DirInternal,"kmt.db", True)
|
||||
Root = Root1
|
||||
Root.LoadLayout("MainPage")
|
||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_VARIABLES (CAT_VA_DESCRIPCION TEXT, CAT_VA_VALOR TEXT)")
|
||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS TMP_INFO_EnSal (TMP_PLACA TEXT, TMP_HR_ENTRA TEXT, TMP_HR_SAL TEXT)")
|
||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS TMP_TARIFA (TMP_TAR_H TEXT)")
|
||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_PLACAS (PLACA TEXT, ENTRADA TEXT, SALIDA TEXT, MONTO TEXT, FOLIO TEXT)")
|
||||
Subs.agregaColumna("TMP_INFO_EnSal", "TMP_DEN_FUE", "INTEGER")
|
||||
Subs.agregaColumna("TMP_INFO_EnSal", "TMP_FOLIO", "TEXT")
|
||||
|
||||
|
||||
AjustarInterfaz(Root.Width, Root.Height)
|
||||
|
||||
btAdmin.Initialize("BlueTeeth")
|
||||
cmp20.Initialize("Printer")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub AjustarInterfaz(Ancho As Int, Alto As Int)
|
||||
|
||||
p_estacionamiento.SetLayoutAnimated(0, 0, 0, Ancho, Alto)
|
||||
p_guarda_info.SetLayoutAnimated(0, 0, 0, Ancho, Alto)
|
||||
p_sal_esta.SetLayoutAnimated(0, 0, 0, Ancho, Alto)
|
||||
p_res.SetLayoutAnimated(0, 0, 0, Ancho, Alto)
|
||||
|
||||
|
||||
Dim margenVertical As Int = Alto * 0.02
|
||||
Dim margenHorizontal As Int = Ancho * 0.05
|
||||
Dim botonAncho As Int = (Ancho - (margenHorizontal * 4)) / 3
|
||||
Dim botonAlto As Int = Alto * 0.09
|
||||
Dim botonesY As Int = Alto - botonAlto - margenVertical
|
||||
Dim espacioEntreBotones As Int = margenVertical
|
||||
|
||||
Dim bAncho As Int = (Ancho - (margenHorizontal * 4))
|
||||
|
||||
Dim centroX As Int = (Ancho - bAncho) / 2
|
||||
Dim centroY As Int = (Alto - (3 * botonAlto + 2 * espacioEntreBotones)) / 2
|
||||
|
||||
b_entrada.SetLayoutAnimated(0, centroX, centroY, bAncho, botonAlto)
|
||||
b_salida.SetLayoutAnimated(0, centroX, b_entrada.Top + botonAlto + espacioEntreBotones, bAncho, botonAlto)
|
||||
b_Tarifa.SetLayoutAnimated(0,centroX, b_salida.Top + botonAlto + espacioEntreBotones, bAncho, botonAlto)
|
||||
b_resdia.SetLayoutAnimated(0,centroX, b_Tarifa.Top + botonAlto + espacioEntreBotones, bAncho, botonAlto)
|
||||
|
||||
b_guardar.SetLayoutAnimated(0, margenHorizontal, botonesY, botonAncho, botonAlto)
|
||||
b_cancelar.SetLayoutAnimated(0, margenHorizontal + 2 * (botonAncho + margenHorizontal), botonesY, botonAncho, botonAlto)
|
||||
b_regresar.SetLayoutAnimated(0, margenHorizontal + 1 * (botonAncho + margenHorizontal), botonesY, botonAncho, botonAlto)
|
||||
b_rescan.SetLayoutAnimated(0, margenHorizontal + 1 * (botonAncho + margenHorizontal), botonesY, botonAncho, botonAlto)
|
||||
b_resacep.SetLayoutAnimated(0, margenHorizontal + 1 * (botonAncho + margenHorizontal), botonesY, botonAncho, botonAlto)
|
||||
|
||||
|
||||
Dim logoAncho As Int = Ancho * 0.3
|
||||
Dim logoAlto As Int = Alto * 0.2
|
||||
Dim logoY As Int = margenVertical
|
||||
|
||||
LogoEst.SetLayoutAnimated(0, margenHorizontal, logoY, logoAncho, logoAlto)
|
||||
LogEst_lv.SetLayoutAnimated(0, margenHorizontal, logoY, logoAncho, logoAlto)
|
||||
LogoEst_placa.SetLayoutAnimated(0, margenHorizontal, logoY, logoAncho, logoAlto)
|
||||
LogEst_res.SetLayoutAnimated(0, margenHorizontal, logoY, logoAncho, logoAlto)
|
||||
|
||||
lv_Lis_Placa.SetLayoutAnimated(0, margenHorizontal, logoY + logoAlto + margenVertical, Ancho - 2 * margenHorizontal, b_regresar.Top - logoAlto - 2 * margenVertical)
|
||||
|
||||
p_guarda_info.BringToFront
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub B4XPage_Resize(Width As Int, Height As Int)
|
||||
AjustarInterfaz(Width, Height)
|
||||
End Sub
|
||||
|
||||
Private Sub b_entrada_Click
|
||||
|
||||
Dim t As Cursor = skmt.ExecQuery("SELECT TMP_TAR_H FROM TMP_TARIFA")
|
||||
If t.RowCount > 0 Then
|
||||
t.Position = 0
|
||||
Log(t.GetString("TMP_TAR_H"))
|
||||
|
||||
et_placa.Text = ""
|
||||
|
||||
b_entrada.Visible = False
|
||||
b_salida.Visible = False
|
||||
p_guarda_info.Visible = True
|
||||
p_estacionamiento.Visible = False
|
||||
et_placa.Visible = True
|
||||
p_guarda_info.BringToFront
|
||||
|
||||
Else If t.RowCount = 0 Then
|
||||
|
||||
MsgboxAsync("Favor de caprurar la tarifa por hora", "Atención")
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub b_salida_Click
|
||||
lv_Lis_Placa.Clear
|
||||
b_entrada.Visible = False
|
||||
b_salida.Visible = False
|
||||
p_guarda_info.Visible = False
|
||||
p_estacionamiento.Visible = False
|
||||
p_sal_esta.Visible = True
|
||||
lv_Lis_Placa.Visible = True
|
||||
lv_Lis_Placa.BringToFront
|
||||
|
||||
Private l1 As Label = lv_Lis_Placa.SingleLineLayout.Label
|
||||
l1.TextColor = Colors.Black
|
||||
|
||||
c = skmt.ExecQuery("SELECT TMP_PLACA, TMP_HR_ENTRA, TMP_HR_SAL, TMP_DEN_FUE FROM TMP_INFO_EnSal")
|
||||
|
||||
If c.RowCount > 0 Then
|
||||
|
||||
lv_Lis_Placa.Clear
|
||||
For i = 0 To c.RowCount - 1
|
||||
c.Position = i
|
||||
If c.GetString("TMP_DEN_FUE") <> 1 Then
|
||||
lv_Lis_Placa.AddSingleLine(c.GetString("TMP_PLACA"))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Private Sub b_salida_LongClick
|
||||
RES = Msgbox2("Seguro que desea hacer el cierre todos los datos se borraran?","Cierre", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png")) 'ignore
|
||||
If RES = DialogResponse.POSITIVE Then
|
||||
skmt.ExecNonQuery("DELETE FROM TMP_INFO_EnSal")
|
||||
skmt.ExecNonQuery("DELETE FROM HIST_PLACAS")
|
||||
skmt.ExecNonQuery("DELETE FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'Folio'")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub lv_Lis_Placa_ItemClick (Position As Int, Value As Object)
|
||||
RES = Msgbox2Async("¿Seguro que esta placa va a salir?", "Cierre", "Sí", "", "No", LoadBitmap(File.DirAssets, "alert2.png"), False)
|
||||
Wait For Msgbox_Result(RES2 As Int)
|
||||
If RES2 = DialogResponse.POSITIVE Then
|
||||
|
||||
v = Value
|
||||
p = Position
|
||||
Impresion
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Impresion
|
||||
Dim placaSeleccionada As String = v
|
||||
c = skmt.ExecQuery2("SELECT TMP_PLACA, TMP_HR_ENTRA, TMP_HR_SAL, TMP_DEN_FUE, TMP_FOLIO FROM TMP_INFO_EnSal WHERE TMP_PLACA = ?", Array As String(placaSeleccionada))
|
||||
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
|
||||
Dim fechaSalida As String = Subs.traeFecha
|
||||
Dim fechaEntrada As String = c.GetString("TMP_HR_ENTRA")
|
||||
Dim partesFechaEntrada() As String = Regex.Split(" ", fechaEntrada)
|
||||
Dim partesFechaSalida() As String = Regex.Split(" ", fechaSalida)
|
||||
|
||||
If partesFechaEntrada.Length > 1 And partesFechaSalida.Length > 1 Then
|
||||
|
||||
Dim fechaSalida As String = Subs.traeFecha
|
||||
Dim fechaEntrada As String = c.GetString("TMP_HR_ENTRA")
|
||||
|
||||
Dim partesFechaEntrada() As String = Regex.Split(" ", fechaEntrada)
|
||||
Dim partesFechaSalida() As String = Regex.Split(" ", fechaSalida)
|
||||
|
||||
If partesFechaEntrada.Length > 1 And partesFechaSalida.Length > 1 Then
|
||||
Dim horaEntrada As String = partesFechaEntrada(1)
|
||||
Dim fechaEntrada As String = partesFechaEntrada(0)
|
||||
|
||||
Dim horaSalida As String = partesFechaSalida(1)
|
||||
Dim fechaSalida As String = partesFechaSalida(0)
|
||||
|
||||
Dim milisEntrada As Long = DateTime.TimeParse(horaEntrada)
|
||||
Dim milisSalida As Long = DateTime.TimeParse(horaSalida)
|
||||
|
||||
Dim diasEntrada As Long = DateTime.DateParse(fechaEntrada) / DateTime.TicksPerDay
|
||||
Dim diasSalida As Long = DateTime.DateParse(fechaSalida) / DateTime.TicksPerDay
|
||||
|
||||
Dim diferenciaDiasEnMilis As Long = (diasSalida - diasEntrada) * DateTime.TicksPerDay
|
||||
Dim diferenciaTotalMilis As Long = (milisSalida + diferenciaDiasEnMilis) - milisEntrada
|
||||
|
||||
Dim diferenciaTotalSegundos As Long = diferenciaTotalMilis / DateTime.TicksPerSecond
|
||||
Dim diferenciaTotalMinutos As Long = diferenciaTotalSegundos / 60
|
||||
Dim diferenciaTotalHoras As Long = diferenciaTotalMinutos / 60
|
||||
|
||||
Dim horasRestantes As Long = diferenciaTotalHoras
|
||||
Dim minutosRestantes As Long = diferenciaTotalMinutos Mod 60
|
||||
Dim segundosRestantes As Long = diferenciaTotalSegundos Mod 60
|
||||
|
||||
Log("Horas restantes: " & horasRestantes)
|
||||
Log("Minutos restantes: " & minutosRestantes)
|
||||
Log("Segundos restantes: " & segundosRestantes)
|
||||
End If
|
||||
|
||||
|
||||
' printer.WriteLine("------------------------------")
|
||||
' printer.WriteLine("---NO ES UN COMPROBANTE ------")
|
||||
' printer.WriteLine("---------FISCAL---------------")
|
||||
' printer.WriteLine("---COMPROBANTE DE ENTREGA-----")
|
||||
' printer.WriteLine("------------------------------")
|
||||
|
||||
Else
|
||||
Log("Formato de fecha incorrecto en entrada o salida.")
|
||||
End If
|
||||
|
||||
|
||||
ProgressDialogShow("Imprimiendo, un momento ...")
|
||||
Printer1.DisConnect
|
||||
If Not(Printer1.IsConnected) Then
|
||||
Log("Conectando a impresora ...")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada)
|
||||
Sleep(1000)
|
||||
Log("++++++ " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect 'Tratamos de reconectar
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
Else
|
||||
Log("conectando 2")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada) Or Not(Printer1.IsConnected)
|
||||
Sleep(1000)
|
||||
Log("****** " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
End If
|
||||
t = skmt.ExecQuery("SELECT TMP_TAR_H FROM TMP_TARIFA")
|
||||
If t.RowCount > 0 Then
|
||||
t.Position = 0
|
||||
Log(t.GetString("TMP_TAR_H"))
|
||||
|
||||
|
||||
Private sDate As String =DateTime.Date(DateTime.Now)
|
||||
Private sTime As String =DateTime.Time(DateTime.Now)
|
||||
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
|
||||
Printer1.WriteString(" Establecimietno: " & CRLF)
|
||||
Printer1.WriteString(" La Antigua, Restaurante - Bar" & CRLF)
|
||||
Printer1.WriteString(" Fecha: " & sDate & " " & sTime & " " & CRLF)
|
||||
Printer1.WriteString(" Folio: " & c.GetString("TMP_FOLIO") & CRLF)
|
||||
Printer1.WriteString(Chr(27) & Chr(69)) ' Código ESC/P para iniciar negritas
|
||||
Printer1.WriteString(" Placa: " & c.GetString("TMP_PLACA") & " " & CRLF)
|
||||
Printer1.WriteString(Chr(27) & Chr(70)) ' Código ESC/P para finalizar negritas
|
||||
Printer1.WriteString("Hora Entrada:" & c.GetString("TMP_HR_ENTRA")& CRLF)
|
||||
Printer1.WriteString("Hora Salida: " & Subs.traeFecha& CRLF)
|
||||
Printer1.WriteString("Tarifa por Hora: " & t.GetString("TMP_TAR_H") & CRLF)
|
||||
Printer1.WriteString("Horas: " & horasRestantes & CRLF)
|
||||
Printer1.WriteString("Munutos: " & minutosRestantes & CRLF)
|
||||
Printer1.WriteString("Total a pagar: " & Subs.CalcularCosto(diferenciaTotalMinutos, t.GetString("TMP_TAR_H"))& CRLF)
|
||||
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Sleep(1000)
|
||||
Printer1.DisConnect
|
||||
|
||||
ProgressDialogHide
|
||||
|
||||
RES3 = Msgbox2Async("¿Deceas volver a imprimir el ticket?", "Cierre", "Sí", "", "No", LoadBitmap(File.DirAssets, "alert2.png"), False)
|
||||
Wait For Msgbox_Result(RES4 As Int)
|
||||
|
||||
If RES4 = DialogResponse.POSITIVE Then
|
||||
Impresion
|
||||
Else
|
||||
skmt.ExecNonQuery2("INSERT INTO HIST_PLACAS(PLACA, ENTRADA, SALIDA, MONTO, FOLIO) values(?,?,?,?,?)", Array As String(c.GetString("TMP_PLACA"),c.GetString("TMP_HR_ENTRA"),Subs.traeFecha,Subs.CalcularCosto(diferenciaTotalMinutos, t.GetString("TMP_TAR_H")),c.GetString("TMP_FOLIO")))
|
||||
p_estacionamiento.Visible = True
|
||||
b_entrada.Visible = True
|
||||
b_salida.Visible = True
|
||||
lv_Lis_Placa.Visible = False
|
||||
p_sal_esta.Visible = False
|
||||
skmt.ExecNonQuery2("DELETE FROM TMP_INFO_EnSal WHERE TMP_PLACA = ? and TMP_FOLIO = ? ", Array As String(c.GetString("TMP_PLACA"), c.GetString("TMP_FOLIO")))
|
||||
End If
|
||||
|
||||
End If
|
||||
t.Close
|
||||
c.Close
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub b_regresar_Click
|
||||
p_estacionamiento.Visible = True
|
||||
b_entrada.Visible = True
|
||||
b_salida.Visible = True
|
||||
lv_Lis_Placa.Visible = False
|
||||
p_sal_esta.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub b_guardar_Click
|
||||
'Verificamos que haya una placa escrita
|
||||
If et_placa.Text <> "" Then
|
||||
|
||||
'Verificamos que haya un folio o no
|
||||
Private check As Cursor = skmt.ExecQuery($"SELECT * FROM TMP_INFO_EnSal WHERE TMP_PLACA = '${et_placa.Text}'"$)
|
||||
If check.RowCount = 0 Then
|
||||
|
||||
Private folio As Cursor = skmt.ExecQuery($"SELECT * FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'Folio'"$)
|
||||
If folio.RowCount = 0 Then
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) values(?,?)", Array As String("Folio", "1"))
|
||||
|
||||
Private folioasing As Cursor = skmt.ExecQuery($"SELECT * FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'Folio'"$)
|
||||
folioasing.Position = 0
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO TMP_INFO_EnSal(TMP_PLACA, TMP_HR_ENTRA ,TMP_DEN_FUE ,TMP_FOLIO) values (?,?,?,?)", Array As String(et_placa.Text,Subs.traeFecha,0, folioasing.GetString("CAT_VA_VALOR")))
|
||||
|
||||
'Vamos a llamar la rutina de impresion
|
||||
imprime_Guarda
|
||||
|
||||
folioasing.Close
|
||||
|
||||
Else If folio.RowCount > 0 Then
|
||||
|
||||
skmt.ExecNonQuery($"UPDATE CAT_VARIABLES SET CAT_VA_VALOR = CAT_VA_VALOR + 1 WHERE CAT_VA_DESCRIPCION = 'Folio' "$)
|
||||
|
||||
Private folioasing As Cursor = skmt.ExecQuery($"SELECT * FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'Folio'"$)
|
||||
folioasing.Position = 0
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO TMP_INFO_EnSal(TMP_PLACA, TMP_HR_ENTRA ,TMP_DEN_FUE ,TMP_FOLIO) values (?,?,?,?)", Array As String(et_placa.Text,Subs.traeFecha,0, folioasing.GetString("CAT_VA_VALOR")))
|
||||
|
||||
'Vamos a llamar la rutina de impresion
|
||||
imprime_Guarda
|
||||
|
||||
folioasing.Close
|
||||
|
||||
End If
|
||||
|
||||
Else If check.RowCount > 0 Then
|
||||
|
||||
MsgboxAsync("El vehiculo esta en el estacionamiento","Atención")
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
MsgboxAsync("Ingrese una placa valida","Atención")
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub imprime_Guarda
|
||||
|
||||
Private check As Cursor = skmt.ExecQuery($"SELECT * FROM TMP_INFO_EnSal WHERE TMP_PLACA = '${et_placa.Text}'"$)
|
||||
If check.RowCount > 0 Then
|
||||
|
||||
check.Position = 0
|
||||
|
||||
ProgressDialogShow("Imprimiendo, un momento ...")
|
||||
Printer1.DisConnect
|
||||
If Not(Printer1.IsConnected) Then
|
||||
Log("Conectando a impresora ...")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada)
|
||||
Sleep(1000)
|
||||
Log("++++++ " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect 'Tratamos de reconectar
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
Else
|
||||
Log("conectando 2")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada) Or Not(Printer1.IsConnected)
|
||||
Sleep(1000)
|
||||
Log("****** " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
End If
|
||||
|
||||
Private t As Cursor = skmt.ExecQuery("SELECT TMP_TAR_H FROM TMP_TARIFA")
|
||||
t.Position = 0
|
||||
Dim folio As Cursor = skmt.ExecQuery($"SELECT * FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'Folio'"$)
|
||||
folio.Position = 0
|
||||
|
||||
Dim fecha As String = check.GetString("TMP_HR_ENTRA")
|
||||
Dim fechaHora() As String = Regex.Split(" ", fecha)
|
||||
|
||||
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
|
||||
Printer1.WriteString("Establecimietno:" & CRLF)
|
||||
Printer1.WriteString("La Antigua, Restaurante - Bar" & CRLF)
|
||||
Printer1.WriteString("Fecha: " & fechaHora(0) & CRLF)
|
||||
Printer1.WriteString("Folio: " & folio.GetString("CAT_VA_VALOR")& CRLF)
|
||||
Printer1.WriteString("Placa: " & et_placa.Text & CRLF)
|
||||
Printer1.WriteString("Hora Entrada:" & fechaHora(1)& CRLF)
|
||||
Printer1.WriteString("Tarifa por Hora: " & t.GetString("TMP_TAR_H") & CRLF)
|
||||
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Sleep(1000)
|
||||
Printer1.DisConnect
|
||||
ProgressDialogHide
|
||||
|
||||
folio.Close
|
||||
t.Close
|
||||
check.Close
|
||||
|
||||
RES5 = Msgbox2Async("Deseas imprimirlo de nuevo?", "Atencion", "Sí", "", "No", LoadBitmap(File.DirAssets, "alert2.png"), False)
|
||||
Wait For Msgbox_Result(RES6 As Int)
|
||||
|
||||
If RES6 = DialogResponse.POSITIVE Then
|
||||
imprime_Guarda
|
||||
Else
|
||||
MsgboxAsync("Datos Guardados", "AVISO")
|
||||
p_guarda_info.Visible = False
|
||||
p_estacionamiento.Visible = True
|
||||
b_entrada.Visible = True
|
||||
b_salida.Visible = True
|
||||
b_Tarifa.Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub b_cancelar_Click
|
||||
b_entrada.Visible = True
|
||||
b_salida.Visible = True
|
||||
p_guarda_info.Visible = False
|
||||
p_estacionamiento.Visible = True
|
||||
et_placa.Text = ""
|
||||
End Sub
|
||||
|
||||
Sub Printer_Connected (Success As Boolean)
|
||||
If Success Then
|
||||
' B_IMP.Enabled = True
|
||||
StartPrinter
|
||||
Else
|
||||
' B_IMP.Enabled = False
|
||||
If Msgbox2("", "Printer Error","Reprint","Cancel","",Null) = DialogResponse.POSITIVE Then 'Ignore
|
||||
StartPrinter
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub StartPrinter
|
||||
Dim PairedDevices As Map
|
||||
Dim L As List
|
||||
Dim resimp As Int
|
||||
ToastMessageShow("Printing.....",True)
|
||||
PairedDevices.Initialize
|
||||
Try
|
||||
PairedDevices = cmp20.GetPairedDevices
|
||||
Catch
|
||||
Msgbox("Getting Paired Devices","Printer Error") 'Ignore
|
||||
printer.Close
|
||||
cmp20.Disconnect
|
||||
End Try
|
||||
If PairedDevices.Size = 0 Then
|
||||
Msgbox("Error Connecting to Printer - Printer Not Found","") 'Ignore
|
||||
Return
|
||||
End If
|
||||
If PairedDevices.Size = 1 Then
|
||||
Try
|
||||
cmp20.ConnectInsecure(btAdmin,PairedDevices.Get(PairedDevices.GetKeyAt(0)),1)
|
||||
Catch
|
||||
Msgbox("Connecting","Printer Error") 'Ignore
|
||||
printer.Close
|
||||
cmp20.Disconnect
|
||||
End Try
|
||||
Else
|
||||
L.Initialize
|
||||
For i = 0 To PairedDevices.Size - 1
|
||||
L.Add(PairedDevices.GetKeyAt(i))
|
||||
Next
|
||||
resimp = InputList(L, "Choose device", -1) 'Ignore
|
||||
If resimp <> DialogResponse.CANCEL Then
|
||||
cmp20.Connect(PairedDevices.Get(L.Get(resimp)))
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Sub B4XPage_Appear
|
||||
c = skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("MACIMP"))
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
Starter.MAC_IMPRESORA = c.GetString("CAT_VA_VALOR")
|
||||
End If
|
||||
If Starter.MAC_IMPRESORA = "" Then Starter.MAC_IMPRESORA = "0"
|
||||
' Log("|" & Starter.MAC_IMPRESORA & "|")
|
||||
Printer1.Initialize(Me, "Printer1")
|
||||
|
||||
If Printer1.IsConnected = False Then
|
||||
' Printer1.Connect
|
||||
' Log("1")
|
||||
Else
|
||||
Printer1.DisConnect
|
||||
Printer1.Connect
|
||||
Log("2")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Printer1_Connected (Success As Boolean)
|
||||
' If Logger Then Log("Printer1_Connected")
|
||||
If Success Then
|
||||
ToastMessageShow("Impresora conectada", False)
|
||||
skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("MACIMP"))
|
||||
skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("MACIMP",Starter.mac_impresora))
|
||||
LogColor("Impresora conectada", Colors.Green)
|
||||
' B_IMP2.Enabled = True
|
||||
impresoraConectada = True
|
||||
Else
|
||||
' Msgbox(Printer1.ConnectedErrorMsg, "Error connecting.") 'ignore
|
||||
' ToastMessageShow("Error conectando la impresora", False)
|
||||
LogColor("Error conectando la impresora", Colors.Red)
|
||||
errorImpresora = errorImpresora + 1
|
||||
If errorImpresora > 1 Then
|
||||
Starter.MAC_IMPRESORA = "0"
|
||||
errorImpresora = 0
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub b_Tarifa_Click
|
||||
p_tar_f.Visible = True
|
||||
b_entrada.Visible = False
|
||||
b_salida.Visible = False
|
||||
b_Tarifa.Visible = False
|
||||
b_resdia.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub b_tar_can_Click
|
||||
p_tar_f.Visible = False
|
||||
b_entrada.Visible = True
|
||||
b_salida.Visible = True
|
||||
b_resdia.Visible = True
|
||||
|
||||
b_Tarifa.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub b_tar_in_Click
|
||||
|
||||
If et_tar_f.Text <> "" Then
|
||||
|
||||
c = skmt.ExecQuery("SELECT TMP_TAR_H FROM TMP_TARIFA")
|
||||
If c.RowCount = 0 Then
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO TMP_TARIFA (TMP_TAR_H) VALUES (?)", Array As Object(et_tar_f.Text))
|
||||
MsgboxAsync("Tarifa guardada", "AVISO")
|
||||
p_tar_f.Visible = False
|
||||
p_estacionamiento.Visible = True
|
||||
b_entrada.Visible = True
|
||||
b_salida.Visible = True
|
||||
b_Tarifa.Visible = True
|
||||
|
||||
Else If c.RowCount > 0 Then
|
||||
|
||||
skmt.ExecNonQuery($"UPDATE TMP_TARIFA SET TMP_TAR_H = '${et_tar_f.Text}' "$)
|
||||
MsgboxAsync("Tarifa actualizada", "AVISO")
|
||||
p_tar_f.Visible = False
|
||||
p_estacionamiento.Visible = True
|
||||
b_entrada.Visible = True
|
||||
b_salida.Visible = True
|
||||
b_Tarifa.Visible = True
|
||||
|
||||
End If
|
||||
Else
|
||||
MsgboxAsync("Ingrese la tarifa por hora", "AVISO")
|
||||
End If
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Private Sub b_resdia_Click
|
||||
p_res.Visible = True
|
||||
p_estacionamiento.Visible = False
|
||||
|
||||
c = skmt.ExecQuery("SELECT * FROM TMP_INFO_EnSal")
|
||||
l_totales.Text = c.RowCount
|
||||
|
||||
|
||||
Dim fecha As String = Subs.traeFecha
|
||||
Dim fechaHora() As String = Regex.Split(" ", fecha)
|
||||
Log(fechaHora(0))
|
||||
Private d1 As Cursor = skmt.ExecQuery($"SELECT * FROM HIST_PLACAS WHERE SALIDA LIKE '%${fechaHora(0)}%'"$)
|
||||
l_totalsal.Text = d1.RowCount
|
||||
|
||||
Private d2 As Cursor = skmt.ExecQuery($"SELECT IFNULL(SUM(MONTO),0) AS MONTO FROM HIST_PLACAS WHERE SALIDA LIKE '%${fechaHora(0)}%'"$)
|
||||
d2.Position = 0
|
||||
l_montoto.Text = d2.GetString("MONTO")
|
||||
d2.Close
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub b_rescan_Click
|
||||
p_res.Visible = False
|
||||
p_estacionamiento.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub b_resacep_Click
|
||||
|
||||
End Sub
|
||||
Reference in New Issue
Block a user