package reparto_mazapa.keymon.lat;


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

public class subs {
private static subs mostCurrent = new subs();
public static Object getObject() {
    throw new RuntimeException("Code module does not support this method.");
}
 public anywheresoftware.b4a.keywords.Common __c = null;
public static de.donmanfred.GZipStringswrapper _gzip = null;
public static anywheresoftware.b4a.objects.StringUtils _su = null;
public static anywheresoftware.b4a.phone.Phone _phn = null;
public static String _devmodel = "";
public static anywheresoftware.b4a.sql.SQL _kmt = null;
public static anywheresoftware.b4a.sql.SQL _errorlog = null;
public static String _ssid = "";
public static int _rutamaxpoints = 0;
public static int _rutahrsatras = 0;
public b4a.example.dateutils _dateutils = null;
public reparto_mazapa.keymon.lat.main _main = null;
public reparto_mazapa.keymon.lat.appupdater _appupdater = null;
public reparto_mazapa.keymon.lat.tracker _tracker = null;
public reparto_mazapa.keymon.lat.starter _starter = null;
public reparto_mazapa.keymon.lat.firebasemessaging _firebasemessaging = null;
public reparto_mazapa.keymon.lat.foto _foto = null;
public reparto_mazapa.keymon.lat.mapa_cliente _mapa_cliente = null;
public reparto_mazapa.keymon.lat.mapa_rutas _mapa_rutas = null;
public reparto_mazapa.keymon.lat.newinst2 _newinst2 = null;
public reparto_mazapa.keymon.lat.b4xpages _b4xpages = null;
public reparto_mazapa.keymon.lat.b4xcollections _b4xcollections = null;
public reparto_mazapa.keymon.lat.httputils2service _httputils2service = null;
public reparto_mazapa.keymon.lat.xuiviewsutils _xuiviewsutils = null;
public static String  _agregacolumna(anywheresoftware.b4a.BA _ba,String _tabla,String _columna,String _tipo) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 924;BA.debugLine="Sub agregaColumna(tabla As String, columna As Stri";
 //BA.debugLineNum = 925;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try { //BA.debugLineNum = 926;BA.debugLine="Private c As Cursor = Starter.skmt.ExecQuery($\"S";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("SELECT COUNT(*) AS fCol FROM pragma_table_info('"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+"') WHERE name='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+"'"))));
 //BA.debugLineNum = 927;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 928;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 929;BA.debugLine="Starter.skmt.ExecNonQuery($\"ALTER TABLE ${tabla";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("ALTER TABLE "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 930;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("314286854",("Columna \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+"\"."),0);
 };
 } 
       catch (Exception e9) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e9); //BA.debugLineNum = 933;BA.debugLine="Try";
try { //BA.debugLineNum = 934;BA.debugLine="Starter.skmt.ExecNonQuery($\"ALTER TABLE ${tabla";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("ALTER TABLE "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 935;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("314286859",("Columna \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+"\".."),0);
 } 
       catch (Exception e13) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e13); //BA.debugLineNum = 937;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("314286861",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 };
 //BA.debugLineNum = 940;BA.debugLine="End Sub";
return "";
}
public static String  _borraarribade100errores(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 414;BA.debugLine="Sub borraArribaDe100Errores 'ignore";
 //BA.debugLineNum = 415;BA.debugLine="If Not(errorLog.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_errorlog.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 416;BA.debugLine="LogColor(\"Recortamos la tabla de Errores, limite";
anywheresoftware.b4a.keywords.Common.LogImpl("312189698","Recortamos la tabla de Errores, limite de 100",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 417;BA.debugLine="errorLog.ExecNonQuery(\"DELETE FROM errores WHERE";
_errorlog.ExecNonQuery("DELETE FROM errores WHERE fecha NOT in (SELECT fecha FROM errores ORDER BY fecha desc LIMIT 99 )");
 //BA.debugLineNum = 418;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 420;BA.debugLine="End Sub";
return "";
}
public static String  _borraarribade600renglonesbitacora(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 423;BA.debugLine="Sub borraArribaDe600RenglonesBitacora 'ignore";
 //BA.debugLineNum = 424;BA.debugLine="revisaBD";
_revisabd(_ba);
 //BA.debugLineNum = 425;BA.debugLine="LogColor(\"Recortamos la tabla de la Bitacora, lim";
anywheresoftware.b4a.keywords.Common.LogImpl("312255234","Recortamos la tabla de la Bitacora, limite de 600",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 426;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 427;BA.debugLine="c = kmt.ExecQuery(\"select fecha from bitacora\")";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery("select fecha from bitacora")));
 //BA.debugLineNum = 428;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 429;BA.debugLine="If c.RowCount > 650 Then";
if (_c.getRowCount()>650) { 
 //BA.debugLineNum = 430;BA.debugLine="kmt.ExecNonQuery(\"DELETE FROM bitacora WHERE fec";
_kmt.ExecNonQuery("DELETE FROM bitacora WHERE fecha NOT in (SELECT fecha FROM bitacora ORDER BY fecha desc LIMIT 599 )");
 //BA.debugLineNum = 431;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 };
 //BA.debugLineNum = 434;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 435;BA.debugLine="End Sub";
return "";
}
public static String  _borralogdb(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 302;BA.debugLine="Sub borraLogDB 'ignore";
 //BA.debugLineNum = 303;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("311862017","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 304;BA.debugLine="kmt.ExecNonQuery(\"delete from bitacora\")";
_kmt.ExecNonQuery("delete from bitacora");
 //BA.debugLineNum = 305;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 306;BA.debugLine="End Sub";
return "";
}
public static String  _borramosarchivogps(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
String _s = "";
byte[] _t = null;
 //BA.debugLineNum = 186;BA.debugLine="Sub borramosArchivoGPS 'ignore";
 //BA.debugLineNum = 187;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 188;BA.debugLine="Dim s As String = \"\"";
_s = "";
 //BA.debugLineNum = 189;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
 //BA.debugLineNum = 190;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
 //BA.debugLineNum = 191;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 192;BA.debugLine="End Sub";
return "";
}
public static String  _centraboton(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ButtonWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 592;BA.debugLine="Sub centraBoton(elemento As Button, anchoElementoS";
 //BA.debugLineNum = 593;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (anywheresoftware.b4a.keywords.Common.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
 //BA.debugLineNum = 594;BA.debugLine="End Sub";
return "";
}
public static String  _centraetiqueta(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.LabelWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 587;BA.debugLine="Sub centraEtiqueta(elemento As Label, anchoElement";
 //BA.debugLineNum = 588;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (anywheresoftware.b4a.keywords.Common.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
 //BA.debugLineNum = 589;BA.debugLine="End Sub";
return "";
}
public static String  _centralistview(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ListViewWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 577;BA.debugLine="Sub centraListView(elemento As ListView, anchoElem";
 //BA.debugLineNum = 578;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (anywheresoftware.b4a.keywords.Common.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
 //BA.debugLineNum = 579;BA.debugLine="End Sub";
return "";
}
public static String  _centrapanel(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 582;BA.debugLine="Sub centraPanel(elemento As Panel, anchoElementoSu";
 //BA.debugLineNum = 583;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (anywheresoftware.b4a.keywords.Common.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
 //BA.debugLineNum = 584;BA.debugLine="End Sub";
return "";
}
public static String  _compress(anywheresoftware.b4a.BA _ba,String _str) throws Exception{
byte[] _compressed = null;
String _base64 = "";
 //BA.debugLineNum = 39;BA.debugLine="Sub compress(str As String) As String 'ignore";
 //BA.debugLineNum = 41;BA.debugLine="Dim compressed() As Byte = GZip.compress(str)";
_compressed = _gzip.compress(_str);
 //BA.debugLineNum = 44;BA.debugLine="Dim base64 As String = su.EncodeBase64(compressed";
_base64 = _su.EncodeBase64(_compressed);
 //BA.debugLineNum = 45;BA.debugLine="Log($\"Comprimido: ${base64.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("310485766",("Comprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_base64.length()))+""),0);
 //BA.debugLineNum = 47;BA.debugLine="Return base64";
if (true) return _base64;
 //BA.debugLineNum = 48;BA.debugLine="End Sub";
return "";
}
public static String  _copiadb(anywheresoftware.b4a.BA _ba,boolean _result) throws Exception{
String _p = "";
String _thedir = "";
 //BA.debugLineNum = 511;BA.debugLine="Sub copiaDB(result As Boolean) 'ignore";
 //BA.debugLineNum = 512;BA.debugLine="If result Then";
if (_result) { 
 //BA.debugLineNum = 513;BA.debugLine="Dim p As String";
_p = "";
 //BA.debugLineNum = 514;BA.debugLine="If File.ExternalWritable Then";
if (anywheresoftware.b4a.keywords.Common.File.getExternalWritable()) { 
 //BA.debugLineNum = 515;BA.debugLine="p = File.DirInternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 }else {
 //BA.debugLineNum = 518;BA.debugLine="p = File.DirInternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 };
 //BA.debugLineNum = 521;BA.debugLine="Dim theDir As String";
_thedir = "";
 //BA.debugLineNum = 522;BA.debugLine="Try";
try { //BA.debugLineNum = 523;BA.debugLine="File.MakeDir(File.DirInternal,\"kmts\")";
anywheresoftware.b4a.keywords.Common.File.MakeDir(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmts");
 //BA.debugLineNum = 524;BA.debugLine="theDir = \"/kmts\"";
_thedir = "/kmts";
 } 
       catch (Exception e13) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e13); //BA.debugLineNum = 526;BA.debugLine="theDir = \"\"";
_thedir = "";
 };
 //BA.debugLineNum = 528;BA.debugLine="Try";
try { //BA.debugLineNum = 529;BA.debugLine="File.Copy(File.DirInternal,\"kmt.db\",File.DirInt";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db",anywheresoftware.b4a.keywords.Common.File.getDirInternal()+_thedir,"guna_rep_kmt.db");
 //BA.debugLineNum = 530;BA.debugLine="ToastMessageShow(\"BD copiada!\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("BD copiada!"),anywheresoftware.b4a.keywords.Common.False);
 } 
       catch (Exception e19) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e19); //BA.debugLineNum = 532;BA.debugLine="ToastMessageShow(\"No se pudo hacer la copia: \"&";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("No se pudo hacer la copia: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba))),anywheresoftware.b4a.keywords.Common.True);
 };
 //BA.debugLineNum = 534;BA.debugLine="Log(\"rootExternal=\"&p)";
anywheresoftware.b4a.keywords.Common.LogImpl("312582935","rootExternal="+_p,0);
 //BA.debugLineNum = 535;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
anywheresoftware.b4a.keywords.Common.LogImpl("312582936","File.DirInternal="+anywheresoftware.b4a.keywords.Common.File.getDirInternal(),0);
 //BA.debugLineNum = 536;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
anywheresoftware.b4a.keywords.Common.LogImpl("312582937","File.DirInternal="+anywheresoftware.b4a.keywords.Common.File.getDirInternal(),0);
 }else {
 //BA.debugLineNum = 538;BA.debugLine="ToastMessageShow(\"Sin permisos\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Sin permisos"),anywheresoftware.b4a.keywords.Common.False);
 };
 //BA.debugLineNum = 540;BA.debugLine="End Sub";
return "";
}
public static String  _dameerroresjson(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.sql.SQL _sql,int _maxerrores,boolean _comprimido) throws Exception{
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _j = null;
String _lim = "";
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _cur = null;
anywheresoftware.b4a.objects.collections.List _l = null;
int _i = 0;
anywheresoftware.b4a.objects.collections.Map _m = null;
anywheresoftware.b4a.objects.collections.Map _m2 = null;
 //BA.debugLineNum = 448;BA.debugLine="Sub dameErroresJSON(SQL As SQL, maxErrores As Int,";
 //BA.debugLineNum = 449;BA.debugLine="Log(\"dameErroresJSON\")";
anywheresoftware.b4a.keywords.Common.LogImpl("312386305","dameErroresJSON",0);
 //BA.debugLineNum = 450;BA.debugLine="Private j As JSONGenerator";
_j = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 451;BA.debugLine="Private lim As String";
_lim = "";
 //BA.debugLineNum = 452;BA.debugLine="Private cur As ResultSet";
_cur = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
 //BA.debugLineNum = 453;BA.debugLine="Private l As List";
_l = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 454;BA.debugLine="Private i As Int = 0";
_i = (int) (0);
 //BA.debugLineNum = 455;BA.debugLine="l.Initialize";
_l.Initialize();
 //BA.debugLineNum = 456;BA.debugLine="Dim m, m2 As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m2 = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 457;BA.debugLine="m2.Initialize";
_m2.Initialize();
 //BA.debugLineNum = 458;BA.debugLine="If maxErrores = 0 Then lim = \"\" Else lim = \"limit";
if (_maxerrores==0) { 
_lim = "";}
else {
_lim = "limit "+BA.NumberToString(_maxerrores);};
 //BA.debugLineNum = 459;BA.debugLine="cur = SQL.ExecQuery(\"select * from errores order";
_cur = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(_sql.ExecQuery("select * from errores order by fecha desc "+_lim)));
 //BA.debugLineNum = 460;BA.debugLine="Do While cur.NextRow";
