package medicomed.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 b4a.example.dateutils _dateutils = null;
public medicomed.keymon.com.mx.main _main = null;
public medicomed.keymon.com.mx.starter _starter = null;
public medicomed.keymon.com.mx.appupdater _appupdater = null;
public medicomed.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public medicomed.keymon.com.mx.mapa_cliente _mapa_cliente = null;
public medicomed.keymon.com.mx.notificationservice _notificationservice = null;
public medicomed.keymon.com.mx.pendientes _pendientes = null;
public medicomed.keymon.com.mx.tracker _tracker = null;
public medicomed.keymon.com.mx.newinst2 _newinst2 = null;
public medicomed.keymon.com.mx.b4xpages _b4xpages = null;
public medicomed.keymon.com.mx.b4xcollections _b4xcollections = null;
public medicomed.keymon.com.mx.httputils2service _httputils2service = null;
public medicomed.keymon.com.mx.xuiviewsutils _xuiviewsutils = null;
public static String  _actualizaproducto(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,int _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _cantc,String _bcajas) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _antcant = 0;
int _difcant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pe = null;
 //BA.debugLineNum = 808;BA.debugLine="Sub actualizaProducto(cedis As String, costoU As S";
 //BA.debugLineNum = 809;BA.debugLine="Log(\"Entramos a actualiza producto\")";
anywheresoftware.b4a.keywords.Common.LogImpl("758523649","Entramos a actualiza producto",0);
 //BA.debugLineNum = 810;BA.debugLine="Private c As Cursor=B4XPages.MainPage.skmt.ExecQu";
_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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._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_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"))));
 //BA.debugLineNum = 812;BA.debugLine="LogColor($\"actualizaProducto, c=${clienteId}, p=$";
