package medicomed.keymon.com.mx;


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

public class c_noventa 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_noventa");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", medicomed.keymon.com.mx.c_noventa.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.gps.GPS _g = null;
public String _ruta = "";
public anywheresoftware.b4a.sql.SQL _skmt = null;
public anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
public anywheresoftware.b4a.objects.ButtonWrapper _cancela = null;
public anywheresoftware.b4a.objects.ButtonWrapper _guarda = null;
public anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper _r_1 = null;
public anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper _r_2 = null;
public anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper _r_3 = null;
public anywheresoftware.b4a.objects.EditTextWrapper _e_comm = null;
public String _motivo = "";
public String _cuenta = "";
public String _usuario = "";
public String _sdate = "";
public String _stime = "";
public com.rootsoft.togglelibrary.ToggleLibrary _tgl = null;
public anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper _r_4 = null;
public medicomed.keymon.com.mx.dbrequestmanager _reqmanager = null;
public String _stay_hh = "";
public String _stay_mi = "";
public String _stay_ss = "";
public medicomed.keymon.com.mx.c_bitacora _bitacora = null;
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  _b4xpage_appear() throws Exception{
 //BA.debugLineNum = 56;BA.debugLine="Sub B4XPage_Appear";
 //BA.debugLineNum = 57;BA.debugLine="e_comm.Text=\"\"";
_e_comm.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 58;BA.debugLine="tgl.Initialize";
_tgl.Initialize(ba);
 //BA.debugLineNum = 59;BA.debugLine="If Not(Starter.gps.GPSEnabled) Then";
if (__c.Not(_starter._gps /*anywheresoftware.b4a.gps.GPS*/ .getGPSEnabled())) { 
 //BA.debugLineNum = 60;BA.debugLine="ToastMessageShow(\"Es necesario tener el GPS ence";
__c.ToastMessageShow(BA.ObjectToCharSequence("Es necesario tener el GPS encendido"),__c.True);
 //BA.debugLineNum = 61;BA.debugLine="StartActivity(Starter.gps.LocationSettingsIntent";
__c.StartActivity(ba,(Object)(_starter._gps /*anywheresoftware.b4a.gps.GPS*/ .getLocationSettingsIntent()));
 };
 //BA.debugLineNum = 63;BA.debugLine="r_1.Checked = False";
_r_1.setChecked(__c.False);
 //BA.debugLineNum = 64;BA.debugLine="r_2.Checked = False";
_r_2.setChecked(__c.False);
 //BA.debugLineNum = 65;BA.debugLine="r_3.Checked = False";
_r_3.setChecked(__c.False);
 //BA.debugLineNum = 66;BA.debugLine="r_4.Checked = False";
_r_4.setChecked(__c.False);
 //BA.debugLineNum = 67;BA.debugLine="e_comm.Text = \"\"";
_e_comm.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 68;BA.debugLine="End Sub";
return "";
}
public String  _b4xpage_created(anywheresoftware.b4a.objects.B4XViewWrapper _root1) throws Exception{
 //BA.debugLineNum = 38;BA.debugLine="Private Sub B4XPage_Created (Root1 As B4XView)";
 //BA.debugLineNum = 39;BA.debugLine="Root = Root1";
_root = _root1;
 //BA.debugLineNum = 41;BA.debugLine="Root.LoadLayout(\"noventa\")";
_root.LoadLayout("noventa",ba);
 //BA.debugLineNum = 42;BA.debugLine="ruta = File.DirInternal";
_ruta = __c.File.getDirInternal();
 //BA.debugLineNum = 44;BA.debugLine="If File.Exists(ruta, \"kmt.db\") = False Then";
if (__c.File.Exists(_ruta,"kmt.db")==__c.False) { 
 //BA.debugLineNum = 45;BA.debugLine="File.Copy(File.DirAssets, \"kmt.db\", ruta, \"kmt.d";
__c.File.Copy(__c.File.getDirAssets(),"kmt.db",_ruta,"kmt.db");
 };
 //BA.debugLineNum = 47;BA.debugLine="reqManager.Initialize(Me, Starter.DBReqServer)";
_reqmanager._initialize /*String*/ (ba,this,_starter._dbreqserver /*String*/ );
 //BA.debugLineNum = 49;BA.debugLine="bitacora.Initialize(\"bitacora\", \"bitacora\", Root,";
_bitacora._initialize /*Object*/ (ba,(Object)("bitacora"),"bitacora",_root,_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ ,_reqmanager);
 //BA.debugLineNum = 52;BA.debugLine="End Sub";
return "";
}
public String  _cancela_click() throws Exception{
 //BA.debugLineNum = 75;BA.debugLine="Sub CANCELA_Click";
 //BA.debugLineNum = 76;BA.debugLine="B4XPages.ShowPage(\"Cliente\")";
_b4xpages._showpage /*String*/ (ba,"Cliente");
 //BA.debugLineNum = 77;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 = 5;BA.debugLine="Dim g As GPS";
_g = new anywheresoftware.b4a.gps.GPS();
 //BA.debugLineNum = 6;BA.debugLine="Dim ruta As String";
_ruta = "";
 //BA.debugLineNum = 7;BA.debugLine="Dim skmt As SQL";
_skmt = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 8;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 10;BA.debugLine="Dim CANCELA As Button";
_cancela = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 11;BA.debugLine="Dim GUARDA As Button";
_guarda = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 12;BA.debugLine="Dim r_1 As RadioButton";
_r_1 = new anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper();
 //BA.debugLineNum = 13;BA.debugLine="Dim r_2 As RadioButton";
_r_2 = new anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper();
 //BA.debugLineNum = 14;BA.debugLine="Dim r_3 As RadioButton";
_r_3 = new anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper();
 //BA.debugLineNum = 15;BA.debugLine="Dim e_comm As EditText";
_e_comm = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 16;BA.debugLine="Dim motivo As String";
_motivo = "";
 //BA.debugLineNum = 17;BA.debugLine="Dim cuenta As String";
_cuenta = "";
 //BA.debugLineNum = 18;BA.debugLine="Dim usuario As String";
_usuario = "";
 //BA.debugLineNum = 19;BA.debugLine="Dim sDate,sTime As String";
_sdate = "";
_stime = "";
 //BA.debugLineNum = 21;BA.debugLine="Dim tgl As Toggle";
_tgl = new com.rootsoft.togglelibrary.ToggleLibrary();
 //BA.debugLineNum = 22;BA.debugLine="Dim r_4 As RadioButton";
_r_4 = new anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper();
 //BA.debugLineNum = 23;BA.debugLine="Dim reqManager As DBRequestManager";
_reqmanager = new medicomed.keymon.com.mx.dbrequestmanager();
 //BA.debugLineNum = 24;BA.debugLine="Private stay_hh As String";
_stay_hh = "";
 //BA.debugLineNum = 25;BA.debugLine="Private stay_mi As String";
_stay_mi = "";
 //BA.debugLineNum = 26;BA.debugLine="Private stay_ss As String";
_stay_ss = "";
 //BA.debugLineNum = 28;BA.debugLine="Dim bitacora As C_Bitacora";
_bitacora = new medicomed.keymon.com.mx.c_bitacora();
 //BA.debugLineNum = 30;BA.debugLine="End Sub";
return "";
}
public String  _gps_locationchanged(anywheresoftware.b4a.gps.LocationWrapper _location1) throws Exception{
 //BA.debugLineNum = 70;BA.debugLine="Sub GPS_LocationChanged (Location1 As Location)";
 //BA.debugLineNum = 73;BA.debugLine="End Sub";
return "";
}
public String  _guarda_click() throws Exception{
int _i = 0;
 //BA.debugLineNum = 78;BA.debugLine="Sub GUARDA_Click";
 //BA.debugLineNum = 79;BA.debugLine="If r_1.Checked Then";
if (_r_1.getChecked()) { 
 //BA.debugLineNum = 80;BA.debugLine="motivo = \"CERRADO\"";
_motivo = "CERRADO";
 }else if(_r_2.getChecked()) { 
 //BA.debugLineNum = 82;BA.debugLine="motivo = \"NO COMPRA\"";
_motivo = "NO COMPRA";
 }else if(_r_3.getChecked()) { 
 //BA.debugLineNum = 84;BA.debugLine="motivo = \"CON PRODUCTO\"";
_motivo = "CON PRODUCTO";
 }else {
 //BA.debugLineNum = 86;BA.debugLine="motivo = \"NO ESTA EL ENCARGADO\"";
_motivo = "NO ESTA EL ENCARGADO";
 };
 //BA.debugLineNum = 88;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
__c.DateTime.setDateFormat("MM/dd/yyyy");
 //BA.debugLineNum = 89;BA.debugLine="sDate=DateTime.Date(DateTime.Now)";
_sdate = __c.DateTime.Date(__c.DateTime.getNow());
 //BA.debugLineNum = 90;BA.debugLine="sTime=DateTime.Time(DateTime.Now)";
_stime = __c.DateTime.Time(__c.DateTime.getNow());
 //BA.debugLineNum = 91;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select CUENTA";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select CUENTA from cuentaa")));
 //BA.debugLineNum = 92;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 93;BA.debugLine="cuenta = c.GetString(\"CUENTA\")";
_cuenta = _c.GetString("CUENTA");
 //BA.debugLineNum = 94;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select usuari";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select usuario from usuarioa")));
 //BA.debugLineNum = 95;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 96;BA.debugLine="usuario = c.GetString(\"USUARIO\")";
_usuario = _c.GetString("USUARIO");
 //BA.debugLineNum = 97;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select PE_PRO";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select PE_PROID,PE_CANT FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")));
 //BA.debugLineNum = 98;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 99;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step21 = 1;
final int limit21 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit21 ;_i = _i + step21 ) {
 //BA.debugLineNum = 100;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 101;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"update ca";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_c.GetString("PE_CANT")),(Object)(_c.GetString("PE_PROID"))}));
 }
};
 };
 //BA.debugLineNum = 105;BA.debugLine="If B4XPages.MainPage.cliente.IsInitialized Then";
