package medicomed.keymon.com.mx;


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

public class c_subs 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, "medicomed.keymon.com.mx.c_subs");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", medicomed.keymon.com.mx.c_subs.class).invoke(this, new Object[] {null});
        else
            ba.raiseEvent2(null, true, "class_globals", false);
    }

 public anywheresoftware.b4a.keywords.Common __c = null;
public medicomed.keymon.com.mx.dbrequestmanager _reqmanager = null;
public String _eventname = "";
public Object _callback = null;
public anywheresoftware.b4a.phone.Phone _phn = null;
public String _devmodel = "";
public anywheresoftware.b4a.sql.SQL _db = null;
public anywheresoftware.b4a.sql.SQL _kmt = null;
public anywheresoftware.b4a.sql.SQL _errorlog = null;
public String _ssid = "";
public anywheresoftware.b4a.objects.collections.List _reqslist = null;
public boolean _reqerror = false;
public boolean _subslogs = false;
public b4a.example.dateutils _dateutils = null;
public medicomed.keymon.com.mx.main _main = null;
public medicomed.keymon.com.mx.starter _starter = null;
public medicomed.keymon.com.mx.appupdater _appupdater = null;
public medicomed.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public medicomed.keymon.com.mx.mapa_cliente _mapa_cliente = null;
public medicomed.keymon.com.mx.subs _subs = null;
public medicomed.keymon.com.mx.notificationservice _notificationservice = null;
public medicomed.keymon.com.mx.pendientes _pendientes = null;
public medicomed.keymon.com.mx.tracker _tracker = null;
public medicomed.keymon.com.mx.newinst2 _newinst2 = null;
public medicomed.keymon.com.mx.b4xpages _b4xpages = null;
public medicomed.keymon.com.mx.b4xcollections _b4xcollections = null;
public medicomed.keymon.com.mx.httputils2service _httputils2service = null;
public medicomed.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 = 417;BA.debugLine="Sub agregaColumna(tabla As String, columna As Stri";
 //BA.debugLineNum = 418;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try { //BA.debugLineNum = 419;BA.debugLine="Private c As Cursor = db.ExecQuery($\"SELECT COUN";
_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 COUNT(*) AS fCol FROM pragma_table_info('"+__c.SmartStringFormatter("",(Object)(_tabla))+"') WHERE name='"+__c.SmartStringFormatter("",(Object)(_columna))+"'"))));
 //BA.debugLineNum = 420;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 421;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 422;BA.debugLine="db.ExecNonQuery($\"ALTER TABLE ${tabla} ADD COLU";
