package gunav2.keymon.com.mx;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.B4AClass;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.debug.*;

public class c_bitacora extends B4AClass.ImplB4AClass implements BA.SubDelegator{
    private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
    private void innerInitialize(BA _ba) throws Exception {
        if (ba == null) {
            ba = new BA(_ba, this, htSubs, "gunav2.keymon.com.mx.c_bitacora");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", gunav2.keymon.com.mx.c_bitacora.class).invoke(this, new Object[] {null});
        else
            ba.raiseEvent2(null, true, "class_globals", false);
    }

 public anywheresoftware.b4a.keywords.Common __c = null;
public anywheresoftware.b4a.objects.B4XViewWrapper _root = null;
public anywheresoftware.b4a.objects.B4XViewWrapper.XUI _xui = null;
public anywheresoftware.b4a.sql.SQL _db = null;
public anywheresoftware.b4a.objects.B4XViewWrapper _root2 = null;
public anywheresoftware.b4a.objects.PanelWrapper _p_transparenteiniciofin2 = null;
public anywheresoftware.b4a.objects.ButtonWrapper _b_inicio_fin_venta2 = null;
public int _contadoriniciarventa = 0;
public int _precision = 0;
public boolean _inivenno = false;
public boolean _dentrodegeocerca = false;
public boolean _enventa = false;
public String _motivonoventa = "";
public String _motivonovisita = "";
public String _banderageocerca = "";
public gunav2.keymon.com.mx.dbrequestmanager _reqmanager = null;
public b4a.example.dateutils _dateutils = null;
public gunav2.keymon.com.mx.main _main = null;
public gunav2.keymon.com.mx.starter _starter = null;
public gunav2.keymon.com.mx.subs _subs = null;
public gunav2.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public gunav2.keymon.com.mx.appupdater _appupdater = null;
public gunav2.keymon.com.mx.firebasemessaging _firebasemessaging = null;
public gunav2.keymon.com.mx.tracker _tracker = null;
public gunav2.keymon.com.mx.newinst2 _newinst2 = null;
public gunav2.keymon.com.mx.b4xpages _b4xpages = null;
public gunav2.keymon.com.mx.b4xcollections _b4xcollections = null;
public gunav2.keymon.com.mx.httputils2service _httputils2service = null;
public gunav2.keymon.com.mx.xuiviewsutils _xuiviewsutils = null;
public String  _agregacolumna(String _tabla,String _columna,String _tipo) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 196;BA.debugLine="Sub agregaColumna(tabla As String, columna As Stri";
 //BA.debugLineNum = 197;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try { //BA.debugLineNum = 198;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exe";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("SELECT COUNT(*) AS fCol FROM pragma_table_info('"+__c.SmartStringFormatter("",(Object)(_tabla))+"') WHERE name='"+__c.SmartStringFormatter("",(Object)(_columna))+"'"))));
 //BA.debugLineNum = 199;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 200;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 201;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("ALTER TABLE "+__c.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 202;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
__c.LogImpl("432505862",("Columna \""+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+__c.SmartStringFormatter("",(Object)(_tabla))+"\"."),0);
 };
 } 
       catch (Exception e9) {
			ba.setLastException(e9); //BA.debugLineNum = 206;BA.debugLine="Try";
try { //BA.debugLineNum = 207;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("ALTER TABLE "+__c.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 208;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
__c.LogImpl("432505868",("Columna \""+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+__c.SmartStringFormatter("",(Object)(_tabla))+"\".."),0);
 } 
       catch (Exception e13) {
			ba.setLastException(e13); //BA.debugLineNum = 210;BA.debugLine="Log(LastException)";
__c.LogImpl("432505870",BA.ObjectToString(__c.LastException(ba)),0);
 };
 //BA.debugLineNum = 212;BA.debugLine="Log(2)";
__c.LogImpl("432505872",BA.NumberToString(2),0);
 };
 //BA.debugLineNum = 214;BA.debugLine="End Sub";
