package gunav2.keymon.com.mx;


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 static boolean _subslogs = false;
public static anywheresoftware.b4a.sql.SQL _skmt = null;
public static anywheresoftware.b4a.objects.IntentWrapper _in = null;
public static boolean _intentusado = false;
public b4a.example.dateutils _dateutils = null;
public gunav2.keymon.com.mx.main _main = null;
public gunav2.keymon.com.mx.starter _starter = null;
public gunav2.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public gunav2.keymon.com.mx.appupdater _appupdater = null;
public gunav2.keymon.com.mx.firebasemessaging _firebasemessaging = null;
public gunav2.keymon.com.mx.tracker _tracker = null;
public gunav2.keymon.com.mx.newinst2 _newinst2 = null;
public gunav2.keymon.com.mx.b4xpages _b4xpages = null;
public gunav2.keymon.com.mx.b4xcollections _b4xcollections = null;
public gunav2.keymon.com.mx.httputils2service _httputils2service = null;
public gunav2.keymon.com.mx.xuiviewsutils _xuiviewsutils = null;
public static String  _actualizaproducto(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,String _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _dev,String _futuro,String _aplicades) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _antcant = 0;
int _difcant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pe = null;
 //BA.debugLineNum = 1781;BA.debugLine="Sub actualizaProducto(cedis As String, costoU As S";
 //BA.debugLineNum = 1782;BA.debugLine="If nombre.Length < 6 Then ToastMessageShow(\"(actu";
if (_nombre.length()<6) { 
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("(actualizaProducto) El nombre del producto no es valido "+_nombre),anywheresoftware.b4a.keywords.Common.True);};
 //BA.debugLineNum = 1783;BA.debugLine="precioSin = NumberFormat2(precioSin, 1, 2, 2, Fal";
_preciosin = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_preciosin)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1784;BA.debugLine="costoU = NumberFormat2(costoU, 1, 2, 2, False)";
_costou = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_costou)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1785;BA.debugLine="LogColor($\"actualizaProducto, c=${clienteId}, p=$";
anywheresoftware.b4a.keywords.Common.LogImpl("412451844",("actualizaProducto, c="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+", p="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+", nombre="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_nombre))+", cant="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+", cedis="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+", tipo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipoventa))+""),anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 1788;BA.debugLine="If dev = 0 Then";
if ((_dev).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1789;BA.debugLine="Private c As Cursor=Starter.skmt.ExecQuery($\"sel";
_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 * from pedido where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' and PE_CEDIS <> 'DUR' AND PE_FUTURO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_futuro))+"'"))));
 //BA.debugLineNum = 1790;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1792;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1793;BA.debugLine="Private antCant As Int = 0";
_antcant = (int) (0);
 //BA.debugLineNum = 1794;BA.debugLine="If IsNumber(c.GetInt(\"PE_CANT\")) Then antCant=c";
if (anywheresoftware.b4a.keywords.Common.IsNumber(BA.NumberToString(_c.GetInt("PE_CANT")))) { 
_antcant = _c.GetInt("PE_CANT");};
 //BA.debugLineNum = 1795;BA.debugLine="Private difCant As Int = cant - antCant";
_difcant = (int) ((double)(Double.parseDouble(_cant))-_antcant);
 //BA.debugLineNum = 1796;BA.debugLine="Starter.skmt.ExecNonQuery($\"update pedido set p";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update pedido set pe_cant = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+", pe_costo_tot = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.NumberFormat2(((double)(Double.parseDouble(_cant))*(double)(Double.parseDouble(_c.GetString("PE_COSTOU")))),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)))+", pe_folio = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipoventa))+"' where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FUTURO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_futuro))+"' "));
 //BA.debugLineNum = 1797;BA.debugLine="If cedis <> \"DUR\" Then Starter.skmt.ExecNonQuer";
if ((_cedis).equals("DUR") == false) { 
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_tipoventa)))+" set cat_gp_almacen = cat_gp_almacen - ("+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_difcant))+") where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' "));};
 //BA.debugLineNum = 1798;BA.debugLine="If cant = 0 Then";
if ((_cant).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1799;BA.debugLine="LogColor($\"BORRAMOS PRODUCTO - ${prodId}\"$, Co";
anywheresoftware.b4a.keywords.Common.LogImpl("412451858",("BORRAMOS PRODUCTO - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+""),anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 1800;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedido";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FUTURO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_futuro))+"' "));
 //BA.debugLineNum = 1801;BA.debugLine="Log($\"Borramos pe_cedis='${cedis}' and pe_proi";
anywheresoftware.b4a.keywords.Common.LogImpl("412451860",("Borramos pe_cedis='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"'"),0);
 //BA.debugLineNum = 1802;BA.debugLine="Private pe As Cursor = Starter.skmt.ExecQuery(";
_pe = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_pe = (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(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")));
 //BA.debugLineNum = 1803;BA.debugLine="pe.Position=0";
_pe.setPosition((int) (0));
 //BA.debugLineNum = 1804;BA.debugLine="If pe.GetString(\"cuantosPedidos\") = 0 Then";
if ((_pe.GetString("cuantosPedidos")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1805;BA.debugLine="Log(\"######    delete from pedido_cliente - \"";
anywheresoftware.b4a.keywords.Common.LogImpl("412451864","######    delete from pedido_cliente - "+_traecliente(_ba)+"|"+_clienteid,0);
 //BA.debugLineNum = 1806;BA.debugLine="Log($\"delete from pedido_cliente where PC_CLI";
anywheresoftware.b4a.keywords.Common.LogImpl("412451865",("delete from pedido_cliente where PC_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"),0);
 //BA.debugLineNum = 1807;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedid";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido_cliente where PC_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"));
 };
 };
 }else {
 //BA.debugLineNum = 1813;BA.debugLine="If cant > 0 Then guardaProductoSinGestion(cedis";
if ((double)(Double.parseDouble(_cant))>0) { 
_guardaproductosingestion(_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_futuro,_aplicades);};
 };
 //BA.debugLineNum = 1815;BA.debugLine="c.Close";
_c.Close();
 }else if((_dev).equals(BA.NumberToString(1))) { 
 //BA.debugLineNum = 1817;BA.debugLine="Private c As Cursor=Starter.skmt.ExecQuery($\"sel";
_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 * from pedido where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' and PE_CEDIS = 'DUR' AND PE_FUTURO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_futuro))+"' "))));
 //BA.debugLineNum = 1818;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1820;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1821;BA.debugLine="Private antCant As Int = 0";
_antcant = (int) (0);
 //BA.debugLineNum = 1822;BA.debugLine="If IsNumber(c.GetInt(\"PE_CANT\")) Then antCant=c";
if (anywheresoftware.b4a.keywords.Common.IsNumber(BA.NumberToString(_c.GetInt("PE_CANT")))) { 
_antcant = _c.GetInt("PE_CANT");};
 //BA.debugLineNum = 1823;BA.debugLine="Private difCant As Int = cant - antCant";
_difcant = (int) ((double)(Double.parseDouble(_cant))-_antcant);
 //BA.debugLineNum = 1824;BA.debugLine="Starter.skmt.ExecNonQuery($\"update pedido set p";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update pedido set pe_cant = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+", pe_costo_tot = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.NumberFormat2(((double)(Double.parseDouble(_cant))*(double)(Double.parseDouble(_c.GetString("PE_COSTOU")))),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)))+", pe_folio = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipoventa))+"' where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FUTURO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_futuro))+"' "));
 //BA.debugLineNum = 1825;BA.debugLine="If cedis <> \"DUR\" Then Starter.skmt.ExecNonQuer";
if ((_cedis).equals("DUR") == false) { 
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_tipoventa)))+" set cat_gp_almacen = cat_gp_almacen - ("+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_difcant))+") where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' "));};
 //BA.debugLineNum = 1826;BA.debugLine="If cant = 0 Then";
if ((_cant).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1827;BA.debugLine="LogColor($\"BORRAMOS PRODUCTO - ${prodId}\"$, Co";
anywheresoftware.b4a.keywords.Common.LogImpl("412451886",("BORRAMOS PRODUCTO - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+""),anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 1828;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedido";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FUTURO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_futuro))+"' "));
 //BA.debugLineNum = 1829;BA.debugLine="Log($\"Borramos pe_cedis='${cedis}' and pe_proi";
anywheresoftware.b4a.keywords.Common.LogImpl("412451888",("Borramos pe_cedis='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"'"),0);
 //BA.debugLineNum = 1830;BA.debugLine="Private pe As Cursor = Starter.skmt.ExecQuery(";
_pe = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_pe = (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(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")));
 //BA.debugLineNum = 1831;BA.debugLine="pe.Position=0";
_pe.setPosition((int) (0));
 //BA.debugLineNum = 1832;BA.debugLine="If pe.GetString(\"cuantosPedidos\") = 0 Then";
if ((_pe.GetString("cuantosPedidos")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1833;BA.debugLine="Log(\"######    delete from pedido_cliente - \"";
anywheresoftware.b4a.keywords.Common.LogImpl("412451892","######    delete from pedido_cliente - "+_traecliente(_ba)+"|"+_clienteid,0);
 //BA.debugLineNum = 1834;BA.debugLine="Log($\"delete from pedido_cliente where PC_CLI";
anywheresoftware.b4a.keywords.Common.LogImpl("412451893",("delete from pedido_cliente where PC_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"),0);
 //BA.debugLineNum = 1835;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedid";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido_cliente where PC_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"));
 };
 };
 }else {
 //BA.debugLineNum = 1841;BA.debugLine="If cant > 0 Then guardaProductoSinGestion(cedis";
if ((double)(Double.parseDouble(_cant))>0) { 
_guardaproductosingestion(_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_futuro,_aplicades);};
 };
 //BA.debugLineNum = 1843;BA.debugLine="c.Close";
_c.Close();
 };
 //BA.debugLineNum = 1846;BA.debugLine="End Sub";
return "";
}
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 = 1312;BA.debugLine="Sub agregaColumna(tabla As String, columna As Stri";
 //BA.debugLineNum = 1313;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try { //BA.debugLineNum = 1314;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exe";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._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 = 1315;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1316;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1317;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._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 = 1318;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("411272198",("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 = 1322;BA.debugLine="Try";
try { //BA.debugLineNum = 1323;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._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 = 1324;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("411272204",("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 = 1326;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("411272206",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 //BA.debugLineNum = 1328;BA.debugLine="Log(2)";
anywheresoftware.b4a.keywords.Common.LogImpl("411272208",BA.NumberToString(2),0);
 };
 //BA.debugLineNum = 1330;BA.debugLine="End Sub";
return "";
}
public static boolean  _alcanzanlosvariablesparapromo(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _promomap,anywheresoftware.b4a.objects.collections.Map _inventariosinfijos) throws Exception{
boolean _thislog = false;
int _totalprodsvariables = 0;
int _totalprodsvariables2 = 0;
anywheresoftware.b4a.objects.collections.List _prodsvariables = null;
anywheresoftware.b4a.objects.collections.List _prodsvariables2 = null;
int _p = 0;
String _t = "";
String _p2 = "";
boolean _res = false;
boolean _res1 = false;
boolean _res2 = false;
 //BA.debugLineNum = 2197;BA.debugLine="Sub alcanzanLosVariablesParaPromo(promoMap As Map,";
 //BA.debugLineNum = 2198;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 2199;BA.debugLine="If thisLog Then LogColor(\"Inventario inicial: \"&i";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413434882","Inventario inicial: "+BA.ObjectToString(_inventariosinfijos),anywheresoftware.b4a.keywords.Common.Colors.Gray);};
 //BA.debugLineNum = 2200;BA.debugLine="Private totalProdsVariables As Int = 0";
_totalprodsvariables = (int) (0);
 //BA.debugLineNum = 2201;BA.debugLine="Private totalProdsVariables2 As Int = 0";
_totalprodsvariables2 = (int) (0);
 //BA.debugLineNum = 2203;BA.debugLine="Private prodsVariables As List = promoMap.get(\"pr";
_prodsvariables = new anywheresoftware.b4a.objects.collections.List();
_prodsvariables = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_promomap.Get((Object)("prodsVariables"))));
 //BA.debugLineNum = 2204;BA.debugLine="Private prodsVariables2 As List = promoMap.get(\"p";
_prodsvariables2 = new anywheresoftware.b4a.objects.collections.List();
_prodsvariables2 = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_promomap.Get((Object)("prodsVariables2"))));
 //BA.debugLineNum = 2205;BA.debugLine="For p = 0 To prodsVariables.Size - 1";
{
final int step7 = 1;
final int limit7 = (int) (_prodsvariables.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit7 ;_p = _p + step7 ) {
 //BA.debugLineNum = 2206;BA.debugLine="Private t As String = prodsVariables.Get(p) 'Obt";
_t = BA.ObjectToString(_prodsvariables.Get(_p));
 //BA.debugLineNum = 2208;BA.debugLine="If inventarioSinFijos.ContainsKey(t) Then 'Si ex";
if (_inventariosinfijos.ContainsKey((Object)(_t))) { 
 //BA.debugLineNum = 2209;BA.debugLine="Private p2 As String = inventarioSinFijos.Get(t";
_p2 = BA.ObjectToString(_inventariosinfijos.Get((Object)(_t)));
 //BA.debugLineNum = 2211;BA.debugLine="totalProdsVariables = totalProdsVariables + p2";
_totalprodsvariables = (int) (_totalprodsvariables+(double)(Double.parseDouble(_p2)));
 //BA.debugLineNum = 2213;BA.debugLine="If thisLog Then Log($\"prod ${t}, hay: ${p2}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413434896",("prod "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+", hay: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_p2))+""),0);};
 };
 }
};
 //BA.debugLineNum = 2216;BA.debugLine="For p = 0 To prodsVariables2.Size - 1";
{
final int step15 = 1;
final int limit15 = (int) (_prodsvariables2.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit15 ;_p = _p + step15 ) {
 //BA.debugLineNum = 2217;BA.debugLine="Private t As String = prodsVariables2.Get(p) 'Ob";
_t = BA.ObjectToString(_prodsvariables2.Get(_p));
 //BA.debugLineNum = 2218;BA.debugLine="If inventarioSinFijos.ContainsKey(t) Then 'Si ex";
if (_inventariosinfijos.ContainsKey((Object)(_t))) { 
 //BA.debugLineNum = 2219;BA.debugLine="Private p2 As String = inventarioSinFijos.Get(t";
_p2 = BA.ObjectToString(_inventariosinfijos.Get((Object)(_t)));
 //BA.debugLineNum = 2220;BA.debugLine="totalProdsVariables2 = totalProdsVariables2 + p";
_totalprodsvariables2 = (int) (_totalprodsvariables2+(double)(Double.parseDouble(_p2)));
 //BA.debugLineNum = 2221;BA.debugLine="If thisLog Then Log($\"prod ${t}, hay: ${p2}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413434904",("prod "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+", hay: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_p2))+""),0);};
 };
 }
};
 //BA.debugLineNum = 2224;BA.debugLine="If thisLog Then Log(\"Total prods variables=\" & to";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413434907","Total prods variables="+BA.NumberToString(_totalprodsvariables)+", requeridos="+BA.ObjectToString(_promomap.Get((Object)("prodsVariablesRequeridos"))),0);};
 //BA.debugLineNum = 2225;BA.debugLine="If thisLog Then Log(\"Total prods variables2=\" & t";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413434908","Total prods variables2="+BA.NumberToString(_totalprodsvariables2)+", requeridos2="+BA.ObjectToString(_promomap.Get((Object)("prodsVariables2Requeridos"))),0);};
 //BA.debugLineNum = 2226;BA.debugLine="Private res As Boolean = False";
_res = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 2227;BA.debugLine="Private res1 As Boolean = False";
_res1 = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 2228;BA.debugLine="Private res2 As Boolean = False";
_res2 = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 2233;BA.debugLine="If totalProdsVariables > 0 And totalProdsVariable";
if (_totalprodsvariables>0 && _totalprodsvariables>=(double)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariablesRequeridos"))))) { 
 //BA.debugLineNum = 2234;BA.debugLine="res1 = True 'Si el total de inventario de produc";
_res1 = anywheresoftware.b4a.keywords.Common.True;
 };
 //BA.debugLineNum = 2236;BA.debugLine="If promoMap.Get(\"prodsVariablesRequeridos\").As (I";
if (((int)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariablesRequeridos")))))==0) { 
_res1 = anywheresoftware.b4a.keywords.Common.True;};
 //BA.debugLineNum = 2237;BA.debugLine="If totalProdsVariables2 > 0 And totalProdsVariabl";
if (_totalprodsvariables2>0 && _totalprodsvariables2>=(double)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariables2Requeridos"))))) { 
 //BA.debugLineNum = 2238;BA.debugLine="res2 = True 'Si el total de inventario de produc";
_res2 = anywheresoftware.b4a.keywords.Common.True;
 };
 //BA.debugLineNum = 2240;BA.debugLine="If promoMap.Get(\"prodsVariables2Requeridos\").As(I";
if (((int)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariables2Requeridos")))))==0) { 
_res2 = anywheresoftware.b4a.keywords.Common.True;};
 //BA.debugLineNum = 2241;BA.debugLine="If res1 And res2 Then 'Solo si son verdadero los";
if (_res1 && _res2) { 
 //BA.debugLineNum = 2242;BA.debugLine="res = True";
_res = anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 2244;BA.debugLine="res = False";
_res = anywheresoftware.b4a.keywords.Common.False;
 };
 //BA.debugLineNum = 2247;BA.debugLine="Return res";
if (true) return _res;
 //BA.debugLineNum = 2248;BA.debugLine="End Sub";
return false;
}
public static String  _bitacora(anywheresoftware.b4a.BA _ba,String _fechab,String _usuariob,String _almacenb,String _rutab,String _eventob,String _clienteb,String _iniciob,String _finb,String _latitudb,String _longitudb,String _precision,String _motivonoventa,String _motivonovisita,String _ban_geob) throws Exception{
 //BA.debugLineNum = 1434;BA.debugLine="Sub bitacora(fechab As String, usuariob As String,";
 //BA.debugLineNum = 1476;BA.debugLine="End Sub";
return "";
}
public static String  _borraarribade100errores(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 449;BA.debugLine="Sub borraArribaDe100Errores 'ignore";
 //BA.debugLineNum = 450;BA.debugLine="revisaBD";
_revisabd(_ba);
 //BA.debugLineNum = 451;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("48585218","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 452;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 = 453;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 454;BA.debugLine="Log(\"Borramos mas de 100 de errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("48585221","Borramos mas de 100 de errorLog",0);
 //BA.debugLineNum = 455;BA.debugLine="End Sub";
return "";
}
public static String  _borraarribade600renglonesbitacora(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 458;BA.debugLine="Sub borraArribaDe600RenglonesBitacora 'ignore";
 //BA.debugLineNum = 459;BA.debugLine="revisaBD";
_revisabd(_ba);
 //BA.debugLineNum = 460;BA.debugLine="If Starter.logger Then LogColor(\"Recortamos la ta";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("48650754","Recortamos la tabla de la Bitacora, limite de 600",anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
 //BA.debugLineNum = 461;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 462;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"select fech";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select fecha from bitacora")));
 //BA.debugLineNum = 463;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 464;BA.debugLine="If c.RowCount > 650 Then";
if (_c.getRowCount()>650) { 
 //BA.debugLineNum = 465;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"DELETE FROM";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("DELETE FROM bitacora WHERE fecha NOT in (SELECT fecha FROM bitacora ORDER BY fecha desc LIMIT 599 )");
 //BA.debugLineNum = 466;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"vacuum;\")";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("vacuum;");
 };
 //BA.debugLineNum = 469;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 470;BA.debugLine="End Sub";
return "";
}
public static String  _borralogdb(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 333;BA.debugLine="Sub borraLogDB 'ignore";
 //BA.debugLineNum = 334;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("48388609","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 335;BA.debugLine="kmt.ExecNonQuery(\"delete from bitacora\")";
_kmt.ExecNonQuery("delete from bitacora");
 //BA.debugLineNum = 336;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 337;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 = 208;BA.debugLine="Sub borramosArchivoGPS 'ignore";
 //BA.debugLineNum = 209;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.getDirRootExternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 210;BA.debugLine="Dim s As String = \"\"";
_s = "";
 //BA.debugLineNum = 211;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
 //BA.debugLineNum = 212;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
 //BA.debugLineNum = 213;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 214;BA.debugLine="End Sub";
return "";
}
public static String  _borrapedidoclienteactual(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _thisc = null;
int _i = 0;
 //BA.debugLineNum = 737;BA.debugLine="Sub borraPedidoClienteActual As String";
 //BA.debugLineNum = 751;BA.debugLine="Private thisC As Cursor";
_thisc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 753;BA.debugLine="thisC=Starter.skmt.ExecQuery(\"select PE_PROID, PE";
_thisc = (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 PE_PROID, PE_CANT, PE_FOLIO FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) AND PE_CEDIS <> 'DUR'")));
 //BA.debugLineNum = 754;BA.debugLine="If thisC.RowCount>0 Then";
if (_thisc.getRowCount()>0) { 
 //BA.debugLineNum = 755;BA.debugLine="For i=0 To thisC.RowCount -1";
{
final int step4 = 1;
final int limit4 = (int) (_thisc.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
 //BA.debugLineNum = 756;BA.debugLine="thisC.Position = i";
_thisc.setPosition(_i);
 //BA.debugLineNum = 758;BA.debugLine="Starter.skmt.ExecNonQuery($\"update ${traeTablaP";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_thisc.GetString("PE_FOLIO"))))+" set cat_gp_almacen = cat_gp_almacen + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_CANT")))+" where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_PROID")))+"'"));
 //BA.debugLineNum = 759;BA.debugLine="LogColor($\"update ${traeTablaProds(thisC.GetStr";
anywheresoftware.b4a.keywords.Common.LogImpl("49961494",("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_thisc.GetString("PE_FOLIO"))))+" set cat_gp_almacen = cat_gp_almacen + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_CANT")))+" where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_PROID")))+"'"),anywheresoftware.b4a.keywords.Common.Colors.Red);
 }
};
 };
 //BA.debugLineNum = 763;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from pedido_cli";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)");
 //BA.debugLineNum = 764;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from pedido whe";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)");
 //BA.debugLineNum = 765;BA.debugLine="Starter.skmt.ExecNonQuery(\"UPDATE kmt_info set ge";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE kmt_info set gestion = 0  where CAT_CL_CODIGO In (select cuenta from cuentaa)");
 //BA.debugLineNum = 766;BA.debugLine="Return 1";
if (true) return BA.NumberToString(1);
 //BA.debugLineNum = 767;BA.debugLine="End Sub";
return "";
}
public static String  _buscadbusuario(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _usuario = "";
 //BA.debugLineNum = 611;BA.debugLine="Sub buscaDBUsuario As String 'ignore";
 //BA.debugLineNum = 612;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 613;BA.debugLine="Private usuario As String = \"SinUsuario\"";
_usuario = "SinUsuario";
 //BA.debugLineNum = 614;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 = 615;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 616;BA.debugLine="If c.RowCount > 0 Then usuario = c.GetString(\"USU";
if (_c.getRowCount()>0) { 
_usuario = _c.GetString("USUARIO");};
 //BA.debugLineNum = 617;BA.debugLine="Return usuario";
if (true) return _usuario;
 //BA.debugLineNum = 618;BA.debugLine="End Sub";
return "";
}
public static String  _calculatotalconpromoxrango(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
String _totalparcial = "";
String _total = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _cx = null;
int _i = 0;
 //BA.debugLineNum = 2251;BA.debugLine="Sub calculaTotalConPromoXRango(idCliente As String";
 //BA.debugLineNum = 2259;BA.debugLine="Private totalParcial As String = 0";
_totalparcial = BA.NumberToString(0);
 //BA.debugLineNum = 2260;BA.debugLine="Private total As String = 0";
_total = BA.NumberToString(0);
 //BA.debugLineNum = 2261;BA.debugLine="Private cx As Cursor = Starter.skmt.ExecQuery($\"s";
_cx = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cx = (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 *, ifnull(pe_reccant, 'N') as RECANT from pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"'"))));
 //BA.debugLineNum = 2262;BA.debugLine="If cx.RowCount > 0 Then";
if (_cx.getRowCount()>0) { 
 //BA.debugLineNum = 2263;BA.debugLine="For i = 0 To cx.RowCount - 1";
{
final int step5 = 1;
final int limit5 = (int) (_cx.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 2265;BA.debugLine="cx.Position = i";
_cx.setPosition(_i);
 //BA.debugLineNum = 2267;BA.debugLine="If cx.getstring(\"RECANT\") = \"N\" Then ' Sin prod";
if ((_cx.GetString("RECANT")).equals("N")) { 
 //BA.debugLineNum = 2268;BA.debugLine="totalParcial = cx.getstring(\"PE_COSTO_TOT\")";
_totalparcial = _cx.GetString("PE_COSTO_TOT");
 }else if((_cx.GetString("RECANT")).equals(_cx.GetString("PE_CANT"))) { 
 //BA.debugLineNum = 2270;BA.debugLine="totalParcial = cx.getstring(\"PE_RECALCULOTOT\")";
_totalparcial = _cx.GetString("PE_RECALCULOTOT");
 }else {
 //BA.debugLineNum = 2272;BA.debugLine="totalParcial = ((cx.getstring(\"PE_CANT\") - cx.";
_totalparcial = BA.NumberToString((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))+((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT")))));
 //BA.debugLineNum = 2273;BA.debugLine="Log($\"${((cx.getstring(\"PE_CANT\") - cx.getstri";
anywheresoftware.b4a.keywords.Common.LogImpl("413500438",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))))+" + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))))+" "),0);
 };
 //BA.debugLineNum = 2276;BA.debugLine="total = total + totalParcial";
_total = BA.NumberToString((double)(Double.parseDouble(_total))+(double)(Double.parseDouble(_totalparcial)));
 }
};
 };
 //BA.debugLineNum = 2279;BA.debugLine="cx.Close";
_cx.Close();
 //BA.debugLineNum = 2280;BA.debugLine="total = NumberFormat2(total, 1, 2, 2, False)";
_total = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_total)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 2282;BA.debugLine="Return total";
if (true) return _total;
 //BA.debugLineNum = 2283;BA.debugLine="End Sub";
return "";
}
public static String  _calculatotalconpromoxrango1(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
String _totalparcial = "";
String _total = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _cx = null;
int _i = 0;
 //BA.debugLineNum = 2286;BA.debugLine="Sub calculaTotalConPromoXRango1(idCliente As Strin";
 //BA.debugLineNum = 2294;BA.debugLine="Private totalParcial As String = 0";
_totalparcial = BA.NumberToString(0);
 //BA.debugLineNum = 2295;BA.debugLine="Private total As String = 0";
_total = BA.NumberToString(0);
 //BA.debugLineNum = 2296;BA.debugLine="Private cx As Cursor = Starter.skmt.ExecQuery($\"s";
_cx = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cx = (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 *, ifnull(pe_reccant, 'N') as RECANT from pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"' and PE_FUTURO = '1' "))));
 //BA.debugLineNum = 2297;BA.debugLine="If cx.RowCount > 0 Then";