anywheresoftware.b4a.keywords.Common.LogImpl("758523652",("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 = 813;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 814;BA.debugLine="Log(\"----->1<--------------\")";
anywheresoftware.b4a.keywords.Common.LogImpl("758523654","----->1<--------------",0);
 //BA.debugLineNum = 815;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 816;BA.debugLine="Private antCant As Int = 0";
_antcant = (int) (0);
 //BA.debugLineNum = 817;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 = 818;BA.debugLine="Private difCant As Int = cant - antCant";
_difcant = (int) (_cant-_antcant);
 //BA.debugLineNum = 819;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update ped";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._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)((_cant*(double)(Double.parseDouble(_c.GetString("PE_COSTOU"))))))+", PE_CANTC = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cantc))+", PE_BCAJAS = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_bcajas))+" 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_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"));
 //BA.debugLineNum = 821;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update CAT";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD 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 = 822;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update CAT";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD2 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 = 825;BA.debugLine="If cant = 0 Then";
if (_cant==0) { 
 //BA.debugLineNum = 826;BA.debugLine="Log(\"BORRAMOS PROD\")";
anywheresoftware.b4a.keywords.Common.LogImpl("758523666","BORRAMOS PROD",0);
 //BA.debugLineNum = 827;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"delete fr";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._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_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"));
 //BA.debugLineNum = 828;BA.debugLine="Private pe As Cursor = B4XPages.MainPage.skmt.E";
_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._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")));
 //BA.debugLineNum = 829;BA.debugLine="pe.Position=0";
_pe.setPosition((int) (0));
 //BA.debugLineNum = 830;BA.debugLine="If pe.GetString(\"cuantosPedidos\") = 0 Then B4XP";
if ((_pe.GetString("cuantosPedidos")).equals(BA.NumberToString(0))) { 
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");};
 };
 }else {
 //BA.debugLineNum = 833;BA.debugLine="Log(\"----->2<--------------\")";
anywheresoftware.b4a.keywords.Common.LogImpl("758523673","----->2<--------------",0);
 //BA.debugLineNum = 835;BA.debugLine="If cant <> 0 Then guardaProductoSinGestion(cedis";
if (_cant!=0) { 
_guardaproductosingestion(_ba,_cedis,_costou,BA.NumberToString(_cant),_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas);};
 };
 //BA.debugLineNum = 837;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 838;BA.debugLine="End Sub";
return "";
}
public static String  _actualizaproducto2(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,int _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _cantc,String _bcajas) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _antcant = 0;
int _difcant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pe = null;
 //BA.debugLineNum = 853;BA.debugLine="Sub actualizaProducto2(cedis As String, costoU As";
 //BA.debugLineNum = 854;BA.debugLine="Private c As Cursor=B4XPages.MainPage.skmt.ExecQu";
_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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._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_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"))));
 //BA.debugLineNum = 856;BA.debugLine="LogColor($\"actualizaProducto, c=${clienteId}, p=$";
anywheresoftware.b4a.keywords.Common.LogImpl("758654723",("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 = 858;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 859;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 860;BA.debugLine="Private antCant As Int = 0";
_antcant = (int) (0);
 //BA.debugLineNum = 861;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 = 862;BA.debugLine="Private difCant As Int = cant - antCant";
_difcant = (int) (_cant-_antcant);
 //BA.debugLineNum = 863;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update ped";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._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)(((double)(Double.parseDouble(_cantc))*(double)(Double.parseDouble(_c.GetString("PE_COSTOU"))))))+", PE_CANTC = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cantc))+", PE_BCAJAS = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_bcajas))+" 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_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"));
 //BA.debugLineNum = 865;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update CAT";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD 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 = 866;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update CAT";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD2 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 = 868;BA.debugLine="If cant = 0 Then";
if (_cant==0) { 
 //BA.debugLineNum = 869;BA.debugLine="Log(\"BORRAMOS PROD\")";
anywheresoftware.b4a.keywords.Common.LogImpl("758654736","BORRAMOS PROD",0);
 //BA.debugLineNum = 870;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"delete fr";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._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_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"));
 //BA.debugLineNum = 871;BA.debugLine="Private pe As Cursor = B4XPages.MainPage.skmt.E";
_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._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")));
 //BA.debugLineNum = 872;BA.debugLine="pe.Position=0";
_pe.setPosition((int) (0));
 //BA.debugLineNum = 873;BA.debugLine="If pe.GetString(\"cuantosPedidos\") = 0 Then B4XP";
if ((_pe.GetString("cuantosPedidos")).equals(BA.NumberToString(0))) { 
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");};
 };
 }else {
 //BA.debugLineNum = 877;BA.debugLine="If cant <> 0 Then guardaProductoSinGestion2(cedi";
if (_cant!=0) { 
_guardaproductosingestion2(_ba,_cedis,_costou,BA.NumberToString(_cant),_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas);};
 };
 //BA.debugLineNum = 879;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 880;BA.debugLine="End Sub";
return "";
}
public static String  _actualizatet(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
long _total = 0L;
int _i = 0;
long _subtotal = 0L;
 //BA.debugLineNum = 1420;BA.debugLine="Sub actualizaTET(cliente As String)";
 //BA.debugLineNum = 1421;BA.debugLine="Dim c As Cursor = B4XPages.MainPage.skmt.Execquer";
_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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select * from PEDIDO_INICIO_FINAL where PIF_CLIENTE = ?",new String[]{_cliente})));
 //BA.debugLineNum = 1422;BA.debugLine="Dim total As Long = 0";
_total = (long) (0);
 //BA.debugLineNum = 1423;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1424;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1425;BA.debugLine="For i = 0 To c.RowCount-1";
{
final int step5 = 1;
final int limit5 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 1426;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 1428;BA.debugLine="Dim subtotal As Long = c.GetString(\"PIF_HORA_FI";
_subtotal = (long) ((double)(Double.parseDouble(_c.GetString("PIF_HORA_FINAL")))-(double)(Double.parseDouble(_c.GetString("PIF_HORA_INICIO"))));
 //BA.debugLineNum = 1429;BA.debugLine="total = total + subtotal";
_total = (long) (_total+_subtotal);
 }
};
 //BA.debugLineNum = 1433;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"update PED";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("update PEDIDO_CLIENTE set PC_TIEMPO_TIENDA = ? where PC_CLIENTE = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{BA.NumberToString(((_total/(double)1000)/(double)60)),_cliente}));
 };
 //BA.debugLineNum = 1435;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 = 1517;BA.debugLine="Sub agregaColumna(tabla As String, columna As Stri";
 //BA.debugLineNum = 1518;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try { //BA.debugLineNum = 1519;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 /*medicomed.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 = 1520;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1521;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 1522;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
mostCurrent._b4xpages._mainpage /*medicomed.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))+""));
 };
 } 
       catch (Exception e8) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e8); //BA.debugLineNum = 1526;BA.debugLine="Try";
try { //BA.debugLineNum = 1527;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
mostCurrent._b4xpages._mainpage /*medicomed.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 = 1528;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("760293131",("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 e12) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e12); //BA.debugLineNum = 1530;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("760293133",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 };
 //BA.debugLineNum = 1533;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 = 1106;BA.debugLine="Sub alcanzanLosVariablesParaPromo(promoMap As Map,";
 //BA.debugLineNum = 1107;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1108;BA.debugLine="If thisLog Then LogColor(\"Inventario inicial: \"&i";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759244546","Inventario inicial: "+BA.ObjectToString(_inventariosinfijos),anywheresoftware.b4a.keywords.Common.Colors.Gray);};
 //BA.debugLineNum = 1109;BA.debugLine="Private totalProdsVariables As Int = 0";
_totalprodsvariables = (int) (0);
 //BA.debugLineNum = 1110;BA.debugLine="Private totalProdsVariables2 As Int = 0";
_totalprodsvariables2 = (int) (0);
 //BA.debugLineNum = 1112;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 = 1113;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 = 1114;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 = 1115;BA.debugLine="Private t As String = prodsVariables.Get(p) 'Obt";
_t = BA.ObjectToString(_prodsvariables.Get(_p));
 //BA.debugLineNum = 1117;BA.debugLine="If inventarioSinFijos.ContainsKey(t) Then 'Si ex";
if (_inventariosinfijos.ContainsKey((Object)(_t))) { 
 //BA.debugLineNum = 1118;BA.debugLine="Private p2 As String = inventarioSinFijos.Get(t";
_p2 = BA.ObjectToString(_inventariosinfijos.Get((Object)(_t)));
 //BA.debugLineNum = 1120;BA.debugLine="totalProdsVariables = totalProdsVariables + p2";
_totalprodsvariables = (int) (_totalprodsvariables+(double)(Double.parseDouble(_p2)));
 //BA.debugLineNum = 1122;BA.debugLine="If thisLog Then Log($\"prod ${t}, hay: ${p2}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759244560",("prod "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+", hay: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_p2))+""),0);};
 };
 }
};
 //BA.debugLineNum = 1125;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 = 1126;BA.debugLine="Private t As String = prodsVariables2.Get(p) 'Ob";
_t = BA.ObjectToString(_prodsvariables2.Get(_p));
 //BA.debugLineNum = 1127;BA.debugLine="If inventarioSinFijos.ContainsKey(t) Then 'Si ex";
if (_inventariosinfijos.ContainsKey((Object)(_t))) { 
 //BA.debugLineNum = 1128;BA.debugLine="Private p2 As String = inventarioSinFijos.Get(t";
_p2 = BA.ObjectToString(_inventariosinfijos.Get((Object)(_t)));
 //BA.debugLineNum = 1129;BA.debugLine="totalProdsVariables2 = totalProdsVariables2 + p";
_totalprodsvariables2 = (int) (_totalprodsvariables2+(double)(Double.parseDouble(_p2)));
 //BA.debugLineNum = 1130;BA.debugLine="If thisLog Then Log($\"prod ${t}, hay: ${p2}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759244568",("prod "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+", hay: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_p2))+""),0);};
 };
 }
};
 //BA.debugLineNum = 1133;BA.debugLine="If thisLog Then Log(\"Total prods variables=\" & to";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759244571","Total prods variables="+BA.NumberToString(_totalprodsvariables)+", requeridos="+BA.ObjectToString(_promomap.Get((Object)("prodsVariablesRequeridos"))),0);};
 //BA.debugLineNum = 1134;BA.debugLine="If thisLog Then Log(\"Total prods variables2=\" & t";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759244572","Total prods variables2="+BA.NumberToString(_totalprodsvariables2)+", requeridos2="+BA.ObjectToString(_promomap.Get((Object)("prodsVariables2Requeridos"))),0);};
 //BA.debugLineNum = 1135;BA.debugLine="Private res As Boolean = False";
_res = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1136;BA.debugLine="Private res1 As Boolean = False";
_res1 = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1137;BA.debugLine="Private res2 As Boolean = False";
_res2 = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1142;BA.debugLine="If totalProdsVariables > 0 And totalProdsVariable";
if (_totalprodsvariables>0 && _totalprodsvariables>=(double)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariablesRequeridos"))))) { 
 //BA.debugLineNum = 1143;BA.debugLine="res1 = True 'Si el total de inventario de produc";
_res1 = anywheresoftware.b4a.keywords.Common.True;
 };
 //BA.debugLineNum = 1145;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 = 1146;BA.debugLine="If totalProdsVariables2 > 0 And totalProdsVariabl";
if (_totalprodsvariables2>0 && _totalprodsvariables2>=(double)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariables2Requeridos"))))) { 
 //BA.debugLineNum = 1147;BA.debugLine="res2 = True 'Si el total de inventario de produc";
_res2 = anywheresoftware.b4a.keywords.Common.True;
 };
 //BA.debugLineNum = 1149;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 = 1150;BA.debugLine="Log(res1&\" ________________________\" & res2)";
anywheresoftware.b4a.keywords.Common.LogImpl("759244588",BA.ObjectToString(_res1)+" ________________________"+BA.ObjectToString(_res2),0);
 //BA.debugLineNum = 1151;BA.debugLine="If res1 And res2 Then 'Solo si son verdadero los";
if (_res1 && _res2) { 
 //BA.debugLineNum = 1152;BA.debugLine="res = True";
_res = anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 1154;BA.debugLine="res = False";
_res = anywheresoftware.b4a.keywords.Common.False;
 };
 //BA.debugLineNum = 1157;BA.debugLine="Return res";
if (true) return _res;
 //BA.debugLineNum = 1158;BA.debugLine="End Sub";
return false;
}
public static String  _borraarribade100errores(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 466;BA.debugLine="Sub borraArribaDe100Errores 'ignore";
 //BA.debugLineNum = 467;BA.debugLine="revisaBD";
_revisabd(_ba);
 //BA.debugLineNum = 468;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("756885250","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 469;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 = 470;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 471;BA.debugLine="Log(\"Borramos mas de 100 de errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("756885253","Borramos mas de 100 de errorLog",0);
 //BA.debugLineNum = 472;BA.debugLine="End Sub";
return "";
}
public static String  _borraarribade600renglonesbitacora(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 475;BA.debugLine="Sub borraArribaDe600RenglonesBitacora 'ignore";
 //BA.debugLineNum = 476;BA.debugLine="revisaBD";
_revisabd(_ba);
 //BA.debugLineNum = 477;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("756950786","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 478;BA.debugLine="kmt.ExecNonQuery(\"DELETE FROM bitacora WHERE fech";
_kmt.ExecNonQuery("DELETE FROM bitacora WHERE fecha NOT in (SELECT fecha FROM bitacora ORDER BY fecha desc LIMIT 599 )");
 //BA.debugLineNum = 479;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 480;BA.debugLine="Log(\"Borramos mas de 600 de bitacora\")";
anywheresoftware.b4a.keywords.Common.LogImpl("756950789","Borramos mas de 600 de bitacora",0);
 //BA.debugLineNum = 481;BA.debugLine="End Sub";
return "";
}
public static String  _borralogdb(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 350;BA.debugLine="Sub borraLogDB 'ignore";
 //BA.debugLineNum = 351;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("756688641","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 352;BA.debugLine="kmt.ExecNonQuery(\"delete from bitacora\")";
_kmt.ExecNonQuery("delete from bitacora");
 //BA.debugLineNum = 353;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 354;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 = 180;BA.debugLine="Sub borramosArchivoGPS 'ignore";
 //BA.debugLineNum = 181;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 182;BA.debugLine="Dim s As String = \"\"";
_s = "";
 //BA.debugLineNum = 183;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
 //BA.debugLineNum = 184;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
 //BA.debugLineNum = 185;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 186;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 = 1451;BA.debugLine="Sub borraPedidoClienteActual As String";
 //BA.debugLineNum = 1465;BA.debugLine="Private thisC As Cursor";
_thisc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1467;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) ")));
 //BA.debugLineNum = 1468;BA.debugLine="If thisC.RowCount>0 Then";
if (_thisc.getRowCount()>0) { 
 //BA.debugLineNum = 1469;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 = 1470;BA.debugLine="thisC.Position = i";
_thisc.setPosition(_i);
 //BA.debugLineNum = 1472;BA.debugLine="Starter.skmt.ExecNonQuery($\"update CAT_GUNAPROD";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD 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 = 1473;BA.debugLine="Starter.skmt.ExecNonQuery($\"update CAT_GUNAPROD";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD2 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 = 1474;BA.debugLine="LogColor($\"update ${traeTablaProds(thisC.GetStr";
anywheresoftware.b4a.keywords.Common.LogImpl("760030999",("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 = 1478;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 = 1479;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 = 1480;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 = 1481;BA.debugLine="Return 1";
if (true) return BA.NumberToString(1);
 //BA.debugLineNum = 1482;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 = 618;BA.debugLine="Sub buscaDBUsuario As String 'ignore";
 //BA.debugLineNum = 619;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 620;BA.debugLine="Private usuario As String = \"SinUsuario\"";
_usuario = "SinUsuario";
 //BA.debugLineNum = 621;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 = 622;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 623;BA.debugLine="If c.RowCount > 0 Then usuario = c.GetString(\"USU";
if (_c.getRowCount()>0) { 
_usuario = _c.GetString("USUARIO");};
 //BA.debugLineNum = 624;BA.debugLine="Return usuario";
if (true) return _usuario;
 //BA.debugLineNum = 625;BA.debugLine="End Sub";
return "";
}
public static String  _centraboton(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ButtonWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 40;BA.debugLine="Sub centraBoton(elemento As Button, anchoElementoS";
 //BA.debugLineNum = 41;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 = 42;BA.debugLine="End Sub";
return "";
}
public static String  _centraetiqueta(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.LabelWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 598;BA.debugLine="Sub centraEtiqueta(elemento As Label, anchoElement";
 //BA.debugLineNum = 599;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 = 600;BA.debugLine="End Sub";
return "";
}
public static String  _centrapanel(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 603;BA.debugLine="Sub centraPanel(elemento As Panel, anchoElementoSu";
 //BA.debugLineNum = 604;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 = 605;BA.debugLine="End Sub";
return "";
}
public static String  _centrapanelv(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _elemento,int _altoelementosuperior) throws Exception{
 //BA.debugLineNum = 608;BA.debugLine="Sub centraPanelV(elemento As Panel, altoElementoSu";
 //BA.debugLineNum = 609;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 = 610;BA.debugLine="End Sub";
return "";
}
public static String  _centraprogressbar(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ProgressBarWrapper _elemento,int _anchoelementosuperior) throws Exception{
 //BA.debugLineNum = 613;BA.debugLine="Sub centraProgressBar(elemento As ProgressBar, anc";
 //BA.debugLineNum = 614;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 = 615;BA.debugLine="End Sub";
return "";
}
public static String  _compress(anywheresoftware.b4a.BA _ba,String _str) throws Exception{
byte[] _compressed = null;
String _base64 = "";
 //BA.debugLineNum = 45;BA.debugLine="Sub compress(str As String) As String 'ignore";
 //BA.debugLineNum = 47;BA.debugLine="Dim compressed() As Byte = GZip.compress(str)";
_compressed = _gzip.compress(_str);
 //BA.debugLineNum = 50;BA.debugLine="Dim base64 As String = su.EncodeBase64(compressed";
_base64 = _su.EncodeBase64(_compressed);
 //BA.debugLineNum = 51;BA.debugLine="Log($\"Comprimido: ${base64.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("755443462",("Comprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_base64.length()))+""),0);
 //BA.debugLineNum = 53;BA.debugLine="Return base64";
if (true) return _base64;
 //BA.debugLineNum = 54;BA.debugLine="End Sub";
return "";
}
public static String  _copiadb(anywheresoftware.b4a.BA _ba,boolean _result) throws Exception{
String _p = "";
String _thedir = "";
 //BA.debugLineNum = 556;BA.debugLine="Sub copiaDB(result As Boolean) 'ignore";
 //BA.debugLineNum = 557;BA.debugLine="ToastMessageShow(\"copiaDB\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("copiaDB"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 558;BA.debugLine="If result Then";
if (_result) { 
 //BA.debugLineNum = 559;BA.debugLine="Dim p As String";
_p = "";
 //BA.debugLineNum = 560;BA.debugLine="If File.ExternalWritable Then";
if (anywheresoftware.b4a.keywords.Common.File.getExternalWritable()) { 
 //BA.debugLineNum = 561;BA.debugLine="p = File.DirInternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 }else {
 //BA.debugLineNum = 564;BA.debugLine="p = File.DirInternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 };
 //BA.debugLineNum = 567;BA.debugLine="Dim theDir As String";
_thedir = "";
 //BA.debugLineNum = 568;BA.debugLine="Try";
try { //BA.debugLineNum = 569;BA.debugLine="File.MakeDir(File.DirInternal,\"kmts\")";
anywheresoftware.b4a.keywords.Common.File.MakeDir(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmts");
 //BA.debugLineNum = 570;BA.debugLine="theDir = \"/kmts\"";
_thedir = "/kmts";
 } 
       catch (Exception e14) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e14); //BA.debugLineNum = 572;BA.debugLine="theDir = \"\"";
_thedir = "";
 };
 //BA.debugLineNum = 574;BA.debugLine="Try";
try { //BA.debugLineNum = 575;BA.debugLine="File.Copy(File.DirInternal,\"kmt.db\",File.DirInt";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db",anywheresoftware.b4a.keywords.Common.File.getDirInternal()+_thedir,"cedex_kmt.db");
 //BA.debugLineNum = 576;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.getDirInternal()+_thedir,"cedex_errorLog.db");
 //BA.debugLineNum = 577;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 = 579;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 = 581;BA.debugLine="Log(\"rootExternal=\"&p)";
anywheresoftware.b4a.keywords.Common.LogImpl("757278489","rootExternal="+_p,0);
 //BA.debugLineNum = 582;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
anywheresoftware.b4a.keywords.Common.LogImpl("757278490","File.DirInternal="+anywheresoftware.b4a.keywords.Common.File.getDirInternal(),0);
 //BA.debugLineNum = 583;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
anywheresoftware.b4a.keywords.Common.LogImpl("757278491","File.DirInternal="+anywheresoftware.b4a.keywords.Common.File.getDirInternal(),0);
 }else {
 //BA.debugLineNum = 585;BA.debugLine="ToastMessageShow(\"Sin permisos\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Sin permisos"),anywheresoftware.b4a.keywords.Common.False);
 };
 //BA.debugLineNum = 587;BA.debugLine="End Sub";
return "";
}
public static String  _cuantosvariablestengobd(anywheresoftware.b4a.BA _ba,String _promo) throws Exception{
 //BA.debugLineNum = 1384;BA.debugLine="Sub cuantosVariablesTengoBD(promo As String) As St";
 //BA.debugLineNum = 1395;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 = 494;BA.debugLine="Sub dameErroresJSON(SQL As SQL, maxErrores As Int,";
 //BA.debugLineNum = 495;BA.debugLine="Log(\"dameErroresJSON\")";
anywheresoftware.b4a.keywords.Common.LogImpl("757081857","dameErroresJSON",0);
 //BA.debugLineNum = 496;BA.debugLine="Private j As JSONGenerator";
_j = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 497;BA.debugLine="Private lim As String";
_lim = "";
 //BA.debugLineNum = 498;BA.debugLine="Private cur As ResultSet";
_cur = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
 //BA.debugLineNum = 499;BA.debugLine="Private l As List";
_l = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 500;BA.debugLine="Private i As Int = 0";
_i = (int) (0);
 //BA.debugLineNum = 501;BA.debugLine="l.Initialize";
_l.Initialize();
 //BA.debugLineNum = 502;BA.debugLine="Dim m, m2 As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m2 = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 503;BA.debugLine="m2.Initialize";
_m2.Initialize();
 //BA.debugLineNum = 504;BA.debugLine="If maxErrores = 0 Then lim = \"\" Else lim = \"limit";
if (_maxerrores==0) { 
_lim = "";}
else {
_lim = "limit "+BA.NumberToString(_maxerrores);};
 //BA.debugLineNum = 505;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 = 506;BA.debugLine="Do While cur.NextRow";
while (_cur.NextRow()) {
 //BA.debugLineNum = 507;BA.debugLine="m.Initialize";
_m.Initialize();
 //BA.debugLineNum = 508;BA.debugLine="m.Put(\"fecha\", cur.GetString(\"fecha\"))";
_m.Put((Object)("fecha"),(Object)(_cur.GetString("fecha")));
 //BA.debugLineNum = 509;BA.debugLine="m.Put(\"error\", cur.GetString(\"error\"))";
_m.Put((Object)("error"),(Object)(_cur.GetString("error")));
 //BA.debugLineNum = 510;BA.debugLine="m2.Put(i,m)";
_m2.Put((Object)(_i),(Object)(_m.getObject()));
 //BA.debugLineNum = 511;BA.debugLine="i = i + 1";
_i = (int) (_i+1);
 }
;
 //BA.debugLineNum = 513;BA.debugLine="cur.Close";
_cur.Close();
 //BA.debugLineNum = 514;BA.debugLine="j.Initialize(m2)";
_j.Initialize(_m2);
 //BA.debugLineNum = 515;BA.debugLine="Log(j.ToString)";
anywheresoftware.b4a.keywords.Common.LogImpl("757081877",_j.ToString(),0);
 //BA.debugLineNum = 516;BA.debugLine="If comprimido Then";
if (_comprimido) { 
 //BA.debugLineNum = 517;BA.debugLine="Return compress(j.ToString)";
if (true) return _compress(_ba,_j.ToString());
 }else {
 //BA.debugLineNum = 519;BA.debugLine="Return j.ToString";
if (true) return _j.ToString();
 };
 //BA.debugLineNum = 521;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 = 136;BA.debugLine="Sub dameRuta(inicioRuta As String, origenRuta As S";
 //BA.debugLineNum = 138;BA.debugLine="Dim fechaInicio As String";
_fechainicio = "";
 //BA.debugLineNum = 139;BA.debugLine="Try 'incioRuta es numero";
try { //BA.debugLineNum = 140;BA.debugLine="inicioRuta = inicioRuta * 1";
_inicioruta = BA.NumberToString((double)(Double.parseDouble(_inicioruta))*1);
 //BA.debugLineNum = 142;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 = 144;BA.debugLine="fechaInicio = fechaInicioHoy";
_fechainicio = _fechainiciohoy(_ba);
 };
 //BA.debugLineNum = 147;BA.debugLine="If subsLogs Then Log(\"fechaInicio: \"&fechaInicio&";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("755902219","fechaInicio: "+_fechainicio+" | rutaHrsAtras="+BA.NumberToString(_rutahrsatras),0);};
 //BA.debugLineNum = 148;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 149;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 = 150;BA.debugLine="If subsLogs Then Log(\"select FECHA, LAT, LON from";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("755902222","select FECHA, LAT, LON from "+_origenruta+" where FECHA > "+_fechainicio+" order by FECHA desc limit "+BA.NumberToString(_rutamaxpoints),0);};
 //BA.debugLineNum = 151;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 = 152;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 153;BA.debugLine="Dim ruta2 As String = \"\"";
_ruta2 = "";
 //BA.debugLineNum = 154;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 155;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 = 156;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 157;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 = 158;BA.debugLine="B4XPages.MainPage.fechaRuta = c.GetString(\"FECH";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._fecharuta /*String*/  = _c.GetString("FECHA");
 }
};
 };
 //BA.debugLineNum = 161;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 162;BA.debugLine="Return compress(ruta2)";
if (true) return _compress(_ba,_ruta2);
 //BA.debugLineNum = 163;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 = 628;BA.debugLine="Sub dameUsuarioDeDB As String 'ignore";
 //BA.debugLineNum = 629;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 630;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
 //BA.debugLineNum = 631;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 632;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 = 633;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 634;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
 //BA.debugLineNum = 635;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 636;BA.debugLine="Return u";
if (true) return _u;
 //BA.debugLineNum = 637;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 = 57;BA.debugLine="Sub decompress(base64 As String) As String 'ignore";
 //BA.debugLineNum = 58;BA.debugLine="Dim decompressedbytes() As Byte = su.DecodeBase64";
_decompressedbytes = _su.DecodeBase64(_base64);
 //BA.debugLineNum = 60;BA.debugLine="Dim bc As ByteConverter";
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
 //BA.debugLineNum = 61;BA.debugLine="Dim uncompressed As String = bc.StringFromBytes(d";