return "";
}
public String  _b_inicio_fin_venta2_click() throws Exception{
 //BA.debugLineNum = 128;BA.debugLine="Private Sub b_Inicio_Fin_venta2_Click";
 //BA.debugLineNum = 131;BA.debugLine="contadorIniciarVenta = 0";
_contadoriniciarventa = (int) (0);
 //BA.debugLineNum = 132;BA.debugLine="IniVenNO = False";
_inivenno = __c.False;
 //BA.debugLineNum = 133;BA.debugLine="If dentroDeGeocerca Then precision = 1";
if (_dentrodegeocerca) { 
_precision = (int) (1);};
 //BA.debugLineNum = 135;BA.debugLine="LogColor($\">>>>>>>>>>>>   EN VENTA : ${enVenta}";
__c.LogImpl("432243719",(">>>>>>>>>>>>   EN VENTA : "+__c.SmartStringFormatter("",(Object)(_enventa))+"    <<<<<<<<<<<<"),__c.Colors.Blue);
 //BA.debugLineNum = 136;BA.debugLine="motivoNoVenta = \"\"";
_motivonoventa = "";
 //BA.debugLineNum = 137;BA.debugLine="motivoNoVisita = \"\"";
_motivonovisita = "";
 //BA.debugLineNum = 138;BA.debugLine="p_transparenteInicioFin2.Visible = False";
_p_transparenteiniciofin2.setVisible(__c.False);
 //BA.debugLineNum = 139;BA.debugLine="If b_Inicio_Fin_venta2.Text = \"TERMINAR VISITA\" T";
if ((_b_inicio_fin_venta2.getText()).equals("TERMINAR VISITA")) { 
 //BA.debugLineNum = 140;BA.debugLine="mandaBitacora(Subs.fechanormal(DateTime.Now), Su";
_mandabitacora(_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),_subs._traeusuariodebd /*String*/ (ba),_subs._traealmacen /*String*/ (ba),_subs._traerutabitacora /*String*/ (ba),"Termina Venta",_subs._traecliente /*String*/ (ba),"",_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._lat_gps /*String*/ ,_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._lon_gps /*String*/ ,BA.NumberToString(_precision),_motivonoventa,_motivonovisita,_banderageocerca);
 //BA.debugLineNum = 141;BA.debugLine="enVenta = False";
_enventa = __c.False;
 //BA.debugLineNum = 142;BA.debugLine="LogColor($\">>>>>> EN VENTA: ${enVenta}\"$, Colors";
__c.LogImpl("432243726",(">>>>>> EN VENTA: "+__c.SmartStringFormatter("",(Object)(_enventa))+""),__c.Colors.Red);
 //BA.debugLineNum = 143;BA.debugLine="iniciamosVenta";
_iniciamosventa();
 //BA.debugLineNum = 144;BA.debugLine="B4XPages.ShowPageAndRemovePreviousPages(\"Princip";
_b4xpages._showpageandremovepreviouspages /*String*/ (ba,"Principal");
 }else if((_b_inicio_fin_venta2.getText()).equals("INICIAR VISITA")) { 
 //BA.debugLineNum = 147;BA.debugLine="contadorIniciarVenta = 0";
_contadoriniciarventa = (int) (0);
 //BA.debugLineNum = 148;BA.debugLine="IniVenNO = False";
_inivenno = __c.False;
 //BA.debugLineNum = 149;BA.debugLine="contadorIniciarVenta = contadorIniciarVenta + 1";
_contadoriniciarventa = (int) (_contadoriniciarventa+1);
 //BA.debugLineNum = 150;BA.debugLine="If contadorIniciarVenta = 1 And IniVenNO = False";
if (_contadoriniciarventa==1 && _inivenno==__c.False && (_motivonoventa).equals("NO VENTA") == false) { 
 //BA.debugLineNum = 151;BA.debugLine="IniVenNO = True";
_inivenno = __c.True;
 //BA.debugLineNum = 152;BA.debugLine="mandaBitacora(Subs.fechanormal(DateTime.Now), S";
_mandabitacora(_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),_subs._traeusuariodebd /*String*/ (ba),_subs._traealmacen /*String*/ (ba),_subs._traerutabitacora /*String*/ (ba),"Inicia Venta",_subs._traecliente /*String*/ (ba),_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),"",_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._lat_gps /*String*/ ,_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._lon_gps /*String*/ ,BA.NumberToString(_precision),"","",_banderageocerca);
 //BA.debugLineNum = 153;BA.debugLine="enVenta = True";
_enventa = __c.True;
 //BA.debugLineNum = 154;BA.debugLine="LogColor($\">>>>>> EN VENTA: ${enVenta}\"$, Color";
