Build1=Default,gunav2.keymon.com.mx
File1=alert2.png
File10=fila.bal
File11=fondo_kmt.jpg
File12=foto.bal
File13=guardagestion.bal
File14=guna_viejo.png
File15=Hacer pedido.jpg
File16=info_gral.bal
File17=infonavit1.jpg
File18=itembuttonblue.png
File19=keymon_logo.png
File2=alerta.jpg
File20=kmt.db
File21=login.bal
File22=LOGO SANFER.jpg
File23=logo_exitus1.jpg
File24=Malo.jpg
File25=mapa.bal
File26=MAPA_RUTAS.bal
File27=nopago.bal
File28=nuevocliente.bal
File29=Nvo Cliente.jpg
File3=alerta_amarilla.png
File30=palomita_verde.png
File31=pedido.bal
File32=planfia_logo.png
File33=planfia_logo_old.png
File34=planfia_logo_old2.png
File35=qr.bal
File36=RESDIA.bal
File37=ResDia.jpg
File38=ROJO.png
File39=salma.jpg
File4=AMARILLO.png
File40=salma.png
File41=seleccion.bal
File42=senial.jpg
File43=sync.png
File44=tache_rojo.png
File45=tarjeta.bal
File46=telefonos.bal
File47=Ticket dia.jpg
File48=Tiendita.jpg
File49=VERDE.png
File5=buscar.bal
File6=carrito.png
File7=COMIS.bal
File8=detalle_promo.bal
File9=durakelo.png
FileGroup1=Default Group
FileGroup10=Default Group
FileGroup11=Default Group
FileGroup12=Default Group
FileGroup13=Default Group
FileGroup14=Default Group
FileGroup15=Default Group
FileGroup16=Default Group
FileGroup17=Default Group
FileGroup18=Default Group
FileGroup19=Default Group
FileGroup2=Default Group
FileGroup20=Default Group
FileGroup21=Default Group
FileGroup22=Default Group
FileGroup23=Default Group
FileGroup24=Default Group
FileGroup25=Default Group
FileGroup26=Default Group
FileGroup27=Default Group
FileGroup28=Default Group
FileGroup29=Default Group
FileGroup3=Default Group
FileGroup30=Default Group
FileGroup31=Default Group
FileGroup32=Default Group
FileGroup33=Default Group
FileGroup34=Default Group
FileGroup35=Default Group
FileGroup36=Default Group
FileGroup37=Default Group
FileGroup38=Default Group
FileGroup39=Default Group
FileGroup4=Default Group
FileGroup40=Default Group
FileGroup41=Default Group
FileGroup42=Default Group
FileGroup43=Default Group
FileGroup44=Default Group
FileGroup45=Default Group
FileGroup46=Default Group
FileGroup47=Default Group
FileGroup48=Default Group
FileGroup49=Default Group
FileGroup5=Default Group
FileGroup6=Default Group
FileGroup7=Default Group
FileGroup8=Default Group
FileGroup9=Default Group
Group=Default Group
Library1=baqrcode
Library10=javaobject
Library11=okhttputils2
Library12=phone
Library13=randomaccessfile
Library14=reflection
Library15=rspopupmenu
Library16=serial
Library17=sql
Library18=togglelibrary
Library19=zxing_scanner
Library2=batteryprogressview
Library20=runtimepermissions
Library3=byteconverter
Library4=camera
Library5=core
Library6=firebaseadmob
Library7=googlemaps
Library8=googlemapsextras
Library9=gps
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: http://www.basic4ppc.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="33"/>~\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~AddApplicationText(<activity android:name="com.google.zxing.client.android.CaptureActivity"~\n~android:screenOrientation="landscape" ~\n~android:configChanges="orientation|keyboardHidden"~\n~android:theme="@android:style/Theme.NoTitleBar.Fullscreen"~\n~android:windowSoftInputMode="stateAlwaysHidden">~\n~</activity>)~\n~~\n~CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)~\n~	  'End of default text.~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")~\n~	AddManifestText(~\n~<uses-permission~\n~  android:name="android.permission.ACCESS_FINE_LOCATION"~\n~  android:maxSdkVersion="29" />~\n~)~\n~	AddManifestText(~\n~<uses-permission~\n~  android:name="android.permission.WRITE_EXTERNAL_STORAGE"~\n~  android:maxSdkVersion="28" />~\n~)~\n~AddManifestText(~\n~<uses-permission~\n~  android:name="android.permission.READ_PHONE_STATE"~\n~  android:maxSdkVersion="28" />~\n~)~\n~AddManifestText(~\n~<uses-permission~\n~  android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"~\n~  android:maxSdkVersion="28" />~\n~) 'in order to access the device non-resettable identifiers such as IMEI and serial number.~\n~AddManifestText(<uses-permission~\n~	android:name="android.permission.BLUETOOTH_ADMIN" />)~\n~	  ''''' CAMBIA LA CLAVE API~\n~AddApplicationText(~\n~<meta-data~\n~  android:name="com.google.android.geo.API_KEY"~\n~   android:value="AIzaSyBlBnx3O-DncOSv3oFIp-12wgujOYYcl-U"/>~\n~  <meta-data android:name="com.google.android.gms.version"~\n~   android:value="@integer/google_play_services_version" />~\n~)~\n~'Si al cargar un mapa de google manda este error "java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion". agregar la siguiente linea:~\n~AddApplicationText(<uses-library android:name="org.apache.http.legacy" android:required="false"/>)~\n~''CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)~\n~	  'End of default text.~\n~	  ~\n~~\n~
Module1=BatteryUtilities
Module10=gestion
Module11=Historico
Module12=MAPA_RUTAS
Module13=mapas
Module14=nopago
Module15=nuevocliente
Module16=pedidos
Module17=QR_MODULE
Module18=seleccion
Module19=Starter
Module2=BUSCAR
Module20=tarjeta
Module21=telefonos
Module3=CameraExClass
Module4=colonia
Module5=colonia2
Module6=DBRequestManager
Module7=detalle_promo
Module8=fila
Module9=foto
NumberOfFiles=49
NumberOfLibraries=20
NumberOfModules=21
Version=11.5
@EndOfDesignText@
#Region  Project Attributes 
	#ApplicationLabel: Danvit-V
	#VersionCode: 1
	#VersionName: 1.12.06
	'SupportedOrientations possible values: unspecified, landscape or portrait.
	#SupportedOrientations: portrait
	#CanInstallToExternalStorage: False
	#MultiDex: True
	'###########################################################################################################
	'######################           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

