B4A=true Group=Default Group ModulesStructureVersion=1 Type=Activity Version=6.8 @EndOfDesignText@ #Region Activity Attributes #FullScreen: False #IncludeTitle: 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. Dim g As GPS Dim ruta As String ' Dim skmt As SQL Dim c As Cursor End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim CANCELA As Button Dim GUARDA As Button Dim cuenta As String Dim usuario As String Dim sDate,sTime As String Dim lat_gps, lon_gps As Double Dim no_cliente As String Dim no_ruta As String Dim r_4 As RadioButton Dim E_NOMBRE As EditText Dim tgl As Toggle End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: If(FirstTime) Then g.Initialize("GPS") End If Activity.LoadLayout("nuevocliente") ' valido donde escribo el archivo de la base de datos de kmt ' If File.ExternalWritable Then ' ruta = File.DirDefaultExternal ' Else ' ruta = File.DirInternal ' ' End If ' 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 Sub Activity_Resume E_NOMBRE.Text = "" tgl.Initialize ' tgl.TurnGPSOn ' If g.GPSEnabled=False Then ' ToastMessageShow("Habilitar el GPS", True) ' StartActivity(g.LocationSettingsIntent) ' Else g.Start(0,0) ' End If GUARDA.Visible = False End Sub Sub Activity_Pause (UserClosed As Boolean) g.Start(0,0) End Sub Sub GPS_LocationChanged (Location1 As Location) lat_gps=Location1.Latitude lon_gps=Location1.Longitude GUARDA.Visible = True End Sub Sub CANCELA_Click StartActivity(seleccion) 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" sDate=DateTime.Date(DateTime.Now) sTime=DateTime.Time(DateTime.Now) c=starter.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 c.Close Starter.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",lon_gps,lat_gps)) Starter.skmt.execNonQuery2("INSERT INTO HIST_STAY_STORE(HSS_CODIGO, HSS_IN , HSS_OUT , HSS_TOT) VALUES (?,0,0,0)", Array As Object (no_cliente)) Starter.skmt.execNonQuery("delete from CUENTAA") Starter.skmt.execNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente)) StartActivity(fila) End If End Sub