package reparto_intmex.keymon.lat;


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, "reparto_intmex.keymon.lat.c_noventa");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", reparto_intmex.keymon.lat.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 anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
public String _comentario = "";
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 anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper _r_4 = null;
public anywheresoftware.b4a.objects.PanelWrapper _p_principal = null;
public anywheresoftware.b4a.sql.SQL.CursorWrapper _d = null;
public reparto_intmex.keymon.lat.dbrequestmanager _reqmanager = null;
public anywheresoftware.b4a.objects.CompoundButtonWrapper.CheckBoxWrapper _cb_reprogramar = null;
public int _reprogramar = 0;
public b4a.example.dateutils _dateutils = null;
public reparto_intmex.keymon.lat.main _main = null;
public reparto_intmex.keymon.lat.appupdater _appupdater = null;
public reparto_intmex.keymon.lat.starter _starter = null;
public reparto_intmex.keymon.lat.foto _foto = null;
public reparto_intmex.keymon.lat.mapa_cliente _mapa_cliente = null;
public reparto_intmex.keymon.lat.mapa_rutas _mapa_rutas = null;
public reparto_intmex.keymon.lat.subs _subs = null;
public reparto_intmex.keymon.lat.tracker _tracker = null;
public reparto_intmex.keymon.lat.newinst2 _newinst2 = null;
public reparto_intmex.keymon.lat.b4xpages _b4xpages = null;
public reparto_intmex.keymon.lat.b4xcollections _b4xcollections = null;
public reparto_intmex.keymon.lat.httputils2service _httputils2service = null;
public reparto_intmex.keymon.lat.xuiviewsutils _xuiviewsutils = null;
public String  _b4xpage_appear() throws Exception{
 //BA.debugLineNum = 40;BA.debugLine="Sub B4XPage_Appear";
 //BA.debugLineNum = 41;BA.debugLine="reqManager.Initialize(Me, B4XPages.MainPage.SERVE";
_reqmanager._initialize /*String*/ (ba,this,_b4xpages._mainpage /*reparto_intmex.keymon.lat.b4xmainpage*/ (ba)._server /*String*/ );
 //BA.debugLineNum = 42;BA.debugLine="e_comm.Text=\"\"";
_e_comm.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 43;BA.debugLine="r_1.Checked = False";
_r_1.setChecked(__c.False);
 //BA.debugLineNum = 44;BA.debugLine="r_2.Checked = False";
_r_2.setChecked(__c.False);
 //BA.debugLineNum = 45;BA.debugLine="r_3.Checked = False";
_r_3.setChecked(__c.False);
 //BA.debugLineNum = 46;BA.debugLine="r_4.Checked = False";
_r_4.setChecked(__c.False);
 //BA.debugLineNum = 47;BA.debugLine="cb_reprogramar.Checked = False";
_cb_reprogramar.setChecked(__c.False);
 //BA.debugLineNum = 48;BA.debugLine="End Sub";
return "";
}
public String  _b4xpage_created(anywheresoftware.b4a.objects.B4XViewWrapper _root1) throws Exception{
 //BA.debugLineNum = 31;BA.debugLine="Private Sub B4XPage_Created (Root1 As B4XView)";
 //BA.debugLineNum = 32;BA.debugLine="Root = Root1";
_root = _root1;
 //BA.debugLineNum = 34;BA.debugLine="Root.LoadLayout(\"no_venta\")";
_root.LoadLayout("no_venta",ba);
 //BA.debugLineNum = 35;BA.debugLine="reqManager.Initialize(Me, B4XPages.MainPage.SERVE";
_reqmanager._initialize /*String*/ (ba,this,_b4xpages._mainpage /*reparto_intmex.keymon.lat.b4xmainpage*/ (ba)._server /*String*/ );
 //BA.debugLineNum = 36;BA.debugLine="End Sub";
return "";
}
public String  _cancela_click() throws Exception{
 //BA.debugLineNum = 55;BA.debugLine="Sub CANCELA_Click";
 //BA.debugLineNum = 56;BA.debugLine="B4XPages.ShowPage(\"Cliente\")";
_b4xpages._showpage /*String*/ (ba,"Cliente");
 //BA.debugLineNum = 57;BA.debugLine="End Sub";
return "";
}
public String  _cb_reprogramar_checkedchange(boolean _checked) throws Exception{
 //BA.debugLineNum = 199;BA.debugLine="Private Sub cb_reprogramar_CheckedChange(Checked A";
 //BA.debugLineNum = 200;BA.debugLine="If Checked Then";
if (_checked) { 
 //BA.debugLineNum = 201;BA.debugLine="reprogramar = 1";
_reprogramar = (int) (1);
 }else {
 //BA.debugLineNum = 203;BA.debugLine="reprogramar = 0";
_reprogramar = (int) (0);
 };
 //BA.debugLineNum = 205;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 g As GPS";
_g = new anywheresoftware.b4a.gps.GPS();
 //BA.debugLineNum = 5;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 6;BA.debugLine="Dim COMENTARIO As String";
_comentario = "";
 //BA.debugLineNum = 7;BA.debugLine="Dim CANCELA As Button";
_cancela = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 8;BA.debugLine="Dim GUARDA As Button";
_guarda = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 9;BA.debugLine="Dim r_1 As RadioButton";
_r_1 = new anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper();
 //BA.debugLineNum = 10;BA.debugLine="Dim r_2 As RadioButton";
_r_2 = new anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper();
 //BA.debugLineNum = 11;BA.debugLine="Dim r_3 As RadioButton";
_r_3 = new anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper();
 //BA.debugLineNum = 12;BA.debugLine="Dim e_comm As EditText";
_e_comm = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 13;BA.debugLine="Dim motivo As String";
_motivo = "";
 //BA.debugLineNum = 14;BA.debugLine="Dim cuenta As String";
_cuenta = "";
 //BA.debugLineNum = 15;BA.debugLine="Dim usuario As String";
_usuario = "";
 //BA.debugLineNum = 16;BA.debugLine="Dim sDate,sTime As String";
_sdate = "";
_stime = "";
 //BA.debugLineNum = 17;BA.debugLine="Dim r_4 As RadioButton";
_r_4 = new anywheresoftware.b4a.objects.CompoundButtonWrapper.RadioButtonWrapper();
 //BA.debugLineNum = 18;BA.debugLine="Private p_principal As Panel";
_p_principal = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 19;BA.debugLine="Dim d As Cursor";
_d = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 20;BA.debugLine="Dim reqManager As DBRequestManager";
_reqmanager = new reparto_intmex.keymon.lat.dbrequestmanager();
 //BA.debugLineNum = 21;BA.debugLine="Private cb_reprogramar As CheckBox";
_cb_reprogramar = new anywheresoftware.b4a.objects.CompoundButtonWrapper.CheckBoxWrapper();
 //BA.debugLineNum = 22;BA.debugLine="Dim reprogramar As Int = 0";
_reprogramar = (int) (0);
 //BA.debugLineNum = 23;BA.debugLine="End Sub";
return "";
}
public String  _gps_locationchanged(anywheresoftware.b4a.gps.LocationWrapper _location1) throws Exception{
 //BA.debugLineNum = 50;BA.debugLine="Sub GPS_LocationChanged (Location1 As Location)";
 //BA.debugLineNum = 53;BA.debugLine="End Sub";
return "";
}
public String  _guarda_click() throws Exception{
String _rutaactualizar = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _rut = null;
String _estecliente = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _rv = null;
int _i2 = 0;
int _i = 0;
String _ruta = "";
String _rutapre = "";
String _fechaprev = "";
 //BA.debugLineNum = 59;BA.debugLine="Sub GUARDA_Click";
 //BA.debugLineNum = 60;BA.debugLine="If r_1.Checked = False And r_2.Checked = False An";
if (_r_1.getChecked()==__c.False && _r_2.getChecked()==__c.False && _r_3.getChecked()==__c.False && _r_4.getChecked()==__c.False) { 
 //BA.debugLineNum = 61;BA.debugLine="MsgboxAsync(\"Selecciona un motivo de rechazo\",\"A";
__c.MsgboxAsync(BA.ObjectToCharSequence("Selecciona un motivo de rechazo"),BA.ObjectToCharSequence("Atención"),ba);
 }else {
 //BA.debugLineNum = 64;BA.debugLine="If r_1.Checked Then";
if (_r_1.getChecked()) { 
 //BA.debugLineNum = 65;BA.debugLine="motivo = \"CERRADO\"";
_motivo = "CERRADO";
 }else if(_r_2.getChecked()) { 
 //BA.debugLineNum = 67;BA.debugLine="motivo = \"NO PIDIO\"";
_motivo = "NO PIDIO";
 }else if(_r_3.getChecked()) { 
 //BA.debugLineNum = 69;BA.debugLine="motivo = \"CANCELA\"";
_motivo = "CANCELA";
 }else {
 //BA.debugLineNum = 71;BA.debugLine="motivo = \"NO ESTA EL ENCARGADO\"";
_motivo = "NO ESTA EL ENCARGADO";
 };
 //BA.debugLineNum = 74;BA.debugLine="If motivo <> \"CERRADO\"  Or motivo = \"CERRADO\" Th";
if ((_motivo).equals("CERRADO") == false || (_motivo).equals("CERRADO")) { 
 //BA.debugLineNum = 75;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
__c.DateTime.setDateFormat("MM/dd/yyyy");
 //BA.debugLineNum = 76;BA.debugLine="DateTime.TimeFormat=\"HHmmss\"";
__c.DateTime.setTimeFormat("HHmmss");
 //BA.debugLineNum = 77;BA.debugLine="sDate=DateTime.Date(DateTime.Now)";
_sdate = __c.DateTime.Date(__c.DateTime.getNow());
 //BA.debugLineNum = 78;BA.debugLine="sTime=DateTime.Time(DateTime.Now)";
_stime = __c.DateTime.Time(__c.DateTime.getNow());
 //BA.debugLineNum = 79;BA.debugLine="c=Starter.skmt.ExecQuery(\"select CUENTA from cu";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select CUENTA from cuentaa")));
 //BA.debugLineNum = 80;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 81;BA.debugLine="cuenta = c.GetString(\"CUENTA\")";
_cuenta = _c.GetString("CUENTA");
 //BA.debugLineNum = 82;BA.debugLine="c=Starter.skmt.ExecQuery(\"select usuario from u";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select usuario from usuarioa")));
 //BA.debugLineNum = 83;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 84;BA.debugLine="usuario = c.GetString(\"USUARIO\")";
_usuario = _c.GetString("USUARIO");
 //BA.debugLineNum = 85;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 86;BA.debugLine="Dim rutaactualizar As String";
_rutaactualizar = "";
 //BA.debugLineNum = 87;BA.debugLine="Dim rut As Cursor = Starter.skmt.ExecQuery(\"SEL";
_rut = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_rut = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT CAT_CL_RUTA FROM kmt_info WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 88;BA.debugLine="If rut.RowCount > 0 Then";
if (_rut.getRowCount()>0) { 
 //BA.debugLineNum = 89;BA.debugLine="rut.Position = 0";
_rut.setPosition((int) (0));
 //BA.debugLineNum = 90;BA.debugLine="rutaactualizar = rut.GetString(\"CAT_CL_RUTA\")";
_rutaactualizar = _rut.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 92;BA.debugLine="Starter.skmt.ExecNonQuery($\"DELETE FROM NOVENTA";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("DELETE FROM NOVENTA WHERE NV_CLIENTE IN (select cuenta from cuentaa) AND NV_RUTA ='"+__c.SmartStringFormatter("",(Object)(_rutaactualizar))+"' "));
 //BA.debugLineNum = 94;BA.debugLine="c=Starter.skmt.ExecQuery(\"select HVD_NUM_REGIST";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select HVD_NUM_REGISTRO, HVD_CLIENTE, HVD_PRONOMBRE, HVD_CANT, HVD_COSTO_TOT, HVD_FECHA, HVD_PROID, CAT_GP_PRECIO from HIST_VENTAS2 join CAT_GUNAPROD on CAT_GP_ID = HVD_PROID WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_PRONOMBRE asc")));
 //BA.debugLineNum = 95;BA.debugLine="If c.RowCount > 0 Then 'Si  hay pedido en HIST_";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 98;BA.debugLine="Private esteCliente As String = Subs.traeClien";
_estecliente = _subs._traecliente /*String*/ (ba);
 //BA.debugLineNum = 99;BA.debugLine="Private rv As Cursor = Starter.skmt.ExecQuery(";
_rv = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_rv = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from REPARTO where REP_CLIENTE = '"+__c.SmartStringFormatter("",(Object)(_estecliente))+"' and REP_CLI_ORIG <> '"+__c.SmartStringFormatter("",(Object)(_estecliente))+"' and REP_RECHAZO = 0"))));
 //BA.debugLineNum = 100;BA.debugLine="If rv.RowCount > 0 Then 'Si tenemos venta en e";
if (_rv.getRowCount()>0) { 
 //BA.debugLineNum = 101;BA.debugLine="For i2=0 To rv.RowCount - 1";
{
final int step37 = 1;
final int limit37 = (int) (_rv.getRowCount()-1);
_i2 = (int) (0) ;
for (;_i2 <= limit37 ;_i2 = _i2 + step37 ) {
 //BA.debugLineNum = 102;BA.debugLine="rv.Position = i2";
_rv.setPosition(_i2);
 //BA.debugLineNum = 103;BA.debugLine="Log($\"Actualizamos REPARTO - cliente=${rv.Ge";
__c.LogImpl("818022444",("Actualizamos REPARTO - cliente="+__c.SmartStringFormatter("",(Object)(_rv.GetString("REP_CLIENTE")))+", cliente orignal="+__c.SmartStringFormatter("",(Object)(_rv.GetString("REP_CLI_ORIG")))+", le agregamos "+__c.SmartStringFormatter("",(Object)(_rv.GetString("REP_CANT")))+""),0);
 //BA.debugLineNum = 104;BA.debugLine="Starter.skmt.ExecNonQuery($\"update REPARTO s";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update REPARTO set REP_CANT = REP_CANT + "+__c.SmartStringFormatter("",(Object)(_rv.GetString("REP_CANT")))+" where REP_RECHAZO = '1' and REP_CLIENTE = '"+__c.SmartStringFormatter("",(Object)(_rv.GetString("REP_CLI_ORIG")))+"' and REP_CLI_ORIG = '"+__c.SmartStringFormatter("",(Object)(_rv.GetString("REP_CLI_ORIG")))+"'"));
 }
};
 };
 //BA.debugLineNum = 108;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from reparto";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from reparto where REP_CLIENTE IN (Select CUENTA from cuentaa)");
 //BA.debugLineNum = 109;BA.debugLine="For i=0 To c.RowCount - 1 'Insertamos los prod";
{
final int step44 = 1;
final int limit44 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit44 ;_i = _i + step44 ) {
 //BA.debugLineNum = 110;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 111;BA.debugLine="Log($\"REGISTRO= ${c.GetString(\"HVD_NUM_REGIST";
__c.LogImpl("818022452",("REGISTRO= "+__c.SmartStringFormatter("",(Object)(_c.GetString("HVD_NUM_REGISTRO")))+""),0);
 //BA.debugLineNum = 112;BA.debugLine="Starter.skmt.ExecNonQuery2(\"insert into repar";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into reparto(REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT, REP_FECHA, REP_RECHAZO, REP_PRODID, REP_PRECIO, REP_PRODREGISTRO, REP_CLI_ORIG) VALUES (?,?,?,?,?,1,?,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_c.GetString("HVD_CLIENTE"),_c.GetString("HVD_PRONOMBRE"),_c.GetString("HVD_CANT"),_c.GetString("HVD_COSTO_TOT"),_c.GetString("HVD_FECHA"),_c.GetString("HVD_PROID"),_c.GetString("CAT_GP_PRECIO"),_c.GetString("HVD_NUM_REGISTRO"),_c.GetString("HVD_CLIENTE")}));
 //BA.debugLineNum = 113;BA.debugLine="Starter.skmt.ExecNonQuery2(\"insert into repar";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into reparto(REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT, REP_FECHA, REP_RECHAZO, REP_PRODID, REP_PRECIO, REP_PRODREGISTRO, REP_CLI_ORIG) VALUES (?,?,?,?,?,0,?,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_c.GetString("HVD_CLIENTE"),_c.GetString("HVD_PRONOMBRE"),BA.NumberToString(0),_c.GetString("HVD_COSTO_TOT"),_c.GetString("HVD_FECHA"),_c.GetString("HVD_PROID"),_c.GetString("CAT_GP_PRECIO"),_c.GetString("HVD_NUM_REGISTRO"),_c.GetString("HVD_CLIENTE")}));
 //BA.debugLineNum = 114;BA.debugLine="Starter.skmt.ExecNonQuery2(\"update cat_gunapr";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_c.GetString("HVD_CANT")),(Object)(_c.GetString("HVD_PRONOMBRE"))}));
 }
};
 };
 //BA.debugLineNum = 118;BA.debugLine="Starter.skmt.ExecNonQuery2(\"INSERT INTO NOVENTA";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON,NV_FOTO,NV_REPROGRAMAR) VALUES(?,?,?,?,?,?,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cuenta),(Object)(_sdate+_stime),(Object)(_usuario),(Object)(_motivo),(Object)(_e_comm.getText()),(Object)(_b4xpages._mainpage /*reparto_intmex.keymon.lat.b4xmainpage*/ (ba)._lat_gps /*String*/ ),(Object)(_b4xpages._mainpage /*reparto_intmex.keymon.lat.b4xmainpage*/ (ba)._lon_gps /*String*/ ),(Object)(_rutaactualizar),(Object)(_reprogramar)}));
 //BA.debugLineNum = 119;BA.debugLine="Starter.skmt.ExecNonQuery($\"UPDATE kmt_info set";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("UPDATE kmt_info set gestion = 3, HORAENT = '"+__c.SmartStringFormatter("",(Object)(_sdate+" "+_stime))+"' where CAT_CL_CODIGO In (select cuenta from cuentaa) and CAT_CL_RUTA = '"+__c.SmartStringFormatter("",(Object)(_rutaactualizar))+"'"));
 //BA.debugLineNum = 120;BA.debugLine="Starter.skmt.ExecNonQuery(\"update HIST_VENTAS S";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("update HIST_VENTAS SET HVD_RECHAZO = 1, HVD_RECHAZOCANT = HVD_CANT, HVD_RECHAZOCANTC = CANTC, BCAJAS = 0 , CANTC = 0 WHERE HVD_CLIENTE IN (SELECT CUENTA FROM CUENTAA)");
 //BA.debugLineNum = 121;BA.debugLine="Starter.skmt.ExecNonQuery($\"update HIST_VENTAS";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update HIST_VENTAS set HVD_RECHAZO = 2,  HVD_RECHAZOCANT = HVD_RECHAZOCANT  WHERE HVD_PROID = HVD_CODPROMO and HVD_CLIENTE in (Select CUENTA from cuentaa)"));
 //BA.debugLineNum = 122;BA.debugLine="Starter.skmt.ExecNonQuery(\"DELETE FROM PEDIDO W";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("DELETE FROM PEDIDO WHERE PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA)");
 //BA.debugLineNum = 123;BA.debugLine="d = Starter.skmt.ExecQuery(\"SELECT RUTAA FROM R";
_d = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT RUTAA FROM RUTAA")));
 //BA.debugLineNum = 124;BA.debugLine="d.Position = 0";
_d.setPosition((int) (0));
 //BA.debugLineNum = 125;BA.debugLine="Dim ruta As String = d.GetString(\"RUTAA\")";
_ruta = _d.GetString("RUTAA");
 //BA.debugLineNum = 126;BA.debugLine="d.Close";
_d.Close();
 //BA.debugLineNum = 127;BA.debugLine="d = Starter.skmt.ExecQuery(\"SELECT CAT_CL_RUTA";
_d = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT CAT_CL_RUTA FROM kmt_info WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 128;BA.debugLine="d.Position = 0";
_d.setPosition((int) (0));
 //BA.debugLineNum = 129;BA.debugLine="Dim rutapre As String = d.GetString(\"CAT_CL_RUT";
_rutapre = _d.GetString("CAT_CL_RUTA");
 //BA.debugLineNum = 130;BA.debugLine="d.Close";
_d.Close();
 //BA.debugLineNum = 131;BA.debugLine="d = Starter.skmt.ExecQuery(\"SELECT HVD_FECHA FR";
_d = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT HVD_FECHA FROM HIST_VENTAS WHERE HVD_CLIENTE IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 132;BA.debugLine="d.Position = 0";
_d.setPosition((int) (0));
 //BA.debugLineNum = 133;BA.debugLine="Dim fechaprev As String = d.GetString(\"HVD_FECH";
_fechaprev = _d.GetString("HVD_FECHA");
 //BA.debugLineNum = 134;BA.debugLine="d.Close";
_d.Close();
 //BA.debugLineNum = 135;BA.debugLine="d = Starter.skmt.ExecQuery(\"SELECT CUENTA FROM";
_d = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT CUENTA FROM CUENTAA")));
 //BA.debugLineNum = 136;BA.debugLine="d.Position = 0";
_d.setPosition((int) (0));
 //BA.debugLineNum = 137;BA.debugLine="Starter.skmt.ExecNonQuery2(\"INSERT INTO REPARTO";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO REPARTO_GEO (CLIENTE, USUARIO, FECHA_PUNTEO, LATITUD, LONGITUD, ALMACEN, RUTA_REPARTO, RUTA_PREV, FECHA_PREVENTA, MOTIVO, COMENTARIO,TIPO,ENVIO) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,0)",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_cuenta,_usuario,_sdate+" "+_stime,_b4xpages._mainpage /*reparto_intmex.keymon.lat.b4xmainpage*/ (ba)._lat_gps /*String*/ ,_b4xpages._mainpage /*reparto_intmex.keymon.lat.b4xmainpage*/ (ba)._lon_gps /*String*/ ,_b4xpages._mainpage /*reparto_intmex.keymon.lat.b4xmainpage*/ (ba)._almacen /*String*/ ,_ruta,_rutapre,_fechaprev,_motivo,_e_comm.getText(),"NO ENTREGADO"}));
 //BA.debugLineNum = 143;BA.debugLine="B4XPages.ShowPage(\"Principal\")";
_b4xpages._showpage /*String*/ (ba,"Principal");
 }else {
 //BA.debugLineNum = 146;BA.debugLine="COMENTARIO = e_comm.Text";
_comentario = _e_comm.getText();
 };
 };
 //BA.debugLineNum = 151;BA.debugLine="End Sub";