__c.LogImpl("432243738",(">>>>>> EN VENTA: "+__c.SmartStringFormatter("",(Object)(_enventa))+""),__c.Colors.Red);
 }else if(_contadoriniciarventa==1 && _inivenno==__c.False && (_motivonoventa).equals("NO VENTA")) { 
 //BA.debugLineNum = 157;BA.debugLine="IniVenNO = True";
_inivenno = __c.True;
 //BA.debugLineNum = 158;BA.debugLine="mandaBitacora(Subs.fechanormal(DateTime.Now), S";
_mandabitacora(_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),_subs._traeusuariodebd /*String*/ (ba),_subs._traealmacen /*String*/ (ba),_subs._traerutabitacora /*String*/ (ba),"Inicia Venta",_subs._traecliente /*String*/ (ba),_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),"",_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._lat_gps /*String*/ ,_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._lon_gps /*String*/ ,BA.NumberToString(_precision),_motivonoventa,"",_banderageocerca);
 //BA.debugLineNum = 159;BA.debugLine="enVenta = True";
_enventa = __c.True;
 //BA.debugLineNum = 160;BA.debugLine="LogColor($\">>>>>> EN VENTA: ${enVenta}\"$, Color";
__c.LogImpl("432243744",(">>>>>> EN VENTA: "+__c.SmartStringFormatter("",(Object)(_enventa))+""),__c.Colors.Red);
 }else if(_contadoriniciarventa>1) { 
 //BA.debugLineNum = 162;BA.debugLine="p_transparenteInicioFin2.Visible = False";
_p_transparenteiniciofin2.setVisible(__c.False);
 };
 };
 //BA.debugLineNum = 165;BA.debugLine="p_transparenteInicioFin2.Visible = False";
_p_transparenteiniciofin2.setVisible(__c.False);
 //BA.debugLineNum = 166;BA.debugLine="LogColor($\">>>>>>>>>>>>   EN VENTA : ${enVenta}";
__c.LogImpl("432243750",(">>>>>>>>>>>>   EN VENTA : "+__c.SmartStringFormatter("",(Object)(_enventa))+"    <<<<<<<<<<<<"),__c.Colors.Blue);
 //BA.debugLineNum = 167;BA.debugLine="End Sub";