if (_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._cliente /*medicomed.keymon.com.mx.c_cliente*/ .IsInitialized /*boolean*/ ()) { 
 //BA.debugLineNum = 106;BA.debugLine="B4XPages.MainPage.cliente.motivoNoVenta = motivo";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._cliente /*medicomed.keymon.com.mx.c_cliente*/ ._motivonoventa /*String*/  = _motivo;
 //BA.debugLineNum = 108;BA.debugLine="Starter.enVenta = False";
_starter._enventa /*boolean*/  = __c.False;
 };
 //BA.debugLineNum = 114;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO  NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON) VALUES(?,?,?,?,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cuenta),(Object)(_sdate+_stime),(Object)(_usuario),(Object)(_motivo),(Object)(_e_comm.getText()),(Object)(_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._lat_gps /*String*/ ),(Object)(_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._lon_gps /*String*/ )}));
 //BA.debugLineNum = 115;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"UPDATE kmt_i";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE kmt_info set gestion = 3  where CAT_CL_CODIGO In (select cuenta from cuentaa)");
 //BA.debugLineNum = 116;BA.debugLine="DateTime.TimeFormat = \"HHmmss\"";
__c.DateTime.setTimeFormat("HHmmss");
 //BA.debugLineNum = 117;BA.debugLine="sTime=DateTime.Time(DateTime.Now)";
