package reparto_izca.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_izca.keymon.lat.c_noventa");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", reparto_izca.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_izca.keymon.lat.dbrequestmanager _reqmanager = null;
public anywheresoftware.b4a.objects.CompoundButtonWrapper.CheckBoxWrapper _cb_reprogramar = null;
public int _reprogramar = 0;
public String _pasa_imp = "";
public reparto_izca.keymon.lat.escposprinter _printer1 = null;
public boolean _impresoraconectada = false;
public int _errorimpresora = 0;
public anywheresoftware.b4a.objects.Serial _cmp20 = null;
public anywheresoftware.b4a.objects.Serial.BluetoothAdmin _btadmin = null;
public anywheresoftware.b4a.objects.streams.File.TextWriterWrapper _printer = null;
public b4a.example.dateutils _dateutils = null;
public reparto_izca.keymon.lat.main _main = null;
public reparto_izca.keymon.lat.appupdater _appupdater = null;
public reparto_izca.keymon.lat.foto _foto = null;
public reparto_izca.keymon.lat.mapa_cliente _mapa_cliente = null;
public reparto_izca.keymon.lat.mapa_rutas _mapa_rutas = null;
public reparto_izca.keymon.lat.starter _starter = null;
public reparto_izca.keymon.lat.subs _subs = null;
public reparto_izca.keymon.lat.tracker _tracker = null;
public reparto_izca.keymon.lat.newinst2 _newinst2 = null;
public reparto_izca.keymon.lat.b4xpages _b4xpages = null;
public reparto_izca.keymon.lat.b4xcollections _b4xcollections = null;
public reparto_izca.keymon.lat.httputils2service _httputils2service = null;
public reparto_izca.keymon.lat.xuiviewsutils _xuiviewsutils = null;
public void  _b_imp_click() throws Exception{
ResumableSub_B_IMP_Click rsub = new ResumableSub_B_IMP_Click(this);
rsub.resume(ba, null);
}
public static class ResumableSub_B_IMP_Click extends BA.ResumableSub {
public ResumableSub_B_IMP_Click(reparto_izca.keymon.lat.c_noventa parent) {
this.parent = parent;
}
reparto_izca.keymon.lat.c_noventa parent;
int _cont = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _clientecur = null;
int _resultado = 0;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 144;BA.debugLine="c=Starter.skmt.ExecQuery(\"select USUARIO from usu";
parent._c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select USUARIO from usuarioa")));
 //BA.debugLineNum = 145;BA.debugLine="c.Position=0";
parent._c.setPosition((int) (0));
 //BA.debugLineNum = 146;BA.debugLine="usuario = c.GetString(\"USUARIO\")";
parent._usuario = parent._c.GetString("USUARIO");
 //BA.debugLineNum = 148;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
parent.__c.DateTime.setDateFormat("MM/dd/yyyy");
 //BA.debugLineNum = 149;BA.debugLine="DateTime.TimeFormat=\"HH:mm:ss\"";
parent.__c.DateTime.setTimeFormat("HH:mm:ss");
 //BA.debugLineNum = 150;BA.debugLine="sDate=DateTime.Date(DateTime.Now)";
parent._sdate = parent.__c.DateTime.Date(parent.__c.DateTime.getNow());
 //BA.debugLineNum = 151;BA.debugLine="sTime=DateTime.Time(DateTime.Now)";
parent._stime = parent.__c.DateTime.Time(parent.__c.DateTime.getNow());
 //BA.debugLineNum = 152;BA.debugLine="c.Close";
parent._c.Close();
 //BA.debugLineNum = 158;BA.debugLine="ProgressDialogShow(\"Imprimiendo, un momento ...\")";
parent.__c.ProgressDialogShow(ba,BA.ObjectToCharSequence("Imprimiendo, un momento ..."));
 //BA.debugLineNum = 159;BA.debugLine="Printer1.DisConnect";
parent._printer1._disconnect /*String*/ ();
 //BA.debugLineNum = 160;BA.debugLine="If Not(Printer1.IsConnected) Then";
if (true) break;

case 1:
//if
this.state = 38;
if (parent.__c.Not(parent._printer1._isconnected /*boolean*/ ())) { 
this.state = 3;
}else {
this.state = 21;
}if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 162;BA.debugLine="Printer1.Connect";
parent._printer1._connect /*boolean*/ ();
 //BA.debugLineNum = 163;BA.debugLine="Private cont As Int = 0";
_cont = (int) (0);
 //BA.debugLineNum = 164;BA.debugLine="Do While Not(impresoraConectada)";
if (true) break;

case 4:
//do while
this.state = 19;
while (parent.__c.Not(parent._impresoraconectada)) {
this.state = 6;
if (true) break;
}
if (true) break;

case 6:
//C
this.state = 7;
 //BA.debugLineNum = 165;BA.debugLine="Sleep(1000)";
parent.__c.Sleep(ba,this,(int) (1000));
this.state = 55;
return;
case 55:
//C
this.state = 7;
;
 //BA.debugLineNum = 167;BA.debugLine="cont = cont + 1";
_cont = (int) (_cont+1);
 //BA.debugLineNum = 168;BA.debugLine="If cont = 2 Then Printer1.Connect 'Tratamos de";
if (true) break;

case 7:
//if
this.state = 12;
if (_cont==2) { 
this.state = 9;
;}if (true) break;

case 9:
//C
this.state = 12;
parent._printer1._connect /*boolean*/ ();
if (true) break;

case 12:
//C
this.state = 13;
;
 //BA.debugLineNum = 169;BA.debugLine="If cont > 3 Then impresoraConectada = True";
if (true) break;

case 13:
//if
this.state = 18;
if (_cont>3) { 
this.state = 15;
;}if (true) break;

case 15:
//C
this.state = 18;
parent._impresoraconectada = parent.__c.True;
if (true) break;

case 18:
//C
this.state = 4;
;
 if (true) break;

case 19:
//C
this.state = 38;
;
 //BA.debugLineNum = 171;BA.debugLine="Sleep(500)";
parent.__c.Sleep(ba,this,(int) (500));
this.state = 56;
return;
case 56:
//C
this.state = 38;
;
 //BA.debugLineNum = 172;BA.debugLine="impresoraConectada = False";
parent._impresoraconectada = parent.__c.False;
 if (true) break;

case 21:
//C
this.state = 22;
 //BA.debugLineNum = 175;BA.debugLine="Printer1.Connect";
parent._printer1._connect /*boolean*/ ();
 //BA.debugLineNum = 176;BA.debugLine="Private cont As Int = 0";
_cont = (int) (0);
 //BA.debugLineNum = 177;BA.debugLine="Do While Not(impresoraConectada) Or Not(Printer1";
if (true) break;

case 22:
//do while
this.state = 37;
while (parent.__c.Not(parent._impresoraconectada) || parent.__c.Not(parent._printer1._isconnected /*boolean*/ ())) {
this.state = 24;
if (true) break;
}
if (true) break;

case 24:
//C
this.state = 25;
 //BA.debugLineNum = 178;BA.debugLine="Sleep(1000)";
parent.__c.Sleep(ba,this,(int) (1000));
this.state = 57;
return;
case 57:
//C
this.state = 25;
;
 //BA.debugLineNum = 180;BA.debugLine="cont = cont + 1";
_cont = (int) (_cont+1);
 //BA.debugLineNum = 181;BA.debugLine="If cont = 2 Then Printer1.Connect";
if (true) break;

case 25:
//if
this.state = 30;
if (_cont==2) { 
this.state = 27;
;}if (true) break;

case 27:
//C
this.state = 30;
parent._printer1._connect /*boolean*/ ();
if (true) break;

case 30:
//C
this.state = 31;
;
 //BA.debugLineNum = 182;BA.debugLine="If cont > 3 Then impresoraConectada = True";
if (true) break;

case 31:
//if
this.state = 36;
if (_cont>3) { 
this.state = 33;
;}if (true) break;

case 33:
//C
this.state = 36;
parent._impresoraconectada = parent.__c.True;
if (true) break;

case 36:
//C
this.state = 22;
;
 if (true) break;

case 37:
//C
this.state = 38;
;
 //BA.debugLineNum = 184;BA.debugLine="Sleep(500)";
parent.__c.Sleep(ba,this,(int) (500));
this.state = 58;
return;
case 58:
//C
this.state = 38;
;
 //BA.debugLineNum = 185;BA.debugLine="impresoraConectada = False";
parent._impresoraconectada = parent.__c.False;
 if (true) break;

case 38:
//C
this.state = 39;
;
 //BA.debugLineNum = 189;BA.debugLine="Printer1.WriteString(\"Izca Distribuciones\" &  CRL";
parent._printer1._writestring /*String*/ ("Izca Distribuciones"+parent.__c.CRLF);
 //BA.debugLineNum = 191;BA.debugLine="Printer1.WriteString(\"Vendedor:\" & usuario &  CRL";
parent._printer1._writestring /*String*/ ("Vendedor:"+parent._usuario+parent.__c.CRLF);
 //BA.debugLineNum = 194;BA.debugLine="Dim clientecur As Cursor = Starter.skmt.ExecQuery";
_clientecur = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_clientecur = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT CAT_CL_NOMBRE FROM kmt_info WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 195;BA.debugLine="clientecur.Position = 0";
_clientecur.setPosition((int) (0));
 //BA.debugLineNum = 197;BA.debugLine="Printer1.WriteString(\"ID.Cliente: \" &  Subs.traeC";
parent._printer1._writestring /*String*/ ("ID.Cliente: "+parent._subs._traecliente /*String*/ (ba)+parent.__c.CRLF);
 //BA.debugLineNum = 199;BA.debugLine="Printer1.WriteString(\"Tienda: \" & clientecur.GetS";
parent._printer1._writestring /*String*/ ("Tienda: "+_clientecur.GetString("CAT_CL_NOMBRE")+parent.__c.CRLF);
 //BA.debugLineNum = 201;BA.debugLine="Printer1.WriteString(sDate &\" \"& sTime &  CRLF)";
parent._printer1._writestring /*String*/ (parent._sdate+" "+parent._stime+parent.__c.CRLF);
 //BA.debugLineNum = 202;BA.debugLine="If r_1.Checked Then";
if (true) break;

case 39:
//if
this.state = 48;
if (parent._r_1.getChecked()) { 
this.state = 41;
}else if(parent._r_2.getChecked()) { 
this.state = 43;
}else if(parent._r_3.getChecked()) { 
this.state = 45;
}else {
this.state = 47;
}if (true) break;

case 41:
//C
this.state = 48;
 //BA.debugLineNum = 203;BA.debugLine="motivo = \"CERRADO\"";
parent._motivo = "CERRADO";
 if (true) break;

case 43:
//C
this.state = 48;
 //BA.debugLineNum = 205;BA.debugLine="motivo = \"NO PIDIO\"";
parent._motivo = "NO PIDIO";
 if (true) break;

case 45:
//C
this.state = 48;
 //BA.debugLineNum = 207;BA.debugLine="motivo = \"CANCELA\"";
parent._motivo = "CANCELA";
 if (true) break;

case 47:
//C
this.state = 48;
 //BA.debugLineNum = 209;BA.debugLine="motivo = \"NO ESTA EL ENCARGADO\"";
parent._motivo = "NO ESTA EL ENCARGADO";
 if (true) break;

case 48:
//C
this.state = 49;
;
 //BA.debugLineNum = 211;BA.debugLine="Printer1.WriteString(motivo &  CRLF)";
parent._printer1._writestring /*String*/ (parent._motivo+parent.__c.CRLF);
 //BA.debugLineNum = 215;BA.debugLine="Printer1.WriteString(\" \" &  CRLF)";
parent._printer1._writestring /*String*/ (" "+parent.__c.CRLF);
 //BA.debugLineNum = 216;BA.debugLine="Printer1.WriteString(\"--------INFORMATIVO--------";
parent._printer1._writestring /*String*/ ("--------INFORMATIVO-----------"+parent.__c.CRLF);
 //BA.debugLineNum = 217;BA.debugLine="Printer1.WriteString(\"---------------------------";
parent._printer1._writestring /*String*/ ("------------------------------"+parent.__c.CRLF);
 //BA.debugLineNum = 218;BA.debugLine="Printer1.WriteString(\" \" &  CRLF)";
parent._printer1._writestring /*String*/ (" "+parent.__c.CRLF);
 //BA.debugLineNum = 219;BA.debugLine="Printer1.WriteString(\" \" &  CRLF)";
parent._printer1._writestring /*String*/ (" "+parent.__c.CRLF);
 //BA.debugLineNum = 220;BA.debugLine="Printer1.WriteString(\" \" &  CRLF)";
parent._printer1._writestring /*String*/ (" "+parent.__c.CRLF);
 //BA.debugLineNum = 221;BA.debugLine="Sleep(1000)";
parent.__c.Sleep(ba,this,(int) (1000));
this.state = 59;
return;
case 59:
//C
this.state = 49;
;
 //BA.debugLineNum = 222;BA.debugLine="Printer1.DisConnect";
parent._printer1._disconnect /*String*/ ();
 //BA.debugLineNum = 224;BA.debugLine="ProgressDialogHide";
parent.__c.ProgressDialogHide();
 //BA.debugLineNum = 226;BA.debugLine="Msgbox2Async(\"Deseas imprimir de nuevo el ticket?";
parent.__c.Msgbox2Async(BA.ObjectToCharSequence("Deseas imprimir de nuevo el ticket?"),BA.ObjectToCharSequence("ATENCION"),"SI","","NO",parent.__c.LoadBitmap(parent.__c.File.getDirAssets(),"alert2.png"),ba,parent.__c.False);
 //BA.debugLineNum = 227;BA.debugLine="Wait For Msgbox_Result (resultado As Int)";
parent.__c.WaitFor("msgbox_result", ba, this, null);
this.state = 60;
return;
case 60:
//C
this.state = 49;
_resultado = (Integer) result[0];
;
 //BA.debugLineNum = 228;BA.debugLine="If resultado = DialogResponse.POSITIVE Then";
if (true) break;

case 49:
//if
this.state = 54;
if (_resultado==parent.__c.DialogResponse.POSITIVE) { 
this.state = 51;
}else {
this.state = 53;
}if (true) break;

case 51:
//C
this.state = 54;
 //BA.debugLineNum = 229;BA.debugLine="B_IMP_Click";
parent._b_imp_click();
 if (true) break;

case 53:
//C
this.state = 54;
 //BA.debugLineNum = 231;BA.debugLine="Guardado";
parent._guardado();
 if (true) break;

case 54:
//C
this.state = -1;
;
 //BA.debugLineNum = 233;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public void  _msgbox_result(int _resultado) throws Exception{
}
public String  _b4xpage_appear() throws Exception{
 //BA.debugLineNum = 47;BA.debugLine="Sub B4XPage_Appear";
 //BA.debugLineNum = 48;BA.debugLine="Printer1.Initialize(Me, \"Printer1\")";
_printer1._initialize /*String*/ (ba,this,"Printer1");
 //BA.debugLineNum = 50;BA.debugLine="If Printer1.IsConnected = False Then";
if (_printer1._isconnected /*boolean*/ ()==__c.False) { 
 }else {
 //BA.debugLineNum = 54;BA.debugLine="Printer1.DisConnect";
_printer1._disconnect /*String*/ ();
 //BA.debugLineNum = 55;BA.debugLine="Printer1.Connect";
_printer1._connect /*boolean*/ ();
 //BA.debugLineNum = 56;BA.debugLine="Log(\"2\")";
__c.LogImpl("150921481","2",0);
 };
 //BA.debugLineNum = 58;BA.debugLine="btAdmin.Initialize(\"BlueTeeth\")";
_btadmin.Initialize(ba,"BlueTeeth");
 //BA.debugLineNum = 59;BA.debugLine="cmp20.Initialize(\"Printer\")";
_cmp20.Initialize("Printer");
 //BA.debugLineNum = 61;BA.debugLine="reqManager.Initialize(Me, B4XPages.MainPage.SERVE";
_reqmanager._initialize /*String*/ (ba,this,_b4xpages._mainpage /*reparto_izca.keymon.lat.b4xmainpage*/ (ba)._server /*String*/ );
 //BA.debugLineNum = 62;BA.debugLine="e_comm.Text=\"\"";
_e_comm.setText(BA.ObjectToCharSequence(""));
 //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="cb_reprogramar.Checked = False";
_cb_reprogramar.setChecked(__c.False);
 //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(\"no_venta\")";
_root.LoadLayout("no_venta",ba);
 //BA.debugLineNum = 42;BA.debugLine="reqManager.Initialize(Me, B4XPages.MainPage.SERVE";
_reqmanager._initialize /*String*/ (ba,this,_b4xpages._mainpage /*reparto_izca.keymon.lat.b4xmainpage*/ (ba)._server /*String*/ );
 //BA.debugLineNum = 43;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  _cb_reprogramar_checkedchange(boolean _checked) throws Exception{
 //BA.debugLineNum = 134;BA.debugLine="Private Sub cb_reprogramar_CheckedChange(Checked A";
 //BA.debugLineNum = 135;BA.debugLine="If Checked Then";
if (_checked) { 
 //BA.debugLineNum = 136;BA.debugLine="reprogramar = 1";
_reprogramar = (int) (1);
 }else {
 //BA.debugLineNum = 138;BA.debugLine="reprogramar = 0";
_reprogramar = (int) (0);
 };
 //BA.debugLineNum = 140;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_izca.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="Dim PASA_IMP As String";
_pasa_imp = "";
 //BA.debugLineNum = 24;BA.debugLine="Dim Printer1 As EscPosPrinter";
_printer1 = new reparto_izca.keymon.lat.escposprinter();
 //BA.debugLineNum = 25;BA.debugLine="Dim impresoraConectada As Boolean = False";
_impresoraconectada = __c.False;
 //BA.debugLineNum = 26;BA.debugLine="Dim errorImpresora As Int = 0";
_errorimpresora = (int) (0);
 //BA.debugLineNum = 27;BA.debugLine="Dim cmp20 As Serial";
_cmp20 = new anywheresoftware.b4a.objects.Serial();
 //BA.debugLineNum = 28;BA.debugLine="Dim btAdmin As BluetoothAdmin";
_btadmin = new anywheresoftware.b4a.objects.Serial.BluetoothAdmin();
 //BA.debugLineNum = 29;BA.debugLine="Dim printer As TextWriter";
_printer = new anywheresoftware.b4a.objects.streams.File.TextWriterWrapper();
 //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{
 //BA.debugLineNum = 79;BA.debugLine="Sub GUARDA_Click";
 //BA.debugLineNum = 80;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 = 81;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 = 83;BA.debugLine="B_IMP_Click";
_b_imp_click();
 };
 //BA.debugLineNum = 86;BA.debugLine="End Sub";