#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region
#Region Service Attributes
#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 reqManager As DBRequestManager
	Dim ruta As String
	Dim tgl As Toggle
	Public rp As RuntimePermissions
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 skmt As SQL
	Dim user As EditText
	Dim pass As EditText
	Dim c As Cursor
	Dim existe As String
	Dim paso1 As String
	Private IMEN As Label
	Dim IMEI As String
	Dim g As GPS
	Dim server As String
	Dim alterno As String
	Private b_menu As Button
	Dim PopupMenu As RSPopupMenu
	Dim cmd As DBCommand
	Private PDF As Button
	Private bpv1 As BatteryProgressView
	Dim batterystatus(11) As Int
	Private bu As BatteryUtilities
	Private l_version As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
	Log("================  Iniciamos App  ===================")
	ruta = File.DirInternal
	If(FirstTime) Then
		g.Initialize("GPS")
	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)
	'c=skmt.ExecQuery2("select COUNT(*) AS CUANTOS from CAT_CODIGOS where CAT_CO_PONDERACION =1 AND CAT_CO_ACCION = ?", Array As String("SERVER"))
	'c.Position =0
    
	'If c.GetString("CUANTOS") = 0 Then
	'skmt.ExecNonQuery2("INSERT INTO CAT_CODIGOS (CAT_CO_PONDERACION, CAT_CO_ACCION, CAT_CO_RESULTADO, CAT_CO_CONFIGURACION) VALUES (?,?,?,?)", Array As Object ("1","1","SERVER","http://masternoc.mx:1783"))
	'skmt.ExecNonQuery2("INSERT INTO CAT_CODIGOS (CAT_CO_PONDERACION, CAT_CO_ACCION, CAT_CO_RESULTADO, CAT_CO_CONFIGURACION) VALUES (?,?,?,?)", Array As Object ("0","2","SERVER","http://masternoc1.mx:1783"))
    
	'End If
	'c.Close
	'c=skmt.ExecQuery2("select CAT_CO_CONFIGURACION from CAT_CODIGOS where CAT_CO_PONDERACION =1 AND CAT_CO_ACCION = ?", Array As String("SERVER"))
	'c.Position =0
	'server = c.GetString("CAT_CO_CONFIGURACION")
	'c.Close
    
	Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_CUOTAS (HC_META6 TEXT, HC_META5 TEXT, HC_META4 TEXT, HC_META3 TEXT, HC_META2 TEXT, HC_META1 TEXT, HC_RUTA TEXT, HC_CUOTA1 TEXT, HC_CUOTA2 TEXT, HC_CUOTA3 TEXT, HC_CUOTA4 TEXT, HC_CUOTA5 TEXT, HC_CUOTA6 TEXT)")
	Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_GPS (HGDATE TEXT, HGLAT TEXT, HGLON TEXT)")
	Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_STAY_STORE (HSS_CODIGO TEXT, HSS_IN TEXT, HSS_OUT TEXT, HSS_TOT TEXT)")
	Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_STAY_OUT (HSO_INI TEXT, HSO_FIN TEXT)")
	Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS INVENT_X_ENVIAR (ALMACEN TEXT, PROID TEXT, CANTIDAD TEXT)")
	Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_RESUM_APK (HIST_RA_OBJMES TEXT, HIST_RA_VENTA TEXT, HIST_RA_TENDENCIA TEXT, HIST_RA_ALCANCE TEXT, HISR_RA_DRAOBJ TEXT, HIST_RA_DRAVTA TEXT, HIST_RA_DSOBJ TEXT, HIST_RA_DSVTA TEXT, HIST_RA_VPOOBJ TEXT, HIST_RA_VPOVTA TEXT, HIST_RA_COBCCC TEXT, HIST_RA_CTES TEXT, HIST_RA_ECO TEXT, HIST_RA_VISITPLAN TEXT, HIST_RA_VISIREAL TEXT, HIST_RA_COBVISIT TEXT, HIST_RA_FRECCOMPOBJ TEXT, HIST_RA_FRECCOMREAL TEXT, HIST_RA_VENTAMES1 TEXT, HIST_RA_VENTAMES2 TEXT, HIST_RA_VENTAMES3 TEXT, HIST_RA_VENTAMES4 TEXT, HIST_RA_RECHAZO TEXT, HIST_RA_RECHAZOPORCEN TEXT, HIST_RA_SEMANA1 TEXT, HIST_RA_SEMANA1_DIAS TEXT, HIST_RA_SEMANA1_DRA TEXT, HIST_RA_SEMANA2 TEXT, HIST_RA_SEMANA2_DIAS TEXT, HIST_RA_SEMANA2_DRA TEXT, HIST_RA_SEMANA3 TEXT, HIST_RA_SEMANA3_DIAS TEXT, HIST_RA_SEMANA4 TEXT, HIST_RA_SEMANA3_DRA TEXT, HIST_RA_SEMANA4_DIAS TEXT, HIST_RA_SEMANA4_DRA TEXT, HIST_RA_SEMANA5 TEXT, HIST_RA_SEMANA5_DIAS TEXT, HIST_RA_SEMANA5_DRA TEXT, HIST_RA_SEMANA1_LPT TEXT, HIST_RA_SEMANA2_LPT TEXT, HIST_RA_SEMANA3_LPT TEXT, HIST_RA_SEMANA4_LPT TEXT, HIST_RA_SEMANA5_LPT TEXT, HIST_RA_RUTA TEXT, HIST_RA_IDALMACEN TEXT)")
	Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_COMISIONES_MOVIL (HCM_IDALMACEN TEXT, HCM_RUTA TEXT, HCM_TOTAL_V TEXT, HCM_TOTAL_VIVE TEXT, HCM_TOTAL_GUNA TEXT,	HCM_TOTAL_BEB TEXT)")
	
	Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_GEOCERCA (HGCLIENTE TEXT, HGDATE TEXT, HGLAT TEXT, HGLON TEXT)")
	c=Starter.skmt.ExecQuery("select  COUNT(*) AS CUANTOS from HIST_STAY_OUT ")
	C.Position = 0
	If c.GetString("CUANTOS")  = 0 Then
		Starter.skmt.ExecNonQuery("INSERT INTO HIST_STAY_OUT(HSO_INI, HSO_FIN) VALUES (0,0)")
	End If
	C.Close

	server = "http://keymon.com.mx:1782"
	'server = "http://201.99.139.28:1783"
	If FirstTime Then
		reqManager.Initialize(Me, server)
	End If
	Activity.LoadLayout("login")
	'este codigo es para lo del menu
	PopupMenu.Initialize("PopupMenu", b_menu)
	PopupMenu.AddMenuItem(0, 0, "View")
	PopupMenu.AddMenuItem(1, 1, "Edit")
	PopupMenu.AddMenuItem(2, 2, "Details")
	PopupMenu.AddMenuItem(3, 3, "Remove")
	' menu fin