while (_cur.NextRow()) {
 //BA.debugLineNum = 461;BA.debugLine="m.Initialize";
_m.Initialize();
 //BA.debugLineNum = 462;BA.debugLine="m.Put(\"fecha\", cur.GetString(\"fecha\"))";
_m.Put((Object)("fecha"),(Object)(_cur.GetString("fecha")));
 //BA.debugLineNum = 463;BA.debugLine="m.Put(\"error\", cur.GetString(\"error\"))";
_m.Put((Object)("error"),(Object)(_cur.GetString("error")));
 //BA.debugLineNum = 464;BA.debugLine="m2.Put(i,m)";
_m2.Put((Object)(_i),(Object)(_m.getObject()));
 //BA.debugLineNum = 465;BA.debugLine="i = i + 1";
_i = (int) (_i+1);
 }
;
 //BA.debugLineNum = 467;BA.debugLine="cur.Close";
_cur.Close();
 //BA.debugLineNum = 468;BA.debugLine="j.Initialize(m2)";
_j.Initialize(_m2);
 //BA.debugLineNum = 469;BA.debugLine="Log(j.ToString)";
anywheresoftware.b4a.keywords.Common.LogImpl("312386325",_j.ToString(),0);
 //BA.debugLineNum = 470;BA.debugLine="If comprimido Then";
if (_comprimido) { 
 //BA.debugLineNum = 471;BA.debugLine="Return compress(j.ToString)";
if (true) return _compress(_ba,_j.ToString());
 }else {
 //BA.debugLineNum = 473;BA.debugLine="Return j.ToString";
if (true) return _j.ToString();
 };
 //BA.debugLineNum = 475;BA.debugLine="End Sub";
return "";
}
public static String  _dameruta(anywheresoftware.b4a.BA _ba,String _inicioruta,String _origenruta) throws Exception{
String _fechainicio = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _ruta2 = "";
int _i = 0;
 //BA.debugLineNum = 142;BA.debugLine="Sub dameRuta(inicioRuta As String, origenRuta As S";
 //BA.debugLineNum = 144;BA.debugLine="Dim fechaInicio As String";
_fechainicio = "";
 //BA.debugLineNum = 145;BA.debugLine="Try 'incioRuta es numero";
try { //BA.debugLineNum = 146;BA.debugLine="inicioRuta = inicioRuta * 1";
_inicioruta = BA.NumberToString((double)(Double.parseDouble(_inicioruta))*1);
 //BA.debugLineNum = 148;BA.debugLine="fechaInicio = fechaKMT(DateTime.Now - (DateTime.";
_fechainicio = _fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()-(anywheresoftware.b4a.keywords.Common.DateTime.TicksPerHour*(double)(Double.parseDouble(_inicioruta)))));
 } 
       catch (Exception e6) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e6); //BA.debugLineNum = 150;BA.debugLine="fechaInicio = fechaInicioHoy";
_fechainicio = _fechainiciohoy(_ba);
 };
 //BA.debugLineNum = 153;BA.debugLine="If B4XPages.MainPage.logger Then Log(\"fechaInicio";
if (mostCurrent._b4xpages._mainpage /*reparto_mazapa.keymon.lat.b4xmainpage*/ (_ba)._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("311010059","fechaInicio: "+_fechainicio+" | rutaHrsAtras="+BA.NumberToString(_rutahrsatras),0);};
 //BA.debugLineNum = 154;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 155;BA.debugLine="If kmt.IsInitialized = False Then kmt.Initialize(";
if (_kmt.IsInitialized()==anywheresoftware.b4a.keywords.Common.False) { 
_kmt.Initialize(mostCurrent._starter._ruta /*String*/ ,"kmt.db",anywheresoftware.b4a.keywords.Common.True);};
 //BA.debugLineNum = 156;BA.debugLine="If B4XPages.MainPage.logger Then Log(\"select FECH";
if (mostCurrent._b4xpages._mainpage /*reparto_mazapa.keymon.lat.b4xmainpage*/ (_ba)._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("311010062","select FECHA, LAT, LON from "+_origenruta+" where FECHA > "+_fechainicio+" order by FECHA desc limit "+BA.NumberToString(_rutamaxpoints),0);};
 //BA.debugLineNum = 157;BA.debugLine="c = kmt.ExecQuery(\"select FECHA, LAT, LON from \"&";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery("select FECHA, LAT, LON from "+_origenruta+" where FECHA > "+_fechainicio+" order by FECHA desc limit "+BA.NumberToString(_rutamaxpoints))));
 //BA.debugLineNum = 158;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 159;BA.debugLine="Dim ruta2 As String = \"\"";
_ruta2 = "";
 //BA.debugLineNum = 160;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 161;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step16 = 1;
final int limit16 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit16 ;_i = _i + step16 ) {
 //BA.debugLineNum = 162;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 163;BA.debugLine="ruta2=ruta2&CRLF&c.GetString(\"LAT\")&\",\"&c.GetSt";
_ruta2 = _ruta2+anywheresoftware.b4a.keywords.Common.CRLF+_c.GetString("LAT")+","+_c.GetString("LON")+","+_c.GetString("FECHA");
 //BA.debugLineNum = 164;BA.debugLine="B4XPages.MainPage.fechaRuta = c.GetString(\"FECH";
mostCurrent._b4xpages._mainpage /*reparto_mazapa.keymon.lat.b4xmainpage*/ (_ba)._fecharuta /*String*/  = _c.GetString("FECHA");
 }
};
 };
 //BA.debugLineNum = 167;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 168;BA.debugLine="Return compress(ruta2)";
if (true) return _compress(_ba,_ruta2);
 //BA.debugLineNum = 169;BA.debugLine="End Sub";
return "";
}
public static String  _dameusuariodedb(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _u = "";
 //BA.debugLineNum = 556;BA.debugLine="Sub dameUsuarioDeDB As String 'ignore";
 //BA.debugLineNum = 557;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 558;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
 //BA.debugLineNum = 559;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 560;BA.debugLine="c=kmt.ExecQuery(\"select USUARIO from usuarioa\")";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery("select USUARIO from usuarioa")));
 //BA.debugLineNum = 561;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 562;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
 //BA.debugLineNum = 563;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 564;BA.debugLine="Return u";
if (true) return _u;
 //BA.debugLineNum = 565;BA.debugLine="End Sub";
return "";
}
public static String  _decompress(anywheresoftware.b4a.BA _ba,String _base64) throws Exception{
byte[] _decompressedbytes = null;
anywheresoftware.b4a.agraham.byteconverter.ByteConverter _bc = null;
String _uncompressed = "";
 //BA.debugLineNum = 51;BA.debugLine="Sub decompress(base64 As String) As String 'ignore";
 //BA.debugLineNum = 52;BA.debugLine="Dim decompressedbytes() As Byte = su.DecodeBase64";
_decompressedbytes = _su.DecodeBase64(_base64);
 //BA.debugLineNum = 54;BA.debugLine="Dim bc As ByteConverter";
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
 //BA.debugLineNum = 55;BA.debugLine="Dim uncompressed As String = bc.StringFromBytes(d";
_uncompressed = _bc.StringFromBytes(_decompressedbytes,"UTF8");
 //BA.debugLineNum = 56;BA.debugLine="Log($\"Descomprimido: ${uncompressed.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("310551301",("Descomprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_uncompressed.length()))+""),0);
 //BA.debugLineNum = 58;BA.debugLine="Return uncompressed";
if (true) return _uncompressed;
 //BA.debugLineNum = 59;BA.debugLine="End Sub";
return "";
}
public static String  _deleteerrorlog_db(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 178;BA.debugLine="Sub deleteErrorLog_DB 'ignore";
 //BA.debugLineNum = 179;BA.debugLine="If Not(errorLog.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_errorlog.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 180;BA.debugLine="errorLog.ExecNonQuery(\"delete from errores\")";
_errorlog.ExecNonQuery("delete from errores");
 //BA.debugLineNum = 181;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 182;BA.debugLine="ToastMessageShow(\"Borrada\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Borrada"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 183;BA.debugLine="End Sub";
return "";
}
public static String  _deletegps_db(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 172;BA.debugLine="Sub deleteGPS_DB 'ignore";
 //BA.debugLineNum = 173;BA.debugLine="kmt.ExecNonQuery(\"delete from RUTA_GPS\")";
_kmt.ExecNonQuery("delete from RUTA_GPS");
 //BA.debugLineNum = 174;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 175;BA.debugLine="End Sub";
return "";
}
public static String  _fechainiciohoy(anywheresoftware.b4a.BA _ba) throws Exception{
String _origformat = "";
String _h = "";
 //BA.debugLineNum = 261;BA.debugLine="Sub fechaInicioHoy As String 'ignore";
 //BA.debugLineNum = 262;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 263;BA.debugLine="DateTime.DateFormat=\"yyMMdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMdd");
 //BA.debugLineNum = 264;BA.debugLine="Private h As String = DateTime.Date(DateTime.Now";
_h = anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow())+"000000";
 //BA.debugLineNum = 265;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 266;BA.debugLine="Log(\"Hoy=\"&h)";
anywheresoftware.b4a.keywords.Common.LogImpl("311599877","Hoy="+_h,0);
 //BA.debugLineNum = 267;BA.debugLine="Return h";
if (true) return _h;
 //BA.debugLineNum = 268;BA.debugLine="End Sub";