_stime = __c.DateTime.Time(__c.DateTime.getNow());
 //BA.debugLineNum = 118;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"UPDATE HIST";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("UPDATE HIST_STAY_STORE set HSS_OUT = ?  where HSS_CODIGO In (select cuenta from cuentaa)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_stime)}));
 //BA.debugLineNum = 121;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\" Select (subs";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(" Select (substr(HSS_OUT,1,2) - substr(HSS_IN,1,2)) - Case when  (substr(HSS_OUT,3,2) - substr(HSS_IN,3,2)) < 0 Then 1 Else 0 end HORAS_TOTALES, "+"Case when  (substr(HSS_OUT,3,2) - substr(HSS_IN,3,2)) < 0 Then (substr(HSS_OUT,3,2) + 60 - substr(HSS_IN,3,2)) "+"	Else (substr(HSS_OUT,3,2) - substr(HSS_IN,3,2)) End - Case when  (substr(HSS_OUT,5,2) - substr(HSS_IN,5,2)) < 0 Then 1 Else 0 end  MINUTOS_TOTALES, "+"Case when  (substr(HSS_OUT,5,2) - substr(HSS_IN,5,2)) < 0 Then (substr(HSS_OUT,5,2) + 60 - substr(HSS_IN,5,2)) "+"	Else (substr(HSS_OUT,5,2) - substr(HSS_IN,5,2)) end SEGUNDOS_TOTALES "+"	from HIST_STAY_STORE where HSS_CODIGO In (Select cuenta from cuentaa) ")));
 //BA.debugLineNum = 127;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 128;BA.debugLine="stay_hh = c.GetString(\"HORAS_TOTALES\") * 60 * 60";