if (_cx.getRowCount()>0) { 
 //BA.debugLineNum = 2298;BA.debugLine="For i = 0 To cx.RowCount - 1";
{
final int step5 = 1;
final int limit5 = (int) (_cx.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 2300;BA.debugLine="cx.Position = i";
_cx.setPosition(_i);
 //BA.debugLineNum = 2302;BA.debugLine="If cx.getstring(\"RECANT\") = \"N\" Then ' Sin prod";
if ((_cx.GetString("RECANT")).equals("N")) { 
 //BA.debugLineNum = 2303;BA.debugLine="totalParcial = cx.getstring(\"PE_COSTO_TOT\")";
_totalparcial = _cx.GetString("PE_COSTO_TOT");
 }else if((_cx.GetString("RECANT")).equals(_cx.GetString("PE_CANT"))) { 
 //BA.debugLineNum = 2305;BA.debugLine="totalParcial = cx.getstring(\"PE_RECALCULOTOT\")";
_totalparcial = _cx.GetString("PE_RECALCULOTOT");
 }else {
 //BA.debugLineNum = 2307;BA.debugLine="totalParcial = ((cx.getstring(\"PE_CANT\") - cx.";
_totalparcial = BA.NumberToString((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))+((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT")))));
 //BA.debugLineNum = 2308;BA.debugLine="Log($\"${((cx.getstring(\"PE_CANT\") - cx.getstri";
anywheresoftware.b4a.keywords.Common.LogImpl("413565974",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))))+" + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))))+" "),0);
 };
 //BA.debugLineNum = 2311;BA.debugLine="total = total + totalParcial";
_total = BA.NumberToString((double)(Double.parseDouble(_total))+(double)(Double.parseDouble(_totalparcial)));
 }
};
 };
 //BA.debugLineNum = 2314;BA.debugLine="cx.Close";
_cx.Close();
 //BA.debugLineNum = 2315;BA.debugLine="total = NumberFormat2(total, 1, 2, 2, False)";
_total = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_total)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 2317;BA.debugLine="Return total";
if (true) return _total;
 //BA.debugLineNum = 2318;BA.debugLine="End Sub";
return "";
}
public static String  _calculatotalconpromoxrango2(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
String _totalparcial = "";
String _total = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _cx = null;
int _i = 0;
 //BA.debugLineNum = 2322;BA.debugLine="Sub calculaTotalConPromoXRango2(idCliente As Strin";
 //BA.debugLineNum = 2330;BA.debugLine="Private totalParcial As String = 0";
_totalparcial = BA.NumberToString(0);
 //BA.debugLineNum = 2331;BA.debugLine="Private total As String = 0";
_total = BA.NumberToString(0);
 //BA.debugLineNum = 2332;BA.debugLine="Private cx As Cursor = Starter.skmt.ExecQuery($\"s";
_cx = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cx = (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 *, ifnull(pe_reccant, 'N') as RECANT from pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"' and PE_FUTURO = '0'  "))));
 //BA.debugLineNum = 2333;BA.debugLine="If cx.RowCount > 0 Then";
if (_cx.getRowCount()>0) { 
 //BA.debugLineNum = 2334;BA.debugLine="For i = 0 To cx.RowCount - 1";
{
final int step5 = 1;
final int limit5 = (int) (_cx.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 2336;BA.debugLine="cx.Position = i";
_cx.setPosition(_i);
 //BA.debugLineNum = 2338;BA.debugLine="If cx.getstring(\"RECANT\") = \"N\" Then ' Sin prod";
if ((_cx.GetString("RECANT")).equals("N")) { 
 //BA.debugLineNum = 2339;BA.debugLine="totalParcial = cx.getstring(\"PE_COSTO_TOT\")";
_totalparcial = _cx.GetString("PE_COSTO_TOT");
 }else if((_cx.GetString("RECANT")).equals(_cx.GetString("PE_CANT"))) { 
 //BA.debugLineNum = 2341;BA.debugLine="totalParcial = cx.getstring(\"PE_RECALCULOTOT\")";
_totalparcial = _cx.GetString("PE_RECALCULOTOT");
 }else {
 //BA.debugLineNum = 2343;BA.debugLine="totalParcial = ((cx.getstring(\"PE_CANT\") - cx.";
_totalparcial = BA.NumberToString((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))+((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT")))));
 //BA.debugLineNum = 2344;BA.debugLine="Log($\"${((cx.getstring(\"PE_CANT\") - cx.getstri";
anywheresoftware.b4a.keywords.Common.LogImpl("413631510",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))))+" + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))))+" "),0);
 };
 //BA.debugLineNum = 2347;BA.debugLine="total = total + totalParcial";
_total = BA.NumberToString((double)(Double.parseDouble(_total))+(double)(Double.parseDouble(_totalparcial)));
 }
};
 };
 //BA.debugLineNum = 2350;BA.debugLine="cx.Close";
_cx.Close();
 //BA.debugLineNum = 2351;BA.debugLine="total = NumberFormat2(total, 1, 2, 2, False)";
_total = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_total)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 2353;BA.debugLine="Return total";
if (true) return _total;
 //BA.debugLineNum = 2354;BA.debugLine="End Sub";
return "";
}
public static String  _calculatotalconpromoxrango3(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
String _total = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _cx = null;
int _i = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _precioprom = null;
 //BA.debugLineNum = 2357;BA.debugLine="Sub calculaTotalConPromoXRango3(idCliente As Strin";
 //BA.debugLineNum = 2366;BA.debugLine="Private total As String = 0";
_total = BA.NumberToString(0);
 //BA.debugLineNum = 2367;BA.debugLine="Private cx As Cursor = Starter.skmt.ExecQuery($\"s";
_cx = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cx = (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 pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"' and PE_FUTURO = '0' AND PE_PROID <> PE_CEDIS "))));
 //BA.debugLineNum = 2368;BA.debugLine="If cx.RowCount > 0 Then";
if (_cx.getRowCount()>0) { 
 //BA.debugLineNum = 2369;BA.debugLine="For i = 0 To cx.RowCount - 1";
{
final int step4 = 1;
final int limit4 = (int) (_cx.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
 //BA.debugLineNum = 2371;BA.debugLine="cx.Position = i";
_cx.setPosition(_i);
 //BA.debugLineNum = 2372;BA.debugLine="Log(\"***************************************\")";
anywheresoftware.b4a.keywords.Common.LogImpl("413697039","***************************************",0);
 //BA.debugLineNum = 2374;BA.debugLine="Dim precioprom As Cursor = Starter.skmt.ExecQue";
_precioprom = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_precioprom = (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_GP_PRECIO FROM CAT_GUNAPROD WHERE CAT_GP_NOMBRE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cx.GetString("PE_PRONOMBRE")))+"' "))));
 //BA.debugLineNum = 2375;BA.debugLine="If precioprom.RowCount > 0 Then";
if (_precioprom.getRowCount()>0) { 
 //BA.debugLineNum = 2376;BA.debugLine="precioprom.Position = 0";
_precioprom.setPosition((int) (0));
 //BA.debugLineNum = 2377;BA.debugLine="Log (precioprom.GETSTRING(\"CAT_GP_PRECIO\"))";
anywheresoftware.b4a.keywords.Common.LogImpl("413697044",_precioprom.GetString("CAT_GP_PRECIO"),0);
 //BA.debugLineNum = 2378;BA.debugLine="Log (cx.GETSTRING(\"PE_CANT\"))";
anywheresoftware.b4a.keywords.Common.LogImpl("413697045",_cx.GetString("PE_CANT"),0);
 //BA.debugLineNum = 2379;BA.debugLine="Log (cx.GETSTRING(\"PE_PRONOMBRE\"))";
anywheresoftware.b4a.keywords.Common.LogImpl("413697046",_cx.GetString("PE_PRONOMBRE"),0);
 //BA.debugLineNum = 2381;BA.debugLine="total = total + ((cx.GETSTRING(\"PE_CANT\")*prec";
_total = BA.NumberToString((double)(Double.parseDouble(_total))+(((double)(Double.parseDouble(_cx.GetString("PE_CANT")))*(double)(Double.parseDouble(_precioprom.GetString("CAT_GP_PRECIO"))))));
 };
 //BA.debugLineNum = 2385;BA.debugLine="Log($\"Total:${total} \"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("413697052",("Total:"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_total))+" "),0);
 }
};
 };
 //BA.debugLineNum = 2389;BA.debugLine="cx.Close";
_cx.Close();
 //BA.debugLineNum = 2390;BA.debugLine="total = NumberFormat2(total, 1, 2, 2, False)";
_total = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_total)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 2391;BA.debugLine="Log($\"Total con promocXrango = ${total}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("413697058",("Total con promocXrango = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_total))+""),0);
 //BA.debugLineNum = 2392;BA.debugLine="Return total";
if (true) return _total;
 //BA.debugLineNum = 2393;BA.debugLine="End Sub";
return "";
}
public static String  _calculatotalconpromoxrango4(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
String _total = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _cx = null;
int _i = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _precioprom = null;
 //BA.debugLineNum = 2396;BA.debugLine="Sub calculaTotalConPromoXRango4(idCliente As Strin";
 //BA.debugLineNum = 2405;BA.debugLine="Private total As String = 0";
_total = BA.NumberToString(0);
 //BA.debugLineNum = 2406;BA.debugLine="Private cx As Cursor = Starter.skmt.ExecQuery($\"s";
_cx = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cx = (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 pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"' and PE_FUTURO = '1' AND PE_PROID <> PE_CEDIS "))));
 //BA.debugLineNum = 2407;BA.debugLine="If cx.RowCount > 0 Then";
if (_cx.getRowCount()>0) { 
 //BA.debugLineNum = 2408;BA.debugLine="For i = 0 To cx.RowCount - 1";
{
final int step4 = 1;
final int limit4 = (int) (_cx.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
 //BA.debugLineNum = 2410;BA.debugLine="cx.Position = i";
_cx.setPosition(_i);
 //BA.debugLineNum = 2413;BA.debugLine="Dim precioprom As Cursor = Starter.skmt.ExecQue";
_precioprom = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_precioprom = (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_GP_PRECIO FROM CAT_GUNAPROD WHERE CAT_GP_NOMBRE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cx.GetString("PE_PRONOMBRE")))+"' "))));
 //BA.debugLineNum = 2414;BA.debugLine="If precioprom.RowCount > 0 Then";
if (_precioprom.getRowCount()>0) { 
 //BA.debugLineNum = 2415;BA.debugLine="precioprom.Position = 0";
_precioprom.setPosition((int) (0));
 //BA.debugLineNum = 2421;BA.debugLine="total = total + ((cx.GETSTRING(\"PE_CANT\")*prec";
_total = BA.NumberToString((double)(Double.parseDouble(_total))+(((double)(Double.parseDouble(_cx.GetString("PE_CANT")))*(double)(Double.parseDouble(_precioprom.GetString("CAT_GP_PRECIO"))))));
 };
 }
};
 };
 //BA.debugLineNum = 2429;BA.debugLine="cx.Close";
_cx.Close();
 //BA.debugLineNum = 2430;BA.debugLine="total = NumberFormat2(total, 1, 2, 2, False)";
_total = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_total)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 2432;BA.debugLine="Return total";
if (true) return _total;
 //BA.debugLineNum = 2433;BA.debugLine="End Sub";
return "";
}
public static String  _calculatotalconpromoxrango5(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
String _totalparcial = "";
String _total = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _cx = null;
int _i = 0;
 //BA.debugLineNum = 2436;BA.debugLine="Sub calculaTotalConPromoXRango5(idCliente As Strin";
 //BA.debugLineNum = 2444;BA.debugLine="Private totalParcial As String = 0";
_totalparcial = BA.NumberToString(0);
 //BA.debugLineNum = 2445;BA.debugLine="Private total As String = 0";
_total = BA.NumberToString(0);
 //BA.debugLineNum = 2446;BA.debugLine="Private cx As Cursor = Starter.skmt.ExecQuery($\"s";
_cx = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cx = (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 *, ifnull(pe_reccant, 'N') as RECANT from pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"' and PE_PROID IN (SELECT CAT_GP_ID FROM CAT_GUNAPROD WHERE CAT_GP_TIPO = 'CIGARRO')"))));
 //BA.debugLineNum = 2447;BA.debugLine="If cx.RowCount > 0 Then";
if (_cx.getRowCount()>0) { 
 //BA.debugLineNum = 2448;BA.debugLine="For i = 0 To cx.RowCount - 1";
{
final int step5 = 1;
final int limit5 = (int) (_cx.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 2450;BA.debugLine="cx.Position = i";
_cx.setPosition(_i);
 //BA.debugLineNum = 2452;BA.debugLine="If cx.getstring(\"RECANT\") = \"N\" Then ' Sin prod";
if ((_cx.GetString("RECANT")).equals("N")) { 
 //BA.debugLineNum = 2453;BA.debugLine="totalParcial = cx.getstring(\"PE_COSTO_TOT\")";
_totalparcial = _cx.GetString("PE_COSTO_TOT");
 }else if((_cx.GetString("RECANT")).equals(_cx.GetString("PE_CANT"))) { 
 //BA.debugLineNum = 2455;BA.debugLine="totalParcial = cx.getstring(\"PE_RECALCULOTOT\")";
_totalparcial = _cx.GetString("PE_RECALCULOTOT");
 }else {
 //BA.debugLineNum = 2457;BA.debugLine="totalParcial = ((cx.getstring(\"PE_CANT\") - cx.";
_totalparcial = BA.NumberToString((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))+((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT")))));
 //BA.debugLineNum = 2458;BA.debugLine="Log($\"${((cx.getstring(\"PE_CANT\") - cx.getstri";
anywheresoftware.b4a.keywords.Common.LogImpl("413828118",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))))+" + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))))+" "),0);
 };
 //BA.debugLineNum = 2461;BA.debugLine="total = total + totalParcial";
_total = BA.NumberToString((double)(Double.parseDouble(_total))+(double)(Double.parseDouble(_totalparcial)));
 }
};
 };
 //BA.debugLineNum = 2464;BA.debugLine="cx.Close";
_cx.Close();
 //BA.debugLineNum = 2465;BA.debugLine="total = NumberFormat2(total, 1, 2, 2, False)";
_total = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_total)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 2467;BA.debugLine="Return total";
if (true) return _total;
 //BA.debugLineNum = 2468;BA.debugLine="End Sub";
return "";
}
public static String  _calculatotalconpromoxrango6(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
String _totalparcial = "";
String _total = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _cx = null;
int _i = 0;
 //BA.debugLineNum = 2472;BA.debugLine="Sub calculaTotalConPromoXRango6(idCliente As Strin";
 //BA.debugLineNum = 2480;BA.debugLine="Private totalParcial As String = 0";
_totalparcial = BA.NumberToString(0);
 //BA.debugLineNum = 2481;BA.debugLine="Private total As String = 0";
_total = BA.NumberToString(0);
 //BA.debugLineNum = 2482;BA.debugLine="Private cx As Cursor = Starter.skmt.ExecQuery($\"s";
_cx = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cx = (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 *, ifnull(pe_reccant, 'N') as RECANT from pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"' AND PE_PROID IN (SELECT CAT_GP_ID FROM CAT_GUNAPROD WHERE CAT_GP_TIPO = 'PARTNERSHIP') "))));
 //BA.debugLineNum = 2483;BA.debugLine="If cx.RowCount > 0 Then";
if (_cx.getRowCount()>0) { 
 //BA.debugLineNum = 2484;BA.debugLine="For i = 0 To cx.RowCount - 1";
{
final int step5 = 1;
final int limit5 = (int) (_cx.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 2486;BA.debugLine="cx.Position = i";
_cx.setPosition(_i);
 //BA.debugLineNum = 2488;BA.debugLine="If cx.getstring(\"RECANT\") = \"N\" Then ' Sin prod";
if ((_cx.GetString("RECANT")).equals("N")) { 
 //BA.debugLineNum = 2489;BA.debugLine="totalParcial = cx.getstring(\"PE_COSTO_TOT\")";
_totalparcial = _cx.GetString("PE_COSTO_TOT");
 }else if((_cx.GetString("RECANT")).equals(_cx.GetString("PE_CANT"))) { 
 //BA.debugLineNum = 2491;BA.debugLine="totalParcial = cx.getstring(\"PE_RECALCULOTOT\")";
_totalparcial = _cx.GetString("PE_RECALCULOTOT");
 }else {
 //BA.debugLineNum = 2493;BA.debugLine="totalParcial = ((cx.getstring(\"PE_CANT\") - cx.";
_totalparcial = BA.NumberToString((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))+((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT")))));
 //BA.debugLineNum = 2494;BA.debugLine="Log($\"${((cx.getstring(\"PE_CANT\") - cx.getstri";
anywheresoftware.b4a.keywords.Common.LogImpl("413893654",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)((((double)(Double.parseDouble(_cx.GetString("PE_CANT")))-(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))*(double)(Double.parseDouble(_cx.GetString("PE_COSTOU"))))))+" + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(Double.parseDouble(_cx.GetString("PE_RECALCULO")))*(double)(Double.parseDouble(_cx.GetString("PE_RECCANT"))))))+" "),0);
 };
 //BA.debugLineNum = 2497;BA.debugLine="total = total + totalParcial";
_total = BA.NumberToString((double)(Double.parseDouble(_total))+(double)(Double.parseDouble(_totalparcial)));
 }
};
 };
 //BA.debugLineNum = 2500;BA.debugLine="cx.Close";
_cx.Close();
 //BA.debugLineNum = 2501;BA.debugLine="total = NumberFormat2(total, 1, 2, 2, False)";
_total = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_total)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 2503;BA.debugLine="Return total";
if (true) return _total;
 //BA.debugLineNum = 2504;BA.debugLine="End Sub";
return "";
}
public static String  _centraedittext(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.EditTextWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 606;BA.debugLine="Sub centraEditText(elemento As EditText, anchoElem";
 //BA.debugLineNum = 607;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 = 608;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 = 67;BA.debugLine="Sub centraListView(elemento As ListView, anchoElem";
 //BA.debugLineNum = 68;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 = 69;BA.debugLine="End Sub";
return "";
}
public static String  _centrapanel(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 592;BA.debugLine="Sub centraPanel(elemento As Panel, anchoElementoSu";
 //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  _centrapanelv(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _elemento,int _altoelementosuperior) throws Exception{
 //BA.debugLineNum = 597;BA.debugLine="Sub centraPanelV(elemento As Panel, altoElementoSu";
 //BA.debugLineNum = 598;BA.debugLine="elemento.Top = Round(altoElementoSuperior/2)-(ele";
_elemento.setTop((int) (anywheresoftware.b4a.keywords.Common.Round(_altoelementosuperior/(double)2)-(_elemento.getHeight()/(double)2)));
 //BA.debugLineNum = 599;BA.debugLine="End Sub";
return "";
}
public static String  _centraprogressbar(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ProgressBarWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 602;BA.debugLine="Sub centraProgressBar(elemento As ProgressBar, anc";
 //BA.debugLineNum = 603;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 = 604;BA.debugLine="End Sub";
return "";
}
public static String  _compress(anywheresoftware.b4a.BA _ba,String _str) throws Exception{
byte[] _compressed = null;
String _base64 = "";
 //BA.debugLineNum = 73;BA.debugLine="Sub compress(str As String) As String 'ignore";
 //BA.debugLineNum = 75;BA.debugLine="Dim compressed() As Byte = GZip.compress(str)";
_compressed = _gzip.compress(_str);
 //BA.debugLineNum = 78;BA.debugLine="Dim base64 As String = su.EncodeBase64(compressed";
_base64 = _su.EncodeBase64(_compressed);
 //BA.debugLineNum = 79;BA.debugLine="Log($\"Comprimido: ${base64.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("47077894",("Comprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_base64.length()))+""),0);
 //BA.debugLineNum = 81;BA.debugLine="Return base64";
if (true) return _base64;
 //BA.debugLineNum = 82;BA.debugLine="End Sub";
return "";
}
public static String  _copiadb(anywheresoftware.b4a.BA _ba,boolean _result) throws Exception{
String _p = "";
String _thedir = "";
 //BA.debugLineNum = 545;BA.debugLine="Sub copiaDB(result As Boolean) 'ignore";
 //BA.debugLineNum = 546;BA.debugLine="ToastMessageShow(\"copiaDB\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("copiaDB"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 547;BA.debugLine="If result Then";
if (_result) { 
 //BA.debugLineNum = 548;BA.debugLine="Dim p As String";
_p = "";
 //BA.debugLineNum = 549;BA.debugLine="If File.ExternalWritable Then";
if (anywheresoftware.b4a.keywords.Common.File.getExternalWritable()) { 
 //BA.debugLineNum = 550;BA.debugLine="p = File.DirRootExternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirRootExternal();
 }else {
 //BA.debugLineNum = 553;BA.debugLine="p = File.DirInternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 };
 //BA.debugLineNum = 556;BA.debugLine="Dim theDir As String";
_thedir = "";
 //BA.debugLineNum = 557;BA.debugLine="Try";
try { //BA.debugLineNum = 558;BA.debugLine="File.MakeDir(File.DirRootExternal,\"kmts\")";
anywheresoftware.b4a.keywords.Common.File.MakeDir(anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),"kmts");
 //BA.debugLineNum = 559;BA.debugLine="theDir = \"/kmts\"";
_thedir = "/kmts";
 } 
       catch (Exception e14) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e14); //BA.debugLineNum = 561;BA.debugLine="theDir = \"\"";
_thedir = "";
 };
 //BA.debugLineNum = 563;BA.debugLine="Try";
try { //BA.debugLineNum = 564;BA.debugLine="File.Copy(File.DirInternal,\"kmt.db\",File.DirRoo";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db",anywheresoftware.b4a.keywords.Common.File.getDirRootExternal()+_thedir,"cedex_kmt.db");
 //BA.debugLineNum = 565;BA.debugLine="File.Copy(File.DirInternal,\"errorLog.db\",File.D";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"errorLog.db",anywheresoftware.b4a.keywords.Common.File.getDirRootExternal()+_thedir,"cedex_errorLog.db");
 //BA.debugLineNum = 566;BA.debugLine="ToastMessageShow(\"BD copiada!\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("BD copiada!"),anywheresoftware.b4a.keywords.Common.False);
 } 
       catch (Exception e21) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e21); //BA.debugLineNum = 568;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 = 570;BA.debugLine="Log(\"rootExternal=\"&p)";
anywheresoftware.b4a.keywords.Common.LogImpl("48978457","rootExternal="+_p,0);
 //BA.debugLineNum = 571;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
anywheresoftware.b4a.keywords.Common.LogImpl("48978458","File.DirInternal="+anywheresoftware.b4a.keywords.Common.File.getDirInternal(),0);
 //BA.debugLineNum = 572;BA.debugLine="Log(\"File.DirRootExternal=\"&File.DirRootExternal";
anywheresoftware.b4a.keywords.Common.LogImpl("48978459","File.DirRootExternal="+anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),0);
 }else {
 //BA.debugLineNum = 574;BA.debugLine="ToastMessageShow(\"Sin permisos\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Sin permisos"),anywheresoftware.b4a.keywords.Common.False);
 };
 //BA.debugLineNum = 576;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper  _createbitmapwithnumber(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _originalbitmap,int _number) throws Exception{
anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _newbitmap = null;
anywheresoftware.b4a.objects.drawable.CanvasWrapper _canvas = null;
anywheresoftware.b4a.objects.drawable.CanvasWrapper.RectWrapper _destrect = null;
 //BA.debugLineNum = 42;BA.debugLine="Sub CreateBitmapWithNumber(OriginalBitmap As Bitma";
 //BA.debugLineNum = 43;BA.debugLine="Dim NewBitmap As Bitmap";
_newbitmap = new anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper();
 //BA.debugLineNum = 44;BA.debugLine="NewBitmap.InitializeMutable(OriginalBitmap.Width,";
_newbitmap.InitializeMutable(_originalbitmap.getWidth(),_originalbitmap.getHeight());
 //BA.debugLineNum = 45;BA.debugLine="Dim Canvas As Canvas";
_canvas = new anywheresoftware.b4a.objects.drawable.CanvasWrapper();
 //BA.debugLineNum = 46;BA.debugLine="Canvas.Initialize2(NewBitmap)";
_canvas.Initialize2((android.graphics.Bitmap)(_newbitmap.getObject()));
 //BA.debugLineNum = 48;BA.debugLine="Dim DestRect As Rect";
_destrect = new anywheresoftware.b4a.objects.drawable.CanvasWrapper.RectWrapper();
 //BA.debugLineNum = 49;BA.debugLine="DestRect.Initialize(0, 0, OriginalBitmap.Width, O";
_destrect.Initialize((int) (0),(int) (0),_originalbitmap.getWidth(),_originalbitmap.getHeight());
 //BA.debugLineNum = 51;BA.debugLine="Canvas.DrawBitmap(OriginalBitmap, Null, DestRect)";
_canvas.DrawBitmap((android.graphics.Bitmap)(_originalbitmap.getObject()),(android.graphics.Rect)(anywheresoftware.b4a.keywords.Common.Null),(android.graphics.Rect)(_destrect.getObject()));
 //BA.debugLineNum = 53;BA.debugLine="Canvas.DrawText(Number, (OriginalBitmap.Width / 2";
_canvas.DrawText(_ba,BA.NumberToString(_number),(float) ((_originalbitmap.getWidth()/(double)2)),(float) ((_originalbitmap.getHeight()/(double)2.4)),anywheresoftware.b4a.keywords.Common.Typeface.DEFAULT,(float) (15),anywheresoftware.b4a.keywords.Common.Colors.White,BA.getEnumFromString(android.graphics.Paint.Align.class,"CENTER"));
 //BA.debugLineNum = 54;BA.debugLine="Return NewBitmap";
if (true) return _newbitmap;
 //BA.debugLineNum = 55;BA.debugLine="End Sub";