_uncompressed = _bc.StringFromBytes(_decompressedbytes,"UTF8");
 //BA.debugLineNum = 62;BA.debugLine="Log($\"Descomprimido: ${uncompressed.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("755508997",("Descomprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_uncompressed.length()))+""),0);
 //BA.debugLineNum = 64;BA.debugLine="Return uncompressed";
if (true) return _uncompressed;
 //BA.debugLineNum = 65;BA.debugLine="End Sub";
return "";
}
public static String  _deleteerrorlog_db(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 173;BA.debugLine="Sub deleteErrorLog_DB 'ignore";
 //BA.debugLineNum = 174;BA.debugLine="errorLog.ExecNonQuery(\"delete from errores\")";
_errorlog.ExecNonQuery("delete from errores");
 //BA.debugLineNum = 175;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 176;BA.debugLine="ToastMessageShow(\"BD Errores Borrada\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("BD Errores Borrada"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 177;BA.debugLine="End Sub";
return "";
}
public static String  _deletegps_db(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 166;BA.debugLine="Sub deleteGPS_DB 'ignore";
 //BA.debugLineNum = 167;BA.debugLine="kmt.ExecNonQuery(\"delete from RUTA_GPS\")";
_kmt.ExecNonQuery("delete from RUTA_GPS");
 //BA.debugLineNum = 168;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 169;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 = 170;BA.debugLine="End Sub";
return "";
}
public static String  _fechainiciohoy(anywheresoftware.b4a.BA _ba) throws Exception{
String _origformat = "";
String _h = "";
 //BA.debugLineNum = 309;BA.debugLine="Sub fechaInicioHoy As String 'ignore";
 //BA.debugLineNum = 310;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 311;BA.debugLine="DateTime.DateFormat=\"yyMMdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMdd");
 //BA.debugLineNum = 312;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 = 313;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 314;BA.debugLine="Log(\"Hoy=\"&h)";
anywheresoftware.b4a.keywords.Common.LogImpl("756426501","Hoy="+_h,0);
 //BA.debugLineNum = 315;BA.debugLine="Return h";
if (true) return _h;
 //BA.debugLineNum = 316;BA.debugLine="End Sub";
return "";
}
public static String  _fechakmt(anywheresoftware.b4a.BA _ba,String _fecha) throws Exception{
String _origformat = "";
String _nuevafecha = "";
 //BA.debugLineNum = 68;BA.debugLine="Sub fechaKMT(fecha As String) As String 'ignore";
 //BA.debugLineNum = 70;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 71;BA.debugLine="DateTime.DateFormat=\"yyMMddHHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMddHHmmss");
 //BA.debugLineNum = 72;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
 //BA.debugLineNum = 73;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 75;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
 //BA.debugLineNum = 76;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 = 524;BA.debugLine="Sub fechaKMT2Ticks(fKMT As String) As Long 'ignore";
 //BA.debugLineNum = 525;BA.debugLine="Try";
try { //BA.debugLineNum = 526;BA.debugLine="If fKMT.Length = 12 Then";
if (_fkmt.length()==12) { 
 //BA.debugLineNum = 527;BA.debugLine="Private parteFecha As String = fKMT.SubString2(";
_partefecha = _fkmt.substring((int) (0),(int) (6));
 //BA.debugLineNum = 528;BA.debugLine="Private parteHora As String = fKMT.SubString(6)";
_partehora = _fkmt.substring((int) (6));
 //BA.debugLineNum = 529;BA.debugLine="Private OrigFormat As String = DateTime.DateFor";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 530;BA.debugLine="DateTime.DateFormat=\"yymmdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yymmdd");
 //BA.debugLineNum = 531;BA.debugLine="DateTime.TimeFormat=\"HHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setTimeFormat("HHmmss");
 //BA.debugLineNum = 532;BA.debugLine="Private ticks As Long = DateTime.DateTimeParse(";
_ticks = anywheresoftware.b4a.keywords.Common.DateTime.DateTimeParse(_partefecha,_partehora);
 //BA.debugLineNum = 533;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 534;BA.debugLine="Return ticks";
if (true) return _ticks;
 }else {
 //BA.debugLineNum = 536;BA.debugLine="Log(\"Formato de fecha incorrecto, debe de ser '";
anywheresoftware.b4a.keywords.Common.LogImpl("757147404","Formato de fecha incorrecto, debe de ser 'YYMMDDHHMMSS', no '"+_fkmt+"' largo="+BA.NumberToString(_fkmt.length()),0);
 //BA.debugLineNum = 537;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 } 
       catch (Exception e16) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e16); //BA.debugLineNum = 540;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("757147408",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 //BA.debugLineNum = 541;BA.debugLine="LogColor($\"Fecha dada: ${fKMT}, Parte Fecha: ${p";
anywheresoftware.b4a.keywords.Common.LogImpl("757147409",("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 = 542;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 //BA.debugLineNum = 544;BA.debugLine="End Sub";
return 0L;
}
public static String  _fechanormal(anywheresoftware.b4a.BA _ba,String _fecha) throws Exception{
String _origformat = "";
String _nuevafecha = "";
 //BA.debugLineNum = 1614;BA.debugLine="Sub fechanormal(fecha As String) As String 'ignore";
 //BA.debugLineNum = 1616;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 1617;BA.debugLine="DateTime.DateFormat = \"YYYY/MM/dd HH:mm:ss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("YYYY/MM/dd HH:mm:ss");
 //BA.debugLineNum = 1618;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
 //BA.debugLineNum = 1619;BA.debugLine="DateTime.DateFormat = OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 1621;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
 //BA.debugLineNum = 1622;BA.debugLine="End Sub";
return "";
}
public static String  _getphnid(anywheresoftware.b4a.BA _ba) throws Exception{
String _t = "";
String _s = "";
 //BA.debugLineNum = 20;BA.debugLine="Sub getPhnId As String 'ignore";
 //BA.debugLineNum = 22;BA.debugLine="devModel = phn.Model";
_devmodel = _phn.getModel();
 //BA.debugLineNum = 23;BA.debugLine="If devModel.Length <= 3 Then 'Si phn.Model esta e";
if (_devmodel.length()<=3) { 
 //BA.debugLineNum = 24;BA.debugLine="Dim t As String = phn.GetSettings(\"android_id\")";
_t = _phn.GetSettings("android_id");
 //BA.debugLineNum = 25;BA.debugLine="devModel = t";
_devmodel = _t;
 };
 //BA.debugLineNum = 27;BA.debugLine="If devModel.Length >= 3 Then 'Si tenemos valor pa";
if (_devmodel.length()>=3) { 
 //BA.debugLineNum = 28;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 = 31;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 = 32;BA.debugLine="devModel = s";
_devmodel = _s;
 };
 //BA.debugLineNum = 36;BA.debugLine="Return devModel";
if (true) return _devmodel;
 //BA.debugLineNum = 37;BA.debugLine="End Sub";
return "";
}
public static String  _getssid(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 257;BA.debugLine="Sub getSSID  'ignore";
 //BA.debugLineNum = 262;BA.debugLine="End Sub";
return "";
}
public static String  _guardaappinfo(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.sql.SQL _skmt) throws Exception{
 //BA.debugLineNum = 1546;BA.debugLine="Sub guardaAppInfo(skmt As SQL)";
 //BA.debugLineNum = 1547;BA.debugLine="skmt.ExecNonQuery(\"delete from CAT_VARIABLES wher";
_skmt.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'EMPRESA' or CAT_VA_DESCRIPCION = 'APP_NAME' or CAT_VA_DESCRIPCION = 'APP_VERSION'");
 //BA.debugLineNum = 1548;BA.debugLine="skmt.ExecNonQuery($\"insert into CAT_VARIABLES (CA";
_skmt.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 = 1549;BA.debugLine="skmt.ExecNonQuery($\"insert into CAT_VARIABLES (CA";
_skmt.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 = 1550;BA.debugLine="End Sub";
return "";
}
public static String  _guardaclientehorainicio(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
 //BA.debugLineNum = 1414;BA.debugLine="Sub guardaClienteHoraInicio(cliente As String)";
 //BA.debugLineNum = 1415;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into PEDIDO_INICIO_FINAL(PIF_CLIENTE, PIF_HORA_INICIO, PIF_HORA_FINAL) VALUES(?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cliente),(Object)(anywheresoftware.b4a.keywords.Common.DateTime.getNow()),(Object)(0)}));
 //BA.debugLineNum = 1417;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 = 107;BA.debugLine="Sub guardaInfoEnArchivo(coords As String) 'ignore";
 //BA.debugLineNum = 109;BA.debugLine="Dim OrigFormat As String=DateTime.DateFormat  'sa";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
 //BA.debugLineNum = 110;BA.debugLine="DateTime.DateFormat=\"MMM-dd HH:mm:ss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MMM-dd HH:mm:ss");
 //BA.debugLineNum = 111;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 = 112;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
 //BA.debugLineNum = 114;BA.debugLine="Dim ubic As String = coords&\",\"&lastUpdate";
_ubic = _coords+","+_lastupdate;
 //BA.debugLineNum = 115;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 116;BA.debugLine="Dim s As String = ubic & CRLF";
_s = _ubic+anywheresoftware.b4a.keywords.Common.CRLF;
 //BA.debugLineNum = 117;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
 //BA.debugLineNum = 118;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
 //BA.debugLineNum = 119;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 120;BA.debugLine="End Sub";
return "";
}
public static String  _guardainfoenbd(anywheresoftware.b4a.BA _ba,String _coords) throws Exception{
String[] _latlon = null;
 //BA.debugLineNum = 123;BA.debugLine="Sub guardaInfoEnBD(coords As String) 'ignore";
 //BA.debugLineNum = 124;BA.debugLine="Log(\"Guardamos ubicacion en BD - \"&coords)";
anywheresoftware.b4a.keywords.Common.LogImpl("755836673","Guardamos ubicacion en BD - "+_coords,0);
 //BA.debugLineNum = 125;BA.debugLine="Try";
try { //BA.debugLineNum = 126;BA.debugLine="Dim latlon() As String = Regex.Split(\"\\|\", coord";
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split("\\|",_coords);
 //BA.debugLineNum = 127;BA.debugLine="If latlon.Length < 2 Then latlon = Regex.Split(\"";
if (_latlon.length<2) { 
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split(",",_coords);};
 //BA.debugLineNum = 128;BA.debugLine="If subsLogs Then Log(\"LatLon=\"&latlon)";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("755836677","LatLon="+BA.ObjectToString(_latlon),0);};
 //BA.debugLineNum = 129;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 = 131;BA.debugLine="LogColor(LastException, Colors.red)";
anywheresoftware.b4a.keywords.Common.LogImpl("755836680",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 133;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 = 781;BA.debugLine="Sub guardaProducto(cedis As String, costoU As Stri";
 //BA.debugLineNum = 783;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 784;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*medicomed.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)(_rutav),(Object)(_preciosin),(Object)(_tipoventa)}));
 //BA.debugLineNum = 785;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update ${S";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 //BA.debugLineNum = 786;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 /*medicomed.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 = 787;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 788;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*medicomed.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 = 789;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*medicomed.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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
 //BA.debugLineNum = 790;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"UPDATE kmt_i";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE kmt_info set gestion = 2  where CAT_CL_CODIGO In (select cuenta from cuentaa)");
 //BA.debugLineNum = 791;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 _cantc,String _bcajas) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 796;BA.debugLine="Sub guardaProductoSinGestion(cedis As String, cost";
 //BA.debugLineNum = 798;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 799;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*medicomed.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,PE_ENVIO_OK,PE_CANTC,PE_BCAJAS) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,0,?,?) ",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)(_cantc),(Object)(_bcajas)}));
 //BA.debugLineNum = 800;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update CAT";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update CAT_GUNAPROD set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 //BA.debugLineNum = 801;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update CAT";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update CAT_GUNAPROD2 set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 //BA.debugLineNum = 802;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 /*medicomed.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 = 803;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 804;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*medicomed.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 = 805;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*medicomed.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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
 //BA.debugLineNum = 806;BA.debugLine="End Sub";
return "";
}
public static String  _guardaproductosingestion2(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 _cantc,String _bcajas) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 840;BA.debugLine="Sub guardaProductoSinGestion2(cedis As String, cos";
 //BA.debugLineNum = 842;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 843;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*medicomed.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,PE_ENVIO_OK,PE_CANTC,PE_BCAJAS) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,0,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cedis),(Object)(((double)(Double.parseDouble(_cantc))*(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)(_cantc),(Object)(_bcajas)}));
 //BA.debugLineNum = 845;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update CAT";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update CAT_GUNAPROD set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 //BA.debugLineNum = 846;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update CAT";
mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update CAT_GUNAPROD2 set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 //BA.debugLineNum = 847;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 /*medicomed.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 = 848;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 849;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*medicomed.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 = 850;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*medicomed.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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
 //BA.debugLineNum = 851;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 = 1505;BA.debugLine="Sub hayPedido As Boolean";
 //BA.debugLineNum = 1506;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 /*medicomed.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 = 1507;BA.debugLine="thisC.Position=0";
_thisc.setPosition((int) (0));
 //BA.debugLineNum = 1508;BA.debugLine="Private hay As Boolean = False";
_hay = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1509;BA.debugLine="If thisC.GetInt(\"hayPedido\") > 0 Then hay = True";
if (_thisc.GetInt("hayPedido")>0) { 
_hay = anywheresoftware.b4a.keywords.Common.True;};
 //BA.debugLineNum = 1511;BA.debugLine="Return hay";
if (true) return _hay;
 //BA.debugLineNum = 1512;BA.debugLine="End Sub";
return false;
}
public static String  _insertarenglonespruebaenerrorlog(anywheresoftware.b4a.BA _ba) throws Exception{
int _x = 0;
 //BA.debugLineNum = 484;BA.debugLine="Sub insertaRenglonesPruebaEnErrorLog 'ignore";
 //BA.debugLineNum = 485;BA.debugLine="revisaBD";
_revisabd(_ba);
 //BA.debugLineNum = 486;BA.debugLine="Log(\"insertamos 50 renglones a errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("757016322","insertamos 50 renglones a errorLog",0);
 //BA.debugLineNum = 487;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 = 488;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 = 489;BA.debugLine="Log(x)";
anywheresoftware.b4a.keywords.Common.LogImpl("757016325",BA.NumberToString(_x),0);
 }
};
 //BA.debugLineNum = 491;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 = 546;BA.debugLine="Sub InstallAPK(dir As String, apk As String) 'igno";
 //BA.debugLineNum = 547;BA.debugLine="If File.Exists(dir, apk) Then";
if (anywheresoftware.b4a.keywords.Common.File.Exists(_dir,_apk)) { 
 //BA.debugLineNum = 548;BA.debugLine="Dim i As Intent";
_i = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 549;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 = 550;BA.debugLine="i.SetType(\"application/vnd.android.package-archi";
_i.SetType("application/vnd.android.package-archive");
 //BA.debugLineNum = 551;BA.debugLine="StartActivity(i)";
anywheresoftware.b4a.keywords.Common.StartActivity((_ba.processBA == null ? _ba : _ba.processBA),(Object)(_i.getObject()));
 };
 //BA.debugLineNum = 553;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _json2map(anywheresoftware.b4a.BA _ba,String _thejson) throws Exception{
anywheresoftware.b4a.objects.collections.JSONParser _json = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
 //BA.debugLineNum = 265;BA.debugLine="Sub JSON2Map(theJson As String) As Map 'ignore";
 //BA.debugLineNum = 267;BA.debugLine="Try";
try { //BA.debugLineNum = 268;BA.debugLine="Private json As JSONParser";
_json = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 269;BA.debugLine="json.Initialize(theJson)";
_json.Initialize(_thejson);
 //BA.debugLineNum = 270;BA.debugLine="Return json.NextObject";
if (true) return _json.NextObject();
 } 
       catch (Exception e6) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e6); //BA.debugLineNum = 272;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("756295431",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 //BA.debugLineNum = 273;BA.debugLine="log2DB(\"JSON2Map: \"&LastException)";
_log2db(_ba,"JSON2Map: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)));
 //BA.debugLineNum = 274;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 = 275;BA.debugLine="Return m";
if (true) return _m;
 };
 //BA.debugLineNum = 277;BA.debugLine="End Sub";
return null;
}
public static String  _log2db(anywheresoftware.b4a.BA _ba,String _texto) throws Exception{
 //BA.debugLineNum = 319;BA.debugLine="Sub log2DB(texto As String) 'ignore";
 //BA.debugLineNum = 320;BA.debugLine="LogColor(fechaKMT(DateTime.Now)&\" - log2BD: '\"&te";
anywheresoftware.b4a.keywords.Common.LogImpl("756492033",_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))+" - log2BD: '"+_texto+"'",anywheresoftware.b4a.keywords.Common.Colors.LightGray);
 //BA.debugLineNum = 321;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 = 322;BA.debugLine="End Sub";