'	Wait For (GetAdvertisingId) Complete (Id As String)
'	Dim P As PhoneId
'	IMEN.Text = P.GetDeviceId
'	IMEI = P.GetDeviceId
	l_version.Text = Application.VersionName
End Sub

Sub Activity_Resume
	Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_READ_PHONE_STATE)
	Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
	If Result Then
		Dim P As PhoneId
		'user.Text = P.GetDeviceId
		IMEI = "" 'P.GetDeviceId
		IMEI = ""
	Else
		Log("Sin permisos para leer los datos del celular")
	End If
	Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
	Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
	If Result Then
		Log("Con permisos de ubicacion")
	Else
		Log("SIN permisos de ubicacion")
	End If
	Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
	Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
	If Result Then
		Log("Con permisos de almacenamiento")
	Else
		Log("Sin permisos de almacenamiento")
	End If
	'server = "http://201.99.139.28:1782"
	'server = "http://keymon.com.mx:1782"
	'server = "http://177.244.63.54:1782"
	server = "http://187.189.244.154:1782"
'	Log(File.DirInternal)
'	If Not(skmt.IsInitialized) Then skmt.Initialize(ruta,"kmt.db", True) : Log("Reinicializamos skmt")
	reqManager.Initialize(Me, server)
	tgl.Initialize()
'	tgl.ToggleGPS
	'tgl.TurnGPSOn
	g.Initialize("GPS")
	g.Start(0,0)
	c=Starter.skmt.ExecQuery2("select count(*) as CUANTOS from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("FECHA"))
	c.Position =0
	If c.GetString("CUANTOS") = 0 Then
		cmd.Initialize
		cmd.Name = "select_fecha"
		reqManager.ExecuteQuery(cmd , 0, "fecha")
		Msgbox("AJUSTAR FECHA","AVISO")
		Activity_Resume
	Else
		c=Starter.skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("FECHA"))
		c.Position =0
		Dim sDate,sTime As String
		DateTime.DateFormat = "yyyyMMdd"
		sDate=DateTime.Date(DateTime.Now)
		If sDate > "20291001" Then
			Msgbox("INSTALAR NUEVO APK" ,"AVISO")
			Activity_Resume
		End If
		If c.GetString("CAT_VA_VALOR") > sDate Then
			Msgbox("AJUSTAR LA FECHA YA QUE ES MENOR AL SISTEMA" ,"AVISO")
			Activity_Resume
		End If
	End If
	bu.Initialize
	batterystatus = bu.BatteryInformation