return null;
}
public static String  _cuantosvariablestengobd(anywheresoftware.b4a.BA _ba,String _promo) throws Exception{
 //BA.debugLineNum = 1263;BA.debugLine="Sub cuantosVariablesTengoBD(promo As String) As St";
 //BA.debugLineNum = 1274;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 = 483;BA.debugLine="Sub dameErroresJSON(SQL As SQL, maxErrores As Int,";
 //BA.debugLineNum = 484;BA.debugLine="Log(\"dameErroresJSON\")";
anywheresoftware.b4a.keywords.Common.LogImpl("48781825","dameErroresJSON",0);
 //BA.debugLineNum = 485;BA.debugLine="Private j As JSONGenerator";
_j = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 486;BA.debugLine="Private lim As String";
_lim = "";
 //BA.debugLineNum = 487;BA.debugLine="Private cur As ResultSet";
_cur = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
 //BA.debugLineNum = 488;BA.debugLine="Private l As List";
_l = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 489;BA.debugLine="Private i As Int = 0";
_i = (int) (0);
 //BA.debugLineNum = 490;BA.debugLine="l.Initialize";
_l.Initialize();
 //BA.debugLineNum = 491;BA.debugLine="Dim m, m2 As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m2 = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 492;BA.debugLine="m2.Initialize";
_m2.Initialize();
 //BA.debugLineNum = 493;BA.debugLine="If maxErrores = 0 Then lim = \"\" Else lim = \"limit";
if (_maxerrores==0) { 
_lim = "";}
else {
_lim = "limit "+BA.NumberToString(_maxerrores);};
 //BA.debugLineNum = 494;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 = 495;BA.debugLine="Do While cur.NextRow";
while (_cur.NextRow()) {
 //BA.debugLineNum = 496;BA.debugLine="m.Initialize";
_m.Initialize();
 //BA.debugLineNum = 497;BA.debugLine="m.Put(\"fecha\", cur.GetString(\"fecha\"))";
_m.Put((Object)("fecha"),(Object)(_cur.GetString("fecha")));
 //BA.debugLineNum = 498;BA.debugLine="m.Put(\"error\", cur.GetString(\"error\"))";
_m.Put((Object)("error"),(Object)(_cur.GetString("error")));
 //BA.debugLineNum = 499;BA.debugLine="m2.Put(i,m)";
_m2.Put((Object)(_i),(Object)(_m.getObject()));
 //BA.debugLineNum = 500;BA.debugLine="i = i + 1";
_i = (int) (_i+1);
 }
;
 //BA.debugLineNum = 502;BA.debugLine="cur.Close";
_cur.Close();
 //BA.debugLineNum = 503;BA.debugLine="j.Initialize(m2)";
_j.Initialize(_m2);
 //BA.debugLineNum = 504;BA.debugLine="Log(j.ToString)";
anywheresoftware.b4a.keywords.Common.LogImpl("48781845",_j.ToString(),0);
 //BA.debugLineNum = 505;BA.debugLine="If comprimido Then";
if (_comprimido) { 
 //BA.debugLineNum = 506;BA.debugLine="Return compress(j.ToString)";
if (true) return _compress(_ba,_j.ToString());
 }else {
 //BA.debugLineNum = 508;BA.debugLine="Return j.ToString";
if (true) return _j.ToString();
 };
 //BA.debugLineNum = 510;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 = 164;BA.debugLine="Sub dameRuta(inicioRuta As String, origenRuta As S";
 //BA.debugLineNum = 166;BA.debugLine="Dim fechaInicio As String";
_fechainicio = "";
 //BA.debugLineNum = 167;BA.debugLine="Try 'incioRuta es numero";
try { //BA.debugLineNum = 168;BA.debugLine="inicioRuta = inicioRuta * 1";
_inicioruta = BA.NumberToString((double)(Double.parseDouble(_inicioruta))*1);
 //BA.debugLineNum = 170;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 = 172;BA.debugLine="fechaInicio = fechaInicioHoy";
_fechainicio = _fechainiciohoy(_ba);
 };
 //BA.debugLineNum = 175;BA.debugLine="If subsLogs Then Log(\"fechaInicio: \"&fechaInicio&";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("47536651","fechaInicio: "+_fechainicio+" | rutaHrsAtras="+BA.NumberToString(_rutahrsatras),0);};
 //BA.debugLineNum = 176;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 177;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 = 178;BA.debugLine="If subsLogs Then Log(\"select FECHA, LAT, LON from";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("47536654","select FECHA, LAT, LON from "+_origenruta+" where FECHA > "+_fechainicio+" order by FECHA desc limit "+BA.NumberToString(_rutamaxpoints),0);};
 //BA.debugLineNum = 179;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 = 180;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 181;BA.debugLine="Dim ruta2 As String = \"\"";
_ruta2 = "";
 //BA.debugLineNum = 182;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 183;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 = 184;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 185;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 = 186;BA.debugLine="B4XPages.MainPage.fechaRuta = c.GetString(\"FECH";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._fecharuta /*String*/  = _c.GetString("FECHA");
 }
};
 };
 //BA.debugLineNum = 189;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 190;BA.debugLine="Return compress(ruta2)";
if (true) return _compress(_ba,_ruta2);
 //BA.debugLineNum = 191;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 = 621;BA.debugLine="Sub dameUsuarioDeDB As String 'ignore";
 //BA.debugLineNum = 622;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 623;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
 //BA.debugLineNum = 624;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 625;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 = 626;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 627;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
 //BA.debugLineNum = 628;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 629;BA.debugLine="Return u";
if (true) return _u;
 //BA.debugLineNum = 630;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 = 85;BA.debugLine="Sub decompress(base64 As String) As String 'ignore";
 //BA.debugLineNum = 86;BA.debugLine="Dim decompressedbytes() As Byte = su.DecodeBase64";
_decompressedbytes = _su.DecodeBase64(_base64);
 //BA.debugLineNum = 88;BA.debugLine="Dim bc As ByteConverter";
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
 //BA.debugLineNum = 89;BA.debugLine="Dim uncompressed As String = bc.StringFromBytes(d";
_uncompressed = _bc.StringFromBytes(_decompressedbytes,"UTF8");
 //BA.debugLineNum = 90;BA.debugLine="Log($\"Descomprimido: ${uncompressed.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("47143429",("Descomprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_uncompressed.length()))+""),0);
 //BA.debugLineNum = 92;BA.debugLine="Return uncompressed";
if (true) return _uncompressed;
 //BA.debugLineNum = 93;BA.debugLine="End Sub";
return "";
}
public static String  _deleteerrorlog_db(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 201;BA.debugLine="Sub deleteErrorLog_DB 'ignore";
 //BA.debugLineNum = 202;BA.debugLine="errorLog.ExecNonQuery(\"delete from errores\")";
_errorlog.ExecNonQuery("delete from errores");
 //BA.debugLineNum = 203;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 204;BA.debugLine="ToastMessageShow(\"BD Errores Borrada\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("BD Errores Borrada"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 205;BA.debugLine="End Sub";
return "";
}
public static String  _deletefolder(anywheresoftware.b4a.BA _ba,String _folder) throws Exception{
String _f = "";
 //BA.debugLineNum = 1932;BA.debugLine="Sub deleteFolder(folder As String)";
 //BA.debugLineNum = 1933;BA.debugLine="Log(\"Borrando \" & folder)";
anywheresoftware.b4a.keywords.Common.LogImpl("412976129","Borrando "+_folder,0);
 //BA.debugLineNum = 1934;BA.debugLine="For Each f As String In File.ListFiles(folder)";
{
final anywheresoftware.b4a.BA.IterableList group2 = anywheresoftware.b4a.keywords.Common.File.ListFiles(_folder);
final int groupLen2 = group2.getSize()
;int index2 = 0;
;
for (; index2 < groupLen2;index2++){
_f = BA.ObjectToString(group2.Get(index2));
 //BA.debugLineNum = 1935;BA.debugLine="Log(f)";
anywheresoftware.b4a.keywords.Common.LogImpl("412976131",_f,0);
 //BA.debugLineNum = 1936;BA.debugLine="If File.IsDirectory(folder, f) Then";
if (anywheresoftware.b4a.keywords.Common.File.IsDirectory(_folder,_f)) { 
 //BA.debugLineNum = 1937;BA.debugLine="deleteFolder(File.Combine(folder, f))";
_deletefolder(_ba,anywheresoftware.b4a.keywords.Common.File.Combine(_folder,_f));
 //BA.debugLineNum = 1938;BA.debugLine="Log($\"Borramos ${File.Combine(folder, f)}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("412976134",("Borramos "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.File.Combine(_folder,_f)))+""),0);
 };
 //BA.debugLineNum = 1940;BA.debugLine="File.Delete(folder, f)";
anywheresoftware.b4a.keywords.Common.File.Delete(_folder,_f);
 }
};
 //BA.debugLineNum = 1942;BA.debugLine="End Sub";
return "";
}
public static String  _deletegps_db(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 194;BA.debugLine="Sub deleteGPS_DB 'ignore";
 //BA.debugLineNum = 195;BA.debugLine="kmt.ExecNonQuery(\"delete from RUTA_GPS\")";
_kmt.ExecNonQuery("delete from RUTA_GPS");
 //BA.debugLineNum = 196;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 197;BA.debugLine="ToastMessageShow(\"Borramos BD Coords GPS\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Borramos BD Coords GPS"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 198;BA.debugLine="End Sub";
return "";
}
public static String  _enviawhatsappmsg(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 1944;BA.debugLine="Sub enviaWhatsappMsg()";
 //BA.debugLineNum = 1979;BA.debugLine="End Sub";
return "";
}
public static String  _fechainiciohoy(anywheresoftware.b4a.BA _ba) throws Exception{
String _origformat = "";
String _h = "";
 //BA.debugLineNum = 292;BA.debugLine="Sub fechaInicioHoy As String 'ignore";
 //BA.debugLineNum = 293;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 294;BA.debugLine="DateTime.DateFormat=\"yyMMdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMdd");
 //BA.debugLineNum = 295;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 = 296;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 297;BA.debugLine="Log(\"Hoy=\"&h)";
anywheresoftware.b4a.keywords.Common.LogImpl("48126469","Hoy="+_h,0);
 //BA.debugLineNum = 298;BA.debugLine="Return h";
if (true) return _h;
 //BA.debugLineNum = 299;BA.debugLine="End Sub";
return "";
}
public static String  _fechakmt(anywheresoftware.b4a.BA _ba,String _fecha) throws Exception{
String _origformat = "";
String _nuevafecha = "";
 //BA.debugLineNum = 96;BA.debugLine="Sub fechaKMT(fecha As String) As String 'ignore";
 //BA.debugLineNum = 98;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 99;BA.debugLine="DateTime.DateFormat=\"yyMMddHHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMddHHmmss");
 //BA.debugLineNum = 100;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
 //BA.debugLineNum = 101;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 103;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
 //BA.debugLineNum = 104;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 = 513;BA.debugLine="Sub fechaKMT2Ticks(fKMT As String) As Long 'ignore";
 //BA.debugLineNum = 514;BA.debugLine="Try";
try { //BA.debugLineNum = 515;BA.debugLine="If fKMT.Length = 12 Then";
if (_fkmt.length()==12) { 
 //BA.debugLineNum = 516;BA.debugLine="Private parteFecha As String = fKMT.SubString2(";
_partefecha = _fkmt.substring((int) (0),(int) (6));
 //BA.debugLineNum = 517;BA.debugLine="Private parteHora As String = fKMT.SubString(6)";
_partehora = _fkmt.substring((int) (6));
 //BA.debugLineNum = 518;BA.debugLine="Private OrigFormat As String = DateTime.DateFor";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 519;BA.debugLine="DateTime.DateFormat=\"yymmdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yymmdd");
 //BA.debugLineNum = 520;BA.debugLine="DateTime.TimeFormat=\"HHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setTimeFormat("HHmmss");
 //BA.debugLineNum = 521;BA.debugLine="Private ticks As Long = DateTime.DateTimeParse(";
_ticks = anywheresoftware.b4a.keywords.Common.DateTime.DateTimeParse(_partefecha,_partehora);
 //BA.debugLineNum = 522;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 523;BA.debugLine="Return ticks";
if (true) return _ticks;
 }else {
 //BA.debugLineNum = 525;BA.debugLine="Log(\"Formato de fecha incorrecto, debe de ser '";
anywheresoftware.b4a.keywords.Common.LogImpl("48847372","Formato de fecha incorrecto, debe de ser 'YYMMDDHHMMSS', no '"+_fkmt+"' largo="+BA.NumberToString(_fkmt.length()),0);
 //BA.debugLineNum = 526;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 } 
       catch (Exception e16) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e16); //BA.debugLineNum = 529;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("48847376",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 //BA.debugLineNum = 530;BA.debugLine="LogColor($\"Fecha dada: ${fKMT}, Parte Fecha: ${p";
anywheresoftware.b4a.keywords.Common.LogImpl("48847377",("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 = 531;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 //BA.debugLineNum = 533;BA.debugLine="End Sub";
return 0L;
}
public static String  _fechanormal(anywheresoftware.b4a.BA _ba,String _fecha) throws Exception{
String _origformat = "";
String _nuevafecha = "";
 //BA.debugLineNum = 229;BA.debugLine="Sub fechanormal(fecha As String) As String 'ignore";
 //BA.debugLineNum = 231;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 232;BA.debugLine="DateTime.DateFormat = \"YYYY/MM/dd HH:mm:ss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("YYYY/MM/dd HH:mm:ss");
 //BA.debugLineNum = 233;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
 //BA.debugLineNum = 234;BA.debugLine="DateTime.DateFormat = OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 236;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
 //BA.debugLineNum = 237;BA.debugLine="End Sub";
return "";
}
public static String  _getphnid(anywheresoftware.b4a.BA _ba) throws Exception{
String _t = "";
String _s = "";
 //BA.debugLineNum = 23;BA.debugLine="Sub getPhnId As String 'ignore";
 //BA.debugLineNum = 25;BA.debugLine="devModel = phn.Model";
_devmodel = _phn.getModel();
 //BA.debugLineNum = 26;BA.debugLine="If devModel.Length <= 3 Then 'Si phn.Model esta e";
if (_devmodel.length()<=3) { 
 //BA.debugLineNum = 27;BA.debugLine="Dim t As String = phn.GetSettings(\"android_id\")";
_t = _phn.GetSettings("android_id");
 //BA.debugLineNum = 28;BA.debugLine="devModel = t";
_devmodel = _t;
 };
 //BA.debugLineNum = 30;BA.debugLine="If devModel.Length >= 3 Then 'Si tenemos valor pa";
if (_devmodel.length()>=3) { 
 //BA.debugLineNum = 31;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 = 34;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 = 35;BA.debugLine="devModel = s";
_devmodel = _s;
 };
 //BA.debugLineNum = 39;BA.debugLine="Return devModel";
if (true) return _devmodel;
 //BA.debugLineNum = 40;BA.debugLine="End Sub";
return "";
}
public static String  _getssid(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 240;BA.debugLine="Sub getSSID  'ignore";
 //BA.debugLineNum = 245;BA.debugLine="End Sub";
return "";
}
public static String  _guardaappinfo(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 1333;BA.debugLine="Sub guardaAppInfo 'ignore";
 //BA.debugLineNum = 1334;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._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 = 1335;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"insert into";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._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 = 1336;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"insert into";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._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 = 1337;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 = 135;BA.debugLine="Sub guardaInfoEnArchivo(coords As String) 'ignore";
 //BA.debugLineNum = 137;BA.debugLine="Dim OrigFormat As String=DateTime.DateFormat  'sa";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 138;BA.debugLine="DateTime.DateFormat=\"MMM-dd HH:mm:ss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MMM-dd HH:mm:ss");
 //BA.debugLineNum = 139;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 = 140;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 142;BA.debugLine="Dim ubic As String = coords&\",\"&lastUpdate";
_ubic = _coords+","+_lastupdate;
 //BA.debugLineNum = 143;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.getDirRootExternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 144;BA.debugLine="Dim s As String = ubic & CRLF";
_s = _ubic+anywheresoftware.b4a.keywords.Common.CRLF;
 //BA.debugLineNum = 145;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
 //BA.debugLineNum = 146;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
 //BA.debugLineNum = 147;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 148;BA.debugLine="End Sub";
return "";
}
public static String  _guardainfoenbd(anywheresoftware.b4a.BA _ba,String _coords) throws Exception{
String[] _latlon = null;
 //BA.debugLineNum = 151;BA.debugLine="Sub guardaInfoEnBD(coords As String) 'ignore";
 //BA.debugLineNum = 152;BA.debugLine="Log(\"Guardamos ubicacion en BD - \"&coords)";
anywheresoftware.b4a.keywords.Common.LogImpl("47471105","Guardamos ubicacion en BD - "+_coords,0);
 //BA.debugLineNum = 153;BA.debugLine="Try";
try { //BA.debugLineNum = 154;BA.debugLine="Dim latlon() As String = Regex.Split(\"\\|\", coord";
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split("\\|",_coords);
 //BA.debugLineNum = 155;BA.debugLine="If latlon.Length < 2 Then latlon = Regex.Split(\"";
if (_latlon.length<2) { 
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split(",",_coords);};
 //BA.debugLineNum = 156;BA.debugLine="If subsLogs Then Log(\"LatLon=\"&latlon)";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("47471109","LatLon="+BA.ObjectToString(_latlon),0);};
 //BA.debugLineNum = 157;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 = 159;BA.debugLine="LogColor(LastException, Colors.red)";
anywheresoftware.b4a.keywords.Common.LogImpl("47471112",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 161;BA.debugLine="End Sub";
return "";
}
public static String  _guardaproducto(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,String _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 876;BA.debugLine="Sub guardaProducto(cedis As String, costoU As Stri";
 //BA.debugLineNum = 877;BA.debugLine="LogColor(\"guardaProducto: \"&prodId&\", cant=\"&cant";
anywheresoftware.b4a.keywords.Common.LogImpl("410551297","guardaProducto: "+_prodid+", cant="+_cant+" - TV:"+_tipoventa,anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 878;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 879;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA,PE_COSTO_SIN,PE_FOLIO) VALUES(?,?,?,?,?,?,?,?,?,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cedis),(Object)(((double)(Double.parseDouble(_cant))*(double)(Double.parseDouble(_costou)))),(Object)(_costou),(Object)(_cant),(Object)(_nombre),(Object)(_prodid),(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_traerutabitacora(_ba)),(Object)(_preciosin),(Object)(_tipoventa)}));
 //BA.debugLineNum = 880;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update ${t";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_traetipoventadebd(_ba))))+" set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 //BA.debugLineNum = 881;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select sum(pe";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")));
 //BA.debugLineNum = 882;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 883;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");
 //BA.debugLineNum = 884;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_c.GetString("CANT_CLIE")),(Object)(_c.GetString("TOTAL_CLIE")),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
 //BA.debugLineNum = 885;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"UPDATE kmt_i";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE kmt_info3 set gestion = 2  where CAT_CL_CODIGO In (select cuenta from cuentaa)");
 //BA.debugLineNum = 886;BA.debugLine="End Sub";
return "";
}
public static String  _guardaproductosin(anywheresoftware.b4a.BA _ba,String _cedis,String _costotot,String _costou,String _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipov,String _precio2,String _query) throws Exception{
 //BA.debugLineNum = 641;BA.debugLine="Sub guardaProductoSin(cedis As String, costoTot As";
 //BA.debugLineNum = 654;BA.debugLine="ToastMessageShow(\"guardaProdSin\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("guardaProdSin"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 655;BA.debugLine="End Sub";
return "";
}
public static String  _guardaproductosingestion(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,String _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _futuro,String _aplicades) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 1852;BA.debugLine="Sub guardaProductoSinGestion(cedis As String, cost";
 //BA.debugLineNum = 1853;BA.debugLine="If nombre.Length < 6 Then ToastMessageShow(\"(guar";
if (_nombre.length()<6) { 
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("(guardaProductoSinGestion) El nombre del producto no es valido "+_nombre),anywheresoftware.b4a.keywords.Common.True);};
 //BA.debugLineNum = 1854;BA.debugLine="precioSin = NumberFormat2(precioSin, 1, 2, 2, Fal";
_preciosin = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_preciosin)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1855;BA.debugLine="costoU = NumberFormat2(costoU, 1, 2, 2, False)";
_costou = anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(_costou)),(int) (1),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1857;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1860;BA.debugLine="Starter.skmt.ExecNonQuery2(\"INSERT INTO PEDIDO (P";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_FECHA, PE_USUARIO, PE_RUTA, PE_COSTO_SIN, PE_FOLIO,PE_FUTURO,PE_DESC) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cedis),(Object)(((double)(Double.parseDouble(_cant))*(double)(Double.parseDouble(_costou)))),(Object)(_costou),(Object)(_cant),(Object)(_nombre),(Object)(_prodid),(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_rutav),(Object)(_preciosin),(Object)(_tipoventa),(Object)(_futuro),(Object)(_aplicades)}));
 //BA.debugLineNum = 1862;BA.debugLine="If cedis <> \"DUR\" Then Starter.skmt.ExecNonQuery2";
if ((_cedis).equals("DUR") == false) { 
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_tipoventa)))+" set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));};
 //BA.debugLineNum = 1863;BA.debugLine="c=Starter.skmt.ExecQuery(\"select sum(pe_costo_tot";
_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 sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")));
 //BA.debugLineNum = 1864;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1867;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedido_cl";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido_cliente where PC_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"));
 //BA.debugLineNum = 1868;BA.debugLine="Starter.skmt.ExecNonQuery2(\"insert into pedido_cl";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_c.GetString("CANT_CLIE")),(Object)(_c.GetString("TOTAL_CLIE")),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_rutav),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
 //BA.debugLineNum = 1869;BA.debugLine="End Sub";
return "";
}
public static String  _guardaproductox(anywheresoftware.b4a.BA _ba,String _cedis,String _costotot,String _costou,String _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _tipov,String _precio2,String _query) throws Exception{
 //BA.debugLineNum = 633;BA.debugLine="Sub guardaProductoX(cedis As String, costoTot As S";
 //BA.debugLineNum = 639;BA.debugLine="End Sub";
return "";
}
public static String  _guardavariable(anywheresoftware.b4a.BA _ba,String _nombre,String _valor) throws Exception{
 //BA.debugLineNum = 1909;BA.debugLine="Sub guardaVariable(nombre As String, valor As Stri";
 //BA.debugLineNum = 1910;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"delete from";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_nombre))+"'"));
 //BA.debugLineNum = 1911;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"insert into";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_nombre))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_valor))+"')"));
 //BA.debugLineNum = 1912;BA.debugLine="End Sub";
return "";
}
public static boolean  _haypedido(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _thisc = null;
boolean _hay = false;
 //BA.debugLineNum = 867;BA.debugLine="Sub hayPedido As Boolean";
 //BA.debugLineNum = 868;BA.debugLine="Private thisC As Cursor=B4XPages.MainPage.skmt.Ex";
_thisc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_thisc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select count(PE_CLIENTE) as hayPedido from PEDIDO where PE_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"))));
 //BA.debugLineNum = 869;BA.debugLine="thisC.Position=0";
_thisc.setPosition((int) (0));
 //BA.debugLineNum = 870;BA.debugLine="Private hay As Boolean = False";
_hay = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 871;BA.debugLine="If thisC.GetInt(\"hayPedido\") > 0 Then hay = True";
if (_thisc.GetInt("hayPedido")>0) { 
_hay = anywheresoftware.b4a.keywords.Common.True;};
 //BA.debugLineNum = 873;BA.debugLine="Return hay";
if (true) return _hay;
 //BA.debugLineNum = 874;BA.debugLine="End Sub";
return false;
}
public static String  _importabddesdewhatsapp(anywheresoftware.b4a.BA _ba) throws Exception{
String _xmldata = "";
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _outstr = null;
anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _instr = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _a = null;
 //BA.debugLineNum = 1727;BA.debugLine="Sub importaBDDesdeWhatsApp";
 //BA.debugLineNum = 1729;BA.debugLine="Log(\"Revisamos intent de importar desde whatsapp\"";
anywheresoftware.b4a.keywords.Common.LogImpl("412320770","Revisamos intent de importar desde whatsapp",0);
 //BA.debugLineNum = 1730;BA.debugLine="Log(B4XPages.MainPage.intentUsado)";
anywheresoftware.b4a.keywords.Common.LogImpl("412320771",BA.ObjectToString(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._intentusado /*boolean*/ ),0);
 //BA.debugLineNum = 1731;BA.debugLine="Log(in)";
anywheresoftware.b4a.keywords.Common.LogImpl("412320772",BA.ObjectToString(_in),0);
 //BA.debugLineNum = 1732;BA.debugLine="If Not(in.IsInitialized) Then in = B4XPages.GetNa";
if (anywheresoftware.b4a.keywords.Common.Not(_in.IsInitialized())) { 
_in = mostCurrent._b4xpages._getnativeparent /*anywheresoftware.b4a.objects.ActivityWrapper*/ (_ba,(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba))).GetStartingIntent();};
 //BA.debugLineNum = 1733;BA.debugLine="If Not(B4XPages.MainPage.intentUsado) And in <> N";