_stay_hh = BA.NumberToString((double)(Double.parseDouble(_c.GetString("HORAS_TOTALES")))*60*60);
 //BA.debugLineNum = 129;BA.debugLine="stay_mi = c.GetString(\"MINUTOS_TOTALES\") * 60";
_stay_mi = BA.NumberToString((double)(Double.parseDouble(_c.GetString("MINUTOS_TOTALES")))*60);
 //BA.debugLineNum = 130;BA.debugLine="stay_ss = c.GetString(\"SEGUNDOS_TOTALES\")";
_stay_ss = _c.GetString("SEGUNDOS_TOTALES");
 //BA.debugLineNum = 132;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"UPDATE HIST";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("UPDATE HIST_STAY_STORE set HSS_TOT = ?  where HSS_CODIGO In (select cuenta from cuentaa)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)((double)(Double.parseDouble(_stay_hh))+(double)(Double.parseDouble(_stay_mi))+(double)(Double.parseDouble(_stay_ss)))}));
 //BA.debugLineNum = 133;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"UPDATE HIST";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("UPDATE HIST_STAY_OUT set HSO_FIN = ?  ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_stime)}));
 //BA.debugLineNum = 134;BA.debugLine="DateTime.TimeFormat = \"HH:mm:ss\"";
__c.DateTime.setTimeFormat("HH:mm:ss");
 //BA.debugLineNum = 136;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"update PEDI";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("update PEDIDO_INICIO_FINAL set PIF_HORA_FINAL = ? where PIF_CLIENTE = ? and PIF_HORA_FINAL = 0",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(__c.DateTime.getNow()),(Object)(_cuenta)}));
 //BA.debugLineNum = 137;BA.debugLine="LogColor($\"actualizamos \"${cuenta},  hora_final=$";
__c.LogImpl("763111227",("actualizamos \""+__c.SmartStringFormatter("",(Object)(_cuenta))+",  hora_final="+__c.SmartStringFormatter("",(Object)(__c.DateTime.getNow()))+""),__c.Colors.Red);
 //BA.debugLineNum = 140;BA.debugLine="bitacora.mandaBitacora(Subs.fechanormal(DateTime.";
_bitacora._mandabitacora /*String*/ (_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),_usuario,_subs._traealmacen /*String*/ (ba),_subs._traerutabitacora /*String*/ (ba),"NO VENTA",_subs._traecliente /*String*/ (ba),_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),_subs._fechanormal /*String*/ (ba,BA.NumberToString(__c.DateTime.getNow())),_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._lat_gps /*String*/ ,_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._lon_gps /*String*/ ,BA.NumberToString(2),_motivo,BA.ObjectToString(_r_1.getChecked()));
 //BA.debugLineNum = 142;BA.debugLine="B4XPages.ShowPage(\"Principal\")";