return "";
}
public Object  _initialize(anywheresoftware.b4a.BA _ba) throws Exception{
innerInitialize(_ba);
 //BA.debugLineNum = 26;BA.debugLine="Public Sub Initialize As Object";
 //BA.debugLineNum = 27;BA.debugLine="Return Me";
if (true) return this;
 //BA.debugLineNum = 28;BA.debugLine="End Sub";
return null;
}
public String  _jobdone(reparto_intmex.keymon.lat.httpjob _job) throws Exception{
reparto_intmex.keymon.lat.dbrequestmanager._dbresult _resultado = null;
String _cliente = "";
Object[] _records = null;
String _k = "";
 //BA.debugLineNum = 174;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 175;BA.debugLine="Log(Job.Success)";
__c.LogImpl("818153473",BA.ObjectToString(_job._success /*boolean*/ ),0);
 //BA.debugLineNum = 176;BA.debugLine="If Job.Success = False Then";
if (_job._success /*boolean*/ ==__c.False) { 
 }else {
 //BA.debugLineNum = 179;BA.debugLine="LogColor(\"JobDone: '\" & reqManager.HandleJob(Job";
__c.LogImpl("818153477","JobDone: '"+BA.ObjectToString(_reqmanager._handlejob /*reparto_intmex.keymon.lat.dbrequestmanager._dbresult*/ (_job).Tag /*Object*/ )+"' - Registros: "+BA.NumberToString(_reqmanager._handlejob /*reparto_intmex.keymon.lat.dbrequestmanager._dbresult*/ (_job).Rows /*anywheresoftware.b4a.objects.collections.List*/ .getSize()),__c.Colors.Green);
 //BA.debugLineNum = 180;BA.debugLine="If Job.JobName = \"DBRequest\" Then";
if ((_job._jobname /*String*/ ).equals("DBRequest")) { 
 //BA.debugLineNum = 181;BA.debugLine="Dim resultado As DBResult = reqManager.HandleJo";
_resultado = _reqmanager._handlejob /*reparto_intmex.keymon.lat.dbrequestmanager._dbresult*/ (_job);
 //BA.debugLineNum = 182;BA.debugLine="If resultado.Tag.As(String).IndexOf(\"ins_REPART";
if ((BA.ObjectToString(_resultado.Tag /*Object*/ )).indexOf("ins_REPARTOPendientes_head_")>-1) { 
 //BA.debugLineNum = 183;BA.debugLine="Private cliente As String= resultado.Tag";
_cliente = BA.ObjectToString(_resultado.Tag /*Object*/ );
 //BA.debugLineNum = 184;BA.debugLine="cliente = cliente.SubString(cliente.IndexOf(\"_";
_cliente = _cliente.substring((int) (_cliente.indexOf("_")+24));
 //BA.debugLineNum = 185;BA.debugLine="Log($\"Cliente1:${cliente}\"$)";
__c.LogImpl("818153483",("Cliente1:"+__c.SmartStringFormatter("",(Object)(_cliente))+""),0);
 //BA.debugLineNum = 186;BA.debugLine="Starter.skmt.ExecNonQuery2(\"update REPARTO_GEO";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("update REPARTO_GEO SET ENVIO = ? WHERE CLIENTE = ? AND ENVIO <> ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{"1",_cliente,"1"}));
 //BA.debugLineNum = 187;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 = 188;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 = 189;BA.debugLine="Log(resultado.Tag & \": \" & k & \": \" & record";
__c.LogImpl("818153487",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 = 194;BA.debugLine="Job.Release";
_job._release /*String*/ ();
 };
 //BA.debugLineNum = 197;BA.debugLine="End Sub";
return "";
}
public String  _mandapendientesreparto() throws Exception{
 //BA.debugLineNum = 154;BA.debugLine="Sub mandaPendientesreparto";
 //BA.debugLineNum = 170;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((reparto_intmex.keymon.lat.httpjob) args[0]);
return BA.SubDelegator.SubNotFound;
}
}