if (anywheresoftware.b4a.keywords.Common.Not(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._intentusado /*boolean*/ ) && _in!= null) { 
 //BA.debugLineNum = 1735;BA.debugLine="LogColor(\"Importamos base de datos desde Whatsap";
anywheresoftware.b4a.keywords.Common.LogImpl("412320776","Importamos base de datos desde Whatsapp.",anywheresoftware.b4a.keywords.Common.Colors.Blue);
 //BA.debugLineNum = 1736;BA.debugLine="B4XPages.MainPage.intentUsado = True";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._intentusado /*boolean*/  = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1738;BA.debugLine="If in.GetData <> Null Then";
if (_in.GetData()!= null) { 
 //BA.debugLineNum = 1739;BA.debugLine="Dim XmlData As String";
_xmldata = "";
 //BA.debugLineNum = 1740;BA.debugLine="XmlData = in.GetData";
_xmldata = _in.GetData();
 //BA.debugLineNum = 1741;BA.debugLine="Try";
try { //BA.debugLineNum = 1742;BA.debugLine="Dim OutStr As OutputStream = File.OpenOutput(F";
_outstr = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_outstr = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db",anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1743;BA.debugLine="Dim InStr As InputStream = File.OpenInput(\"Con";
_instr = new anywheresoftware.b4a.objects.streams.File.InputStreamWrapper();
_instr = anywheresoftware.b4a.keywords.Common.File.OpenInput("ContentDir",_xmldata);
 //BA.debugLineNum = 1744;BA.debugLine="File.Copy2(InStr,OutStr)";
anywheresoftware.b4a.keywords.Common.File.Copy2((java.io.InputStream)(_instr.getObject()),(java.io.OutputStream)(_outstr.getObject()));
 //BA.debugLineNum = 1745;BA.debugLine="LogColor(\"BD copiada a interna.\", Colors.Blue)";
anywheresoftware.b4a.keywords.Common.LogImpl("412320786","BD copiada a interna.",anywheresoftware.b4a.keywords.Common.Colors.Blue);
 //BA.debugLineNum = 1746;BA.debugLine="OutStr.Close";
_outstr.Close();
 //BA.debugLineNum = 1747;BA.debugLine="If in.As(String).Contains(\"whatsapp\") Then Toa";
if ((BA.ObjectToString(_in)).contains("whatsapp")) { 
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("BD cargada desde Whatsapp"),anywheresoftware.b4a.keywords.Common.False);};
 } 
       catch (Exception e19) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e19); //BA.debugLineNum = 1749;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("412320790",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 //BA.debugLineNum = 1754;BA.debugLine="Private a As Cursor = Starter.skmt.ExecQuery($\"";
_a = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_a = (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_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'APP_NAME'"))));
 //BA.debugLineNum = 1755;BA.debugLine="If a.RowCount > 0 Then";
if (_a.getRowCount()>0) { 
 //BA.debugLineNum = 1756;BA.debugLine="a.Position = 0";
_a.setPosition((int) (0));
 //BA.debugLineNum = 1757;BA.debugLine="ToastMessageShow($\"BD de \"${a.GetString(\"CAT_V";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(("BD de \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_a.GetString("CAT_VA_VALOR")))+"\" cargada.")),anywheresoftware.b4a.keywords.Common.True);
 };
 //BA.debugLineNum = 1759;BA.debugLine="a = Starter.skmt.ExecQuery($\"select * from usua";
_a = (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 usuarioa"))));
 //BA.debugLineNum = 1760;BA.debugLine="If a.RowCount > 0 Then";
if (_a.getRowCount()>0) { 
 //BA.debugLineNum = 1761;BA.debugLine="a.Position = 0";
_a.setPosition((int) (0));
 //BA.debugLineNum = 1762;BA.debugLine="B4XPages.MainPage.user.Text = a.GetString(\"USU";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._user /*anywheresoftware.b4a.objects.EditTextWrapper*/ .setText(BA.ObjectToCharSequence(_a.GetString("USUARIO")));
 //BA.debugLineNum = 1763;BA.debugLine="B4XPages.MainPage.pass.Text = a.GetString(\"PAS";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._pass /*anywheresoftware.b4a.objects.EditTextWrapper*/ .setText(BA.ObjectToCharSequence(_a.GetString("PASS")));
 };
 };
 };
 //BA.debugLineNum = 1767;BA.debugLine="End Sub";
return "";
}
public static String  _iniciaactividad(anywheresoftware.b4a.BA _ba,String _ia) throws Exception{
 //BA.debugLineNum = 1535;BA.debugLine="Sub iniciaActividad(ia As String)";
 //BA.debugLineNum = 1536;BA.debugLine="If ia <> \"\" And ia <> Null Then";
if ((_ia).equals("") == false && _ia!= null) { 
 //BA.debugLineNum = 1538;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"delete fro";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)("ULTIMOMODULO")}));
 //BA.debugLineNum = 1539;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INT";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)("ULTIMOMODULO"),(Object)(_ia)}));
 //BA.debugLineNum = 1540;BA.debugLine="B4XPages.ShowPage(ia)";
mostCurrent._b4xpages._showpage /*String*/ (_ba,_ia);
 };
 //BA.debugLineNum = 1543;BA.debugLine="End Sub";
return "";
}
public static String  _insertarenglonespruebaenerrorlog(anywheresoftware.b4a.BA _ba) throws Exception{
int _x = 0;
 //BA.debugLineNum = 473;BA.debugLine="Sub insertaRenglonesPruebaEnErrorLog 'ignore";
 //BA.debugLineNum = 474;BA.debugLine="revisaBD";
_revisabd(_ba);
 //BA.debugLineNum = 475;BA.debugLine="Log(\"insertamos 50 renglones a errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("48716290","insertamos 50 renglones a errorLog",0);
 //BA.debugLineNum = 476;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 = 477;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 = 478;BA.debugLine="Log(x)";
anywheresoftware.b4a.keywords.Common.LogImpl("48716293",BA.NumberToString(_x),0);
 }
};
 //BA.debugLineNum = 480;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 = 535;BA.debugLine="Sub InstallAPK(dir As String, apk As String) 'igno";
 //BA.debugLineNum = 536;BA.debugLine="If File.Exists(dir, apk) Then";
if (anywheresoftware.b4a.keywords.Common.File.Exists(_dir,_apk)) { 
 //BA.debugLineNum = 537;BA.debugLine="Dim i As Intent";
_i = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 538;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 = 539;BA.debugLine="i.SetType(\"application/vnd.android.package-archi";
_i.SetType("application/vnd.android.package-archive");
 //BA.debugLineNum = 540;BA.debugLine="StartActivity(i)";
anywheresoftware.b4a.keywords.Common.StartActivity((_ba.processBA == null ? _ba : _ba.processBA),(Object)(_i.getObject()));
 };
 //BA.debugLineNum = 542;BA.debugLine="End Sub";
return "";
}
public static boolean  _invsuficientepromoesp(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _y = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _i = 0;
 //BA.debugLineNum = 1393;BA.debugLine="Sub InvSuficientePromoEsp As Boolean";
 //BA.debugLineNum = 1394;BA.debugLine="Private y As Boolean = False";
_y = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1395;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exec";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_DP_IDPROD, CAT_DP_PZAS, ifnull(CAT_GP_ALMACEN, 0) As CAT_GP_ALMACEN from CAT_DETALLES_PAQ left JOIN "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_traetipoventadebd(_ba))))+" ON CAT_DP_IDPROD = CAT_GP_ID WHERE CAT_DP_ID IN (SELECT DISTINCT CAT_PE_IDPROMO FROM CAT_PROMO_ESP)"))));
 //BA.debugLineNum = 1396;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1397;BA.debugLine="For i = 0 To c.RowCount - 1";
{
final int step4 = 1;
final int limit4 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
 //BA.debugLineNum = 1398;BA.debugLine="c.Position = i";
_c.setPosition(_i);
 //BA.debugLineNum = 1399;BA.debugLine="If c.GetString(\"CAT_GP_ALMACEN\") >= c.GetString";
if ((double)(Double.parseDouble(_c.GetString("CAT_GP_ALMACEN")))>=(double)(Double.parseDouble(_c.GetString("CAT_DP_PZAS")))) { 
 //BA.debugLineNum = 1400;BA.debugLine="y = True";
_y = anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 1404;BA.debugLine="y = False";
_y = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1407;BA.debugLine="Exit";
if (true) break;
 };
 }
};
 };
 //BA.debugLineNum = 1411;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1412;BA.debugLine="Return y";
if (true) return _y;
 //BA.debugLineNum = 1413;BA.debugLine="End Sub";
return false;
}
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 = 248;BA.debugLine="Sub JSON2Map(theJson As String) As Map 'ignore";
 //BA.debugLineNum = 250;BA.debugLine="Try";
try { //BA.debugLineNum = 251;BA.debugLine="Private json As JSONParser";
_json = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 252;BA.debugLine="json.Initialize(theJson)";
_json.Initialize(_thejson);
 //BA.debugLineNum = 253;BA.debugLine="Return json.NextObject";
if (true) return _json.NextObject();
 } 
       catch (Exception e6) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e6); //BA.debugLineNum = 255;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("47995399",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 //BA.debugLineNum = 256;BA.debugLine="log2DB(\"JSON2Map: \"&LastException)";
_log2db(_ba,"JSON2Map: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)));
 //BA.debugLineNum = 257;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 = 258;BA.debugLine="Return m";
if (true) return _m;
 };
 //BA.debugLineNum = 260;BA.debugLine="End Sub";
return null;
}
public static String  _log2db(anywheresoftware.b4a.BA _ba,String _texto) throws Exception{
 //BA.debugLineNum = 302;BA.debugLine="Sub log2DB(texto As String) 'ignore";
 //BA.debugLineNum = 303;BA.debugLine="LogColor(fechaKMT(DateTime.Now)&\" - log2BD: '\"&te";
anywheresoftware.b4a.keywords.Common.LogImpl("48192001",_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))+" - log2BD: '"+_texto+"'",anywheresoftware.b4a.keywords.Common.Colors.LightGray);
 //BA.debugLineNum = 304;BA.debugLine="kmt.ExecNonQuery2(\"INSERT INTO bitacora(fecha, te";
_kmt.ExecNonQuery2("INSERT INTO bitacora(fecha, texto) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))),(Object)(_texto)}));
 //BA.debugLineNum = 305;BA.debugLine="End Sub";
return "";
}
public static String  _logjobdoneresultados(anywheresoftware.b4a.BA _ba,gunav2.keymon.com.mx.dbrequestmanager._dbresult _resultado) throws Exception{
Object[] _records = null;
String _k = "";
 //BA.debugLineNum = 2507;BA.debugLine="Sub logJobDoneResultados(resultado As DBResult)";
 //BA.debugLineNum = 2508;BA.debugLine="For Each records() As Object In resultado.Rows";
{
final anywheresoftware.b4a.BA.IterableList group1 = _resultado.Rows /*anywheresoftware.b4a.objects.collections.List*/ ;
final int groupLen1 = group1.getSize()
;int index1 = 0;
;
for (; index1 < groupLen1;index1++){
_records = (Object[])(group1.Get(index1));
 //BA.debugLineNum = 2509;BA.debugLine="LogColor($\"====== ${resultado.Tag} - REGISTROS =";
anywheresoftware.b4a.keywords.Common.LogImpl("413959170",("====== "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_resultado.Tag /*Object*/ )+" - REGISTROS = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_resultado.Rows /*anywheresoftware.b4a.objects.collections.List*/ .getSize()))+""),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (215),(int) (37),(int) (0)));
 //BA.debugLineNum = 2510;BA.debugLine="For Each k As String In resultado.Columns.Keys";
{
final anywheresoftware.b4a.BA.IterableList group3 = _resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Keys();
final int groupLen3 = group3.getSize()
;int index3 = 0;
;
for (; index3 < groupLen3;index3++){
_k = BA.ObjectToString(group3.Get(index3));
 //BA.debugLineNum = 2511;BA.debugLine="LogColor(k & \" = \" & records(resultado.Columns.";
anywheresoftware.b4a.keywords.Common.LogImpl("413959172",_k+" = "+BA.ObjectToString(_records[(int)(BA.ObjectToNumber(_resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Get((Object)(_k))))]),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (215),(int) (37),(int) (0)));
 }
};
 }
};
 //BA.debugLineNum = 2514;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 = 263;BA.debugLine="Sub map2JSON(m As Map) As String 'ignore";
 //BA.debugLineNum = 266;BA.debugLine="Dim jg As JSONGenerator";
_jg = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 267;BA.debugLine="jg.Initialize(m)";
_jg.Initialize(_m);
 //BA.debugLineNum = 268;BA.debugLine="Dim t As String = jg.ToString";
_t = _jg.ToString();
 //BA.debugLineNum = 269;BA.debugLine="Return t";
if (true) return _t;
 //BA.debugLineNum = 270;BA.debugLine="End Sub";
return "";
}
public static boolean  _masdexxmins(anywheresoftware.b4a.BA _ba,int _hora,int _mins) throws Exception{
 //BA.debugLineNum = 308;BA.debugLine="Sub masDeXXMins(hora As Int, mins As Int) As Boole";
 //BA.debugLineNum = 309;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 = 310;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 312;BA.debugLine="Return False";
if (true) return anywheresoftware.b4a.keywords.Common.False;
 };
 //BA.debugLineNum = 314;BA.debugLine="End Sub";
return false;
}
public static boolean  _masdexxminskmt(anywheresoftware.b4a.BA _ba,String _hora,int _mins) throws Exception{
 //BA.debugLineNum = 317;BA.debugLine="Sub masDeXXMinsKMT(hora As String, mins As Int) As";
 //BA.debugLineNum = 318;BA.debugLine="Try";
try { //BA.debugLineNum = 320;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 = 322;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 325;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 = 328;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("48323083",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 //BA.debugLineNum = 330;BA.debugLine="End Sub";
return false;
}
public static String  _notihigh(anywheresoftware.b4a.BA _ba,String _title,String _body,Object _activity) throws Exception{
anywheresoftware.b4a.objects.NotificationWrapper _notif = null;
 //BA.debugLineNum = 107;BA.debugLine="Sub notiHigh(title As String, body As String, acti";
 //BA.debugLineNum = 108;BA.debugLine="Private notif As Notification";
_notif = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 109;BA.debugLine="notif.Initialize2(notif.IMPORTANCE_HIGH)";
_notif.Initialize2(_notif.IMPORTANCE_HIGH);
 //BA.debugLineNum = 110;BA.debugLine="notif.Icon = \"icon\"";
_notif.setIcon("icon");
 //BA.debugLineNum = 111;BA.debugLine="notif.Vibrate = False";
_notif.setVibrate(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 112;BA.debugLine="notif.Sound = False";
_notif.setSound(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 113;BA.debugLine="notif.AutoCancel = True";
_notif.setAutoCancel(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 114;BA.debugLine="Log(\"notiHigh: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("47274503","notiHigh: "+_title,0);
 //BA.debugLineNum = 115;BA.debugLine="notif.SetInfo(title, body, activity)";
_notif.SetInfoNew((_ba.processBA == null ? _ba : _ba.processBA),BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),_activity);
 //BA.debugLineNum = 117;BA.debugLine="notif.Notify(777)";
_notif.Notify((int) (777));
 //BA.debugLineNum = 118;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 = 121;BA.debugLine="Sub notiLowReturn(title As String, Body As String,";
 //BA.debugLineNum = 122;BA.debugLine="Private notification As Notification";
_notification = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 123;BA.debugLine="notification.Initialize2(notification.IMPORTANCE_";
_notification.Initialize2(_notification.IMPORTANCE_LOW);
 //BA.debugLineNum = 124;BA.debugLine="Log(\"notiLowReturn: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("47340035","notiLowReturn: "+_title,0);
 //BA.debugLineNum = 125;BA.debugLine="notification.Icon = \"icon\"";
_notification.setIcon("icon");
 //BA.debugLineNum = 126;BA.debugLine="notification.Sound = False";
_notification.setSound(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 127;BA.debugLine="notification.Vibrate = False";
_notification.setVibrate(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 128;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 = 129;BA.debugLine="notification.Notify(id)";
_notification.Notify(_id);
 //BA.debugLineNum = 131;BA.debugLine="Return notification";
if (true) return _notification;
 //BA.debugLineNum = 132;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 = 579;BA.debugLine="Sub panelVisible(panel As Panel, top As Int, left";
 //BA.debugLineNum = 580;BA.debugLine="panel.BringToFront";
_panel.BringToFront();
 //BA.debugLineNum = 581;BA.debugLine="panel.Visible = True";
_panel.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 582;BA.debugLine="panel.Top = top";
_panel.setTop(_top);
 //BA.debugLineNum = 583;BA.debugLine="panel.Left = left";
_panel.setLeft(_left);
 //BA.debugLineNum = 584;BA.debugLine="End Sub";
return "";
}
public static String  _parsehttperror(anywheresoftware.b4a.BA _ba,String _error) throws Exception{
String _nuevoerror = "";
int _inicio = 0;
int _final = 0;
 //BA.debugLineNum = 1714;BA.debugLine="Sub parseHTTPError(error As String) As String";
 //BA.debugLineNum = 1715;BA.debugLine="Private nuevoError As String = error";
_nuevoerror = _error;
 //BA.debugLineNum = 1716;BA.debugLine="Private inicio As Int = error.IndexOf(\"<title>\")";
_inicio = _error.indexOf("<title>");
 //BA.debugLineNum = 1717;BA.debugLine="Private final As Int = error.IndexOf(\"</title>\")";
_final = _error.indexOf("</title>");
 //BA.debugLineNum = 1718;BA.debugLine="Log(\"|\" & inicio & \"|\" & final & \"|\")";
anywheresoftware.b4a.keywords.Common.LogImpl("412255236","|"+BA.NumberToString(_inicio)+"|"+BA.NumberToString(_final)+"|",0);
 //BA.debugLineNum = 1719;BA.debugLine="If inicio > 0 And final > 0 Then";
if (_inicio>0 && _final>0) { 
 //BA.debugLineNum = 1720;BA.debugLine="nuevoError = error.SubString2(inicio + 17, final";
_nuevoerror = _error.substring((int) (_inicio+17),_final);
 };
 //BA.debugLineNum = 1723;BA.debugLine="Return nuevoError";
if (true) return _nuevoerror;
 //BA.debugLineNum = 1724;BA.debugLine="End Sub";
return "";
}
public static boolean  _pedidoguardado(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _guardado = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _g = null;
 //BA.debugLineNum = 723;BA.debugLine="Sub pedidoGuardado As Boolean";
 //BA.debugLineNum = 724;BA.debugLine="Private guardado As Boolean = False";
_guardado = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 725;BA.debugLine="Private g As Cursor = B4XPages.MainPage.skmt.Exec";
_g = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_g = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select gestion from kmt_info3 where CAT_CL_CODIGO in (Select CUENTA from cuentaa)")));
 //BA.debugLineNum = 726;BA.debugLine="If g.RowCount > 0 Then";
if (_g.getRowCount()>0) { 
 //BA.debugLineNum = 727;BA.debugLine="g.Position=0";
_g.setPosition((int) (0));
 //BA.debugLineNum = 728;BA.debugLine="If g.GetString(\"gestion\") = \"2\" Or g.GetString(\"";
if ((_g.GetString("gestion")).equals("2") || (_g.GetString("gestion")).equals("3")) { 
_guardado = anywheresoftware.b4a.keywords.Common.True;};
 };
 //BA.debugLineNum = 731;BA.debugLine="Return guardado";
if (true) return _guardado;
 //BA.debugLineNum = 732;BA.debugLine="End Sub";
return false;
}
public static anywheresoftware.b4a.objects.collections.Map  _procesapromocion(anywheresoftware.b4a.BA _ba,String _idpromo,String _cliente) throws Exception{
boolean _thislog = false;
String _iniciocontador = "";
anywheresoftware.b4a.objects.collections.Map _pm = null;
anywheresoftware.b4a.objects.collections.Map _inventariosinfijos = null;
boolean _pv = false;
 //BA.debugLineNum = 1089;BA.debugLine="Sub procesaPromocion(idPromo As String, cliente As";
 //BA.debugLineNum = 1090;BA.debugLine="Private thisLog As Boolean = True  'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1091;BA.debugLine="Private inicioContador As String = DateTime.Now";
_iniciocontador = BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 1092;BA.debugLine="If thisLog Then LogColor($\"********* Iniciamos re";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410878979",("********* Iniciamos revision de Promo "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idpromo))+" *********"),anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
 //BA.debugLineNum = 1094;BA.debugLine="Private pm As Map = traePromo(idPromo, cliente)";
_pm = new anywheresoftware.b4a.objects.collections.Map();
_pm = _traepromo(_ba,_idpromo,_cliente);
 //BA.debugLineNum = 1095;BA.debugLine="If thisLog Then LogColor(pm, Colors.Blue)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410878982",BA.ObjectToString(_pm),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1096;BA.debugLine="If pm.Get(\"resultado\") = \"ok\" Then 'Si encontramo";
if ((_pm.Get((Object)("resultado"))).equals((Object)("ok"))) { 
 //BA.debugLineNum = 1098;BA.debugLine="If thisLog Then LogColor($\"Promociones permitida";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410878985",("Promociones permitidas="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traemaxpromos(_ba,_pm)))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1099;BA.debugLine="If thisLog Then Log(\"Promos vendidas: \" & traePr";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410878986","Promos vendidas: "+BA.NumberToString(_traepromosvendidas(_ba,_idpromo,_cliente)),0);};
 //BA.debugLineNum = 1100;BA.debugLine="If traePromosVendidas(idPromo, cliente) >= traeM";
if (_traepromosvendidas(_ba,_idpromo,_cliente)>=_traemaxpromos(_ba,_pm)) { 
 //BA.debugLineNum = 1101;BA.debugLine="If thisLog Then LogColor(\"Ya se vendieron las p";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410878988","Ya se vendieron las promos PERMITIDAS para el cliente",anywheresoftware.b4a.keywords.Common.Colors.Red);};
 //BA.debugLineNum = 1102;BA.debugLine="Return CreateMap(\"status\":\"ko\", \"mp\":pm)";
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("status"),(Object)("ko"),(Object)("mp"),(Object)(_pm.getObject())});
 };
 //BA.debugLineNum = 1105;BA.debugLine="Private inventarioSinFijos As Map = restaFijosPr";
_inventariosinfijos = new anywheresoftware.b4a.objects.collections.Map();
_inventariosinfijos = _restafijospromo(_ba,_pm);
 //BA.debugLineNum = 1106;BA.debugLine="If thisLog Then LogColor(\"inventariosfijos=\"&inv";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410878993","inventariosfijos="+BA.ObjectToString(_inventariosinfijos),anywheresoftware.b4a.keywords.Common.Colors.Green);};
 //BA.debugLineNum = 1108;BA.debugLine="If inventarioSinFijos.Get(\"resultado\") = \"ok\" Th";
if ((_inventariosinfijos.Get((Object)("resultado"))).equals((Object)("ok"))) { 
 //BA.debugLineNum = 1110;BA.debugLine="Private pv As Boolean =  alcanzanLosVariablesPa";
_pv = _alcanzanlosvariablesparapromo(_ba,_pm,_inventariosinfijos);
 //BA.debugLineNum = 1111;BA.debugLine="If thisLog Then Log(\"Alcanzan los variables? --";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410878998","Alcanzan los variables? --> "+BA.ObjectToString(_pv),0);};
 //BA.debugLineNum = 1112;BA.debugLine="If pv Then Return CreateMap(\"status\":\"ok\", \"mp\"";
if (_pv) { 
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("status"),(Object)("ok"),(Object)("mp"),(Object)(_pm.getObject())});}
else {
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("status"),(Object)("ko"),(Object)("mp"),(Object)(_pm.getObject())});};
 }else {
 //BA.debugLineNum = 1114;BA.debugLine="If thisLog Then LogColor(\"NO HAY INVENTARIO SUF";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410879001","NO HAY INVENTARIO SUFICIENTE "+_idpromo,anywheresoftware.b4a.keywords.Common.Colors.Red);};
 //BA.debugLineNum = 1115;BA.debugLine="Return CreateMap(\"status\":\"ko\", \"mp\":pm)";
if (true) return anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("status"),(Object)("ko"),(Object)("mp"),(Object)(_pm.getObject())});
 };
 };
 //BA.debugLineNum = 1121;BA.debugLine="LogColor(\"TIEMPO DE PROCESO ESTA PROMO: \" & ((Dat";
anywheresoftware.b4a.keywords.Common.LogImpl("410879008","TIEMPO DE PROCESO ESTA PROMO: "+BA.NumberToString(((anywheresoftware.b4a.keywords.Common.DateTime.getNow()-(double)(Double.parseDouble(_iniciocontador)))/(double)1000)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 1122;BA.debugLine="End Sub";
return null;
}
public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 3;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 6;BA.debugLine="Public GZip As GZipStrings 		'Usa la libreria Com";
_gzip = new de.donmanfred.GZipStringswrapper();
 //BA.debugLineNum = 7;BA.debugLine="Private su As StringUtils 		'Usa la libreria Stri";
_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="Private subsLogs As Boolean = False";
_subslogs = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 17;BA.debugLine="Dim skmt As SQL";
_skmt = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 18;BA.debugLine="Dim in As Intent";
_in = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 19;BA.debugLine="Dim intentUsado As Boolean = False";
_intentusado = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 20;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _restafijospromo(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _promomap) throws Exception{
boolean _thislog = false;
anywheresoftware.b4a.objects.collections.Map _inventariosdisponiblesparaestapromo = null;
int _i = 0;
anywheresoftware.b4a.objects.collections.Map _prodsmap = null;
anywheresoftware.b4a.objects.collections.List _prodsfijos = null;
int _p = 0;
String _t = "";
anywheresoftware.b4a.objects.collections.Map _p2 = null;
 //BA.debugLineNum = 988;BA.debugLine="Sub restaFijosPromo(promoMap As Map) As Map 'ignor";
 //BA.debugLineNum = 989;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 990;BA.debugLine="Private inventariosDisponiblesParaEstaPromo As Ma";
_inventariosdisponiblesparaestapromo = new anywheresoftware.b4a.objects.collections.Map();
_inventariosdisponiblesparaestapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_promomap.Get((Object)("id"))));
 //BA.debugLineNum = 991;BA.debugLine="If thisLog Then LogColor(inventariosDisponiblesPa";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410682371",BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Red);};
 //BA.debugLineNum = 992;BA.debugLine="If thisLog Then LogColor(\"Inventario inicial ante";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410682372","Inventario inicial antes de FIJOS: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Gray);};
 //BA.debugLineNum = 993;BA.debugLine="Private i As Int";
_i = 0;
 //BA.debugLineNum = 994;BA.debugLine="Private prodsmap As Map = promoMap.Get(\"productos";
_prodsmap = new anywheresoftware.b4a.objects.collections.Map();
_prodsmap = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_promomap.Get((Object)("productos"))));
 //BA.debugLineNum = 995;BA.debugLine="Private prodsFijos As List = promoMap.get(\"prodsF";
_prodsfijos = new anywheresoftware.b4a.objects.collections.List();
_prodsfijos = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_promomap.Get((Object)("prodsFijos"))));
 //BA.debugLineNum = 996;BA.debugLine="For p = 0 To prodsFijos.Size - 1";
{
final int step8 = 1;
final int limit8 = (int) (_prodsfijos.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit8 ;_p = _p + step8 ) {
 //BA.debugLineNum = 997;BA.debugLine="Private t As String = prodsFijos.Get(p) 'Obtenem";
_t = BA.ObjectToString(_prodsfijos.Get(_p));
 //BA.debugLineNum = 998;BA.debugLine="Private p2 As Map = prodsmap.Get(t) 'Obtenemos u";
_p2 = new anywheresoftware.b4a.objects.collections.Map();
_p2 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_prodsmap.Get((Object)(_t))));
 //BA.debugLineNum = 999;BA.debugLine="If thisLog Then Log($\"T: ${t}, prod ${p2.Get(\"id";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410682379",("T: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+", prod "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_p2.Get((Object)("idProducto")))+", piezas: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_p2.Get((Object)("piezas")))+""),0);};
 //BA.debugLineNum = 1000;BA.debugLine="If thisLog Then Log(\"inventariosDisponiblesParaE";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410682380","inventariosDisponiblesParaEstaPromo="+BA.ObjectToString(_inventariosdisponiblesparaestapromo),0);};
 //BA.debugLineNum = 1001;BA.debugLine="If inventariosDisponiblesParaEstaPromo.ContainsK";
