Type=Activity
Version=3
@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.

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 g As GPS
    Dim skmt As SQL
	Dim c As Cursor
	Dim ListView1 As ListView
	Dim la_cuenta As Label
	Dim La_nombre As Label
	Dim la_Calle As Label
	Dim la_numero As Label
	Dim la_nint As Label
	Dim la_edo As Label
	Dim la_pob As Label
	Dim la_col As Label
	Dim la_cp As Label
	Dim la_zona As Label
	Dim la_entre1 As Label
	Dim la_entre2 As Label
	Dim gest As Button
	Dim la_saldotot As Label
	Dim la_saldooper As Label
	Dim la_saldof1 As Label
	Dim la_penal As Label
	Dim la_producto As Label
	Dim la_padre As Label
	Dim la_no_ird As Label

	Dim Tels As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
	'Do not forget to load the layout file created with the visual designer. For example:
	'Activity.LoadLayout("Layout1")
	If(FirstTime) Then
	 g.Initialize("GPS")
	End If
    Activity.LoadLayout("info_gral")
	Dim ruta As String
	
	' 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
	
	' se crea o no el archivo de la base de ddatos de kmt
	'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE 
	'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
	'SI SE REGRESA A ESTE ACTIVIDAD.
	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.ExecQuery("select pr_cd_credito,pr_cd_nombre,pr_cd_calle,pr_cd_numero,pr_cd_num_int,pr_cd_entrecalle1,pr_cd_entrecalle2,pr_cd_colonia,pr_cd_poblacion,pr_cd_edo,pr_cd_cp,pr_Cd_zona, pr_cf_saldotot,pr_cf_saldooper,pr_cf_saldof1, pr_cf_penalizacion, pr_kt_producto, Pr_Ca_Padre, Pr_Ca_No_Ird, PR_CA_CONVENIO,PR_CF_MTO_PRESTAMO,PR_CF_FECHA_DISP,PR_CF_SALDO_ACORT,PR_CF_SALDO_VEN,PR_CF_SALDO_PAGARE,PR_CF_CAPITAL from kmt_info where pr_cd_credito In (select cuenta from cuentaa)")
	  ' ListView1.Clear
	   
	   'If c.RowCount>0 Then
	    '  For i=0 To c.RowCount -1
		     c.Position=0
			 la_cuenta.Text = c.GetString("pr_cd_credito")
			 La_nombre.Text = c.GetString("pr_cd_nombre")
			 la_Calle.Text = c.GetString("pr_cd_calle")
			 'la_numero.Text = c.GetString("pr_cd_numero")
			 'la_nint.Text = c.GetString("pr_cd_num_int")
			 la_entre1.Text = c.GetString("PR_CF_CAPITAL")
			 'la_entre2.Text = c.GetString("pr_cd_entrecalle2")
			 la_col.Text = c.GetString("pr_cd_colonia")
			 la_pob.Text = c.GetString("pr_cd_poblacion")
			 la_edo.Text = c.GetString("pr_cd_edo")
			 la_cp.Text = c.GetString("pr_cd_cp")
			 'la_zona.Text = c.GetString("pr_Cd_zona")
			 la_saldotot.Text = c.GetString("PR_CA_CONVENIO")
			 la_saldooper.Text = c.GetString("PR_CF_MTO_PRESTAMO")
			 la_saldof1.Text = c.GetString("PR_CF_SALDO_VEN")
			 la_penal.Text = c.GetString("PR_CF_SALDO_PAGARE")
			 la_producto.Text = c.GetString("pr_kt_producto")
			 la_padre.Text = c.GetString("PR_CF_FECHA_DISP")
			 la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
			 
			 'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
	    '  Next
	   'End If
End Sub

Sub Activity_Resume
If g.GPSEnabled=False Then
	  ToastMessageShow("Habilitar el GPS", True)
	  StartActivity(g.LocationSettingsIntent)
	 Else
	  g.Start(0,0)
	 End If
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub ListView1_ItemLongClick (Position As Int, Value As Object)
	
End Sub

Sub gest_Click
	StartActivity(gestion)
End Sub

Sub Tels_Click
    StartActivity(telefonos)	
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(seleccion)
            'Return True
    End If
    ' Returning False signals the system to handle the key
    Return False
End Sub