return "";
}
public String  _b4xpage_created(anywheresoftware.b4a.objects.B4XViewWrapper _root1) throws Exception{
 //BA.debugLineNum = 28;BA.debugLine="Private Sub B4XPage_Created (Root1 As B4XView)";
 //BA.debugLineNum = 29;BA.debugLine="Root = Root1";
_root = _root1;
 //BA.debugLineNum = 31;BA.debugLine="End Sub";
return "";
}
public String  _borradatosbitacora() throws Exception{
 //BA.debugLineNum = 217;BA.debugLine="Sub borraDatosBitacora";
 //BA.debugLineNum = 218;BA.debugLine="db.ExecNonQuery(\"DELETE FROM BITACORAGPS\")";
_db.ExecNonQuery("DELETE FROM BITACORAGPS");
 //BA.debugLineNum = 219;BA.debugLine="End Sub";
return "";
}
public String  _cargamospanel() throws Exception{
 //BA.debugLineNum = 170;BA.debugLine="private Sub cargamosPanel";
 //BA.debugLineNum = 171;BA.debugLine="Log(p_transparenteInicioFin2.IsInitialized)";
__c.LogImpl("432309249",BA.ObjectToString(_p_transparenteiniciofin2.IsInitialized()),0);
 //BA.debugLineNum = 173;BA.debugLine="If Not(p_transparenteInicioFin2.IsInitialized) Th";
if (__c.Not(_p_transparenteiniciofin2.IsInitialized())) { 
 //BA.debugLineNum = 174;BA.debugLine="LogColor(\">>>>>>>   CARGAMOS PANEL BITACORA\", Co";
__c.LogImpl("432309252",">>>>>>>   CARGAMOS PANEL BITACORA",__c.Colors.Red);
 //BA.debugLineNum = 175;BA.debugLine="Root2.LoadLayout(\"inicioFinVenta\")";
_root2.LoadLayout("inicioFinVenta",ba);
 //BA.debugLineNum = 176;BA.debugLine="p_transparenteInicioFin2.Width = Root2.Width";
_p_transparenteiniciofin2.setWidth(_root2.getWidth());
 //BA.debugLineNum = 177;BA.debugLine="p_transparenteInicioFin2.Height = Root2.Height";
_p_transparenteiniciofin2.setHeight(_root2.getHeight());
 //BA.debugLineNum = 178;BA.debugLine="b_Inicio_Fin_venta2.top = 700";
_b_inicio_fin_venta2.setTop((int) (700));
 //BA.debugLineNum = 179;BA.debugLine="b_Inicio_Fin_venta2.Left = 5";
_b_inicio_fin_venta2.setLeft((int) (5));
 //BA.debugLineNum = 180;BA.debugLine="b_Inicio_Fin_venta2.Width = Root2.Width - 20";
_b_inicio_fin_venta2.setWidth((int) (_root2.getWidth()-20));
 //BA.debugLineNum = 181;BA.debugLine="b_Inicio_Fin_venta2.Text = \"INICIAR VISITA\"";
_b_inicio_fin_venta2.setText(BA.ObjectToCharSequence("INICIAR VISITA"));
 //BA.debugLineNum = 182;BA.debugLine="p_transparenteInicioFin2.BringToFront";
_p_transparenteiniciofin2.BringToFront();
 };
 //BA.debugLineNum = 184;BA.debugLine="End Sub";
return "";
}
public String  _class_globals() throws Exception{
 //BA.debugLineNum = 1;BA.debugLine="Sub Class_Globals";
 //BA.debugLineNum = 2;BA.debugLine="Private Root As B4XView 'ignore";
_root = new anywheresoftware.b4a.objects.B4XViewWrapper();
 //BA.debugLineNum = 3;BA.debugLine="Private xui As XUI 'ignore";
_xui = new anywheresoftware.b4a.objects.B4XViewWrapper.XUI();
 //BA.debugLineNum = 4;BA.debugLine="Dim db As SQL";
_db = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 5;BA.debugLine="Private Root2 As B4XView";
_root2 = new anywheresoftware.b4a.objects.B4XViewWrapper();
 //BA.debugLineNum = 6;BA.debugLine="Dim p_transparenteInicioFin2 As Panel";
_p_transparenteiniciofin2 = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 7;BA.debugLine="Dim b_Inicio_Fin_venta2 As Button";
_b_inicio_fin_venta2 = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 8;BA.debugLine="Dim contadorIniciarVenta, precision As Int";
_contadoriniciarventa = 0;
_precision = 0;
 //BA.debugLineNum = 9;BA.debugLine="Dim IniVenNO, dentroDeGeocerca, enVenta As Boolea";
_inivenno = false;
_dentrodegeocerca = false;
_enventa = false;
 //BA.debugLineNum = 10;BA.debugLine="Dim motivoNoVenta, motivoNoVisita As String";
_motivonoventa = "";
_motivonovisita = "";
 //BA.debugLineNum = 11;BA.debugLine="Dim banderaGeoCerca As String";
_banderageocerca = "";
 //BA.debugLineNum = 12;BA.debugLine="Private reqManager As DBRequestManager";
_reqmanager = new gunav2.keymon.com.mx.dbrequestmanager();
 //BA.debugLineNum = 13;BA.debugLine="End Sub";
return "";
}
public String  _iniciamosventa() throws Exception{
 //BA.debugLineNum = 191;BA.debugLine="Sub iniciamosVenta";
 //BA.debugLineNum = 192;BA.debugLine="enVenta = False";
_enventa = __c.False;
 //BA.debugLineNum = 193;BA.debugLine="b_Inicio_Fin_venta2.Text = \"INICIAR VISITA\"";
_b_inicio_fin_venta2.setText(BA.ObjectToCharSequence("INICIAR VISITA"));
 //BA.debugLineNum = 194;BA.debugLine="End Sub";
return "";
}
public String  _iniciofin() throws Exception{
 //BA.debugLineNum = 112;BA.debugLine="Sub inicioFin";
 //BA.debugLineNum = 113;BA.debugLine="LogColor($\">>>>>>>>>>>>   XX EN VENTA : ${enVenta";
__c.LogImpl("432178177",(">>>>>>>>>>>>   XX EN VENTA : "+__c.SmartStringFormatter("",(Object)(_enventa))+"    <<<<<<<<<<<<"),__c.Colors.Blue);
 //BA.debugLineNum = 114;BA.debugLine="Log(b_Inicio_Fin_venta2.Text)";
__c.LogImpl("432178178",_b_inicio_fin_venta2.getText(),0);
 //BA.debugLineNum = 115;BA.debugLine="If  enVenta = False Then";
if (_enventa==__c.False) { 
 //BA.debugLineNum = 116;BA.debugLine="p_transparenteInicioFin2.BringToFront";
_p_transparenteiniciofin2.BringToFront();
 //BA.debugLineNum = 117;BA.debugLine="p_transparenteInicioFin2.Visible = True";
_p_transparenteiniciofin2.setVisible(__c.True);
 }else {
 //BA.debugLineNum = 121;BA.debugLine="If b_Inicio_Fin_venta2.Text <> \"TERMINAR VISITA\"";
if ((_b_inicio_fin_venta2.getText()).equals("TERMINAR VISITA") == false) { 
 //BA.debugLineNum = 122;BA.debugLine="p_transparenteInicioFin2.Visible = False";
_p_transparenteiniciofin2.setVisible(__c.False);
 };
 };
 //BA.debugLineNum = 126;BA.debugLine="End Sub";
return "";
}
public Object  _initialize(anywheresoftware.b4a.BA _ba,Object _vcallback,String _veventname,anywheresoftware.b4a.objects.B4XViewWrapper _vroot,anywheresoftware.b4a.sql.SQL _db1,gunav2.keymon.com.mx.dbrequestmanager _dbreq) throws Exception{
innerInitialize(_ba);
 //BA.debugLineNum = 16;BA.debugLine="Public Sub Initialize (vCallback As Object, vEvent";
 //BA.debugLineNum = 17;BA.debugLine="db = db1";
_db = _db1;
 //BA.debugLineNum = 18;BA.debugLine="Root2 = vRoot";
_root2 = _vroot;
 //BA.debugLineNum = 19;BA.debugLine="reqManager = DBReq";
_reqmanager = _dbreq;
 //BA.debugLineNum = 20;BA.debugLine="db.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS BITAC";
_db.ExecNonQuery("CREATE TABLE IF NOT EXISTS BITACORAGPS(fechab TEXT, usuariob TEXT, almacenb TEXT, rutab TEXT, eventob TEXT, clienteb TEXT, iniciob TEXT, finb TEXT, latitudb TEXT, longitudb TEXT, precision TEXT, motivonoventa TEXT, motivonovisita TEXT, BAN_GEOB TEXT)");
 //BA.debugLineNum = 21;BA.debugLine="agregaColumna(\"BITACORAGPS\", \"BAN_GEOB\", \"TEXT\")";
_agregacolumna("BITACORAGPS","BAN_GEOB","TEXT");
 //BA.debugLineNum = 22;BA.debugLine="contadorIniciarVenta = 0";
_contadoriniciarventa = (int) (0);
 //BA.debugLineNum = 23;BA.debugLine="cargamosPanel";
_cargamospanel();
 //BA.debugLineNum = 24;BA.debugLine="Return Me";
if (true) return this;
 //BA.debugLineNum = 25;BA.debugLine="End Sub";
return null;
}
public String  _jobdone(gunav2.keymon.com.mx.httpjob _job) throws Exception{
gunav2.keymon.com.mx.dbrequestmanager._dbresult _result = null;
 //BA.debugLineNum = 221;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 222;BA.debugLine="Log(\"JOBDONE BITACORA\")";
__c.LogImpl("432636929","JOBDONE BITACORA",0);
 //BA.debugLineNum = 223;BA.debugLine="If Job.JobName = \"DBRequest\" Then";
if ((_job._jobname /*String*/ ).equals("DBRequest")) { 
 //BA.debugLineNum = 224;BA.debugLine="Dim RESULT As DBResult = reqManager.HandleJob(Jo";
_result = _reqmanager._handlejob /*gunav2.keymon.com.mx.dbrequestmanager._dbresult*/ (_job);
 //BA.debugLineNum = 225;BA.debugLine="Log($\"Tag: ${RESULT.tag}, success=${Job.Success}";
__c.LogImpl("432636932",("Tag: "+__c.SmartStringFormatter("",_result.Tag /*Object*/ )+", success="+__c.SmartStringFormatter("",(Object)(_job._success /*boolean*/ ))+""),0);
 };
 //BA.debugLineNum = 228;BA.debugLine="If Job.Success = False Then";
if (_job._success /*boolean*/ ==__c.False) { 
 //BA.debugLineNum = 230;BA.debugLine="LogColor(\"Error: \" & Job.ErrorMessage, Colors.re";
__c.LogImpl("432636937","Error: "+_job._errormessage /*String*/ ,__c.Colors.Red);
 }else {
 };
 //BA.debugLineNum = 234;BA.debugLine="End Sub";
return "";
}
public String  _mandabitacora(String _fechab,String _usuariob,String _almacenb,String _rutab,String _eventob,String _clienteb,String _iniciob,String _finb,String _latitudb,String _longitudb,String _precisionb,String _motivonoventab,String _motivonovisitab,String _ban_geob) throws Exception{
gunav2.keymon.com.mx.dbrequestmanager._dbcommand _cmd = null;
String _nombrecliente = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _e = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 37;BA.debugLine="Sub mandaBitacora(fechab As String, usuariob As St";
 //BA.debugLineNum = 38;BA.debugLine="Log(motivoNoVisitab)";
__c.LogImpl("431981569",_motivonovisitab,0);
 //BA.debugLineNum = 40;BA.debugLine="Private cmd As DBCommand";
_cmd = new gunav2.keymon.com.mx.dbrequestmanager._dbcommand();
 //BA.debugLineNum = 41;BA.debugLine="cmd.Initialize";
_cmd.Initialize();
 //BA.debugLineNum = 42;BA.debugLine="cmd.Name = \"mandaBitacora3_GUNA\"";
_cmd.Name /*String*/  = "mandaBitacora3_GUNA";
 //BA.debugLineNum = 44;BA.debugLine="Private nombreCliente As String = traeNombreClien";
_nombrecliente = _traenombrecliente(_clienteb);
 //BA.debugLineNum = 45;BA.debugLine="If eventob = \"Llega a almacen\" Then";
if ((_eventob).equals("Llega a almacen")) { 
 //BA.debugLineNum = 46;BA.debugLine="nombreCliente = \"BOLETA\"";
_nombrecliente = "BOLETA";
 //BA.debugLineNum = 47;BA.debugLine="clienteb = \"\"";
_clienteb = "";
 //BA.debugLineNum = 48;BA.debugLine="finb = iniciob";
_finb = _iniciob;
 };
 //BA.debugLineNum = 50;BA.debugLine="If eventob = \"Salida almacen\" Then nombreCliente";
if ((_eventob).equals("Salida almacen")) { 
_nombrecliente = "CHECKLIST";};
 //BA.debugLineNum = 51;BA.debugLine="If eventob = \"Fin Día\" Then nombreCliente = \"FIN";
if ((_eventob).equals("Fin Día")) { 
_nombrecliente = "FIN DIA";};
 //BA.debugLineNum = 52;BA.debugLine="If eventob = \"Carga día\" Then nombreCliente = \"CA";
if ((_eventob).equals("Carga día")) { 
_nombrecliente = "CARGA DIA";};
 //BA.debugLineNum = 53;BA.debugLine="If eventob = \"Carga día suplencia\" Then nombreCli";
if ((_eventob).equals("Carga día suplencia")) { 
_nombrecliente = _traerutassup();};
 //BA.debugLineNum = 54;BA.debugLine="If eventob <> \"Termina Venta\" And eventob <> \"No";
if ((_eventob).equals("Termina Venta") == false && (_eventob).equals("No Venta") == false) { 
 //BA.debugLineNum = 55;BA.debugLine="db.ExecNonQuery($\"INSERT INTO BITACORAGPS (fecha";
_db.ExecNonQuery(("INSERT INTO BITACORAGPS (fechab, usuariob , almacenb , rutab , eventob , clienteb , iniciob , finb , latitudb, longitudb , precision , motivonoventa , motivonovisita, BAN_GEOB) VALUES ('"+__c.SmartStringFormatter("",(Object)(_fechab))+"' ,'"+__c.SmartStringFormatter("",(Object)(_usuariob))+"' , '"+__c.SmartStringFormatter("",(Object)(_almacenb))+"' , '"+__c.SmartStringFormatter("",(Object)(_rutab))+"' , '"+__c.SmartStringFormatter("",(Object)(_eventob))+"' , '"+__c.SmartStringFormatter("",(Object)(_clienteb))+"' , '"+__c.SmartStringFormatter("",(Object)(_iniciob))+"' , '"+__c.SmartStringFormatter("",(Object)(_finb))+"' , '"+__c.SmartStringFormatter("",(Object)(_latitudb))+"' , '"+__c.SmartStringFormatter("",(Object)(_longitudb))+"' , '"+__c.SmartStringFormatter("",(Object)(_precisionb))+"' , '"+__c.SmartStringFormatter("",(Object)(_motivonoventab))+"' , '"+__c.SmartStringFormatter("",(Object)(_motivonovisitab))+"', '"+__c.SmartStringFormatter("",(Object)(_ban_geob))+"')"));
 }else {
 //BA.debugLineNum = 57;BA.debugLine="Private e As Cursor = db.ExecQuery($\"select fech";
_e = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_e = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_db.ExecQuery(("select fechab from BITACORAGPS where usuariob = '"+__c.SmartStringFormatter("",(Object)(_usuariob))+"' and almacenb = '"+__c.SmartStringFormatter("",(Object)(_almacenb))+"' and rutab = '"+__c.SmartStringFormatter("",(Object)(_rutab))+"' and clienteb = '"+__c.SmartStringFormatter("",(Object)(_clienteb))+"' and eventob = 'Inicia Venta' order by fechab desc"))));
 //BA.debugLineNum = 58;BA.debugLine="If e.RowCount > 0 Then";