if (_inventariosdisponiblesparaestapromo.ContainsKey((Object)(_t))) { 
 //BA.debugLineNum = 1002;BA.debugLine="i = inventariosDisponiblesParaEstaPromo.get(t)";
_i = (int)(BA.ObjectToNumber(_inventariosdisponiblesparaestapromo.Get((Object)(_t))));
 //BA.debugLineNum = 1003;BA.debugLine="If thisLog Then Log($\"Nuevo inventario de ${t}:";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410682383",("Nuevo inventario de "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+": "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_i))+"-"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",((anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_promomap.Get((Object)("prodsFijosPiezas"))))).Get(_p))+" = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("1.0",(Object)(_i-(double)(BA.ObjectToNumber(((anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_promomap.Get((Object)("prodsFijosPiezas"))))).Get(_p)))))+""),0);};
 //BA.debugLineNum = 1004;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(t, $\"${";
_inventariosdisponiblesparaestapromo.Put((Object)(_t),(Object)((""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_i-(double)(BA.ObjectToNumber(((anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_promomap.Get((Object)("prodsFijosPiezas"))))).Get(_p)))))+"")));
 //BA.debugLineNum = 1005;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ok"));
 }else {
 //BA.debugLineNum = 1007;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("No hay suficiente producto para la promocion."));
 //BA.debugLineNum = 1008;BA.debugLine="LogColor(\"Sin suficiente inventario fijo: \" & t";
anywheresoftware.b4a.keywords.Common.LogImpl("410682388","Sin suficiente inventario fijo: "+_t,anywheresoftware.b4a.keywords.Common.Colors.Blue);
 //BA.debugLineNum = 1009;BA.debugLine="Exit";
if (true) break;
 };
 //BA.debugLineNum = 1011;BA.debugLine="If i - p2.Get(\"piezas\") < 0 Then";
if (_i-(double)(BA.ObjectToNumber(_p2.Get((Object)("piezas"))))<0) { 
 //BA.debugLineNum = 1012;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("No hay suficiente producto para la promocion."));
 //BA.debugLineNum = 1013;BA.debugLine="Exit";
if (true) break;
 };
 }
};
 //BA.debugLineNum = 1016;BA.debugLine="If prodsFijos.Size = 0 Then inventariosDisponible";
if (_prodsfijos.getSize()==0) { 
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ok"));};
 //BA.debugLineNum = 1017;BA.debugLine="If thisLog Then LogColor(\"Inventario final depues";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410682397","Inventario final depues de FIJOS: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1018;BA.debugLine="Return inventariosDisponiblesParaEstaPromo";
if (true) return _inventariosdisponiblesparaestapromo;
 //BA.debugLineNum = 1019;BA.debugLine="End Sub";
return null;
}
public static String  _revisabd(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 217;BA.debugLine="Sub revisaBD 'ignore";
 //BA.debugLineNum = 219;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 = 220;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 = 221;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 = 223;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS bita";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)");
 //BA.debugLineNum = 225;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 = 226;BA.debugLine="errorLog.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS";
_errorlog.ExecNonQuery("CREATE TABLE IF NOT EXISTS errores(fecha INTEGER, error TEXT)");
 //BA.debugLineNum = 227;BA.debugLine="End Sub";
return "";
}
public static String  _revisaflp(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _todobienflp = false;
 //BA.debugLineNum = 380;BA.debugLine="Sub revisaFLP 'ignore";
 //BA.debugLineNum = 381;BA.debugLine="LogColor(\"**** **** Revisamos FLP **** ****\", Col";
anywheresoftware.b4a.keywords.Common.LogImpl("48519681","**** **** Revisamos FLP **** ****",anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (78),(int) (0),(int) (227)));
 //BA.debugLineNum = 382;BA.debugLine="Private todoBienFLP As Boolean = True";
_todobienflp = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 383;BA.debugLine="Try";
try { //BA.debugLineNum = 384;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 = 385;BA.debugLine="log2DB(\"revisaFLP: No esta inicializado ... 'Re";
_log2db(_ba,"revisaFLP: No esta inicializado ... 'Reinicializando FLP'");
 //BA.debugLineNum = 386;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 = 387;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e10) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e10); //BA.debugLineNum = 390;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsInitialized) ---";
anywheresoftware.b4a.keywords.Common.LogImpl("48519690","If Not(Tracker.FLP.IsInitialized) --- "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 392;BA.debugLine="Try";
try { //BA.debugLineNum = 393;BA.debugLine="If Tracker.FLP.IsInitialized Then";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsInitialized()) { 
 //BA.debugLineNum = 394;BA.debugLine="Try";
try { //BA.debugLineNum = 395;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 = 396;BA.debugLine="log2DB(\"revisaFLP: No esta conectado ... 'Rec";
_log2db(_ba,"revisaFLP: No esta conectado ... 'Reconectando FLP'");
 //BA.debugLineNum = 398;BA.debugLine="CallSubDelayed(Tracker,\"StartFLP\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()),"StartFLP");
 //BA.debugLineNum = 399;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e21) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e21); //BA.debugLineNum = 402;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsConnected) -->";
anywheresoftware.b4a.keywords.Common.LogImpl("48519702","If Not(Tracker.FLP.IsConnected) --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 404;BA.debugLine="Try";
try { //BA.debugLineNum = 405;BA.debugLine="If Tracker.FLP.IsConnected And _ 					Tracker.";
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 = 408;BA.debugLine="log2DB(\"revisaFLP: 'No se esta actualizando,";
_log2db(_ba,"revisaFLP: 'No se esta actualizando, lo reiniciamos ...'");
 //BA.debugLineNum = 409;BA.debugLine="StartService(Tracker)";
anywheresoftware.b4a.keywords.Common.StartService((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()));
 //BA.debugLineNum = 410;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e30) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e30); //BA.debugLineNum = 413;BA.debugLine="LogColor(\"If FLP.IsConnectctd and FLP.getLKL.I";
anywheresoftware.b4a.keywords.Common.LogImpl("48519713","If FLP.IsConnectctd and FLP.getLKL.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
 //BA.debugLineNum = 416;BA.debugLine="If todoBienFLP Then LogColor(\" +++ +++ Sin error";
if (_todobienflp) { 
anywheresoftware.b4a.keywords.Common.LogImpl("48519716"," +++ +++ Sin errores en FLP",anywheresoftware.b4a.keywords.Common.Colors.Green);};
 } 
       catch (Exception e35) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e35); //BA.debugLineNum = 418;BA.debugLine="LogColor(\"If Tracker.FLP.IsInitialized --> \"&Las";
anywheresoftware.b4a.keywords.Common.LogImpl("48519718","If Tracker.FLP.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 421;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _revisaforzaractualizacion(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _ra = null;
String _nuevaversion = "";
int _forzaractualizacion = 0;
anywheresoftware.b4a.objects.collections.Map _m = null;
 //BA.debugLineNum = 1685;BA.debugLine="Sub revisaForzarActualizacion As Map";
 //BA.debugLineNum = 1686;BA.debugLine="Private ra As ResultSet = Starter.skmt.ExecQuery(";
_ra = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_ra = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'VERSION_NUEVA' or CAT_VA_DESCRIPCION = 'FORZAR_ACTUALIZACION'"))));
 //BA.debugLineNum = 1687;BA.debugLine="Private nuevaVersion As String = \"\"";
_nuevaversion = "";
 //BA.debugLineNum = 1688;BA.debugLine="Private forzarActualizacion As Int = 2";
_forzaractualizacion = (int) (2);
 //BA.debugLineNum = 1689;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1690;BA.debugLine="m.Initialize";
_m.Initialize();
 //BA.debugLineNum = 1691;BA.debugLine="Do While ra.NextRow";
while (_ra.NextRow()) {
 //BA.debugLineNum = 1692;BA.debugLine="If ra.GetString(\"CAT_VA_DESCRIPCION\") = \"VERSION";
if ((_ra.GetString("CAT_VA_DESCRIPCION")).equals("VERSION_NUEVA")) { 
_nuevaversion = _ra.GetString("CAT_VA_VALOR");};
 //BA.debugLineNum = 1693;BA.debugLine="If ra.GetString(\"CAT_VA_DESCRIPCION\") = \"FORZAR_";
if ((_ra.GetString("CAT_VA_DESCRIPCION")).equals("FORZAR_ACTUALIZACION")) { 
_forzaractualizacion = _ra.GetInt("CAT_VA_VALOR");};
 }
;
 //BA.debugLineNum = 1697;BA.debugLine="If nuevaVersion <> Application.VersionName And fo";
if ((_nuevaversion).equals(anywheresoftware.b4a.keywords.Common.Application.getVersionName()) == false && _forzaractualizacion==1) { 
 //BA.debugLineNum = 1698;BA.debugLine="m.Put(\"forzar\", 1)";
_m.Put((Object)("forzar"),(Object)(1));
 //BA.debugLineNum = 1699;BA.debugLine="m.Put(\"nuevaVersion\", nuevaVersion)";
_m.Put((Object)("nuevaVersion"),(Object)(_nuevaversion));
 }else if(_forzaractualizacion==2) { 
 //BA.debugLineNum = 1701;BA.debugLine="m.Put(\"forzar\", 2)";
_m.Put((Object)("forzar"),(Object)(2));
 //BA.debugLineNum = 1702;BA.debugLine="m.Put(\"nuevaVersion\", \"Recargar\")";
_m.Put((Object)("nuevaVersion"),(Object)("Recargar"));
 }else {
 //BA.debugLineNum = 1704;BA.debugLine="m.Put(\"forzar\", 0)";
_m.Put((Object)("forzar"),(Object)(0));
 //BA.debugLineNum = 1705;BA.debugLine="m.Put(\"nuevaVersion\", nuevaVersion)";
_m.Put((Object)("nuevaVersion"),(Object)(_nuevaversion));
 };
 //BA.debugLineNum = 1707;BA.debugLine="If nuevaVersion = \"\" Or nuevaVersion = Null Or nu";
if ((_nuevaversion).equals("") || _nuevaversion== null || (_nuevaversion).equals("null")) { 
 //BA.debugLineNum = 1708;BA.debugLine="m.Put(\"forzar\", 0)";
_m.Put((Object)("forzar"),(Object)(0));
 //BA.debugLineNum = 1709;BA.debugLine="m.Put(\"nuevaVersion\", \"\")";
_m.Put((Object)("nuevaVersion"),(Object)(""));
 };
 //BA.debugLineNum = 1711;BA.debugLine="Return m";
if (true) return _m;
 //BA.debugLineNum = 1712;BA.debugLine="End Sub";
return null;
}
public static boolean  _revisaimpreso(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _impreso = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 1925;BA.debugLine="Sub revisaImpreso As Boolean 'ignore";
 //BA.debugLineNum = 1926;BA.debugLine="Private impreso As Boolean = False";
_impreso = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1927;BA.debugLine="Private c As Cursor = Starter.skmt.ExecQuery(\"sel";
_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 idCliente from ticket_impreso where idCliente in (select cuenta from cuentaa)")));
 //BA.debugLineNum = 1928;BA.debugLine="If c.RowCount > 0 Then impreso = True";
if (_c.getRowCount()>0) { 
_impreso = anywheresoftware.b4a.keywords.Common.True;};
 //BA.debugLineNum = 1929;BA.debugLine="Return impreso";
if (true) return _impreso;
 //BA.debugLineNum = 1930;BA.debugLine="End Sub";
return false;
}
public static int  _revisamaxpromosprodsfijosporinventario(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _pm) throws Exception{
boolean _thislog = false;
anywheresoftware.b4a.objects.collections.Map _invfijoxpromo = null;
anywheresoftware.b4a.objects.collections.List _t = null;
anywheresoftware.b4a.objects.collections.Map _invdispparapromo = null;
anywheresoftware.b4a.objects.collections.List _prodsfijospiezas = null;
anywheresoftware.b4a.objects.collections.List _idprodsfijos = null;
int _p = 0;
String[] _x = null;
 //BA.debugLineNum = 1168;BA.debugLine="Sub revisaMaxPromosProdsFijosPorInventario(pm As M";
 //BA.debugLineNum = 1169;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1170;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1171;BA.debugLine="Private t As List";
_t = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 1172;BA.debugLine="t.Initialize";
_t.Initialize();
 //BA.debugLineNum = 1173;BA.debugLine="t.Add(traeMaxPromos(pm)) ' Agregamos a la lista l";
_t.Add((Object)(_traemaxpromos(_ba,_pm)));
 //BA.debugLineNum = 1174;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
 //BA.debugLineNum = 1175;BA.debugLine="If thisLog Then LogColor($\"pm=${pm}\"$, Colors.Blu";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("411010055",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1176;BA.debugLine="Private invDispParaPromo As Map = traemosInventar";
_invdispparapromo = new anywheresoftware.b4a.objects.collections.Map();
_invdispparapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_pm.Get((Object)("id"))));
 //BA.debugLineNum = 1177;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("411010057",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
 //BA.debugLineNum = 1178;BA.debugLine="Private prodsFijosPiezas As List = pm.Get(\"prodsF";
_prodsfijospiezas = new anywheresoftware.b4a.objects.collections.List();
_prodsfijospiezas = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsFijosPiezas"))));
 //BA.debugLineNum = 1179;BA.debugLine="Private idProdsFijos As List = pm.Get(\"prodsFijos";
_idprodsfijos = new anywheresoftware.b4a.objects.collections.List();
_idprodsfijos = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsFijos"))));
 //BA.debugLineNum = 1180;BA.debugLine="For p = 0 To idProdsFijos.Size -1 'Generamos una";
{
final int step12 = 1;
final int limit12 = (int) (_idprodsfijos.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit12 ;_p = _p + step12 ) {
 //BA.debugLineNum = 1181;BA.debugLine="If thisLog Then Log($\"id=${idProdsFijos.Get(p)},";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("411010061",("id="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_idprodsfijos.Get(_p))+", inv="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_invdispparapromo.Get(_idprodsfijos.Get(_p)))+", pzas="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_prodsfijospiezas.Get(_p))+""),0);};
 //BA.debugLineNum = 1182;BA.debugLine="If thisLog Then Log($\"${(invDispParaPromo.Get(id";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("411010062",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsfijos.Get(_p))))/(double)(double)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p))))))+""),0);};
 //BA.debugLineNum = 1183;BA.debugLine="Log(prodsFijosPiezas.Get(p))";
anywheresoftware.b4a.keywords.Common.LogImpl("411010063",BA.ObjectToString(_prodsfijospiezas.Get(_p)),0);
 //BA.debugLineNum = 1184;BA.debugLine="Log(prodsFijosPiezas.Get(p))";
anywheresoftware.b4a.keywords.Common.LogImpl("411010064",BA.ObjectToString(_prodsfijospiezas.Get(_p)),0);
 //BA.debugLineNum = 1185;BA.debugLine="Log(idProdsFijos.Get(p))";
anywheresoftware.b4a.keywords.Common.LogImpl("411010065",BA.ObjectToString(_idprodsfijos.Get(_p)),0);
 //BA.debugLineNum = 1186;BA.debugLine="Log((invDispParaPromo.Get(idProdsFijos.Get(p)) /";
anywheresoftware.b4a.keywords.Common.LogImpl("411010066",BA.NumberToString(((double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsfijos.Get(_p))))/(double)(double)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p))))),0);
 //BA.debugLineNum = 1187;BA.debugLine="Private x() As String = Regex.Split(\"\\.\", $\"${(i";
_x = anywheresoftware.b4a.keywords.Common.Regex.Split("\\.",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsfijos.Get(_p))))/(double)(double)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p))))))+""));
 //BA.debugLineNum = 1188;BA.debugLine="If thisLog Then Log(x(0))";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("411010068",_x[(int) (0)],0);};
 //BA.debugLineNum = 1189;BA.debugLine="t.Add(x(0).As(Int)) 'Solo guardamos la parte del";
_t.Add((Object)(((int)(Double.parseDouble(_x[(int) (0)])))));
 }
};
 //BA.debugLineNum = 1191;BA.debugLine="t.Sort(True) 'Ordenamos la lista para que en el l";
_t.Sort(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1192;BA.debugLine="If thisLog Then LogColor($\"prodsFijos=${idProdsFi";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("411010072",("prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsfijos.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1193;BA.debugLine="If thisLog Then LogColor($\"prodsFijosPiezasReq=${";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("411010073",("prodsFijosPiezasReq="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsfijospiezas.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1194;BA.debugLine="If thisLog Then LogColor($\"invFijoXpromo=${invFij";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("411010074",("invFijoXpromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invfijoxpromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1195;BA.debugLine="LogColor(\"Max promos de prodsFijos POR inventario";
anywheresoftware.b4a.keywords.Common.LogImpl("411010075","Max promos de prodsFijos POR inventario = "+BA.ObjectToString(_t.Get((int) (0))),anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 1196;BA.debugLine="Return t.Get(0) 'Regresamos el resultado mas pequ";
if (true) return (int)(BA.ObjectToNumber(_t.Get((int) (0))));
 //BA.debugLineNum = 1197;BA.debugLine="End Sub";
return 0;
}
public static int  _revisamaxpromosprodsfijosporinventario2(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _pm) throws Exception{
boolean _thislog = false;
anywheresoftware.b4a.objects.collections.Map _invdispparapromo = null;
String _maxpromos = "";
int _maxpromosfijosxinv = 0;
int _fpf2 = 0;
int _pdp2 = 0;
boolean _salir = false;
anywheresoftware.b4a.objects.collections.List _pf = null;
anywheresoftware.b4a.objects.collections.List _pfp = null;
anywheresoftware.b4a.objects.collections.Map _invfijoxpromo = null;
int _p = 0;
int _i = 0;
int _q = 0;
String _q2 = "";
 //BA.debugLineNum = 1125;BA.debugLine="Sub revisaMaxPromosProdsFijosPorInventario2(pm As";
 //BA.debugLineNum = 1126;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1127;BA.debugLine="If thisLog Then Log($\"pm=${pm}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944514",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),0);};
 //BA.debugLineNum = 1129;BA.debugLine="Private invDispParaPromo As Map = traemosInventar";
_invdispparapromo = new anywheresoftware.b4a.objects.collections.Map();
_invdispparapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_pm.Get((Object)("id"))));
 //BA.debugLineNum = 1130;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944517",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
 //BA.debugLineNum = 1131;BA.debugLine="Private maxPromos As String = traeMaxPromos(pm)";
_maxpromos = BA.NumberToString(_traemaxpromos(_ba,_pm));
 //BA.debugLineNum = 1132;BA.debugLine="Private maxPromosFijosXinv As Int = 1";
_maxpromosfijosxinv = (int) (1);
 //BA.debugLineNum = 1133;BA.debugLine="Private fpf2, pdp2 As Int";
_fpf2 = 0;
_pdp2 = 0;
 //BA.debugLineNum = 1134;BA.debugLine="Private salir As Boolean = False";
_salir = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1135;BA.debugLine="Private pf As List = pm.Get(\"prodsFijos\")";
_pf = new anywheresoftware.b4a.objects.collections.List();
_pf = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsFijos"))));
 //BA.debugLineNum = 1136;BA.debugLine="Private pfp As List = pm.Get(\"prodsFijosPiezas\")";
_pfp = new anywheresoftware.b4a.objects.collections.List();
_pfp = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsFijosPiezas"))));
 //BA.debugLineNum = 1137;BA.debugLine="If thisLog Then Log($\"maxPromos=${maxPromos}, pro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944524",("maxPromos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromos))+", prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pf.getObject()))+", piezas="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pfp.getObject()))+""),0);};
 //BA.debugLineNum = 1138;BA.debugLine="If thisLog Then LogColor($\"InvFijo disponible=${i";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944525",("InvFijo disponible="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1139;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1140;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
 //BA.debugLineNum = 1141;BA.debugLine="For p = 0 To pf.Size -1 'Generamos mapa con los p";
{
final int step15 = 1;
final int limit15 = (int) (_pf.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit15 ;_p = _p + step15 ) {
 //BA.debugLineNum = 1142;BA.debugLine="invFijoXpromo.Put(pf.Get(p), pfp.Get(p))";
_invfijoxpromo.Put(_pf.Get(_p),_pfp.Get(_p));
 }
};
 //BA.debugLineNum = 1144;BA.debugLine="If thisLog Then LogColor(\"Inv req. de prods fijos";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944531","Inv req. de prods fijos x promo"+BA.ObjectToString(_invfijoxpromo),anywheresoftware.b4a.keywords.Common.Colors.Green);};
 //BA.debugLineNum = 1145;BA.debugLine="For i = 1 To maxPromos 'Revisamos cuantas promoci";
{
final int step19 = 1;
final int limit19 = (int)(Double.parseDouble(_maxpromos));
_i = (int) (1) ;
for (;_i <= limit19 ;_i = _i + step19 ) {
 //BA.debugLineNum = 1146;BA.debugLine="If thisLog Then LogColor(\"Prods para promo \" & (";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944533","Prods para promo "+BA.NumberToString((_i+1)),anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
 //BA.debugLineNum = 1147;BA.debugLine="For q = 0 To pf.Size - 1";
{
final int step21 = 1;
final int limit21 = (int) (_pf.getSize()-1);
_q = (int) (0) ;
for (;_q <= limit21 ;_q = _q + step21 ) {
 //BA.debugLineNum = 1148;BA.debugLine="Private q2 As String = pf.Get(q)";
_q2 = BA.ObjectToString(_pf.Get(_q));
 //BA.debugLineNum = 1149;BA.debugLine="If thisLog Then Log(\"q=\"&q2)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944536","q="+_q2,0);};
 //BA.debugLineNum = 1151;BA.debugLine="fpf2 = pfp.Get(q) * i 'Multiplicamos las piezas";
_fpf2 = (int) ((double)(BA.ObjectToNumber(_pfp.Get(_q)))*_i);
 //BA.debugLineNum = 1152;BA.debugLine="pdp2 = invDispParaPromo.Get(q2)";
_pdp2 = (int)(BA.ObjectToNumber(_invdispparapromo.Get((Object)(_q2))));
 //BA.debugLineNum = 1153;BA.debugLine="If thisLog Then Log($\"pf=${q2}, Actual=${(i)},";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944540",("pf="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_q2))+", Actual="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)((_i)))+", max promos: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pdp2))+"-"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_fpf2))+"="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pdp2-_fpf2))+""),0);};
 //BA.debugLineNum = 1154;BA.debugLine="If pdp2 - fpf2 < 0 Then 'Si el inventario es ne";
if (_pdp2-_fpf2<0) { 
 //BA.debugLineNum = 1155;BA.debugLine="salir=True";
_salir = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1156;BA.debugLine="Exit";
if (true) break;
 };
 }
};
 //BA.debugLineNum = 1159;BA.debugLine="If salir Then Exit";
if (_salir) { 
if (true) break;};
 //BA.debugLineNum = 1160;BA.debugLine="maxPromosFijosXinv = i";
_maxpromosfijosxinv = _i;
 }
};
 //BA.debugLineNum = 1162;BA.debugLine="If thisLog Then LogColor(\"InvFijo requerido x pro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410944549","InvFijo requerido x promo="+BA.ObjectToString(_invfijoxpromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1163;BA.debugLine="LogColor(\"Maximo de promociones de prodsFijos POR";
anywheresoftware.b4a.keywords.Common.LogImpl("410944550","Maximo de promociones de prodsFijos POR inventario = "+BA.NumberToString(_maxpromosfijosxinv),anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 1164;BA.debugLine="Return maxPromosFijosXinv";
if (true) return _maxpromosfijosxinv;
 //BA.debugLineNum = 1165;BA.debugLine="End Sub";
return 0;
}
public static int  _revisamaxpromosprodsvariablesporinventario(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _pm) throws Exception{
boolean _thislog = false;
anywheresoftware.b4a.objects.collections.Map _invfijoxpromo = null;
int _totalprodsvariablesdisponibles = 0;
int _totalprodsvariables2disponibles = 0;
anywheresoftware.b4a.objects.collections.Map _invdispparapromo = null;
String _maxpromos = "";
int _maxpromosxfijos = 0;
anywheresoftware.b4a.objects.collections.List _idprodsvariables = null;
anywheresoftware.b4a.objects.collections.List _idprodsvariables2 = null;
int _prodsvariablesrequeridos = 0;
int _prodsvariables2requeridos = 0;
anywheresoftware.b4a.objects.collections.List _prodsfijospiezas = null;
anywheresoftware.b4a.objects.collections.List _idprodsfijos = null;
int _p = 0;
String _idesteprod = "";
int _investeprod = 0;
int _pzasreqesteprod = 0;
int _maxpromosxvariables = 0;
int _maxpromosxvariables2 = 0;
int _x = 0;
int _i = 0;
 //BA.debugLineNum = 2122;BA.debugLine="Sub revisaMaxPromosProdsVariablesPorInventario(pm";
 //BA.debugLineNum = 2123;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 2124;BA.debugLine="If thisLog Then Log(\"============================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369346","======================================================",0);};
 //BA.debugLineNum = 2125;BA.debugLine="If thisLog Then Log(\"============================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369347","======================================================",0);};
 //BA.debugLineNum = 2126;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 2127;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
 //BA.debugLineNum = 2128;BA.debugLine="Private totalProdsVariablesDisponibles As Int = 0";
_totalprodsvariablesdisponibles = (int) (0);
 //BA.debugLineNum = 2129;BA.debugLine="Private totalProdsVariables2Disponibles As Int =";
_totalprodsvariables2disponibles = (int) (0);
 //BA.debugLineNum = 2130;BA.debugLine="If thisLog Then LogColor($\"pm=${pm}\"$, Colors.Blu";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369352",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 2131;BA.debugLine="Private invDispParaPromo As Map = traemosInventar";
_invdispparapromo = new anywheresoftware.b4a.objects.collections.Map();
_invdispparapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_pm.Get((Object)("id"))));
 //BA.debugLineNum = 2132;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369354",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
 //BA.debugLineNum = 2133;BA.debugLine="Private maxPromos As String = traeMaxPromos(pm)";
_maxpromos = BA.NumberToString(_traemaxpromos(_ba,_pm));
 //BA.debugLineNum = 2134;BA.debugLine="Private maxPromosXFijos As Int = revisaMaxPromosP";
_maxpromosxfijos = _revisamaxpromosprodsfijosporinventario(_ba,_pm);
 //BA.debugLineNum = 2135;BA.debugLine="Private idProdsVariables As List = pm.Get(\"prodsV";
_idprodsvariables = new anywheresoftware.b4a.objects.collections.List();
_idprodsvariables = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsVariables"))));
 //BA.debugLineNum = 2136;BA.debugLine="Private idProdsVariables2 As List = pm.Get(\"prods";
_idprodsvariables2 = new anywheresoftware.b4a.objects.collections.List();
_idprodsvariables2 = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsVariables2"))));
 //BA.debugLineNum = 2137;BA.debugLine="Private prodsVariablesRequeridos As Int = pm.Get(";
_prodsvariablesrequeridos = (int)(BA.ObjectToNumber(_pm.Get((Object)("prodsVariablesRequeridos"))));
 //BA.debugLineNum = 2138;BA.debugLine="Private prodsVariables2Requeridos As Int = pm.Get";
_prodsvariables2requeridos = (int)(BA.ObjectToNumber(_pm.Get((Object)("prodsVariables2Requeridos"))));
 //BA.debugLineNum = 2139;BA.debugLine="Private prodsFijosPiezas As List = pm.Get(\"prodsF";
_prodsfijospiezas = new anywheresoftware.b4a.objects.collections.List();
_prodsfijospiezas = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsFijosPiezas"))));
 //BA.debugLineNum = 2140;BA.debugLine="Private idProdsFijos As List = pm.Get(\"prodsFijos";
_idprodsfijos = new anywheresoftware.b4a.objects.collections.List();
_idprodsfijos = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsFijos"))));
 //BA.debugLineNum = 2141;BA.debugLine="For p = 0 To idProdsFijos.Size -1 'Generamos mapa";
{
final int step19 = 1;
final int limit19 = (int) (_idprodsfijos.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit19 ;_p = _p + step19 ) {
 //BA.debugLineNum = 2142;BA.debugLine="invFijoXpromo.Put(idProdsFijos.Get(p), prodsFijo";
_invfijoxpromo.Put(_idprodsfijos.Get(_p),_prodsfijospiezas.Get(_p));
 //BA.debugLineNum = 2143;BA.debugLine="Private idEsteProd As String = idProdsFijos.Get(";
_idesteprod = BA.ObjectToString(_idprodsfijos.Get(_p));
 //BA.debugLineNum = 2144;BA.debugLine="Private invEsteProd As Int = invDispParaPromo.Ge";
_investeprod = (int)(BA.ObjectToNumber(_invdispparapromo.Get((Object)(_idesteprod))));
 //BA.debugLineNum = 2145;BA.debugLine="Private pzasReqEsteProd As Int = prodsFijosPieza";
_pzasreqesteprod = (int)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p)));
 //BA.debugLineNum = 2146;BA.debugLine="If thisLog Then Log($\"id=${idEsteProd}, inv=${in";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369368",("id="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idesteprod))+", inv="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_investeprod))+", pzas="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pzasreqesteprod))+""),0);};
 }
};
 //BA.debugLineNum = 2149;BA.debugLine="If thisLog Then LogColor($\"MaxPromos=${maxPromos}";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369371",("MaxPromos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromos))+", promosXFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromosxfijos))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 2150;BA.debugLine="If thisLog Then LogColor($\"prodsFijos=${idProdsFi";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369372",("prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsfijos.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 2151;BA.debugLine="If thisLog Then LogColor($\"prodsFijosPiezasReq=${";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369373",("prodsFijosPiezasReq="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsfijospiezas.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 2152;BA.debugLine="If thisLog Then LogColor($\"prodsVariables=${idPro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369374",("prodsVariables="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsvariables.getObject()))+""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.CRLF))+"Variables Req="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsvariablesrequeridos))+" "),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 2153;BA.debugLine="If thisLog Then LogColor($\"prodsVariables2=${idPr";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369375",("prodsVariables2="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsvariables2.getObject()))+""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.CRLF))+"Variables2 Req="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsvariables2requeridos))+" "),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 2154;BA.debugLine="If thisLog Then LogColor($\"invFijoXpromo=${invFij";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369376",("invFijoXpromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invfijoxpromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 2155;BA.debugLine="If thisLog Then Log($\"Prods variables disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369377",("Prods variables disponibles = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariablesdisponibles))+""),0);};
 //BA.debugLineNum = 2156;BA.debugLine="If thisLog Then Log($\"Prods variables2 disponible";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369378",("Prods variables2 disponibles = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariables2disponibles))+""),0);};
 //BA.debugLineNum = 2157;BA.debugLine="Private maxPromosXVariables As Int = 0";
_maxpromosxvariables = (int) (0);
 //BA.debugLineNum = 2158;BA.debugLine="Private maxPromosXVariables2 As Int = 0";
_maxpromosxvariables2 = (int) (0);
 //BA.debugLineNum = 2159;BA.debugLine="For x = 1 To maxPromosXFijos";
{
final int step36 = 1;
final int limit36 = _maxpromosxfijos;
_x = (int) (1) ;
for (;_x <= limit36 ;_x = _x + step36 ) {
 //BA.debugLineNum = 2160;BA.debugLine="If thisLog Then Log(\"===========================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369382","=====================================================",0);};
 //BA.debugLineNum = 2161;BA.debugLine="If thisLog Then Log(\"===========================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369383","=====================================================",0);};
 //BA.debugLineNum = 2162;BA.debugLine="For i = 0 To idProdsFijos.Size - 1";
{
final int step39 = 1;
final int limit39 = (int) (_idprodsfijos.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit39 ;_i = _i + step39 ) {
 //BA.debugLineNum = 2163;BA.debugLine="If thisLog Then Log($\"FIJO - ${idProdsFijos.Get";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369385",("FIJO - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_idprodsfijos.Get(_i))+", "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_invdispparapromo.Get(_idprodsfijos.Get(_i)))+" - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((int)(BA.ObjectToNumber(_prodsfijospiezas.Get(_i))))*(_i+1)))+""),0);};
 //BA.debugLineNum = 2164;BA.debugLine="invDispParaPromo.Put(idProdsFijos.Get(i), invDi";
_invdispparapromo.Put(_idprodsfijos.Get(_i),(Object)(((int)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsfijos.Get(_i)))))-((int)(BA.ObjectToNumber(_prodsfijospiezas.Get(_i))))*(_i+1)));
 }
};
 //BA.debugLineNum = 2166;BA.debugLine="If thisLog Then LogColor(\"Inv disponible despues";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369388","Inv disponible despues de restar fijos = "+BA.ObjectToString(_invdispparapromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 2168;BA.debugLine="totalProdsVariablesDisponibles = 0";
_totalprodsvariablesdisponibles = (int) (0);
 //BA.debugLineNum = 2169;BA.debugLine="totalProdsVariables2Disponibles = 0";
_totalprodsvariables2disponibles = (int) (0);
 //BA.debugLineNum = 2170;BA.debugLine="For i = 0 To idProdsVariables.Size - 1 'Obtenemo";
{
final int step46 = 1;
final int limit46 = (int) (_idprodsvariables.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit46 ;_i = _i + step46 ) {
 //BA.debugLineNum = 2171;BA.debugLine="If invDispParaPromo.ContainsKey(idProdsVariable";
if (_invdispparapromo.ContainsKey(_idprodsvariables.Get(_i))) { 
 //BA.debugLineNum = 2172;BA.debugLine="totalProdsVariablesDisponibles = totalProdsVar";
_totalprodsvariablesdisponibles = (int) (_totalprodsvariablesdisponibles+(double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsvariables.Get(_i)))));
 };
 }
};
 //BA.debugLineNum = 2175;BA.debugLine="For i = 0 To idProdsVariables2.Size - 1 'Obtenem";
{
final int step51 = 1;
final int limit51 = (int) (_idprodsvariables2.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit51 ;_i = _i + step51 ) {
 //BA.debugLineNum = 2176;BA.debugLine="If invDispParaPromo.ContainsKey(idProdsVariable";
if (_invdispparapromo.ContainsKey(_idprodsvariables2.Get(_i))) { 
 //BA.debugLineNum = 2177;BA.debugLine="totalProdsVariables2Disponibles = totalProdsVa";
_totalprodsvariables2disponibles = (int) (_totalprodsvariables2disponibles+(double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsvariables2.Get(_i)))));
 };
 }
};
 //BA.debugLineNum = 2181;BA.debugLine="If thisLog Then Log($\"Var disponibles -  var req";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369403",("Var disponibles -  var requeridos : "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariablesdisponibles))+" - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsvariablesrequeridos*_x))+""),0);};
 //BA.debugLineNum = 2182;BA.debugLine="totalProdsVariablesDisponibles = totalProdsVaria";