_db.ExecNonQuery(("ALTER TABLE "+__c.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 423;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
__c.LogImpl("768222982",("Columna \""+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+__c.SmartStringFormatter("",(Object)(_tabla))+"\"."),0);
 };
 } 
       catch (Exception e9) {
			ba.setLastException(e9); //BA.debugLineNum = 426;BA.debugLine="Try";
try { //BA.debugLineNum = 427;BA.debugLine="db.ExecNonQuery($\"ALTER TABLE ${tabla} ADD COLU";
_db.ExecNonQuery(("ALTER TABLE "+__c.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 428;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
__c.LogImpl("768222987",("Columna \""+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+__c.SmartStringFormatter("",(Object)(_tabla))+"\".."),0);
 } 
       catch (Exception e13) {
			ba.setLastException(e13); //BA.debugLineNum = 430;BA.debugLine="Log(LastException)";
__c.LogImpl("768222989",BA.ObjectToString(__c.LastException(getActivityBA())),0);
 };
 };
 //BA.debugLineNum = 433;BA.debugLine="End Sub";
return "";
}
public String  _borralogdb() throws Exception{
 //BA.debugLineNum = 247;BA.debugLine="Sub borraLogDB 'ignore";
 //BA.debugLineNum = 248;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
__c.LogImpl("767305473","Borramos BD de log",__c.Colors.Magenta);
 //BA.debugLineNum = 249;BA.debugLine="kmt.ExecNonQuery(\"delete from bitacora\")";
_kmt.ExecNonQuery("delete from bitacora");
 //BA.debugLineNum = 250;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 251;BA.debugLine="End Sub";
return "";
}
public String  _buscadbusuario() throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _usuario = "";
 //BA.debugLineNum = 369;BA.debugLine="Sub buscaDBUsuario As String 'ignore";
 //BA.debugLineNum = 370;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 371;BA.debugLine="Private usuario As String = \"SinUsuario\"";
_usuario = "SinUsuario";
 //BA.debugLineNum = 372;BA.debugLine="c=kmt.ExecQuery(\"select USUARIO from usuarioa\")";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery("select USUARIO from usuarioa")));
 //BA.debugLineNum = 373;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 374;BA.debugLine="If c.RowCount > 0 Then usuario = c.GetString(\"USU";
if (_c.getRowCount()>0) { 
_usuario = _c.GetString("USUARIO");};
 //BA.debugLineNum = 375;BA.debugLine="Return usuario";
if (true) return _usuario;
 //BA.debugLineNum = 376;BA.debugLine="End Sub";
return "";
}
public String  _centraetiqueta(anywheresoftware.b4a.objects.LabelWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 349;BA.debugLine="Sub centraEtiqueta(elemento As Label, anchoElement";
 //BA.debugLineNum = 350;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (__c.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
 //BA.debugLineNum = 351;BA.debugLine="End Sub";
return "";
}
public String  _centrapanel(anywheresoftware.b4a.objects.PanelWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 354;BA.debugLine="Sub centraPanel(elemento As Panel, anchoElementoSu";
 //BA.debugLineNum = 355;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (__c.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
 //BA.debugLineNum = 356;BA.debugLine="End Sub";
return "";
}
public String  _centrapanelv(anywheresoftware.b4a.objects.PanelWrapper _elemento,int _altoelementosuperior) throws Exception{
 //BA.debugLineNum = 359;BA.debugLine="Sub centraPanelV(elemento As Panel, altoElementoSu";
 //BA.debugLineNum = 360;BA.debugLine="elemento.Top = Round(altoElementoSuperior/2)-(ele";
_elemento.setTop((int) (__c.Round(_altoelementosuperior/(double)2)-(_elemento.getHeight()/(double)2)));
 //BA.debugLineNum = 361;BA.debugLine="End Sub";
return "";
}
public String  _centraprogressbar(anywheresoftware.b4a.objects.ProgressBarWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 364;BA.debugLine="Sub centraProgressBar(elemento As ProgressBar, anc";
 //BA.debugLineNum = 365;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (__c.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
 //BA.debugLineNum = 366;BA.debugLine="End Sub";
return "";
}
public boolean  _checknotificationaccess() throws Exception{
anywheresoftware.b4a.phone.Phone _ph = null;
String _nstr = "";
String _pstr = "";
anywheresoftware.b4a.agraham.reflection.Reflection _r = null;
 //BA.debugLineNum = 595;BA.debugLine="Sub CheckNotificationAccess As Boolean 'ignore";
 //BA.debugLineNum = 596;BA.debugLine="Dim ph As Phone";
_ph = new anywheresoftware.b4a.phone.Phone();
 //BA.debugLineNum = 597;BA.debugLine="Dim nstr, pstr As String";
_nstr = "";
_pstr = "";
 //BA.debugLineNum = 598;BA.debugLine="Dim r As Reflector";
_r = new anywheresoftware.b4a.agraham.reflection.Reflection();
 //BA.debugLineNum = 599;BA.debugLine="pstr = r.GetStaticField(\"anywheresoftware.b4a.BA\"";
_pstr = BA.ObjectToString(_r.GetStaticField("anywheresoftware.b4a.BA","packageName"));
 //BA.debugLineNum = 600;BA.debugLine="nstr = ph.GetSettings(\"enabled_notification_liste";
_nstr = _ph.GetSettings("enabled_notification_listeners");
 //BA.debugLineNum = 601;BA.debugLine="Return nstr.Contains(pstr)";
if (true) return _nstr.contains(_pstr);
 //BA.debugLineNum = 602;BA.debugLine="End Sub";
return false;
}
public String  _class_globals() throws Exception{
 //BA.debugLineNum = 1;BA.debugLine="Sub Class_Globals";
 //BA.debugLineNum = 6;BA.debugLine="Dim reqManager As DBRequestManager";
_reqmanager = new medicomed.keymon.com.mx.dbrequestmanager();
 //BA.debugLineNum = 7;BA.debugLine="Private EventName As String 'ignore";
_eventname = "";
 //BA.debugLineNum = 8;BA.debugLine="Private CallBack As Object 'ignore";
_callback = new Object();
 //BA.debugLineNum = 9;BA.debugLine="Dim phn As Phone";
_phn = new anywheresoftware.b4a.phone.Phone();
 //BA.debugLineNum = 10;BA.debugLine="Dim devModel As String";
_devmodel = "";
 //BA.debugLineNum = 11;BA.debugLine="Dim db, kmt, errorLog As SQL 'Requiere la libreri";
_db = new anywheresoftware.b4a.sql.SQL();
_kmt = new anywheresoftware.b4a.sql.SQL();
_errorlog = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 12;BA.debugLine="Dim ssid As String  'ignore";
_ssid = "";
 //BA.debugLineNum = 13;BA.debugLine="Dim reqsList As List";
_reqslist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 14;BA.debugLine="Dim reqError As Boolean = False";
_reqerror = __c.False;
 //BA.debugLineNum = 15;BA.debugLine="Private subsLogs As Boolean = False";
_subslogs = __c.False;
 //BA.debugLineNum = 16;BA.debugLine="End Sub";
return "";
}
public String  _copiadb(boolean _result) throws Exception{
String _p = "";
String _thedir = "";
 //BA.debugLineNum = 307;BA.debugLine="Sub copiaDB(result As Boolean) 'ignore";
 //BA.debugLineNum = 308;BA.debugLine="ToastMessageShow(\"copiaDB\", False)";
__c.ToastMessageShow(BA.ObjectToCharSequence("copiaDB"),__c.False);
 //BA.debugLineNum = 309;BA.debugLine="If result Then";
if (_result) { 
 //BA.debugLineNum = 310;BA.debugLine="Dim p As String";
_p = "";
 //BA.debugLineNum = 311;BA.debugLine="If File.ExternalWritable Then";
if (__c.File.getExternalWritable()) { 
 //BA.debugLineNum = 312;BA.debugLine="p = File.DirInternal";
_p = __c.File.getDirInternal();
 }else {
 //BA.debugLineNum = 315;BA.debugLine="p = File.DirInternal";
_p = __c.File.getDirInternal();
 };
 //BA.debugLineNum = 318;BA.debugLine="Dim theDir As String";
_thedir = "";
 //BA.debugLineNum = 319;BA.debugLine="Try";
try { //BA.debugLineNum = 320;BA.debugLine="File.MakeDir(File.DirInternal,\"kmts\")";
__c.File.MakeDir(__c.File.getDirInternal(),"kmts");
 //BA.debugLineNum = 321;BA.debugLine="theDir = \"/kmts\"";
_thedir = "/kmts";
 } 
       catch (Exception e14) {
			ba.setLastException(e14); //BA.debugLineNum = 323;BA.debugLine="theDir = \"\"";
_thedir = "";
 };
 //BA.debugLineNum = 325;BA.debugLine="Try";
try { //BA.debugLineNum = 326;BA.debugLine="File.Copy(File.DirInternal,\"kmt.db\",File.DirInt";
__c.File.Copy(__c.File.getDirInternal(),"kmt.db",__c.File.getDirInternal()+_thedir,"cedex_kmt.db");
 //BA.debugLineNum = 327;BA.debugLine="File.Copy(File.DirInternal,\"errorLog.db\",File.D";
__c.File.Copy(__c.File.getDirInternal(),"errorLog.db",__c.File.getDirInternal()+_thedir,"cedex_errorLog.db");
 //BA.debugLineNum = 328;BA.debugLine="ToastMessageShow(\"BD copiada!\", False)";
__c.ToastMessageShow(BA.ObjectToCharSequence("BD copiada!"),__c.False);
 } 
       catch (Exception e21) {
			ba.setLastException(e21); //BA.debugLineNum = 330;BA.debugLine="ToastMessageShow(\"No se pudo hacer la copia: \"&";
__c.ToastMessageShow(BA.ObjectToCharSequence("No se pudo hacer la copia: "+BA.ObjectToString(__c.LastException(getActivityBA()))),__c.True);
 };
 //BA.debugLineNum = 332;BA.debugLine="Log(\"rootExternal=\"&p)";
__c.LogImpl("767502105","rootExternal="+_p,0);
 //BA.debugLineNum = 333;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
__c.LogImpl("767502106","File.DirInternal="+__c.File.getDirInternal(),0);
 //BA.debugLineNum = 334;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
__c.LogImpl("767502107","File.DirInternal="+__c.File.getDirInternal(),0);
 }else {
 //BA.debugLineNum = 336;BA.debugLine="ToastMessageShow(\"Sin permisos\", False)";
__c.ToastMessageShow(BA.ObjectToCharSequence("Sin permisos"),__c.False);
 };
 //BA.debugLineNum = 338;BA.debugLine="End Sub";
return "";
}
public anywheresoftware.b4a.objects.NotificationWrapper  _createnotification(String _body) throws Exception{
anywheresoftware.b4a.objects.NotificationWrapper _notification = null;
 //BA.debugLineNum = 469;BA.debugLine="Sub CreateNotification (Body As String) As Notific";
 //BA.debugLineNum = 470;BA.debugLine="Dim notification As Notification";
_notification = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 471;BA.debugLine="notification.Initialize2(notification.IMPORTANCE_";
_notification.Initialize2(_notification.IMPORTANCE_LOW);
 //BA.debugLineNum = 472;BA.debugLine="notification.Icon = \"icon\"";
_notification.setIcon("icon");
 //BA.debugLineNum = 473;BA.debugLine="notification.SetInfo(\"Tester\", Body, Main)";
_notification.SetInfoNew(ba,BA.ObjectToCharSequence("Tester"),BA.ObjectToCharSequence(_body),(Object)(_main.getObject()));
 //BA.debugLineNum = 474;BA.debugLine="Return notification";
if (true) return _notification;
 //BA.debugLineNum = 475;BA.debugLine="End Sub";
return null;
}
public anywheresoftware.b4a.sql.SQL  _dbinit() throws Exception{
 //BA.debugLineNum = 30;BA.debugLine="Sub dbInit As SQL";
 //BA.debugLineNum = 31;BA.debugLine="If File.Exists(File.DirInternal, \"kmt.db\") = Fals";
if (__c.File.Exists(__c.File.getDirInternal(),"kmt.db")==__c.False) { 
__c.File.Copy(__c.File.getDirAssets(),"kmt.db",__c.File.getDirInternal(),"kmt.db");};
 //BA.debugLineNum = 32;BA.debugLine="db.Initialize(File.DirInternal,\"kmt.db\", True)";
_db.Initialize(__c.File.getDirInternal(),"kmt.db",__c.True);
 //BA.debugLineNum = 33;BA.debugLine="dbOk(True)";
_dbok(__c.True);
 //BA.debugLineNum = 35;BA.debugLine="Return db";
if (true) return _db;
 //BA.debugLineNum = 36;BA.debugLine="End Sub";
return null;
}
public String  _dbok(boolean _success) throws Exception{
 //BA.debugLineNum = 38;BA.debugLine="Sub dbOk(Success As Boolean)";
 //BA.debugLineNum = 39;BA.debugLine="If SubExists(CallBack, EventName & \"_dbOk\") Then";
if (__c.SubExists(ba,_callback,_eventname+"_dbOk")) { 
 //BA.debugLineNum = 40;BA.debugLine="CallSub2(CallBack, EventName & \"_dbOk\", Success)";
__c.CallSubNew2(ba,_callback,_eventname+"_dbOk",(Object)(_success));
 };
 //BA.debugLineNum = 42;BA.debugLine="End Sub";
return "";
}
public String  _deleteerrorlog_db() throws Exception{
 //BA.debugLineNum = 180;BA.debugLine="Sub deleteErrorLog_DB 'ignore";
 //BA.debugLineNum = 181;BA.debugLine="errorLog.ExecNonQuery(\"delete from errores\")";
_errorlog.ExecNonQuery("delete from errores");
 //BA.debugLineNum = 182;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 183;BA.debugLine="ToastMessageShow(\"BD Errores Borrada\", False)";
__c.ToastMessageShow(BA.ObjectToCharSequence("BD Errores Borrada"),__c.False);
 //BA.debugLineNum = 184;BA.debugLine="End Sub";
return "";
}
public String  _deletegps_db() throws Exception{
 //BA.debugLineNum = 173;BA.debugLine="Sub deleteGPS_DB 'ignore";
 //BA.debugLineNum = 174;BA.debugLine="kmt.ExecNonQuery(\"delete from RUTA_GPS\")";
_kmt.ExecNonQuery("delete from RUTA_GPS");
 //BA.debugLineNum = 175;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 176;BA.debugLine="ToastMessageShow(\"Borramos BD Coords GPS\", False)";
__c.ToastMessageShow(BA.ObjectToCharSequence("Borramos BD Coords GPS"),__c.False);
 //BA.debugLineNum = 177;BA.debugLine="End Sub";
return "";
}
public String  _enviook(boolean _success) throws Exception{
 //BA.debugLineNum = 71;BA.debugLine="Sub envioOk(Success As Boolean)";
 //BA.debugLineNum = 73;BA.debugLine="If SubExists(CallBack, EventName & \"_envioOk\") Th";
if (__c.SubExists(ba,_callback,_eventname+"_envioOk")) { 
 //BA.debugLineNum = 74;BA.debugLine="CallSub2(CallBack, EventName & \"_envioOk\", Succe";
__c.CallSubNew2(ba,_callback,_eventname+"_envioOk",(Object)(_success));
 };
 //BA.debugLineNum = 76;BA.debugLine="End Sub";
return "";
}
public String  _enviotest() throws Exception{
medicomed.keymon.com.mx.dbrequestmanager._dbcommand _cmd = null;
int _i = 0;
 //BA.debugLineNum = 58;BA.debugLine="Sub envioTest";
 //BA.debugLineNum = 59;BA.debugLine="reqsList.Initialize ' Ponemos la lista de DBReque";
_reqslist.Initialize();
 //BA.debugLineNum = 60;BA.debugLine="Private cmd As DBCommand";
_cmd = new medicomed.keymon.com.mx.dbrequestmanager._dbcommand();
 //BA.debugLineNum = 61;BA.debugLine="cmd.Initialize";
_cmd.Initialize();
 //BA.debugLineNum = 62;BA.debugLine="cmd.Name = \"select_fecha\"";
_cmd.Name /*String*/  = "select_fecha";
 //BA.debugLineNum = 63;BA.debugLine="For i = 0 To 50";
{
final int step5 = 1;
final int limit5 = (int) (50);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 65;BA.debugLine="reqManager.ExecuteQuery(cmd, 0, $\"select_fecha_$";
_reqmanager._executequery /*String*/ (_cmd,(int) (0),(Object)(("select_fecha_"+__c.SmartStringFormatter("",(Object)(_i))+"")));
 //BA.debugLineNum = 66;BA.debugLine="reqsList.Add($\"select_fecha_${i}\"$)";
_reqslist.Add((Object)(("select_fecha_"+__c.SmartStringFormatter("",(Object)(_i))+"")));
 }
};
 //BA.debugLineNum = 68;BA.debugLine="End Sub";