if (_e.getRowCount()>0) { 
 //BA.debugLineNum = 59;BA.debugLine="e.Position = 0";
_e.setPosition((int) (0));
 //BA.debugLineNum = 60;BA.debugLine="Log(\"ACTUALIZA BITACORA\")";
__c.LogImpl("431981591","ACTUALIZA BITACORA",0);
 //BA.debugLineNum = 61;BA.debugLine="If eventob = \"Termina Venta\" Then";
if ((_eventob).equals("Termina Venta")) { 
 //BA.debugLineNum = 62;BA.debugLine="db.ExecNonQuery($\"update BITACORAGPS set finb";
_db.ExecNonQuery(("update BITACORAGPS set finb = '"+__c.SmartStringFormatter("",(Object)(_finb))+"' where rutab = '"+__c.SmartStringFormatter("",(Object)(_rutab))+"' and almacenb = '"+__c.SmartStringFormatter("",(Object)(_almacenb))+"' and usuariob = '"+__c.SmartStringFormatter("",(Object)(_usuariob))+"' and clienteb = '"+__c.SmartStringFormatter("",(Object)(_clienteb))+"' and fechab = '"+__c.SmartStringFormatter("",(Object)(_e.GetString("fechab")))+"' "));
 //BA.debugLineNum = 63;BA.debugLine="cmd.Parameters = Array As Object(finb, rutab,";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(_finb),(Object)(_rutab),(Object)(_almacenb),(Object)(_usuariob),(Object)(_clienteb),(Object)("Inicia Venta"),(Object)(_e.GetString("fechab"))};
 }else if((_eventob).equals("No Venta")) { 
 //BA.debugLineNum = 65;BA.debugLine="db.ExecNonQuery($\"update BITACORAGPS set finb";
_db.ExecNonQuery(("update BITACORAGPS set finb = '"+__c.SmartStringFormatter("",(Object)(_finb))+"', motivonoventa = '"+__c.SmartStringFormatter("",(Object)(_motivonoventab))+"', motivonovisita = '"+__c.SmartStringFormatter("",(Object)(_motivonovisitab))+"' where rutab = '"+__c.SmartStringFormatter("",(Object)(_rutab))+"' and almacenb = '"+__c.SmartStringFormatter("",(Object)(_almacenb))+"' and usuariob = '"+__c.SmartStringFormatter("",(Object)(_usuariob))+"' and clienteb = '"+__c.SmartStringFormatter("",(Object)(_clienteb))+"' and fechab = '"+__c.SmartStringFormatter("",(Object)(_e.GetString("fechab")))+"' "));
 //BA.debugLineNum = 66;BA.debugLine="cmd.Parameters = Array As Object(finb, motivoN";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(_finb),(Object)(_motivonoventab),(Object)(_motivonovisitab),(Object)(_rutab),(Object)(_almacenb),(Object)(_usuariob),(Object)(_clienteb),(Object)("Inicia Venta"),(Object)(_e.GetString("fechab"))};
 };
 };
 };
 //BA.debugLineNum = 70;BA.debugLine="If eventob <> \"Inicia Venta\" Then";