_totalprodsvariablesdisponibles = (int) (_totalprodsvariablesdisponibles-(_prodsvariablesrequeridos*_x));
 //BA.debugLineNum = 2183;BA.debugLine="totalProdsVariables2Disponibles = totalProdsVari";
_totalprodsvariables2disponibles = (int) (_totalprodsvariables2disponibles-(_prodsvariables2requeridos*_x));
 //BA.debugLineNum = 2184;BA.debugLine="If thisLog Then Log(\"prodsVariables disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369406","prodsVariables disponibles despues de promo = "+BA.NumberToString(_totalprodsvariablesdisponibles),0);};
 //BA.debugLineNum = 2185;BA.debugLine="If thisLog Then Log(\"prodsVariables2 disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369407","prodsVariables2 disponibles despues de promo = "+BA.NumberToString(_totalprodsvariables2disponibles),0);};
 //BA.debugLineNum = 2186;BA.debugLine="If totalProdsVariablesDisponibles < 0 Then Exit";
if (_totalprodsvariablesdisponibles<0) { 
if (true) break;};
 //BA.debugLineNum = 2187;BA.debugLine="If totalProdsVariables2Disponibles < 0 Then Exit";
if (_totalprodsvariables2disponibles<0) { 
if (true) break;};
 //BA.debugLineNum = 2188;BA.debugLine="maxPromosXVariables = x";
_maxpromosxvariables = _x;
 }
};
 //BA.debugLineNum = 2191;BA.debugLine="If thisLog Then LogColor(\"Max promos de prodsVari";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("413369413","Max promos de prodsVariables POR inventario = "+BA.NumberToString(_maxpromosxvariables),anywheresoftware.b4a.keywords.Common.Colors.Red);};
 //BA.debugLineNum = 2192;BA.debugLine="Return maxPromosXVariables";
if (true) return _maxpromosxvariables;
 //BA.debugLineNum = 2193;BA.debugLine="End Sub";
return 0;
}
public static boolean  _revisapro2265(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _r = null;
boolean _x = false;
 //BA.debugLineNum = 1651;BA.debugLine="Sub revisaPRO2265(idCliente As String) As Boolean";
 //BA.debugLineNum = 1652;BA.debugLine="Private r As ResultSet = Starter.skmt.ExecQuery($";
_r = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_r = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from HIST_PRO2265 where H_IDCLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"'"))));
 //BA.debugLineNum = 1653;BA.debugLine="Private x As Boolean = False";
_x = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1654;BA.debugLine="Do While r.NextRow";
while (_r.NextRow()) {
 //BA.debugLineNum = 1655;BA.debugLine="x = True";
_x = anywheresoftware.b4a.keywords.Common.True;
 }
;
 //BA.debugLineNum = 1657;BA.debugLine="Log($\">>>>  revisaPRO2265 ${idCliente} = ${x}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("411993094",(">>>>  revisaPRO2265 "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+" = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_x))+""),0);
 //BA.debugLineNum = 1658;BA.debugLine="Return x";
if (true) return _x;
 //BA.debugLineNum = 1659;BA.debugLine="End Sub";
return false;
}
public static boolean  _revisapro3054(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _r = null;
boolean _x = false;
 //BA.debugLineNum = 1662;BA.debugLine="Sub revisaPRO3054(idCliente As String) As Boolean";
 //BA.debugLineNum = 1663;BA.debugLine="Private r As ResultSet = Starter.skmt.ExecQuery($";
_r = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_r = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from HIST_PRO3054 where H_IDCLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"'"))));
 //BA.debugLineNum = 1664;BA.debugLine="Private x As Boolean = False";
_x = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1665;BA.debugLine="Do While r.NextRow";
while (_r.NextRow()) {
 //BA.debugLineNum = 1666;BA.debugLine="x = True";
_x = anywheresoftware.b4a.keywords.Common.True;
 }
;
 //BA.debugLineNum = 1668;BA.debugLine="Log($\">>>>  revisaPRO3054 ${idCliente} = ${x}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("412058630",(">>>>  revisaPRO3054 "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+" = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_x))+""),0);
 //BA.debugLineNum = 1669;BA.debugLine="Return x";
if (true) return _x;
 //BA.debugLineNum = 1670;BA.debugLine="End Sub";
return false;
}
public static boolean  _revisapro3055(anywheresoftware.b4a.BA _ba,String _idcliente) throws Exception{
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _r = null;
boolean _x = false;
 //BA.debugLineNum = 1673;BA.debugLine="Sub revisaPRO3055(idCliente As String) As Boolean";
 //BA.debugLineNum = 1674;BA.debugLine="Private r As ResultSet = Starter.skmt.ExecQuery($";
_r = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_r = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from HIST_PRO3055 where H_IDCLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"'"))));
 //BA.debugLineNum = 1675;BA.debugLine="Private x As Boolean = False";
_x = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1676;BA.debugLine="Do While r.NextRow";
while (_r.NextRow()) {
 //BA.debugLineNum = 1677;BA.debugLine="x = True";
_x = anywheresoftware.b4a.keywords.Common.True;
 }
;
 //BA.debugLineNum = 1679;BA.debugLine="Log($\">>>>  revisaPRO3055 ${idCliente} = ${x}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("412124166",(">>>>  revisaPRO3055 "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+" = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_x))+""),0);
 //BA.debugLineNum = 1680;BA.debugLine="Return x";
if (true) return _x;
 //BA.debugLineNum = 1681;BA.debugLine="End Sub";
return false;
}
public static boolean  _revisaprodfueradepromo(anywheresoftware.b4a.BA _ba,String _prodid) throws Exception{
boolean _fueradepromo = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _p = null;
 //BA.debugLineNum = 1882;BA.debugLine="Sub revisaProdFueraDePromo(prodId As String) As Bo";
 //BA.debugLineNum = 1883;BA.debugLine="Private fueraDePromo As Boolean = False";
_fueradepromo = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1884;BA.debugLine="Private p As Cursor = Starter.skmt.ExecQuery($\"se";
_p = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_p = (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 PE_CEDIS from PEDIDO where PE_PROID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and PE_CEDIS in (select id_almacen from CAT_ALMACEN) and PE_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._cliente /*gunav2.keymon.com.mx.c_cliente*/ ._la_cuenta /*anywheresoftware.b4a.objects.LabelWrapper*/ .getText()))+"'"))));
 //BA.debugLineNum = 1885;BA.debugLine="Log(\"rowcount: \" & p.RowCount)";
anywheresoftware.b4a.keywords.Common.LogImpl("412648451","rowcount: "+BA.NumberToString(_p.getRowCount()),0);
 //BA.debugLineNum = 1886;BA.debugLine="If p.RowCount > 0 Then";
if (_p.getRowCount()>0) { 
 //BA.debugLineNum = 1887;BA.debugLine="p.Position = 0";
_p.setPosition((int) (0));
 //BA.debugLineNum = 1888;BA.debugLine="Log($\"|${p.GetString(\"PE_CEDIS\")}|${prodId}|\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("412648454",("|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_p.GetString("PE_CEDIS")))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"|"),0);
 //BA.debugLineNum = 1889;BA.debugLine="fueraDePromo = True";
_fueradepromo = anywheresoftware.b4a.keywords.Common.True;
 };
 //BA.debugLineNum = 1891;BA.debugLine="Return fueraDePromo";
if (true) return _fueradepromo;
 //BA.debugLineNum = 1892;BA.debugLine="End Sub";
return false;
}
public static String  _revisapromoprocterpro3009(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _prodsmap1) throws Exception{
anywheresoftware.b4a.objects.collections.List _almacenes = null;
String _idregalo = "";
anywheresoftware.b4a.objects.collections.Map _newprodsmap = null;
String _monto = "";
int _invregalo = 0;
int _totalregalos = 0;
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _r = null;
anywheresoftware.b4a.objects.collections.Map _m1 = null;
anywheresoftware.b4a.objects.collections.Map _m2 = null;
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _r2 = null;
anywheresoftware.b4a.objects.CSBuilder _cs = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pe = null;
 //BA.debugLineNum = 1546;BA.debugLine="Sub revisaPromoProcterPRO3009(prodsMap1 As Map)";
 //BA.debugLineNum = 1547;BA.debugLine="Log(\"entramos a promo Procter\")";
anywheresoftware.b4a.keywords.Common.LogImpl("411862017","entramos a promo Procter",0);
 //BA.debugLineNum = 1548;BA.debugLine="Dim almacenes As List";
_almacenes = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 1549;BA.debugLine="almacenes.Initialize2(Array As String(\"3\", \"17\",";
_almacenes.Initialize2(anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{"3","17","37","31","68","71","33","80"}));
 //BA.debugLineNum = 1550;BA.debugLine="Log(\"Posicion de almacen: \" & almacenes.IndexOf(t";
anywheresoftware.b4a.keywords.Common.LogImpl("411862020","Posicion de almacen: "+BA.NumberToString(_almacenes.IndexOf((Object)(_traealmacen(_ba)))),0);
 //BA.debugLineNum = 1552;BA.debugLine="If almacenes.IndexOf(traeAlmacen) >= 0 Then ' Si";
if (_almacenes.IndexOf((Object)(_traealmacen(_ba)))>=0) { 
 //BA.debugLineNum = 1553;BA.debugLine="Private idRegalo As String = \"PYG1016\"";
_idregalo = "PYG1016";
 //BA.debugLineNum = 1554;BA.debugLine="Private newProdsMap As Map = prodsMap1";
_newprodsmap = new anywheresoftware.b4a.objects.collections.Map();
_newprodsmap = _prodsmap1;
 //BA.debugLineNum = 1555;BA.debugLine="Private monto As String = 0";
_monto = BA.NumberToString(0);
 //BA.debugLineNum = 1556;BA.debugLine="Private invRegalo As Int = 0";
_invregalo = (int) (0);
 //BA.debugLineNum = 1557;BA.debugLine="Private totalRegalos As Int = 0";
_totalregalos = (int) (0);
 //BA.debugLineNum = 1558;BA.debugLine="Private r As ResultSet = Starter.skmt.ExecQuery(";
_r = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_r = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select ifnull(cat_gp_almacen, 0) as CAT_GP_ALMACEN from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_traetipoventadebd(_ba))))+" where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idregalo))+"'"))));
 //BA.debugLineNum = 1559;BA.debugLine="Do While r.NextRow";
while (_r.NextRow()) {
 //BA.debugLineNum = 1560;BA.debugLine="Log(r.GetString(\"CAT_GP_ALMACEN\"))";
anywheresoftware.b4a.keywords.Common.LogImpl("411862030",_r.GetString("CAT_GP_ALMACEN"),0);
 //BA.debugLineNum = 1561;BA.debugLine="If r.GetString(\"CAT_GP_ALMACEN\") > 0 Then invRe";
if ((double)(Double.parseDouble(_r.GetString("CAT_GP_ALMACEN")))>0) { 
_invregalo = (int)(Double.parseDouble(_r.GetString("CAT_GP_ALMACEN")));};
 }
;
 //BA.debugLineNum = 1563;BA.debugLine="Log(\"INV REGALO: \" & invRegalo)";
anywheresoftware.b4a.keywords.Common.LogImpl("411862033","INV REGALO: "+BA.NumberToString(_invregalo),0);
 //BA.debugLineNum = 1564;BA.debugLine="r = Starter.skmt.ExecQuery($\"select pe_proid fro";
_r = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select pe_proid from pedido where pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idregalo))+"' and pe_cedis = 'PRO3009' and pe_cant = 1 and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"' "))));
 //BA.debugLineNum = 1565;BA.debugLine="If r.RowCount > 0 Then totalRegalos = r.RowCount";
if (_r.getRowCount()>0) { 
_totalregalos = _r.getRowCount();};
 //BA.debugLineNum = 1566;BA.debugLine="Log($\"TOTAL REGALOS: ${totalRegalos}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("411862036",("TOTAL REGALOS: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalregalos))+""),0);
 //BA.debugLineNum = 1567;BA.debugLine="If prodsMap1.ContainsKey(\"PYG1014\") Then ' Calcu";
if (_prodsmap1.ContainsKey((Object)("PYG1014"))) { 
 //BA.debugLineNum = 1568;BA.debugLine="Private m1 As Map = prodsMap1.Get(\"PYG1014\")";
_m1 = new anywheresoftware.b4a.objects.collections.Map();
_m1 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_prodsmap1.Get((Object)("PYG1014"))));
 //BA.debugLineNum = 1569;BA.debugLine="monto = monto + m1.Get(\"cant\") * m1.Get(\"precio";
_monto = BA.NumberToString((double)(Double.parseDouble(_monto))+(double)(BA.ObjectToNumber(_m1.Get((Object)("cant"))))*(double)(BA.ObjectToNumber(_m1.Get((Object)("precio")))));
 };
 //BA.debugLineNum = 1571;BA.debugLine="If prodsMap1.ContainsKey(\"PYG1025\") Then  ' Calc";
if (_prodsmap1.ContainsKey((Object)("PYG1025"))) { 
 //BA.debugLineNum = 1572;BA.debugLine="Private m2 As Map = prodsMap1.Get(\"PYG1025\")";
_m2 = new anywheresoftware.b4a.objects.collections.Map();
_m2 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_prodsmap1.Get((Object)("PYG1025"))));
 //BA.debugLineNum = 1573;BA.debugLine="monto = monto + m2.Get(\"cant\") * m2.Get(\"precio";
_monto = BA.NumberToString((double)(Double.parseDouble(_monto))+(double)(BA.ObjectToNumber(_m2.Get((Object)("cant"))))*(double)(BA.ObjectToNumber(_m2.Get((Object)("precio")))));
 };
 //BA.debugLineNum = 1575;BA.debugLine="Private r2 As ResultSet = Starter.skmt.ExecQuery";
_r2 = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_r2 = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select ifnull(sum(pe_costo_tot),0) as monto from pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"' and PE_PROID in (\"PYG1014\", \"PYG1025\")"))));
 //BA.debugLineNum = 1576;BA.debugLine="Do While r2.NextRow";
while (_r2.NextRow()) {
 //BA.debugLineNum = 1577;BA.debugLine="monto = monto + r2.GetString(\"monto\")";
_monto = BA.NumberToString((double)(Double.parseDouble(_monto))+(double)(Double.parseDouble(_r2.GetString("monto"))));
 }
;
 //BA.debugLineNum = 1579;BA.debugLine="Log($\"Monto: ${monto}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("411862049",("Monto: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_monto))+""),0);
 //BA.debugLineNum = 1581;BA.debugLine="Log(\"prodsMap.Size: \" & prodsMap1.Size)";
anywheresoftware.b4a.keywords.Common.LogImpl("411862051","prodsMap.Size: "+BA.NumberToString(_prodsmap1.getSize()),0);
 //BA.debugLineNum = 1582;BA.debugLine="If prodsMap1.Size > 0 Then";