return "";
}
public String  _fechainiciohoy() throws Exception{
String _origformat = "";
String _h = "";
 //BA.debugLineNum = 206;BA.debugLine="Sub fechaInicioHoy As String 'ignore";
 //BA.debugLineNum = 207;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = __c.DateTime.getDateFormat();
 //BA.debugLineNum = 208;BA.debugLine="DateTime.DateFormat=\"yyMMdd\"";
__c.DateTime.setDateFormat("yyMMdd");
 //BA.debugLineNum = 209;BA.debugLine="Private h As String = DateTime.Date(DateTime.Now)";
_h = __c.DateTime.Date(__c.DateTime.getNow())+"000000";
 //BA.debugLineNum = 210;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
__c.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 211;BA.debugLine="Log(\"Hoy=\"&h)";
__c.LogImpl("767043333","Hoy="+_h,0);
 //BA.debugLineNum = 212;BA.debugLine="Return h";
if (true) return _h;
 //BA.debugLineNum = 213;BA.debugLine="End Sub";
return "";
}
public String  _fechakmt(String _fecha) throws Exception{
String _origformat = "";
String _nuevafecha = "";
 //BA.debugLineNum = 133;BA.debugLine="Sub fechaKMT(fecha As String) As String 'ignore";
 //BA.debugLineNum = 135;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = __c.DateTime.getDateFormat();
 //BA.debugLineNum = 136;BA.debugLine="DateTime.DateFormat=\"yyMMddHHmmss\"";
__c.DateTime.setDateFormat("yyMMddHHmmss");
 //BA.debugLineNum = 137;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = __c.DateTime.Date((long)(Double.parseDouble(_fecha)));
 //BA.debugLineNum = 138;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
__c.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 140;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
 //BA.debugLineNum = 141;BA.debugLine="End Sub";
return "";
}
public long  _fechakmt2ticks(String _fkmt) throws Exception{
String _partefecha = "";
String _partehora = "";
String _origformat = "";
long _ticks = 0L;
 //BA.debugLineNum = 275;BA.debugLine="Sub fechaKMT2Ticks(fKMT As String) As Long 'ignore";
 //BA.debugLineNum = 276;BA.debugLine="Try";
try { //BA.debugLineNum = 277;BA.debugLine="If fKMT.Length = 12 Then";
if (_fkmt.length()==12) { 
 //BA.debugLineNum = 278;BA.debugLine="Private parteFecha As String = fKMT.SubString2(";
_partefecha = _fkmt.substring((int) (0),(int) (6));
 //BA.debugLineNum = 279;BA.debugLine="Private parteHora As String = fKMT.SubString(6)";
_partehora = _fkmt.substring((int) (6));
 //BA.debugLineNum = 280;BA.debugLine="Private OrigFormat As String = DateTime.DateFor";
_origformat = __c.DateTime.getDateFormat();
 //BA.debugLineNum = 281;BA.debugLine="DateTime.DateFormat=\"yymmdd\"";
__c.DateTime.setDateFormat("yymmdd");
 //BA.debugLineNum = 282;BA.debugLine="DateTime.TimeFormat=\"HHmmss\"";
__c.DateTime.setTimeFormat("HHmmss");
 //BA.debugLineNum = 283;BA.debugLine="Private ticks As Long = DateTime.DateTimeParse(";
_ticks = __c.DateTime.DateTimeParse(_partefecha,_partehora);
 //BA.debugLineNum = 284;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
__c.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 285;BA.debugLine="Return ticks";
if (true) return _ticks;
 }else {
 //BA.debugLineNum = 287;BA.debugLine="Log(\"Formato de fecha incorrecto, debe de ser '";
__c.LogImpl("767371020","Formato de fecha incorrecto, debe de ser 'YYMMDDHHMMSS', no '"+_fkmt+"' largo="+BA.NumberToString(_fkmt.length()),0);
 //BA.debugLineNum = 288;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 } 
       catch (Exception e16) {
			ba.setLastException(e16); //BA.debugLineNum = 291;BA.debugLine="Log(LastException)";
__c.LogImpl("767371024",BA.ObjectToString(__c.LastException(getActivityBA())),0);
 //BA.debugLineNum = 292;BA.debugLine="LogColor($\"Fecha dada: ${fKMT}, Parte Fecha: ${p";
__c.LogImpl("767371025",("Fecha dada: "+__c.SmartStringFormatter("",(Object)(_fkmt))+", Parte Fecha: "+__c.SmartStringFormatter("",(Object)(_partefecha))+", Parte Hora: "+__c.SmartStringFormatter("",(Object)(_partehora))+""),__c.Colors.Red);
 //BA.debugLineNum = 293;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 //BA.debugLineNum = 295;BA.debugLine="End Sub";
return 0L;
}
public String  _getphnid() throws Exception{
String _t = "";
String _s = "";
 //BA.debugLineNum = 113;BA.debugLine="Sub getPhnId As String 'ignore";
 //BA.debugLineNum = 115;BA.debugLine="devModel = phn.Model";
_devmodel = _phn.getModel();
 //BA.debugLineNum = 116;BA.debugLine="If devModel.Length <= 3 Then 'Si phn.Model esta e";
if (_devmodel.length()<=3) { 
 //BA.debugLineNum = 117;BA.debugLine="Dim t As String = phn.GetSettings(\"android_id\")";
_t = _phn.GetSettings("android_id");
 //BA.debugLineNum = 118;BA.debugLine="devModel = t";
_devmodel = _t;
 };
 //BA.debugLineNum = 120;BA.debugLine="If devModel.Length >= 3 Then 'Si tenemos valor pa";
if (_devmodel.length()>=3) { 
 //BA.debugLineNum = 121;BA.debugLine="File.WriteString(File.DirInternal, \"phnId.txt\",";
__c.File.WriteString(__c.File.getDirInternal(),"phnId.txt",_devmodel);
 }else if(_devmodel.length()<3) { 
 //BA.debugLineNum = 124;BA.debugLine="Dim s As String = File.ReadString(File.DirIntern";
_s = __c.File.ReadString(__c.File.getDirInternal(),"phnId.txt");
 //BA.debugLineNum = 125;BA.debugLine="devModel = s";
_devmodel = _s;
 };
 //BA.debugLineNum = 129;BA.debugLine="Return devModel";
if (true) return _devmodel;
 //BA.debugLineNum = 130;BA.debugLine="End Sub";
return "";
}
public String  _guardaappinfo(anywheresoftware.b4a.sql.SQL _skmt) throws Exception{
 //BA.debugLineNum = 387;BA.debugLine="Sub guardaAppInfo(skmt As SQL) 'ignore";
 //BA.debugLineNum = 388;BA.debugLine="skmt.ExecNonQuery(\"delete from CAT_VARIABLES wher";
_skmt.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'EMPRESA' or CAT_VA_DESCRIPCION = 'APP_NAME' or CAT_VA_DESCRIPCION = 'APP_VERSION'");
 //BA.debugLineNum = 389;BA.debugLine="skmt.ExecNonQuery($\"insert into CAT_VARIABLES (CA";
_skmt.ExecNonQuery(("insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_NAME', '"+__c.SmartStringFormatter("",(Object)(__c.Application.getLabelName()))+"')"));
 //BA.debugLineNum = 390;BA.debugLine="skmt.ExecNonQuery($\"insert into CAT_VARIABLES (CA";
_skmt.ExecNonQuery(("insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_VERSION', '"+__c.SmartStringFormatter("",(Object)(__c.Application.getVersionName()))+"')"));
 //BA.debugLineNum = 391;BA.debugLine="End Sub";
return "";
}
public String  _guardainfoenarchivo(String _coords) throws Exception{
String _origformat = "";
String _lastupdate = "";
String _ubic = "";
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
String _s = "";
byte[] _t = null;
 //BA.debugLineNum = 144;BA.debugLine="Sub guardaInfoEnArchivo(coords As String) 'ignore";
 //BA.debugLineNum = 146;BA.debugLine="Dim OrigFormat As String=DateTime.DateFormat  'sa";
_origformat = __c.DateTime.getDateFormat();
 //BA.debugLineNum = 147;BA.debugLine="DateTime.DateFormat=\"MMM-dd HH:mm:ss\"";
__c.DateTime.setDateFormat("MMM-dd HH:mm:ss");
 //BA.debugLineNum = 148;BA.debugLine="Dim lastUpdate As String=DateTime.Date(DateTime.N";
_lastupdate = __c.DateTime.Date(__c.DateTime.getNow());
 //BA.debugLineNum = 149;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
__c.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 151;BA.debugLine="Dim ubic As String = coords&\",\"&lastUpdate";
_ubic = _coords+","+_lastupdate;
 //BA.debugLineNum = 152;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = __c.File.OpenOutput(__c.File.getDirInternal(),"gps.txt",__c.True);
 //BA.debugLineNum = 153;BA.debugLine="Dim s As String = ubic & CRLF";
_s = _ubic+__c.CRLF;
 //BA.debugLineNum = 154;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
 //BA.debugLineNum = 155;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
 //BA.debugLineNum = 156;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 157;BA.debugLine="End Sub";
return "";
}
public String  _guardainfoenbd(String _coords) throws Exception{
String[] _latlon = null;
 //BA.debugLineNum = 160;BA.debugLine="Sub guardaInfoEnBD(coords As String) 'ignore";
 //BA.debugLineNum = 161;BA.debugLine="Log(\"Guardamos ubicacion en BD - \"&coords)";
__c.LogImpl("766846721","Guardamos ubicacion en BD - "+_coords,0);
 //BA.debugLineNum = 162;BA.debugLine="Try";
try { //BA.debugLineNum = 163;BA.debugLine="Dim latlon() As String = Regex.Split(\"\\|\", coord";
_latlon = __c.Regex.Split("\\|",_coords);
 //BA.debugLineNum = 164;BA.debugLine="If latlon.Length < 2 Then latlon = Regex.Split(\"";
if (_latlon.length<2) { 
_latlon = __c.Regex.Split(",",_coords);};
 //BA.debugLineNum = 165;BA.debugLine="If subsLogs Then Log(\"LatLon=\"&latlon)";
if (_subslogs) { 
__c.LogImpl("766846725","LatLon="+BA.ObjectToString(_latlon),0);};
 //BA.debugLineNum = 166;BA.debugLine="kmt.ExecNonQuery2(\"INSERT INTO RUTA_GPS(FECHA, L";
_kmt.ExecNonQuery2("INSERT INTO RUTA_GPS(FECHA, LAT, LON) VALUES (?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_latlon[(int) (2)]),(Object)(_latlon[(int) (0)]),(Object)(_latlon[(int) (1)])}));
 } 
       catch (Exception e8) {
			ba.setLastException(e8); //BA.debugLineNum = 168;BA.debugLine="LogColor(LastException, Colors.red)";
__c.LogImpl("766846728",BA.ObjectToString(__c.LastException(getActivityBA())),__c.Colors.Red);
 };
 //BA.debugLineNum = 170;BA.debugLine="End Sub";
return "";
}
public anywheresoftware.b4a.sql.SQL  _inicializabd(String _ruta,String _bdname) throws Exception{
anywheresoftware.b4a.sql.SQL _skmt = null;
 //BA.debugLineNum = 404;BA.debugLine="Sub inicializaBD(ruta As String, BDName As String)";
 //BA.debugLineNum = 405;BA.debugLine="Dim skmt As SQL";
_skmt = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 406;BA.debugLine="If File.Exists(ruta, BDName) = False Then";
if (__c.File.Exists(_ruta,_bdname)==__c.False) { 
 //BA.debugLineNum = 407;BA.debugLine="File.Copy(File.DirAssets, BDName, ruta, BDName)";
__c.File.Copy(__c.File.getDirAssets(),_bdname,_ruta,_bdname);
 //BA.debugLineNum = 408;BA.debugLine="LogColor($\"Copiamos ${BDName} de ${File.DirAsset";
__c.LogImpl("768157444",("Copiamos "+__c.SmartStringFormatter("",(Object)(_bdname))+" de "+__c.SmartStringFormatter("",(Object)(__c.File.getDirAssets()))+" a "+__c.SmartStringFormatter("",(Object)(_ruta))+""),__c.Colors.Green);
 };
 //BA.debugLineNum = 410;BA.debugLine="skmt.Initialize(ruta, BDName, True)";
_skmt.Initialize(_ruta,_bdname,__c.True);
 //BA.debugLineNum = 411;BA.debugLine="Return skmt";
if (true) return _skmt;
 //BA.debugLineNum = 412;BA.debugLine="End Sub";
return null;
}
public Object  _initialize(anywheresoftware.b4a.BA _ba,Object _vcallback,String _veventname) throws Exception{
innerInitialize(_ba);
 //BA.debugLineNum = 19;BA.debugLine="Public Sub Initialize (vCallback As Object, vEvent";
 //BA.debugLineNum = 20;BA.debugLine="reqsList.Initialize";
_reqslist.Initialize();
 //BA.debugLineNum = 21;BA.debugLine="EventName = vEventName";
_eventname = _veventname;
 //BA.debugLineNum = 22;BA.debugLine="CallBack = vCallback";
_callback = _vcallback;
 //BA.debugLineNum = 23;BA.debugLine="db = dbInit";
_db = _dbinit();
 //BA.debugLineNum = 24;BA.debugLine="reqManager = reqManagerInit";
_reqmanager = _reqmanagerinit();
 //BA.debugLineNum = 25;BA.debugLine="Return Me";
if (true) return this;
 //BA.debugLineNum = 26;BA.debugLine="End Sub";
return null;
}
public String  _installapk(String _dir,String _apk) throws Exception{
anywheresoftware.b4a.objects.IntentWrapper _i = null;
 //BA.debugLineNum = 297;BA.debugLine="Sub InstallAPK(dir As String, apk As String) 'igno";
 //BA.debugLineNum = 298;BA.debugLine="If File.Exists(dir, apk) Then";
if (__c.File.Exists(_dir,_apk)) { 
 //BA.debugLineNum = 299;BA.debugLine="Dim i As Intent";
_i = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 300;BA.debugLine="i.Initialize(i.ACTION_VIEW, \"file://\" & File.Com";
_i.Initialize(_i.ACTION_VIEW,"file://"+__c.File.Combine(_dir,_apk));
 //BA.debugLineNum = 301;BA.debugLine="i.SetType(\"application/vnd.android.package-archi";
_i.SetType("application/vnd.android.package-archive");
 //BA.debugLineNum = 302;BA.debugLine="StartActivity(i)";
__c.StartActivity(ba,(Object)(_i.getObject()));
 };
 //BA.debugLineNum = 304;BA.debugLine="End Sub";
return "";
}
public String  _jobdone(medicomed.keymon.com.mx.httpjob _job) throws Exception{
medicomed.keymon.com.mx.dbrequestmanager._dbresult _resultado = null;
Object[] _records = null;
String _k = "";
 //BA.debugLineNum = 78;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 79;BA.debugLine="LogColor(\"C_SUBS JOBDONE - \" & Job.Success, Color";
__c.LogImpl("766584577","C_SUBS JOBDONE - "+BA.ObjectToString(_job._success /*boolean*/ ),__c.Colors.Red);
 //BA.debugLineNum = 80;BA.debugLine="If Job.Success = False Then";
if (_job._success /*boolean*/ ==__c.False) { 
 //BA.debugLineNum = 81;BA.debugLine="Log($\"Error en el request ${Job.Tag}\"$)";
__c.LogImpl("766584579",("Error en el request "+__c.SmartStringFormatter("",_job._tag /*Object*/ )+""),0);
 //BA.debugLineNum = 82;BA.debugLine="LogColor(\"** \" & Job.Tag & \" Error: \" & Job.Erro";
__c.LogImpl("766584580","** "+BA.ObjectToString(_job._tag /*Object*/ )+" Error: "+_job._errormessage /*String*/ ,__c.Colors.Red);
 //BA.debugLineNum = 83;BA.debugLine="If reqsList.IndexOf(Job.Tag) > -1 Then reqsList.";
if (_reqslist.IndexOf(_job._tag /*Object*/ )>-1) { 
_reqslist.RemoveAt(_reqslist.IndexOf(_job._tag /*Object*/ ));};
 //BA.debugLineNum = 84;BA.debugLine="reqError = True";
_reqerror = __c.True;
 }else {
 //BA.debugLineNum = 86;BA.debugLine="If Job.JobName = \"DBRequest\" Then";
if ((_job._jobname /*String*/ ).equals("DBRequest")) { 
 //BA.debugLineNum = 87;BA.debugLine="Dim resultado As DBResult = reqManager.HandleJo";
_resultado = _reqmanager._handlejob /*medicomed.keymon.com.mx.dbrequestmanager._dbresult*/ (_job);
 //BA.debugLineNum = 88;BA.debugLine="If reqsList.IndexOf(resultado.Tag) > -1 Then re";
if (_reqslist.IndexOf(_resultado.Tag /*Object*/ )>-1) { 
_reqslist.RemoveAt(_reqslist.IndexOf(_resultado.Tag /*Object*/ ));};
 //BA.debugLineNum = 89;BA.debugLine="If resultado.Tag = \"select_fecha\" Then";
if ((_resultado.Tag /*Object*/ ).equals((Object)("select_fecha"))) { 
 //BA.debugLineNum = 90;BA.debugLine="For Each records() As Object In resultado.Rows";
{
final anywheresoftware.b4a.BA.IterableList group12 = _resultado.Rows /*anywheresoftware.b4a.objects.collections.List*/ ;
final int groupLen12 = group12.getSize()
;int index12 = 0;
;
for (; index12 < groupLen12;index12++){
_records = (Object[])(group12.Get(index12));
 //BA.debugLineNum = 91;BA.debugLine="For Each k As String In resultado.Columns.Key";
{
final anywheresoftware.b4a.BA.IterableList group13 = _resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Keys();
final int groupLen13 = group13.getSize()
;int index13 = 0;
;
for (; index13 < groupLen13;index13++){
_k = BA.ObjectToString(group13.Get(index13));
 //BA.debugLineNum = 92;BA.debugLine="Log(resultado.Tag & \": \" & k & \": \" & record";
__c.LogImpl("766584590",BA.ObjectToString(_resultado.Tag /*Object*/ )+": "+_k+": "+BA.ObjectToString(_records[(int)(BA.ObjectToNumber(_resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Get((Object)(_k))))]),0);
 }
};
 }
};
 };
 };
 };
 //BA.debugLineNum = 98;BA.debugLine="Log(reqsList.Size)";
__c.LogImpl("766584596",BA.NumberToString(_reqslist.getSize()),0);
 //BA.debugLineNum = 99;BA.debugLine="If reqsList.Size = 0 Then 'Ya no hay DBReqs pendi";
if (_reqslist.getSize()==0) { 
 //BA.debugLineNum = 100;BA.debugLine="Log(reqError)";
__c.LogImpl("766584598",BA.ObjectToString(_reqerror),0);
 //BA.debugLineNum = 101;BA.debugLine="If Not(reqError) Then";
if (__c.Not(_reqerror)) { 
 //BA.debugLineNum = 102;BA.debugLine="envioOk(True)";
_enviook(__c.True);
 }else {
 //BA.debugLineNum = 104;BA.debugLine="envioOk(False)";
_enviook(__c.False);
 };
 //BA.debugLineNum = 106;BA.debugLine="reqError = False";
_reqerror = __c.False;
 //BA.debugLineNum = 107;BA.debugLine="Log(\"-= FIN =-\")";
__c.LogImpl("766584605","-= FIN =-",0);
 };
 //BA.debugLineNum = 109;BA.debugLine="Job.Release";
_job._release /*String*/ ();
 //BA.debugLineNum = 110;BA.debugLine="End Sub";
return "";
}
public String  _log2db(String _texto) throws Exception{
 //BA.debugLineNum = 216;BA.debugLine="Sub log2DB(texto As String) 'ignore";
 //BA.debugLineNum = 217;BA.debugLine="LogColor(fechaKMT(DateTime.Now)&\" - log2BD: '\"&te";
__c.LogImpl("767108865",_fechakmt(BA.NumberToString(__c.DateTime.getNow()))+" - log2BD: '"+_texto+"'",__c.Colors.LightGray);
 //BA.debugLineNum = 218;BA.debugLine="kmt.ExecNonQuery2(\"INSERT INTO bitacora(fecha, te";
_kmt.ExecNonQuery2("INSERT INTO bitacora(fecha, texto) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_fechakmt(BA.NumberToString(__c.DateTime.getNow()))),(Object)(_texto)}));
 //BA.debugLineNum = 219;BA.debugLine="End Sub";
return "";
}
public String  _logjobdoneresultados(medicomed.keymon.com.mx.dbrequestmanager._dbresult _resultado) throws Exception{
Object[] _records = null;
String _k = "";
 //BA.debugLineNum = 394;BA.debugLine="Sub logJobDoneResultados(resultado As DBResult) 'i";
 //BA.debugLineNum = 395;BA.debugLine="For Each records() As Object In resultado.Rows";
{
final anywheresoftware.b4a.BA.IterableList group1 = _resultado.Rows /*anywheresoftware.b4a.objects.collections.List*/ ;
final int groupLen1 = group1.getSize()
;int index1 = 0;
;
for (; index1 < groupLen1;index1++){
_records = (Object[])(group1.Get(index1));
 //BA.debugLineNum = 396;BA.debugLine="LogColor($\"====== ${resultado.Tag} - REGISTROS =";
__c.LogImpl("768091906",("====== "+__c.SmartStringFormatter("",_resultado.Tag /*Object*/ )+" - REGISTROS = "+__c.SmartStringFormatter("",(Object)(_resultado.Rows /*anywheresoftware.b4a.objects.collections.List*/ .getSize()))+""),__c.Colors.RGB((int) (215),(int) (37),(int) (0)));
 //BA.debugLineNum = 397;BA.debugLine="For Each k As String In resultado.Columns.Keys";
{
final anywheresoftware.b4a.BA.IterableList group3 = _resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Keys();
final int groupLen3 = group3.getSize()
;int index3 = 0;
;
for (; index3 < groupLen3;index3++){
_k = BA.ObjectToString(group3.Get(index3));
 //BA.debugLineNum = 398;BA.debugLine="LogColor(k & \" = \" & records(resultado.Columns.";
__c.LogImpl("768091908",_k+" = "+BA.ObjectToString(_records[(int)(BA.ObjectToNumber(_resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Get((Object)(_k))))]),__c.Colors.RGB((int) (215),(int) (37),(int) (0)));
 }
};
 }
};
 //BA.debugLineNum = 401;BA.debugLine="End Sub";
return "";
}
public boolean  _masdexxmins(int _hora,int _mins) throws Exception{
 //BA.debugLineNum = 222;BA.debugLine="Sub masDeXXMins(hora As Int, mins As Int) As Boole";
 //BA.debugLineNum = 223;BA.debugLine="If (hora + mins * DateTime.TicksPerMinute) < Date";
if ((_hora+_mins*__c.DateTime.TicksPerMinute)<__c.DateTime.getNow()) { 
 //BA.debugLineNum = 224;BA.debugLine="Return True";
if (true) return __c.True;
 }else {
 //BA.debugLineNum = 226;BA.debugLine="Return False";
if (true) return __c.False;
 };
 //BA.debugLineNum = 228;BA.debugLine="End Sub";
return false;
}
public boolean  _masdexxminskmt(String _hora,int _mins) throws Exception{
 //BA.debugLineNum = 231;BA.debugLine="Sub masDeXXMinsKMT(hora As String, mins As Int) As";
 //BA.debugLineNum = 232;BA.debugLine="Try";
try { //BA.debugLineNum = 234;BA.debugLine="If fechaKMT2Ticks(hora) + mins * DateTime.TicksP";
if (_fechakmt2ticks(_hora)+_mins*__c.DateTime.TicksPerMinute<__c.DateTime.getNow()) { 
 //BA.debugLineNum = 236;BA.debugLine="Return True";
if (true) return __c.True;
 }else {
 //BA.debugLineNum = 239;BA.debugLine="Return False";
if (true) return __c.False;
 };
 } 
       catch (Exception e8) {
			ba.setLastException(e8); //BA.debugLineNum = 242;BA.debugLine="Log(LastException)";
__c.LogImpl("767239947",BA.ObjectToString(__c.LastException(getActivityBA())),0);
 };
 //BA.debugLineNum = 244;BA.debugLine="End Sub";
return false;
}
public String  _notihigh(String _title,String _body,String _id,Object _activity) throws Exception{
anywheresoftware.b4a.objects.NotificationWrapper _notif = null;
 //BA.debugLineNum = 478;BA.debugLine="Sub notiHigh(title As String, body As String, id A";
 //BA.debugLineNum = 479;BA.debugLine="activity = Main";
_activity = (Object)(_main.getObject());
 //BA.debugLineNum = 480;BA.debugLine="Private notif As Notification";
_notif = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 481;BA.debugLine="notif.Initialize2(notif.IMPORTANCE_HIGH)";
_notif.Initialize2(_notif.IMPORTANCE_HIGH);
 //BA.debugLineNum = 482;BA.debugLine="notif.Icon = \"icon\"";
_notif.setIcon("icon");
 //BA.debugLineNum = 483;BA.debugLine="notif.Vibrate = False";
_notif.setVibrate(__c.False);
 //BA.debugLineNum = 484;BA.debugLine="notif.Sound = False";
_notif.setSound(__c.False);
 //BA.debugLineNum = 485;BA.debugLine="notif.AutoCancel = True";
_notif.setAutoCancel(__c.True);
 //BA.debugLineNum = 487;BA.debugLine="notif.SetInfo(title, body, activity)";
_notif.SetInfoNew(ba,BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),_activity);
 //BA.debugLineNum = 489;BA.debugLine="notif.Notify(id)";
_notif.Notify((int)(Double.parseDouble(_id)));
 //BA.debugLineNum = 490;BA.debugLine="End Sub";
return "";
}
public anywheresoftware.b4a.objects.NotificationWrapper  _notilowreturn(String _title,String _body,int _id) throws Exception{
anywheresoftware.b4a.objects.NotificationWrapper _notification = null;
 //BA.debugLineNum = 493;BA.debugLine="Sub notiLowReturn(title As String, Body As String,";
 //BA.debugLineNum = 494;BA.debugLine="Private notification As Notification";
_notification = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 495;BA.debugLine="notification.Initialize2(notification.IMPORTANCE_";
_notification.Initialize2(_notification.IMPORTANCE_LOW);
 //BA.debugLineNum = 497;BA.debugLine="notification.Icon = \"icon\"";
_notification.setIcon("icon");
 //BA.debugLineNum = 498;BA.debugLine="notification.Sound = False";
_notification.setSound(__c.False);
 //BA.debugLineNum = 499;BA.debugLine="notification.Vibrate = False";
_notification.setVibrate(__c.False);
 //BA.debugLineNum = 500;BA.debugLine="notification.SetInfo(title, Body, Main)";
_notification.SetInfoNew(ba,BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),(Object)(_main.getObject()));
 //BA.debugLineNum = 501;BA.debugLine="notification.Notify(id)";
_notification.Notify(_id);
 //BA.debugLineNum = 503;BA.debugLine="Return notification";
if (true) return _notification;
 //BA.debugLineNum = 504;BA.debugLine="End Sub";
return null;
}
public String  _panelvisible(anywheresoftware.b4a.objects.PanelWrapper _panel,int _top,int _left) throws Exception{
 //BA.debugLineNum = 341;BA.debugLine="Sub panelVisible(panel As Panel, top As Int, left";
 //BA.debugLineNum = 342;BA.debugLine="panel.BringToFront";
_panel.BringToFront();
 //BA.debugLineNum = 343;BA.debugLine="panel.Visible = True";
_panel.setVisible(__c.True);
 //BA.debugLineNum = 344;BA.debugLine="panel.Top = top";
_panel.setTop(_top);
 //BA.debugLineNum = 345;BA.debugLine="panel.Left = left";
_panel.setLeft(_left);
 //BA.debugLineNum = 346;BA.debugLine="End Sub";
return "";
}
public medicomed.keymon.com.mx.dbrequestmanager  _reqmanagerinit() throws Exception{
medicomed.keymon.com.mx.dbrequestmanager _rm = null;
 //BA.debugLineNum = 45;BA.debugLine="Sub reqManagerInit As DBRequestManager";
 //BA.debugLineNum = 46;BA.debugLine="Private rm As DBRequestManager";
_rm = new medicomed.keymon.com.mx.dbrequestmanager();
 //BA.debugLineNum = 47;BA.debugLine="rm.Initialize(Me, traeDBReqServerDeBD(db))";
_rm._initialize /*String*/ (ba,this,_traedbreqserverdebd(_db));
 //BA.debugLineNum = 48;BA.debugLine="Log($\"Inicializamos reqManager con ${traeDBReqSer";
__c.LogImpl("766322435",("Inicializamos reqManager con "+__c.SmartStringFormatter("",(Object)(_traedbreqserverdebd(_db)))+""),0);
 //BA.debugLineNum = 49;BA.debugLine="Return rm";
if (true) return _rm;
 //BA.debugLineNum = 50;BA.debugLine="End Sub";
return null;
}
public String  _reqmanagerreinit() throws Exception{
 //BA.debugLineNum = 53;BA.debugLine="Sub reqManagerReInit";
 //BA.debugLineNum = 54;BA.debugLine="Log(\"reqManager ReInit\")";
__c.LogImpl("766387969","reqManager ReInit",0);
 //BA.debugLineNum = 55;BA.debugLine="reqManager = reqManagerInit";
_reqmanager = _reqmanagerinit();
 //BA.debugLineNum = 56;BA.debugLine="End Sub";
return "";
}
public String  _traealmacen() throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _a = "";
 //BA.debugLineNum = 507;BA.debugLine="Sub traeAlmacen As String 'ignore";
 //BA.debugLineNum = 508;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 509;BA.debugLine="Private a As String";
_a = "";
 //BA.debugLineNum = 510;BA.debugLine="c = db.ExecQuery(\"select  ID_ALMACEN from CAT_ALM";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_db.ExecQuery("select  ID_ALMACEN from CAT_ALMACEN")));
 //BA.debugLineNum = 511;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 512;BA.debugLine="a = C.GetString(\"ID_ALMACEN\")";
_a = _c.GetString("ID_ALMACEN");
 //BA.debugLineNum = 513;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 514;BA.debugLine="Return a";
if (true) return _a;
 //BA.debugLineNum = 515;BA.debugLine="End Sub";
return "";
}
public String  _traedbreqserverdebd(anywheresoftware.b4a.sql.SQL _dbx) throws Exception{
String _srvr = "";
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _rs = null;
 //BA.debugLineNum = 436;BA.debugLine="Sub traeDBReqServerDeBD(dbx As SQL) As String 'ign";
 //BA.debugLineNum = 437;BA.debugLine="Dim srvr As String = \"N/A\"";
_srvr = "N/A";
 //BA.debugLineNum = 438;BA.debugLine="Dim rs As ResultSet = dbx.ExecQuery(\"select CAT_V";
_rs = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_rs = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(_dbx.ExecQuery("select CAT_VA_VALOR from cat_variables where CAT_VA_DESCRIPCION = 'SERVER'")));
 //BA.debugLineNum = 439;BA.debugLine="If rs.RowCount > 0 Then";
if (_rs.getRowCount()>0) { 
 //BA.debugLineNum = 440;BA.debugLine="rs.NextRow";
_rs.NextRow();
 //BA.debugLineNum = 441;BA.debugLine="srvr = rs.GetString(\"CAT_VA_VALOR\")";
_srvr = _rs.GetString("CAT_VA_VALOR");
 };
 //BA.debugLineNum = 443;BA.debugLine="Return srvr";
if (true) return _srvr;
 //BA.debugLineNum = 444;BA.debugLine="End Sub";
return "";
}
public String  _traefecha() throws Exception{
String _sdate = "";
String _stime = "";
 //BA.debugLineNum = 379;BA.debugLine="Sub traeFecha As String 'ignore";
 //BA.debugLineNum = 380;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
__c.DateTime.setDateFormat("MM/dd/yyyy");
 //BA.debugLineNum = 381;BA.debugLine="Private sDate As String = DateTime.Date(DateTime.";
_sdate = __c.DateTime.Date(__c.DateTime.getNow());
 //BA.debugLineNum = 382;BA.debugLine="Private sTime As String = DateTime.Time(DateTime.";
_stime = __c.DateTime.Time(__c.DateTime.getNow());
 //BA.debugLineNum = 383;BA.debugLine="Return sDate & sTime";
if (true) return _sdate+_stime;
 //BA.debugLineNum = 384;BA.debugLine="End Sub";
return "";
}
public String  _traeintervalodebd() throws Exception{
String _intrvl = "";
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _rs = null;
 //BA.debugLineNum = 447;BA.debugLine="Sub traeIntervaloDeBD As String 'ignore";
 //BA.debugLineNum = 448;BA.debugLine="Dim intrvl As String = \"30\"";
_intrvl = "30";
 //BA.debugLineNum = 449;BA.debugLine="Dim rs As ResultSet = db.ExecQuery(\"select valor";
_rs = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_rs = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(_db.ExecQuery("select valor from cat_variables where nombre = 'intervalo'")));
 //BA.debugLineNum = 450;BA.debugLine="If rs.RowCount > 0 Then";
if (_rs.getRowCount()>0) { 
 //BA.debugLineNum = 451;BA.debugLine="rs.NextRow";
_rs.NextRow();
 //BA.debugLineNum = 452;BA.debugLine="intrvl = rs.GetString(\"valor\")";
_intrvl = _rs.GetString("valor");
 };
 //BA.debugLineNum = 454;BA.debugLine="Return intrvl";
if (true) return _intrvl;
 //BA.debugLineNum = 455;BA.debugLine="End Sub";
return "";
}
public String  _traeruta() throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
 //BA.debugLineNum = 518;BA.debugLine="Sub traeRuta As String 'ignore";
 //BA.debugLineNum = 519;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 520;BA.debugLine="Private r As String";