return "";
}
public static String  _logjobdoneresultados(anywheresoftware.b4a.BA _ba,medicomed.keymon.com.mx.dbrequestmanager._dbresult _resultado) throws Exception{
Object[] _records = null;
String _k = "";
 //BA.debugLineNum = 1536;BA.debugLine="Sub logJobDoneResultados(resultado As DBResult)";
 //BA.debugLineNum = 1537;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 = 1538;BA.debugLine="LogColor($\"====== ${resultado.Tag} - REGISTROS =";
anywheresoftware.b4a.keywords.Common.LogImpl("760358658",("====== "+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 = 1539;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 = 1540;BA.debugLine="LogColor(k & \" = \" & records(resultado.Columns.";
anywheresoftware.b4a.keywords.Common.LogImpl("760358660",_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 = 1543;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 = 280;BA.debugLine="Sub map2JSON(m As Map) As String 'ignore";
 //BA.debugLineNum = 283;BA.debugLine="Dim jg As JSONGenerator";
_jg = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 284;BA.debugLine="jg.Initialize(m)";
_jg.Initialize(_m);
 //BA.debugLineNum = 285;BA.debugLine="Dim t As String = jg.ToString";
_t = _jg.ToString();
 //BA.debugLineNum = 286;BA.debugLine="Return t";
if (true) return _t;
 //BA.debugLineNum = 287;BA.debugLine="End Sub";
return "";
}
public static boolean  _masdexxmins(anywheresoftware.b4a.BA _ba,int _hora,int _mins) throws Exception{
 //BA.debugLineNum = 325;BA.debugLine="Sub masDeXXMins(hora As Int, mins As Int) As Boole";
 //BA.debugLineNum = 326;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 = 327;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 329;BA.debugLine="Return False";
if (true) return anywheresoftware.b4a.keywords.Common.False;
 };
 //BA.debugLineNum = 331;BA.debugLine="End Sub";
return false;
}
public static boolean  _masdexxminskmt(anywheresoftware.b4a.BA _ba,String _hora,int _mins) throws Exception{
 //BA.debugLineNum = 334;BA.debugLine="Sub masDeXXMinsKMT(hora As String, mins As Int) As";
 //BA.debugLineNum = 335;BA.debugLine="Try";
try { //BA.debugLineNum = 337;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 = 339;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
 //BA.debugLineNum = 342;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 = 345;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("756623115",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 //BA.debugLineNum = 347;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 = 79;BA.debugLine="Sub notiHigh(title As String, body As String, acti";
 //BA.debugLineNum = 80;BA.debugLine="Private notif As Notification";
_notif = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 81;BA.debugLine="notif.Initialize2(notif.IMPORTANCE_HIGH)";
_notif.Initialize2(_notif.IMPORTANCE_HIGH);
 //BA.debugLineNum = 82;BA.debugLine="notif.Icon = \"icon\"";
_notif.setIcon("icon");
 //BA.debugLineNum = 83;BA.debugLine="notif.Vibrate = False";
_notif.setVibrate(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 84;BA.debugLine="notif.Sound = False";
_notif.setSound(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 85;BA.debugLine="notif.AutoCancel = True";
_notif.setAutoCancel(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 86;BA.debugLine="Log(\"notiHigh: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("755640071","notiHigh: "+_title,0);
 //BA.debugLineNum = 87;BA.debugLine="notif.SetInfo(title, body, activity)";
_notif.SetInfoNew((_ba.processBA == null ? _ba : _ba.processBA),BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),_activity);
 //BA.debugLineNum = 89;BA.debugLine="notif.Notify(777)";
_notif.Notify((int) (777));
 //BA.debugLineNum = 90;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 = 93;BA.debugLine="Sub notiLowReturn(title As String, Body As String,";
 //BA.debugLineNum = 94;BA.debugLine="Private notification As Notification";
_notification = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 95;BA.debugLine="notification.Initialize2(notification.IMPORTANCE_";
_notification.Initialize2(_notification.IMPORTANCE_LOW);
 //BA.debugLineNum = 96;BA.debugLine="Log(\"notiLowReturn: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("755705603","notiLowReturn: "+_title,0);
 //BA.debugLineNum = 97;BA.debugLine="notification.Icon = \"icon\"";
_notification.setIcon("icon");
 //BA.debugLineNum = 98;BA.debugLine="notification.Sound = False";
_notification.setSound(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 99;BA.debugLine="notification.Vibrate = False";
_notification.setVibrate(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 100;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 = 101;BA.debugLine="notification.Notify(id)";
_notification.Notify(_id);
 //BA.debugLineNum = 103;BA.debugLine="Return notification";
if (true) return _notification;
 //BA.debugLineNum = 104;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 = 590;BA.debugLine="Sub panelVisible(panel As Panel, top As Int, left";
 //BA.debugLineNum = 591;BA.debugLine="panel.BringToFront";
_panel.BringToFront();
 //BA.debugLineNum = 592;BA.debugLine="panel.Visible = True";
_panel.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 593;BA.debugLine="panel.Top = top";
_panel.setTop(_top);
 //BA.debugLineNum = 594;BA.debugLine="panel.Left = left";
_panel.setLeft(_left);
 //BA.debugLineNum = 595;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 = 1493;BA.debugLine="Sub pedidoGuardado As Boolean";
 //BA.debugLineNum = 1494;BA.debugLine="Private guardado As Boolean = False";
_guardado = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1495;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select gestion from kmt_info where CAT_CL_CODIGO in (Select CUENTA from cuentaa)")));
 //BA.debugLineNum = 1496;BA.debugLine="If g.RowCount > 0 Then";
if (_g.getRowCount()>0) { 
 //BA.debugLineNum = 1497;BA.debugLine="g.Position=0";
_g.setPosition((int) (0));
 //BA.debugLineNum = 1498;BA.debugLine="If g.GetString(\"gestion\") = \"2\" Then guardado =";
if ((_g.GetString("gestion")).equals("2")) { 
_guardado = anywheresoftware.b4a.keywords.Common.True;};
 };
 //BA.debugLineNum = 1501;BA.debugLine="Return guardado";
if (true) return _guardado;
 //BA.debugLineNum = 1502;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 = 1199;BA.debugLine="Sub procesaPromocion(idPromo As String, cliente As";
 //BA.debugLineNum = 1200;BA.debugLine="Private thisLog As Boolean = True  'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1201;BA.debugLine="Private inicioContador As String = DateTime.Now";
_iniciocontador = BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 1202;BA.debugLine="If thisLog Then LogColor($\"********* Iniciamos re";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759441155",("********* Iniciamos revision de Promo "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idpromo))+" *********"),anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
 //BA.debugLineNum = 1204;BA.debugLine="Private pm As Map = traePromo(idPromo, cliente)";
_pm = new anywheresoftware.b4a.objects.collections.Map();
_pm = _traepromo(_ba,_idpromo,_cliente);
 //BA.debugLineNum = 1205;BA.debugLine="If thisLog Then LogColor(pm, Colors.Blue)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759441158",BA.ObjectToString(_pm),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1206;BA.debugLine="If pm.Get(\"resultado\") = \"ok\" Then 'Si encontramo";
if ((_pm.Get((Object)("resultado"))).equals((Object)("ok"))) { 
 //BA.debugLineNum = 1208;BA.debugLine="If thisLog Then LogColor($\"Promociones permitida";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759441161",("Promociones permitidas="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traemaxpromos(_ba,_pm)))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1209;BA.debugLine="If thisLog Then Log(\"Promos vendidas: \" & traePr";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759441162","Promos vendidas: "+BA.NumberToString(_traepromosvendidas(_ba,_idpromo,_cliente)),0);};
 //BA.debugLineNum = 1210;BA.debugLine="If traePromosVendidas(idPromo, cliente) >= traeM";
if (_traepromosvendidas(_ba,_idpromo,_cliente)>=_traemaxpromos(_ba,_pm)) { 
 //BA.debugLineNum = 1211;BA.debugLine="If thisLog Then LogColor(\"Ya se vendieron las p";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759441164","Ya se vendieron las promos PERMITIDAS para el cliente",anywheresoftware.b4a.keywords.Common.Colors.Red);};
 //BA.debugLineNum = 1212;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 = 1215;BA.debugLine="Private inventarioSinFijos As Map = restaFijosPr";
_inventariosinfijos = new anywheresoftware.b4a.objects.collections.Map();
_inventariosinfijos = _restafijospromo(_ba,_pm);
 //BA.debugLineNum = 1216;BA.debugLine="If thisLog Then LogColor(\"inventariosfijos=\"&inv";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759441169","inventariosfijos="+BA.ObjectToString(_inventariosinfijos),anywheresoftware.b4a.keywords.Common.Colors.Green);};
 //BA.debugLineNum = 1218;BA.debugLine="If inventarioSinFijos.Get(\"resultado\") = \"ok\" Th";
if ((_inventariosinfijos.Get((Object)("resultado"))).equals((Object)("ok"))) { 
 //BA.debugLineNum = 1220;BA.debugLine="Private pv As Boolean =  alcanzanLosVariablesPa";
_pv = _alcanzanlosvariablesparapromo(_ba,_pm,_inventariosinfijos);
 //BA.debugLineNum = 1221;BA.debugLine="If thisLog Then Log(\"Alcanzan los variables? --";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759441174","Alcanzan los variables? --> "+BA.ObjectToString(_pv),0);};
 //BA.debugLineNum = 1222;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 = 1224;BA.debugLine="If thisLog Then LogColor(\"NO HAY INVENTARIO SUF";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759441177","NO HAY INVENTARIO SUFICIENTE "+_idpromo,anywheresoftware.b4a.keywords.Common.Colors.Red);};
 //BA.debugLineNum = 1225;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 = 1231;BA.debugLine="LogColor(\"TIEMPO DE PROCESO ESTA PROMO: \" & ((Dat";
anywheresoftware.b4a.keywords.Common.LogImpl("759441184","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 = 1232;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="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 = 1070;BA.debugLine="Sub restaFijosPromo(promoMap As Map) As Map 'ignor";
 //BA.debugLineNum = 1071;BA.debugLine="Private thisLog As Boolean = True 'Si es verdader";
_thislog = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1072;BA.debugLine="Private inventariosDisponiblesParaEstaPromo As Ma";
_inventariosdisponiblesparaestapromo = new anywheresoftware.b4a.objects.collections.Map();
_inventariosdisponiblesparaestapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_promomap.Get((Object)("id"))));
 //BA.debugLineNum = 1073;BA.debugLine="If thisLog Then LogColor(\"InvDisponible: \" & inve";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759179011","InvDisponible: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Red);};
 //BA.debugLineNum = 1074;BA.debugLine="If thisLog Then LogColor(\"Inventario inicial ante";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759179012","Inventario inicial antes de FIJOS: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Gray);};
 //BA.debugLineNum = 1075;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"resultad";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ko"));
 //BA.debugLineNum = 1076;BA.debugLine="Private i As Int";
_i = 0;
 //BA.debugLineNum = 1077;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 = 1078;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 = 1079;BA.debugLine="For p = 0 To prodsFijos.Size - 1";
{
final int step9 = 1;
final int limit9 = (int) (_prodsfijos.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit9 ;_p = _p + step9 ) {
 //BA.debugLineNum = 1080;BA.debugLine="Private t As String = prodsFijos.Get(p) 'Obtenem";
_t = BA.ObjectToString(_prodsfijos.Get(_p));
 //BA.debugLineNum = 1081;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 = 1082;BA.debugLine="If thisLog Then Log($\"T: ${t}, prod ${p2.Get(\"id";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759179020",("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 = 1083;BA.debugLine="If thisLog Then Log(\"inventariosDisponiblesParaE";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759179021","inventariosDisponiblesParaEstaPromo="+BA.ObjectToString(_inventariosdisponiblesparaestapromo),0);};
 //BA.debugLineNum = 1084;BA.debugLine="If inventariosDisponiblesParaEstaPromo.ContainsK";
if (_inventariosdisponiblesparaestapromo.ContainsKey((Object)(_t))) { 
 //BA.debugLineNum = 1085;BA.debugLine="i = inventariosDisponiblesParaEstaPromo.get(t)";
_i = (int)(BA.ObjectToNumber(_inventariosdisponiblesparaestapromo.Get((Object)(_t))));
 //BA.debugLineNum = 1086;BA.debugLine="If thisLog Then Log($\"Nuevo inventario de ${t}:";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759179024",("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 = 1087;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 = 1088;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ok"));
 }else {
 //BA.debugLineNum = 1090;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("No hay suficiente producto para la promocion."));
 //BA.debugLineNum = 1091;BA.debugLine="LogColor(\"Sin suficiente inventario fijo: \" & t";
anywheresoftware.b4a.keywords.Common.LogImpl("759179029","Sin suficiente inventario fijo: "+_t,anywheresoftware.b4a.keywords.Common.Colors.Blue);
 //BA.debugLineNum = 1092;BA.debugLine="Exit";
if (true) break;
 };
 //BA.debugLineNum = 1094;BA.debugLine="If i - p2.Get(\"piezas\") < 0 Then";
if (_i-(double)(BA.ObjectToNumber(_p2.Get((Object)("piezas"))))<0) { 
 //BA.debugLineNum = 1095;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("No hay suficiente producto para la promocion."));
 //BA.debugLineNum = 1096;BA.debugLine="Exit";
if (true) break;
 };
 }
};
 //BA.debugLineNum = 1099;BA.debugLine="If prodsFijos.Size = 0 Then inventariosDisponible";
if (_prodsfijos.getSize()==0) { 
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ok"));};
 //BA.debugLineNum = 1100;BA.debugLine="If thisLog Then LogColor(\"Inventario final depues";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759179038","Inventario final depues de FIJOS: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1101;BA.debugLine="Return inventariosDisponiblesParaEstaPromo";
if (true) return _inventariosdisponiblesparaestapromo;
 //BA.debugLineNum = 1102;BA.debugLine="End Sub";
return null;
}
public static String  _revisabd(anywheresoftware.b4a.BA _ba) throws Exception{
 //BA.debugLineNum = 189;BA.debugLine="Sub revisaBD 'ignore";
 //BA.debugLineNum = 193;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"))) { 
 //BA.debugLineNum = 194;BA.debugLine="File.Copy(File.DirAssets, \"kmt.db\", Starter.ruta";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirAssets(),"kmt.db",mostCurrent._starter._ruta /*String*/ ,"kmt.db");
 //BA.debugLineNum = 195;BA.debugLine="LogColor(\"copiamos kmt.db de \"&File.DirAssets &";
anywheresoftware.b4a.keywords.Common.LogImpl("756164358","copiamos kmt.db de "+anywheresoftware.b4a.keywords.Common.File.getDirAssets()+" a "+mostCurrent._starter._ruta /*String*/ ,anywheresoftware.b4a.keywords.Common.Colors.Green);
 };
 //BA.debugLineNum = 197;BA.debugLine="If Not(kmt.IsInitialized) Then kmt.Initialize(Sta";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_kmt.Initialize(mostCurrent._starter._ruta /*String*/ ,"kmt.db",anywheresoftware.b4a.keywords.Common.True);};
 //BA.debugLineNum = 198;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS RUTA";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS RUTA_GPS(FECHA INTEGER, LAT TEXT, LON TEXT)");
 //BA.debugLineNum = 200;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS bita";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)");
 //BA.debugLineNum = 201;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS HIST";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_AVANCE(HA_MARCA TEXT, HA_AVANCE TEXT, HA_OBJETIVO TEXT, HA_PORCENTAJE TEXT)");
 //BA.debugLineNum = 202;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS ABON";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS ABONOSP(NOTA TEXT, CLIENTE TEXT, SALDO_PENDIENTE TEXT)");
 //BA.debugLineNum = 203;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS CLIE";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CLIENTE_NUEVO(CN_ID_CLIENTE TEXT, CN_NOMBRE TEXT, CN_enviado text)");
 //BA.debugLineNum = 204;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS RUTA";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS RUTA_SUPLENCIA(RS_RUTA TEXT)");
 //BA.debugLineNum = 205;BA.debugLine="Try 'Si no existe la columna PC_ENVIO_OK la agreg";
try { //BA.debugLineNum = 206;BA.debugLine="kmt.ExecQuery(\"select count(PC_ENVIO_OK) from PE";
_kmt.ExecQuery("select count(PC_ENVIO_OK) from PEDIDO_CLIENTE");
 } 
       catch (Exception e15) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e15); //BA.debugLineNum = 208;BA.debugLine="Try";
try { //BA.debugLineNum = 209;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE PEDIDO_CLIENTE AD";
_kmt.ExecNonQuery("ALTER TABLE PEDIDO_CLIENTE ADD COLUMN PC_ENVIO_OK INTEGER");
 } 
       catch (Exception e18) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e18); //BA.debugLineNum = 211;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_ENVI";
anywheresoftware.b4a.keywords.Common.LogImpl("756164374","No pudimos agregar la columna PC_ENVIO_OK.",anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 212;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("756164375",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
 //BA.debugLineNum = 216;BA.debugLine="Try 'Si no existe la columna CAT_CL_DIAS_VISITA l";
try { //BA.debugLineNum = 217;BA.debugLine="kmt.ExecQuery(\"select count(CAT_CL_DIAS_VISITA)";
_kmt.ExecQuery("select count(CAT_CL_DIAS_VISITA) from kmt_info");
 } 
       catch (Exception e25) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e25); //BA.debugLineNum = 219;BA.debugLine="Try";
try { //BA.debugLineNum = 220;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE kmt_info ADD COLU";
_kmt.ExecNonQuery("ALTER TABLE kmt_info ADD COLUMN CAT_CL_DIAS_VISITA TEXT");
 } 
       catch (Exception e28) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e28); //BA.debugLineNum = 222;BA.debugLine="LogColor(\"No pudimos agregar la columna CAT_CL_";
anywheresoftware.b4a.keywords.Common.LogImpl("756164385","No pudimos agregar la columna CAT_CL_DIAS_VISITA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 223;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("756164386",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
 //BA.debugLineNum = 227;BA.debugLine="Try 'Si no existe la columna PC_ENVIO_OK la agreg";
try { //BA.debugLineNum = 228;BA.debugLine="kmt.ExecQuery(\"select count(PC_TIEMPO_TIENDA) fr";
_kmt.ExecQuery("select count(PC_TIEMPO_TIENDA) from PEDIDO_CLIENTE");
 } 
       catch (Exception e35) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e35); //BA.debugLineNum = 230;BA.debugLine="Try";
try { //BA.debugLineNum = 231;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE PEDIDO_CLIENTE AD";
_kmt.ExecNonQuery("ALTER TABLE PEDIDO_CLIENTE ADD COLUMN PC_TIEMPO_TIENDA FLOAT");
 } 
       catch (Exception e38) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e38); //BA.debugLineNum = 233;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_TIEM";
anywheresoftware.b4a.keywords.Common.LogImpl("756164396","No pudimos agregar la columna PC_TIEMPO_TIENDA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 234;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("756164397",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
 //BA.debugLineNum = 237;BA.debugLine="Try 'Si no existe la columna PC_FACTURA la agrega";
try { //BA.debugLineNum = 238;BA.debugLine="kmt.ExecQuery(\"select count(PC_FACTURA) from PED";
_kmt.ExecQuery("select count(PC_FACTURA) from PEDIDO_CLIENTE");
 } 
       catch (Exception e45) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e45); //BA.debugLineNum = 240;BA.debugLine="Try";
try { //BA.debugLineNum = 241;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE PEDIDO_CLIENTE AD";
_kmt.ExecNonQuery("ALTER TABLE PEDIDO_CLIENTE ADD COLUMN PC_FACTURA INTEGER");
 } 
       catch (Exception e48) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e48); //BA.debugLineNum = 243;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_FACT";
anywheresoftware.b4a.keywords.Common.LogImpl("756164406","No pudimos agregar la columna PC_FACTURA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 244;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("756164407",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
 //BA.debugLineNum = 247;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS bita";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)");
 //BA.debugLineNum = 249;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS PEDI";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS PEDIDO_INICIO_FINAL(PIF_CLIENTE TEXT, PIF_HORA_INICIO LONG, PIF_HORA_FINAL LONG)");
 //BA.debugLineNum = 252;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 = 253;BA.debugLine="errorLog.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS";
_errorlog.ExecNonQuery("CREATE TABLE IF NOT EXISTS errores(fecha INTEGER, error TEXT)");
 //BA.debugLineNum = 254;BA.debugLine="End Sub";
return "";
}
public static String  _revisaflp(anywheresoftware.b4a.BA _ba) throws Exception{
boolean _todobienflp = false;
 //BA.debugLineNum = 397;BA.debugLine="Sub revisaFLP 'ignore";
 //BA.debugLineNum = 398;BA.debugLine="LogColor(\"**** **** Revisamos FLP **** ****\", Col";
anywheresoftware.b4a.keywords.Common.LogImpl("756819713","**** **** Revisamos FLP **** ****",anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (78),(int) (0),(int) (227)));
 //BA.debugLineNum = 399;BA.debugLine="Private todoBienFLP As Boolean = True";
_todobienflp = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 400;BA.debugLine="Try";
try { //BA.debugLineNum = 401;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 = 402;BA.debugLine="log2DB(\"revisaFLP: No esta inicializado ... 'Re";
_log2db(_ba,"revisaFLP: No esta inicializado ... 'Reinicializando FLP'");
 //BA.debugLineNum = 403;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 = 404;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e10) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e10); //BA.debugLineNum = 407;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsInitialized) ---";
anywheresoftware.b4a.keywords.Common.LogImpl("756819722","If Not(Tracker.FLP.IsInitialized) --- "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 409;BA.debugLine="Try";
try { //BA.debugLineNum = 410;BA.debugLine="If Tracker.FLP.IsInitialized Then";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsInitialized()) { 
 //BA.debugLineNum = 411;BA.debugLine="Try";
try { //BA.debugLineNum = 412;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 = 413;BA.debugLine="log2DB(\"revisaFLP: No esta conectado ... 'Rec";
_log2db(_ba,"revisaFLP: No esta conectado ... 'Reconectando FLP'");
 //BA.debugLineNum = 415;BA.debugLine="CallSubDelayed(Tracker,\"StartFLP\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()),"StartFLP");
 //BA.debugLineNum = 416;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e21) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e21); //BA.debugLineNum = 419;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsConnected) -->";
anywheresoftware.b4a.keywords.Common.LogImpl("756819734","If Not(Tracker.FLP.IsConnected) --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 421;BA.debugLine="Try";
try { //BA.debugLineNum = 422;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 = 425;BA.debugLine="log2DB(\"revisaFLP: 'No se esta actualizando,";
_log2db(_ba,"revisaFLP: 'No se esta actualizando, lo reiniciamos ...'");
 //BA.debugLineNum = 426;BA.debugLine="StartService(Tracker)";
anywheresoftware.b4a.keywords.Common.StartService((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()));
 //BA.debugLineNum = 427;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e30) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e30); //BA.debugLineNum = 430;BA.debugLine="LogColor(\"If FLP.IsConnectctd and FLP.getLKL.I";
anywheresoftware.b4a.keywords.Common.LogImpl("756819745","If FLP.IsConnectctd and FLP.getLKL.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
 //BA.debugLineNum = 433;BA.debugLine="If todoBienFLP Then LogColor(\" +++ +++ Sin error";
if (_todobienflp) { 
anywheresoftware.b4a.keywords.Common.LogImpl("756819748"," +++ +++ Sin errores en FLP",anywheresoftware.b4a.keywords.Common.Colors.Green);};
 } 
       catch (Exception e35) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e35); //BA.debugLineNum = 435;BA.debugLine="LogColor(\"If Tracker.FLP.IsInitialized --> \"&Las";
anywheresoftware.b4a.keywords.Common.LogImpl("756819750","If Tracker.FLP.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 438;BA.debugLine="End Sub";
return "";
}
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 = 1278;BA.debugLine="Sub revisaMaxPromosProdsFijosPorInventario(pm As M";
 //BA.debugLineNum = 1279;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1280;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1281;BA.debugLine="Private t As List";
_t = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 1282;BA.debugLine="t.Initialize";
_t.Initialize();
 //BA.debugLineNum = 1283;BA.debugLine="t.Add(traeMaxPromos(pm)) ' Agregamos a la lista l";
_t.Add((Object)(_traemaxpromos(_ba,_pm)));
 //BA.debugLineNum = 1284;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
 //BA.debugLineNum = 1285;BA.debugLine="If thisLog Then LogColor($\"pm=${pm}\"$, Colors.Blu";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759572231",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1286;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 = 1287;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759572233",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
 //BA.debugLineNum = 1288;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 = 1289;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 = 1290;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 = 1291;BA.debugLine="If thisLog Then Log($\"id=${idProdsFijos.Get(p)},";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759572237",("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 = 1292;BA.debugLine="If thisLog Then Log($\"${(invDispParaPromo.Get(id";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759572238",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsfijos.Get(_p))))/(double)(double)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p))))))+""),0);};
 //BA.debugLineNum = 1293;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 = 1294;BA.debugLine="If thisLog Then Log(x(0))";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759572240",_x[(int) (0)],0);};
 //BA.debugLineNum = 1295;BA.debugLine="t.Add(x(0).As(Int)) 'Solo guardamos la parte del";
_t.Add((Object)(((int)(Double.parseDouble(_x[(int) (0)])))));
 }
};
 //BA.debugLineNum = 1297;BA.debugLine="t.Sort(True) 'Ordenamos la lista para que en el l";
_t.Sort(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1298;BA.debugLine="If thisLog Then LogColor($\"prodsFijos=${idProdsFi";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759572244",("prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsfijos.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1299;BA.debugLine="If thisLog Then LogColor($\"prodsFijosPiezasReq=${";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759572245",("prodsFijosPiezasReq="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsfijospiezas.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1300;BA.debugLine="If thisLog Then LogColor($\"invFijoXpromo=${invFij";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759572246",("invFijoXpromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invfijoxpromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1302;BA.debugLine="Return t.Get(0) 'Regresamos el resultado mas pequ";
if (true) return (int)(BA.ObjectToNumber(_t.Get((int) (0))));
 //BA.debugLineNum = 1303;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 = 1235;BA.debugLine="Sub revisaMaxPromosProdsFijosPorInventario2(pm As";
 //BA.debugLineNum = 1236;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1237;BA.debugLine="If thisLog Then Log($\"pm=${pm}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506690",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),0);};
 //BA.debugLineNum = 1239;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 = 1240;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506693",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
 //BA.debugLineNum = 1241;BA.debugLine="Private maxPromos As String = traeMaxPromos(pm)";
_maxpromos = BA.NumberToString(_traemaxpromos(_ba,_pm));
 //BA.debugLineNum = 1242;BA.debugLine="Private maxPromosFijosXinv As Int = 1";
_maxpromosfijosxinv = (int) (1);
 //BA.debugLineNum = 1243;BA.debugLine="Private fpf2, pdp2 As Int";
_fpf2 = 0;
_pdp2 = 0;
 //BA.debugLineNum = 1244;BA.debugLine="Private salir As Boolean = False";
_salir = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1245;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 = 1246;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 = 1247;BA.debugLine="If thisLog Then Log($\"maxPromos=${maxPromos}, pro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506700",("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 = 1248;BA.debugLine="If thisLog Then LogColor($\"InvFijo disponible=${i";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506701",("InvFijo disponible="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1249;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1250;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
 //BA.debugLineNum = 1251;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 = 1252;BA.debugLine="invFijoXpromo.Put(pf.Get(p), pfp.Get(p))";
_invfijoxpromo.Put(_pf.Get(_p),_pfp.Get(_p));
 }
};
 //BA.debugLineNum = 1254;BA.debugLine="If thisLog Then LogColor(\"Inv req. de prods fijos";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506707","Inv req. de prods fijos x promo"+BA.ObjectToString(_invfijoxpromo),anywheresoftware.b4a.keywords.Common.Colors.Green);};
 //BA.debugLineNum = 1255;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 = 1256;BA.debugLine="If thisLog Then LogColor(\"Prods para promo \" & (";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506709","Prods para promo "+BA.NumberToString((_i+1)),anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
 //BA.debugLineNum = 1257;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 = 1258;BA.debugLine="Private q2 As String = pf.Get(q)";
_q2 = BA.ObjectToString(_pf.Get(_q));
 //BA.debugLineNum = 1259;BA.debugLine="If thisLog Then Log(\"q=\"&q2)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506712","q="+_q2,0);};
 //BA.debugLineNum = 1261;BA.debugLine="fpf2 = pfp.Get(q) * i 'Multiplicamos las piezas";
_fpf2 = (int) ((double)(BA.ObjectToNumber(_pfp.Get(_q)))*_i);
 //BA.debugLineNum = 1262;BA.debugLine="pdp2 = invDispParaPromo.Get(q2)";
_pdp2 = (int)(BA.ObjectToNumber(_invdispparapromo.Get((Object)(_q2))));
 //BA.debugLineNum = 1263;BA.debugLine="If thisLog Then Log($\"pf=${q2}, Actual=${(i)},";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506716",("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 = 1264;BA.debugLine="If pdp2 - fpf2 < 0 Then 'Si el inventario es ne";
if (_pdp2-_fpf2<0) { 
 //BA.debugLineNum = 1265;BA.debugLine="salir=True";
_salir = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1266;BA.debugLine="Exit";
if (true) break;
 };
 }
};
 //BA.debugLineNum = 1269;BA.debugLine="If salir Then Exit";
if (_salir) { 
if (true) break;};
 //BA.debugLineNum = 1270;BA.debugLine="maxPromosFijosXinv = i";
_maxpromosfijosxinv = _i;
 }
};
 //BA.debugLineNum = 1272;BA.debugLine="If thisLog Then LogColor(\"InvFijo requerido x pro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759506725","InvFijo requerido x promo="+BA.ObjectToString(_invfijoxpromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1273;BA.debugLine="LogColor(\"Maximo de promociones de prodsFijos POR";
anywheresoftware.b4a.keywords.Common.LogImpl("759506726","Maximo de promociones de prodsFijos POR inventario = "+BA.NumberToString(_maxpromosfijosxinv),anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 1274;BA.debugLine="Return maxPromosFijosXinv";
if (true) return _maxpromosfijosxinv;
 //BA.debugLineNum = 1275;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 = 1310;BA.debugLine="Sub revisaMaxPromosProdsVariablesPorInventario(pm";
 //BA.debugLineNum = 1311;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1312;BA.debugLine="If thisLog Then Log(\"============================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637762","======================================================",0);};
 //BA.debugLineNum = 1313;BA.debugLine="If thisLog Then Log(\"============================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637763","======================================================",0);};
 //BA.debugLineNum = 1314;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1315;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
 //BA.debugLineNum = 1316;BA.debugLine="Private totalProdsVariablesDisponibles As Int = 0";
_totalprodsvariablesdisponibles = (int) (0);
 //BA.debugLineNum = 1317;BA.debugLine="Private totalProdsVariables2Disponibles As Int =";
_totalprodsvariables2disponibles = (int) (0);
 //BA.debugLineNum = 1318;BA.debugLine="If thisLog Then LogColor($\"pm=${pm}\"$, Colors.Blu";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637768",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1319;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 = 1320;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637770",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
 //BA.debugLineNum = 1321;BA.debugLine="Private maxPromos As String = traeMaxPromos(pm)";
_maxpromos = BA.NumberToString(_traemaxpromos(_ba,_pm));
 //BA.debugLineNum = 1322;BA.debugLine="Private maxPromosXFijos As Int = revisaMaxPromosP";
_maxpromosxfijos = _revisamaxpromosprodsfijosporinventario(_ba,_pm);
 //BA.debugLineNum = 1323;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 = 1324;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 = 1325;BA.debugLine="Private prodsVariablesRequeridos As Int = pm.Get(";
_prodsvariablesrequeridos = (int)(BA.ObjectToNumber(_pm.Get((Object)("prodsVariablesRequeridos"))));
 //BA.debugLineNum = 1326;BA.debugLine="Private prodsVariables2Requeridos As Int = pm.Get";
_prodsvariables2requeridos = (int)(BA.ObjectToNumber(_pm.Get((Object)("prodsVariables2Requeridos"))));
 //BA.debugLineNum = 1327;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 = 1328;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 = 1329;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 = 1330;BA.debugLine="invFijoXpromo.Put(idProdsFijos.Get(p), prodsFijo";
_invfijoxpromo.Put(_idprodsfijos.Get(_p),_prodsfijospiezas.Get(_p));
 //BA.debugLineNum = 1331;BA.debugLine="Private idEsteProd As String = idProdsFijos.Get(";
_idesteprod = BA.ObjectToString(_idprodsfijos.Get(_p));
 //BA.debugLineNum = 1332;BA.debugLine="Private invEsteProd As Int = invDispParaPromo.Ge";
_investeprod = (int)(BA.ObjectToNumber(_invdispparapromo.Get((Object)(_idesteprod))));
 //BA.debugLineNum = 1333;BA.debugLine="Private pzasReqEsteProd As Int = prodsFijosPieza";
_pzasreqesteprod = (int)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p)));
 //BA.debugLineNum = 1334;BA.debugLine="If thisLog Then Log($\"id=${idEsteProd}, inv=${in";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637784",("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 = 1337;BA.debugLine="If thisLog Then LogColor($\"MaxPromos=${maxPromos}";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637787",("MaxPromos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromos))+", promosXFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromosxfijos))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1338;BA.debugLine="If thisLog Then LogColor($\"prodsFijos=${idProdsFi";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637788",("prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsfijos.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1339;BA.debugLine="If thisLog Then LogColor($\"prodsFijosPiezasReq=${";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637789",("prodsFijosPiezasReq="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsfijospiezas.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1340;BA.debugLine="If thisLog Then LogColor($\"prodsVariables=${idPro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637790",("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 = 1341;BA.debugLine="If thisLog Then LogColor($\"prodsVariables2=${idPr";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637791",("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 = 1342;BA.debugLine="If thisLog Then LogColor($\"invFijoXpromo=${invFij";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637792",("invFijoXpromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invfijoxpromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1343;BA.debugLine="If thisLog Then Log($\"Prods variables disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637793",("Prods variables disponibles = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariablesdisponibles))+""),0);};
 //BA.debugLineNum = 1344;BA.debugLine="If thisLog Then Log($\"Prods variables2 disponible";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637794",("Prods variables2 disponibles = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariables2disponibles))+""),0);};
 //BA.debugLineNum = 1345;BA.debugLine="Private maxPromosXVariables As Int = 0";
_maxpromosxvariables = (int) (0);
 //BA.debugLineNum = 1346;BA.debugLine="Private maxPromosXVariables2 As Int = 0";
_maxpromosxvariables2 = (int) (0);
 //BA.debugLineNum = 1347;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 = 1348;BA.debugLine="If thisLog Then Log(\"===========================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637798","=====================================================",0);};
 //BA.debugLineNum = 1349;BA.debugLine="If thisLog Then Log(\"===========================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637799","=====================================================",0);};
 //BA.debugLineNum = 1350;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 = 1351;BA.debugLine="If thisLog Then Log($\"FIJO - ${idProdsFijos.Get";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637801",("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 = 1352;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 = 1354;BA.debugLine="If thisLog Then LogColor(\"Inv disponible despues";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637804","Inv disponible despues de restar fijos = "+BA.ObjectToString(_invdispparapromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
 //BA.debugLineNum = 1356;BA.debugLine="totalProdsVariablesDisponibles = 0";
_totalprodsvariablesdisponibles = (int) (0);
 //BA.debugLineNum = 1357;BA.debugLine="totalProdsVariables2Disponibles = 0";
_totalprodsvariables2disponibles = (int) (0);
 //BA.debugLineNum = 1358;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 = 1359;BA.debugLine="If invDispParaPromo.ContainsKey(idProdsVariable";
if (_invdispparapromo.ContainsKey(_idprodsvariables.Get(_i))) { 
 //BA.debugLineNum = 1360;BA.debugLine="totalProdsVariablesDisponibles = totalProdsVar";
_totalprodsvariablesdisponibles = (int) (_totalprodsvariablesdisponibles+(double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsvariables.Get(_i)))));
 };
 }
};
 //BA.debugLineNum = 1363;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 = 1364;BA.debugLine="If invDispParaPromo.ContainsKey(idProdsVariable";
if (_invdispparapromo.ContainsKey(_idprodsvariables2.Get(_i))) { 
 //BA.debugLineNum = 1365;BA.debugLine="totalProdsVariables2Disponibles = totalProdsVa";
_totalprodsvariables2disponibles = (int) (_totalprodsvariables2disponibles+(double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsvariables2.Get(_i)))));
 };
 }
};
 //BA.debugLineNum = 1369;BA.debugLine="If thisLog Then Log($\"Var disponibles -  var req";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637819",("Var disponibles -  var requeridos : "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariablesdisponibles))+" - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsvariablesrequeridos*_x))+""),0);};
 //BA.debugLineNum = 1370;BA.debugLine="totalProdsVariablesDisponibles = totalProdsVaria";