if (_prodsmap1.getSize()>0) { 
 //BA.debugLineNum = 1583;BA.debugLine="If monto > 149 Then";
if ((double)(Double.parseDouble(_monto))>149) { 
 //BA.debugLineNum = 1584;BA.debugLine="Log(\"Mas de 149\")";
anywheresoftware.b4a.keywords.Common.LogImpl("411862054","Mas de 149",0);
 //BA.debugLineNum = 1585;BA.debugLine="If invRegalo > 0 Then";
if (_invregalo>0) { 
 //BA.debugLineNum = 1586;BA.debugLine="Log(\"Hay inventario para regalo\")";
anywheresoftware.b4a.keywords.Common.LogImpl("411862056","Hay inventario para regalo",0);
 //BA.debugLineNum = 1587;BA.debugLine="If totalRegalos = 0 Then";
if (_totalregalos==0) { 
 //BA.debugLineNum = 1588;BA.debugLine="guardaProducto(\"PRO3009\", 1, 1, traeProdNomb";
_guardaproducto(_ba,"PRO3009",BA.NumberToString(1),BA.NumberToString(1),_traeprodnombre(_ba,_idregalo),_idregalo,_traecliente(_ba),_traefecha(_ba),_traeusuariodebd(_ba),_traeruta(_ba),BA.NumberToString(0),mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ );
 //BA.debugLineNum = 1590;BA.debugLine="Private cs As CSBuilder";
_cs = new anywheresoftware.b4a.objects.CSBuilder();
 //BA.debugLineNum = 1591;BA.debugLine="cs.Initialize";
_cs.Initialize();
 //BA.debugLineNum = 1592;BA.debugLine="Msgbox(cs.Color(Colors.red).append(\"PRO3009:";
anywheresoftware.b4a.keywords.Common.Msgbox(BA.ObjectToCharSequence(_cs.Color(anywheresoftware.b4a.keywords.Common.Colors.Red).Append(BA.ObjectToCharSequence("PRO3009:")).Pop().Append(BA.ObjectToCharSequence(" En la compra de $150 de la linea Oral B Procter & Gamble se agrega 1 Salvo Multiusuos 500 ml.")).Color(anywheresoftware.b4a.keywords.Common.Colors.Red).Append(BA.ObjectToCharSequence(" con precio de $1.00")).PopAll().getObject()),BA.ObjectToCharSequence("Producto de regalo agregado"),_ba);
 };
 }else {
 //BA.debugLineNum = 1595;BA.debugLine="LogColor(\"NO hay inventario para regalo PRO30";
anywheresoftware.b4a.keywords.Common.LogImpl("411862065","NO hay inventario para regalo PRO3009 Procter & Gamble.",anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 }else {
 //BA.debugLineNum = 1598;BA.debugLine="Log(\"Menos de 149\")";
anywheresoftware.b4a.keywords.Common.LogImpl("411862068","Menos de 149",0);
 //BA.debugLineNum = 1599;BA.debugLine="If totalRegalos > 0 Then";
if (_totalregalos>0) { 
 //BA.debugLineNum = 1600;BA.debugLine="Log(\"Quitamos regalo\")";
anywheresoftware.b4a.keywords.Common.LogImpl("411862070","Quitamos regalo",0);
 //BA.debugLineNum = 1601;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedid";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido where pe_cedis = 'PRO3009' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idregalo))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"' and pe_cant = 1 "));
 //BA.debugLineNum = 1602;BA.debugLine="Log($\"Borramos pe_cedis='PRO3009' and pe_proi";
anywheresoftware.b4a.keywords.Common.LogImpl("411862072",("Borramos pe_cedis='PRO3009' and pe_proid='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idregalo))+"' and pe_cliente='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"),0);
 //BA.debugLineNum = 1603;BA.debugLine="Private pe As Cursor = Starter.skmt.ExecQuery";
_pe = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_pe = (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(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")));
 //BA.debugLineNum = 1604;BA.debugLine="pe.Position=0";
_pe.setPosition((int) (0));
 //BA.debugLineNum = 1605;BA.debugLine="If pe.GetString(\"cuantosPedidos\") = 0 Then";
if ((_pe.GetString("cuantosPedidos")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1606;BA.debugLine="Log(\"######    delete from pedido_cliente -";
anywheresoftware.b4a.keywords.Common.LogImpl("411862076","######    delete from pedido_cliente - "+_traecliente(_ba)+"|"+_traecliente(_ba),0);
 //BA.debugLineNum = 1607;BA.debugLine="Log($\"delete from pedido_cliente where PC_CL";
anywheresoftware.b4a.keywords.Common.LogImpl("411862077",("delete from pedido_cliente where PC_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"),0);
 //BA.debugLineNum = 1608;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedi";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido_cliente where PC_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"));
 };
 //BA.debugLineNum = 1610;BA.debugLine="ToastMessageShow(\"Quitamos regalo PRO3009\", F";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Quitamos regalo PRO3009"),anywheresoftware.b4a.keywords.Common.False);
 };
 };
 };
 }else {
 //BA.debugLineNum = 1615;BA.debugLine="LogColor(\"El almacen actual NO esta en la lista";
anywheresoftware.b4a.keywords.Common.LogImpl("411862085","El almacen actual NO esta en la lista para la promo de Procter & Gamble.",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 };
 //BA.debugLineNum = 1618;BA.debugLine="End Sub";
return "";
}
public static String  _revisauug(anywheresoftware.b4a.BA _ba) throws Exception{
int _daa = 0;
 //BA.debugLineNum = 362;BA.debugLine="Sub revisaUUG 'ignore";
 //BA.debugLineNum = 363;BA.debugLine="Try";
try { //BA.debugLineNum = 365;BA.debugLine="If Tracker.FLP.GetLastKnownLocation.IsInitialize";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().IsInitialized()) { 
 //BA.debugLineNum = 366;BA.debugLine="Dim daa As Int = Tracker.UUGCoords.DistanceTo(T";
_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 = 367;BA.debugLine="If Starter.Logger Then LogColor($\"**** UUC \"${f";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("48454149",("**** 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 = 368;BA.debugLine="If daa > 40 And Tracker.FLP.GetLastKnownLocatio";
if (_daa>40 && mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()<35) { 
 //BA.debugLineNum = 369;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 = 370;BA.debugLine="If Starter.Logger Then Log(\"++++ Distancia a a";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("48454152","++++ Distancia a anterior="+BA.NumberToString(_daa)+"|"+"Precision="+BA.NumberToString(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()),0);};
 };
 //BA.debugLineNum = 372;BA.debugLine="Tracker.UUGCoords = Tracker.FLP.GetLastKnownLoc";
mostCurrent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/  = mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation();
 };
 } 
       catch (Exception e12) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e12); //BA.debugLineNum = 375;BA.debugLine="LogColor(\"If Tracker.FLP.GetLastKnownLocation.Is";
anywheresoftware.b4a.keywords.Common.LogImpl("48454157","If Tracker.FLP.GetLastKnownLocation.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 377;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 = 57;BA.debugLine="Sub SetDivider(lv As ListView, Color As Int, Heigh";
 //BA.debugLineNum = 58;BA.debugLine="Dim r As Reflector";
_r = new anywheresoftware.b4a.agraham.reflection.Reflection();
 //BA.debugLineNum = 59;BA.debugLine="r.Target = lv";
_r.Target = (Object)(_lv.getObject());
 //BA.debugLineNum = 60;BA.debugLine="Dim CD As ColorDrawable";
_cd = new anywheresoftware.b4a.objects.drawable.ColorDrawable();
 //BA.debugLineNum = 61;BA.debugLine="CD.Initialize(Color, 0)";
_cd.Initialize(_color,(int) (0));
 //BA.debugLineNum = 62;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 = 63;BA.debugLine="r.RunMethod2(\"setDividerHeight\", Height, \"java.la";
_r.RunMethod2("setDividerHeight",BA.NumberToString(_height),"java.lang.int");
 //BA.debugLineNum = 64;BA.debugLine="End Sub";
return "";
}
public static String  _totalpedido(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _ct = null;
String _ptotal = "";
String _tempt = "";
 //BA.debugLineNum = 770;BA.debugLine="Sub totalPedido As String";
 //BA.debugLineNum = 771;BA.debugLine="Private cT As Cursor = Starter.skmt.ExecQuery($\"s";
_ct = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_ct = (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(PE_COSTO_TOT) as total from PEDIDO where PE_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"' AND PE_CEDIS <> 'DUR'"))));
 //BA.debugLineNum = 772;BA.debugLine="Private pTotal As String = \"0\"";
_ptotal = "0";
 //BA.debugLineNum = 773;BA.debugLine="If cT.RowCount > 0 Then";
if (_ct.getRowCount()>0) { 
 //BA.debugLineNum = 774;BA.debugLine="cT.Position = 0";
_ct.setPosition((int) (0));
 //BA.debugLineNum = 776;BA.debugLine="Private tempT As String = cT.GetLong(\"total\")";
_tempt = BA.NumberToString(_ct.GetLong("total"));
 //BA.debugLineNum = 777;BA.debugLine="If tempT <> \"null\" And tempT <> Null Then";
if ((_tempt).equals("null") == false && _tempt!= null) { 
 //BA.debugLineNum = 779;BA.debugLine="pTotal = tempT";
_ptotal = _tempt;
 };
 };
 //BA.debugLineNum = 783;BA.debugLine="cT.Close";
_ct.Close();
 //BA.debugLineNum = 784;BA.debugLine="Return pTotal";
if (true) return _ptotal;
 //BA.debugLineNum = 785;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 = 658;BA.debugLine="Sub traeAlmacen As String 'ignore";
 //BA.debugLineNum = 659;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 660;BA.debugLine="Private a As String = \"NA\"";
_a = "NA";
 //BA.debugLineNum = 661;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select  ID_AL";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select  ID_ALMACEN from CAT_ALMACEN")));
 //BA.debugLineNum = 662;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 663;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 664;BA.debugLine="a = C.GetString(\"ID_ALMACEN\")";
_a = _c.GetString("ID_ALMACEN");
 };
 //BA.debugLineNum = 666;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 667;BA.debugLine="Return a";
if (true) return _a;
 //BA.debugLineNum = 668;BA.debugLine="End Sub";
return "";
}
public static String  _traecliente(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _cl = "";
 //BA.debugLineNum = 834;BA.debugLine="Sub traeCliente As String 'ignore";
 //BA.debugLineNum = 835;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 836;BA.debugLine="Private cl As String";
_cl = "";
 //BA.debugLineNum = 837;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"Select CUENTA";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select CUENTA from cuentaa")));
 //BA.debugLineNum = 838;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 839;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 840;BA.debugLine="cl = c.GetString(\"CUENTA\")";
_cl = _c.GetString("CUENTA");
 };
 //BA.debugLineNum = 842;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 844;BA.debugLine="Return cl";
if (true) return _cl;
 //BA.debugLineNum = 845;BA.debugLine="End Sub";
return "";
}
public static String  _traefecha(anywheresoftware.b4a.BA _ba) throws Exception{
String _sdate = "";
String _stime = "";
 //BA.debugLineNum = 847;BA.debugLine="Sub traeFecha As String 'ignore";
 //BA.debugLineNum = 848;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MM/dd/yyyy");
 //BA.debugLineNum = 849;BA.debugLine="Private sDate As String =DateTime.Date(DateTime.N";
_sdate = anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 850;BA.debugLine="Private sTime As String =DateTime.Time(DateTime.N";
_stime = anywheresoftware.b4a.keywords.Common.DateTime.Time(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 851;BA.debugLine="Return sDate & sTime";
if (true) return _sdate+_stime;
 //BA.debugLineNum = 852;BA.debugLine="End Sub";
return "";
}
public static String  _traeinventario(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _inventario = "";
 //BA.debugLineNum = 1999;BA.debugLine="Sub traeinventario(id As String) As String";
 //BA.debugLineNum = 2000;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 2001;BA.debugLine="Dim inventario As String = \"0\"";
_inventario = "0";
 //BA.debugLineNum = 2002;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select CAT_G";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_GP_ALMACEN from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ )))+" where CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 2004;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 2005;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 2006;BA.debugLine="inventario = c.GetString(\"CAT_GP_ALMACEN\")";
_inventario = _c.GetString("CAT_GP_ALMACEN");
 };
 //BA.debugLineNum = 2008;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 2009;BA.debugLine="Return inventario";
if (true) return _inventario;
 //BA.debugLineNum = 2010;BA.debugLine="End Sub";
return "";
}
public static int  _traemaxpromos(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _pm) throws Exception{
boolean _thislog = false;
anywheresoftware.b4a.objects.collections.List _maxpromos = null;
int _vendidas = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 1044;BA.debugLine="Sub traeMaxPromos(pm As Map) As Int";
 //BA.debugLineNum = 1045;BA.debugLine="Private thisLog As Boolean = True 'Si es verdader";
_thislog = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1046;BA.debugLine="Private maxPromos As List";
_maxpromos = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 1047;BA.debugLine="Private vendidas As Int = 0";
_vendidas = (int) (0);
 //BA.debugLineNum = 1048;BA.debugLine="maxPromos.Initialize";
_maxpromos.Initialize();
 //BA.debugLineNum = 1050;BA.debugLine="If thisLog Then Log(pm)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410747910",BA.ObjectToString(_pm),0);};
 //BA.debugLineNum = 1051;BA.debugLine="If pm.Get(\"historico\") = \"1\" Then maxPromos.Add(p";
if ((_pm.Get((Object)("historico"))).equals((Object)("1"))) { 
_maxpromos.Add(_pm.Get((Object)("maxRecurrente")));};
 //BA.debugLineNum = 1052;BA.debugLine="maxPromos.Add(pm.Get(\"maxPromos\")) 'Agregamos max";
_maxpromos.Add(_pm.Get((Object)("maxPromos")));
 //BA.debugLineNum = 1053;BA.debugLine="maxPromos.Add(pm.Get(\"maxXcliente\")) 'Agregamos m";
_maxpromos.Add(_pm.Get((Object)("maxXcliente")));
 //BA.debugLineNum = 1054;BA.debugLine="If thisLog Then Log(maxPromos)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("410747914",BA.ObjectToString(_maxpromos),0);};
 //BA.debugLineNum = 1055;BA.debugLine="maxPromos.Sort(True)";
_maxpromos.Sort(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1057;BA.debugLine="If B4XPages.MainPage.tipo_venta = \"PREVENTA_FUTUR";
if ((mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ).equals("PREVENTA_FUTURA")) { 
 //BA.debugLineNum = 1058;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exe";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select sum(PE_CANT) as vendidas from PEDIDO where PE_PROID = ? and PE_CLIENTE = ? AND PE_FUTURO = '1' ",new String[]{(BA.ObjectToString(_pm.Get((Object)("id")))).trim(),_traecliente(_ba).trim()})));
 }else {
 //BA.debugLineNum = 1060;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exe";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select sum(PE_CANT) as vendidas from PEDIDO where PE_PROID = ? and PE_CLIENTE = ? AND PE_FUTURO = '0'  ",new String[]{(BA.ObjectToString(_pm.Get((Object)("id")))).trim(),_traecliente(_ba).trim()})));
 };
 //BA.debugLineNum = 1062;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1063;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1064;BA.debugLine="vendidas = c.GetInt(\"vendidas\")";
_vendidas = _c.GetInt("vendidas");
 };
 //BA.debugLineNum = 1070;BA.debugLine="Return maxPromos.Get(0) - vendidas 'Regresamos el";
if (true) return (int) ((double)(BA.ObjectToNumber(_maxpromos.Get((int) (0))))-_vendidas);
 //BA.debugLineNum = 1071;BA.debugLine="End Sub";
return 0;
}
public static boolean  _traemontoprod(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _x = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c2 = null;
 //BA.debugLineNum = 1340;BA.debugLine="Sub TraeMontoProd As Boolean";
 //BA.debugLineNum = 1341;BA.debugLine="Private x As Boolean = False";
_x = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1342;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exec";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT ifnull( SUM (PE_COSTO_TOT),0) As suma FROM PEDIDO JOIN CAT_PROMO_ESP ON CAT_PE_ID = PE_PROID WHERE PE_CLIENTE IN (Select CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 1343;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1344;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1345;BA.debugLine="Private c2 As Cursor = B4XPages.MainPage.skmt.Ex";
_c2 = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_c2 = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT DISTINCT CAT_PE_MONTO FROM CAT_PROMO_ESP")));
 //BA.debugLineNum = 1346;BA.debugLine="If c2.RowCount > 0 Then";
if (_c2.getRowCount()>0) { 
 //BA.debugLineNum = 1347;BA.debugLine="c2.Position = 0";
_c2.setPosition((int) (0));
 //BA.debugLineNum = 1348;BA.debugLine="If c.GetString(\"suma\") >= c2.GetString(\"CAT_PE";
if ((double)(Double.parseDouble(_c.GetString("suma")))>=(double)(Double.parseDouble(_c2.GetString("CAT_PE_MONTO")))) { 
 //BA.debugLineNum = 1349;BA.debugLine="x = True";
_x = anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 1352;BA.debugLine="x = False";
_x = anywheresoftware.b4a.keywords.Common.False;
 };
 };
 };
 //BA.debugLineNum = 1357;BA.debugLine="Return x";
if (true) return _x;
 //BA.debugLineNum = 1358;BA.debugLine="End Sub";
return false;
}
public static boolean  _traemontoprod2(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _x = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c2 = null;
 //BA.debugLineNum = 1362;BA.debugLine="Sub TraeMontoProd2 As Boolean";
 //BA.debugLineNum = 1364;BA.debugLine="Private x As Boolean = False";
_x = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1366;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exec";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT ifnull( SUM (PE_COSTO_TOT),0) As suma FROM PEDIDO JOIN CAT_PROMO_ESP ON CAT_PE_ID = PE_PROID WHERE PE_CLIENTE IN (Select CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 1368;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1370;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1372;BA.debugLine="Private c2 As Cursor = B4XPages.MainPage.skmt.Ex";
_c2 = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_c2 = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT DISTINCT CAT_PE_MONTO FROM CAT_PROMO_ESP")));
 //BA.debugLineNum = 1374;BA.debugLine="If c2.RowCount > 0 Then";
if (_c2.getRowCount()>0) { 
 //BA.debugLineNum = 1376;BA.debugLine="c2.Position = 0";
_c2.setPosition((int) (0));
 //BA.debugLineNum = 1378;BA.debugLine="If c.GetString(\"suma\") >= 350 And c.GetString(\"";
if ((double)(Double.parseDouble(_c.GetString("suma")))>=350 && (double)(Double.parseDouble(_c.GetString("suma")))<=499.99) { 
 //BA.debugLineNum = 1380;BA.debugLine="x = True";
_x = anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 1383;BA.debugLine="x = False";
_x = anywheresoftware.b4a.keywords.Common.False;
 };
 };
 };
 //BA.debugLineNum = 1389;BA.debugLine="Return x";
if (true) return _x;
 //BA.debugLineNum = 1391;BA.debugLine="End Sub";
return false;
}
public static anywheresoftware.b4a.objects.collections.Map  _traemosinventariodisponibleparapromo(anywheresoftware.b4a.BA _ba,String _promo) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
anywheresoftware.b4a.objects.collections.Map _prods = null;
int _i = 0;
 //BA.debugLineNum = 967;BA.debugLine="Sub traemosInventarioDisponibleParaPromo(promo As";
 //BA.debugLineNum = 968;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 969;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery2($\"SELECT CA";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2(("SELECT CAT_GP_ID, CAT_GP_ALMACEN FROM "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_traetipoventadebd(_ba))))+" WHERE CAT_GP_ID IN (select CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = ?)"),new String[]{_promo})));
 //BA.debugLineNum = 972;BA.debugLine="Private prods As Map";
_prods = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 973;BA.debugLine="prods.Initialize";
_prods.Initialize();
 //BA.debugLineNum = 974;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 975;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step6 = 1;
final int limit6 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit6 ;_i = _i + step6 ) {
 //BA.debugLineNum = 976;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 977;BA.debugLine="prods.Put(c.GetString(\"CAT_GP_ID\"), c.GetString";
_prods.Put((Object)(_c.GetString("CAT_GP_ID")),(Object)(_c.GetString("CAT_GP_ALMACEN")));
 }
};
 };
 //BA.debugLineNum = 982;BA.debugLine="Return prods";
if (true) return _prods;
 //BA.debugLineNum = 983;BA.debugLine="End Sub";
return null;
}
public static String  _traenombrecliente(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _c = null;
String _n = "";
 //BA.debugLineNum = 1525;BA.debugLine="Sub traeNombreCliente(id As String) As String";
 //BA.debugLineNum = 1526;BA.debugLine="Private c As ResultSet = B4XPages.MainPage.skmt.E";
_c = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_c = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_NOMBRE from kmt_info3 where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 1527;BA.debugLine="Private n As String = \"N/A\"";
_n = "N/A";
 //BA.debugLineNum = 1528;BA.debugLine="Do While c.NextRow";
while (_c.NextRow()) {
 //BA.debugLineNum = 1529;BA.debugLine="n = c.GetString(\"CAT_CL_NOMBRE\")";
_n = _c.GetString("CAT_CL_NOMBRE");
 }
;
 //BA.debugLineNum = 1531;BA.debugLine="Return n";
if (true) return _n;
 //BA.debugLineNum = 1532;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _traeprodiddebd(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
 //BA.debugLineNum = 1278;BA.debugLine="Sub traeProdIdDeBD As Map 'ignore";
 //BA.debugLineNum = 1279;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1280;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1281;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select CAT_G";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_TIPO, CAT_GP_SUBTIPO from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_traetipoventadebd(_ba))))+" where CAT_GP_NOMBRE In (Select PDESC from PROID)"))));
 //BA.debugLineNum = 1282;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1283;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1284;BA.debugLine="m = CreateMap(\"id\":c.GetString(\"CAT_GP_ID\"), \"no";
_m = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("id"),(Object)(_c.GetString("CAT_GP_ID")),(Object)("nombre"),(Object)(_c.GetString("CAT_GP_NOMBRE")),(Object)("tipo"),(Object)(_c.GetString("CAT_GP_TIPO")),(Object)("subtipo"),(Object)(_c.GetString("CAT_GP_SUBTIPO"))});
 }else {
 //BA.debugLineNum = 1286;BA.debugLine="m = CreateMap(\"id\":\"N/A\", \"nombre\":\"N/A\", \"tipo\"";
_m = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("id"),(Object)("N/A"),(Object)("nombre"),(Object)("N/A"),(Object)("tipo"),(Object)("N/A"),(Object)("subtipo"),(Object)("N/A")});
 };
 //BA.debugLineNum = 1288;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1289;BA.debugLine="Return m";
if (true) return _m;
 //BA.debugLineNum = 1290;BA.debugLine="End Sub";
return null;
}
public static String  _traeprodnombre(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _h = null;
String _n = "";
 //BA.debugLineNum = 671;BA.debugLine="Sub traeProdNombre(id As String) As String";
 //BA.debugLineNum = 672;BA.debugLine="Private h As Cursor";
_h = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 673;BA.debugLine="Private n As String";
_n = "";
 //BA.debugLineNum = 674;BA.debugLine="h=B4XPages.MainPage.skmt.ExecQuery2($\"select CAT_";
_h = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2(("select CAT_GP_NOMBRE from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_traetipoventadebd(_ba))))+" where CAT_GP_ID = ? "),new String[]{_id.trim()})));
 //BA.debugLineNum = 675;BA.debugLine="If h.RowCount > 0 Then";
if (_h.getRowCount()>0) { 
 //BA.debugLineNum = 676;BA.debugLine="h.Position = 0";
_h.setPosition((int) (0));
 //BA.debugLineNum = 677;BA.debugLine="n = h.GetString(\"CAT_GP_NOMBRE\")";
_n = _h.GetString("CAT_GP_NOMBRE");
 };
 //BA.debugLineNum = 680;BA.debugLine="h.Close";
_h.Close();
 //BA.debugLineNum = 681;BA.debugLine="If n = Null Or n=\"\" Then n = \"N/A\"";
if (_n== null || (_n).equals("")) { 
_n = "N/A";};
 //BA.debugLineNum = 683;BA.debugLine="Return n";
if (true) return _n;
 //BA.debugLineNum = 684;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _traepromo(anywheresoftware.b4a.BA _ba,String _promo,String _cliente) throws Exception{
String _iniciocontador = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _sihistorico = "";
anywheresoftware.b4a.objects.collections.Map _promomap = null;
anywheresoftware.b4a.objects.collections.List _prodsfijos = null;
anywheresoftware.b4a.objects.collections.List _prodsfijosprecios = null;
anywheresoftware.b4a.objects.collections.List _prodsfijospiezas = null;
anywheresoftware.b4a.objects.collections.List _prodsvariables = null;
anywheresoftware.b4a.objects.collections.List _prodsvariables2 = null;
anywheresoftware.b4a.objects.collections.List _prodsvariablesprecios = null;
anywheresoftware.b4a.objects.collections.List _prodsvariablesprecios2 = null;
anywheresoftware.b4a.objects.collections.Map _prods = null;
anywheresoftware.b4a.objects.collections.Map _tipos = null;
int _i = 0;
String _pvr = "";
String _pvr2 = "";
 //BA.debugLineNum = 2032;BA.debugLine="Sub traePromo(promo As String, cliente As String)";
 //BA.debugLineNum = 2033;BA.debugLine="Private inicioContador As String = DateTime.Now";
_iniciocontador = BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 2034;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exec";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select * from promos_comp where cat_pa_id = '"+_promo+"'")));
 //BA.debugLineNum = 2035;BA.debugLine="Private siHistorico As String = 0";
_sihistorico = BA.NumberToString(0);
 //BA.debugLineNum = 2036;BA.debugLine="Private promoMap As Map";
_promomap = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 2037;BA.debugLine="Private prodsFijos, prodsFijosPrecios, prodsFijos";
_prodsfijos = new anywheresoftware.b4a.objects.collections.List();
_prodsfijosprecios = new anywheresoftware.b4a.objects.collections.List();
_prodsfijospiezas = new anywheresoftware.b4a.objects.collections.List();
_prodsvariables = new anywheresoftware.b4a.objects.collections.List();
_prodsvariables2 = new anywheresoftware.b4a.objects.collections.List();
_prodsvariablesprecios = new anywheresoftware.b4a.objects.collections.List();
_prodsvariablesprecios2 = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 2038;BA.debugLine="promoMap.Initialize";
_promomap.Initialize();
 //BA.debugLineNum = 2039;BA.debugLine="prodsFijos.Initialize";
_prodsfijos.Initialize();
 //BA.debugLineNum = 2040;BA.debugLine="prodsFijosPrecios.Initialize";
_prodsfijosprecios.Initialize();
 //BA.debugLineNum = 2041;BA.debugLine="prodsFijosPiezas.Initialize";
_prodsfijospiezas.Initialize();
 //BA.debugLineNum = 2042;BA.debugLine="prodsVariables.Initialize";
_prodsvariables.Initialize();
 //BA.debugLineNum = 2043;BA.debugLine="prodsVariables2.Initialize";
_prodsvariables2.Initialize();
 //BA.debugLineNum = 2044;BA.debugLine="prodsVariablesPrecios.Initialize";
_prodsvariablesprecios.Initialize();
 //BA.debugLineNum = 2045;BA.debugLine="prodsVariablesPrecios2.Initialize";
_prodsvariablesprecios2.Initialize();
 //BA.debugLineNum = 2046;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 2047;BA.debugLine="If c.RowCount > 0 Then promoMap = CreateMap(\"id\":";
if (_c.getRowCount()>0) { 
_promomap = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("id"),(Object)(_promo),(Object)("maxXcliente"),(Object)(_c.GetString("CAT_PA_MAXPROMCLIE")),(Object)("maxRecurrente"),(Object)(_c.GetString("CAT_PA_MAXPROMREC")),(Object)("maxPromos"),(Object)(_c.GetString("CAT_PA_MAXPROM"))});};
 //BA.debugLineNum = 2048;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"Select coun";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select count(*) as hist from HIST_PROMOS where HP_CLIENTE = '"+_cliente+"' and HP_CODIGO_PROMOCION = '"+_promo+"'")));
 //BA.debugLineNum = 2049;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 2050;BA.debugLine="If c.GetString(\"hist\") > 0 Then siHistorico = 1";
if ((double)(Double.parseDouble(_c.GetString("hist")))>0) { 
_sihistorico = BA.NumberToString(1);};
 //BA.debugLineNum = 2051;BA.debugLine="promoMap.Put(\"historico\", siHistorico)";
_promomap.Put((Object)("historico"),(Object)(_sihistorico));
 //BA.debugLineNum = 2052;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"Select * fr";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select * from CAT_DETALLES_PAQ where CAT_DP_ID = '"+_promo+"'")));
 //BA.debugLineNum = 2053;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 2054;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 2055;BA.debugLine="Private prods, tipos As Map";
_prods = new anywheresoftware.b4a.objects.collections.Map();
_tipos = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 2056;BA.debugLine="prods.Initialize";
_prods.Initialize();
 //BA.debugLineNum = 2057;BA.debugLine="tipos.Initialize";
_tipos.Initialize();
 //BA.debugLineNum = 2058;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step26 = 1;
final int limit26 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit26 ;_i = _i + step26 ) {
 //BA.debugLineNum = 2059;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 2060;BA.debugLine="prods.Put(c.GetString(\"CAT_DP_IDPROD\"), CreateM";
_prods.Put((Object)(_c.GetString("CAT_DP_IDPROD")),(Object)(anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("idProducto"),(Object)(_c.GetString("CAT_DP_IDPROD")),(Object)("precioSimptos"),(Object)(_c.GetString("CAT_DP_PRECIO_SIMPTOS")),(Object)("precio"),(Object)(_c.GetString("CAT_DP_PRECIO")),(Object)("almacen"),(Object)(_c.GetString("CAT_DP_ALMACEN")),(Object)("tipo"),(Object)(_c.GetString("CAT_DP_TIPO")),(Object)("piezas"),(Object)(_c.GetString("CAT_DP_PZAS")),(Object)("usuario"),(Object)(_c.GetString("CAT_DP_USUARIO")),(Object)("regalo"),(Object)(_c.GetString("CAT_DP_REGALO")),(Object)("clasif"),(Object)(_c.GetString("CAT_DP_CLASIF"))}).getObject()));
 //BA.debugLineNum = 2061;BA.debugLine="tipos.Put(c.GetString(\"CAT_DP_IDPROD\"), c.GetSt";
_tipos.Put((Object)(_c.GetString("CAT_DP_IDPROD")),(Object)(_c.GetString("CAT_DP_TIPO")));
 //BA.debugLineNum = 2062;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"0\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("0")) { 
 //BA.debugLineNum = 2063;BA.debugLine="prodsFijos.Add(c.GetString(\"CAT_DP_IDPROD\"))";
_prodsfijos.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
 //BA.debugLineNum = 2064;BA.debugLine="prodsFijosPrecios.Add(c.GetString(\"CAT_DP_PREC";
_prodsfijosprecios.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
 //BA.debugLineNum = 2065;BA.debugLine="prodsFijosPiezas.Add(c.GetString(\"CAT_DP_PZAS\"";
_prodsfijospiezas.Add((Object)(_c.GetString("CAT_DP_PZAS")));
 };
 //BA.debugLineNum = 2067;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"1\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("1")) { 
 //BA.debugLineNum = 2068;BA.debugLine="prodsVariables.Add(c.GetString(\"CAT_DP_IDPROD\"";
_prodsvariables.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
 //BA.debugLineNum = 2069;BA.debugLine="prodsVariablesPrecios.Add(c.GetString(\"CAT_DP_";
_prodsvariablesprecios.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
 };
 //BA.debugLineNum = 2071;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"2\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("2")) { 
 //BA.debugLineNum = 2073;BA.debugLine="prodsVariables2.Add(c.GetString(\"CAT_DP_IDPROD";
