Files
Profina_Reparto/gestion.bas

257 lines
8.2 KiB
QBasic

B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=7.01
@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
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 s As SQL
Dim c As Cursor
Dim nombre As EditText
Dim btn As Button
Dim lv As ListView
Dim telefono As EditText
Dim lb_gps As Label
Dim lat_gps As String
' Dim lon_gps As String
Dim contacto As EditText
Dim Resultado As EditText
Dim comentario As EditText
Dim codigos As Button
Dim parent As Button
Dim quien_llamo As String
Dim fecha As EditText
Dim l_fecha As Label
Dim l_monto As Label
Dim monto As EditText
Dim cuantos As String
Dim l_comentario As Label
Dim l_ird1 As Label
Dim ird1 As EditText
Dim l_ird2 As Label
Dim ird2 As EditText
Dim l_ird3 As Label
Dim ird3 As EditText
Dim l_ird4 As Label
Dim ird4 As EditText
Dim despues As Button
Dim cuenta As String
Dim usuario As String
Dim result As String
Dim pondera As String
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("guardagestion")
' Dim ruta As String
' valido donde escribo el archivo de la base de datos de kmt
' ruta = Main.ruta
' 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(Starter.ruta, "kmt.db") = False Then
' File.Copy(File.DirAssets, "kmt.db", Starter.ruta, "kmt.db")
' End If
s.Initialize(Starter.ruta,"kmt.db", True)
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
monto.Visible = False
l_monto.Visible = False
l_fecha.Visible = False
fecha.Visible = False
contacto.Text = ""
Resultado.Text= ""
comentario.Text =""
monto.Text = ""
fecha.Text = ""
End Sub
Sub Activity_Pause (UserClosed As Boolean)
' g.Start(0,0)
End Sub
Sub btn_Click
If Resultado.text<>"" And contacto.Text<>"" And comentario.text<>"" Then
' c=s.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 from kmt_info where pr_cd_credito In (select cuenta from cuentaa)")
'ESTO SE NECESITA PARA SACAR LOS VALORES Y COMPARAR LOS IRD
' c.Position=0
' Dim la_cuenta As String = c.GetString("pr_cd_credito")
' Dim La_nombre As String = 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_cd_entrecalle1")
' 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_cf_saldotot")
' la_saldooper.Text = c.GetString("pr_cf_saldooper")
' la_saldof1.Text = c.GetString("pr_cf_saldof1")
' la_penal.Text = c.GetString("pr_cf_penalizacion")
' la_producto.Text = c.GetString("pr_kt_producto")
' la_padre.Text = c.GetString("Pr_Ca_Padre")
' la_no_ird.Text = c.GetString("Pr_Ca_No_Ird")
c=s.ExecQuery("select CUENTA from cuentaa")
c.Position = 0
cuenta = c.GetString("CUENTA")
c=s.ExecQuery("select usuario from usuarioa")
c.Position = 0
usuario = c.GetString("USUARIO")
c=s.ExecQuery2("select CRDESC,CRCOD AS CODIGO,CRPROD from cod_result WHERE CRDESC = ? ", Array As String(Resultado.Text))
c.Position = 0
result = c.GetString("CODIGO")
'pondera = c.GetString("CAT_CO_PONDERACION")
Dim sDate,sTime As String
DateTime.DateFormat = "MM/dd/yyyy"
sDate=DateTime.Date(DateTime.Now)
sTime=DateTime.Time(DateTime.Now)
s.ExecNonQuery("UPDATE kmt_info set gestion = 1 where MGCTA In (select cuenta from cuentaa)")
s.ExecNonQuery2("UPDATE hist_visitas SET HIST_VI_VISITADOR = ?, HIST_VI_RESULTADO = ?, HIST_VI_CODIGO = ?, HIST_VI_PARENTESCO = ?, HIST_VI_COMENTARIO =?, HIST_VI_DPROM =?, HIST_VI_MPROM =? WHERE HIST_VI_CREDITO = ? ", Array As Object(usuario,Resultado.Text,result,contacto.text, comentario.Text,fecha.text,monto.Text, cuenta))
'datetime(updatedon,'localtime')
'CallSubDelayed(foto,"foto")
StartActivity(seleccion)
End If
End Sub
Sub GPS_LocationChanged (Location1 As Location)
Dim sDate,sTime As String
DateTime.DateFormat = "MM/dd/yyyy"
sDate=DateTime.Date(DateTime.Now)
sTime=DateTime.Time(DateTime.Now)
lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
's.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE,HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, lat_gps, lon_gps))
End Sub
Sub codigos_Click
quien_llamo = "codigo"
c=s.ExecQuery("select COUNT(*) AS CUANTOS from COD_RESULT WHERE CRPROD IN (select productoa from productoa)")
c.Position=0
cuantos = c.GetString("CUANTOS")
If cuantos = 0 Then
lv.Clear
lv.AddSingleLine("SIN CODIGOS")
Else
c=s.ExecQuery("select CRDESC AS DESC, CRCOD from COD_RESULT WHERE CRPROD IN (select productoa from productoa) ORDER BY CRDESC ASC")
lv.Clear
If c.RowCount>0 Then
For i=0 To c.RowCount -1
c.Position=i
lv.AddSingleLine(c.GetString("DESC"))
Next
End If
End If
End Sub
Sub lv_ItemClick (Position As Int, Value As Object)
Dim es_c_promesa As String
If quien_llamo = "codigo" Then
Resultado.Text = Value
If Resultado.Text <> "EQUIPO RECUPERADO" Then
comentario.Visible = True
l_comentario.Visible = True
l_ird1.Visible = False
ird1.Visible = False
l_ird2.Visible = False
ird2.Visible = False
l_ird3.Visible = False
ird3.Visible = False
l_ird4.Visible = False
ird4.Visible = False
' c=s.ExecQuery2("select CAT_CO_CONFIGURACION from CAT_CODIGOS WHERE CAT_CO_RDESCRIPCION = ? ", Array As String(Value))
' c.Position=0
' es_c_promesa=c.GetString("CAT_CO_CONFIGURACION")
If Resultado.Text = "PROMESA DE PAGO" Then
monto.Visible = True
l_monto.Visible = True
l_fecha.Visible = True
fecha.Visible = True
Else
monto.Visible = False
l_monto.Visible = False
l_fecha.Visible = False
fecha.Visible = False
End If
Else
comentario.Visible = False
l_comentario.Visible = False
l_ird1.Visible = True
ird1.Visible = True
l_ird2.Visible = True
ird2.Visible = True
l_ird3.Visible = True
ird3.Visible = True
l_ird4.Visible = True
ird4.Visible = True
End If
Else
contacto.Text = Value
End If
lv.Clear
End Sub
Sub parent_Click
quien_llamo = "parent"
c=s.ExecQuery("select CAT_PA_ID, CAT_PA_PARENTESCO from CAT_PARENTESCO order by CAT_PA_PARENTESCO asc")
lv.Clear
If c.RowCount>0 Then
For i=0 To c.RowCount -1
c.Position=i
lv.AddSingleLine(c.GetString("CAT_PA_PARENTESCO"))
Next
End If
End Sub
Sub despues_Click
s.ExecNonQuery("UPDATE kmt_info set gestion = 2 where pr_cd_credito In (select cuenta from cuentaa)")
's.ExecNonQuery2("insert into hist_Act (htel, hanombre) values (?,datetime(updatedon,'localtime'))" Array As String(cuantos))
'CallSubDelayed(foto,"foto")
StartActivity(colonia)
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