'	Msgbox(batterystatus(0),"aviso")
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Entrar_Click
	If user.Text = "ALTERNO" Then
		c=Starter.skmt.ExecQuery2("select CAT_CO_CONFIGURACION, CAT_CO_RESULTADO from CAT_CODIGOS where CAT_CO_PONDERACION =1 AND CAT_CO_ACCION = ?", Array As String("SERVER"))
		c.Position =0
		server = c.GetString("CAT_CO_CONFIGURACION")
		alterno = c.GetString("CAT_CO_RESULTADO")
		c.Close
		If alterno = 1 Then
			Starter.skmt.ExecNonQuery2("UPDATE CAT_CODIGOS SET CAT_CO_PONDERACION = 1 WHERE CAT_CO_ACCION = ? AND CAT_CO_RESULTADO = 2", Array As String ("SERVER"))
			Starter.skmt.ExecNonQuery2("UPDATE CAT_CODIGOS SET CAT_CO_PONDERACION = 0 WHERE CAT_CO_ACCION = ? AND CAT_CO_RESULTADO = 1", Array As String ("SERVER"))
		Else if alterno = 2 Then
			Starter.skmt.ExecNonQuery2("UPDATE CAT_CODIGOS SET CAT_CO_PONDERACION = 1 WHERE CAT_CO_ACCION = ? AND CAT_CO_RESULTADO = 1", Array As String ("SERVER"))
			Starter.skmt.ExecNonQuery2("UPDATE CAT_CODIGOS SET CAT_CO_PONDERACION = 0 WHERE CAT_CO_ACCION = ? AND CAT_CO_RESULTADO = 2", Array As String ("SERVER"))
		End If
		c=Starter.skmt.ExecQuery2("select CAT_CO_CONFIGURACION, CAT_CO_RESULTADO from CAT_CODIGOS where CAT_CO_PONDERACION =1 AND CAT_CO_ACCION = ?", Array As String("SERVER"))
		c.Position =0
		server = c.GetString("CAT_CO_CONFIGURACION")
		user.Text = server
		c.Close
		reqManager.Initialize(Me, server)
	else if user.Text = "KMTS1" Then
		Starter.skmt.ExecNonQuery("delete from usuarioa")
		Starter.skmt.ExecNonQuery2("INSERT INTO USUARIOA VALUES (?,?)", Array As Object(user.Text, pass.Text))
		Starter.skmt.ExecNonQuery("delete from cat_almacen")
		Starter.skmt.ExecNonQuery2("INSERT INTO CAT_ALMACEN(ID_ALMACEN) VALUES (?)", Array As Object (pass.Text))
		Starter.skmt.ExecNonQuery("delete from VERSION")
		Starter.skmt.ExecNonQuery2("INSERT INTO VERSION(NOVERSION) VALUES (?)", Array As Object ("2.1"))
		StartActivity(seleccion)
	else if user.Text = "BERNA1" Then
		Starter.skmt.ExecNonQuery("delete from usuarioa")
		Starter.skmt.ExecNonQuery2("INSERT INTO USUARIOA VALUES (?,?)", Array As Object(user.Text, "1"))
		Starter.skmt.ExecNonQuery("delete from cat_almacen")
		Starter.skmt.ExecNonQuery2("INSERT INTO CAT_ALMACEN(ID_ALMACEN) VALUES (?)", Array As Object ("1"))
		Starter.skmt.ExecNonQuery("delete from VERSION")
		Starter.skmt.ExecNonQuery2("INSERT INTO VERSION(NOVERSION) VALUES (?)", Array As Object ("2.1"))
		StartActivity(seleccion)
	else if user.Text = "IMEI" Then
		user.Text = IMEI
	End If
	c=Starter.skmt.ExecQuery2("select count(*) as EXISTE1 from usuarioa where usuario = ?", Array As String(user.Text))
	c.Position=0
	existe = c.GetString("EXISTE1")
	'existe = 1
	If existe = 0 Then
		'skmt.ExecNonQuery("delete from usuarioa")