_totalprodsvariablesdisponibles = (int) (_totalprodsvariablesdisponibles-(_prodsvariablesrequeridos*_x));
 //BA.debugLineNum = 1371;BA.debugLine="totalProdsVariables2Disponibles = totalProdsVari";
_totalprodsvariables2disponibles = (int) (_totalprodsvariables2disponibles-(_prodsvariables2requeridos*_x));
 //BA.debugLineNum = 1372;BA.debugLine="If thisLog Then Log(\"prodsVariables disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637822","prodsVariables disponibles despues de promo = "+BA.NumberToString(_totalprodsvariablesdisponibles),0);};
 //BA.debugLineNum = 1373;BA.debugLine="If thisLog Then Log(\"prodsVariables2 disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637823","prodsVariables2 disponibles despues de promo = "+BA.NumberToString(_totalprodsvariables2disponibles),0);};
 //BA.debugLineNum = 1374;BA.debugLine="If totalProdsVariablesDisponibles < 0 Then Exit";
if (_totalprodsvariablesdisponibles<0) { 
if (true) break;};
 //BA.debugLineNum = 1375;BA.debugLine="If totalProdsVariables2Disponibles < 0 Then Exit";
if (_totalprodsvariables2disponibles<0) { 
if (true) break;};
 //BA.debugLineNum = 1376;BA.debugLine="maxPromosXVariables = x";