_r = "";
 //BA.debugLineNum = 521;BA.debugLine="c = db.ExecQuery(\"select CAT_CL_RUTA from kmt_inf";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_db.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")));
 //BA.debugLineNum = 522;BA.debugLine="r = \"0\"";
_r = "0";
 //BA.debugLineNum = 523;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 524;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 525;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 527;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 528;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 529;BA.debugLine="End Sub";
return "";
}
public String  _traetimeoutdebd() throws Exception{
String _tmout = "";
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _rs = null;
 //BA.debugLineNum = 458;BA.debugLine="Sub traeTimeoutDeBD As String 'ignore";
 //BA.debugLineNum = 459;BA.debugLine="Dim tmout As String = \"9000\"";
_tmout = "9000";
 //BA.debugLineNum = 460;BA.debugLine="Dim rs As ResultSet = db.ExecQuery(\"select valor";
_rs = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_rs = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(_db.ExecQuery("select valor from cat_variables where nombre = 'timeout'")));
 //BA.debugLineNum = 461;BA.debugLine="If rs.RowCount > 0 Then";
if (_rs.getRowCount()>0) { 
 //BA.debugLineNum = 462;BA.debugLine="rs.NextRow";
_rs.NextRow();
 //BA.debugLineNum = 463;BA.debugLine="tmout = rs.GetString(\"valor\")";
_tmout = _rs.GetString("valor");
 };
 //BA.debugLineNum = 465;BA.debugLine="Return tmout";
if (true) return _tmout;
 //BA.debugLineNum = 466;BA.debugLine="End Sub";
return "";
}
public Object callSub(String sub, Object sender, Object[] args) throws Exception {
BA.senderHolder.set(sender);
if (BA.fastSubCompare(sub, "JOBDONE"))
	return _jobdone((medicomed.keymon.com.mx.httpjob) args[0]);
return BA.SubDelegator.SubNotFound;
}
}