_prodsvariables2.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
 //BA.debugLineNum = 2074;BA.debugLine="prodsVariablesPrecios2.Add(c.GetString(\"CAT_DP";
_prodsvariablesprecios2.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
 };
 }
};
 //BA.debugLineNum = 2079;BA.debugLine="promoMap.Put(\"productos\", prods) 'Mapa con los p";
_promomap.Put((Object)("productos"),(Object)(_prods.getObject()));
 //BA.debugLineNum = 2080;BA.debugLine="promoMap.Put(\"tipos\", tipos) 'Mapa con los produ";
_promomap.Put((Object)("tipos"),(Object)(_tipos.getObject()));
 //BA.debugLineNum = 2081;BA.debugLine="promoMap.Put(\"prodsFijos\", prodsFijos) 'Lista de";
_promomap.Put((Object)("prodsFijos"),(Object)(_prodsfijos.getObject()));
 //BA.debugLineNum = 2082;BA.debugLine="promoMap.Put(\"prodsVariables\", prodsVariables) '";
_promomap.Put((Object)("prodsVariables"),(Object)(_prodsvariables.getObject()));
 //BA.debugLineNum = 2083;BA.debugLine="promoMap.Put(\"prodsVariables2\", prodsVariables2)";
_promomap.Put((Object)("prodsVariables2"),(Object)(_prodsvariables2.getObject()));
 //BA.debugLineNum = 2084;BA.debugLine="promoMap.Put(\"prodsFijosCant\", prodsFijos.Size)";
_promomap.Put((Object)("prodsFijosCant"),(Object)(_prodsfijos.getSize()));
 //BA.debugLineNum = 2085;BA.debugLine="promoMap.Put(\"prodsFijosPrecios\", prodsFijosPrec";
_promomap.Put((Object)("prodsFijosPrecios"),(Object)(_prodsfijosprecios.getObject()));
 //BA.debugLineNum = 2086;BA.debugLine="promoMap.Put(\"prodsFijosPiezas\", prodsFijosPieza";
_promomap.Put((Object)("prodsFijosPiezas"),(Object)(_prodsfijospiezas.getObject()));
 //BA.debugLineNum = 2087;BA.debugLine="promoMap.Put(\"prodsVariablesCant\", prodsVariable";
_promomap.Put((Object)("prodsVariablesCant"),(Object)(_prodsvariables.getSize()));
 //BA.debugLineNum = 2088;BA.debugLine="promoMap.Put(\"prodsVariables2Cant\", prodsVariabl";
_promomap.Put((Object)("prodsVariables2Cant"),(Object)(_prodsvariables2.getSize()));
 //BA.debugLineNum = 2089;BA.debugLine="promoMap.Put(\"prodsVariablesPrecios\", prodsVaria";
_promomap.Put((Object)("prodsVariablesPrecios"),(Object)(_prodsvariablesprecios.getObject()));
 //BA.debugLineNum = 2090;BA.debugLine="promoMap.Put(\"prodsVariablesPrecios2\", prodsVari";
_promomap.Put((Object)("prodsVariablesPrecios2"),(Object)(_prodsvariablesprecios2.getObject()));
 //BA.debugLineNum = 2091;BA.debugLine="promoMap.Put(\"resultado\", \"ok\")";
_promomap.Put((Object)("resultado"),(Object)("ok"));
 }else {
 //BA.debugLineNum = 2093;BA.debugLine="promoMap.Put(\"resultado\", \"No hay datos de la pr";
_promomap.Put((Object)("resultado"),(Object)("No hay datos de la promoción."));
 };
 //BA.debugLineNum = 2095;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery2($\"Select CA";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2(("Select CAT_GP_STS, CAT_GP_IMP1, CAT_GP_NOMBRE from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" where CAT_GP_ID = ?"),new String[]{_promo})));
 //BA.debugLineNum = 2096;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 2097;BA.debugLine="Private pvr As String = 0";
_pvr = BA.NumberToString(0);
 //BA.debugLineNum = 2098;BA.debugLine="Private pvr2 As String = 0";
_pvr2 = BA.NumberToString(0);
 //BA.debugLineNum = 2099;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 2100;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 2101;BA.debugLine="pvr = c.GetString(\"CAT_GP_STS\")";
_pvr = _c.GetString("CAT_GP_STS");
 //BA.debugLineNum = 2102;BA.debugLine="pvr2 = c.GetString(\"CAT_GP_IMP1\")";
_pvr2 = _c.GetString("CAT_GP_IMP1");
 //BA.debugLineNum = 2103;BA.debugLine="If pvr = Null Or pvr = \"null\" Then pvr = 0";
if (_pvr== null || (_pvr).equals("null")) { 
_pvr = BA.NumberToString(0);};
 //BA.debugLineNum = 2104;BA.debugLine="If pvr2 = Null Or pvr2 = \"null\" Then pvr2 = 0";
if (_pvr2== null || (_pvr2).equals("null")) { 
_pvr2 = BA.NumberToString(0);};
 //BA.debugLineNum = 2105;BA.debugLine="promoMap.Put(\"prodsVariablesRequeridos\", pvr) 'C";
_promomap.Put((Object)("prodsVariablesRequeridos"),(Object)(_pvr));
 //BA.debugLineNum = 2106;BA.debugLine="promoMap.Put(\"prodsVariables2Requeridos\", pvr2)";
_promomap.Put((Object)("prodsVariables2Requeridos"),(Object)(_pvr2));
 //BA.debugLineNum = 2107;BA.debugLine="promoMap.put(\"descripcion\", c.GetString(\"CAT_GP_";
_promomap.Put((Object)("descripcion"),(Object)(_c.GetString("CAT_GP_NOMBRE")));
 };
 //BA.debugLineNum = 2109;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 2114;BA.debugLine="Return promoMap";
if (true) return _promomap;
 //BA.debugLineNum = 2115;BA.debugLine="End Sub";
return null;
}
public static anywheresoftware.b4a.objects.collections.Map  _traepromoiddebd(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
 //BA.debugLineNum = 1295;BA.debugLine="Sub traePromoIdDeBD As Map 'ignore";
 //BA.debugLineNum = 1296;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1297;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1299;BA.debugLine="Log(\"ENTRE\")";
anywheresoftware.b4a.keywords.Common.LogImpl("411206660","ENTRE",0);
 //BA.debugLineNum = 1300;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select CAT_G";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_TIPO, CAT_GP_SUBTIPO from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_traetipoventadebd(_ba))))+" where CAT_GP_NOMBRE In (Select PDESC from PROID) and CAT_GP_TIPO = 'PROMOS'"))));
 //BA.debugLineNum = 1301;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1302;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1303;BA.debugLine="m = CreateMap(\"id\":c.GetString(\"CAT_GP_ID\"), \"no";
_m = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("id"),(Object)(_c.GetString("CAT_GP_ID")),(Object)("nombre"),(Object)(_c.GetString("CAT_GP_NOMBRE")),(Object)("tipo"),(Object)(_c.GetString("CAT_GP_TIPO")),(Object)("subtipo"),(Object)(_c.GetString("CAT_GP_SUBTIPO"))});
 }else {
 //BA.debugLineNum = 1305;BA.debugLine="m = CreateMap(\"id\":\"N/A\", \"nombre\":\"N/A\", \"tipo\"";
_m = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("id"),(Object)("N/A"),(Object)("nombre"),(Object)("N/A"),(Object)("tipo"),(Object)("N/A"),(Object)("subtipo"),(Object)("N/A")});
 };
 //BA.debugLineNum = 1307;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1309;BA.debugLine="Return m";
if (true) return _m;
 //BA.debugLineNum = 1310;BA.debugLine="End Sub";
return null;
}
public static int  _traepromosvendidas(anywheresoftware.b4a.BA _ba,String _promo,String _cliente) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _pv = 0;
 //BA.debugLineNum = 1074;BA.debugLine="Sub traePromosVendidas(promo As String, cliente As";
 //BA.debugLineNum = 1075;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1076;BA.debugLine="Private pv As Int = 0";
_pv = (int) (0);
 //BA.debugLineNum = 1077;BA.debugLine="If B4XPages.MainPage.tipo_venta = \"PREVENTA_FUTUR";
if ((mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ).equals("PREVENTA_FUTURA")) { 
 //BA.debugLineNum = 1078;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select PE_C";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select PE_CANT from PEDIDO where PE_PROID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_promo))+"' and PE_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"' AND PE_FUTURO = '1' "))));
 }else {
 //BA.debugLineNum = 1080;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select PE_C";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select PE_CANT from PEDIDO where PE_PROID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_promo))+"' and PE_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"' AND PE_FUTURO = '0' "))));
 };
 //BA.debugLineNum = 1082;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1083;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1084;BA.debugLine="pv = c.GetInt(\"PE_CANT\")";
_pv = _c.GetInt("PE_CANT");
 };
 //BA.debugLineNum = 1086;BA.debugLine="Return pv";
if (true) return _pv;
 //BA.debugLineNum = 1087;BA.debugLine="End Sub";
return 0;
}
public static String  _traeruta(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
String _idcliente = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _elcc = null;
 //BA.debugLineNum = 688;BA.debugLine="Sub traeRuta As String 'ignore";
 //BA.debugLineNum = 689;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 690;BA.debugLine="Private r As String = \"0\"";
_r = "0";
 //BA.debugLineNum = 691;BA.debugLine="Private idCliente As String = \"\"";
_idcliente = "";
 //BA.debugLineNum = 692;BA.debugLine="Try";
try { //BA.debugLineNum = 693;BA.debugLine="Private elCc As Cursor = Starter.skmt.ExecQuery(";
_elcc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_elcc = (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 = 694;BA.debugLine="If elCc.RowCount > 0 Then";
if (_elcc.getRowCount()>0) { 
 //BA.debugLineNum = 695;BA.debugLine="elCc.Position = 0";
_elcc.setPosition((int) (0));
 //BA.debugLineNum = 696;BA.debugLine="idCliente = elCc.GetString(\"CUENTA\")";
_idcliente = _elcc.GetString("CUENTA");
 //BA.debugLineNum = 697;BA.debugLine="Log(\"|\"&elCc.GetString(\"CUENTA\")&\"|\")";
anywheresoftware.b4a.keywords.Common.LogImpl("49830409","|"+_elcc.GetString("CUENTA")+"|",0);
 };
 //BA.debugLineNum = 700;BA.debugLine="If idCliente <> \"\" Then";
if ((_idcliente).equals("") == false) { 
 //BA.debugLineNum = 702;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery($\"select d";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select distinct CAT_CL_RUTA from kmt_info3 where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idcliente))+"'"))));
 }else {
 //BA.debugLineNum = 705;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"select di";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select distinct CAT_CL_RUTA from kmt_info3 where CAT_CL_RUTA not in (select * from ruta_suplencia)")));
 };
 //BA.debugLineNum = 708;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 710;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 711;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 713;BA.debugLine="c.Close";
_c.Close();
 } 
       catch (Exception e22) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e22); //BA.debugLineNum = 715;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("49830427",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 //BA.debugLineNum = 718;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 719;BA.debugLine="End Sub";
return "";
}
public static String  _traeruta2(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
 //BA.debugLineNum = 788;BA.debugLine="Sub traeRuta2 (cliente As String) As String 'ignor";
 //BA.debugLineNum = 789;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 790;BA.debugLine="Private r As String";
_r = "";
 //BA.debugLineNum = 791;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select CAT_C";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_RUTA from kmt_info3 where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"'"))));
 //BA.debugLineNum = 792;BA.debugLine="r = \"0\"";
_r = "0";
 //BA.debugLineNum = 793;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 794;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 795;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 797;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 798;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 799;BA.debugLine="End Sub";
return "";
}
public static String  _traerutabitacora(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
 //BA.debugLineNum = 801;BA.debugLine="Sub traeRutaBitacora As String 'ignore";
 //BA.debugLineNum = 802;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 803;BA.debugLine="Private r As String";
_r = "";
 //BA.debugLineNum = 804;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select CAT_CL";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select CAT_CL_RUTA from kmt_info3 WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 805;BA.debugLine="r = \"0\"";
_r = "0";
 //BA.debugLineNum = 806;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 807;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 808;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 810;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 811;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 812;BA.debugLine="End Sub";
return "";
}
public static String  _traerutassup(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _rutas = "";
int _i = 0;
 //BA.debugLineNum = 815;BA.debugLine="Sub traeRutasSup As String";
 //BA.debugLineNum = 816;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 817;BA.debugLine="Dim rutas As String";
_rutas = "";
 //BA.debugLineNum = 818;BA.debugLine="rutas = \"\"";
_rutas = "";
 //BA.debugLineNum = 820;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"SELECT CAT_";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT CAT_CL_RUTA FROM kmt_info3")));
 //BA.debugLineNum = 822;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 823;BA.debugLine="For i = 0 To c.RowCount - 1";
{
final int step6 = 1;
final int limit6 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit6 ;_i = _i + step6 ) {
 //BA.debugLineNum = 824;BA.debugLine="c.Position = i";
_c.setPosition(_i);
 //BA.debugLineNum = 825;BA.debugLine="rutas = rutas & c.GetString(\"CAT_CL_RUTA\") & \",";
_rutas = _rutas+_c.GetString("CAT_CL_RUTA")+", ";
 }
};
 //BA.debugLineNum = 827;BA.debugLine="If rutas.Length > 0 Then rutas = rutas.SubString";
if (_rutas.length()>0) { 
_rutas = _rutas.substring((int) (0),(int) (_rutas.length()-2));};
 };
 //BA.debugLineNum = 830;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 831;BA.debugLine="Return rutas";
if (true) return _rutas;
 //BA.debugLineNum = 832;BA.debugLine="End Sub";
return "";
}
public static String  _traetablaprods(anywheresoftware.b4a.BA _ba,String _tipoventa) throws Exception{
String _tablaprods = "";
 //BA.debugLineNum = 1872;BA.debugLine="Sub traeTablaProds(tipoventa As String) As String";
 //BA.debugLineNum = 1873;BA.debugLine="Log(tipoventa)";
anywheresoftware.b4a.keywords.Common.LogImpl("412582913",_tipoventa,0);
 //BA.debugLineNum = 1874;BA.debugLine="Private tablaProds As String = \"cat_gunaprod2\"";
_tablaprods = "cat_gunaprod2";
 //BA.debugLineNum = 1875;BA.debugLine="If tipoventa = \"ABORDO\" Or tipoventa = \"PREVENTA\"";
if ((_tipoventa).equals("ABORDO") || (_tipoventa).equals("PREVENTA") || (_tipoventa).equals("PREVENTA_FUTURA") || (_tipoventa).equals("MAYOREO")) { 
_tablaprods = "cat_gunaprod";};
 //BA.debugLineNum = 1877;BA.debugLine="Return tablaProds";
if (true) return _tablaprods;
 //BA.debugLineNum = 1878;BA.debugLine="End Sub";
return "";
}
public static int  _traetipocliente(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _x = null;
int _tc = 0;
 //BA.debugLineNum = 1986;BA.debugLine="Sub traeTipoCliente As Int";
 //BA.debugLineNum = 1987;BA.debugLine="Private x As Cursor";
_x = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1988;BA.debugLine="Private tc As Int = 3";
_tc = (int) (3);
 //BA.debugLineNum = 1989;BA.debugLine="x = Starter.skmt.ExecQuery($\"select IFNULL(cat_cl";
_x = (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 IFNULL(cat_cl_tipocliente,3) AS CAT_CL_TIPOCLIENTE from kmt_info3 where cat_cl_codigo in (select cuenta from cuentaa)"))));
 //BA.debugLineNum = 1990;BA.debugLine="If x.RowCount > 0 Then";
if (_x.getRowCount()>0) { 
 //BA.debugLineNum = 1991;BA.debugLine="x.Position = 0";
_x.setPosition((int) (0));
 //BA.debugLineNum = 1993;BA.debugLine="tc = x.GetInt(\"CAT_CL_TIPOCLIENTE\")";
_tc = _x.GetInt("CAT_CL_TIPOCLIENTE");
 };
 //BA.debugLineNum = 1996;BA.debugLine="Return tc";
if (true) return _tc;
 //BA.debugLineNum = 1997;BA.debugLine="End Sub";
return 0;
}
public static String  _traetipoventadebd(anywheresoftware.b4a.BA _ba) throws Exception{
String _tipoventa = "";
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _r = null;
 //BA.debugLineNum = 1895;BA.debugLine="Sub traeTipoVentaDeBD As String";
 //BA.debugLineNum = 1896;BA.debugLine="Private tipoVenta As String = \"PREVENTA\"";
_tipoventa = "PREVENTA";
 //BA.debugLineNum = 1897;BA.debugLine="Private r As ResultSet = Starter.skmt.ExecQuery(\"";
_r = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_r = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'TIPO_VENTA'  ")));
 //BA.debugLineNum = 1898;BA.debugLine="Do While r.NextRow";
while (_r.NextRow()) {
 //BA.debugLineNum = 1899;BA.debugLine="tipoVenta = r.GetString(\"CAT_VA_VALOR\").As(Strin";
_tipoventa = (_r.GetString("CAT_VA_VALOR")).toUpperCase();
 }
;
 //BA.debugLineNum = 1901;BA.debugLine="If Starter.idCliente = \"0\" Then";
if ((mostCurrent._starter._idcliente /*String*/ ).equals("0")) { 
 //BA.debugLineNum = 1902;BA.debugLine="tipoVenta = \"ABORDO\"";
_tipoventa = "ABORDO";
 };
 //BA.debugLineNum = 1905;BA.debugLine="Return tipoVenta";
if (true) return _tipoventa;
 //BA.debugLineNum = 1906;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _traetotalesclienteactual(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.objects.collections.Map _m = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c_prodsx = null;
 //BA.debugLineNum = 2013;BA.debugLine="Sub traeTotalesClienteActual As Map";
 //BA.debugLineNum = 2014;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 2015;BA.debugLine="m.Initialize";
_m.Initialize();
 //BA.debugLineNum = 2016;BA.debugLine="Private c_prodsX As Cursor=B4XPages.MainPage.skmt";
_c_prodsx = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_c_prodsx = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select ifnull(sum(PE_CANT), 0) as cantProds, ifnull(sum(PE_COSTO_TOT), 0) as costoTotal FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")));
 //BA.debugLineNum = 2017;BA.debugLine="c_prodsX.Position=0";
_c_prodsx.setPosition((int) (0));
 //BA.debugLineNum = 2019;BA.debugLine="m = CreateMap(\"productos\": c_prodsX.GetString(\"ca";
_m = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("productos"),(Object)(_c_prodsx.GetString("cantProds")),(Object)("monto"),(Object)(_c_prodsx.GetString("costoTotal"))});
 //BA.debugLineNum = 2020;BA.debugLine="Return m";
if (true) return _m;
 //BA.debugLineNum = 2021;BA.debugLine="End Sub";
return null;
}
public static boolean  _traeusarintentbdwa(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _bdwa = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _x = null;
 //BA.debugLineNum = 1770;BA.debugLine="Sub traeUsarIntentBDWA As Boolean 'ignore";
 //BA.debugLineNum = 1771;BA.debugLine="Private BDWA As Boolean = False";
_bdwa = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1772;BA.debugLine="Private x As Cursor = Starter.skmt.ExecQuery($\"se";
_x = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_x = (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_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'IMPORTAR_BD_WA'"))));
 //BA.debugLineNum = 1773;BA.debugLine="If x.RowCount > 0 Then";
if (_x.getRowCount()>0) { 
 //BA.debugLineNum = 1774;BA.debugLine="x.Position = 0";
_x.setPosition((int) (0));
 //BA.debugLineNum = 1775;BA.debugLine="If x.GetString(\"CAT_VA_VALOR\") = \"true\" Then BDW";
if ((_x.GetString("CAT_VA_VALOR")).equals("true")) { 
_bdwa = anywheresoftware.b4a.keywords.Common.True;};
 };
 //BA.debugLineNum = 1778;BA.debugLine="Return BDWA";
if (true) return _bdwa;
 //BA.debugLineNum = 1779;BA.debugLine="End Sub";
return false;
}
public static String  _traeusuariodebd(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _u = "";
 //BA.debugLineNum = 855;BA.debugLine="Sub traeUsuarioDeBD As String 'ignore";
 //BA.debugLineNum = 856;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 857;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
 //BA.debugLineNum = 858;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 859;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 = 860;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 861;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
 //BA.debugLineNum = 862;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 863;BA.debugLine="Return u";
if (true) return _u;
 //BA.debugLineNum = 864;BA.debugLine="End Sub";
return "";
}
public static String  _traevariable(anywheresoftware.b4a.BA _ba,String _nombre) throws Exception{
String _valor = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _lavc = null;
 //BA.debugLineNum = 1915;BA.debugLine="Sub traeVariable(nombre As String) As String";
 //BA.debugLineNum = 1916;BA.debugLine="Private valor As String = \"\"";
_valor = "";
 //BA.debugLineNum = 1917;BA.debugLine="Private laVc As Cursor = Starter.skmt.ExecQuery($";
_lavc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_lavc = (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_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_nombre))+"'"))));
 //BA.debugLineNum = 1918;BA.debugLine="If laVc.RowCount > 0 Then";
if (_lavc.getRowCount()>0) { 
 //BA.debugLineNum = 1919;BA.debugLine="laVc.Position = 0";
_lavc.setPosition((int) (0));
 //BA.debugLineNum = 1920;BA.debugLine="valor = laVc.GetString(\"CAT_VA_VALOR\")";
_valor = _lavc.GetString("CAT_VA_VALOR");
 };
 //BA.debugLineNum = 1922;BA.debugLine="Return valor";
if (true) return _valor;
 //BA.debugLineNum = 1923;BA.debugLine="End Sub";
return "";
}
public static String  _validapromoprocterpro3009(anywheresoftware.b4a.BA _ba) throws Exception{
String _idregalo = "";
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _r = null;
String _monto = "";
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _r2 = null;
 //BA.debugLineNum = 1621;BA.debugLine="Sub validaPromoProcterPRO3009";
 //BA.debugLineNum = 1622;BA.debugLine="Private idRegalo As String = \"PYG1016\"";
_idregalo = "PYG1016";
 //BA.debugLineNum = 1623;BA.debugLine="Private r As ResultSet = Starter.skmt.ExecQuery($";
_r = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_r = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select pe_cliente from pedido where pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idregalo))+"' and pe_cedis = 'PRO3009'"))));
 //BA.debugLineNum = 1625;BA.debugLine="Do While r.NextRow";
while (_r.NextRow()) {
 //BA.debugLineNum = 1626;BA.debugLine="Private monto As String = 0";
_monto = BA.NumberToString(0);
 //BA.debugLineNum = 1627;BA.debugLine="Private r2 As ResultSet = Starter.skmt.ExecQuery";
_r2 = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_r2 = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select ifnull(sum(pe_costo_tot),0) as monto from pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_r.GetString("PE_CLIENTE")))+"' and PE_PROID in (\"PYG1014\", \"PYG1025\")"))));
 //BA.debugLineNum = 1628;BA.debugLine="Do While r2.NextRow";
while (_r2.NextRow()) {
 //BA.debugLineNum = 1629;BA.debugLine="Log($\"Cliente: ${r.GetString(\"PE_CLIENTE\")}, mo";
anywheresoftware.b4a.keywords.Common.LogImpl("411927560",("Cliente: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_r.GetString("PE_CLIENTE")))+", monto: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_r2.GetString("monto")))+""),0);
 //BA.debugLineNum = 1632;BA.debugLine="If r2.GetString(\"monto\") < 150 Then";
if ((double)(Double.parseDouble(_r2.GetString("monto")))<150) { 
 //BA.debugLineNum = 1633;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedido";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido where pe_cedis = 'PRO3009' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idregalo))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_r.GetString("PE_CLIENTE")))+"' and pe_cant = 1 "));
 //BA.debugLineNum = 1635;BA.debugLine="Msgbox($\"Regalo de la promoción PRO3009 borrad";
anywheresoftware.b4a.keywords.Common.Msgbox(BA.ObjectToCharSequence(("Regalo de la promoción PRO3009 borrado por no cumplir con los requisitos mínimos.")),BA.ObjectToCharSequence("Regalo Borrado"),_ba);
 };
 }
;
 //BA.debugLineNum = 1639;BA.debugLine="r2 = Starter.skmt.ExecQuery($\"select count(pe_pr";
_r2 = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select count(pe_proid) as cuantos from pedido where pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_r.GetString("PE_CLIENTE")))+"'"))));
 //BA.debugLineNum = 1640;BA.debugLine="Do While r2.NextRow";
while (_r2.NextRow()) {
 //BA.debugLineNum = 1642;BA.debugLine="If r2.GetString(\"cuantos\") = 0 Then";
if ((_r2.GetString("cuantos")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1643;BA.debugLine="Starter.skmt.ExecNonQuery($\"delete from pedido";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido_cliente where pc_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_r.GetString("PE_CLIENTE")))+"'"));
 //BA.debugLineNum = 1644;BA.debugLine="Starter.skmt.ExecNonQuery($\"update kmt_info3 s";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update kmt_info3 set gestion = 0 where cat_cl_codigo = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_r.GetString("PE_CLIENTE")))+"'"));
 };
 }
;
 }
;
 //BA.debugLineNum = 1648;BA.debugLine="End Sub";
return "";
}
public static boolean  _vendidopromoesp(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _w = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 1415;BA.debugLine="Sub vendidoPromoEsp As Boolean";
 //BA.debugLineNum = 1416;BA.debugLine="Private w As Boolean = False";
_w = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1417;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exec";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select HP_CLIENTE, HP_CODIGO_PROMOCION from HIST_PROMOS WHERE HP_CODIGO_PROMOCION IN (SELECT DISTINCT CAT_PE_IDPROMO FROM CAT_PROMO_ESP) AND HP_CLIENTE IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 1418;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1419;BA.debugLine="w = True";
_w = anywheresoftware.b4a.keywords.Common.True;
 };
 //BA.debugLineNum = 1421;BA.debugLine="Log(w)";
anywheresoftware.b4a.keywords.Common.LogImpl("411599878",BA.ObjectToString(_w),0);
 //BA.debugLineNum = 1422;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1423;BA.debugLine="Private c As Cursor = B4XPages.MainPage.skmt.Exec";
_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._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select PE_PROID from PEDIDO WHERE PE_PROID IN (SELECT DISTINCT CAT_PE_IDPROMO FROM CAT_PROMO_ESP) AND PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 1424;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1425;BA.debugLine="w = True";
_w = anywheresoftware.b4a.keywords.Common.True;
 };
 //BA.debugLineNum = 1427;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1428;BA.debugLine="Log(w)";
anywheresoftware.b4a.keywords.Common.LogImpl("411599885",BA.ObjectToString(_w),0);
 //BA.debugLineNum = 1429;BA.debugLine="Return w";
if (true) return _w;
 //BA.debugLineNum = 1430;BA.debugLine="End Sub";
return false;
}
}