_maxpromosxvariables = _x;
 }
};
 //BA.debugLineNum = 1379;BA.debugLine="If thisLog Then LogColor(\"Max promos de prodsVari";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759637829","Max promos de prodsVariables POR inventario = "+BA.NumberToString(_maxpromosxvariables),anywheresoftware.b4a.keywords.Common.Colors.Red);};
 //BA.debugLineNum = 1380;BA.debugLine="Return maxPromosXVariables";
if (true) return _maxpromosxvariables;
 //BA.debugLineNum = 1381;BA.debugLine="End Sub";
return 0;
}
public static String  _revisauug(anywheresoftware.b4a.BA _ba) throws Exception{
int _daa = 0;
 //BA.debugLineNum = 379;BA.debugLine="Sub revisaUUG 'ignore";
 //BA.debugLineNum = 380;BA.debugLine="Try";
try { //BA.debugLineNum = 382;BA.debugLine="If Tracker.FLP.GetLastKnownLocation.IsInitialize";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().IsInitialized()) { 
 //BA.debugLineNum = 383;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 = 384;BA.debugLine="If Starter.Logger Then LogColor($\"**** UUC \"${f";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("756754181",("**** 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 = 385;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 = 386;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 = 387;BA.debugLine="If Starter.Logger Then Log(\"++++ Distancia a a";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("756754184","++++ Distancia a anterior="+BA.NumberToString(_daa)+"|"+"Precision="+BA.NumberToString(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()),0);};
 };
 //BA.debugLineNum = 389;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 = 392;BA.debugLine="LogColor(\"If Tracker.FLP.GetLastKnownLocation.Is";
anywheresoftware.b4a.keywords.Common.LogImpl("756754189","If Tracker.FLP.GetLastKnownLocation.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 394;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 = 692;BA.debugLine="Sub totalPedido As String";
 //BA.debugLineNum = 693;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)))+"'"))));
 //BA.debugLineNum = 694;BA.debugLine="Private pTotal As String = \"0\"";
_ptotal = "0";
 //BA.debugLineNum = 695;BA.debugLine="If cT.RowCount > 0 Then";
if (_ct.getRowCount()>0) { 
 //BA.debugLineNum = 696;BA.debugLine="cT.Position = 0";
_ct.setPosition((int) (0));
 //BA.debugLineNum = 698;BA.debugLine="Private tempT As String = cT.GetLong(\"total\")";
_tempt = BA.NumberToString(_ct.GetLong("total"));
 //BA.debugLineNum = 699;BA.debugLine="If tempT <> \"null\" And tempT <> Null Then";
if ((_tempt).equals("null") == false && _tempt!= null) { 
 //BA.debugLineNum = 701;BA.debugLine="pTotal = tempT";
_ptotal = _tempt;
 };
 };
 //BA.debugLineNum = 705;BA.debugLine="cT.Close";
_ct.Close();
 //BA.debugLineNum = 706;BA.debugLine="Return pTotal";
if (true) return _ptotal;
 //BA.debugLineNum = 707;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 = 665;BA.debugLine="Sub traeAlmacen As String 'ignore";
 //BA.debugLineNum = 666;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 667;BA.debugLine="Private a As String";
_a = "";
 //BA.debugLineNum = 668;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select  ID_ALMACEN from CAT_ALMACEN")));
 //BA.debugLineNum = 669;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 670;BA.debugLine="a = C.GetString(\"ID_ALMACEN\")";
_a = _c.GetString("ID_ALMACEN");
 //BA.debugLineNum = 671;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 672;BA.debugLine="Return a";
if (true) return _a;
 //BA.debugLineNum = 673;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 = 750;BA.debugLine="Sub traeCliente As String 'ignore";
 //BA.debugLineNum = 751;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 752;BA.debugLine="Private cl As String";
_cl = "";
 //BA.debugLineNum = 753;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select CUENTA from cuentaa")));
 //BA.debugLineNum = 754;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 755;BA.debugLine="cl = c.GetString(\"CUENTA\")";
_cl = _c.GetString("CUENTA");
 //BA.debugLineNum = 756;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 757;BA.debugLine="Return cl";
if (true) return _cl;
 //BA.debugLineNum = 758;BA.debugLine="End Sub";
return "";
}
public static String  _traediaentrega(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _diaentrega = "";
String _diacalculado = "";
long _fechahoy = 0L;
long _fechacalculada = 0L;
int _diasemana = 0;
 //BA.debugLineNum = 1577;BA.debugLine="Sub traeDiaEntrega(id As String) As String";
 //BA.debugLineNum = 1578;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1579;BA.debugLine="Dim DiaEntrega As String = \"0\"";
_diaentrega = "0";
 //BA.debugLineNum = 1580;BA.debugLine="Dim DiaCalculado As String = \"\"";
_diacalculado = "";
 //BA.debugLineNum = 1582;BA.debugLine="DateTime.DateFormat = \"dd/MM/yyyy\" ' Establecer e";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("dd/MM/yyyy");
 //BA.debugLineNum = 1584;BA.debugLine="Dim FechaHoy As Long = DateTime.Now";
_fechahoy = anywheresoftware.b4a.keywords.Common.DateTime.getNow();
 //BA.debugLineNum = 1586;BA.debugLine="Dim FechaCalculada As Long";
_fechacalculada = 0L;
 //BA.debugLineNum = 1587;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("SELECT CAT_DP_ENTREGA FROM "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" WHERE CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 1588;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1589;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1590;BA.debugLine="DiaEntrega = c.GetString(\"CAT_DP_ENTREGA\")";
_diaentrega = _c.GetString("CAT_DP_ENTREGA");
 };
 //BA.debugLineNum = 1592;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1593;BA.debugLine="Select DiaEntrega";
switch (BA.switchObjectToInt(_diaentrega,"0","1")) {
case 0: {
 //BA.debugLineNum = 1595;BA.debugLine="FechaCalculada = DateTime.Add(FechaHoy, 0, 0, 1";
_fechacalculada = anywheresoftware.b4a.keywords.Common.DateTime.Add(_fechahoy,(int) (0),(int) (0),(int) (1));
 break; }
case 1: {
 //BA.debugLineNum = 1597;BA.debugLine="FechaCalculada = DateTime.Add(FechaHoy, 0, 0, 2";
_fechacalculada = anywheresoftware.b4a.keywords.Common.DateTime.Add(_fechahoy,(int) (0),(int) (0),(int) (2));
 break; }
}
;
 //BA.debugLineNum = 1600;BA.debugLine="Dim DiaSemana As Int = DateTime.GetDayOfWeek(Fech";
_diasemana = anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfWeek(_fechacalculada);
 //BA.debugLineNum = 1601;BA.debugLine="If DiaSemana = 1 Then ' 1 representa domingo en B";
if (_diasemana==1) { 
 //BA.debugLineNum = 1602;BA.debugLine="FechaCalculada = DateTime.Add(FechaCalculada, 0,";
_fechacalculada = anywheresoftware.b4a.keywords.Common.DateTime.Add(_fechacalculada,(int) (0),(int) (0),(int) (1));
 };
 //BA.debugLineNum = 1605;BA.debugLine="DateTime.DateFormat = \"dd/MM/yyyy\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("dd/MM/yyyy");
 //BA.debugLineNum = 1606;BA.debugLine="DiaCalculado = DateTime.Date(FechaCalculada)";
_diacalculado = anywheresoftware.b4a.keywords.Common.DateTime.Date(_fechacalculada);
 //BA.debugLineNum = 1607;BA.debugLine="Return DiaCalculado";
if (true) return _diacalculado;
 //BA.debugLineNum = 1608;BA.debugLine="End Sub";
return "";
}
public static String  _traefecha(anywheresoftware.b4a.BA _ba) throws Exception{
String _sdate = "";
String _stime = "";
 //BA.debugLineNum = 760;BA.debugLine="Sub traeFecha As String 'ignore";
 //BA.debugLineNum = 761;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MM/dd/yyyy");
 //BA.debugLineNum = 762;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 = 763;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 = 764;BA.debugLine="Return sDate & sTime";
if (true) return _sdate+_stime;
 //BA.debugLineNum = 765;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 = 1552;BA.debugLine="Sub traeinventario(id As String) As String";
 //BA.debugLineNum = 1553;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1554;BA.debugLine="Dim inventario As String = \"0\"";
_inventario = "0";
 //BA.debugLineNum = 1555;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_GP_ALMACEN from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" where CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
 //BA.debugLineNum = 1557;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1558;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1559;BA.debugLine="inventario = c.GetString(\"CAT_GP_ALMACEN\")";
_inventario = _c.GetString("CAT_GP_ALMACEN");
 };
 //BA.debugLineNum = 1561;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1562;BA.debugLine="Return inventario";