'		If IMEI = "" Then
'			Dim cmd As DBCommand
'			cmd.Initialize
'			cmd.Name = "select_usuario_guna_DANV_1"
'			cmd.Parameters = Array As Object(user.Text, pass.Text)
'			reqManager.ExecuteQuery(cmd , 0, "usuario")
'	
		'Else
'	If IMEI = "" Then
		Dim cmd As DBCommand
		cmd.Initialize
		cmd.Name = "select_usuario_guna_DANV_10"
		cmd.Parameters = Array As Object(user.Text, pass.Text)
		reqManager.ExecuteQuery(cmd , 0, "usuario_10")
'	Else
'				Dim cmd As DBCommand
'				cmd.Initialize
'				cmd.Name = "select_usuario_guna_DANV"
'				cmd.Parameters = Array As Object(user.Text, pass.Text)
'				reqManager.ExecuteQuery(cmd , 0, "usuario")
'	End If
		'
		'End If
		Dim cmd As DBCommand
		cmd.Initialize
		cmd.Name = "select_version_DANV"
		reqManager.ExecuteQuery(cmd , 0, "version")
	Else
		StartActivity(seleccion)
	End If
End Sub

Sub JobDone(Job As HttpJob)
	If Job.Success = False Then
		ToastMessageShow("Error: " & Job.ErrorMessage, True)
	Else
		If Job.JobName = "DBRequest" Then
			Dim result As DBResult = reqManager.HandleJob(Job)
			If result.Tag = "version" Then 'query tag
				For Each records() As Object In result.Rows
					Starter.skmt.ExecNonQuery("delete from VERSION")
					Dim CAT_VE_VERSION As String = records(result.Columns.Get("CAT_VE_VERSION"))
					Starter.skmt.ExecNonQuery2("INSERT INTO VERSION(NOVERSION) VALUES (?)", Array As Object (CAT_VE_VERSION))
				Next
			End If
		End If
	 
		If Job.JobName = "DBRequest" Then
			Dim result As DBResult = reqManager.HandleJob(Job)
			If result.Tag = "agencia" Then 'query tag
				For Each records() As Object In result.Rows
					Dim ID_ALMACEN As String = records(result.Columns.Get("ID_ALMACEN"))
				Next
			End If
		End If
	 
		If Job.JobName = "DBRequest" Then
			Dim result As DBResult = reqManager.HandleJob(Job)
			If result.Tag = "fecha" Then 'query tag
				For Each records() As Object In result.Rows
					Dim FECHA_HOY As String = records(result.Columns.Get("FECHA"))
					Starter.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("FECHA"))
					starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("FECHA",FECHA_HOY))
				Next
        
			End If
		End If
	 
		If Job.JobName = "DBRequest" Then
			Dim result As DBResult = reqManager.HandleJob(Job)
			If result.Tag = "usuario" Then 'query tag
				For Each records() As Object In result.Rows
					Dim name As String = records(result.Columns.Get("USUARIO"))
					Dim ID_ALMACEN As String = records(result.Columns.Get("CAT_LO_AGENCIA"))
					Dim IMEI_BASE As String = records(result.Columns.Get("CAT_LO_IDTELEFONO"))
				Next
				paso1 = 1
			End If
		End If
	 
		If Job.JobName = "DBRequest" Then
			Dim result As DBResult = reqManager.HandleJob(Job)
			If result.Tag = "usuario_10" Then 'query tag
				For Each records() As Object In result.Rows
					Dim name As String = records(result.Columns.Get("USUARIO"))
					Dim ID_ALMACEN As String = records(result.Columns.Get("CAT_LO_AGENCIA"))
					Dim IMEI_BASE As String = records(result.Columns.Get("CAT_LO_IDTELEFONO"))
					IMEI_BASE = ""
				Next
				paso1 = 1
			End If
		End If
		Job.Release
	End If
	If paso1 =1 Then
		'If IMEI = "" Then
		If name = "OKActivo"  Then
			starter.skmt.ExecNonQuery("delete from usuarioa")
			Starter.skmt.ExecNonQuery2("INSERT INTO USUARIOA VALUES (?,?)", Array As Object(user.Text, pass.Text))
			Starter.skmt.ExecNonQuery("delete from cat_almacen")
			Starter.skmt.ExecNonQuery2("INSERT INTO CAT_ALMACEN(ID_ALMACEN) VALUES (?)", Array As Object (ID_ALMACEN))

			StartActivity(seleccion)
		Else If name  = "OKExpirado" Then
			Msgbox("Usuario Expirado llamar al administrador","")
		Else If name = "OKCancelado" Then
			Msgbox("Usuario Cancelado llamar al administrador","")
		Else
			Msgbox("Usuario o password No validos","")
		End If
		paso1 = 0
		'Else