if ((_eventob).equals("Inicia Venta") == false) { 
 //BA.debugLineNum = 71;BA.debugLine="Private c As Cursor = db.ExecQuery($\"select * fr";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_db.ExecQuery(("select * from BITACORAGPS where usuariob = '"+__c.SmartStringFormatter("",(Object)(_usuariob))+"' and almacenb = '"+__c.SmartStringFormatter("",(Object)(_almacenb))+"' and rutab = '"+__c.SmartStringFormatter("",(Object)(_rutab))+"' and clienteb = '"+__c.SmartStringFormatter("",(Object)(_clienteb))+"' order by fechab desc"))));
 //BA.debugLineNum = 72;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 73;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 74;BA.debugLine="cmd.Parameters = Array As Object(c.GetString(\"a";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(_c.GetString("almacenb")),(Object)(_c.GetString("usuariob")),(Object)(_c.GetString("rutab")),(Object)(_c.GetString("eventob")),(Object)(_c.GetString("clienteb")),(Object)(_nombrecliente),(Object)(_c.GetString("iniciob")),(Object)(_c.GetString("finb")),(Object)(_c.GetString("latitudb")),(Object)(_c.GetString("longitudb")),(Object)(_c.GetString("precision")),(Object)(_c.GetString("motivonoventa")),(Object)(_c.GetString("motivonovisita")),(Object)(_c.GetString("fechab")),(Object)(_c.GetString("BAN_GEOB"))};
 //BA.debugLineNum = 75;BA.debugLine="reqManager.ExecuteCommand(cmd , \"mandaBitacora\"";
_reqmanager._executecommand /*String*/ (_cmd,(Object)("mandaBitacora"));
 };
 };
 //BA.debugLineNum = 79;BA.debugLine="End Sub";