return "";
}
public static String  _fechakmt(anywheresoftware.b4a.BA _ba,String _fecha) throws Exception{
String _origformat = "";
String _nuevafecha = "";
 //BA.debugLineNum = 62;BA.debugLine="Sub fechaKMT(fecha As String) As String 'ignore";
 //BA.debugLineNum = 64;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 65;BA.debugLine="DateTime.DateFormat=\"yyMMddHHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMddHHmmss");
 //BA.debugLineNum = 66;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
 //BA.debugLineNum = 67;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 69;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
 //BA.debugLineNum = 70;BA.debugLine="End Sub";
return "";
}
public static long  _fechakmt2ticks(anywheresoftware.b4a.BA _ba,String _fkmt) throws Exception{
String _partefecha = "";
String _partehora = "";
String _origformat = "";
long _ticks = 0L;
 //BA.debugLineNum = 478;BA.debugLine="Sub fechaKMT2Ticks(fKMT As String) As Long 'ignore";
 //BA.debugLineNum = 479;BA.debugLine="Try";
try { //BA.debugLineNum = 480;BA.debugLine="If fKMT.Length = 12 Then";
if (_fkmt.length()==12) { 
 //BA.debugLineNum = 481;BA.debugLine="Private parteFecha As String = fKMT.SubString2(";
_partefecha = _fkmt.substring((int) (0),(int) (6));
 //BA.debugLineNum = 482;BA.debugLine="Private parteHora As String = fKMT.SubString(6)";
_partehora = _fkmt.substring((int) (6));
 //BA.debugLineNum = 483;BA.debugLine="Private OrigFormat As String = DateTime.DateFor";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 484;BA.debugLine="DateTime.DateFormat=\"yyMMdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMdd");
 //BA.debugLineNum = 485;BA.debugLine="DateTime.TimeFormat=\"HHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setTimeFormat("HHmmss");
 //BA.debugLineNum = 486;BA.debugLine="Private ticks As Long = DateTime.DateTimeParse(";
_ticks = anywheresoftware.b4a.keywords.Common.DateTime.DateTimeParse(_partefecha,_partehora);
 //BA.debugLineNum = 488;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 489;BA.debugLine="Return ticks";
if (true) return _ticks;
 }else {
 //BA.debugLineNum = 491;BA.debugLine="Log(\"Formato de fecha incorrecto, debe de ser '";
anywheresoftware.b4a.keywords.Common.LogImpl("312451853","Formato de fecha incorrecto, debe de ser 'YYMMDDHHMMSS', no '"+_fkmt+"' largo="+BA.NumberToString(_fkmt.length()),0);
 //BA.debugLineNum = 492;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 } 
       catch (Exception e16) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e16); //BA.debugLineNum = 495;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("312451857",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 //BA.debugLineNum = 496;BA.debugLine="LogColor($\"Fecha dada: ${fKMT}, Parte Fecha: ${p";
anywheresoftware.b4a.keywords.Common.LogImpl("312451858",("Fecha dada: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_fkmt))+", Parte Fecha: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_partefecha))+", Parte Hora: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_partehora))+""),anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 497;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 //BA.debugLineNum = 499;BA.debugLine="End Sub";
return 0L;
}
public static String  _getphnid(anywheresoftware.b4a.BA _ba) throws Exception{
String _t = "";
String _s = "";
 //BA.debugLineNum = 19;BA.debugLine="Sub getPhnId As String 'ignore";
 //BA.debugLineNum = 21;BA.debugLine="devModel = phn.Model";
_devmodel = _phn.getModel();
 //BA.debugLineNum = 22;BA.debugLine="If devModel.Length <= 3 Then 'Si phn.Model esta e";
if (_devmodel.length()<=3) { 
 //BA.debugLineNum = 23;BA.debugLine="Dim t As String = phn.GetSettings(\"android_id\")";
_t = _phn.GetSettings("android_id");
 //BA.debugLineNum = 24;BA.debugLine="devModel = t";
_devmodel = _t;
 };
 //BA.debugLineNum = 26;BA.debugLine="If devModel.Length >= 3 Then 'Si tenemos valor pa";
if (_devmodel.length()>=3) { 
 //BA.debugLineNum = 27;BA.debugLine="File.WriteString(File.DirInternal, \"phnId.txt\",";
anywheresoftware.b4a.keywords.Common.File.WriteString(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"phnId.txt",_devmodel);
 }else if(_devmodel.length()<3) { 
 //BA.debugLineNum = 30;BA.debugLine="Dim s As String = File.ReadString(File.DirIntern";
_s = anywheresoftware.b4a.keywords.Common.File.ReadString(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"phnId.txt");
 //BA.debugLineNum = 31;BA.debugLine="devModel = s";
_devmodel = _s;
 };
 //BA.debugLineNum = 35;BA.debugLine="Return devModel";
if (true) return _devmodel;
 //BA.debugLineNum = 36;BA.debugLine="End Sub";
return "";
}
public static String  _getssid(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 209;BA.debugLine="Sub getSSID  'ignore";
 //BA.debugLineNum = 214;BA.debugLine="End Sub";
return "";
}
public static String  _guardaappinfo(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 1018;BA.debugLine="Sub guardaAppInfo 'ignore";
 //BA.debugLineNum = 1019;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from CAT_VARIAB";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'EMPRESA' or CAT_VA_DESCRIPCION = 'APP_NAME' or CAT_VA_DESCRIPCION = 'APP_VERSION'");
 //BA.debugLineNum = 1020;BA.debugLine="Starter.skmt.ExecNonQuery($\"insert into CAT_VARIA";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_NAME', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.Application.getLabelName()))+"')"));
 //BA.debugLineNum = 1021;BA.debugLine="Starter.skmt.ExecNonQuery($\"insert into CAT_VARIA";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_VERSION', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.Application.getVersionName()))+"')"));
 //BA.debugLineNum = 1022;BA.debugLine="End Sub";
return "";
}
public static String  _guardainfoenarchivo(anywheresoftware.b4a.BA _ba,String _coords) throws Exception{
String _origformat = "";
String _lastupdate = "";
String _ubic = "";
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
String _s = "";
byte[] _t = null;
 //BA.debugLineNum = 112;BA.debugLine="Sub guardaInfoEnArchivo(coords As String) 'ignore";
 //BA.debugLineNum = 114;BA.debugLine="Dim OrigFormat As String=DateTime.DateFormat  'sa";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 115;BA.debugLine="DateTime.DateFormat=\"MMM-dd HH:mm:ss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MMM-dd HH:mm:ss");
 //BA.debugLineNum = 116;BA.debugLine="Dim lastUpdate As String=DateTime.Date(DateTime.N";
_lastupdate = anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 117;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 119;BA.debugLine="Dim ubic As String = coords&\",\"&lastUpdate";
_ubic = _coords+","+_lastupdate;
 //BA.debugLineNum = 120;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 121;BA.debugLine="Dim s As String = ubic & CRLF";
_s = _ubic+anywheresoftware.b4a.keywords.Common.CRLF;
 //BA.debugLineNum = 122;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
 //BA.debugLineNum = 123;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
 //BA.debugLineNum = 124;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 125;BA.debugLine="End Sub";
return "";
}
public static String  _guardainfoenbd(anywheresoftware.b4a.BA _ba,String _coords) throws Exception{
String[] _latlon = null;
 //BA.debugLineNum = 128;BA.debugLine="Sub guardaInfoEnBD(coords As String) 'ignore";
 //BA.debugLineNum = 129;BA.debugLine="If B4XPages.MainPage.logger Then Log(\"Guardamos u";
if (mostCurrent._b4xpages._mainpage /*reparto_mazapa.keymon.lat.b4xmainpage*/ (_ba)._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("310944513","Guardamos ubicacion en BD - "+_coords,0);};
 //BA.debugLineNum = 130;BA.debugLine="Try";
try { //BA.debugLineNum = 131;BA.debugLine="Dim latlon() As String = Regex.Split(\"\\|\", coord";
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split("\\|",_coords);
 //BA.debugLineNum = 132;BA.debugLine="If latlon.Length < 2 Then latlon = Regex.Split(\"";
if (_latlon.length<2) { 
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split(",",_coords);};
 //BA.debugLineNum = 134;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 135;BA.debugLine="kmt.ExecNonQuery2(\"INSERT INTO RUTA_GPS(fecha, l";
_kmt.ExecNonQuery2("INSERT INTO RUTA_GPS(fecha, lat, lon) VALUES (?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_latlon[(int) (2)]),(Object)(_latlon[(int) (0)]),(Object)(_latlon[(int) (1)])}));
 } 
       catch (Exception e8) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e8); //BA.debugLineNum = 137;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("310944521",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 //BA.debugLineNum = 139;BA.debugLine="End Sub";
return "";
}
public static String  _hmskmt(anywheresoftware.b4a.BA _ba) throws Exception{
String _origformat = "";
String _nuevahora = "";
 //BA.debugLineNum = 73;BA.debugLine="Sub hmsKMT As String 'ignore";
 //BA.debugLineNum = 75;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 76;BA.debugLine="DateTime.DateFormat=\"HHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("HHmmss");
 //BA.debugLineNum = 77;BA.debugLine="Private nuevaHora As String=DateTime.Date(DateTim";
_nuevahora = anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 78;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 80;BA.debugLine="Return nuevaHora";
if (true) return _nuevahora;
 //BA.debugLineNum = 81;BA.debugLine="End Sub";
return "";
}
public static String  _insertaenerrores(anywheresoftware.b4a.BA _ba,String _error) throws Exception{
 //BA.debugLineNum = 550;BA.debugLine="Sub insertaEnErrores(error As String)  'ignore";
 //BA.debugLineNum = 551;BA.debugLine="If Not(errorLog.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_errorlog.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 552;BA.debugLine="errorLog.ExecNonQuery2(\"INSERT INTO errores(fecha";
_errorlog.ExecNonQuery2("INSERT INTO errores(fecha, error) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))),(Object)(_error)}));
 //BA.debugLineNum = 553;BA.debugLine="End Sub";
return "";
}
public static String  _insertarenglonespruebaenerrorlog(anywheresoftware.b4a.BA _ba) throws Exception{
int _x = 0;
 //BA.debugLineNum = 438;BA.debugLine="Sub insertaRenglonesPruebaEnErrorLog 'ignore";
 //BA.debugLineNum = 439;BA.debugLine="If Not(errorLog.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_errorlog.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 440;BA.debugLine="Log(\"insertamos 50 renglones a errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("312320770","insertamos 50 renglones a errorLog",0);
 //BA.debugLineNum = 441;BA.debugLine="For x = 1 To 50";
{
final int step3 = 1;
final int limit3 = (int) (50);
_x = (int) (1) ;
for (;_x <= limit3 ;_x = _x + step3 ) {
 //BA.debugLineNum = 442;BA.debugLine="errorLog.ExecNonQuery2(\"INSERT INTO errores(fech";
_errorlog.ExecNonQuery2("INSERT INTO errores(fecha, error) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))),(Object)("abc")}));
 //BA.debugLineNum = 443;BA.debugLine="Log(x)";
anywheresoftware.b4a.keywords.Common.LogImpl("312320773",BA.NumberToString(_x),0);
 }
};
 //BA.debugLineNum = 445;BA.debugLine="End Sub";
return "";
}
public static String  _installapk(anywheresoftware.b4a.BA _ba,String _dir,String _apk) throws Exception{
anywheresoftware.b4a.objects.IntentWrapper _i = null;
 //BA.debugLineNum = 501;BA.debugLine="Sub InstallAPK(dir As String, apk As String) 'igno";
 //BA.debugLineNum = 502;BA.debugLine="If File.Exists(dir, apk) Then";
if (anywheresoftware.b4a.keywords.Common.File.Exists(_dir,_apk)) { 
 //BA.debugLineNum = 503;BA.debugLine="Dim i As Intent";
_i = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 504;BA.debugLine="i.Initialize(i.ACTION_VIEW, \"file://\" & File.Com";
_i.Initialize(_i.ACTION_VIEW,"file://"+anywheresoftware.b4a.keywords.Common.File.Combine(_dir,_apk));
 //BA.debugLineNum = 505;BA.debugLine="i.SetType(\"application/vnd.android.package-archi";
_i.SetType("application/vnd.android.package-archive");
 //BA.debugLineNum = 506;BA.debugLine="StartActivity(i)";
anywheresoftware.b4a.keywords.Common.StartActivity((_ba.processBA == null ? _ba : _ba.processBA),(Object)(_i.getObject()));
 };
 //BA.debugLineNum = 508;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _json2map(anywheresoftware.b4a.BA _ba,String _thejson) throws Exception{
anywheresoftware.b4a.objects.collections.JSONParser _json = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
 //BA.debugLineNum = 217;BA.debugLine="Sub JSON2Map(theJson As String) As Map 'ignore";
 //BA.debugLineNum = 219;BA.debugLine="Try";
try { //BA.debugLineNum = 220;BA.debugLine="Private json As JSONParser";
_json = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 221;BA.debugLine="json.Initialize(theJson)";
_json.Initialize(_thejson);
 //BA.debugLineNum = 222;BA.debugLine="Return json.NextObject";
if (true) return _json.NextObject();
 } 
       catch (Exception e6) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e6); //BA.debugLineNum = 224;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("311403271",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 //BA.debugLineNum = 225;BA.debugLine="log2DB(\"JSON2Map: \"&LastException)";
_log2db(_ba,"JSON2Map: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)));
 //BA.debugLineNum = 226;BA.debugLine="Private m As Map = CreateMap(\"title\":\"Error gene";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("title"),(Object)("Error generating JSON"),(Object)("t"),(Object)("Error"),(Object)("Message"),(Object)(anywheresoftware.b4a.keywords.Common.LastException(_ba).getObject()),(Object)("text"),(Object)(anywheresoftware.b4a.keywords.Common.LastException(_ba).getObject())});
 //BA.debugLineNum = 227;BA.debugLine="Return m";
if (true) return _m;
 };
 //BA.debugLineNum = 229;BA.debugLine="End Sub";
return null;
}
public static String  _log2db(anywheresoftware.b4a.BA _ba,String _texto) throws Exception{
 //BA.debugLineNum = 271;BA.debugLine="Sub log2DB(texto As String) 'ignore";
 //BA.debugLineNum = 272;BA.debugLine="LogColor(fechaKMT(DateTime.Now)&\" - log2BD: '\"&te";
anywheresoftware.b4a.keywords.Common.LogImpl("311665409",_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))+" - log2BD: '"+_texto+"'",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 273;BA.debugLine="If kmt.IsInitialized Then kmt.ExecNonQuery2(\"INSE";
if (_kmt.IsInitialized()) { 
_kmt.ExecNonQuery2("INSERT INTO bitacora(fecha, texto) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))),(Object)(_texto)}));};
 //BA.debugLineNum = 274;BA.debugLine="End Sub";
return "";
}
public static String  _mandamosloc(anywheresoftware.b4a.BA _ba,String _coords) throws Exception{
 //BA.debugLineNum = 242;BA.debugLine="Sub mandamosLoc(coords As String) 'ignore";
 //BA.debugLineNum = 258;BA.debugLine="End Sub";
return "";
}
public static String  _map2json(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _m) throws Exception{
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _jg = null;
String _t = "";
 //BA.debugLineNum = 232;BA.debugLine="Sub map2JSON(m As Map) As String 'ignore";
 //BA.debugLineNum = 235;BA.debugLine="Dim jg As JSONGenerator";
_jg = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 236;BA.debugLine="jg.Initialize(m)";
_jg.Initialize(_m);
 //BA.debugLineNum = 237;BA.debugLine="Dim t As String = jg.ToString";
_t = _jg.ToString();
 //BA.debugLineNum = 238;BA.debugLine="Return t";
if (true) return _t;
 //BA.debugLineNum = 239;BA.debugLine="End Sub";
return "";
}
public static boolean  _masdexxmins(anywheresoftware.b4a.BA _ba,int _hora,int _mins) throws Exception{
 //BA.debugLineNum = 277;BA.debugLine="Sub masDeXXMins(hora As Int, mins As Int) As Boole";
 //BA.debugLineNum = 278;BA.debugLine="If (hora + mins * DateTime.TicksPerMinute) < Date";
if ((_hora+_mins*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerMinute)<anywheresoftware.b4a.keywords.Common.DateTime.getNow()) { 
 //BA.debugLineNum = 279;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 281;BA.debugLine="Return False";
if (true) return anywheresoftware.b4a.keywords.Common.False;
 };
 //BA.debugLineNum = 283;BA.debugLine="End Sub";
return false;
}
public static boolean  _masdexxminskmt(anywheresoftware.b4a.BA _ba,String _hora,int _mins) throws Exception{
 //BA.debugLineNum = 286;BA.debugLine="Sub masDeXXMinsKMT(hora As String, mins As Int) As";
 //BA.debugLineNum = 287;BA.debugLine="Try";
try { //BA.debugLineNum = 289;BA.debugLine="If fechaKMT2Ticks(hora) + mins * DateTime.TicksP";
if (_fechakmt2ticks(_ba,_hora)+_mins*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerMinute<anywheresoftware.b4a.keywords.Common.DateTime.getNow()) { 
 //BA.debugLineNum = 291;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 294;BA.debugLine="Return False";
if (true) return anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e8) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e8); //BA.debugLineNum = 297;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("311796491",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 //BA.debugLineNum = 299;BA.debugLine="End Sub";
return false;
}
public static String  _monitor(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 309;BA.debugLine="Sub Monitor 'ignore";
 //BA.debugLineNum = 327;BA.debugLine="End Sub";
return "";
}
public static String  _notihigh(anywheresoftware.b4a.BA _ba,String _title,String _body,Object _activity) throws Exception{
anywheresoftware.b4a.objects.NotificationWrapper _notif = null;
 //BA.debugLineNum = 84;BA.debugLine="Sub notiHigh(title As String, body As String, acti";
 //BA.debugLineNum = 85;BA.debugLine="Private notif As Notification";
_notif = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 86;BA.debugLine="notif.Initialize2(notif.IMPORTANCE_HIGH)";
_notif.Initialize2(_notif.IMPORTANCE_HIGH);
 //BA.debugLineNum = 87;BA.debugLine="notif.Icon = \"icon\"";
_notif.setIcon("icon");
 //BA.debugLineNum = 88;BA.debugLine="notif.Vibrate = False";
_notif.setVibrate(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 89;BA.debugLine="notif.Sound = False";
_notif.setSound(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 90;BA.debugLine="notif.AutoCancel = True";
_notif.setAutoCancel(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 91;BA.debugLine="Log(\"notiHigh: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("310747911","notiHigh: "+_title,0);
 //BA.debugLineNum = 92;BA.debugLine="notif.SetInfo(title, body, activity)";
_notif.SetInfoNew((_ba.processBA == null ? _ba : _ba.processBA),BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),_activity);
 //BA.debugLineNum = 94;BA.debugLine="notif.Notify(777)";
_notif.Notify((int) (777));
 //BA.debugLineNum = 95;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.NotificationWrapper  _notilowreturn(anywheresoftware.b4a.BA _ba,String _title,String _body,int _id) throws Exception{
anywheresoftware.b4a.objects.NotificationWrapper _notification = null;
 //BA.debugLineNum = 98;BA.debugLine="Sub notiLowReturn(title As String, Body As String,";
 //BA.debugLineNum = 99;BA.debugLine="Private notification As Notification";
_notification = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 100;BA.debugLine="notification.Initialize2(notification.IMPORTANCE_";
_notification.Initialize2(_notification.IMPORTANCE_LOW);
 //BA.debugLineNum = 101;BA.debugLine="Log(\"notiLowReturn: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("310813443","notiLowReturn: "+_title,0);
 //BA.debugLineNum = 102;BA.debugLine="notification.Icon = \"icon\"";
_notification.setIcon("icon");
 //BA.debugLineNum = 103;BA.debugLine="notification.Sound = False";
_notification.setSound(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 104;BA.debugLine="notification.Vibrate = False";
_notification.setVibrate(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 105;BA.debugLine="notification.SetInfo(title, Body, Main)";
_notification.SetInfoNew((_ba.processBA == null ? _ba : _ba.processBA),BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),(Object)(mostCurrent._main.getObject()));
 //BA.debugLineNum = 106;BA.debugLine="notification.Notify(id)";
_notification.Notify(_id);
 //BA.debugLineNum = 108;BA.debugLine="Return notification";
if (true) return _notification;
 //BA.debugLineNum = 109;BA.debugLine="End Sub";
return null;
}
public static String  _panelvisible(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _panel,int _top,int _left) throws Exception{
 //BA.debugLineNum = 543;BA.debugLine="Sub panelVisible(panel As Panel, top As Int, left";
 //BA.debugLineNum = 544;BA.debugLine="panel.BringToFront";
_panel.BringToFront();
 //BA.debugLineNum = 545;BA.debugLine="panel.Visible = True";
_panel.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 546;BA.debugLine="panel.Top = top";
_panel.setTop(_top);
 //BA.debugLineNum = 547;BA.debugLine="panel.Left = left";
_panel.setLeft(_left);
 //BA.debugLineNum = 548;BA.debugLine="End Sub";
return "";
}
public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 3;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 6;BA.debugLine="Public GZip As GZipStrings";
_gzip = new de.donmanfred.GZipStringswrapper();
 //BA.debugLineNum = 7;BA.debugLine="Private su As StringUtils";
_su = new anywheresoftware.b4a.objects.StringUtils();
 //BA.debugLineNum = 8;BA.debugLine="Dim phn As Phone";
_phn = new anywheresoftware.b4a.phone.Phone();
 //BA.debugLineNum = 9;BA.debugLine="Dim devModel As String";
_devmodel = "";
 //BA.debugLineNum = 10;BA.debugLine="Dim kmt, errorLog As SQL 'Requiere la libreria \"S";
_kmt = new anywheresoftware.b4a.sql.SQL();
_errorlog = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 12;BA.debugLine="Dim ssid As String  'ignore";
_ssid = "";
 //BA.debugLineNum = 13;BA.debugLine="Dim rutaMaxPoints As Int = 3000";
_rutamaxpoints = (int) (3000);
 //BA.debugLineNum = 14;BA.debugLine="Dim rutaHrsAtras As Int = 48";
_rutahrsatras = (int) (48);
 //BA.debugLineNum = 16;BA.debugLine="End Sub";
return "";
}
public static String  _prodrechazo(anywheresoftware.b4a.BA _ba,String _clienteoriginal,String _prodid) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _rr = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _chv = null;
String _precio = "";
 //BA.debugLineNum = 782;BA.debugLine="Sub prodRechazo(clienteOriginal As String, prodId";
 //BA.debugLineNum = 783;BA.debugLine="Log(\"RECHAZO DEVOLUCION\")";
anywheresoftware.b4a.keywords.Common.LogImpl("313893633","RECHAZO DEVOLUCION",0);
 //BA.debugLineNum = 784;BA.debugLine="Private rr As Cursor = Starter.skmt.ExecQuery($\"s";
_rr = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_rr = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select count(REP_CLIENTE) as hayRechazo from REPARTO where rep_prodid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and REP_CLIENTE in (Select CUENTA from cuentaa)"))));
 //BA.debugLineNum = 785;BA.debugLine="rr.Position = 0";
_rr.setPosition((int) (0));
 //BA.debugLineNum = 786;BA.debugLine="If rr.GetString(\"hayRechazo\") = 0 Then";
if ((_rr.GetString("hayRechazo")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 787;BA.debugLine="Log(\"INSERTAMOS EN REPARTO\")";
anywheresoftware.b4a.keywords.Common.LogImpl("313893637","INSERTAMOS EN REPARTO",0);
 //BA.debugLineNum = 789;BA.debugLine="Private chv As Cursor = Starter.skmt.ExecQuery($";
_chv = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_chv = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from hist_ventas where hvd_cliente in (select cuenta from cuentaa) and hvd_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"))));
 //BA.debugLineNum = 791;BA.debugLine="If chv.RowCount > 0 Then";
if (_chv.getRowCount()>0) { 
 //BA.debugLineNum = 792;BA.debugLine="chv.Position = 0";
_chv.setPosition((int) (0));
 //BA.debugLineNum = 794;BA.debugLine="Private precio As String = traePrecio(prodId, t";
_precio = _traeprecio(_ba,_prodid,_traealmacen(_ba));
 //BA.debugLineNum = 795;BA.debugLine="Starter.skmt.ExecNonQuery2(\"insert into reparto";
mostCurrent._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_CLI_ORIG)  VALUES (?,?,?,?,?,1,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_traecliente(_ba),_chv.GetString("HVD_PRONOMBRE"),BA.NumberToString(1),_precio,_chv.GetString("HVD_FECHA"),_prodid,_precio,_traecliente(_ba)}));
 //BA.debugLineNum = 796;BA.debugLine="Starter.skmt.ExecNonQuery2(\"insert into reparto";
mostCurrent._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_CLI_ORIG)  VALUES (?,?,?,?,?,0,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_traecliente(_ba),_chv.GetString("HVD_PRONOMBRE"),BA.NumberToString((double)(Double.parseDouble(_chv.GetString("HVD_CANT")))-1),BA.NumberToString(((double)(Double.parseDouble(_chv.GetString("HVD_CANT")))-1)*(double)(Double.parseDouble(_precio))),_chv.GetString("HVD_FECHA"),_prodid,_precio,_traecliente(_ba)}));
 //BA.debugLineNum = 797;BA.debugLine="Starter.skmt.ExecNonQuery($\"update HIST_VENTAS";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update HIST_VENTAS set HVD_PARCIAL = 1, HVD_CANT = 0, HVD_COSTO_TOT = '0' where HVD_PROID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and HVD_CLIENTE in (Select CUENTA from cuentaa)"));
 };
 }else {
 //BA.debugLineNum = 800;BA.debugLine="Log($\"ACTUALIZAMOS REPARTO\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("313893650",("ACTUALIZAMOS REPARTO"),0);
 //BA.debugLineNum = 801;BA.debugLine="Private precio As String = traePrecio(prodId, tr";
_precio = _traeprecio(_ba,_prodid,_traealmacen(_ba));
 //BA.debugLineNum = 802;BA.debugLine="Starter.skmt.ExecNonQuery2(\"update HIST_VENTAS s";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("update HIST_VENTAS set HVD_PARCIAL = 1, HVD_CANT = 0, HVD_COSTO_TOT = '0' WHERE HVD_PROID = ? and HVD_CLIENTE in (Select CUENTA from cuentaa)",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_prodid}));
 //BA.debugLineNum = 803;BA.debugLine="Starter.skmt.ExecNonQuery($\"update reparto set R";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update reparto set REP_CANT = REP_CANT + 1 where REP_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_CLI_ORIG = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_RECHAZO = 1 and REP_PRODID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"));
 //BA.debugLineNum = 804;BA.debugLine="Starter.skmt.ExecNonQuery($\"update reparto set R";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update reparto set REP_CANT = REP_CANT - 1 where REP_CLIENTE in (Select CUENTA from cuentaa) and REP_CLI_ORIG = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_RECHAZO = 0 and REP_PRODID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"));
 //BA.debugLineNum = 807;BA.debugLine="Starter.skmt.ExecNonQuery($\"update reparto set R";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update reparto set REP_COSTO_TOT = REP_CANT * "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_precio))+", REP_PRECIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_precio))+"' where REP_CLIENTE in (Select CUENTA from cuentaa) and REP_CLI_ORIG = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"'  and REP_PRODID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"));
 };
 //BA.debugLineNum = 809;BA.debugLine="End Sub";