'	If name = "OKActivo" & IMEI And  IMEI = IMEI_BASE Then
'		If name = "OKActivo" & IMEI Then
'			skmt.ExecNonQuery("delete from usuarioa")
'			skmt.ExecNonQuery2("INSERT INTO USUARIOA VALUES (?,?)", Array As Object(user.Text, pass.Text))
'			skmt.ExecNonQuery("delete from cat_almacen")
'			skmt.ExecNonQuery2("INSERT INTO CAT_ALMACEN(ID_ALMACEN) VALUES (?)", Array As Object (ID_ALMACEN))
		'
'			StartActivity(seleccion)
'		Else If name  = "OKExpirado"& IMEI Then
'			Msgbox("Usuario Expirado llamar al administrador","")
'		Else If name = "OKCancelado"& IMEI Then
'			Msgbox("Usuario Cancelado llamar al administrador","")
'		Else
'			Msgbox("Usuario o password No validos","")
'		End If
'		paso1 = 0
'	Else IF  name = "OKActivo" Then
'		Msgbox("Telefono no VALIDO!","")
'	Else
'		Msgbox("Usuario o password No validos","")
'	End If
		'End If
	End If
End Sub

Sub Activity_KeyPress (key As Int) As Boolean
	' BACK key pressed
	If key=KeyCodes.KEYCODE_BACK Then
		' I want to capture the key here so I return True
		'StartActivity(Main)
		ExitApplication
		'Return True
	End If
	' Returning False signals the system to handle the key
	Return False