if (true) return _inventario;
 //BA.debugLineNum = 1563;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 = 1161;BA.debugLine="Sub traeMaxPromos(pm As Map) As Int";
 //BA.debugLineNum = 1162;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1163;BA.debugLine="Private maxPromos As List";
_maxpromos = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 1164;BA.debugLine="Private vendidas As Int = 0";
_vendidas = (int) (0);
 //BA.debugLineNum = 1165;BA.debugLine="maxPromos.Initialize";
_maxpromos.Initialize();
 //BA.debugLineNum = 1167;BA.debugLine="If thisLog Then Log(pm)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("759310086",BA.ObjectToString(_pm),0);};
 //BA.debugLineNum = 1168;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 = 1169;BA.debugLine="maxPromos.Add(pm.Get(\"maxPromos\")) 'Agregamos max";
_maxpromos.Add(_pm.Get((Object)("maxPromos")));
 //BA.debugLineNum = 1170;BA.debugLine="maxPromos.Add(pm.Get(\"maxXcliente\")) 'Agregamos m";
_maxpromos.Add(_pm.Get((Object)("maxXcliente")));
 //BA.debugLineNum = 1171;BA.debugLine="maxPromos.Sort(True)";
_maxpromos.Sort(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1174;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 /*medicomed.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 = ? ",new String[]{(BA.ObjectToString(_pm.Get((Object)("id")))).trim(),_traecliente(_ba).trim()})));
 //BA.debugLineNum = 1175;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1176;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1177;BA.debugLine="vendidas = c.GetInt(\"vendidas\")";
_vendidas = _c.GetInt("vendidas");
 };
 //BA.debugLineNum = 1184;BA.debugLine="Return maxPromos.Get(0) - vendidas 'Regresamos el";
if (true) return (int) ((double)(BA.ObjectToNumber(_maxpromos.Get((int) (0))))-_vendidas);
 //BA.debugLineNum = 1185;BA.debugLine="End Sub";
return 0;
}
public static String  _traeminimo(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _minimaventa = "";
 //BA.debugLineNum = 1565;BA.debugLine="Sub traeMinimo(id As String) As String";
 //BA.debugLineNum = 1566;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1567;BA.debugLine="Dim minimaVenta As String = \"1\"";
_minimaventa = "1";
 //BA.debugLineNum = 1574;BA.debugLine="Return minimaVenta";
if (true) return _minimaventa;
 //BA.debugLineNum = 1575;BA.debugLine="End Sub";
return "";
}
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 = 1047;BA.debugLine="Sub traemosInventarioDisponibleParaPromo(promo As";
 //BA.debugLineNum = 1048;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1049;BA.debugLine="Log(\"ESTAMOS VIENDO INVENTARIO\")";
anywheresoftware.b4a.keywords.Common.LogImpl("759113474","ESTAMOS VIENDO INVENTARIO",0);
 //BA.debugLineNum = 1050;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 /*medicomed.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)(mostCurrent._starter._tabla /*String*/ ))+" WHERE CAT_GP_ID IN (select CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = ?)"),new String[]{_promo})));
 //BA.debugLineNum = 1053;BA.debugLine="Private prods As Map";
_prods = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1054;BA.debugLine="prods.Initialize";
_prods.Initialize();
 //BA.debugLineNum = 1055;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1057;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step7 = 1;
final int limit7 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit7 ;_i = _i + step7 ) {
 //BA.debugLineNum = 1058;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 1059;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 = 1064;BA.debugLine="Return prods";
if (true) return _prods;
 //BA.debugLineNum = 1065;BA.debugLine="End Sub";
return null;
}
public static String  _traenombretienda(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
 //BA.debugLineNum = 737;BA.debugLine="Sub traeNombreTienda (cliente As String) As String";
 //BA.debugLineNum = 738;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 739;BA.debugLine="Private r As String";
_r = "";
 //BA.debugLineNum = 740;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_NOMBRE from kmt_info where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"'"))));
 //BA.debugLineNum = 741;BA.debugLine="r = \"0\"";
_r = "0";
 //BA.debugLineNum = 742;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 743;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 744;BA.debugLine="r = c.GetString(\"CAT_CL_NOMBRE\")";
_r = _c.GetString("CAT_CL_NOMBRE");
 };
 //BA.debugLineNum = 746;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 747;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 748;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 = 1399;BA.debugLine="Sub traeProdIdDeBD As Map 'ignore";
 //BA.debugLineNum = 1400;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1401;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1402;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 /*medicomed.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)(mostCurrent._starter._tabla /*String*/ ))+" where CAT_GP_NOMBRE In (Select PDESC from PROID)"))));
 //BA.debugLineNum = 1403;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1404;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1405;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 = 1407;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 = 1409;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1410;BA.debugLine="Return m";
if (true) return _m;
 //BA.debugLineNum = 1411;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 = 676;BA.debugLine="Sub traeProdNombre(id As String) As String";
 //BA.debugLineNum = 677;BA.debugLine="Private h As Cursor";
_h = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 678;BA.debugLine="Private n As String";
_n = "";
 //BA.debugLineNum = 679;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2(("select CAT_GP_NOMBRE from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" where CAT_GP_ID = ? "),new String[]{_id.trim()})));
 //BA.debugLineNum = 680;BA.debugLine="If h.RowCount > 0 Then";
if (_h.getRowCount()>0) { 
 //BA.debugLineNum = 681;BA.debugLine="h.Position = 0";
_h.setPosition((int) (0));
 //BA.debugLineNum = 682;BA.debugLine="n = h.GetString(\"CAT_GP_NOMBRE\")";
_n = _h.GetString("CAT_GP_NOMBRE");
 };
 //BA.debugLineNum = 685;BA.debugLine="h.Close";
_h.Close();
 //BA.debugLineNum = 686;BA.debugLine="If n = Null Or n=\"\" Then n = \"N/A\"";
if (_n== null || (_n).equals("")) { 
_n = "N/A";};
 //BA.debugLineNum = 688;BA.debugLine="Return n";
if (true) return _n;
 //BA.debugLineNum = 689;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 = 961;BA.debugLine="Sub traePromo(promo As String, cliente As String)";
 //BA.debugLineNum = 962;BA.debugLine="Private inicioContador As String = DateTime.Now";
_iniciocontador = BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 963;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select * from promos_comp where cat_pa_id = '"+_promo+"'")));
 //BA.debugLineNum = 964;BA.debugLine="Private siHistorico As String = 0";
_sihistorico = BA.NumberToString(0);
 //BA.debugLineNum = 965;BA.debugLine="Private promoMap As Map";
_promomap = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 966;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 = 967;BA.debugLine="promoMap.Initialize";
_promomap.Initialize();
 //BA.debugLineNum = 968;BA.debugLine="prodsFijos.Initialize";
_prodsfijos.Initialize();
 //BA.debugLineNum = 969;BA.debugLine="prodsFijosPrecios.Initialize";
_prodsfijosprecios.Initialize();
 //BA.debugLineNum = 970;BA.debugLine="prodsFijosPiezas.Initialize";
_prodsfijospiezas.Initialize();
 //BA.debugLineNum = 971;BA.debugLine="prodsVariables.Initialize";
_prodsvariables.Initialize();
 //BA.debugLineNum = 972;BA.debugLine="prodsVariables2.Initialize";
_prodsvariables2.Initialize();
 //BA.debugLineNum = 973;BA.debugLine="prodsVariablesPrecios.Initialize";
_prodsvariablesprecios.Initialize();
 //BA.debugLineNum = 974;BA.debugLine="prodsVariablesPrecios2.Initialize";
_prodsvariablesprecios2.Initialize();
 //BA.debugLineNum = 975;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 976;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 = 977;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 /*medicomed.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 = 978;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 979;BA.debugLine="If c.GetString(\"hist\") > 0 Then siHistorico = 1";
if ((double)(Double.parseDouble(_c.GetString("hist")))>0) { 
_sihistorico = BA.NumberToString(1);};
 //BA.debugLineNum = 980;BA.debugLine="promoMap.Put(\"historico\", siHistorico)";
_promomap.Put((Object)("historico"),(Object)(_sihistorico));
 //BA.debugLineNum = 981;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select * from CAT_DETALLES_PAQ where CAT_DP_ID = '"+_promo+"'")));
 //BA.debugLineNum = 982;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 983;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 984;BA.debugLine="Private prods, tipos As Map";
_prods = new anywheresoftware.b4a.objects.collections.Map();
_tipos = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 985;BA.debugLine="prods.Initialize";
_prods.Initialize();
 //BA.debugLineNum = 986;BA.debugLine="tipos.Initialize";
_tipos.Initialize();
 //BA.debugLineNum = 987;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 = 988;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 989;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 = 990;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 = 991;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"0\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("0")) { 
 //BA.debugLineNum = 992;BA.debugLine="prodsFijos.Add(c.GetString(\"CAT_DP_IDPROD\"))";