return "";
}
public static String  _prodventa(anywheresoftware.b4a.BA _ba,String _clienteoriginal,String _prodid) throws Exception{
String _precio = "";
 //BA.debugLineNum = 751;BA.debugLine="Sub prodVenta(clienteOriginal As String, prodId As";
 //BA.debugLineNum = 753;BA.debugLine="Private precio As String = traePrecio(prodId, tra";
_precio = _traeprecio(_ba,_prodid,_traealmacen(_ba));
 //BA.debugLineNum = 754;BA.debugLine="Starter.skmt.ExecNonQuery($\"update reparto set RE";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update reparto set REP_CANT = REP_CANT - 1 where REP_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_CLI_ORIG = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_RECHAZO = 1 and REP_PRODID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"));
 //BA.debugLineNum = 755;BA.debugLine="Starter.skmt.ExecNonQuery($\"update reparto set RE";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update reparto set REP_CANT = REP_CANT + 1 where REP_CLIENTE in (Select CUENTA from cuentaa) and REP_CLI_ORIG = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_RECHAZO = 0 and REP_PRODID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"));
 //BA.debugLineNum = 756;BA.debugLine="Log($\"update reparto set REP_CANT = REP_CANT - 1";
anywheresoftware.b4a.keywords.Common.LogImpl("313828101",("update reparto set REP_CANT = REP_CANT - 1 where REP_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_CLI_ORIG = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_RECHAZO = 1 and REP_PRODID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"),0);
 //BA.debugLineNum = 757;BA.debugLine="Log($\"update reparto set REP_CANT = REP_CANT + 1";
anywheresoftware.b4a.keywords.Common.LogImpl("313828102",("update reparto set REP_CANT = REP_CANT + 1 where REP_CLIENTE in (Select CUENTA from cuentaa) and REP_CLI_ORIG = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_RECHAZO = 0 and REP_PRODID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"),0);
 //BA.debugLineNum = 758;BA.debugLine="Starter.skmt.ExecNonQuery($\"update reparto set RE";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update reparto set REP_COSTO_TOT = REP_CANT * "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_precio))+", REP_PRECIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_precio))+"' where REP_CLIENTE in (Select CUENTA from cuentaa) and REP_CLI_ORIG = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteoriginal))+"' and REP_RECHAZO = 0 and REP_PRODID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"));
 //BA.debugLineNum = 779;BA.debugLine="End Sub";
return "";
}
public static String  _revisabd(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 195;BA.debugLine="Sub revisaBD 'ignore";
 //BA.debugLineNum = 196;BA.debugLine="If Not(File.Exists(Starter.ruta, \"kmt.db\")) Then";
if (anywheresoftware.b4a.keywords.Common.Not(anywheresoftware.b4a.keywords.Common.File.Exists(mostCurrent._starter._ruta /*String*/ ,"kmt.db"))) { 
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirAssets(),"kmt.db",mostCurrent._starter._ruta /*String*/ ,"kmt.db");};
 //BA.debugLineNum = 197;BA.debugLine="If Not(kmt.IsInitialized) Then kmt.Initialize(Sta";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_kmt.Initialize(mostCurrent._starter._ruta /*String*/ ,"kmt.db",anywheresoftware.b4a.keywords.Common.True);};
 //BA.debugLineNum = 198;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS RUTA";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS RUTA_GPS(FECHA INTEGER, LAT TEXT, LON TEXT)");
 //BA.debugLineNum = 200;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS bita";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)");
 //BA.debugLineNum = 202;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS REPA";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS REPARTO_GEO (CLIENTE TEXT, USUARIO TEXT, FECHA_PUNTEO TEXT, LATITUD TEXT, LONGITUD TEXT, ALMACEN TEXT, RUTA_REPARTO TEXT, RUTA_PREV TEXT, FECHA_PREVENTA TEXT, MOTIVO TEXT, COMENTARIO TEXT, TIPO TEXT, ENVIO TEXT)");
 //BA.debugLineNum = 204;BA.debugLine="If Not(errorLog.IsInitialized) Then errorLog.Init";