End Sub

Sub GPS_LocationChanged (Location1 As Location)
	If user.text = "GPS" Then
		'user.Text=Location1.ConvertToMinutes(Location1.Latitude)
		'pass.text=Location1.ConvertToMinutes(Location1.Longitude)
		user.Text=Location1.Latitude
		pass.text=Location1.Longitude
		'btnTakePicture.Enabled = True
		's.ExecNonQuery2("INSERT INTO  HIST_GPS (HGDATE,HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, lat_gps, lon_gps))
	End If
End Sub

public Sub Initialize
	'Initialize the PopupMenu
End Sub

Sub PopupMenu_Dismiss
	ToastMessageShow("PopupMenu dismissed", False)
End Sub

Sub PopupMenu_MenuItemClick (ItemId As Int) As Boolean
	ToastMessageShow("Item " & ItemId & " clicked.", False)
	Return False
End Sub

Sub b_menu_Click
	PopupMenu.Show
End Sub

Sub PDF_Click

End Sub

Private Sub GetAdvertisingId As ResumableSub
	Dim jo As JavaObject = Me
	jo.RunMethod("GetAdvertisingId", Null)
	Wait For AdvertisingId_Ready (Success As Boolean, Id As String)
	Return Id
End Sub


#if Java
import java.util.concurrent.Callable;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.ads.identifier.AdvertisingIdClient.Info;

public static void GetAdvertisingId() {
   BA.runAsync(processBA, mostCurrent, "advertisingid_ready", new Object[] {false, ""}
       , new Callable<Object[]>() {
                   @Override
                   public Object[] call() throws Exception {
                       String id = AdvertisingIdClient.getAdvertisingIdInfo(mostCurrent).getId();
                       return new Object[] {true, id};
                   }
               }); }
#End If