_b4xpages._showpage /*String*/ (ba,"Principal");
 //BA.debugLineNum = 143;BA.debugLine="End Sub";
return "";
}
public Object  _initialize(anywheresoftware.b4a.BA _ba) throws Exception{
innerInitialize(_ba);
 //BA.debugLineNum = 33;BA.debugLine="Public Sub Initialize As Object";
 //BA.debugLineNum = 34;BA.debugLine="Return Me";
if (true) return this;
 //BA.debugLineNum = 35;BA.debugLine="End Sub";
return null;
}
public String  _jobdone(medicomed.keymon.com.mx.httpjob _job) throws Exception{
medicomed.keymon.com.mx.dbrequestmanager._dbresult _resultado = null;
String _cliente = "";
Object[] _records = null;
String _k = "";
 //BA.debugLineNum = 163;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 164;BA.debugLine="Log(Job.Success)";
__c.LogImpl("763242241",BA.ObjectToString(_job._success /*boolean*/ ),0);
 //BA.debugLineNum = 165;BA.debugLine="If Job.Success = False Then";
if (_job._success /*boolean*/ ==__c.False) { 
 //BA.debugLineNum = 166;BA.debugLine="ToastMessageShow(\"Error: \" & Job.ErrorMessage, Tr";
__c.ToastMessageShow(BA.ObjectToCharSequence("Error: "+_job._errormessage /*String*/ ),__c.True);
 }else {
 //BA.debugLineNum = 168;BA.debugLine="LogColor(\"JobDone: '\" & reqManager.HandleJob(Job)";
__c.LogImpl("763242245","JobDone: '"+BA.ObjectToString(_reqmanager._handlejob /*medicomed.keymon.com.mx.dbrequestmanager._dbresult*/ (_job).Tag /*Object*/ )+"' - Registros: "+BA.NumberToString(_reqmanager._handlejob /*medicomed.keymon.com.mx.dbrequestmanager._dbresult*/ (_job).Rows /*anywheresoftware.b4a.objects.collections.List*/ .getSize()),__c.Colors.Green);
 //BA.debugLineNum = 169;BA.debugLine="If Job.JobName = \"DBRequest\" Then";
if ((_job._jobname /*String*/ ).equals("DBRequest")) { 
 //BA.debugLineNum = 170;BA.debugLine="Dim resultado As DBResult = reqManager.HandleJob";
_resultado = _reqmanager._handlejob /*medicomed.keymon.com.mx.dbrequestmanager._dbresult*/ (_job);
 //BA.debugLineNum = 171;BA.debugLine="If resultado.Tag.As(String).IndexOf(\"insert_nov";
if ((BA.ObjectToString(_resultado.Tag /*Object*/ )).indexOf("insert_noventa_")>-1) { 
 //BA.debugLineNum = 172;BA.debugLine="Private cliente As String= resultado.Tag";
_cliente = BA.ObjectToString(_resultado.Tag /*Object*/ );
 //BA.debugLineNum = 173;BA.debugLine="cliente = cliente.SubString(cliente.IndexOf(\"_\"";
_cliente = _cliente.substring((int) (_cliente.indexOf("_")+9));
 //BA.debugLineNum = 174;BA.debugLine="Log($\"Cliente1:${cliente}\"$)";
__c.LogImpl("763242251",("Cliente1:"+__c.SmartStringFormatter("",(Object)(_cliente))+""),0);
 //BA.debugLineNum = 175;BA.debugLine="Starter.skmt.ExecNonQuery($\"update NOVENTA set";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update NOVENTA set NV_ENVIO_OK = '1' where NV_CLIENTE = '"+__c.SmartStringFormatter("",(Object)(_cliente))+"'"));
 //BA.debugLineNum = 176;BA.debugLine="For Each records() As Object In resultado.Rows";
{
final anywheresoftware.b4a.BA.IterableList group13 = _resultado.Rows /*anywheresoftware.b4a.objects.collections.List*/ ;
final int groupLen13 = group13.getSize()
;int index13 = 0;
;
for (; index13 < groupLen13;index13++){
_records = (Object[])(group13.Get(index13));
 //BA.debugLineNum = 177;BA.debugLine="For Each k As String In resultado.Columns.Keys";
{
final anywheresoftware.b4a.BA.IterableList group14 = _resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Keys();
final int groupLen14 = group14.getSize()
;int index14 = 0;
;
for (; index14 < groupLen14;index14++){
_k = BA.ObjectToString(group14.Get(index14));
 //BA.debugLineNum = 178;BA.debugLine="Log(resultado.Tag & \": \" & k & \": \" & records";
__c.LogImpl("763242255",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 = 183;BA.debugLine="Job.Release";
_job._release /*String*/ ();
 };
 //BA.debugLineNum = 185;BA.debugLine="End Sub";
return "";
}
public String  _mandapendientesnoventa() throws Exception{
int _i = 0;
medicomed.keymon.com.mx.dbrequestmanager._dbcommand _cmd = null;
 //BA.debugLineNum = 145;BA.debugLine="Sub mandaPendientesnoventa";
 //BA.debugLineNum = 148;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"SELECT * FR";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT * FROM NOVENTA where ifnull(NV_ENVIO_OK, 0) <> 1")));
 //BA.debugLineNum = 149;BA.debugLine="Log($\"NO VENTA PENDIENTE: ${c.RowCount}\"$)";
__c.LogImpl("763176708",("NO VENTA PENDIENTE: "+__c.SmartStringFormatter("",(Object)(_c.getRowCount()))+""),0);
 //BA.debugLineNum = 150;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 151;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step4 = 1;
final int limit4 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
 //BA.debugLineNum = 152;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 153;BA.debugLine="Dim cmd As DBCommand";
_cmd = new medicomed.keymon.com.mx.dbrequestmanager._dbcommand();
 //BA.debugLineNum = 154;BA.debugLine="cmd.Initialize";
_cmd.Initialize();
 //BA.debugLineNum = 155;BA.debugLine="cmd.Name = \"insert_noventa_MEDI_V2\"";
_cmd.Name /*String*/  = "insert_noventa_MEDI_V2";
 //BA.debugLineNum = 156;BA.debugLine="cmd.Parameters = Array As Object(C.GetString(\"N";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(_c.GetString("NV_CLIENTE")),(Object)(_c.GetString("NV_FECHA")),(Object)(_c.GetString("NV_USER")),(Object)(_c.GetString("NV_MOTIVO")),(Object)(_c.GetString("NV_COMM")),(Object)(_c.GetString("NV_LAT")),(Object)(_c.GetString("NV_LON")),(Object)(_subs._traealmacen /*String*/ (ba)),(Object)(_subs._traeruta /*String*/ (ba,_c.GetString("NV_CLIENTE")))};
 //BA.debugLineNum = 157;BA.debugLine="reqManager.ExecuteCommand(cmd , $\"insert_novent";
_reqmanager._executecommand /*String*/ (_cmd,(Object)(("insert_noventa_"+__c.SmartStringFormatter("",(Object)(_c.GetString("NV_CLIENTE")))+"")));
 }
};
 };
 //BA.debugLineNum = 161;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, "GPS_LOCATIONCHANGED"))
	return _gps_locationchanged((anywheresoftware.b4a.gps.LocationWrapper) args[0]);
if (BA.fastSubCompare(sub, "JOBDONE"))
	return _jobdone((medicomed.keymon.com.mx.httpjob) args[0]);
return BA.SubDelegator.SubNotFound;
}
}