if (anywheresoftware.b4a.keywords.Common.Not(_errorlog.IsInitialized())) { 
_errorlog.Initialize(mostCurrent._starter._ruta /*String*/ ,"errorLog.db",anywheresoftware.b4a.keywords.Common.True);};
 //BA.debugLineNum = 205;BA.debugLine="errorLog.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS";
_errorlog.ExecNonQuery("CREATE TABLE IF NOT EXISTS errores(fecha INTEGER, error TEXT)");
 //BA.debugLineNum = 206;BA.debugLine="End Sub";
return "";
}
public static String  _revisaflp(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _todobienflp = false;
 //BA.debugLineNum = 345;BA.debugLine="Sub revisaFLP 'ignore";
 //BA.debugLineNum = 346;BA.debugLine="LogColor($\"**** **** Revisamos FLP - ${fechaKMT(D";
anywheresoftware.b4a.keywords.Common.LogImpl("312058625",("**** **** Revisamos FLP - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))))+"**** ****"),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (78),(int) (0),(int) (227)));
 //BA.debugLineNum = 347;BA.debugLine="Private todoBienFLP As Boolean = True";
_todobienflp = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 348;BA.debugLine="If Not(Tracker.FLP.IsInitialized) Then";
if (anywheresoftware.b4a.keywords.Common.Not(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsInitialized())) { 
 //BA.debugLineNum = 349;BA.debugLine="log2DB(\"revisaFLP: No esta inicializado ... 'Rei";
_log2db(_ba,"revisaFLP: No esta inicializado ... 'Reinicializando FLP'");
 //BA.debugLineNum = 350;BA.debugLine="Tracker.FLP.Initialize(\"flp\")";
mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .Initialize((_ba.processBA == null ? _ba : _ba.processBA),"flp");
 //BA.debugLineNum = 351;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 //BA.debugLineNum = 353;BA.debugLine="If Tracker.FLP.IsInitialized Then";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsInitialized()) { 
 //BA.debugLineNum = 354;BA.debugLine="If Not(Tracker.FLP.IsConnected) Then";
if (anywheresoftware.b4a.keywords.Common.Not(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsConnected())) { 
 //BA.debugLineNum = 355;BA.debugLine="log2DB(\"revisaFLP: No esta conectado ... 'Recon";
_log2db(_ba,"revisaFLP: No esta conectado ... 'Reconectando FLP'");
 //BA.debugLineNum = 357;BA.debugLine="CallSubDelayed(Tracker,\"StartFLP\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()),"StartFLP");
 //BA.debugLineNum = 358;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 //BA.debugLineNum = 360;BA.debugLine="If	Tracker.FLP.IsConnected And _ 			Tracker.FLP.";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsConnected() && mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().IsInitialized() && mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().DistanceTo((android.location.Location)(mostCurrent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/ .getObject()))>500) { 
 //BA.debugLineNum = 363;BA.debugLine="log2DB(\"revisaFLP: 'No se esta actualizando, lo";
_log2db(_ba,"revisaFLP: 'No se esta actualizando, lo reiniciamos ...'");
 //BA.debugLineNum = 364;BA.debugLine="StartService(Tracker)";
anywheresoftware.b4a.keywords.Common.StartService((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()));
 //BA.debugLineNum = 365;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 };
 //BA.debugLineNum = 368;BA.debugLine="If todoBienFLP Then LogColor(\" +++ +++ Sin errore";
if (_todobienflp) { 
anywheresoftware.b4a.keywords.Common.LogImpl("312058647"," +++ +++ Sin errores en FLP",anywheresoftware.b4a.keywords.Common.Colors.Green);};
 //BA.debugLineNum = 370;BA.debugLine="End Sub";
return "";
}
public static String  _revisapushservice(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 373;BA.debugLine="Sub revisaPushService 'ignore";
 //BA.debugLineNum = 411;BA.debugLine="End Sub";
return "";
}
public static String  _revisauug(anywheresoftware.b4a.BA _ba) throws Exception{
int _daa = 0;
 //BA.debugLineNum = 331;BA.debugLine="Sub revisaUUG 'ignore";
 //BA.debugLineNum = 332;BA.debugLine="revisaFLP";
_revisaflp(_ba);
 //BA.debugLineNum = 333;BA.debugLine="If Tracker.FLP.GetLastKnownLocation.IsInitialized";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().IsInitialized()) { 
 //BA.debugLineNum = 334;BA.debugLine="Dim daa As Int = Tracker.UUGCoords.DistanceTo(Tr";
_daa = (int) (mostCurrent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/ .DistanceTo((android.location.Location)(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getObject())));
 //BA.debugLineNum = 335;BA.debugLine="If B4XPages.MainPage.Logger Then LogColor($\"****";
if (mostCurrent._b4xpages._mainpage /*reparto_mazapa.keymon.lat.b4xmainpage*/ (_ba)._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("311993092",("**** UUC \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_fechakmt(_ba,BA.NumberToString(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getTime()))))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.2",(Object)(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.8",(Object)(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getLatitude()))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.8",(Object)(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getLongitude()))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.2",(Object)(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getSpeed()))+"|"),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (255),(int) (112),(int) (35)));};
 //BA.debugLineNum = 336;BA.debugLine="If daa > 40 And Tracker.FLP.GetLastKnownLocation";
if (_daa>40 && mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()<35) { 
 //BA.debugLineNum = 337;BA.debugLine="kmt.ExecNonQuery2(\"INSERT INTO RUTA_GPS(fecha,";
_kmt.ExecNonQuery2("INSERT INTO RUTA_GPS(fecha, lat, lon) VALUES (?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_fechakmt(_ba,BA.NumberToString(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getTime()))),(Object)(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getLatitude()),(Object)(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getLongitude())}));
 //BA.debugLineNum = 338;BA.debugLine="If B4XPages.MainPage.Logger Then Log(\"++++ Dist";
if (mostCurrent._b4xpages._mainpage /*reparto_mazapa.keymon.lat.b4xmainpage*/ (_ba)._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("311993095","++++ Distancia a anterior="+BA.NumberToString(_daa)+"|"+"Precision="+BA.NumberToString(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()),0);};
 };
 //BA.debugLineNum = 340;BA.debugLine="Tracker.UUGCoords = Tracker.FLP.GetLastKnownLoca";
mostCurrent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/  = mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation();
 };
 //BA.debugLineNum = 342;BA.debugLine="End Sub";
return "";
}
public static String  _setdivider(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ListViewWrapper _lv,int _color,int _height) throws Exception{
anywheresoftware.b4a.agraham.reflection.Reflection _r = null;
anywheresoftware.b4a.objects.drawable.ColorDrawable _cd = null;
 //BA.debugLineNum = 567;BA.debugLine="Sub SetDivider(lv As ListView, Color As Int, Heigh";
 //BA.debugLineNum = 568;BA.debugLine="Dim r As Reflector";
_r = new anywheresoftware.b4a.agraham.reflection.Reflection();
 //BA.debugLineNum = 569;BA.debugLine="r.Target = lv";
_r.Target = (Object)(_lv.getObject());
 //BA.debugLineNum = 570;BA.debugLine="Dim CD As ColorDrawable";
_cd = new anywheresoftware.b4a.objects.drawable.ColorDrawable();
 //BA.debugLineNum = 571;BA.debugLine="CD.Initialize(Color, 0)";
_cd.Initialize(_color,(int) (0));
 //BA.debugLineNum = 572;BA.debugLine="r.RunMethod4(\"setDivider\", Array As Object(CD), A";
_r.RunMethod4("setDivider",new Object[]{(Object)(_cd.getObject())},new String[]{"android.graphics.drawable.Drawable"});
 //BA.debugLineNum = 573;BA.debugLine="r.RunMethod2(\"setDividerHeight\", Height, \"java.la";
_r.RunMethod2("setDividerHeight",BA.NumberToString(_height),"java.lang.int");
 //BA.debugLineNum = 574;BA.debugLine="End Sub";
return "";
}
public static String  _traealmacen(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _a = "";
 //BA.debugLineNum = 957;BA.debugLine="Sub traeAlmacen As String 'ignore";
 //BA.debugLineNum = 958;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 959;BA.debugLine="Private a As String";
_a = "";
 //BA.debugLineNum = 960;BA.debugLine="c = Starter.skmt.ExecQuery(\"select ID_ALMACEN fro";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select ID_ALMACEN from CAT_ALMACEN")));
 //BA.debugLineNum = 961;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 962;BA.debugLine="a = C.GetString(\"ID_ALMACEN\")";
_a = _c.GetString("ID_ALMACEN");
 //BA.debugLineNum = 963;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 964;BA.debugLine="Return a";
if (true) return _a;
 //BA.debugLineNum = 965;BA.debugLine="End Sub";
return "";
}
public static int  _traecantidadrechazada(anywheresoftware.b4a.BA _ba,String _cliente,String _prodid) throws Exception{
int _cant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cr = null;
 //BA.debugLineNum = 715;BA.debugLine="Sub traeCantidadRechazada(cliente As String, prodI";
 //BA.debugLineNum = 716;BA.debugLine="Private cant As Int = 0";
_cant = (int) (0);
 //BA.debugLineNum = 717;BA.debugLine="Private cr As Cursor = Starter.skmt.ExecQuery($\"S";
_cr = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cr = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("Select rep_cliente, rep_prodid, REP_CANT, REP_RECHAZO from reparto where rep_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"' and rep_prodid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and REP_RECHAZO = 1"))));
 //BA.debugLineNum = 718;BA.debugLine="If cr.RowCount > 0 Then";
if (_cr.getRowCount()>0) { 
 //BA.debugLineNum = 719;BA.debugLine="cr.Position = 0";
_cr.setPosition((int) (0));
 //BA.debugLineNum = 720;BA.debugLine="cant = cr.GetString(\"REP_CANT\")";
_cant = (int)(Double.parseDouble(_cr.GetString("REP_CANT")));
 };
 //BA.debugLineNum = 722;BA.debugLine="Log($\"${cliente}, ${prodId}, rowcont:${cr.RowCoun";
anywheresoftware.b4a.keywords.Common.LogImpl("313631495",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+", "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+", rowcont:"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cr.getRowCount()))+", cant: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+""),0);
 //BA.debugLineNum = 723;BA.debugLine="Return cant";
if (true) return _cant;
 //BA.debugLineNum = 724;BA.debugLine="End Sub";
return 0;
}
public static int  _traecantidadvendida(anywheresoftware.b4a.BA _ba,String _cliente,String _prodid) throws Exception{
int _cant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cr = null;
 //BA.debugLineNum = 727;BA.debugLine="Sub traeCantidadVendida(cliente As String, prodId";
 //BA.debugLineNum = 728;BA.debugLine="Private cant As Int = 0";
_cant = (int) (0);
 //BA.debugLineNum = 729;BA.debugLine="Private cr As Cursor = Starter.skmt.ExecQuery($\"S";
_cr = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cr = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("Select rep_cliente, rep_prodid, REP_CANT, REP_RECHAZO from reparto where rep_cli_orig = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"' and rep_prodid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and REP_RECHAZO = 0 and REP_CANT > 0"))));
 //BA.debugLineNum = 731;BA.debugLine="If cr.RowCount > 0 Then";
if (_cr.getRowCount()>0) { 
 //BA.debugLineNum = 732;BA.debugLine="cr.Position = 0";
_cr.setPosition((int) (0));
 //BA.debugLineNum = 733;BA.debugLine="cant = cr.GetString(\"REP_CANT\")";
_cant = (int)(Double.parseDouble(_cr.GetString("REP_CANT")));
 };
 //BA.debugLineNum = 735;BA.debugLine="Return cant";
if (true) return _cant;
 //BA.debugLineNum = 736;BA.debugLine="End Sub";
return 0;
}
public static anywheresoftware.b4a.objects.collections.Map  _traecantymonto2(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
int _cant = 0;
float _monto = 0f;
anywheresoftware.b4a.sql.SQL.CursorWrapper _ccym = null;
int _i = 0;
 //BA.debugLineNum = 839;BA.debugLine="Sub traeCantYMonto2(cliente As String) As Map";
 //BA.debugLineNum = 841;BA.debugLine="Private cant As Int = 0";
_cant = (int) (0);
 //BA.debugLineNum = 842;BA.debugLine="Private monto As Float = 0";
_monto = (float) (0);
 //BA.debugLineNum = 843;BA.debugLine="Private ccym As Cursor = Starter.skmt.ExecQuery($";
_ccym = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_ccym = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("Select hvd_codpromo, hvd_proid, HVD_CANT, (Select CAT_GP_PRECIO from cat_gunaprod where cat_gp_id = hvd_proid) As precio from HIST_VENTAS where HVD_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"'"))));
 //BA.debugLineNum = 844;BA.debugLine="If ccym.RowCount > 0 Then";
if (_ccym.getRowCount()>0) { 
 //BA.debugLineNum = 845;BA.debugLine="For i=0 To ccym.RowCount -1";
{
final int step5 = 1;
final int limit5 = (int) (_ccym.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 846;BA.debugLine="ccym.Position = i";
_ccym.setPosition(_i);
 //BA.debugLineNum = 847;BA.debugLine="If ccym.GetString(\"HVD_CODPROMO\") <> ccym.GetSt";
if ((_ccym.GetString("HVD_CODPROMO")).equals(_ccym.GetString("HVD_PROID")) == false && _ccym.GetString("precio")!= null) { 
 //BA.debugLineNum = 848;BA.debugLine="cant = cant + ccym.GetString(\"HVD_CANT\")";
_cant = (int) (_cant+(double)(Double.parseDouble(_ccym.GetString("HVD_CANT"))));
 //BA.debugLineNum = 850;BA.debugLine="monto = monto + (ccym.GetString(\"HVD_CANT\") *";
_monto = (float) (_monto+((double)(Double.parseDouble(_ccym.GetString("HVD_CANT")))*(double)(Double.parseDouble(_traeprecio(_ba,_ccym.GetString("HVD_PROID"),_ccym.GetString("HVD_CODPROMO"))))));
 };
 }
};
 };
 //BA.debugLineNum = 856;BA.debugLine="ccym = Starter.skmt.ExecQuery($\"Select rep_prodid";
_ccym = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("Select rep_prodid, iFNULL(REP_CANT, 0) AS REP_CANT, iFNULL((Select CAT_GP_PRECIO from cat_gunaprod where cat_gp_id = rep_prodid),0) As precio from REPARTO where REP_CLIENTE in (Select cuenta from cuentaa) And REP_RECHAZO = '0' and REP_CANT > 0"))));
 //BA.debugLineNum = 857;BA.debugLine="If ccym.RowCount > 0 Then";
if (_ccym.getRowCount()>0) { 
 //BA.debugLineNum = 858;BA.debugLine="For i=0 To ccym.RowCount -1";
{
final int step15 = 1;
final int limit15 = (int) (_ccym.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit15 ;_i = _i + step15 ) {
 //BA.debugLineNum = 859;BA.debugLine="ccym.Position = i";
_ccym.setPosition(_i);
 //BA.debugLineNum = 860;BA.debugLine="If ccym.GetString(\"REP_CANT\") <> Null Then cant";
if (_ccym.GetString("REP_CANT")!= null) { 
_cant = (int) (_cant+(double)(Double.parseDouble(_ccym.GetString("REP_CANT"))));};
 //BA.debugLineNum = 861;BA.debugLine="monto = monto + (ccym.GetString(\"REP_CANT\") * c";
_monto = (float) (_monto+((double)(Double.parseDouble(_ccym.GetString("REP_CANT")))*(double)(Double.parseDouble(_ccym.GetString("precio")))));
 }
};
 //BA.debugLineNum = 863;BA.debugLine="Log($\"CANT=${cant}, MONTO=${monto}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("314024728",("CANT="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+", MONTO="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_monto))+""),0);
 };
 //BA.debugLineNum = 866;BA.debugLine="ccym.Close";
_ccym.Close();
 //BA.debugLineNum = 867;BA.debugLine="Return CreateMap(\"cantidad\":cant, \"monto\":monto)";
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("cantidad"),(Object)(_cant),(Object)("monto"),(Object)(_monto)});
 //BA.debugLineNum = 868;BA.debugLine="End Sub";
return null;
}
public static String  _traecliente(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _cli = null;
String _cl = "";
 //BA.debugLineNum = 695;BA.debugLine="Sub traeCliente As String 'ignore";
 //BA.debugLineNum = 696;BA.debugLine="Private cli As Cursor = Starter.skmt.ExecQuery(\"S";
_cli = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cli = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select CUENTA from cuentaa")));
 //BA.debugLineNum = 697;BA.debugLine="cli.Position = 0";
_cli.setPosition((int) (0));
 //BA.debugLineNum = 698;BA.debugLine="Private cl As String = cli.GetString(\"CUENTA\")";
_cl = _cli.GetString("CUENTA");
 //BA.debugLineNum = 699;BA.debugLine="cli.Close";
_cli.Close();
 //BA.debugLineNum = 700;BA.debugLine="Return cl";
if (true) return _cl;
 //BA.debugLineNum = 701;BA.debugLine="End Sub";
return "";
}
public static String  _traeconversion(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
String _pu = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _idc = null;
 //BA.debugLineNum = 679;BA.debugLine="Sub traeConversion(id As String) As String";
 //BA.debugLineNum = 680;BA.debugLine="Private pu As String = \"0\"";
_pu = "0";
 //BA.debugLineNum = 682;BA.debugLine="Private idc As Cursor = kmt.ExecQuery($\"select C";
_idc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_idc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery(("select CONVERSION from CAT_GUNAPROD where CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 683;BA.debugLine="If idc.RowCount > 0 Then";
if (_idc.getRowCount()>0) { 
 //BA.debugLineNum = 684;BA.debugLine="idc.Position=0";
_idc.setPosition((int) (0));
 //BA.debugLineNum = 685;BA.debugLine="If idc.RowCount > 0 And IsNumber(idc.GetString(";
if (_idc.getRowCount()>0 && anywheresoftware.b4a.keywords.Common.IsNumber(_idc.GetString("CONVERSION"))) { 
_pu = _idc.GetString("CONVERSION");};
 };
 //BA.debugLineNum = 688;BA.debugLine="idc.Close";
_idc.Close();
 //BA.debugLineNum = 690;BA.debugLine="Return pu";
if (true) return _pu;
 //BA.debugLineNum = 691;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _traeentregados(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.objects.collections.Map _m = null;
int _cant = 0;
String _monto = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _rc = null;
 //BA.debugLineNum = 871;BA.debugLine="Sub traeEntregados As Map";
 //BA.debugLineNum = 872;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 873;BA.debugLine="Private cant As Int = 0";
_cant = (int) (0);
 //BA.debugLineNum = 874;BA.debugLine="Private monto As String = 0";
_monto = BA.NumberToString(0);
 //BA.debugLineNum = 875;BA.debugLine="Private rc As Cursor = Starter.skmt.ExecQuery($\"s";
_rc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_rc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select sum(HVD_CANT) as CUANTOS, sum(HVD_COSTO_TOT) as CUANTO from HIST_VENTAS where HVD_ESTATUS = '1' and HVD_COSTO_TOT <> '0'"))));
 //BA.debugLineNum = 876;BA.debugLine="If rc.RowCount > 0 Then";
if (_rc.getRowCount()>0) { 
 //BA.debugLineNum = 877;BA.debugLine="rc.Position = 0";
_rc.setPosition((int) (0));
 //BA.debugLineNum = 878;BA.debugLine="If rc.GetString(\"CUANTOS\") <> Null Then";
if (_rc.GetString("CUANTOS")!= null) { 
 //BA.debugLineNum = 879;BA.debugLine="cant = cant + rc.GetString(\"CUANTOS\")";
_cant = (int) (_cant+(double)(Double.parseDouble(_rc.GetString("CUANTOS"))));
 //BA.debugLineNum = 880;BA.debugLine="monto = monto + rc.GetString(\"CUANTO\")";
_monto = BA.NumberToString((double)(Double.parseDouble(_monto))+(double)(Double.parseDouble(_rc.GetString("CUANTO"))));
 };
 };
 //BA.debugLineNum = 884;BA.debugLine="Return CreateMap(\"cantidad\": cant, \"monto\": monto";
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("cantidad"),(Object)(_cant),(Object)("monto"),(Object)(_monto)});
 //BA.debugLineNum = 885;BA.debugLine="End Sub";
return null;
}
public static String  _traefechaprev(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _a = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _clienteasing = null;
String[] _fecha = null;
String[] _fecha2 = null;
String _fecha3 = "";
String[] _hora = null;
 //BA.debugLineNum = 978;BA.debugLine="Sub traefECHAPREV As String 'ignore";
 //BA.debugLineNum = 979;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 980;BA.debugLine="Private a As String";
_a = "";
 //BA.debugLineNum = 981;BA.debugLine="Private clienteasing As Cursor = Starter.skmt.Exe";
_clienteasing = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_clienteasing = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT CUENTA FROM CUENTAA")));
 //BA.debugLineNum = 982;BA.debugLine="clienteasing.Position = 0";
_clienteasing.setPosition((int) (0));
 //BA.debugLineNum = 983;BA.debugLine="If clienteasing.GetString(\"CUENTA\") <> \"63403\" Th";
if ((_clienteasing.GetString("CUENTA")).equals("63403") == false) { 
 //BA.debugLineNum = 984;BA.debugLine="c = Starter.skmt.ExecQuery(\"select HVD_FECHA fro";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select HVD_FECHA from HIST_VENTAS where HVD_CLIENTE IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 985;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 986;BA.debugLine="Dim fecha() As String = Regex.Split(\" \", c.GetSt";
_fecha = anywheresoftware.b4a.keywords.Common.Regex.Split(" ",_c.GetString("HVD_FECHA"));
 //BA.debugLineNum = 987;BA.debugLine="Dim fecha2() As String = Regex.Split(\"-\", fecha(";
_fecha2 = anywheresoftware.b4a.keywords.Common.Regex.Split("-",_fecha[(int) (0)]);
 //BA.debugLineNum = 988;BA.debugLine="Dim fecha3 As String = fecha2(2)&\"/\"&fecha2(1)&\"";
_fecha3 = _fecha2[(int) (2)]+"/"+_fecha2[(int) (1)]+"/"+_fecha2[(int) (0)];
 //BA.debugLineNum = 989;BA.debugLine="Log(fecha3)";
anywheresoftware.b4a.keywords.Common.LogImpl("314549003",_fecha3,0);
 //BA.debugLineNum = 990;BA.debugLine="Dim hora() As String = Regex.Split(\"\\.\", fecha(1";
_hora = anywheresoftware.b4a.keywords.Common.Regex.Split("\\.",_fecha[(int) (1)]);
 //BA.debugLineNum = 991;BA.debugLine="a = fecha3 & \" \" & hora(0)";
_a = _fecha3+" "+_hora[(int) (0)];
 //BA.debugLineNum = 992;BA.debugLine="c.Close";
_c.Close();
 }else if((_clienteasing.GetString("CUENTA")).equals("63403")) { 
 //BA.debugLineNum = 994;BA.debugLine="c = Starter.skmt.ExecQuery(\"select HVD_FECHA fro";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select HVD_FECHA from HIST_VENTAS")));
 //BA.debugLineNum = 995;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 996;BA.debugLine="Dim fecha() As String = Regex.Split(\" \", c.GetSt";
_fecha = anywheresoftware.b4a.keywords.Common.Regex.Split(" ",_c.GetString("HVD_FECHA"));
 //BA.debugLineNum = 997;BA.debugLine="Dim fecha2() As String = Regex.Split(\"-\", fecha(";
_fecha2 = anywheresoftware.b4a.keywords.Common.Regex.Split("-",_fecha[(int) (0)]);
 //BA.debugLineNum = 998;BA.debugLine="Dim fecha3 As String = fecha2(2)&\"/\"&fecha2(1)&\"";
_fecha3 = _fecha2[(int) (2)]+"/"+_fecha2[(int) (1)]+"/"+_fecha2[(int) (0)];
 //BA.debugLineNum = 999;BA.debugLine="Log(fecha3)";
anywheresoftware.b4a.keywords.Common.LogImpl("314549013",_fecha3,0);
 //BA.debugLineNum = 1000;BA.debugLine="Dim hora() As String = Regex.Split(\"\\.\", fecha(1";
_hora = anywheresoftware.b4a.keywords.Common.Regex.Split("\\.",_fecha[(int) (1)]);
 //BA.debugLineNum = 1001;BA.debugLine="a = fecha3 & \" \" & hora(0)";
_a = _fecha3+" "+_hora[(int) (0)];
 //BA.debugLineNum = 1002;BA.debugLine="c.Close";
_c.Close();
 };
 //BA.debugLineNum = 1004;BA.debugLine="Return a";
if (true) return _a;
 //BA.debugLineNum = 1005;BA.debugLine="End Sub";
return "";
}
public static String  _traefechareparto(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _fe = null;
String _f = "";
 //BA.debugLineNum = 703;BA.debugLine="Sub traeFechaReparto As String";
 //BA.debugLineNum = 704;BA.debugLine="Private fe As Cursor = Starter.skmt.ExecQuery(\"se";
_fe = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_fe = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select HVD_FECHA from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa)")));
 //BA.debugLineNum = 705;BA.debugLine="Private f As String = \"-\"";
_f = "-";
 //BA.debugLineNum = 706;BA.debugLine="If fe.RowCount > 0 Then";
if (_fe.getRowCount()>0) { 
 //BA.debugLineNum = 707;BA.debugLine="fe.Position = 0";
_fe.setPosition((int) (0));
 //BA.debugLineNum = 708;BA.debugLine="f = fe.GetString(\"HVD_FECHA\")";
_f = _fe.GetString("HVD_FECHA");
 };
 //BA.debugLineNum = 710;BA.debugLine="fe.Close";
_fe.Close();
 //BA.debugLineNum = 711;BA.debugLine="Return f";
if (true) return _f;
 //BA.debugLineNum = 712;BA.debugLine="End Sub";
return "";
}
public static int  _traemaxcantidad(anywheresoftware.b4a.BA _ba,String _cliente,String _prodid) throws Exception{
int _cant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cr = null;
 //BA.debugLineNum = 739;BA.debugLine="Sub traeMaxCantidad(cliente As String, prodId As S";
 //BA.debugLineNum = 740;BA.debugLine="Private cant As Int = 0";
_cant = (int) (0);
 //BA.debugLineNum = 741;BA.debugLine="Private cr As Cursor = Starter.skmt.ExecQuery($\"S";
_cr = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cr = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("Select hvd_cant from hist_ventas2 where hvd_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"' and hvd_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"))));
 //BA.debugLineNum = 743;BA.debugLine="If cr.RowCount > 0 Then";
if (_cr.getRowCount()>0) { 
 //BA.debugLineNum = 744;BA.debugLine="cr.Position = 0";
_cr.setPosition((int) (0));
 //BA.debugLineNum = 745;BA.debugLine="cant = cr.GetString(\"HVD_CANT\")";
_cant = (int)(Double.parseDouble(_cr.GetString("HVD_CANT")));
 };
 //BA.debugLineNum = 747;BA.debugLine="Return cant";
if (true) return _cant;
 //BA.debugLineNum = 748;BA.debugLine="End Sub";
return 0;
}
public static anywheresoftware.b4a.objects.collections.Map  _traemoscantymonto(anywheresoftware.b4a.BA _ba,b4a.example3.customlistview _clv) throws Exception{
int _cant = 0;
float _monto = 0f;
int _i = 0;
anywheresoftware.b4a.objects.B4XViewWrapper _p0 = null;
anywheresoftware.b4a.objects.B4XViewWrapper _p = null;
anywheresoftware.b4a.objects.B4XViewWrapper _cant1 = null;
anywheresoftware.b4a.objects.B4XViewWrapper _cant2 = null;
anywheresoftware.b4a.objects.collections.List _estetag = null;
 //BA.debugLineNum = 811;BA.debugLine="Sub traemosCantYMonto(clv As CustomListView) As Ma";
 //BA.debugLineNum = 813;BA.debugLine="Private cant As Int = 0";
_cant = (int) (0);
 //BA.debugLineNum = 814;BA.debugLine="Private monto As Float = 0";
_monto = (float) (0);
 //BA.debugLineNum = 815;BA.debugLine="For i = 0 To clv.GetSize - 1";
{
final int step3 = 1;
final int limit3 = (int) (_clv._getsize()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
 //BA.debugLineNum = 816;BA.debugLine="Private p0 As B4XView = clv.GetPanel(i)";
_p0 = new anywheresoftware.b4a.objects.B4XViewWrapper();
_p0 = _clv._getpanel(_i);
 //BA.debugLineNum = 817;BA.debugLine="Private p As B4XView = p0.GetView(0)";
_p = new anywheresoftware.b4a.objects.B4XViewWrapper();
_p = _p0.GetView((int) (0));
 //BA.debugLineNum = 818;BA.debugLine="Private cant1 As B4XView = p.GetView(2).GetView(";
_cant1 = new anywheresoftware.b4a.objects.B4XViewWrapper();
_cant1 = _p.GetView((int) (2)).GetView((int) (3));
 //BA.debugLineNum = 819;BA.debugLine="Private cant2 As B4XView = p.GetView(3).GetView(";
_cant2 = new anywheresoftware.b4a.objects.B4XViewWrapper();
_cant2 = _p.GetView((int) (3)).GetView((int) (3));
 //BA.debugLineNum = 821;BA.debugLine="If cant1.text <> \"\" Then";
if ((_cant1.getText()).equals("") == false) { 
 //BA.debugLineNum = 822;BA.debugLine="If cant1.Text = \"\" Then cant1.Text = 0";
if ((_cant1.getText()).equals("")) { 
_cant1.setText(BA.ObjectToCharSequence(0));};
 //BA.debugLineNum = 823;BA.debugLine="Private esteTag As List = Regex.Split(\"\\|\", can";
_estetag = new anywheresoftware.b4a.objects.collections.List();
_estetag = anywheresoftware.b4a.keywords.Common.ArrayToList(anywheresoftware.b4a.keywords.Common.Regex.Split("\\|",BA.ObjectToString(_cant1.getTag())));
 //BA.debugLineNum = 825;BA.debugLine="If esteTag.Get(2) <> esteTag.Get(3) Then cant =";
if ((_estetag.Get((int) (2))).equals(_estetag.Get((int) (3))) == false) { 
_cant = (int) (_cant+(double)(Double.parseDouble(_cant1.getText())));};
 //BA.debugLineNum = 826;BA.debugLine="monto = monto + (esteTag.Get(0) * cant1.Text)";
_monto = (float) (_monto+((double)(BA.ObjectToNumber(_estetag.Get((int) (0))))*(double)(Double.parseDouble(_cant1.getText()))));
 }else {
 //BA.debugLineNum = 828;BA.debugLine="If cant2.Text = \"\" Then cant2.Text = 0";
if ((_cant2.getText()).equals("")) { 
_cant2.setText(BA.ObjectToCharSequence(0));};
 //BA.debugLineNum = 829;BA.debugLine="Private esteTag As List = Regex.Split(\"\\|\", can";
_estetag = new anywheresoftware.b4a.objects.collections.List();
_estetag = anywheresoftware.b4a.keywords.Common.ArrayToList(anywheresoftware.b4a.keywords.Common.Regex.Split("\\|",BA.ObjectToString(_cant2.getTag())));
 //BA.debugLineNum = 831;BA.debugLine="If esteTag.Get(2) <> esteTag.Get(3) Then cant =";
if ((_estetag.Get((int) (2))).equals(_estetag.Get((int) (3))) == false) { 
_cant = (int) (_cant+(double)(Double.parseDouble(_cant2.getText())));};
 //BA.debugLineNum = 832;BA.debugLine="monto = monto + (esteTag.Get(0) * cant2.Text)";
_monto = (float) (_monto+((double)(BA.ObjectToNumber(_estetag.Get((int) (0))))*(double)(Double.parseDouble(_cant2.getText()))));
 };
 }
};
 //BA.debugLineNum = 836;BA.debugLine="Return CreateMap(\"cantidad\":cant, \"monto\":monto)";
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("cantidad"),(Object)(_cant),(Object)("monto"),(Object)(_monto)});
 //BA.debugLineNum = 837;BA.debugLine="End Sub";
return null;
}
public static String  _traenombre(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
String _nombre = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _idc = null;
 //BA.debugLineNum = 597;BA.debugLine="Sub traeNombre(id As String) As String";
 //BA.debugLineNum = 598;BA.debugLine="Private nombre As String";
_nombre = "";
 //BA.debugLineNum = 599;BA.debugLine="Private idc As Cursor = kmt.ExecQuery($\"select HV";
_idc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_idc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery(("select HVD_PRONOMBRE from HIST_VENTAS where HVD_PROID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 600;BA.debugLine="idc.Position=0";
_idc.setPosition((int) (0));
 //BA.debugLineNum = 601;BA.debugLine="If idc.RowCount > 0 Then nombre = idc.GetString(\"";
if (_idc.getRowCount()>0) { 
_nombre = _idc.GetString("HVD_PRONOMBRE");};
 //BA.debugLineNum = 602;BA.debugLine="idc.Close";
_idc.Close();
 //BA.debugLineNum = 604;BA.debugLine="Return nombre";
if (true) return _nombre;
 //BA.debugLineNum = 605;BA.debugLine="End Sub";
return "";
}
public static String  _traeprecio(anywheresoftware.b4a.BA _ba,String _id,String _quepromo) throws Exception{
String _pu = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _idc = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pc = null;
 //BA.debugLineNum = 608;BA.debugLine="Sub traePrecio(id As String, quePromo As String) A";
 //BA.debugLineNum = 609;BA.debugLine="Private pu As String = \"0\"";
_pu = "0";
 //BA.debugLineNum = 611;BA.debugLine="If quePromo = traeAlmacen Then";
if ((_quepromo).equals(_traealmacen(_ba))) { 
 //BA.debugLineNum = 612;BA.debugLine="Private idc As Cursor = kmt.ExecQuery($\"select C";
_idc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_idc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery(("select CAT_GP_PRECIO from CAT_GUNAPROD where CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 613;BA.debugLine="If idc.RowCount > 0 Then";
if (_idc.getRowCount()>0) { 
 //BA.debugLineNum = 614;BA.debugLine="idc.Position=0";
_idc.setPosition((int) (0));
 //BA.debugLineNum = 615;BA.debugLine="If idc.RowCount > 0 And IsNumber(idc.GetString(";
if (_idc.getRowCount()>0 && anywheresoftware.b4a.keywords.Common.IsNumber(_idc.GetString("CAT_GP_PRECIO"))) { 
_pu = _idc.GetString("CAT_GP_PRECIO");};
 };
 //BA.debugLineNum = 618;BA.debugLine="idc.Close";
_idc.Close();
 }else {
 //BA.debugLineNum = 620;BA.debugLine="Private pc As Cursor = Starter.skmt.ExecQuery($\"";
_pc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_pc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select HVD_CANT, HVD_COSTO_TOT from HIST_VENTAS2 where HVD_CLIENTE in (select cuenta from cuentaa) and HVD_PROID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"' and HVD_CODPROMO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_quepromo))+"'"))));
 //BA.debugLineNum = 621;BA.debugLine="If pc.RowCount > 0 Then";
if (_pc.getRowCount()>0) { 
 //BA.debugLineNum = 622;BA.debugLine="pc.Position = 0";
_pc.setPosition((int) (0));
 //BA.debugLineNum = 624;BA.debugLine="If pc.GetString(\"HVD_COSTO_TOT\")<> Null And pc.";
if (_pc.GetString("HVD_COSTO_TOT")!= null && _pc.GetString("HVD_CANT")!= null) { 
 //BA.debugLineNum = 625;BA.debugLine="pu = pc.GetString(\"HVD_COSTO_TOT\") / pc.GetStr";
_pu = BA.NumberToString((double)(Double.parseDouble(_pc.GetString("HVD_COSTO_TOT")))/(double)(double)(Double.parseDouble(_pc.GetString("HVD_CANT"))));
 };
 };
 //BA.debugLineNum = 629;BA.debugLine="pc.Close";
_pc.Close();
 };
 //BA.debugLineNum = 632;BA.debugLine="Return pu";
if (true) return _pu;
 //BA.debugLineNum = 634;BA.debugLine="End Sub";
return "";
}
public static String  _traeprecio2(anywheresoftware.b4a.BA _ba,String _id,String _quepromo,String _consecutivo) throws Exception{
String _pu = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _idc = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pc = null;
 //BA.debugLineNum = 637;BA.debugLine="Sub traePrecio2(id As String, quePromo As String,";
 //BA.debugLineNum = 638;BA.debugLine="Private pu As String = \"0\"";
_pu = "0";
 //BA.debugLineNum = 640;BA.debugLine="If quePromo = traeAlmacen Then";
if ((_quepromo).equals(_traealmacen(_ba))) { 
 //BA.debugLineNum = 641;BA.debugLine="Private idc As Cursor = kmt.ExecQuery($\"select C";
_idc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_idc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery(("select CAT_GP_PRECIO from CAT_GUNAPROD where CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 642;BA.debugLine="If idc.RowCount > 0 Then";
if (_idc.getRowCount()>0) { 
 //BA.debugLineNum = 643;BA.debugLine="idc.Position=0";
_idc.setPosition((int) (0));
 //BA.debugLineNum = 644;BA.debugLine="If idc.RowCount > 0 And IsNumber(idc.GetString(";
if (_idc.getRowCount()>0 && anywheresoftware.b4a.keywords.Common.IsNumber(_idc.GetString("CAT_GP_PRECIO"))) { 
_pu = _idc.GetString("CAT_GP_PRECIO");};
 };
 //BA.debugLineNum = 647;BA.debugLine="idc.Close";
_idc.Close();
 }else {
 //BA.debugLineNum = 649;BA.debugLine="Private pc As Cursor = Starter.skmt.ExecQuery($\"";
_pc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_pc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select HVD_CANT, HVD_COSTO_TOT from HIST_VENTAS where HVD_CLIENTE in (select cuenta from cuentaa) and HVD_PROID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"' and HVD_CODPROMO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_quepromo))+"' AND CONSECUTIVO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_consecutivo))+"'"))));
 //BA.debugLineNum = 650;BA.debugLine="If pc.RowCount > 0 Then";
if (_pc.getRowCount()>0) { 
 //BA.debugLineNum = 651;BA.debugLine="pc.Position = 0";
_pc.setPosition((int) (0));
 //BA.debugLineNum = 653;BA.debugLine="If pc.GetString(\"HVD_COSTO_TOT\")<> Null And pc.";
if (_pc.GetString("HVD_COSTO_TOT")!= null && _pc.GetString("HVD_CANT")!= null) { 
 //BA.debugLineNum = 654;BA.debugLine="pu = pc.GetString(\"HVD_COSTO_TOT\") / pc.GetStr";
_pu = BA.NumberToString((double)(Double.parseDouble(_pc.GetString("HVD_COSTO_TOT")))/(double)(double)(Double.parseDouble(_pc.GetString("HVD_CANT"))));
 };
 };
 //BA.debugLineNum = 658;BA.debugLine="pc.Close";
_pc.Close();
 };
 //BA.debugLineNum = 661;BA.debugLine="Return pu";
if (true) return _pu;
 //BA.debugLineNum = 663;BA.debugLine="End Sub";
return "";
}
public static String  _traeprecioc(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
String _pu = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _idc = null;
 //BA.debugLineNum = 666;BA.debugLine="Sub traePrecioC(id As String) As String";
 //BA.debugLineNum = 667;BA.debugLine="Private pu As String = \"0\"";
_pu = "0";
 //BA.debugLineNum = 668;BA.debugLine="Private idc As Cursor = kmt.ExecQuery($\"select PR";
_idc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_idc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_kmt.ExecQuery(("select PRECIOCONVER from CAT_GUNAPROD where CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 669;BA.debugLine="If idc.RowCount > 0 Then";
if (_idc.getRowCount()>0) { 
 //BA.debugLineNum = 670;BA.debugLine="idc.Position=0";
_idc.setPosition((int) (0));
 //BA.debugLineNum = 671;BA.debugLine="If idc.RowCount > 0 And IsNumber(idc.GetString(\"";
if (_idc.getRowCount()>0 && anywheresoftware.b4a.keywords.Common.IsNumber(_idc.GetString("PRECIOCONVER"))) { 
_pu = _idc.GetString("PRECIOCONVER");};
 };
 //BA.debugLineNum = 674;BA.debugLine="idc.Close";
_idc.Close();
 //BA.debugLineNum = 675;BA.debugLine="Return pu";
if (true) return _pu;
 //BA.debugLineNum = 676;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _traerechazados(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.objects.collections.Map _m = null;
int _cant = 0;
String _monto = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _rc = null;
 //BA.debugLineNum = 888;BA.debugLine="Sub traeRechazados As Map";
 //BA.debugLineNum = 889;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 890;BA.debugLine="Private cant As Int = 0";
_cant = (int) (0);
 //BA.debugLineNum = 891;BA.debugLine="Private monto As String = 0";
_monto = BA.NumberToString(0);
 //BA.debugLineNum = 892;BA.debugLine="Private rc As Cursor = Starter.skmt.ExecQuery($\"s";
_rc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_rc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select sum(REP_CANT) as CUANTOS, sum(REP_CANT * REP_PRECIO) as CUANTO from REPARTO where REP_RECHAZO = '1' and REP_CANT <> '0'"))));
 //BA.debugLineNum = 893;BA.debugLine="If rc.RowCount > 0 Then";
if (_rc.getRowCount()>0) { 
 //BA.debugLineNum = 894;BA.debugLine="rc.Position = 0";
_rc.setPosition((int) (0));
 //BA.debugLineNum = 895;BA.debugLine="If rc.GetString(\"CUANTOS\") <> Null Then";
if (_rc.GetString("CUANTOS")!= null) { 
 //BA.debugLineNum = 896;BA.debugLine="cant = cant + rc.GetString(\"CUANTOS\")";
_cant = (int) (_cant+(double)(Double.parseDouble(_rc.GetString("CUANTOS"))));
 //BA.debugLineNum = 897;BA.debugLine="monto = monto + rc.GetString(\"CUANTO\")";
_monto = BA.NumberToString((double)(Double.parseDouble(_monto))+(double)(Double.parseDouble(_rc.GetString("CUANTO"))));
 };
 };
 //BA.debugLineNum = 901;BA.debugLine="Return CreateMap(\"cantidad\": cant, \"monto\": monto";
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("cantidad"),(Object)(_cant),(Object)("monto"),(Object)(_monto)});
 //BA.debugLineNum = 902;BA.debugLine="End Sub";
return null;
}
public static String  _traerutaprev(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _a = "";
 //BA.debugLineNum = 1007;BA.debugLine="Sub traerUTAPREV As String 'ignore";
 //BA.debugLineNum = 1008;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1009;BA.debugLine="Private a As String";
_a = "";
 //BA.debugLineNum = 1010;BA.debugLine="c = Starter.skmt.ExecQuery(\"select CAT_CL_RUTA fr";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._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 = 1011;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1012;BA.debugLine="a = C.GetString(\"CAT_CL_RUTA\")";
_a = _c.GetString("CAT_CL_RUTA");
 //BA.debugLineNum = 1013;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1014;BA.debugLine="Return a";
if (true) return _a;
 //BA.debugLineNum = 1015;BA.debugLine="End Sub";
return "";
}
public static String  _traerutareparto(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
 //BA.debugLineNum = 943;BA.debugLine="Sub traeRutaReparto As String 'ignore";
 //BA.debugLineNum = 944;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 945;BA.debugLine="Private r As String";
_r = "";
 //BA.debugLineNum = 946;BA.debugLine="c=Starter.skmt.ExecQuery(\"select RUTAA from RUTAA";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select RUTAA from RUTAA")));
 //BA.debugLineNum = 947;BA.debugLine="r = \"0\"";
_r = "0";
 //BA.debugLineNum = 948;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 949;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 950;BA.debugLine="r = c.GetString(\"RUTAA\")";
_r = _c.GetString("RUTAA");
 };
 //BA.debugLineNum = 952;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 953;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 954;BA.debugLine="End Sub";
return "";
}
public static String  _traeusuario(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _a = "";
 //BA.debugLineNum = 967;BA.debugLine="Sub traeUsuario As String 'ignore";
 //BA.debugLineNum = 968;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 969;BA.debugLine="Private a As String";
_a = "";
 //BA.debugLineNum = 970;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)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select USUARIO from USUARIOA")));
 //BA.debugLineNum = 971;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 972;BA.debugLine="a = C.GetString(\"USUARIO\")";
_a = _c.GetString("USUARIO");
 //BA.debugLineNum = 973;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 974;BA.debugLine="Return a";
if (true) return _a;
 //BA.debugLineNum = 975;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _traevendidos(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.objects.collections.Map _m = null;
int _cant = 0;
String _monto = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _rc = null;
 //BA.debugLineNum = 905;BA.debugLine="Sub traeVendidos As Map";
 //BA.debugLineNum = 906;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 907;BA.debugLine="Private cant As Int = 0";
_cant = (int) (0);
 //BA.debugLineNum = 908;BA.debugLine="Private monto As String = 0";
_monto = BA.NumberToString(0);
 //BA.debugLineNum = 909;BA.debugLine="Private rc As Cursor = Starter.skmt.ExecQuery($\"s";
_rc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_rc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select sum(REP_CANT) as CUANTOS, sum(REP_CANT * REP_PRECIO) as CUANTO from REPARTO where REP_RECHAZO = '0' and REP_CANT <> '0'"))));
 //BA.debugLineNum = 910;BA.debugLine="If rc.RowCount > 0 Then";
if (_rc.getRowCount()>0) { 
 //BA.debugLineNum = 911;BA.debugLine="rc.Position = 0";
_rc.setPosition((int) (0));
 //BA.debugLineNum = 912;BA.debugLine="If rc.GetString(\"CUANTOS\") <> Null Then";
if (_rc.GetString("CUANTOS")!= null) { 
 //BA.debugLineNum = 913;BA.debugLine="cant = cant + rc.GetString(\"CUANTOS\")";
_cant = (int) (_cant+(double)(Double.parseDouble(_rc.GetString("CUANTOS"))));
 //BA.debugLineNum = 914;BA.debugLine="monto = monto + rc.GetString(\"CUANTO\")";
_monto = BA.NumberToString((double)(Double.parseDouble(_monto))+(double)(Double.parseDouble(_rc.GetString("CUANTO"))));
 };
 };
 //BA.debugLineNum = 918;BA.debugLine="Return CreateMap(\"cantidad\": cant, \"monto\": monto";
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("cantidad"),(Object)(_cant),(Object)("monto"),(Object)(_monto)});
 //BA.debugLineNum = 919;BA.debugLine="End Sub";
return null;
}
}
