mirror of
https://github.com/KeymonSoft/Intmex_Multiventa.git
synced 2026-04-17 12:56:08 +00:00
115 lines
4.1 KiB
QBasic
115 lines
4.1 KiB
QBasic
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Class
|
|
Version=11.5
|
|
@EndOfDesignText@
|
|
Sub Class_Globals
|
|
Private Root As B4XView 'ignore
|
|
Private xui As XUI 'ignore
|
|
|
|
Dim g As GPS
|
|
Dim ruta As String
|
|
Dim c As Cursor
|
|
|
|
Dim CANCELA As Button
|
|
Dim GUARDA As Button
|
|
Dim cuenta As String
|
|
Dim usuario As String
|
|
Dim sDate,sTime As String
|
|
Dim no_cliente As String
|
|
Dim no_ruta As String
|
|
|
|
Dim r_4 As RadioButton
|
|
Dim E_NOMBRE As EditText
|
|
Dim tgl As Toggle
|
|
Private l_sinUbicacion As Label
|
|
Private p_nuevoCliente As Panel
|
|
Private Label1 As Label
|
|
Private p_botones As Panel
|
|
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
|
|
Root.LoadLayout("nuevocliente")
|
|
ruta = File.DirInternal
|
|
If File.Exists(ruta, "kmt.db") = False Then
|
|
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
|
End If
|
|
' skmt.Initialize(ruta,"kmt.db", True)
|
|
End Sub
|
|
|
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
|
|
|
Sub B4XPage_Appear
|
|
E_NOMBRE.Text = ""
|
|
If Not(Starter.gps.GPSEnabled) Then
|
|
ToastMessageShow("Es necesario tener el GPS encendido", True)
|
|
StartActivity(Starter.gps.LocationSettingsIntent)
|
|
End If
|
|
GUARDA.Visible = False
|
|
Subs.panelVisible(p_nuevoCliente, 0, 0)
|
|
p_nuevoCliente.Height = Root.Height
|
|
p_nuevoCliente.Width = Root.Width
|
|
Subs.centraEtiqueta(Label1, Root.Width)
|
|
Subs.centraEtiqueta(l_sinUbicacion, Root.Width)
|
|
Subs.centraPanel(p_botones, Root.Width)
|
|
E_NOMBRE.Left = Round(Root.Width/2)-(E_NOMBRE.Width/2)
|
|
If B4XPages.MainPage.lat_gps <> "0.0" Then
|
|
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
|
|
l_sinUbicacion.Visible = False
|
|
End If
|
|
End Sub
|
|
|
|
Sub GPS_LocationChanged (Location1 As Location)
|
|
If B4XPages.MainPage.lat_gps <> "0.0" Then
|
|
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
|
|
l_sinUbicacion.Visible = False
|
|
End If
|
|
End Sub
|
|
|
|
Sub CANCELA_Click
|
|
B4XPages.ShowPage("Principal")
|
|
End Sub
|
|
|
|
Sub GUARDA_Click
|
|
If E_NOMBRE.Text = "" Then
|
|
ToastMessageShow("Se tiene que nombrar la tienda para continuar" , True)
|
|
Else
|
|
DateTime.DateFormat = "MM/dd/yyyy"
|
|
DateTime.Timeformat = "HHmmss"
|
|
sDate=DateTime.Date(DateTime.Now)
|
|
sTime=DateTime.Time(DateTime.Now)
|
|
Log($" //////////// Date: ${sDate} - Time: ${sTime} ////////////////"$)
|
|
'Aqui creamos manualmete la hora con el separador de los 2 puntos porque en algunas versiones de android no respeta el formato "Timeformat = 'HH:mm:ss'"
|
|
Private hora As String = sTime.SubString2(0,2)
|
|
Private mins As String = sTime.SubString2(2,4)
|
|
Private segs As String = sTime.SubString(4)
|
|
sTime = hora&":"&mins&":"&segs
|
|
Log("////////////// sTime: "&sTime&" ////////////////")
|
|
c=B4XPages.MainPage.skmt.ExecQuery("select CAT_CL_RUTA FROM kmt_info")
|
|
c.Position=0
|
|
no_ruta= c.GetString("CAT_CL_RUTA")
|
|
no_cliente= "N" & sTime & no_ruta
|
|
Log("++ ++ no_cliente = "&no_cliente)
|
|
c.Close
|
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_MTOCOMPRA,CAT_CL_NUM_SERIEFISICO, gestion) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0,0) ",Array As Object (no_cliente,no_ruta, E_NOMBRE.Text,"null","null","null","null","null","null","null","null","null","null","null","null","null",B4XPages.MainPage.lon_gps,B4XPages.MainPage.lat_gps))
|
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_STAY_STORE(HSS_CODIGO, HSS_IN , HSS_OUT , HSS_TOT) VALUES (?,0,0,0)", Array As Object (no_cliente))
|
|
B4XPages.MainPage.skmt.ExecNonQuery("delete from CUENTAA")
|
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente))
|
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CLIENTE_NUEVO(CN_ID_CLIENTE, CN_NOMBRE) VALUES (?,?)", Array As Object(no_cliente, E_NOMBRE.Text))
|
|
B4XPages.ShowPage("Cliente")
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub p_nuevoCliente_Click
|
|
|
|
End Sub |