_prodsfijos.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
 //BA.debugLineNum = 993;BA.debugLine="prodsFijosPrecios.Add(c.GetString(\"CAT_DP_PREC";
_prodsfijosprecios.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
 //BA.debugLineNum = 994;BA.debugLine="prodsFijosPiezas.Add(c.GetString(\"CAT_DP_PZAS\"";
_prodsfijospiezas.Add((Object)(_c.GetString("CAT_DP_PZAS")));
 };
 //BA.debugLineNum = 996;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"1\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("1")) { 
 //BA.debugLineNum = 997;BA.debugLine="prodsVariables.Add(c.GetString(\"CAT_DP_IDPROD\"";
_prodsvariables.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
 //BA.debugLineNum = 998;BA.debugLine="prodsVariablesPrecios.Add(c.GetString(\"CAT_DP_";
_prodsvariablesprecios.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
 };
 //BA.debugLineNum = 1000;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"2\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("2")) { 
 //BA.debugLineNum = 1002;BA.debugLine="prodsVariables2.Add(c.GetString(\"CAT_DP_IDPROD";
_prodsvariables2.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
 //BA.debugLineNum = 1003;BA.debugLine="prodsVariablesPrecios2.Add(c.GetString(\"CAT_DP";
_prodsvariablesprecios2.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
 };
 }
};
 //BA.debugLineNum = 1008;BA.debugLine="promoMap.Put(\"productos\", prods) 'Mapa con los p";
_promomap.Put((Object)("productos"),(Object)(_prods.getObject()));
 //BA.debugLineNum = 1009;BA.debugLine="promoMap.Put(\"tipos\", tipos) 'Mapa con los produ";
_promomap.Put((Object)("tipos"),(Object)(_tipos.getObject()));
 //BA.debugLineNum = 1010;BA.debugLine="promoMap.Put(\"prodsFijos\", prodsFijos) 'Lista de";
_promomap.Put((Object)("prodsFijos"),(Object)(_prodsfijos.getObject()));
 //BA.debugLineNum = 1011;BA.debugLine="promoMap.Put(\"prodsVariables\", prodsVariables) '";
_promomap.Put((Object)("prodsVariables"),(Object)(_prodsvariables.getObject()));
 //BA.debugLineNum = 1012;BA.debugLine="promoMap.Put(\"prodsVariables2\", prodsVariables2)";
_promomap.Put((Object)("prodsVariables2"),(Object)(_prodsvariables2.getObject()));
 //BA.debugLineNum = 1013;BA.debugLine="promoMap.Put(\"prodsFijosCant\", prodsFijos.Size)";
_promomap.Put((Object)("prodsFijosCant"),(Object)(_prodsfijos.getSize()));
 //BA.debugLineNum = 1014;BA.debugLine="promoMap.Put(\"prodsFijosPrecios\", prodsFijosPrec";
_promomap.Put((Object)("prodsFijosPrecios"),(Object)(_prodsfijosprecios.getObject()));
 //BA.debugLineNum = 1015;BA.debugLine="promoMap.Put(\"prodsFijosPiezas\", prodsFijosPieza";
_promomap.Put((Object)("prodsFijosPiezas"),(Object)(_prodsfijospiezas.getObject()));
 //BA.debugLineNum = 1016;BA.debugLine="promoMap.Put(\"prodsVariablesCant\", prodsVariable";
_promomap.Put((Object)("prodsVariablesCant"),(Object)(_prodsvariables.getSize()));
 //BA.debugLineNum = 1017;BA.debugLine="promoMap.Put(\"prodsVariables2Cant\", prodsVariabl";
_promomap.Put((Object)("prodsVariables2Cant"),(Object)(_prodsvariables2.getSize()));
 //BA.debugLineNum = 1018;BA.debugLine="promoMap.Put(\"prodsVariablesPrecios\", prodsVaria";
_promomap.Put((Object)("prodsVariablesPrecios"),(Object)(_prodsvariablesprecios.getObject()));
 //BA.debugLineNum = 1019;BA.debugLine="promoMap.Put(\"prodsVariablesPrecios2\", prodsVari";
_promomap.Put((Object)("prodsVariablesPrecios2"),(Object)(_prodsvariablesprecios2.getObject()));
 //BA.debugLineNum = 1020;BA.debugLine="promoMap.Put(\"resultado\", \"ok\")";
_promomap.Put((Object)("resultado"),(Object)("ok"));
 }else {
 //BA.debugLineNum = 1022;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 = 1024;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 /*medicomed.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 = 1025;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1026;BA.debugLine="Private pvr As String = 0";
_pvr = BA.NumberToString(0);
 //BA.debugLineNum = 1027;BA.debugLine="Private pvr2 As String = 0";
_pvr2 = BA.NumberToString(0);
 //BA.debugLineNum = 1028;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1029;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1030;BA.debugLine="pvr = c.GetString(\"CAT_GP_STS\")";
_pvr = _c.GetString("CAT_GP_STS");
 //BA.debugLineNum = 1031;BA.debugLine="pvr2 = c.GetString(\"CAT_GP_IMP1\")";
_pvr2 = _c.GetString("CAT_GP_IMP1");
 //BA.debugLineNum = 1032;BA.debugLine="If pvr = Null Or pvr = \"null\" Then pvr = 0";
if (_pvr== null || (_pvr).equals("null")) { 
_pvr = BA.NumberToString(0);};
 //BA.debugLineNum = 1033;BA.debugLine="If pvr2 = Null Or pvr2 = \"null\" Then pvr2 = 0";
if (_pvr2== null || (_pvr2).equals("null")) { 
_pvr2 = BA.NumberToString(0);};
 //BA.debugLineNum = 1034;BA.debugLine="promoMap.Put(\"prodsVariablesRequeridos\", pvr) 'C";
_promomap.Put((Object)("prodsVariablesRequeridos"),(Object)(_pvr));
 //BA.debugLineNum = 1035;BA.debugLine="promoMap.Put(\"prodsVariables2Requeridos\", pvr2)";
_promomap.Put((Object)("prodsVariables2Requeridos"),(Object)(_pvr2));
 //BA.debugLineNum = 1036;BA.debugLine="promoMap.put(\"descripcion\", c.GetString(\"CAT_GP_";
_promomap.Put((Object)("descripcion"),(Object)(_c.GetString("CAT_GP_NOMBRE")));
 };
 //BA.debugLineNum = 1038;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1043;BA.debugLine="Return promoMap";
if (true) return _promomap;
 //BA.debugLineNum = 1044;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 = 1188;BA.debugLine="Sub traePromosVendidas(promo As String, cliente As";
 //BA.debugLineNum = 1189;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1190;BA.debugLine="Private pv As Int = 0";
_pv = (int) (0);
 //BA.debugLineNum = 1191;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select PE_CA";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*medicomed.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))+"'"))));
 //BA.debugLineNum = 1192;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1193;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1194;BA.debugLine="pv = c.GetInt(\"PE_CANT\")";
_pv = _c.GetInt("PE_CANT");
 };
 //BA.debugLineNum = 1196;BA.debugLine="Return pv";
if (true) return _pv;
 //BA.debugLineNum = 1197;BA.debugLine="End Sub";
return 0;
}
public static String  _traeruta(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
 //BA.debugLineNum = 710;BA.debugLine="Sub traeRuta (cliente As String) As String 'ignore";
 //BA.debugLineNum = 711;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 712;BA.debugLine="Private r As String";
_r = "";
 //BA.debugLineNum = 713;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"'"))));
 //BA.debugLineNum = 714;BA.debugLine="r = \"0\"";
_r = "0";
 //BA.debugLineNum = 715;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 716;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 717;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 719;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 720;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 721;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 = 724;BA.debugLine="Sub traeRuta2 (cliente As String) As String 'ignor";
 //BA.debugLineNum = 725;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 726;BA.debugLine="Private r As String";
_r = "";
 //BA.debugLineNum = 727;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"' UNION ALL select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"'"))));
 //BA.debugLineNum = 728;BA.debugLine="r = \"0\"";
_r = "0";
 //BA.debugLineNum = 729;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 730;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 731;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 733;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 734;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 735;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 = 1624;BA.debugLine="Sub traeRutaBitacora As String 'ignore";
 //BA.debugLineNum = 1625;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 1626;BA.debugLine="Private r As String";
_r = "";
 //BA.debugLineNum = 1627;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 /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select CAT_CL_RUTA from kmt_info WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")));
 //BA.debugLineNum = 1628;BA.debugLine="r = \"0\"";
_r = "0";
 //BA.debugLineNum = 1629;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 1630;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 1631;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
 //BA.debugLineNum = 1633;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 1634;BA.debugLine="Return r";
if (true) return _r;
 //BA.debugLineNum = 1635;BA.debugLine="End Sub";
return "";
}
public static String  _traetablaprods(anywheresoftware.b4a.BA _ba,String _tipoventa) throws Exception{
String _tablaprods = "";
 //BA.debugLineNum = 1484;BA.debugLine="Sub traeTablaProds(tipoventa As String) As String";
 //BA.debugLineNum = 1485;BA.debugLine="Private tablaProds As String = \"cat_gunaprod2\"";
_tablaprods = "cat_gunaprod2";
 //BA.debugLineNum = 1486;BA.debugLine="If tipoventa = \"ABORDO\" Or tipoventa = \"PREVENTA\"";
if ((_tipoventa).equals("ABORDO") || (_tipoventa).equals("PREVENTA") || (_tipoventa).equals("RECARGA")) { 
_tablaprods = "cat_gunaprod";};
 //BA.debugLineNum = 1488;BA.debugLine="Return tablaProds";
if (true) return _tablaprods;
 //BA.debugLineNum = 1489;BA.debugLine="End Sub";
return "";
}
public static double  _traetotalcliente(anywheresoftware.b4a.BA _ba) throws Exception{
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
 //BA.debugLineNum = 882;BA.debugLine="Sub traeTotalCliente As Double";
 //BA.debugLineNum = 883;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
 //BA.debugLineNum = 884;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select  PE_COSTO_TOT from pedido where PE_CLIENTE <> 0 ")));
 //BA.debugLineNum = 885;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
 //BA.debugLineNum = 886;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
 //BA.debugLineNum = 888;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
 //BA.debugLineNum = 889;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
 //BA.debugLineNum = 892;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
 //BA.debugLineNum = 893;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
 //BA.debugLineNum = 894;BA.debugLine="End Sub";
return 0;
}
public static double  _traetotalclienteabordo(anywheresoftware.b4a.BA _ba) throws Exception{
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
 //BA.debugLineNum = 896;BA.debugLine="Sub traeTotalClienteabordo As Double";
 //BA.debugLineNum = 897;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
 //BA.debugLineNum = 898;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("Select  PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE = 0",new String[]{"ABORDO"})));
 //BA.debugLineNum = 899;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
 //BA.debugLineNum = 900;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
 //BA.debugLineNum = 902;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
 //BA.debugLineNum = 903;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
 //BA.debugLineNum = 906;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
 //BA.debugLineNum = 907;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
 //BA.debugLineNum = 908;BA.debugLine="End Sub";
return 0;
}
public static double  _traetotalclientepreventa(anywheresoftware.b4a.BA _ba) throws Exception{
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
 //BA.debugLineNum = 910;BA.debugLine="Sub traeTotalClientepreventa As Double";
 //BA.debugLineNum = 911;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
 //BA.debugLineNum = 912;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("Select  PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0",new String[]{"PREVENTA"})));
 //BA.debugLineNum = 913;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
 //BA.debugLineNum = 914;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
 //BA.debugLineNum = 916;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
 //BA.debugLineNum = 917;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
 //BA.debugLineNum = 920;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
 //BA.debugLineNum = 921;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
 //BA.debugLineNum = 922;BA.debugLine="End Sub";
return 0;
}
public static double  _traetotalclientepreventaparacredito(anywheresoftware.b4a.BA _ba,String _clientepedido) throws Exception{
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
 //BA.debugLineNum = 924;BA.debugLine="Sub traeTotalClientepreventaparacredito(clienteped";
 //BA.debugLineNum = 925;BA.debugLine="Private sumaTotal As Double = 0";
_sumatotal = 0;
 //BA.debugLineNum = 926;BA.debugLine="LogColor(clientepedido,Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("758916866",_clientepedido,anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 927;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("Select  PE_COSTO_TOT from pedido where PE_CLIENTE = ? and PE_IMPRESO IS NOT NULL",new String[]{_clientepedido})));
 //BA.debugLineNum = 928;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step4 = 1;
final int limit4 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
 //BA.debugLineNum = 929;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
 //BA.debugLineNum = 931;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
 //BA.debugLineNum = 932;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
 //BA.debugLineNum = 935;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
 //BA.debugLineNum = 936;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
 //BA.debugLineNum = 937;BA.debugLine="End Sub";
return 0;
}
public static double  _traetotalclienteventa(anywheresoftware.b4a.BA _ba) throws Exception{
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
 //BA.debugLineNum = 939;BA.debugLine="Sub traeTotalClienteventa As Double";
 //BA.debugLineNum = 940;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
 //BA.debugLineNum = 941;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("Select  PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0",new String[]{"PREVENTA_48"})));
 //BA.debugLineNum = 942;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
 //BA.debugLineNum = 943;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
 //BA.debugLineNum = 945;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
 //BA.debugLineNum = 946;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
 //BA.debugLineNum = 949;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
 //BA.debugLineNum = 950;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
 //BA.debugLineNum = 951;BA.debugLine="End Sub";
return 0;
}
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 = 1438;BA.debugLine="Sub traeTotalesClienteActual As Map";
 //BA.debugLineNum = 1439;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1440;BA.debugLine="m.Initialize";
_m.Initialize();
 //BA.debugLineNum = 1441;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 /*medicomed.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 = 1442;BA.debugLine="c_prodsX.Position=0";
_c_prodsx.setPosition((int) (0));
 //BA.debugLineNum = 1444;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 = 1445;BA.debugLine="Return m";
if (true) return _m;
 //BA.debugLineNum = 1446;BA.debugLine="End Sub";
return null;
}
public static String  _traeusuariodebd(anywheresoftware.b4a.BA _ba) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _u = "";
 //BA.debugLineNum = 768;BA.debugLine="Sub traeUsuarioDeBD As String 'ignore";
 //BA.debugLineNum = 769;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 770;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
 //BA.debugLineNum = 771;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
 //BA.debugLineNum = 772;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 = 773;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 774;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
 //BA.debugLineNum = 775;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 776;BA.debugLine="Return u";
if (true) return _u;
 //BA.debugLineNum = 777;BA.debugLine="End Sub";
return "";
}
}