return "";
}
public String  _p_transparenteiniciofin2_click() throws Exception{
 //BA.debugLineNum = 186;BA.debugLine="Sub p_transparenteInicioFin2_click";
 //BA.debugLineNum = 188;BA.debugLine="End Sub";
return "";
}
public String  _traenombrecliente(String _id) throws Exception{
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _c = null;
String _n = "";
 //BA.debugLineNum = 82;BA.debugLine="Sub traeNombreCliente(id As String) As String";
 //BA.debugLineNum = 83;BA.debugLine="Private c As ResultSet = B4XPages.MainPage.skmt.E";
_c = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_c = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_NOMBRE from kmt_info3 where CAT_CL_CODIGO = '"+__c.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 84;BA.debugLine="Private n As String = \"N/A\"";
_n = "N/A";
 //BA.debugLineNum = 85;BA.debugLine="Do While c.NextRow";
while (_c.NextRow()) {
 //BA.debugLineNum = 86;BA.debugLine="n = c.GetString(\"CAT_CL_NOMBRE\")";
_n = _c.GetString("CAT_CL_NOMBRE");
 }
;
 //BA.debugLineNum = 88;BA.debugLine="Return n";
if (true) return _n;
 //BA.debugLineNum = 89;BA.debugLine="End Sub";
return "";
}
public String  _traerutassup() throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _rutas = "";
int _i = 0;
 //BA.debugLineNum = 92;BA.debugLine="Sub traeRutasSup As String";
 //BA.debugLineNum = 93;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 94;BA.debugLine="Dim rutas As String";