return "";
}
public String  _guardado() 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 = 235;BA.debugLine="Sub Guardado";
 //BA.debugLineNum = 237;BA.debugLine="If r_1.Checked Then";
if (_r_1.getChecked()) { 
 //BA.debugLineNum = 238;BA.debugLine="motivo = \"CERRADO\"";
_motivo = "CERRADO";
 }else if(_r_2.getChecked()) { 
 //BA.debugLineNum = 240;BA.debugLine="motivo = \"NO PIDIO\"";
_motivo = "NO PIDIO";
 }else if(_r_3.getChecked()) { 
 //BA.debugLineNum = 242;BA.debugLine="motivo = \"CANCELA\"";
_motivo = "CANCELA";
 }else {
 //BA.debugLineNum = 244;BA.debugLine="motivo = \"NO ESTA EL ENCARGADO\"";
_motivo = "NO ESTA EL ENCARGADO";
 };
 //BA.debugLineNum = 247;BA.debugLine="If motivo <> \"CERRADO\"  Or motivo = \"CERRADO\" The";
if ((_motivo).equals("CERRADO") == false || (_motivo).equals("CERRADO")) { 
 //BA.debugLineNum = 248;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
__c.DateTime.setDateFormat("MM/dd/yyyy");
 //BA.debugLineNum = 249;BA.debugLine="DateTime.TimeFormat=\"HHmmss\"";
__c.DateTime.setTimeFormat("HHmmss");
 //BA.debugLineNum = 250;BA.debugLine="sDate=DateTime.Date(DateTime.Now)";
_sdate = __c.DateTime.Date(__c.DateTime.getNow());
 //BA.debugLineNum = 251;BA.debugLine="sTime=DateTime.Time(DateTime.Now)";
_stime = __c.DateTime.Time(__c.DateTime.getNow());
 //BA.debugLineNum = 252;BA.debugLine="c=Starter.skmt.ExecQuery(\"select CUENTA from cue";
_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 = 253;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 254;BA.debugLine="cuenta = c.GetString(\"CUENTA\")";
_cuenta = _c.GetString("CUENTA");
 //BA.debugLineNum = 255;BA.debugLine="c=Starter.skmt.ExecQuery(\"select usuario from us";
_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 = 256;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 257;BA.debugLine="usuario = c.GetString(\"USUARIO\")";
_usuario = _c.GetString("USUARIO");
 //BA.debugLineNum = 258;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 259;BA.debugLine="Dim rutaactualizar As String";
_rutaactualizar = "";
 //BA.debugLineNum = 260;BA.debugLine="Dim rut As Cursor = Starter.skmt.ExecQuery(\"SELE";
_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 = 261;BA.debugLine="If rut.RowCount > 0 Then";
if (_rut.getRowCount()>0) { 
 //BA.debugLineNum = 262;BA.debugLine="rut.Position = 0";
_rut.setPosition((int) (0));
 //BA.debugLineNum = 263;BA.debugLine="rutaactualizar = rut.GetString(\"CAT_CL_RUTA\")";
_rutaactualizar = _rut.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 265;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 = 267;BA.debugLine="c=Starter.skmt.ExecQuery(\"select HVD_NUM_REGISTR";
_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 = 268;BA.debugLine="If c.RowCount > 0 Then 'Si  hay pedido en HIST_V";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 271;BA.debugLine="Private esteCliente As String = Subs.traeClient";
_estecliente = _subs._traecliente /*String*/ (ba);
 //BA.debugLineNum = 272;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 = 273;BA.debugLine="If rv.RowCount > 0 Then 'Si tenemos venta en el";
if (_rv.getRowCount()>0) { 
 //BA.debugLineNum = 274;BA.debugLine="For i2=0 To rv.RowCount - 1";
{
final int step34 = 1;
final int limit34 = (int) (_rv.getRowCount()-1);
_i2 = (int) (0) ;
for (;_i2 <= limit34 ;_i2 = _i2 + step34 ) {
 //BA.debugLineNum = 275;BA.debugLine="rv.Position = i2";
_rv.setPosition(_i2);
 //BA.debugLineNum = 276;BA.debugLine="Log($\"Actualizamos REPARTO - cliente=${rv.Get";
__c.LogImpl("151445801",("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 = 277;BA.debugLine="Starter.skmt.ExecNonQuery($\"update REPARTO se";
_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 = 281;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 = 282;BA.debugLine="For i=0 To c.RowCount - 1 'Insertamos los produ";
{
final int step41 = 1;
final int limit41 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit41 ;_i = _i + step41 ) {
 //BA.debugLineNum = 283;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 284;BA.debugLine="Log($\"REGISTRO= ${c.GetString(\"HVD_NUM_REGISTR";
__c.LogImpl("151445809",("REGISTRO= "+__c.SmartStringFormatter("",(Object)(_c.GetString("HVD_NUM_REGISTRO")))+""),0);
 //BA.debugLineNum = 285;BA.debugLine="Starter.skmt.ExecNonQuery2(\"insert into repart";
_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 = 286;BA.debugLine="Starter.skmt.ExecNonQuery2(\"insert into repart";
_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 = 287;BA.debugLine="Starter.skmt.ExecNonQuery2(\"update cat_gunapro";
_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 = 291;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_izca.keymon.lat.b4xmainpage*/ (ba)._lat_gps /*String*/ ),(Object)(_b4xpages._mainpage /*reparto_izca.keymon.lat.b4xmainpage*/ (ba)._lon_gps /*String*/ ),(Object)(_rutaactualizar),(Object)(_reprogramar)}));
 //BA.debugLineNum = 292;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 = 293;BA.debugLine="Starter.skmt.ExecNonQuery(\"update HIST_VENTAS SE";
_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 = 294;BA.debugLine="Starter.skmt.ExecNonQuery($\"update HIST_VENTAS s";
_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 = 295;BA.debugLine="Starter.skmt.ExecNonQuery(\"DELETE FROM PEDIDO WH";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("DELETE FROM PEDIDO WHERE PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA)");
 //BA.debugLineNum = 296;BA.debugLine="d = Starter.skmt.ExecQuery(\"SELECT RUTAA FROM RU";
_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 = 297;BA.debugLine="d.Position = 0";
_d.setPosition((int) (0));
 //BA.debugLineNum = 298;BA.debugLine="Dim ruta As String = d.GetString(\"RUTAA\")";
_ruta = _d.GetString("RUTAA");
 //BA.debugLineNum = 299;BA.debugLine="d.Close";
_d.Close();
 //BA.debugLineNum = 300;BA.debugLine="d = Starter.skmt.ExecQuery(\"SELECT CAT_CL_RUTA F";
_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 = 301;BA.debugLine="d.Position = 0";
_d.setPosition((int) (0));
 //BA.debugLineNum = 302;BA.debugLine="Dim rutapre As String = d.GetString(\"CAT_CL_RUTA";
_rutapre = _d.GetString("CAT_CL_RUTA");
 //BA.debugLineNum = 303;BA.debugLine="d.Close";
_d.Close();
 //BA.debugLineNum = 304;BA.debugLine="d = Starter.skmt.ExecQuery(\"SELECT HVD_FECHA FRO";
_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 = 305;BA.debugLine="d.Position = 0";
_d.setPosition((int) (0));
 //BA.debugLineNum = 306;BA.debugLine="Dim fechaprev As String = d.GetString(\"HVD_FECHA";
_fechaprev = _d.GetString("HVD_FECHA");
 //BA.debugLineNum = 307;BA.debugLine="d.Close";
_d.Close();
 //BA.debugLineNum = 308;BA.debugLine="d = Starter.skmt.ExecQuery(\"SELECT CUENTA FROM C";
_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 = 309;BA.debugLine="d.Position = 0";
_d.setPosition((int) (0));
 //BA.debugLineNum = 310;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_izca.keymon.lat.b4xmainpage*/ (ba)._lat_gps /*String*/ ,_b4xpages._mainpage /*reparto_izca.keymon.lat.b4xmainpage*/ (ba)._lon_gps /*String*/ ,_b4xpages._mainpage /*reparto_izca.keymon.lat.b4xmainpage*/ (ba)._almacen /*String*/ ,_ruta,_rutapre,_fechaprev,_motivo,_e_comm.getText(),"NO ENTREGADO"}));
 //BA.debugLineNum = 317;BA.debugLine="B4XPages.ShowPage(\"Principal\")";
_b4xpages._showpage /*String*/ (ba,"Principal");
 }else {
 //BA.debugLineNum = 320;BA.debugLine="COMENTARIO = e_comm.Text";
_comentario = _e_comm.getText();
 };
 //BA.debugLineNum = 325;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(reparto_izca.keymon.lat.httpjob _job) throws Exception{
reparto_izca.keymon.lat.dbrequestmanager._dbresult _resultado = null;
String _cliente = "";
Object[] _records = null;
String _k = "";
 //BA.debugLineNum = 109;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 110;BA.debugLine="Log(Job.Success)";
__c.LogImpl("151249153",BA.ObjectToString(_job._success /*boolean*/ ),0);
 //BA.debugLineNum = 111;BA.debugLine="If Job.Success = False Then";
if (_job._success /*boolean*/ ==__c.False) { 
 }else {
 //BA.debugLineNum = 114;BA.debugLine="LogColor(\"JobDone: '\" & reqManager.HandleJob(Job";
__c.LogImpl("151249157","JobDone: '"+BA.ObjectToString(_reqmanager._handlejob /*reparto_izca.keymon.lat.dbrequestmanager._dbresult*/ (_job).Tag /*Object*/ )+"' - Registros: "+BA.NumberToString(_reqmanager._handlejob /*reparto_izca.keymon.lat.dbrequestmanager._dbresult*/ (_job).Rows /*anywheresoftware.b4a.objects.collections.List*/ .getSize()),__c.Colors.Green);
 //BA.debugLineNum = 115;BA.debugLine="If Job.JobName = \"DBRequest\" Then";
if ((_job._jobname /*String*/ ).equals("DBRequest")) { 
 //BA.debugLineNum = 116;BA.debugLine="Dim resultado As DBResult = reqManager.HandleJo";
_resultado = _reqmanager._handlejob /*reparto_izca.keymon.lat.dbrequestmanager._dbresult*/ (_job);
 //BA.debugLineNum = 117;BA.debugLine="If resultado.Tag.As(String).IndexOf(\"ins_REPART";
if ((BA.ObjectToString(_resultado.Tag /*Object*/ )).indexOf("ins_REPARTOPendientes_head_")>-1) { 
 //BA.debugLineNum = 118;BA.debugLine="Private cliente As String= resultado.Tag";
_cliente = BA.ObjectToString(_resultado.Tag /*Object*/ );
 //BA.debugLineNum = 119;BA.debugLine="cliente = cliente.SubString(cliente.IndexOf(\"_";
_cliente = _cliente.substring((int) (_cliente.indexOf("_")+24));
 //BA.debugLineNum = 120;BA.debugLine="Log($\"Cliente1:${cliente}\"$)";
__c.LogImpl("151249163",("Cliente1:"+__c.SmartStringFormatter("",(Object)(_cliente))+""),0);
 //BA.debugLineNum = 121;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 = 122;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 = 123;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 = 124;BA.debugLine="Log(resultado.Tag & \": \" & k & \": \" & record";
__c.LogImpl("151249167",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 = 129;BA.debugLine="Job.Release";
_job._release /*String*/ ();
 };
 //BA.debugLineNum = 132;BA.debugLine="End Sub";
return "";
}
public String  _mandapendientesreparto() throws Exception{
 //BA.debugLineNum = 89;BA.debugLine="Sub mandaPendientesreparto";
 //BA.debugLineNum = 105;BA.debugLine="End Sub";
return "";
}
public String  _printer_connected(boolean _success) throws Exception{
 //BA.debugLineNum = 352;BA.debugLine="Sub Printer_Connected (Success As Boolean)";
 //BA.debugLineNum = 353;BA.debugLine="If Success Then";
if (_success) { 
 //BA.debugLineNum = 355;BA.debugLine="PASA_IMP = \"1\"";
_pasa_imp = "1";
 }else {
 //BA.debugLineNum = 358;BA.debugLine="If Msgbox2(\"\", \"Printer Error\",\"Reprint\",\"Cancel";
if (__c.Msgbox2(BA.ObjectToCharSequence(""),BA.ObjectToCharSequence("Printer Error"),"Reprint","Cancel","",(android.graphics.Bitmap)(__c.Null),ba)==__c.DialogResponse.POSITIVE) { 
 //BA.debugLineNum = 359;BA.debugLine="StartPrinter";
_startprinter();
 };
 };
 //BA.debugLineNum = 362;BA.debugLine="End Sub";
return "";
}
public String  _printer1_connected(boolean _success) throws Exception{
 //BA.debugLineNum = 327;BA.debugLine="Sub Printer1_Connected (Success As Boolean)";
 //BA.debugLineNum = 329;BA.debugLine="If Success Then";
if (_success) { 
 //BA.debugLineNum = 330;BA.debugLine="ToastMessageShow(\"Impresora conectada\", False)";
__c.ToastMessageShow(BA.ObjectToCharSequence("Impresora conectada"),__c.False);
 //BA.debugLineNum = 331;BA.debugLine="Starter.skmt.ExecNonQuery2(\"delete from CAT_VARI";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)("MACIMP")}));
 //BA.debugLineNum = 332;BA.debugLine="Starter.skmt.ExecNonQuery2(\"INSERT INTO CAT_VARI";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)("MACIMP"),(Object)(_starter._mac_impresora /*String*/ )}));
 //BA.debugLineNum = 335;BA.debugLine="impresoraConectada = True";
_impresoraconectada = __c.True;
 }else {
 //BA.debugLineNum = 339;BA.debugLine="LogColor(\"Error conectando la impresora\", Colors";
__c.LogImpl("151511308","Error conectando la impresora",__c.Colors.Red);
 //BA.debugLineNum = 340;BA.debugLine="errorImpresora = errorImpresora + 1";
_errorimpresora = (int) (_errorimpresora+1);
 //BA.debugLineNum = 341;BA.debugLine="If errorImpresora > 1 Then";
if (_errorimpresora>1) { 
 //BA.debugLineNum = 342;BA.debugLine="Starter.MAC_IMPRESORA = \"0\"";
_starter._mac_impresora /*String*/  = "0";
 //BA.debugLineNum = 343;BA.debugLine="errorImpresora = 0";
_errorimpresora = (int) (0);
 };
 };
 //BA.debugLineNum = 346;BA.debugLine="End Sub";
return "";
}
public String  _printer1_error() throws Exception{
 //BA.debugLineNum = 348;BA.debugLine="Sub Printer1_Error";
 //BA.debugLineNum = 349;BA.debugLine="Log(\"error printer\")";
__c.LogImpl("151576833","error printer",0);
 //BA.debugLineNum = 350;BA.debugLine="End Sub";
return "";
}
public String  _startprinter() throws Exception{
anywheresoftware.b4a.objects.collections.Map _paireddevices = null;
anywheresoftware.b4a.objects.collections.List _l1 = null;
int _resimp = 0;
int _i = 0;
 //BA.debugLineNum = 364;BA.debugLine="Sub StartPrinter";
 //BA.debugLineNum = 365;BA.debugLine="Dim PairedDevices As Map";
_paireddevices = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 366;BA.debugLine="Dim L1 As List";
_l1 = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 367;BA.debugLine="Dim resimp As Int";
_resimp = 0;
 //BA.debugLineNum = 368;BA.debugLine="ToastMessageShow(\"Printing.....\",True)";
__c.ToastMessageShow(BA.ObjectToCharSequence("Printing....."),__c.True);
 //BA.debugLineNum = 369;BA.debugLine="PairedDevices.Initialize";
_paireddevices.Initialize();
 //BA.debugLineNum = 370;BA.debugLine="Try";
try { //BA.debugLineNum = 371;BA.debugLine="PairedDevices = cmp20.GetPairedDevices";
_paireddevices = _cmp20.GetPairedDevices();
 } 
       catch (Exception e9) {
			ba.setLastException(e9); //BA.debugLineNum = 373;BA.debugLine="Msgbox(\"Getting Paired Devices\",\"Printer Error\")";
__c.Msgbox(BA.ObjectToCharSequence("Getting Paired Devices"),BA.ObjectToCharSequence("Printer Error"),ba);
 //BA.debugLineNum = 374;BA.debugLine="printer.Close";
_printer.Close();
 //BA.debugLineNum = 375;BA.debugLine="cmp20.Disconnect";
_cmp20.Disconnect();
 };
 //BA.debugLineNum = 378;BA.debugLine="If PairedDevices.Size = 0 Then";
if (_paireddevices.getSize()==0) { 
 //BA.debugLineNum = 379;BA.debugLine="Msgbox(\"Error Connecting to Printer - Printer No";
__c.Msgbox(BA.ObjectToCharSequence("Error Connecting to Printer - Printer Not Found"),BA.ObjectToCharSequence(""),ba);
 //BA.debugLineNum = 380;BA.debugLine="Return";
if (true) return "";
 };
 //BA.debugLineNum = 383;BA.debugLine="If PairedDevices.Size = 1 Then";
if (_paireddevices.getSize()==1) { 
 //BA.debugLineNum = 384;BA.debugLine="Try";
try { //BA.debugLineNum = 385;BA.debugLine="cmp20.Connect(PairedDevices.Get(PairedDevices.G";
_cmp20.Connect(ba,BA.ObjectToString(_paireddevices.Get(_paireddevices.GetKeyAt((int) (0)))));
 } 
       catch (Exception e21) {
			ba.setLastException(e21); //BA.debugLineNum = 387;BA.debugLine="Msgbox(\"Connecting\",\"Printer Error\") 'ignore";
__c.Msgbox(BA.ObjectToCharSequence("Connecting"),BA.ObjectToCharSequence("Printer Error"),ba);
 //BA.debugLineNum = 388;BA.debugLine="printer.Close";
_printer.Close();
 //BA.debugLineNum = 389;BA.debugLine="cmp20.Disconnect";
_cmp20.Disconnect();
 };
 }else {
 //BA.debugLineNum = 392;BA.debugLine="L1.Initialize";
_l1.Initialize();
 //BA.debugLineNum = 393;BA.debugLine="For i = 0 To PairedDevices.Size - 1";
{
final int step27 = 1;
final int limit27 = (int) (_paireddevices.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit27 ;_i = _i + step27 ) {
 //BA.debugLineNum = 394;BA.debugLine="L1.Add(PairedDevices.GetKeyAt(i))";
_l1.Add(_paireddevices.GetKeyAt(_i));
 }
};
 //BA.debugLineNum = 396;BA.debugLine="resimp = InputList(L1, \"Choose device\", -1) 'ign";
_resimp = __c.InputList(_l1,BA.ObjectToCharSequence("Choose device"),(int) (-1),ba);
 //BA.debugLineNum = 397;BA.debugLine="If resimp <> DialogResponse.CANCEL Then";
if (_resimp!=__c.DialogResponse.CANCEL) { 
 //BA.debugLineNum = 398;BA.debugLine="cmp20.Connect(PairedDevices.Get(L1.Get(resimp))";
_cmp20.Connect(ba,BA.ObjectToString(_paireddevices.Get(_l1.Get(_resimp))));
 };
 };
 //BA.debugLineNum = 401;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_izca.keymon.lat.httpjob) args[0]);
return BA.SubDelegator.SubNotFound;
}
}