_rutas = "";
 //BA.debugLineNum = 95;BA.debugLine="rutas = \"\"";
_rutas = "";
 //BA.debugLineNum = 97;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"SELECT CAT_";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT CAT_CL_RUTA FROM kmt_info3")));
 //BA.debugLineNum = 99;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 100;BA.debugLine="For i = 0 To c.RowCount - 1";
{
final int step6 = 1;
final int limit6 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit6 ;_i = _i + step6 ) {
 //BA.debugLineNum = 101;BA.debugLine="c.Position = i";
_c.setPosition(_i);
 //BA.debugLineNum = 102;BA.debugLine="rutas = rutas & c.GetString(\"CAT_CL_RUTA\") & \",";
_rutas = _rutas+_c.GetString("CAT_CL_RUTA")+", ";
 }
};
 //BA.debugLineNum = 104;BA.debugLine="If rutas.Length > 0 Then rutas = rutas.SubString";
if (_rutas.length()>0) { 
_rutas = _rutas.substring((int) (0),(int) (_rutas.length()-2));};
 };
 //BA.debugLineNum = 107;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 108;BA.debugLine="Return rutas";
if (true) return _rutas;
 //BA.debugLineNum = 109;BA.debugLine="End Sub";
return "";
}
public Object callSub(String sub, Object sender, Object[] args) throws Exception {
BA.senderHolder.set(sender);
if (BA.fastSubCompare(sub, "B4XPAGE_CREATED"))
	return _b4xpage_created((anywheresoftware.b4a.objects.B4XViewWrapper) args[0]);
if (BA.fastSubCompare(sub, "JOBDONE"))
	return _jobdone((gunav2.keymon.com.mx.httpjob) args[0]);
return BA.SubDelegator.SubNotFound;
}
}
