package keymon.lat.medicomed;


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 keymon.lat.medicomed.main _main = null;
public keymon.lat.medicomed.starter _starter = null;
public keymon.lat.medicomed.appupdater _appupdater = null;
public keymon.lat.medicomed.mapa_rutas _mapa_rutas = null;
public keymon.lat.medicomed.tracker _tracker = null;
public keymon.lat.medicomed.newinst2 _newinst2 = null;
public keymon.lat.medicomed.b4xpages _b4xpages = null;
public keymon.lat.medicomed.b4xcollections _b4xcollections = null;
public keymon.lat.medicomed.httputils2service _httputils2service = null;
public keymon.lat.medicomed.xuiviewsutils _xuiviewsutils = null;
public static String  _panelvisible(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _panel,int _top,int _left) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "panelvisible", false))
	 {return ((String) Debug.delegate(null, "panelvisible", new Object[] {_ba,_panel,_top,_left}));}
RDebugUtils.currentLine=12648448;
 //BA.debugLineNum = 12648448;BA.debugLine="Sub panelVisible(panel As Panel, top As Int, left";
RDebugUtils.currentLine=12648449;
 //BA.debugLineNum = 12648449;BA.debugLine="panel.BringToFront";
_panel.BringToFront();
RDebugUtils.currentLine=12648450;
 //BA.debugLineNum = 12648450;BA.debugLine="panel.Visible = True";
_panel.setVisible(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=12648451;
 //BA.debugLineNum = 12648451;BA.debugLine="panel.Top = top";
_panel.setTop(_top);
RDebugUtils.currentLine=12648452;
 //BA.debugLineNum = 12648452;BA.debugLine="panel.Left = left";
_panel.setLeft(_left);
RDebugUtils.currentLine=12648453;
 //BA.debugLineNum = 12648453;BA.debugLine="End Sub";
return "";
}
public static String  _agregacolumna(anywheresoftware.b4a.BA _ba,String _tabla,String _columna,String _tipo) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "agregacolumna", false))
	 {return ((String) Debug.delegate(null, "agregacolumna", new Object[] {_ba,_tabla,_columna,_tipo}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
RDebugUtils.currentLine=15269888;
 //BA.debugLineNum = 15269888;BA.debugLine="Sub agregaColumna(tabla As String, columna As Stri";
RDebugUtils.currentLine=15269889;
 //BA.debugLineNum = 15269889;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try {RDebugUtils.currentLine=15269890;
 //BA.debugLineNum = 15269890;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 /*keymon.lat.medicomed.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))+"'"))));
RDebugUtils.currentLine=15269891;
 //BA.debugLineNum = 15269891;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=15269892;
 //BA.debugLineNum = 15269892;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
RDebugUtils.currentLine=15269893;
 //BA.debugLineNum = 15269893;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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))+""));
RDebugUtils.currentLine=15269894;
 //BA.debugLineNum = 15269894;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("315269894",("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);
 };
RDebugUtils.currentLine=15269896;
 //BA.debugLineNum = 15269896;BA.debugLine="Log(1)";
anywheresoftware.b4a.keywords.Common.LogImpl("315269896",BA.NumberToString(1),0);
 } 
       catch (Exception e10) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e10);RDebugUtils.currentLine=15269898;
 //BA.debugLineNum = 15269898;BA.debugLine="Try";
try {RDebugUtils.currentLine=15269899;
 //BA.debugLineNum = 15269899;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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))+""));
RDebugUtils.currentLine=15269900;
 //BA.debugLineNum = 15269900;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("315269900",("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 e14) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e14);RDebugUtils.currentLine=15269902;
 //BA.debugLineNum = 15269902;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("315269902",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
RDebugUtils.currentLine=15269904;
 //BA.debugLineNum = 15269904;BA.debugLine="Log(2)";
anywheresoftware.b4a.keywords.Common.LogImpl("315269904",BA.NumberToString(2),0);
 };
RDebugUtils.currentLine=15269906;
 //BA.debugLineNum = 15269906;BA.debugLine="End Sub";
return "";
}
public static String  _revisabd(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "revisabd", false))
	 {return ((String) Debug.delegate(null, "revisabd", new Object[] {_ba}));}
RDebugUtils.currentLine=11468800;
 //BA.debugLineNum = 11468800;BA.debugLine="Sub revisaBD 'ignore";
RDebugUtils.currentLine=11468804;
 //BA.debugLineNum = 11468804;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"))) { 
RDebugUtils.currentLine=11468805;
 //BA.debugLineNum = 11468805;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");
RDebugUtils.currentLine=11468806;
 //BA.debugLineNum = 11468806;BA.debugLine="LogColor(\"copiamos kmt.db de \"&File.DirAssets &";
anywheresoftware.b4a.keywords.Common.LogImpl("311468806","copiamos kmt.db de "+anywheresoftware.b4a.keywords.Common.File.getDirAssets()+" a "+mostCurrent._starter._ruta /*String*/ ,anywheresoftware.b4a.keywords.Common.Colors.Green);
 };
RDebugUtils.currentLine=11468808;
 //BA.debugLineNum = 11468808;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);};
RDebugUtils.currentLine=11468809;
 //BA.debugLineNum = 11468809;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)");
RDebugUtils.currentLine=11468811;
 //BA.debugLineNum = 11468811;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS bita";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)");
RDebugUtils.currentLine=11468812;
 //BA.debugLineNum = 11468812;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)");
RDebugUtils.currentLine=11468813;
 //BA.debugLineNum = 11468813;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS HIST";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_FOTO_CLIENTE(CODIGO TEXT, ALMACEN TEXT, RUTA TEXT, NOM_FOTO TEXT)");
RDebugUtils.currentLine=11468815;
 //BA.debugLineNum = 11468815;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS CLIE";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CLIENTES_NUEVOS(CN_ID TEXT, CN_FECHA TEXT, CN_USER TEXT, CN_LAT TEXT, CN_LON TEXT, CN_NOMBRE TEXT, CN_DIRECCION TEXT, COLONIA TEXT, CP TEXT, CN_ALMACEN TEXT, CN_RUTA TEXT, CN_ENVIO TEXT)");
RDebugUtils.currentLine=11468817;
 //BA.debugLineNum = 11468817;BA.debugLine="Try 'Si no existe la columna CN_BANDERA la agrega";
try {RDebugUtils.currentLine=11468818;
 //BA.debugLineNum = 11468818;BA.debugLine="kmt.ExecQuery(\"select count(CN_BANDERA) from CLI";
_kmt.ExecQuery("select count(CN_BANDERA) from CLIENTES_NUEVOS");
 } 
       catch (Exception e14) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e14);RDebugUtils.currentLine=11468820;
 //BA.debugLineNum = 11468820;BA.debugLine="Try";
try {RDebugUtils.currentLine=11468821;
 //BA.debugLineNum = 11468821;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE CLIENTES_NUEVOS A";
_kmt.ExecNonQuery("ALTER TABLE CLIENTES_NUEVOS ADD COLUMN CN_BANDERA INTEGER");
 } 
       catch (Exception e17) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e17);RDebugUtils.currentLine=11468823;
 //BA.debugLineNum = 11468823;BA.debugLine="LogColor(\"No pudimos agregar la columna CN_BAND";
anywheresoftware.b4a.keywords.Common.LogImpl("311468823","No pudimos agregar la columna CN_BANDERA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=11468824;
 //BA.debugLineNum = 11468824;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("311468824",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=11468828;
 //BA.debugLineNum = 11468828;BA.debugLine="Try 'Si no existe la columna PC_ENVIO_OK la agreg";
try {RDebugUtils.currentLine=11468829;
 //BA.debugLineNum = 11468829;BA.debugLine="kmt.ExecQuery(\"select count(PC_ENVIO_OK) from PE";
_kmt.ExecQuery("select count(PC_ENVIO_OK) from PEDIDO_CLIENTE");
 } 
       catch (Exception e24) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e24);RDebugUtils.currentLine=11468831;
 //BA.debugLineNum = 11468831;BA.debugLine="Try";
try {RDebugUtils.currentLine=11468832;
 //BA.debugLineNum = 11468832;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE PEDIDO_CLIENTE AD";
_kmt.ExecNonQuery("ALTER TABLE PEDIDO_CLIENTE ADD COLUMN PC_ENVIO_OK INTEGER");
 } 
       catch (Exception e27) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e27);RDebugUtils.currentLine=11468834;
 //BA.debugLineNum = 11468834;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_ENVI";
anywheresoftware.b4a.keywords.Common.LogImpl("311468834","No pudimos agregar la columna PC_ENVIO_OK.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=11468835;
 //BA.debugLineNum = 11468835;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("311468835",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=11468838;
 //BA.debugLineNum = 11468838;BA.debugLine="Try 'Si no existe la columna PC_ENVIO_OK la agreg";
try {RDebugUtils.currentLine=11468839;
 //BA.debugLineNum = 11468839;BA.debugLine="kmt.ExecQuery(\"select count(PC_TIEMPO_TIENDA) fr";
_kmt.ExecQuery("select count(PC_TIEMPO_TIENDA) from PEDIDO_CLIENTE");
 } 
       catch (Exception e34) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e34);RDebugUtils.currentLine=11468841;
 //BA.debugLineNum = 11468841;BA.debugLine="Try";
try {RDebugUtils.currentLine=11468842;
 //BA.debugLineNum = 11468842;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE PEDIDO_CLIENTE AD";
_kmt.ExecNonQuery("ALTER TABLE PEDIDO_CLIENTE ADD COLUMN PC_TIEMPO_TIENDA FLOAT");
 } 
       catch (Exception e37) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e37);RDebugUtils.currentLine=11468844;
 //BA.debugLineNum = 11468844;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_TIEM";
anywheresoftware.b4a.keywords.Common.LogImpl("311468844","No pudimos agregar la columna PC_TIEMPO_TIENDA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=11468845;
 //BA.debugLineNum = 11468845;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("311468845",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=11468848;
 //BA.debugLineNum = 11468848;BA.debugLine="Try 'Si no existe la columna PC_FACTURA la agrega";
try {RDebugUtils.currentLine=11468849;
 //BA.debugLineNum = 11468849;BA.debugLine="kmt.ExecQuery(\"select count(PC_FACTURA) from PED";
_kmt.ExecQuery("select count(PC_FACTURA) from PEDIDO_CLIENTE");
 } 
       catch (Exception e44) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e44);RDebugUtils.currentLine=11468851;
 //BA.debugLineNum = 11468851;BA.debugLine="Try";
try {RDebugUtils.currentLine=11468852;
 //BA.debugLineNum = 11468852;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE PEDIDO_CLIENTE AD";
_kmt.ExecNonQuery("ALTER TABLE PEDIDO_CLIENTE ADD COLUMN PC_FACTURA INTEGER");
 } 
       catch (Exception e47) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e47);RDebugUtils.currentLine=11468854;
 //BA.debugLineNum = 11468854;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_FACT";
anywheresoftware.b4a.keywords.Common.LogImpl("311468854","No pudimos agregar la columna PC_FACTURA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=11468855;
 //BA.debugLineNum = 11468855;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("311468855",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=11468859;
 //BA.debugLineNum = 11468859;BA.debugLine="Try 'Si no existe la columna PC_ENVIO_OK la agreg";
try {RDebugUtils.currentLine=11468860;
 //BA.debugLineNum = 11468860;BA.debugLine="kmt.ExecQuery(\"select count(NV_NOMBRE) from NOVE";
_kmt.ExecQuery("select count(NV_NOMBRE) from NOVENTA");
 } 
       catch (Exception e54) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e54);RDebugUtils.currentLine=11468862;
 //BA.debugLineNum = 11468862;BA.debugLine="Try";
try {RDebugUtils.currentLine=11468863;
 //BA.debugLineNum = 11468863;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE NOVENTA ADD COLUM";
_kmt.ExecNonQuery("ALTER TABLE NOVENTA ADD COLUMN NV_NOMBRE TEXT");
 } 
       catch (Exception e57) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e57);RDebugUtils.currentLine=11468865;
 //BA.debugLineNum = 11468865;BA.debugLine="LogColor(\"No pudimos agregar la columna NV_NOMB";
anywheresoftware.b4a.keywords.Common.LogImpl("311468865","No pudimos agregar la columna NV_NOMBRE.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=11468866;
 //BA.debugLineNum = 11468866;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("311468866",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=11468870;
 //BA.debugLineNum = 11468870;BA.debugLine="Try 'Si no existe la columna PC_ENVIO_OK la agreg";
try {RDebugUtils.currentLine=11468871;
 //BA.debugLineNum = 11468871;BA.debugLine="kmt.ExecQuery(\"select count(NV_DIRECCION) from N";
_kmt.ExecQuery("select count(NV_DIRECCION) from NOVENTA");
 } 
       catch (Exception e64) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e64);RDebugUtils.currentLine=11468873;
 //BA.debugLineNum = 11468873;BA.debugLine="Try";
try {RDebugUtils.currentLine=11468874;
 //BA.debugLineNum = 11468874;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE NOVENTA ADD COLUM";
_kmt.ExecNonQuery("ALTER TABLE NOVENTA ADD COLUMN NV_DIRECCION TEXT");
 } 
       catch (Exception e67) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e67);RDebugUtils.currentLine=11468876;
 //BA.debugLineNum = 11468876;BA.debugLine="LogColor(\"No pudimos agregar la columna NV_NOMB";
anywheresoftware.b4a.keywords.Common.LogImpl("311468876","No pudimos agregar la columna NV_NOMBRE.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=11468877;
 //BA.debugLineNum = 11468877;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("311468877",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=11468881;
 //BA.debugLineNum = 11468881;BA.debugLine="Try 'Si no existe la columna NV_ENVIO la agregamo";
try {RDebugUtils.currentLine=11468882;
 //BA.debugLineNum = 11468882;BA.debugLine="kmt.ExecQuery(\"select count(NV_ENVIO) from NOVEN";
_kmt.ExecQuery("select count(NV_ENVIO) from NOVENTA");
 } 
       catch (Exception e74) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e74);RDebugUtils.currentLine=11468884;
 //BA.debugLineNum = 11468884;BA.debugLine="Try";
try {RDebugUtils.currentLine=11468885;
 //BA.debugLineNum = 11468885;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE NOVENTA ADD COLUM";
_kmt.ExecNonQuery("ALTER TABLE NOVENTA ADD COLUMN NV_ENVIO TEXT");
 } 
       catch (Exception e77) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e77);RDebugUtils.currentLine=11468887;
 //BA.debugLineNum = 11468887;BA.debugLine="LogColor(\"No pudimos agregar la columna NV_ENVI";
anywheresoftware.b4a.keywords.Common.LogImpl("311468887","No pudimos agregar la columna NV_ENVIO.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=11468888;
 //BA.debugLineNum = 11468888;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("311468888",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=11468892;
 //BA.debugLineNum = 11468892;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS bita";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)");
RDebugUtils.currentLine=11468894;
 //BA.debugLineNum = 11468894;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)");
RDebugUtils.currentLine=11468897;
 //BA.debugLineNum = 11468897;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);};
RDebugUtils.currentLine=11468898;
 //BA.debugLineNum = 11468898;BA.debugLine="errorLog.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS";
_errorlog.ExecNonQuery("CREATE TABLE IF NOT EXISTS errores(fecha INTEGER, error TEXT)");
RDebugUtils.currentLine=11468899;
 //BA.debugLineNum = 11468899;BA.debugLine="End Sub";
return "";
}
public static String  _fechakmt(anywheresoftware.b4a.BA _ba,String _fecha) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "fechakmt", false))
	 {return ((String) Debug.delegate(null, "fechakmt", new Object[] {_ba,_fecha}));}
String _origformat = "";
String _nuevafecha = "";
RDebugUtils.currentLine=10878976;
 //BA.debugLineNum = 10878976;BA.debugLine="Sub fechaKMT(fecha As String) As String 'ignore";
RDebugUtils.currentLine=10878978;
 //BA.debugLineNum = 10878978;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=10878979;
 //BA.debugLineNum = 10878979;BA.debugLine="DateTime.DateFormat=\"yyMMddHHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMddHHmmss");
RDebugUtils.currentLine=10878980;
 //BA.debugLineNum = 10878980;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
RDebugUtils.currentLine=10878981;
 //BA.debugLineNum = 10878981;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=10878983;
 //BA.debugLineNum = 10878983;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
RDebugUtils.currentLine=10878984;
 //BA.debugLineNum = 10878984;BA.debugLine="End Sub";
return "";
}
public static String  _bitacora(anywheresoftware.b4a.BA _ba,String _fechab,String _usuariob,String _almacenb,String _rutab,String _eventob,String _clienteb,String _iniciob,String _finb,String _latitudb,String _longitudb,String _precision,String _motivonoventa,String _motivonovisita) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "bitacora", false))
	 {return ((String) Debug.delegate(null, "bitacora", new Object[] {_ba,_fechab,_usuariob,_almacenb,_rutab,_eventob,_clienteb,_iniciob,_finb,_latitudb,_longitudb,_precision,_motivonoventa,_motivonovisita}));}
keymon.lat.medicomed.dbrequestmanager._dbcommand _cmd = null;
String _nombrecliente = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _e = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
RDebugUtils.currentLine=14876672;
 //BA.debugLineNum = 14876672;BA.debugLine="Sub bitacora(fechab As String, usuariob As String,";
RDebugUtils.currentLine=14876673;
 //BA.debugLineNum = 14876673;BA.debugLine="Log(motivonovisita)";
anywheresoftware.b4a.keywords.Common.LogImpl("314876673",_motivonovisita,0);
RDebugUtils.currentLine=14876674;
 //BA.debugLineNum = 14876674;BA.debugLine="Log(\"bitacora\")";
anywheresoftware.b4a.keywords.Common.LogImpl("314876674","bitacora",0);
RDebugUtils.currentLine=14876675;
 //BA.debugLineNum = 14876675;BA.debugLine="Log(eventob)";
anywheresoftware.b4a.keywords.Common.LogImpl("314876675",_eventob,0);
RDebugUtils.currentLine=14876676;
 //BA.debugLineNum = 14876676;BA.debugLine="Private cmd As DBCommand";
_cmd = new keymon.lat.medicomed.dbrequestmanager._dbcommand();
RDebugUtils.currentLine=14876677;
 //BA.debugLineNum = 14876677;BA.debugLine="cmd.Initialize";
_cmd.Initialize();
RDebugUtils.currentLine=14876678;
 //BA.debugLineNum = 14876678;BA.debugLine="cmd.Name = \"mandaBitacora_MEDICOMED\"";
_cmd.Name /*String*/  = "mandaBitacora_MEDICOMED";
RDebugUtils.currentLine=14876679;
 //BA.debugLineNum = 14876679;BA.debugLine="Log(\"BITACORA3\")";
anywheresoftware.b4a.keywords.Common.LogImpl("314876679","BITACORA3",0);
RDebugUtils.currentLine=14876680;
 //BA.debugLineNum = 14876680;BA.debugLine="Private nombreCliente As String = traeNombreClien";
_nombrecliente = _traenombrecliente(_ba,_clienteb);
RDebugUtils.currentLine=14876681;
 //BA.debugLineNum = 14876681;BA.debugLine="If eventob = \"Llega a almacen\" Then";
if ((_eventob).equals("Llega a almacen")) { 
RDebugUtils.currentLine=14876682;
 //BA.debugLineNum = 14876682;BA.debugLine="nombreCliente = \"BOLETA\"";
_nombrecliente = "BOLETA";
RDebugUtils.currentLine=14876683;
 //BA.debugLineNum = 14876683;BA.debugLine="clienteb = \"\"";
_clienteb = "";
RDebugUtils.currentLine=14876684;
 //BA.debugLineNum = 14876684;BA.debugLine="finb = iniciob";
_finb = _iniciob;
 };
RDebugUtils.currentLine=14876686;
 //BA.debugLineNum = 14876686;BA.debugLine="If eventob = \"Salida almacen\" Then nombreCliente";
if ((_eventob).equals("Salida almacen")) { 
_nombrecliente = "CHECKLIST";};
RDebugUtils.currentLine=14876687;
 //BA.debugLineNum = 14876687;BA.debugLine="If eventob = \"Fin Día\" Then nombreCliente = \"FIN";
if ((_eventob).equals("Fin Día")) { 
_nombrecliente = "FIN DIA";};
RDebugUtils.currentLine=14876688;
 //BA.debugLineNum = 14876688;BA.debugLine="If eventob = \"Carga día\" Then nombreCliente = \"CA";
if ((_eventob).equals("Carga día")) { 
_nombrecliente = "CARGA DIA";};
RDebugUtils.currentLine=14876689;
 //BA.debugLineNum = 14876689;BA.debugLine="If eventob <> \"Termina Venta\" And eventob <> \"No";
if ((_eventob).equals("Termina Venta") == false && (_eventob).equals("No Venta") == false) { 
RDebugUtils.currentLine=14876690;
 //BA.debugLineNum = 14876690;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"INSERT INT";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("INSERT INTO BITACORAGPS (fechab, usuariob , almacenb , rutab , eventob , clienteb , iniciob , finb , latitudb, longitudb , precision , motivonoventa , motivonovisita) VALUES ('"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_fechab))+"' ,'"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariob))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenb))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutab))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_eventob))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteb))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_iniciob))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_finb))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_latitudb))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_longitudb))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_precision))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_motivonoventa))+"' , '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_motivonovisita))+"')"));
RDebugUtils.currentLine=14876691;
 //BA.debugLineNum = 14876691;BA.debugLine="Log($\"'${almacenb}', '${usuariob}', '${rutab}',";
anywheresoftware.b4a.keywords.Common.LogImpl("314876691",("'"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenb))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariob))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutab))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_eventob))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteb))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_nombrecliente))+"','"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_iniciob))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_finb))+"','"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_latitudb))+"','"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_longitudb))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_precision))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_motivonoventa))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_motivonovisita))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_fechab))+"'"),0);
 }else {
RDebugUtils.currentLine=14876696;
 //BA.debugLineNum = 14876696;BA.debugLine="Private e As Cursor = B4XPages.MainPage.skmt.Exe";
_e = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_e = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select fechab from BITACORAGPS where usuariob = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariob))+"' and almacenb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenb))+"' and rutab = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutab))+"' and clienteb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteb))+"' and eventob = 'Inicia Venta' order by fechab desc"))));
RDebugUtils.currentLine=14876698;
 //BA.debugLineNum = 14876698;BA.debugLine="If e.RowCount > 0 Then";
if (_e.getRowCount()>0) { 
RDebugUtils.currentLine=14876699;
 //BA.debugLineNum = 14876699;BA.debugLine="e.Position = 0";
_e.setPosition((int) (0));
RDebugUtils.currentLine=14876700;
 //BA.debugLineNum = 14876700;BA.debugLine="Log(\"ACTUALIZA BITACORA\")";
anywheresoftware.b4a.keywords.Common.LogImpl("314876700","ACTUALIZA BITACORA",0);
RDebugUtils.currentLine=14876701;
 //BA.debugLineNum = 14876701;BA.debugLine="If eventob = \"Termina Venta\" Then";
if ((_eventob).equals("Termina Venta")) { 
RDebugUtils.currentLine=14876702;
 //BA.debugLineNum = 14876702;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update B";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update BITACORAGPS set finb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_finb))+"' where rutab = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutab))+"' and almacenb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenb))+"' and usuariob = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariob))+"' and clienteb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteb))+"' and fechab = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_e.GetString("fechab")))+"' "));
RDebugUtils.currentLine=14876705;
 //BA.debugLineNum = 14876705;BA.debugLine="cmd.Parameters = Array As Object(finb, rutab,";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(_finb),(Object)(_rutab),(Object)(_almacenb),(Object)(_usuariob),(Object)(_clienteb),(Object)("Inicia Venta"),(Object)(_e.GetString("fechab"))};
 }else 
{RDebugUtils.currentLine=14876708;
 //BA.debugLineNum = 14876708;BA.debugLine="else if  eventob = \"No Venta\" Then";
if ((_eventob).equals("No Venta")) { 
RDebugUtils.currentLine=14876709;
 //BA.debugLineNum = 14876709;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update B";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update BITACORAGPS set finb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_finb))+"', motivonoventa = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_motivonoventa))+"', motivonovisita = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_motivonovisita))+"' where rutab = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutab))+"' and almacenb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenb))+"' and usuariob = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariob))+"' and clienteb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteb))+"' and fechab = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_e.GetString("fechab")))+"' "));
RDebugUtils.currentLine=14876712;
 //BA.debugLineNum = 14876712;BA.debugLine="cmd.Parameters = Array As Object(finb, motivon";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(_finb),(Object)(_motivonoventa),(Object)(_motivonovisita),(Object)(_rutab),(Object)(_almacenb),(Object)(_usuariob),(Object)(_clienteb),(Object)("Inicia Venta"),(Object)(_e.GetString("fechab"))};
 }}
;
 };
 };
RDebugUtils.currentLine=14876718;
 //BA.debugLineNum = 14876718;BA.debugLine="If eventob <> \"Inicia Venta\" Then";
if ((_eventob).equals("Inicia Venta") == false) { 
RDebugUtils.currentLine=14876719;
 //BA.debugLineNum = 14876719;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from BITACORAGPS where usuariob = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariob))+"' and almacenb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenb))+"' and rutab = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutab))+"' and clienteb = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteb))+"' order by fechab desc"))));
RDebugUtils.currentLine=14876720;
 //BA.debugLineNum = 14876720;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=14876721;
 //BA.debugLineNum = 14876721;BA.debugLine="Log(c.RowCount)";
anywheresoftware.b4a.keywords.Common.LogImpl("314876721",BA.NumberToString(_c.getRowCount()),0);
RDebugUtils.currentLine=14876722;
 //BA.debugLineNum = 14876722;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=14876723;
 //BA.debugLineNum = 14876723;BA.debugLine="cmd.Parameters = Array As Object(c.GetString(\"a";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(_c.GetString("almacenb")),(Object)(_c.GetString("usuariob")),(Object)(_c.GetString("rutab")),(Object)(_c.GetString("eventob")),(Object)(_c.GetString("clienteb")),(Object)(_nombrecliente),(Object)(_c.GetString("iniciob")),(Object)(_c.GetString("finb")),(Object)(_c.GetString("latitudb")),(Object)(_c.GetString("longitudb")),(Object)(_c.GetString("precision")),(Object)(_c.GetString("motivonoventa")),(Object)(_c.GetString("motivonovisita")),(Object)(_c.GetString("fechab"))};
RDebugUtils.currentLine=14876724;
 //BA.debugLineNum = 14876724;BA.debugLine="B4XPages.MainPage.reqManager.ExecuteCommand(cmd";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._reqmanager /*keymon.lat.medicomed.dbrequestmanager*/ ._executecommand /*String*/ (null,_cmd,(Object)("mandaBitacora"));
 };
 };
RDebugUtils.currentLine=14876727;
 //BA.debugLineNum = 14876727;BA.debugLine="Log(\"Mandamos bitacora\")";
anywheresoftware.b4a.keywords.Common.LogImpl("314876727","Mandamos bitacora",0);
RDebugUtils.currentLine=14876728;
 //BA.debugLineNum = 14876728;BA.debugLine="End Sub";
return "";
}
public static String  _fechanormal(anywheresoftware.b4a.BA _ba,String _fecha) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "fechanormal", false))
	 {return ((String) Debug.delegate(null, "fechanormal", new Object[] {_ba,_fecha}));}
String _origformat = "";
String _nuevafecha = "";
RDebugUtils.currentLine=15007744;
 //BA.debugLineNum = 15007744;BA.debugLine="Sub fechanormal(fecha As String) As String 'ignore";
RDebugUtils.currentLine=15007746;
 //BA.debugLineNum = 15007746;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=15007747;
 //BA.debugLineNum = 15007747;BA.debugLine="DateTime.DateFormat = \"YYYY/MM/dd HH:mm:ss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("YYYY/MM/dd HH:mm:ss");
RDebugUtils.currentLine=15007748;
 //BA.debugLineNum = 15007748;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
RDebugUtils.currentLine=15007749;
 //BA.debugLineNum = 15007749;BA.debugLine="DateTime.DateFormat = OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=15007751;
 //BA.debugLineNum = 15007751;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
RDebugUtils.currentLine=15007752;
 //BA.debugLineNum = 15007752;BA.debugLine="End Sub";
return "";
}
public static String  _centrapanel(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _elemento,int _anchoelementosuperior) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "centrapanel", false))
	 {return ((String) Debug.delegate(null, "centrapanel", new Object[] {_ba,_elemento,_anchoelementosuperior}));}
RDebugUtils.currentLine=12779520;
 //BA.debugLineNum = 12779520;BA.debugLine="Sub centraPanel(elemento As Panel, anchoElementoSu";
RDebugUtils.currentLine=12779521;
 //BA.debugLineNum = 12779521;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (anywheresoftware.b4a.keywords.Common.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
RDebugUtils.currentLine=12779522;
 //BA.debugLineNum = 12779522;BA.debugLine="End Sub";
return "";
}
public static String  _centrapanelv(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _elemento,int _altoelementosuperior) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "centrapanelv", false))
	 {return ((String) Debug.delegate(null, "centrapanelv", new Object[] {_ba,_elemento,_altoelementosuperior}));}
RDebugUtils.currentLine=12845056;
 //BA.debugLineNum = 12845056;BA.debugLine="Sub centraPanelV(elemento As Panel, altoElementoSu";
RDebugUtils.currentLine=12845057;
 //BA.debugLineNum = 12845057;BA.debugLine="elemento.Top = Round(altoElementoSuperior/2)-(ele";
_elemento.setTop((int) (anywheresoftware.b4a.keywords.Common.Round(_altoelementosuperior/(double)2)-(_elemento.getHeight()/(double)2)));
RDebugUtils.currentLine=12845058;
 //BA.debugLineNum = 12845058;BA.debugLine="End Sub";
return "";
}
public static String  _traenombrecliente(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traenombrecliente", false))
	 {return ((String) Debug.delegate(null, "traenombrecliente", new Object[] {_ba,_id}));}
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _c = null;
String _n = "";
RDebugUtils.currentLine=14942208;
 //BA.debugLineNum = 14942208;BA.debugLine="Sub traeNombreCliente(id As String) As String";
RDebugUtils.currentLine=14942209;
 //BA.debugLineNum = 14942209;BA.debugLine="Private c As ResultSet = B4XPages.MainPage.skmt.E";
_c = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_c = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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)(_id))+"'"))));
RDebugUtils.currentLine=14942210;
 //BA.debugLineNum = 14942210;BA.debugLine="Private n As String = \"N/A\"";
_n = "N/A";
RDebugUtils.currentLine=14942211;
 //BA.debugLineNum = 14942211;BA.debugLine="Do While c.NextRow";
while (_c.NextRow()) {
RDebugUtils.currentLine=14942212;
 //BA.debugLineNum = 14942212;BA.debugLine="n = c.GetString(\"CAT_CL_NOMBRE\")";
_n = _c.GetString("CAT_CL_NOMBRE");
 }
;
RDebugUtils.currentLine=14942214;
 //BA.debugLineNum = 14942214;BA.debugLine="Return n";
if (true) return _n;
RDebugUtils.currentLine=14942215;
 //BA.debugLineNum = 14942215;BA.debugLine="End Sub";
return "";
}
public static String  _traeusuariodebd(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traeusuariodebd", false))
	 {return ((String) Debug.delegate(null, "traeusuariodebd", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _u = "";
RDebugUtils.currentLine=13434880;
 //BA.debugLineNum = 13434880;BA.debugLine="Sub traeUsuarioDeBD As String 'ignore";
RDebugUtils.currentLine=13434881;
 //BA.debugLineNum = 13434881;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13434882;
 //BA.debugLineNum = 13434882;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
RDebugUtils.currentLine=13434883;
 //BA.debugLineNum = 13434883;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
RDebugUtils.currentLine=13434884;
 //BA.debugLineNum = 13434884;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")));
RDebugUtils.currentLine=13434885;
 //BA.debugLineNum = 13434885;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13434886;
 //BA.debugLineNum = 13434886;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
RDebugUtils.currentLine=13434887;
 //BA.debugLineNum = 13434887;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=13434888;
 //BA.debugLineNum = 13434888;BA.debugLine="Return u";
if (true) return _u;
RDebugUtils.currentLine=13434889;
 //BA.debugLineNum = 13434889;BA.debugLine="End Sub";
return "";
}
public static String  _traeruta(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traeruta", false))
	 {return ((String) Debug.delegate(null, "traeruta", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
RDebugUtils.currentLine=13238272;
 //BA.debugLineNum = 13238272;BA.debugLine="Sub traeRuta As String 'ignore";
RDebugUtils.currentLine=13238273;
 //BA.debugLineNum = 13238273;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13238274;
 //BA.debugLineNum = 13238274;BA.debugLine="Private r As String";
_r = "";
RDebugUtils.currentLine=13238275;
 //BA.debugLineNum = 13238275;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")));
RDebugUtils.currentLine=13238276;
 //BA.debugLineNum = 13238276;BA.debugLine="r = \"0\"";
_r = "0";
RDebugUtils.currentLine=13238277;
 //BA.debugLineNum = 13238277;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=13238278;
 //BA.debugLineNum = 13238278;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13238279;
 //BA.debugLineNum = 13238279;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
RDebugUtils.currentLine=13238281;
 //BA.debugLineNum = 13238281;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=13238282;
 //BA.debugLineNum = 13238282;BA.debugLine="Return r";
if (true) return _r;
RDebugUtils.currentLine=13238283;
 //BA.debugLineNum = 13238283;BA.debugLine="End Sub";
return "";
}
public static String  _traecliente(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traecliente", false))
	 {return ((String) Debug.delegate(null, "traecliente", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _cl = "";
RDebugUtils.currentLine=13303808;
 //BA.debugLineNum = 13303808;BA.debugLine="Sub traeCliente As String 'ignore";
RDebugUtils.currentLine=13303809;
 //BA.debugLineNum = 13303809;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13303810;
 //BA.debugLineNum = 13303810;BA.debugLine="Private cl As String";
_cl = "";
RDebugUtils.currentLine=13303811;
 //BA.debugLineNum = 13303811;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select CUENTA from cuentaa")));
RDebugUtils.currentLine=13303812;
 //BA.debugLineNum = 13303812;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13303813;
 //BA.debugLineNum = 13303813;BA.debugLine="cl = c.GetString(\"CUENTA\")";
_cl = _c.GetString("CUENTA");
RDebugUtils.currentLine=13303814;
 //BA.debugLineNum = 13303814;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=13303815;
 //BA.debugLineNum = 13303815;BA.debugLine="Return cl";
if (true) return _cl;
RDebugUtils.currentLine=13303816;
 //BA.debugLineNum = 13303816;BA.debugLine="End Sub";
return "";
}
public static String  _ventanoventa(anywheresoftware.b4a.BA _ba,String _usuariov,String _almacenv,String _rutav,String _eventov,String _clientev,String _iniciov,String _latitudv,String _longitudv,String _montoventav) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "ventanoventa", false))
	 {return ((String) Debug.delegate(null, "ventanoventa", new Object[] {_ba,_usuariov,_almacenv,_rutav,_eventov,_clientev,_iniciov,_latitudv,_longitudv,_montoventav}));}
keymon.lat.medicomed.dbrequestmanager._dbcommand _cmd = null;
String _nombreclientev = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
RDebugUtils.currentLine=15138816;
 //BA.debugLineNum = 15138816;BA.debugLine="Sub ventaNoVenta(usuariov As String, almacenv As S";
RDebugUtils.currentLine=15138817;
 //BA.debugLineNum = 15138817;BA.debugLine="Log(\"ventaNoVenta\")";
anywheresoftware.b4a.keywords.Common.LogImpl("315138817","ventaNoVenta",0);
RDebugUtils.currentLine=15138818;
 //BA.debugLineNum = 15138818;BA.debugLine="Log(eventov)";
anywheresoftware.b4a.keywords.Common.LogImpl("315138818",_eventov,0);
RDebugUtils.currentLine=15138820;
 //BA.debugLineNum = 15138820;BA.debugLine="Private cmd As DBCommand";
_cmd = new keymon.lat.medicomed.dbrequestmanager._dbcommand();
RDebugUtils.currentLine=15138821;
 //BA.debugLineNum = 15138821;BA.debugLine="cmd.Initialize";
_cmd.Initialize();
RDebugUtils.currentLine=15138822;
 //BA.debugLineNum = 15138822;BA.debugLine="cmd.Name = \"insert_venta_no_venta_MEDICOMED\"";
_cmd.Name /*String*/  = "insert_venta_no_venta_MEDICOMED";
RDebugUtils.currentLine=15138825;
 //BA.debugLineNum = 15138825;BA.debugLine="Private nombreClientev As String = traeNombreClie";
_nombreclientev = _traenombreclientev(_ba,_clientev);
RDebugUtils.currentLine=15138828;
 //BA.debugLineNum = 15138828;BA.debugLine="If eventov = \"Llega a almacen\" Then";
if ((_eventov).equals("Llega a almacen")) { 
RDebugUtils.currentLine=15138829;
 //BA.debugLineNum = 15138829;BA.debugLine="nombreClientev = \"BOLETA\"";
_nombreclientev = "BOLETA";
RDebugUtils.currentLine=15138830;
 //BA.debugLineNum = 15138830;BA.debugLine="clientev = \"\"";
_clientev = "";
 }else 
{RDebugUtils.currentLine=15138831;
 //BA.debugLineNum = 15138831;BA.debugLine="Else If eventov = \"ConVenta\" Then";
if ((_eventov).equals("ConVenta")) { 
RDebugUtils.currentLine=15138832;
 //BA.debugLineNum = 15138832;BA.debugLine="nombreClientev = \"VENTA\"";
_nombreclientev = "VENTA";
 }else 
{RDebugUtils.currentLine=15138833;
 //BA.debugLineNum = 15138833;BA.debugLine="Else If eventov = \"SinVenta\" Then";
if ((_eventov).equals("SinVenta")) { 
RDebugUtils.currentLine=15138834;
 //BA.debugLineNum = 15138834;BA.debugLine="nombreClientev = \"Sin Venta\"";
_nombreclientev = "Sin Venta";
 }}}
;
RDebugUtils.currentLine=15138838;
 //BA.debugLineNum = 15138838;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("SELECT * FROM VENTA_No_VENTA WHERE usuariov = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariov))+"' AND almacenv = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenv))+"' AND rutav = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutav))+"' AND clientev = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clientev))+"' ORDER BY iniciov DESC"))));
RDebugUtils.currentLine=15138840;
 //BA.debugLineNum = 15138840;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=15138842;
 //BA.debugLineNum = 15138842;BA.debugLine="Log(\"Actualizando registro existente\")";
anywheresoftware.b4a.keywords.Common.LogImpl("315138842","Actualizando registro existente",0);
RDebugUtils.currentLine=15138843;
 //BA.debugLineNum = 15138843;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"UPDATE VEN";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("UPDATE VENTA_No_VENTA SET eventov = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_eventov))+"', montoVentav = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_montoventav))+"' WHERE usuariov = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariov))+"' AND almacenv = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenv))+"' AND rutav = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutav))+"' AND clientev = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clientev))+"'"));
 }else {
RDebugUtils.currentLine=15138846;
 //BA.debugLineNum = 15138846;BA.debugLine="Log(\"Insertando nuevo registro\")";
anywheresoftware.b4a.keywords.Common.LogImpl("315138846","Insertando nuevo registro",0);
RDebugUtils.currentLine=15138847;
 //BA.debugLineNum = 15138847;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"INSERT INT";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("INSERT INTO VENTA_No_VENTA (usuariov, almacenv, rutav, eventov, clientev, iniciov, latitudv, longitudv, montoVentav) VALUES ('"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariov))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenv))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutav))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_eventov))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clientev))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_iniciov))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_latitudv))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_longitudv))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_montoventav))+"')"));
 };
RDebugUtils.currentLine=15138851;
 //BA.debugLineNum = 15138851;BA.debugLine="cmd.Parameters = Array As Object(usuariov, almace";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(_usuariov),(Object)(_almacenv),(Object)(_rutav),(Object)(_eventov),(Object)(_clientev),(Object)(_iniciov),(Object)(_latitudv),(Object)(_longitudv),(Object)(_montoventav)};
RDebugUtils.currentLine=15138852;
 //BA.debugLineNum = 15138852;BA.debugLine="B4XPages.MainPage.reqManager.ExecuteCommand(cmd,";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._reqmanager /*keymon.lat.medicomed.dbrequestmanager*/ ._executecommand /*String*/ (null,_cmd,(Object)("ventaNoVenta"));
RDebugUtils.currentLine=15138854;
 //BA.debugLineNum = 15138854;BA.debugLine="Log($\"Datos procesados: '${usuariov}', '${almacen";
anywheresoftware.b4a.keywords.Common.LogImpl("315138854",("Datos procesados: '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_usuariov))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_almacenv))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_rutav))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_eventov))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clientev))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_iniciov))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_latitudv))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_longitudv))+"', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_montoventav))+"'"),0);
RDebugUtils.currentLine=15138855;
 //BA.debugLineNum = 15138855;BA.debugLine="Log(\"Mandamos Venta_No_Venta\")";
anywheresoftware.b4a.keywords.Common.LogImpl("315138855","Mandamos Venta_No_Venta",0);
RDebugUtils.currentLine=15138856;
 //BA.debugLineNum = 15138856;BA.debugLine="End Sub";
return "";
}
public static String  _traealmacen(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traealmacen", false))
	 {return ((String) Debug.delegate(null, "traealmacen", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _a = "";
RDebugUtils.currentLine=13107200;
 //BA.debugLineNum = 13107200;BA.debugLine="Sub traeAlmacen As String 'ignore";
RDebugUtils.currentLine=13107201;
 //BA.debugLineNum = 13107201;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13107202;
 //BA.debugLineNum = 13107202;BA.debugLine="Private a As String";
_a = "";
RDebugUtils.currentLine=13107203;
 //BA.debugLineNum = 13107203;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select  ID_ALMACEN from CAT_ALMACEN")));
RDebugUtils.currentLine=13107204;
 //BA.debugLineNum = 13107204;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13107205;
 //BA.debugLineNum = 13107205;BA.debugLine="a = C.GetString(\"ID_ALMACEN\")";
_a = _c.GetString("ID_ALMACEN");
RDebugUtils.currentLine=13107206;
 //BA.debugLineNum = 13107206;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=13107207;
 //BA.debugLineNum = 13107207;BA.debugLine="Return a";
if (true) return _a;
RDebugUtils.currentLine=13107208;
 //BA.debugLineNum = 13107208;BA.debugLine="End Sub";
return "";
}
public static String  _iniciaactividad(anywheresoftware.b4a.BA _ba,String _ia) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "iniciaactividad", false))
	 {return ((String) Debug.delegate(null, "iniciaactividad", new Object[] {_ba,_ia}));}
RDebugUtils.currentLine=15073280;
 //BA.debugLineNum = 15073280;BA.debugLine="Sub iniciaActividad(ia As String)";
RDebugUtils.currentLine=15073281;
 //BA.debugLineNum = 15073281;BA.debugLine="If ia <> \"\" And ia <> Null Then";
if ((_ia).equals("") == false && _ia!= null) { 
RDebugUtils.currentLine=15073283;
 //BA.debugLineNum = 15073283;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"delete fro";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)("ULTIMOMODULO")}));
RDebugUtils.currentLine=15073284;
 //BA.debugLineNum = 15073284;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INT";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)("ULTIMOMODULO"),(Object)(_ia)}));
RDebugUtils.currentLine=15073285;
 //BA.debugLineNum = 15073285;BA.debugLine="B4XPages.ShowPage(ia)";
mostCurrent._b4xpages._showpage /*String*/ (_ba,_ia);
 };
RDebugUtils.currentLine=15073288;
 //BA.debugLineNum = 15073288;BA.debugLine="End Sub";
return "";
}
public static boolean  _pedidoguardado(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "pedidoguardado", false))
	 {return ((Boolean) Debug.delegate(null, "pedidoguardado", new Object[] {_ba}));}
boolean _guardado = false;
anywheresoftware.b4a.sql.SQL.CursorWrapper _g = null;
RDebugUtils.currentLine=14745600;
 //BA.debugLineNum = 14745600;BA.debugLine="Sub pedidoGuardado As Boolean";
RDebugUtils.currentLine=14745601;
 //BA.debugLineNum = 14745601;BA.debugLine="Private guardado As Boolean = False";
_guardado = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=14745602;
 //BA.debugLineNum = 14745602;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select gestion from kmt_info where CAT_CL_CODIGO in (Select CUENTA from cuentaa)")));
RDebugUtils.currentLine=14745603;
 //BA.debugLineNum = 14745603;BA.debugLine="If g.RowCount > 0 Then";
if (_g.getRowCount()>0) { 
RDebugUtils.currentLine=14745604;
 //BA.debugLineNum = 14745604;BA.debugLine="g.Position=0";
_g.setPosition((int) (0));
RDebugUtils.currentLine=14745605;
 //BA.debugLineNum = 14745605;BA.debugLine="If g.GetString(\"gestion\") = \"2\" Then guardado =";
if ((_g.GetString("gestion")).equals("2")) { 
_guardado = anywheresoftware.b4a.keywords.Common.True;};
 };
RDebugUtils.currentLine=14745607;
 //BA.debugLineNum = 14745607;BA.debugLine="Log($\"Guardado=${guardado}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("314745607",("Guardado="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_guardado))+""),0);
RDebugUtils.currentLine=14745608;
 //BA.debugLineNum = 14745608;BA.debugLine="Return guardado";
if (true) return _guardado;
RDebugUtils.currentLine=14745609;
 //BA.debugLineNum = 14745609;BA.debugLine="End Sub";
return false;
}
public static String  _borrapedidoclienteactual(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "borrapedidoclienteactual", false))
	 {return ((String) Debug.delegate(null, "borrapedidoclienteactual", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _thisc = null;
int _i = 0;
RDebugUtils.currentLine=14680064;
 //BA.debugLineNum = 14680064;BA.debugLine="Sub borraPedidoClienteActual As String";
RDebugUtils.currentLine=14680065;
 //BA.debugLineNum = 14680065;BA.debugLine="Private thisC As Cursor";
_thisc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=14680066;
 //BA.debugLineNum = 14680066;BA.debugLine="thisC=B4XPages.MainPage.skmt.ExecQuery(\"select PE";
_thisc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select PE_PROID,PE_CANT FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")));
RDebugUtils.currentLine=14680067;
 //BA.debugLineNum = 14680067;BA.debugLine="If thisC.RowCount>0 Then";
if (_thisc.getRowCount()>0) { 
RDebugUtils.currentLine=14680068;
 //BA.debugLineNum = 14680068;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 ) {
RDebugUtils.currentLine=14680069;
 //BA.debugLineNum = 14680069;BA.debugLine="thisC.Position=i";
_thisc.setPosition(_i);
RDebugUtils.currentLine=14680070;
 //BA.debugLineNum = 14680070;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"update ca";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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)(_thisc.GetString("PE_CANT")),(Object)(_thisc.GetString("PE_PROID"))}));
RDebugUtils.currentLine=14680071;
 //BA.debugLineNum = 14680071;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT IN";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO INVENT_X_ENVIAR (ALMACEN , PROID , CANTIDAD ) VALUES(?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_traealmacen(_ba)),(Object)(_thisc.GetString("PE_PROID")),(Object)((double)(Double.parseDouble(_thisc.GetString("PE_CANT")))*-1)}));
 }
};
 };
RDebugUtils.currentLine=14680074;
 //BA.debugLineNum = 14680074;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)");
RDebugUtils.currentLine=14680075;
 //BA.debugLineNum = 14680075;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)");
RDebugUtils.currentLine=14680076;
 //BA.debugLineNum = 14680076;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"UPDATE kmt_i";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE kmt_info set gestion = 0  where CAT_CL_CODIGO In (select cuenta from cuentaa)");
RDebugUtils.currentLine=14680077;
 //BA.debugLineNum = 14680077;BA.debugLine="Return 1";
if (true) return BA.NumberToString(1);
RDebugUtils.currentLine=14680078;
 //BA.debugLineNum = 14680078;BA.debugLine="End Sub";
return "";
}
public static String  _guardaclientehorainicio(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "guardaclientehorainicio", false))
	 {return ((String) Debug.delegate(null, "guardaclientehorainicio", new Object[] {_ba,_cliente}));}
RDebugUtils.currentLine=14483456;
 //BA.debugLineNum = 14483456;BA.debugLine="Sub guardaClienteHoraInicio(cliente As String)";
RDebugUtils.currentLine=14483457;
 //BA.debugLineNum = 14483457;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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)}));
RDebugUtils.currentLine=14483459;
 //BA.debugLineNum = 14483459;BA.debugLine="End Sub";
return "";
}
public static String  _actualizaproducto(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,String _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "actualizaproducto", false))
	 {return ((String) Debug.delegate(null, "actualizaproducto", new Object[] {_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _antcant = 0;
int _difcant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pe = null;
RDebugUtils.currentLine=13631488;
 //BA.debugLineNum = 13631488;BA.debugLine="Sub actualizaProducto(cedis As String, costoU As S";
RDebugUtils.currentLine=13631489;
 //BA.debugLineNum = 13631489;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 /*keymon.lat.medicomed.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))+"'"))));
RDebugUtils.currentLine=13631490;
 //BA.debugLineNum = 13631490;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=13631491;
 //BA.debugLineNum = 13631491;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13631492;
 //BA.debugLineNum = 13631492;BA.debugLine="Private antCant As Int = 0";
_antcant = (int) (0);
RDebugUtils.currentLine=13631493;
 //BA.debugLineNum = 13631493;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");};
RDebugUtils.currentLine=13631494;
 //BA.debugLineNum = 13631494;BA.debugLine="Private difCant As Int = cant - antCant";
_difcant = (int) ((double)(Double.parseDouble(_cant))-_antcant);
RDebugUtils.currentLine=13631495;
 //BA.debugLineNum = 13631495;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update ped";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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(_cant))*(double)(Double.parseDouble(_c.GetString("PE_COSTOU"))))))+" 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))+"' "));
RDebugUtils.currentLine=13631496;
 //BA.debugLineNum = 13631496;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update cat";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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))+"' "));
RDebugUtils.currentLine=13631497;
 //BA.debugLineNum = 13631497;BA.debugLine="If cant = 0 Then";
if ((_cant).equals(BA.NumberToString(0))) { 
RDebugUtils.currentLine=13631499;
 //BA.debugLineNum = 13631499;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"delete fr";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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))+"' "));
RDebugUtils.currentLine=13631500;
 //BA.debugLineNum = 13631500;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")));
RDebugUtils.currentLine=13631501;
 //BA.debugLineNum = 13631501;BA.debugLine="pe.Position=0";
_pe.setPosition((int) (0));
RDebugUtils.currentLine=13631502;
 //BA.debugLineNum = 13631502;BA.debugLine="If pe.GetString(\"cuantosPedidos\") = 0 Then B4XP";
if ((_pe.GetString("cuantosPedidos")).equals(BA.NumberToString(0))) { 
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");};
 };
 }else {
RDebugUtils.currentLine=13631506;
 //BA.debugLineNum = 13631506;BA.debugLine="guardaProductoSinGestion(cedis, costoU, cant, no";
_guardaproductosingestion(_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa);
 };
RDebugUtils.currentLine=13631508;
 //BA.debugLineNum = 13631508;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=13631509;
 //BA.debugLineNum = 13631509;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) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "guardaproductosingestion", false))
	 {return ((String) Debug.delegate(null, "guardaproductosingestion", new Object[] {_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
RDebugUtils.currentLine=13565952;
 //BA.debugLineNum = 13565952;BA.debugLine="Sub guardaProductoSinGestion(cedis As String, cost";
RDebugUtils.currentLine=13565953;
 //BA.debugLineNum = 13565953;BA.debugLine="LogColor(\"guardaProductoSinGestion: \"&prodId&\", c";
anywheresoftware.b4a.keywords.Common.LogImpl("313565953","guardaProductoSinGestion: "+_prodid+", cant="+_cant,anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=13565954;
 //BA.debugLineNum = 13565954;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13565955;
 //BA.debugLineNum = 13565955;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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)}));
RDebugUtils.currentLine=13565956;
 //BA.debugLineNum = 13565956;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"update cat_";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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)}));
RDebugUtils.currentLine=13565957;
 //BA.debugLineNum = 13565957;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 /*keymon.lat.medicomed.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)")));
RDebugUtils.currentLine=13565958;
 //BA.debugLineNum = 13565958;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13565959;
 //BA.debugLineNum = 13565959;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");
RDebugUtils.currentLine=13565960;
 //BA.debugLineNum = 13565960;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
RDebugUtils.currentLine=13565961;
 //BA.debugLineNum = 13565961;BA.debugLine="End Sub";
return "";
}
public static String  _actualizatet(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "actualizatet", false))
	 {return ((String) Debug.delegate(null, "actualizatet", new Object[] {_ba,_cliente}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
long _total = 0L;
int _i = 0;
long _subtotal = 0L;
RDebugUtils.currentLine=14548992;
 //BA.debugLineNum = 14548992;BA.debugLine="Sub actualizaTET(cliente As String)";
RDebugUtils.currentLine=14548993;
 //BA.debugLineNum = 14548993;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select * from PEDIDO_INICIO_FINAL where PIF_CLIENTE = ?",new String[]{_cliente})));
RDebugUtils.currentLine=14548994;
 //BA.debugLineNum = 14548994;BA.debugLine="Dim total As Long = 0";
_total = (long) (0);
RDebugUtils.currentLine=14548995;
 //BA.debugLineNum = 14548995;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=14548996;
 //BA.debugLineNum = 14548996;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=14548997;
 //BA.debugLineNum = 14548997;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 ) {
RDebugUtils.currentLine=14548998;
 //BA.debugLineNum = 14548998;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=14549000;
 //BA.debugLineNum = 14549000;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"))));
RDebugUtils.currentLine=14549001;
 //BA.debugLineNum = 14549001;BA.debugLine="total = total + subtotal";
_total = (long) (_total+_subtotal);
 }
};
RDebugUtils.currentLine=14549005;
 //BA.debugLineNum = 14549005;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"update PED";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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}));
 };
RDebugUtils.currentLine=14549007;
 //BA.debugLineNum = 14549007;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{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "alcanzanlosvariablesparapromo", false))
	 {return ((Boolean) Debug.delegate(null, "alcanzanlosvariablesparapromo", new Object[] {_ba,_promomap,_inventariosinfijos}));}
boolean _thislog = false;
int _totalprodsvariables = 0;
anywheresoftware.b4a.objects.collections.List _prodsvariables = null;
int _p = 0;
String _t = "";
String _p2 = "";
boolean _res = false;
RDebugUtils.currentLine=13893632;
 //BA.debugLineNum = 13893632;BA.debugLine="Sub alcanzanLosVariablesParaPromo(promoMap As Map,";
RDebugUtils.currentLine=13893633;
 //BA.debugLineNum = 13893633;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=13893634;
 //BA.debugLineNum = 13893634;BA.debugLine="If thisLog Then LogColor(\"Inventario inicial: \"&i";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313893634","Inventario inicial: "+BA.ObjectToString(_inventariosinfijos),anywheresoftware.b4a.keywords.Common.Colors.Gray);};
RDebugUtils.currentLine=13893635;
 //BA.debugLineNum = 13893635;BA.debugLine="Private totalProdsVariables As Int = 0";
_totalprodsvariables = (int) (0);
RDebugUtils.currentLine=13893637;
 //BA.debugLineNum = 13893637;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"))));
RDebugUtils.currentLine=13893638;
 //BA.debugLineNum = 13893638;BA.debugLine="For p = 0 To prodsVariables.Size - 1";
{
final int step5 = 1;
final int limit5 = (int) (_prodsvariables.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit5 ;_p = _p + step5 ) {
RDebugUtils.currentLine=13893639;
 //BA.debugLineNum = 13893639;BA.debugLine="Private t As String = prodsVariables.Get(p) 'Obt";
_t = BA.ObjectToString(_prodsvariables.Get(_p));
RDebugUtils.currentLine=13893640;
 //BA.debugLineNum = 13893640;BA.debugLine="If inventarioSinFijos.ContainsKey(t) Then 'Si ex";
if (_inventariosinfijos.ContainsKey((Object)(_t))) { 
RDebugUtils.currentLine=13893641;
 //BA.debugLineNum = 13893641;BA.debugLine="Private p2 As String = inventarioSinFijos.Get(t";
_p2 = BA.ObjectToString(_inventariosinfijos.Get((Object)(_t)));
RDebugUtils.currentLine=13893642;
 //BA.debugLineNum = 13893642;BA.debugLine="totalProdsVariables = totalProdsVariables + p2";
_totalprodsvariables = (int) (_totalprodsvariables+(double)(Double.parseDouble(_p2)));
RDebugUtils.currentLine=13893643;
 //BA.debugLineNum = 13893643;BA.debugLine="If thisLog Then Log($\"prod ${t}, hay: ${p2}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313893643",("prod "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+", hay: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_p2))+""),0);};
 };
 }
};
RDebugUtils.currentLine=13893646;
 //BA.debugLineNum = 13893646;BA.debugLine="If thisLog Then Log(\"Total prods variables=\" & to";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313893646","Total prods variables="+BA.NumberToString(_totalprodsvariables)+", requeridos="+BA.ObjectToString(_promomap.Get((Object)("prodsVariablesRequeridos"))),0);};
RDebugUtils.currentLine=13893647;
 //BA.debugLineNum = 13893647;BA.debugLine="Private res As Boolean = False";
_res = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=13893648;
 //BA.debugLineNum = 13893648;BA.debugLine="If totalProdsVariables >= promoMap.Get(\"prodsVari";
if (_totalprodsvariables>=(double)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariablesRequeridos"))))) { 
_res = anywheresoftware.b4a.keywords.Common.True;};
RDebugUtils.currentLine=13893649;
 //BA.debugLineNum = 13893649;BA.debugLine="Return res";
if (true) return _res;
RDebugUtils.currentLine=13893650;
 //BA.debugLineNum = 13893650;BA.debugLine="End Sub";
return false;
}
public static String  _borraarribade100errores(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "borraarribade100errores", false))
	 {return ((String) Debug.delegate(null, "borraarribade100errores", new Object[] {_ba}));}
RDebugUtils.currentLine=12189696;
 //BA.debugLineNum = 12189696;BA.debugLine="Sub borraArribaDe100Errores 'ignore";
RDebugUtils.currentLine=12189697;
 //BA.debugLineNum = 12189697;BA.debugLine="revisaBD";
_revisabd(_ba);
RDebugUtils.currentLine=12189698;
 //BA.debugLineNum = 12189698;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("312189698","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=12189699;
 //BA.debugLineNum = 12189699;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 )");
RDebugUtils.currentLine=12189700;
 //BA.debugLineNum = 12189700;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=12189701;
 //BA.debugLineNum = 12189701;BA.debugLine="Log(\"Borramos mas de 100 de errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("312189701","Borramos mas de 100 de errorLog",0);
RDebugUtils.currentLine=12189702;
 //BA.debugLineNum = 12189702;BA.debugLine="End Sub";
return "";
}
public static String  _borraarribade600renglonesbitacora(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "borraarribade600renglonesbitacora", false))
	 {return ((String) Debug.delegate(null, "borraarribade600renglonesbitacora", new Object[] {_ba}));}
RDebugUtils.currentLine=12255232;
 //BA.debugLineNum = 12255232;BA.debugLine="Sub borraArribaDe600RenglonesBitacora 'ignore";
RDebugUtils.currentLine=12255233;
 //BA.debugLineNum = 12255233;BA.debugLine="revisaBD";
_revisabd(_ba);
RDebugUtils.currentLine=12255234;
 //BA.debugLineNum = 12255234;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("312255234","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=12255235;
 //BA.debugLineNum = 12255235;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 )");
RDebugUtils.currentLine=12255236;
 //BA.debugLineNum = 12255236;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=12255237;
 //BA.debugLineNum = 12255237;BA.debugLine="Log(\"Borramos mas de 600 de bitacora\")";
anywheresoftware.b4a.keywords.Common.LogImpl("312255237","Borramos mas de 600 de bitacora",0);
RDebugUtils.currentLine=12255238;
 //BA.debugLineNum = 12255238;BA.debugLine="End Sub";
return "";
}
public static String  _borralogdb(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "borralogdb", false))
	 {return ((String) Debug.delegate(null, "borralogdb", new Object[] {_ba}));}
RDebugUtils.currentLine=11993088;
 //BA.debugLineNum = 11993088;BA.debugLine="Sub borraLogDB 'ignore";
RDebugUtils.currentLine=11993089;
 //BA.debugLineNum = 11993089;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("311993089","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=11993090;
 //BA.debugLineNum = 11993090;BA.debugLine="kmt.ExecNonQuery(\"delete from bitacora\")";
_kmt.ExecNonQuery("delete from bitacora");
RDebugUtils.currentLine=11993091;
 //BA.debugLineNum = 11993091;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=11993092;
 //BA.debugLineNum = 11993092;BA.debugLine="End Sub";
return "";
}
public static String  _borramosarchivogps(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "borramosarchivogps", false))
	 {return ((String) Debug.delegate(null, "borramosarchivogps", new Object[] {_ba}));}
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
String _s = "";
byte[] _t = null;
RDebugUtils.currentLine=11403264;
 //BA.debugLineNum = 11403264;BA.debugLine="Sub borramosArchivoGPS 'ignore";
RDebugUtils.currentLine=11403265;
 //BA.debugLineNum = 11403265;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=11403266;
 //BA.debugLineNum = 11403266;BA.debugLine="Dim s As String = \"\"";
_s = "";
RDebugUtils.currentLine=11403267;
 //BA.debugLineNum = 11403267;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
RDebugUtils.currentLine=11403268;
 //BA.debugLineNum = 11403268;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
RDebugUtils.currentLine=11403269;
 //BA.debugLineNum = 11403269;BA.debugLine="out.Close";
_out.Close();
RDebugUtils.currentLine=11403270;
 //BA.debugLineNum = 11403270;BA.debugLine="End Sub";
return "";
}
public static String  _buscadbusuario(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "buscadbusuario", false))
	 {return ((String) Debug.delegate(null, "buscadbusuario", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _usuario = "";
RDebugUtils.currentLine=12976128;
 //BA.debugLineNum = 12976128;BA.debugLine="Sub buscaDBUsuario As String 'ignore";
RDebugUtils.currentLine=12976129;
 //BA.debugLineNum = 12976129;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=12976130;
 //BA.debugLineNum = 12976130;BA.debugLine="Private usuario As String = \"SinUsuario\"";
_usuario = "SinUsuario";
RDebugUtils.currentLine=12976131;
 //BA.debugLineNum = 12976131;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")));
RDebugUtils.currentLine=12976132;
 //BA.debugLineNum = 12976132;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=12976133;
 //BA.debugLineNum = 12976133;BA.debugLine="If c.RowCount > 0 Then usuario = c.GetString(\"USU";
if (_c.getRowCount()>0) { 
_usuario = _c.GetString("USUARIO");};
RDebugUtils.currentLine=12976134;
 //BA.debugLineNum = 12976134;BA.debugLine="Return usuario";
if (true) return _usuario;
RDebugUtils.currentLine=12976135;
 //BA.debugLineNum = 12976135;BA.debugLine="End Sub";
return "";
}
public static String  _centraetiqueta(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.LabelWrapper _elemento,int _anchoelementosuperior) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "centraetiqueta", false))
	 {return ((String) Debug.delegate(null, "centraetiqueta", new Object[] {_ba,_elemento,_anchoelementosuperior}));}
RDebugUtils.currentLine=12713984;
 //BA.debugLineNum = 12713984;BA.debugLine="Sub centraEtiqueta(elemento As Label, anchoElement";
RDebugUtils.currentLine=12713985;
 //BA.debugLineNum = 12713985;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (anywheresoftware.b4a.keywords.Common.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
RDebugUtils.currentLine=12713986;
 //BA.debugLineNum = 12713986;BA.debugLine="End Sub";
return "";
}
public static String  _centraprogressbar(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ProgressBarWrapper _elemento,int _anchoelementosuperior) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "centraprogressbar", false))
	 {return ((String) Debug.delegate(null, "centraprogressbar", new Object[] {_ba,_elemento,_anchoelementosuperior}));}
RDebugUtils.currentLine=12910592;
 //BA.debugLineNum = 12910592;BA.debugLine="Sub centraProgressBar(elemento As ProgressBar, anc";
RDebugUtils.currentLine=12910593;
 //BA.debugLineNum = 12910593;BA.debugLine="elemento.Left = Round(anchoElementoSuperior/2)-(e";
_elemento.setLeft((int) (anywheresoftware.b4a.keywords.Common.Round(_anchoelementosuperior/(double)2)-(_elemento.getWidth()/(double)2)));
RDebugUtils.currentLine=12910594;
 //BA.debugLineNum = 12910594;BA.debugLine="End Sub";
return "";
}
public static String  _compress(anywheresoftware.b4a.BA _ba,String _str) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "compress", false))
	 {return ((String) Debug.delegate(null, "compress", new Object[] {_ba,_str}));}
byte[] _compressed = null;
String _base64 = "";
RDebugUtils.currentLine=10747904;
 //BA.debugLineNum = 10747904;BA.debugLine="Sub compress(str As String) As String 'ignore";
RDebugUtils.currentLine=10747906;
 //BA.debugLineNum = 10747906;BA.debugLine="Dim compressed() As Byte = GZip.compress(str)";
_compressed = _gzip.compress(_str);
RDebugUtils.currentLine=10747909;
 //BA.debugLineNum = 10747909;BA.debugLine="Dim base64 As String = su.EncodeBase64(compressed";
_base64 = _su.EncodeBase64(_compressed);
RDebugUtils.currentLine=10747910;
 //BA.debugLineNum = 10747910;BA.debugLine="Log($\"Comprimido: ${base64.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("310747910",("Comprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_base64.length()))+""),0);
RDebugUtils.currentLine=10747912;
 //BA.debugLineNum = 10747912;BA.debugLine="Return base64";
if (true) return _base64;
RDebugUtils.currentLine=10747913;
 //BA.debugLineNum = 10747913;BA.debugLine="End Sub";
return "";
}
public static String  _copiadb(anywheresoftware.b4a.BA _ba,boolean _result) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "copiadb", false))
	 {return ((String) Debug.delegate(null, "copiadb", new Object[] {_ba,_result}));}
String _p = "";
String _thedir = "";
RDebugUtils.currentLine=12582912;
 //BA.debugLineNum = 12582912;BA.debugLine="Sub copiaDB(result As Boolean) 'ignore";
RDebugUtils.currentLine=12582913;
 //BA.debugLineNum = 12582913;BA.debugLine="ToastMessageShow(\"copiaDB\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("copiaDB"),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=12582914;
 //BA.debugLineNum = 12582914;BA.debugLine="If result Then";
if (_result) { 
RDebugUtils.currentLine=12582915;
 //BA.debugLineNum = 12582915;BA.debugLine="Dim p As String";
_p = "";
RDebugUtils.currentLine=12582916;
 //BA.debugLineNum = 12582916;BA.debugLine="If File.ExternalWritable Then";
if (anywheresoftware.b4a.keywords.Common.File.getExternalWritable()) { 
RDebugUtils.currentLine=12582917;
 //BA.debugLineNum = 12582917;BA.debugLine="p = File.DirRootExternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirRootExternal();
 }else {
RDebugUtils.currentLine=12582920;
 //BA.debugLineNum = 12582920;BA.debugLine="p = File.DirInternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 };
RDebugUtils.currentLine=12582923;
 //BA.debugLineNum = 12582923;BA.debugLine="Dim theDir As String";
_thedir = "";
RDebugUtils.currentLine=12582924;
 //BA.debugLineNum = 12582924;BA.debugLine="Try";
try {RDebugUtils.currentLine=12582925;
 //BA.debugLineNum = 12582925;BA.debugLine="File.MakeDir(File.DirRootExternal,\"kmts\")";
anywheresoftware.b4a.keywords.Common.File.MakeDir(anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),"kmts");
RDebugUtils.currentLine=12582926;
 //BA.debugLineNum = 12582926;BA.debugLine="theDir = \"/kmts\"";
_thedir = "/kmts";
 } 
       catch (Exception e14) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e14);RDebugUtils.currentLine=12582928;
 //BA.debugLineNum = 12582928;BA.debugLine="theDir = \"\"";
_thedir = "";
 };
RDebugUtils.currentLine=12582930;
 //BA.debugLineNum = 12582930;BA.debugLine="Try";
try {RDebugUtils.currentLine=12582931;
 //BA.debugLineNum = 12582931;BA.debugLine="File.Copy(File.DirInternal,\"kmt.db\",File.DirRoo";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db",anywheresoftware.b4a.keywords.Common.File.getDirRootExternal()+_thedir,"cedex_kmt.db");
RDebugUtils.currentLine=12582932;
 //BA.debugLineNum = 12582932;BA.debugLine="File.Copy(File.DirInternal,\"errorLog.db\",File.D";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"errorLog.db",anywheresoftware.b4a.keywords.Common.File.getDirRootExternal()+_thedir,"cedex_errorLog.db");
RDebugUtils.currentLine=12582933;
 //BA.debugLineNum = 12582933;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);RDebugUtils.currentLine=12582935;
 //BA.debugLineNum = 12582935;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);
 };
RDebugUtils.currentLine=12582937;
 //BA.debugLineNum = 12582937;BA.debugLine="Log(\"rootExternal=\"&p)";
anywheresoftware.b4a.keywords.Common.LogImpl("312582937","rootExternal="+_p,0);
RDebugUtils.currentLine=12582938;
 //BA.debugLineNum = 12582938;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
anywheresoftware.b4a.keywords.Common.LogImpl("312582938","File.DirInternal="+anywheresoftware.b4a.keywords.Common.File.getDirInternal(),0);
RDebugUtils.currentLine=12582939;
 //BA.debugLineNum = 12582939;BA.debugLine="Log(\"File.DirRootExternal=\"&File.DirRootExternal";
anywheresoftware.b4a.keywords.Common.LogImpl("312582939","File.DirRootExternal="+anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),0);
 }else {
RDebugUtils.currentLine=12582941;
 //BA.debugLineNum = 12582941;BA.debugLine="ToastMessageShow(\"Sin permisos\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Sin permisos"),anywheresoftware.b4a.keywords.Common.False);
 };
RDebugUtils.currentLine=12582943;
 //BA.debugLineNum = 12582943;BA.debugLine="End Sub";
return "";
}
public static String  _cuantosvariablestengobd(anywheresoftware.b4a.BA _ba,String _promo) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "cuantosvariablestengobd", false))
	 {return ((String) Debug.delegate(null, "cuantosvariablestengobd", new Object[] {_ba,_promo}));}
RDebugUtils.currentLine=14352384;
 //BA.debugLineNum = 14352384;BA.debugLine="Sub cuantosVariablesTengoBD(promo As String) As St";
RDebugUtils.currentLine=14352395;
 //BA.debugLineNum = 14352395;BA.debugLine="End Sub";
return "";
}
public static String  _dameerroresjson(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.sql.SQL _sql,int _maxerrores,boolean _comprimido) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "dameerroresjson", false))
	 {return ((String) Debug.delegate(null, "dameerroresjson", new Object[] {_ba,_sql,_maxerrores,_comprimido}));}
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;
RDebugUtils.currentLine=12386304;
 //BA.debugLineNum = 12386304;BA.debugLine="Sub dameErroresJSON(SQL As SQL, maxErrores As Int,";
RDebugUtils.currentLine=12386305;
 //BA.debugLineNum = 12386305;BA.debugLine="Log(\"dameErroresJSON\")";
anywheresoftware.b4a.keywords.Common.LogImpl("312386305","dameErroresJSON",0);
RDebugUtils.currentLine=12386306;
 //BA.debugLineNum = 12386306;BA.debugLine="Private j As JSONGenerator";
_j = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
RDebugUtils.currentLine=12386307;
 //BA.debugLineNum = 12386307;BA.debugLine="Private lim As String";
_lim = "";
RDebugUtils.currentLine=12386308;
 //BA.debugLineNum = 12386308;BA.debugLine="Private cur As ResultSet";
_cur = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
RDebugUtils.currentLine=12386309;
 //BA.debugLineNum = 12386309;BA.debugLine="Private l As List";
_l = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=12386310;
 //BA.debugLineNum = 12386310;BA.debugLine="Private i As Int = 0";
_i = (int) (0);
RDebugUtils.currentLine=12386311;
 //BA.debugLineNum = 12386311;BA.debugLine="l.Initialize";
_l.Initialize();
RDebugUtils.currentLine=12386312;
 //BA.debugLineNum = 12386312;BA.debugLine="Dim m, m2 As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m2 = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=12386313;
 //BA.debugLineNum = 12386313;BA.debugLine="m2.Initialize";
_m2.Initialize();
RDebugUtils.currentLine=12386314;
 //BA.debugLineNum = 12386314;BA.debugLine="If maxErrores = 0 Then lim = \"\" Else lim = \"limit";
if (_maxerrores==0) { 
_lim = "";}
else {
_lim = "limit "+BA.NumberToString(_maxerrores);};
RDebugUtils.currentLine=12386315;
 //BA.debugLineNum = 12386315;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)));
RDebugUtils.currentLine=12386316;
 //BA.debugLineNum = 12386316;BA.debugLine="Do While cur.NextRow";
while (_cur.NextRow()) {
RDebugUtils.currentLine=12386317;
 //BA.debugLineNum = 12386317;BA.debugLine="m.Initialize";
_m.Initialize();
RDebugUtils.currentLine=12386318;
 //BA.debugLineNum = 12386318;BA.debugLine="m.Put(\"fecha\", cur.GetString(\"fecha\"))";
_m.Put((Object)("fecha"),(Object)(_cur.GetString("fecha")));
RDebugUtils.currentLine=12386319;
 //BA.debugLineNum = 12386319;BA.debugLine="m.Put(\"error\", cur.GetString(\"error\"))";
_m.Put((Object)("error"),(Object)(_cur.GetString("error")));
RDebugUtils.currentLine=12386320;
 //BA.debugLineNum = 12386320;BA.debugLine="m2.Put(i,m)";
_m2.Put((Object)(_i),(Object)(_m.getObject()));
RDebugUtils.currentLine=12386321;
 //BA.debugLineNum = 12386321;BA.debugLine="i = i + 1";
_i = (int) (_i+1);
 }
;
RDebugUtils.currentLine=12386323;
 //BA.debugLineNum = 12386323;BA.debugLine="cur.Close";
_cur.Close();
RDebugUtils.currentLine=12386324;
 //BA.debugLineNum = 12386324;BA.debugLine="j.Initialize(m2)";
_j.Initialize(_m2);
RDebugUtils.currentLine=12386325;
 //BA.debugLineNum = 12386325;BA.debugLine="Log(j.ToString)";
anywheresoftware.b4a.keywords.Common.LogImpl("312386325",_j.ToString(),0);
RDebugUtils.currentLine=12386326;
 //BA.debugLineNum = 12386326;BA.debugLine="If comprimido Then";
if (_comprimido) { 
RDebugUtils.currentLine=12386327;
 //BA.debugLineNum = 12386327;BA.debugLine="Return compress(j.ToString)";
if (true) return _compress(_ba,_j.ToString());
 }else {
RDebugUtils.currentLine=12386329;
 //BA.debugLineNum = 12386329;BA.debugLine="Return j.ToString";
if (true) return _j.ToString();
 };
RDebugUtils.currentLine=12386331;
 //BA.debugLineNum = 12386331;BA.debugLine="End Sub";
return "";
}
public static String  _dameruta(anywheresoftware.b4a.BA _ba,String _inicioruta,String _origenruta) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "dameruta", false))
	 {return ((String) Debug.delegate(null, "dameruta", new Object[] {_ba,_inicioruta,_origenruta}));}
String _fechainicio = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _ruta2 = "";
int _i = 0;
RDebugUtils.currentLine=11206656;
 //BA.debugLineNum = 11206656;BA.debugLine="Sub dameRuta(inicioRuta As String, origenRuta As S";
RDebugUtils.currentLine=11206658;
 //BA.debugLineNum = 11206658;BA.debugLine="Dim fechaInicio As String";
_fechainicio = "";
RDebugUtils.currentLine=11206659;
 //BA.debugLineNum = 11206659;BA.debugLine="Try 'incioRuta es numero";
try {RDebugUtils.currentLine=11206660;
 //BA.debugLineNum = 11206660;BA.debugLine="inicioRuta = inicioRuta * 1";
_inicioruta = BA.NumberToString((double)(Double.parseDouble(_inicioruta))*1);
RDebugUtils.currentLine=11206662;
 //BA.debugLineNum = 11206662;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);RDebugUtils.currentLine=11206664;
 //BA.debugLineNum = 11206664;BA.debugLine="fechaInicio = fechaInicioHoy";
_fechainicio = _fechainiciohoy(_ba);
 };
RDebugUtils.currentLine=11206667;
 //BA.debugLineNum = 11206667;BA.debugLine="If subsLogs Then Log(\"fechaInicio: \"&fechaInicio&";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("311206667","fechaInicio: "+_fechainicio+" | rutaHrsAtras="+BA.NumberToString(_rutahrsatras),0);};
RDebugUtils.currentLine=11206668;
 //BA.debugLineNum = 11206668;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=11206669;
 //BA.debugLineNum = 11206669;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);};
RDebugUtils.currentLine=11206670;
 //BA.debugLineNum = 11206670;BA.debugLine="If subsLogs Then Log(\"select FECHA, LAT, LON from";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("311206670","select FECHA, LAT, LON from "+_origenruta+" where FECHA > "+_fechainicio+" order by FECHA desc limit "+BA.NumberToString(_rutamaxpoints),0);};
RDebugUtils.currentLine=11206671;
 //BA.debugLineNum = 11206671;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))));
RDebugUtils.currentLine=11206672;
 //BA.debugLineNum = 11206672;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=11206673;
 //BA.debugLineNum = 11206673;BA.debugLine="Dim ruta2 As String = \"\"";
_ruta2 = "";
RDebugUtils.currentLine=11206674;
 //BA.debugLineNum = 11206674;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=11206675;
 //BA.debugLineNum = 11206675;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 ) {
RDebugUtils.currentLine=11206676;
 //BA.debugLineNum = 11206676;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=11206677;
 //BA.debugLineNum = 11206677;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");
RDebugUtils.currentLine=11206678;
 //BA.debugLineNum = 11206678;BA.debugLine="B4XPages.MainPage.fechaRuta = c.GetString(\"FECH";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._fecharuta /*String*/  = _c.GetString("FECHA");
 }
};
 };
RDebugUtils.currentLine=11206681;
 //BA.debugLineNum = 11206681;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=11206682;
 //BA.debugLineNum = 11206682;BA.debugLine="Return compress(ruta2)";
if (true) return _compress(_ba,_ruta2);
RDebugUtils.currentLine=11206683;
 //BA.debugLineNum = 11206683;BA.debugLine="End Sub";
return "";
}
public static String  _fechainiciohoy(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "fechainiciohoy", false))
	 {return ((String) Debug.delegate(null, "fechainiciohoy", new Object[] {_ba}));}
String _origformat = "";
String _h = "";
RDebugUtils.currentLine=11730944;
 //BA.debugLineNum = 11730944;BA.debugLine="Sub fechaInicioHoy As String 'ignore";
RDebugUtils.currentLine=11730945;
 //BA.debugLineNum = 11730945;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=11730946;
 //BA.debugLineNum = 11730946;BA.debugLine="DateTime.DateFormat=\"yyMMdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMdd");
RDebugUtils.currentLine=11730947;
 //BA.debugLineNum = 11730947;BA.debugLine="Private h As String = DateTime.Date(DateTime.Now";
_h = anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow())+"000000";
RDebugUtils.currentLine=11730948;
 //BA.debugLineNum = 11730948;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=11730949;
 //BA.debugLineNum = 11730949;BA.debugLine="Log(\"Hoy=\"&h)";
anywheresoftware.b4a.keywords.Common.LogImpl("311730949","Hoy="+_h,0);
RDebugUtils.currentLine=11730950;
 //BA.debugLineNum = 11730950;BA.debugLine="Return h";
if (true) return _h;
RDebugUtils.currentLine=11730951;
 //BA.debugLineNum = 11730951;BA.debugLine="End Sub";
return "";
}
public static String  _dameusuariodedb(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "dameusuariodedb", false))
	 {return ((String) Debug.delegate(null, "dameusuariodedb", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _u = "";
RDebugUtils.currentLine=13041664;
 //BA.debugLineNum = 13041664;BA.debugLine="Sub dameUsuarioDeDB As String 'ignore";
RDebugUtils.currentLine=13041665;
 //BA.debugLineNum = 13041665;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13041666;
 //BA.debugLineNum = 13041666;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
RDebugUtils.currentLine=13041667;
 //BA.debugLineNum = 13041667;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
RDebugUtils.currentLine=13041668;
 //BA.debugLineNum = 13041668;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")));
RDebugUtils.currentLine=13041669;
 //BA.debugLineNum = 13041669;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13041670;
 //BA.debugLineNum = 13041670;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
RDebugUtils.currentLine=13041671;
 //BA.debugLineNum = 13041671;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=13041672;
 //BA.debugLineNum = 13041672;BA.debugLine="Return u";
if (true) return _u;
RDebugUtils.currentLine=13041673;
 //BA.debugLineNum = 13041673;BA.debugLine="End Sub";
return "";
}
public static String  _decompress(anywheresoftware.b4a.BA _ba,String _base64) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "decompress", false))
	 {return ((String) Debug.delegate(null, "decompress", new Object[] {_ba,_base64}));}
byte[] _decompressedbytes = null;
anywheresoftware.b4a.agraham.byteconverter.ByteConverter _bc = null;
String _uncompressed = "";
RDebugUtils.currentLine=10813440;
 //BA.debugLineNum = 10813440;BA.debugLine="Sub decompress(base64 As String) As String 'ignore";
RDebugUtils.currentLine=10813441;
 //BA.debugLineNum = 10813441;BA.debugLine="Dim decompressedbytes() As Byte = su.DecodeBase64";
_decompressedbytes = _su.DecodeBase64(_base64);
RDebugUtils.currentLine=10813443;
 //BA.debugLineNum = 10813443;BA.debugLine="Dim bc As ByteConverter";
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
RDebugUtils.currentLine=10813444;
 //BA.debugLineNum = 10813444;BA.debugLine="Dim uncompressed As String = bc.StringFromBytes(d";
_uncompressed = _bc.StringFromBytes(_decompressedbytes,"UTF8");
RDebugUtils.currentLine=10813445;
 //BA.debugLineNum = 10813445;BA.debugLine="Log($\"Descomprimido: ${uncompressed.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("310813445",("Descomprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_uncompressed.length()))+""),0);
RDebugUtils.currentLine=10813447;
 //BA.debugLineNum = 10813447;BA.debugLine="Return uncompressed";
if (true) return _uncompressed;
RDebugUtils.currentLine=10813448;
 //BA.debugLineNum = 10813448;BA.debugLine="End Sub";
return "";
}
public static String  _deleteerrorlog_db(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "deleteerrorlog_db", false))
	 {return ((String) Debug.delegate(null, "deleteerrorlog_db", new Object[] {_ba}));}
RDebugUtils.currentLine=11337728;
 //BA.debugLineNum = 11337728;BA.debugLine="Sub deleteErrorLog_DB 'ignore";
RDebugUtils.currentLine=11337729;
 //BA.debugLineNum = 11337729;BA.debugLine="errorLog.ExecNonQuery(\"delete from errores\")";
_errorlog.ExecNonQuery("delete from errores");
RDebugUtils.currentLine=11337730;
 //BA.debugLineNum = 11337730;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=11337731;
 //BA.debugLineNum = 11337731;BA.debugLine="ToastMessageShow(\"BD Errores Borrada\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("BD Errores Borrada"),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=11337732;
 //BA.debugLineNum = 11337732;BA.debugLine="End Sub";
return "";
}
public static String  _deletegps_db(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "deletegps_db", false))
	 {return ((String) Debug.delegate(null, "deletegps_db", new Object[] {_ba}));}
RDebugUtils.currentLine=11272192;
 //BA.debugLineNum = 11272192;BA.debugLine="Sub deleteGPS_DB 'ignore";
RDebugUtils.currentLine=11272193;
 //BA.debugLineNum = 11272193;BA.debugLine="kmt.ExecNonQuery(\"delete from RUTA_GPS\")";
_kmt.ExecNonQuery("delete from RUTA_GPS");
RDebugUtils.currentLine=11272194;
 //BA.debugLineNum = 11272194;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=11272195;
 //BA.debugLineNum = 11272195;BA.debugLine="ToastMessageShow(\"Borramos BD Coords GPS\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Borramos BD Coords GPS"),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=11272196;
 //BA.debugLineNum = 11272196;BA.debugLine="End Sub";
return "";
}
public static long  _fechakmt2ticks(anywheresoftware.b4a.BA _ba,String _fkmt) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "fechakmt2ticks", false))
	 {return ((Long) Debug.delegate(null, "fechakmt2ticks", new Object[] {_ba,_fkmt}));}
String _partefecha = "";
String _partehora = "";
String _origformat = "";
long _ticks = 0L;
RDebugUtils.currentLine=12451840;
 //BA.debugLineNum = 12451840;BA.debugLine="Sub fechaKMT2Ticks(fKMT As String) As Long 'ignore";
RDebugUtils.currentLine=12451841;
 //BA.debugLineNum = 12451841;BA.debugLine="Try";
try {RDebugUtils.currentLine=12451842;
 //BA.debugLineNum = 12451842;BA.debugLine="If fKMT.Length = 12 Then";
if (_fkmt.length()==12) { 
RDebugUtils.currentLine=12451843;
 //BA.debugLineNum = 12451843;BA.debugLine="Private parteFecha As String = fKMT.SubString2(";
_partefecha = _fkmt.substring((int) (0),(int) (6));
RDebugUtils.currentLine=12451844;
 //BA.debugLineNum = 12451844;BA.debugLine="Private parteHora As String = fKMT.SubString(6)";
_partehora = _fkmt.substring((int) (6));
RDebugUtils.currentLine=12451845;
 //BA.debugLineNum = 12451845;BA.debugLine="Private OrigFormat As String = DateTime.DateFor";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=12451846;
 //BA.debugLineNum = 12451846;BA.debugLine="DateTime.DateFormat=\"yymmdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yymmdd");
RDebugUtils.currentLine=12451847;
 //BA.debugLineNum = 12451847;BA.debugLine="DateTime.TimeFormat=\"HHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setTimeFormat("HHmmss");
RDebugUtils.currentLine=12451848;
 //BA.debugLineNum = 12451848;BA.debugLine="Private ticks As Long = DateTime.DateTimeParse(";
_ticks = anywheresoftware.b4a.keywords.Common.DateTime.DateTimeParse(_partefecha,_partehora);
RDebugUtils.currentLine=12451849;
 //BA.debugLineNum = 12451849;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=12451850;
 //BA.debugLineNum = 12451850;BA.debugLine="Return ticks";
if (true) return _ticks;
 }else {
RDebugUtils.currentLine=12451852;
 //BA.debugLineNum = 12451852;BA.debugLine="Log(\"Formato de fecha incorrecto, debe de ser '";
anywheresoftware.b4a.keywords.Common.LogImpl("312451852","Formato de fecha incorrecto, debe de ser 'YYMMDDHHMMSS', no '"+_fkmt+"' largo="+BA.NumberToString(_fkmt.length()),0);
RDebugUtils.currentLine=12451853;
 //BA.debugLineNum = 12451853;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 } 
       catch (Exception e16) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e16);RDebugUtils.currentLine=12451856;
 //BA.debugLineNum = 12451856;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("312451856",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
RDebugUtils.currentLine=12451857;
 //BA.debugLineNum = 12451857;BA.debugLine="LogColor($\"Fecha dada: ${fKMT}, Parte Fecha: ${p";
anywheresoftware.b4a.keywords.Common.LogImpl("312451857",("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);
RDebugUtils.currentLine=12451858;
 //BA.debugLineNum = 12451858;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
RDebugUtils.currentLine=12451860;
 //BA.debugLineNum = 12451860;BA.debugLine="End Sub";
return 0L;
}
public static String  _getphnid(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "getphnid", false))
	 {return ((String) Debug.delegate(null, "getphnid", new Object[] {_ba}));}
String _t = "";
String _s = "";
RDebugUtils.currentLine=10682368;
 //BA.debugLineNum = 10682368;BA.debugLine="Sub getPhnId As String 'ignore";
RDebugUtils.currentLine=10682370;
 //BA.debugLineNum = 10682370;BA.debugLine="devModel = phn.Model";
_devmodel = _phn.getModel();
RDebugUtils.currentLine=10682371;
 //BA.debugLineNum = 10682371;BA.debugLine="If devModel.Length <= 3 Then 'Si phn.Model esta e";
if (_devmodel.length()<=3) { 
RDebugUtils.currentLine=10682372;
 //BA.debugLineNum = 10682372;BA.debugLine="Dim t As String = phn.GetSettings(\"android_id\")";
_t = _phn.GetSettings("android_id");
RDebugUtils.currentLine=10682373;
 //BA.debugLineNum = 10682373;BA.debugLine="devModel = t";
_devmodel = _t;
 };
RDebugUtils.currentLine=10682375;
 //BA.debugLineNum = 10682375;BA.debugLine="If devModel.Length >= 3 Then 'Si tenemos valor pa";
if (_devmodel.length()>=3) { 
RDebugUtils.currentLine=10682376;
 //BA.debugLineNum = 10682376;BA.debugLine="File.WriteString(File.DirInternal, \"phnId.txt\",";
anywheresoftware.b4a.keywords.Common.File.WriteString(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"phnId.txt",_devmodel);
 }else 
{RDebugUtils.currentLine=10682378;
 //BA.debugLineNum = 10682378;BA.debugLine="Else If devModel.Length < 3 Then ' Si no tenemos";
if (_devmodel.length()<3) { 
RDebugUtils.currentLine=10682379;
 //BA.debugLineNum = 10682379;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");
RDebugUtils.currentLine=10682380;
 //BA.debugLineNum = 10682380;BA.debugLine="devModel = s";
_devmodel = _s;
 }}
;
RDebugUtils.currentLine=10682384;
 //BA.debugLineNum = 10682384;BA.debugLine="Return devModel";
if (true) return _devmodel;
RDebugUtils.currentLine=10682385;
 //BA.debugLineNum = 10682385;BA.debugLine="End Sub";
return "";
}
public static String  _getssid(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "getssid", false))
	 {return ((String) Debug.delegate(null, "getssid", new Object[] {_ba}));}
RDebugUtils.currentLine=11534336;
 //BA.debugLineNum = 11534336;BA.debugLine="Sub getSSID  'ignore";
RDebugUtils.currentLine=11534341;
 //BA.debugLineNum = 11534341;BA.debugLine="End Sub";
return "";
}
public static String  _guardainfoenarchivo(anywheresoftware.b4a.BA _ba,String _coords) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "guardainfoenarchivo", false))
	 {return ((String) Debug.delegate(null, "guardainfoenarchivo", new Object[] {_ba,_coords}));}
String _origformat = "";
String _lastupdate = "";
String _ubic = "";
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
String _s = "";
byte[] _t = null;
RDebugUtils.currentLine=11075584;
 //BA.debugLineNum = 11075584;BA.debugLine="Sub guardaInfoEnArchivo(coords As String) 'ignore";
RDebugUtils.currentLine=11075586;
 //BA.debugLineNum = 11075586;BA.debugLine="Dim OrigFormat As String=DateTime.DateFormat  'sa";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=11075587;
 //BA.debugLineNum = 11075587;BA.debugLine="DateTime.DateFormat=\"MMM-dd HH:mm:ss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MMM-dd HH:mm:ss");
RDebugUtils.currentLine=11075588;
 //BA.debugLineNum = 11075588;BA.debugLine="Dim lastUpdate As String=DateTime.Date(DateTime.N";
_lastupdate = anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=11075589;
 //BA.debugLineNum = 11075589;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=11075591;
 //BA.debugLineNum = 11075591;BA.debugLine="Dim ubic As String = coords&\",\"&lastUpdate";
_ubic = _coords+","+_lastupdate;
RDebugUtils.currentLine=11075592;
 //BA.debugLineNum = 11075592;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=11075593;
 //BA.debugLineNum = 11075593;BA.debugLine="Dim s As String = ubic & CRLF";
_s = _ubic+anywheresoftware.b4a.keywords.Common.CRLF;
RDebugUtils.currentLine=11075594;
 //BA.debugLineNum = 11075594;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
RDebugUtils.currentLine=11075595;
 //BA.debugLineNum = 11075595;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
RDebugUtils.currentLine=11075596;
 //BA.debugLineNum = 11075596;BA.debugLine="out.Close";
_out.Close();
RDebugUtils.currentLine=11075597;
 //BA.debugLineNum = 11075597;BA.debugLine="End Sub";
return "";
}
public static String  _guardainfoenbd(anywheresoftware.b4a.BA _ba,String _coords) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "guardainfoenbd", false))
	 {return ((String) Debug.delegate(null, "guardainfoenbd", new Object[] {_ba,_coords}));}
String[] _latlon = null;
RDebugUtils.currentLine=11141120;
 //BA.debugLineNum = 11141120;BA.debugLine="Sub guardaInfoEnBD(coords As String) 'ignore";
RDebugUtils.currentLine=11141121;
 //BA.debugLineNum = 11141121;BA.debugLine="Log(\"Guardamos ubicacion en BD - \"&coords)";
anywheresoftware.b4a.keywords.Common.LogImpl("311141121","Guardamos ubicacion en BD - "+_coords,0);
RDebugUtils.currentLine=11141122;
 //BA.debugLineNum = 11141122;BA.debugLine="Try";
try {RDebugUtils.currentLine=11141123;
 //BA.debugLineNum = 11141123;BA.debugLine="Dim latlon() As String = Regex.Split(\"\\|\", coord";
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split("\\|",_coords);
RDebugUtils.currentLine=11141124;
 //BA.debugLineNum = 11141124;BA.debugLine="If latlon.Length < 2 Then latlon = Regex.Split(\"";
if (_latlon.length<2) { 
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split(",",_coords);};
RDebugUtils.currentLine=11141125;
 //BA.debugLineNum = 11141125;BA.debugLine="If subsLogs Then Log(\"LatLon=\"&latlon)";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("311141125","LatLon="+BA.ObjectToString(_latlon),0);};
RDebugUtils.currentLine=11141126;
 //BA.debugLineNum = 11141126;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);RDebugUtils.currentLine=11141128;
 //BA.debugLineNum = 11141128;BA.debugLine="LogColor(LastException, Colors.red)";
anywheresoftware.b4a.keywords.Common.LogImpl("311141128",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=11141130;
 //BA.debugLineNum = 11141130;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{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "guardaproducto", false))
	 {return ((String) Debug.delegate(null, "guardaproducto", new Object[] {_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
RDebugUtils.currentLine=13500416;
 //BA.debugLineNum = 13500416;BA.debugLine="Sub guardaProducto(cedis As String, costoU As Stri";
RDebugUtils.currentLine=13500417;
 //BA.debugLineNum = 13500417;BA.debugLine="LogColor(\"guardaProducto: \"&prodId&\", cant=\"&cant";
anywheresoftware.b4a.keywords.Common.LogImpl("313500417","guardaProducto: "+_prodid+", cant="+_cant,anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=13500418;
 //BA.debugLineNum = 13500418;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13500419;
 //BA.debugLineNum = 13500419;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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)}));
RDebugUtils.currentLine=13500420;
 //BA.debugLineNum = 13500420;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"update cat_";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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)}));
RDebugUtils.currentLine=13500421;
 //BA.debugLineNum = 13500421;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 /*keymon.lat.medicomed.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)")));
RDebugUtils.currentLine=13500422;
 //BA.debugLineNum = 13500422;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13500423;
 //BA.debugLineNum = 13500423;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");
RDebugUtils.currentLine=13500424;
 //BA.debugLineNum = 13500424;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
RDebugUtils.currentLine=13500425;
 //BA.debugLineNum = 13500425;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"UPDATE kmt_i";
mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE kmt_info set gestion = 2  where CAT_CL_CODIGO In (select cuenta from cuentaa)");
RDebugUtils.currentLine=13500426;
 //BA.debugLineNum = 13500426;BA.debugLine="End Sub";
return "";
}
public static boolean  _haypedido(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "haypedido", false))
	 {return ((Boolean) Debug.delegate(null, "haypedido", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _thisc = null;
boolean _hay = false;
RDebugUtils.currentLine=14811136;
 //BA.debugLineNum = 14811136;BA.debugLine="Sub hayPedido As Boolean";
RDebugUtils.currentLine=14811137;
 //BA.debugLineNum = 14811137;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 /*keymon.lat.medicomed.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)))+"'"))));
RDebugUtils.currentLine=14811138;
 //BA.debugLineNum = 14811138;BA.debugLine="thisC.Position=0";
_thisc.setPosition((int) (0));
RDebugUtils.currentLine=14811139;
 //BA.debugLineNum = 14811139;BA.debugLine="Private hay As Boolean = False";
_hay = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=14811140;
 //BA.debugLineNum = 14811140;BA.debugLine="If thisC.GetInt(\"hayPedido\") > 0 Then hay = True";
if (_thisc.GetInt("hayPedido")>0) { 
_hay = anywheresoftware.b4a.keywords.Common.True;};
RDebugUtils.currentLine=14811142;
 //BA.debugLineNum = 14811142;BA.debugLine="Return hay";
if (true) return _hay;
RDebugUtils.currentLine=14811143;
 //BA.debugLineNum = 14811143;BA.debugLine="End Sub";
return false;
}
public static String  _insertarenglonespruebaenerrorlog(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "insertarenglonespruebaenerrorlog", false))
	 {return ((String) Debug.delegate(null, "insertarenglonespruebaenerrorlog", new Object[] {_ba}));}
int _x = 0;
RDebugUtils.currentLine=12320768;
 //BA.debugLineNum = 12320768;BA.debugLine="Sub insertaRenglonesPruebaEnErrorLog 'ignore";
RDebugUtils.currentLine=12320769;
 //BA.debugLineNum = 12320769;BA.debugLine="revisaBD";
_revisabd(_ba);
RDebugUtils.currentLine=12320770;
 //BA.debugLineNum = 12320770;BA.debugLine="Log(\"insertamos 50 renglones a errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("312320770","insertamos 50 renglones a errorLog",0);
RDebugUtils.currentLine=12320771;
 //BA.debugLineNum = 12320771;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 ) {
RDebugUtils.currentLine=12320772;
 //BA.debugLineNum = 12320772;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")}));
RDebugUtils.currentLine=12320773;
 //BA.debugLineNum = 12320773;BA.debugLine="Log(x)";
anywheresoftware.b4a.keywords.Common.LogImpl("312320773",BA.NumberToString(_x),0);
 }
};
RDebugUtils.currentLine=12320775;
 //BA.debugLineNum = 12320775;BA.debugLine="End Sub";
return "";
}
public static String  _installapk(anywheresoftware.b4a.BA _ba,String _dir,String _apk) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "installapk", false))
	 {return ((String) Debug.delegate(null, "installapk", new Object[] {_ba,_dir,_apk}));}
anywheresoftware.b4a.objects.IntentWrapper _i = null;
RDebugUtils.currentLine=12517376;
 //BA.debugLineNum = 12517376;BA.debugLine="Sub InstallAPK(dir As String, apk As String) 'igno";
RDebugUtils.currentLine=12517377;
 //BA.debugLineNum = 12517377;BA.debugLine="If File.Exists(dir, apk) Then";
if (anywheresoftware.b4a.keywords.Common.File.Exists(_dir,_apk)) { 
RDebugUtils.currentLine=12517378;
 //BA.debugLineNum = 12517378;BA.debugLine="Dim i As Intent";
_i = new anywheresoftware.b4a.objects.IntentWrapper();
RDebugUtils.currentLine=12517379;
 //BA.debugLineNum = 12517379;BA.debugLine="i.Initialize(i.ACTION_VIEW, \"file://\" & File.Com";
_i.Initialize(_i.ACTION_VIEW,"file://"+anywheresoftware.b4a.keywords.Common.File.Combine(_dir,_apk));
RDebugUtils.currentLine=12517380;
 //BA.debugLineNum = 12517380;BA.debugLine="i.SetType(\"application/vnd.android.package-archi";
_i.SetType("application/vnd.android.package-archive");
RDebugUtils.currentLine=12517381;
 //BA.debugLineNum = 12517381;BA.debugLine="StartActivity(i)";
anywheresoftware.b4a.keywords.Common.StartActivity((_ba.processBA == null ? _ba : _ba.processBA),(Object)(_i.getObject()));
 };
RDebugUtils.currentLine=12517383;
 //BA.debugLineNum = 12517383;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _json2map(anywheresoftware.b4a.BA _ba,String _thejson) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "json2map", false))
	 {return ((anywheresoftware.b4a.objects.collections.Map) Debug.delegate(null, "json2map", new Object[] {_ba,_thejson}));}
anywheresoftware.b4a.objects.collections.JSONParser _json = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
RDebugUtils.currentLine=11599872;
 //BA.debugLineNum = 11599872;BA.debugLine="Sub JSON2Map(theJson As String) As Map 'ignore";
RDebugUtils.currentLine=11599874;
 //BA.debugLineNum = 11599874;BA.debugLine="Try";
try {RDebugUtils.currentLine=11599875;
 //BA.debugLineNum = 11599875;BA.debugLine="Private json As JSONParser";
_json = new anywheresoftware.b4a.objects.collections.JSONParser();
RDebugUtils.currentLine=11599876;
 //BA.debugLineNum = 11599876;BA.debugLine="json.Initialize(theJson)";
_json.Initialize(_thejson);
RDebugUtils.currentLine=11599877;
 //BA.debugLineNum = 11599877;BA.debugLine="Return json.NextObject";
if (true) return _json.NextObject();
 } 
       catch (Exception e6) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e6);RDebugUtils.currentLine=11599879;
 //BA.debugLineNum = 11599879;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("311599879",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
RDebugUtils.currentLine=11599880;
 //BA.debugLineNum = 11599880;BA.debugLine="log2DB(\"JSON2Map: \"&LastException)";
_log2db(_ba,"JSON2Map: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)));
RDebugUtils.currentLine=11599881;
 //BA.debugLineNum = 11599881;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())});
RDebugUtils.currentLine=11599882;
 //BA.debugLineNum = 11599882;BA.debugLine="Return m";
if (true) return _m;
 };
RDebugUtils.currentLine=11599884;
 //BA.debugLineNum = 11599884;BA.debugLine="End Sub";
return null;
}
public static String  _log2db(anywheresoftware.b4a.BA _ba,String _texto) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "log2db", false))
	 {return ((String) Debug.delegate(null, "log2db", new Object[] {_ba,_texto}));}
RDebugUtils.currentLine=11796480;
 //BA.debugLineNum = 11796480;BA.debugLine="Sub log2DB(texto As String) 'ignore";
RDebugUtils.currentLine=11796481;
 //BA.debugLineNum = 11796481;BA.debugLine="LogColor(fechaKMT(DateTime.Now)&\" - log2BD: '\"&te";
anywheresoftware.b4a.keywords.Common.LogImpl("311796481",_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))+" - log2BD: '"+_texto+"'",anywheresoftware.b4a.keywords.Common.Colors.LightGray);
RDebugUtils.currentLine=11796482;
 //BA.debugLineNum = 11796482;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)}));
RDebugUtils.currentLine=11796483;
 //BA.debugLineNum = 11796483;BA.debugLine="End Sub";
return "";
}
public static String  _map2json(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _m) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "map2json", false))
	 {return ((String) Debug.delegate(null, "map2json", new Object[] {_ba,_m}));}
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _jg = null;
String _t = "";
RDebugUtils.currentLine=11665408;
 //BA.debugLineNum = 11665408;BA.debugLine="Sub map2JSON(m As Map) As String 'ignore";
RDebugUtils.currentLine=11665411;
 //BA.debugLineNum = 11665411;BA.debugLine="Dim jg As JSONGenerator";
_jg = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
RDebugUtils.currentLine=11665412;
 //BA.debugLineNum = 11665412;BA.debugLine="jg.Initialize(m)";
_jg.Initialize(_m);
RDebugUtils.currentLine=11665413;
 //BA.debugLineNum = 11665413;BA.debugLine="Dim t As String = jg.ToString";
_t = _jg.ToString();
RDebugUtils.currentLine=11665414;
 //BA.debugLineNum = 11665414;BA.debugLine="Return t";
if (true) return _t;
RDebugUtils.currentLine=11665415;
 //BA.debugLineNum = 11665415;BA.debugLine="End Sub";
return "";
}
public static boolean  _masdexxmins(anywheresoftware.b4a.BA _ba,int _hora,int _mins) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "masdexxmins", false))
	 {return ((Boolean) Debug.delegate(null, "masdexxmins", new Object[] {_ba,_hora,_mins}));}
RDebugUtils.currentLine=11862016;
 //BA.debugLineNum = 11862016;BA.debugLine="Sub masDeXXMins(hora As Int, mins As Int) As Boole";
RDebugUtils.currentLine=11862017;
 //BA.debugLineNum = 11862017;BA.debugLine="If (hora + mins * DateTime.TicksPerMinute) < Date";
if ((_hora+_mins*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerMinute)<anywheresoftware.b4a.keywords.Common.DateTime.getNow()) { 
RDebugUtils.currentLine=11862018;
 //BA.debugLineNum = 11862018;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
RDebugUtils.currentLine=11862020;
 //BA.debugLineNum = 11862020;BA.debugLine="Return False";
if (true) return anywheresoftware.b4a.keywords.Common.False;
 };
RDebugUtils.currentLine=11862022;
 //BA.debugLineNum = 11862022;BA.debugLine="End Sub";
return false;
}
public static boolean  _masdexxminskmt(anywheresoftware.b4a.BA _ba,String _hora,int _mins) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "masdexxminskmt", false))
	 {return ((Boolean) Debug.delegate(null, "masdexxminskmt", new Object[] {_ba,_hora,_mins}));}
RDebugUtils.currentLine=11927552;
 //BA.debugLineNum = 11927552;BA.debugLine="Sub masDeXXMinsKMT(hora As String, mins As Int) As";
RDebugUtils.currentLine=11927553;
 //BA.debugLineNum = 11927553;BA.debugLine="Try";
try {RDebugUtils.currentLine=11927555;
 //BA.debugLineNum = 11927555;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()) { 
RDebugUtils.currentLine=11927557;
 //BA.debugLineNum = 11927557;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
RDebugUtils.currentLine=11927560;
 //BA.debugLineNum = 11927560;BA.debugLine="Return False";
if (true) return anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e8) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e8);RDebugUtils.currentLine=11927563;
 //BA.debugLineNum = 11927563;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("311927563",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
RDebugUtils.currentLine=11927565;
 //BA.debugLineNum = 11927565;BA.debugLine="End Sub";
return false;
}
public static String  _notihigh(anywheresoftware.b4a.BA _ba,String _title,String _body,Object _activity) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "notihigh", false))
	 {return ((String) Debug.delegate(null, "notihigh", new Object[] {_ba,_title,_body,_activity}));}
anywheresoftware.b4a.objects.NotificationWrapper _notif = null;
RDebugUtils.currentLine=10944512;
 //BA.debugLineNum = 10944512;BA.debugLine="Sub notiHigh(title As String, body As String, acti";
RDebugUtils.currentLine=10944513;
 //BA.debugLineNum = 10944513;BA.debugLine="Private notif As Notification";
_notif = new anywheresoftware.b4a.objects.NotificationWrapper();
RDebugUtils.currentLine=10944514;
 //BA.debugLineNum = 10944514;BA.debugLine="notif.Initialize2(notif.IMPORTANCE_HIGH)";
_notif.Initialize2(_notif.IMPORTANCE_HIGH);
RDebugUtils.currentLine=10944515;
 //BA.debugLineNum = 10944515;BA.debugLine="notif.Icon = \"icon\"";
_notif.setIcon("icon");
RDebugUtils.currentLine=10944516;
 //BA.debugLineNum = 10944516;BA.debugLine="notif.Vibrate = False";
_notif.setVibrate(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=10944517;
 //BA.debugLineNum = 10944517;BA.debugLine="notif.Sound = False";
_notif.setSound(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=10944518;
 //BA.debugLineNum = 10944518;BA.debugLine="notif.AutoCancel = True";
_notif.setAutoCancel(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=10944519;
 //BA.debugLineNum = 10944519;BA.debugLine="Log(\"notiHigh: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("310944519","notiHigh: "+_title,0);
RDebugUtils.currentLine=10944520;
 //BA.debugLineNum = 10944520;BA.debugLine="notif.SetInfo(title, body, activity)";
_notif.SetInfoNew((_ba.processBA == null ? _ba : _ba.processBA),BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),_activity);
RDebugUtils.currentLine=10944522;
 //BA.debugLineNum = 10944522;BA.debugLine="notif.Notify(777)";
_notif.Notify((int) (777));
RDebugUtils.currentLine=10944523;
 //BA.debugLineNum = 10944523;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.NotificationWrapper  _notilowreturn(anywheresoftware.b4a.BA _ba,String _title,String _body,int _id) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "notilowreturn", false))
	 {return ((anywheresoftware.b4a.objects.NotificationWrapper) Debug.delegate(null, "notilowreturn", new Object[] {_ba,_title,_body,_id}));}
anywheresoftware.b4a.objects.NotificationWrapper _notification = null;
RDebugUtils.currentLine=11010048;
 //BA.debugLineNum = 11010048;BA.debugLine="Sub notiLowReturn(title As String, Body As String,";
RDebugUtils.currentLine=11010049;
 //BA.debugLineNum = 11010049;BA.debugLine="Private notification As Notification";
_notification = new anywheresoftware.b4a.objects.NotificationWrapper();
RDebugUtils.currentLine=11010050;
 //BA.debugLineNum = 11010050;BA.debugLine="notification.Initialize2(notification.IMPORTANCE_";
_notification.Initialize2(_notification.IMPORTANCE_LOW);
RDebugUtils.currentLine=11010051;
 //BA.debugLineNum = 11010051;BA.debugLine="Log(\"notiLowReturn: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("311010051","notiLowReturn: "+_title,0);
RDebugUtils.currentLine=11010052;
 //BA.debugLineNum = 11010052;BA.debugLine="notification.Icon = \"icon\"";
_notification.setIcon("icon");
RDebugUtils.currentLine=11010053;
 //BA.debugLineNum = 11010053;BA.debugLine="notification.Sound = False";
_notification.setSound(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=11010054;
 //BA.debugLineNum = 11010054;BA.debugLine="notification.Vibrate = False";
_notification.setVibrate(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=11010055;
 //BA.debugLineNum = 11010055;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()));
RDebugUtils.currentLine=11010056;
 //BA.debugLineNum = 11010056;BA.debugLine="notification.Notify(id)";
_notification.Notify(_id);
RDebugUtils.currentLine=11010058;
 //BA.debugLineNum = 11010058;BA.debugLine="Return notification";
if (true) return _notification;
RDebugUtils.currentLine=11010059;
 //BA.debugLineNum = 11010059;BA.debugLine="End Sub";
return null;
}
public static anywheresoftware.b4a.objects.collections.Map  _procesapromocion(anywheresoftware.b4a.BA _ba,String _idpromo,String _cliente) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "procesapromocion", false))
	 {return ((anywheresoftware.b4a.objects.collections.Map) Debug.delegate(null, "procesapromocion", new Object[] {_ba,_idpromo,_cliente}));}
boolean _thislog = false;
String _iniciocontador = "";
anywheresoftware.b4a.objects.collections.Map _pm = null;
anywheresoftware.b4a.objects.collections.Map _inventariosinfijos = null;
boolean _pv = false;
RDebugUtils.currentLine=14090240;
 //BA.debugLineNum = 14090240;BA.debugLine="Sub procesaPromocion(idPromo As String, cliente As";
RDebugUtils.currentLine=14090241;
 //BA.debugLineNum = 14090241;BA.debugLine="Private thisLog As Boolean = False  'Si es verdad";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=14090242;
 //BA.debugLineNum = 14090242;BA.debugLine="Private inicioContador As String = DateTime.Now";
_iniciocontador = BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=14090243;
 //BA.debugLineNum = 14090243;BA.debugLine="If thisLog Then LogColor($\"********* Iniciamos re";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314090243",("********* Iniciamos revision de Promo "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idpromo))+" *********"),anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
RDebugUtils.currentLine=14090245;
 //BA.debugLineNum = 14090245;BA.debugLine="Private pm As Map = traePromo(idPromo, cliente)";
_pm = new anywheresoftware.b4a.objects.collections.Map();
_pm = _traepromo(_ba,_idpromo,_cliente);
RDebugUtils.currentLine=14090246;
 //BA.debugLineNum = 14090246;BA.debugLine="If thisLog Then LogColor(pm, Colors.Blue)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314090246",BA.ObjectToString(_pm),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14090247;
 //BA.debugLineNum = 14090247;BA.debugLine="If pm.Get(\"resultado\") = \"ok\" Then 'Si encontramo";
if ((_pm.Get((Object)("resultado"))).equals((Object)("ok"))) { 
RDebugUtils.currentLine=14090249;
 //BA.debugLineNum = 14090249;BA.debugLine="If thisLog Then LogColor($\"Promociones permitida";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314090249",("Promociones permitidas="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traemaxpromos(_ba,_pm)))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14090250;
 //BA.debugLineNum = 14090250;BA.debugLine="If thisLog Then Log(\"Promos vendidas: \" & traePr";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314090250","Promos vendidas: "+BA.NumberToString(_traepromosvendidas(_ba,_idpromo,_cliente)),0);};
RDebugUtils.currentLine=14090251;
 //BA.debugLineNum = 14090251;BA.debugLine="If traePromosVendidas(idPromo, cliente) >= traeM";
if (_traepromosvendidas(_ba,_idpromo,_cliente)>=_traemaxpromos(_ba,_pm)) { 
RDebugUtils.currentLine=14090252;
 //BA.debugLineNum = 14090252;BA.debugLine="If thisLog Then LogColor(\"Ya se vendieron las p";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314090252","Ya se vendieron las promos PERMITIDAS para el cliente",anywheresoftware.b4a.keywords.Common.Colors.Red);};
RDebugUtils.currentLine=14090253;
 //BA.debugLineNum = 14090253;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())});
 };
RDebugUtils.currentLine=14090256;
 //BA.debugLineNum = 14090256;BA.debugLine="Private inventarioSinFijos As Map = restaFijosPr";
_inventariosinfijos = new anywheresoftware.b4a.objects.collections.Map();
_inventariosinfijos = _restafijospromo(_ba,_pm);
RDebugUtils.currentLine=14090257;
 //BA.debugLineNum = 14090257;BA.debugLine="If thisLog Then LogColor(\"inventariosfijos=\"&inv";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314090257","inventariosfijos="+BA.ObjectToString(_inventariosinfijos),anywheresoftware.b4a.keywords.Common.Colors.Green);};
RDebugUtils.currentLine=14090259;
 //BA.debugLineNum = 14090259;BA.debugLine="If inventarioSinFijos.Get(\"resultado\") = \"ok\" Th";
if ((_inventariosinfijos.Get((Object)("resultado"))).equals((Object)("ok"))) { 
RDebugUtils.currentLine=14090261;
 //BA.debugLineNum = 14090261;BA.debugLine="Private pv As Boolean =  alcanzanLosVariablesPa";
_pv = _alcanzanlosvariablesparapromo(_ba,_pm,_inventariosinfijos);
RDebugUtils.currentLine=14090262;
 //BA.debugLineNum = 14090262;BA.debugLine="If thisLog Then Log(\"Alcanzan los variables? --";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314090262","Alcanzan los variables? --> "+BA.ObjectToString(_pv),0);};
RDebugUtils.currentLine=14090263;
 //BA.debugLineNum = 14090263;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 {
RDebugUtils.currentLine=14090265;
 //BA.debugLineNum = 14090265;BA.debugLine="If thisLog Then LogColor(\"NO HAY INVENTARIO SUF";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314090265","NO HAY INVENTARIO SUFICIENTE "+_idpromo,anywheresoftware.b4a.keywords.Common.Colors.Red);};
RDebugUtils.currentLine=14090266;
 //BA.debugLineNum = 14090266;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())});
 };
 };
RDebugUtils.currentLine=14090272;
 //BA.debugLineNum = 14090272;BA.debugLine="LogColor(\"TIEMPO DE PROCESO ESTA PROMO: \" & ((Dat";
anywheresoftware.b4a.keywords.Common.LogImpl("314090272","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);
RDebugUtils.currentLine=14090273;
 //BA.debugLineNum = 14090273;BA.debugLine="End Sub";
return null;
}
public static anywheresoftware.b4a.objects.collections.Map  _traepromo(anywheresoftware.b4a.BA _ba,String _promo,String _cliente) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traepromo", false))
	 {return ((anywheresoftware.b4a.objects.collections.Map) Debug.delegate(null, "traepromo", new Object[] {_ba,_promo,_cliente}));}
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.Map _prods = null;
anywheresoftware.b4a.objects.collections.Map _tipos = null;
int _i = 0;
String _pvr = "";
RDebugUtils.currentLine=13697024;
 //BA.debugLineNum = 13697024;BA.debugLine="Sub traePromo(promo As String, cliente As String)";
RDebugUtils.currentLine=13697025;
 //BA.debugLineNum = 13697025;BA.debugLine="Private inicioContador As String = DateTime.Now";
_iniciocontador = BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=13697026;
 //BA.debugLineNum = 13697026;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select * from promos_comp where cat_pa_id = '"+_promo+"'")));
RDebugUtils.currentLine=13697027;
 //BA.debugLineNum = 13697027;BA.debugLine="Private siHistorico As String = 0";
_sihistorico = BA.NumberToString(0);
RDebugUtils.currentLine=13697028;
 //BA.debugLineNum = 13697028;BA.debugLine="Private promoMap As Map";
_promomap = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=13697029;
 //BA.debugLineNum = 13697029;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();
RDebugUtils.currentLine=13697030;
 //BA.debugLineNum = 13697030;BA.debugLine="promoMap.Initialize";
_promomap.Initialize();
RDebugUtils.currentLine=13697031;
 //BA.debugLineNum = 13697031;BA.debugLine="prodsFijos.Initialize";
_prodsfijos.Initialize();
RDebugUtils.currentLine=13697032;
 //BA.debugLineNum = 13697032;BA.debugLine="prodsFijosPrecios.Initialize";
_prodsfijosprecios.Initialize();
RDebugUtils.currentLine=13697033;
 //BA.debugLineNum = 13697033;BA.debugLine="prodsFijosPiezas.Initialize";
_prodsfijospiezas.Initialize();
RDebugUtils.currentLine=13697034;
 //BA.debugLineNum = 13697034;BA.debugLine="prodsVariables.Initialize";
_prodsvariables.Initialize();
RDebugUtils.currentLine=13697035;
 //BA.debugLineNum = 13697035;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13697036;
 //BA.debugLineNum = 13697036;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"))});};
RDebugUtils.currentLine=13697037;
 //BA.debugLineNum = 13697037;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select count(*) as hist from HIST_PROMOS where HP_CLIENTE = '"+_cliente+"' and HP_CODIGO_PROMOCION = '"+_promo+"'")));
RDebugUtils.currentLine=13697038;
 //BA.debugLineNum = 13697038;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13697039;
 //BA.debugLineNum = 13697039;BA.debugLine="If c.GetString(\"hist\") > 0 Then siHistorico = 1";
if ((double)(Double.parseDouble(_c.GetString("hist")))>0) { 
_sihistorico = BA.NumberToString(1);};
RDebugUtils.currentLine=13697040;
 //BA.debugLineNum = 13697040;BA.debugLine="promoMap.Put(\"historico\", siHistorico)";
_promomap.Put((Object)("historico"),(Object)(_sihistorico));
RDebugUtils.currentLine=13697041;
 //BA.debugLineNum = 13697041;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select * from CAT_DETALLES_PAQ where CAT_DP_ID = '"+_promo+"'")));
RDebugUtils.currentLine=13697042;
 //BA.debugLineNum = 13697042;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13697043;
 //BA.debugLineNum = 13697043;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=13697044;
 //BA.debugLineNum = 13697044;BA.debugLine="Private prods, tipos As Map";
_prods = new anywheresoftware.b4a.objects.collections.Map();
_tipos = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=13697045;
 //BA.debugLineNum = 13697045;BA.debugLine="prods.Initialize";
_prods.Initialize();
RDebugUtils.currentLine=13697046;
 //BA.debugLineNum = 13697046;BA.debugLine="tipos.Initialize";
_tipos.Initialize();
RDebugUtils.currentLine=13697047;
 //BA.debugLineNum = 13697047;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step23 = 1;
final int limit23 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit23 ;_i = _i + step23 ) {
RDebugUtils.currentLine=13697048;
 //BA.debugLineNum = 13697048;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=13697049;
 //BA.debugLineNum = 13697049;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()));
RDebugUtils.currentLine=13697050;
 //BA.debugLineNum = 13697050;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")));
RDebugUtils.currentLine=13697051;
 //BA.debugLineNum = 13697051;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"0\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("0")) { 
RDebugUtils.currentLine=13697052;
 //BA.debugLineNum = 13697052;BA.debugLine="prodsFijos.Add(c.GetString(\"CAT_DP_IDPROD\"))";
_prodsfijos.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
RDebugUtils.currentLine=13697053;
 //BA.debugLineNum = 13697053;BA.debugLine="prodsFijosPrecios.Add(c.GetString(\"CAT_DP_PREC";
_prodsfijosprecios.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
RDebugUtils.currentLine=13697054;
 //BA.debugLineNum = 13697054;BA.debugLine="prodsFijosPiezas.Add(c.GetString(\"CAT_DP_PZAS\"";
_prodsfijospiezas.Add((Object)(_c.GetString("CAT_DP_PZAS")));
 };
RDebugUtils.currentLine=13697056;
 //BA.debugLineNum = 13697056;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"1\" Then prodsV";
if ((_c.GetString("CAT_DP_TIPO")).equals("1")) { 
_prodsvariables.Add((Object)(_c.GetString("CAT_DP_IDPROD")));};
 }
};
RDebugUtils.currentLine=13697059;
 //BA.debugLineNum = 13697059;BA.debugLine="promoMap.Put(\"productos\", prods) 'Mapa con los p";
_promomap.Put((Object)("productos"),(Object)(_prods.getObject()));
RDebugUtils.currentLine=13697060;
 //BA.debugLineNum = 13697060;BA.debugLine="promoMap.Put(\"tipos\", tipos) 'Mapa con los produ";
_promomap.Put((Object)("tipos"),(Object)(_tipos.getObject()));
RDebugUtils.currentLine=13697061;
 //BA.debugLineNum = 13697061;BA.debugLine="promoMap.Put(\"prodsFijos\", prodsFijos) 'Lista de";
_promomap.Put((Object)("prodsFijos"),(Object)(_prodsfijos.getObject()));
RDebugUtils.currentLine=13697062;
 //BA.debugLineNum = 13697062;BA.debugLine="promoMap.Put(\"prodsVariables\", prodsVariables) '";
_promomap.Put((Object)("prodsVariables"),(Object)(_prodsvariables.getObject()));
RDebugUtils.currentLine=13697063;
 //BA.debugLineNum = 13697063;BA.debugLine="promoMap.Put(\"prodsFijosCant\", prodsFijos.Size)";
_promomap.Put((Object)("prodsFijosCant"),(Object)(_prodsfijos.getSize()));
RDebugUtils.currentLine=13697064;
 //BA.debugLineNum = 13697064;BA.debugLine="promoMap.Put(\"prodsFijosPrecios\", prodsFijosPrec";
_promomap.Put((Object)("prodsFijosPrecios"),(Object)(_prodsfijosprecios.getObject()));
RDebugUtils.currentLine=13697065;
 //BA.debugLineNum = 13697065;BA.debugLine="promoMap.Put(\"prodsFijosPiezas\", prodsFijosPieza";
_promomap.Put((Object)("prodsFijosPiezas"),(Object)(_prodsfijospiezas.getObject()));
RDebugUtils.currentLine=13697066;
 //BA.debugLineNum = 13697066;BA.debugLine="promoMap.Put(\"prodsVariablesCant\", prodsVariable";
_promomap.Put((Object)("prodsVariablesCant"),(Object)(_prodsvariables.getSize()));
RDebugUtils.currentLine=13697067;
 //BA.debugLineNum = 13697067;BA.debugLine="promoMap.Put(\"resultado\", \"ok\")";
_promomap.Put((Object)("resultado"),(Object)("ok"));
 }else {
RDebugUtils.currentLine=13697069;
 //BA.debugLineNum = 13697069;BA.debugLine="promoMap.Put(\"resultado\", \"No hay datos de la pr";
_promomap.Put((Object)("resultado"),(Object)("No hay datos de la promoción."));
 };
RDebugUtils.currentLine=13697071;
 //BA.debugLineNum = 13697071;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 /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select CAT_GP_STS, CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = '"+_promo+"'")));
RDebugUtils.currentLine=13697072;
 //BA.debugLineNum = 13697072;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13697073;
 //BA.debugLineNum = 13697073;BA.debugLine="Private pvr As String = 0";
_pvr = BA.NumberToString(0);
RDebugUtils.currentLine=13697074;
 //BA.debugLineNum = 13697074;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=13697075;
 //BA.debugLineNum = 13697075;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13697076;
 //BA.debugLineNum = 13697076;BA.debugLine="pvr = c.GetString(\"CAT_GP_STS\")";
_pvr = _c.GetString("CAT_GP_STS");
RDebugUtils.currentLine=13697077;
 //BA.debugLineNum = 13697077;BA.debugLine="promoMap.Put(\"prodsVariablesRequeridos\", pvr) 'C";
_promomap.Put((Object)("prodsVariablesRequeridos"),(Object)(_pvr));
RDebugUtils.currentLine=13697078;
 //BA.debugLineNum = 13697078;BA.debugLine="promoMap.put(\"descripcion\", c.GetString(\"CAT_GP_";
_promomap.Put((Object)("descripcion"),(Object)(_c.GetString("CAT_GP_NOMBRE")));
 };
RDebugUtils.currentLine=13697080;
 //BA.debugLineNum = 13697080;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=13697085;
 //BA.debugLineNum = 13697085;BA.debugLine="Return promoMap";
if (true) return _promomap;
RDebugUtils.currentLine=13697086;
 //BA.debugLineNum = 13697086;BA.debugLine="End Sub";
return null;
}
public static int  _traemaxpromos(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _pm) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traemaxpromos", false))
	 {return ((Integer) Debug.delegate(null, "traemaxpromos", new Object[] {_ba,_pm}));}
boolean _thislog = false;
anywheresoftware.b4a.objects.collections.List _maxpromos = null;
int _vendidas = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
RDebugUtils.currentLine=13959168;
 //BA.debugLineNum = 13959168;BA.debugLine="Sub traeMaxPromos(pm As Map) As Int";
RDebugUtils.currentLine=13959169;
 //BA.debugLineNum = 13959169;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=13959170;
 //BA.debugLineNum = 13959170;BA.debugLine="Private maxPromos As List";
_maxpromos = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=13959171;
 //BA.debugLineNum = 13959171;BA.debugLine="Private vendidas As Int = 0";
_vendidas = (int) (0);
RDebugUtils.currentLine=13959172;
 //BA.debugLineNum = 13959172;BA.debugLine="maxPromos.Initialize";
_maxpromos.Initialize();
RDebugUtils.currentLine=13959174;
 //BA.debugLineNum = 13959174;BA.debugLine="If thisLog Then Log(pm)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313959174",BA.ObjectToString(_pm),0);};
RDebugUtils.currentLine=13959175;
 //BA.debugLineNum = 13959175;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")));};
RDebugUtils.currentLine=13959176;
 //BA.debugLineNum = 13959176;BA.debugLine="maxPromos.Add(pm.Get(\"maxPromos\")) 'Agregamos max";
_maxpromos.Add(_pm.Get((Object)("maxPromos")));
RDebugUtils.currentLine=13959177;
 //BA.debugLineNum = 13959177;BA.debugLine="maxPromos.Add(pm.Get(\"maxXcliente\")) 'Agregamos m";
_maxpromos.Add(_pm.Get((Object)("maxXcliente")));
RDebugUtils.currentLine=13959178;
 //BA.debugLineNum = 13959178;BA.debugLine="maxPromos.Sort(True)";
_maxpromos.Sort(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=13959181;
 //BA.debugLineNum = 13959181;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 /*keymon.lat.medicomed.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()})));
RDebugUtils.currentLine=13959182;
 //BA.debugLineNum = 13959182;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=13959183;
 //BA.debugLineNum = 13959183;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=13959184;
 //BA.debugLineNum = 13959184;BA.debugLine="vendidas = c.GetInt(\"vendidas\")";
_vendidas = _c.GetInt("vendidas");
 };
RDebugUtils.currentLine=13959191;
 //BA.debugLineNum = 13959191;BA.debugLine="Return maxPromos.Get(0) - vendidas 'Regresamos el";
if (true) return (int) ((double)(BA.ObjectToNumber(_maxpromos.Get((int) (0))))-_vendidas);
RDebugUtils.currentLine=13959192;
 //BA.debugLineNum = 13959192;BA.debugLine="End Sub";
return 0;
}
public static int  _traepromosvendidas(anywheresoftware.b4a.BA _ba,String _promo,String _cliente) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traepromosvendidas", false))
	 {return ((Integer) Debug.delegate(null, "traepromosvendidas", new Object[] {_ba,_promo,_cliente}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _pv = 0;
RDebugUtils.currentLine=14024704;
 //BA.debugLineNum = 14024704;BA.debugLine="Sub traePromosVendidas(promo As String, cliente As";
RDebugUtils.currentLine=14024705;
 //BA.debugLineNum = 14024705;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=14024706;
 //BA.debugLineNum = 14024706;BA.debugLine="Private pv As Int = 0";
_pv = (int) (0);
RDebugUtils.currentLine=14024707;
 //BA.debugLineNum = 14024707;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 /*keymon.lat.medicomed.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))+"'"))));
RDebugUtils.currentLine=14024708;
 //BA.debugLineNum = 14024708;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=14024709;
 //BA.debugLineNum = 14024709;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=14024710;
 //BA.debugLineNum = 14024710;BA.debugLine="pv = c.GetInt(\"PE_CANT\")";
_pv = _c.GetInt("PE_CANT");
 };
RDebugUtils.currentLine=14024712;
 //BA.debugLineNum = 14024712;BA.debugLine="Return pv";
if (true) return _pv;
RDebugUtils.currentLine=14024713;
 //BA.debugLineNum = 14024713;BA.debugLine="End Sub";
return 0;
}
public static anywheresoftware.b4a.objects.collections.Map  _restafijospromo(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _promomap) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "restafijospromo", false))
	 {return ((anywheresoftware.b4a.objects.collections.Map) Debug.delegate(null, "restafijospromo", new Object[] {_ba,_promomap}));}
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;
RDebugUtils.currentLine=13828096;
 //BA.debugLineNum = 13828096;BA.debugLine="Sub restaFijosPromo(promoMap As Map) As Map 'ignor";
RDebugUtils.currentLine=13828097;
 //BA.debugLineNum = 13828097;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=13828098;
 //BA.debugLineNum = 13828098;BA.debugLine="Private inventariosDisponiblesParaEstaPromo As Ma";
_inventariosdisponiblesparaestapromo = new anywheresoftware.b4a.objects.collections.Map();
_inventariosdisponiblesparaestapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_promomap.Get((Object)("id"))));
RDebugUtils.currentLine=13828099;
 //BA.debugLineNum = 13828099;BA.debugLine="If thisLog Then LogColor(inventariosDisponiblesPa";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313828099",BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Red);};
RDebugUtils.currentLine=13828100;
 //BA.debugLineNum = 13828100;BA.debugLine="If thisLog Then LogColor(\"Inventario inicial ante";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313828100","Inventario inicial antes de FIJOS: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Gray);};
RDebugUtils.currentLine=13828101;
 //BA.debugLineNum = 13828101;BA.debugLine="Private i As Int";
_i = 0;
RDebugUtils.currentLine=13828102;
 //BA.debugLineNum = 13828102;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"))));
RDebugUtils.currentLine=13828103;
 //BA.debugLineNum = 13828103;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"))));
RDebugUtils.currentLine=13828104;
 //BA.debugLineNum = 13828104;BA.debugLine="For p = 0 To prodsFijos.Size - 1";
{
final int step8 = 1;
final int limit8 = (int) (_prodsfijos.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit8 ;_p = _p + step8 ) {
RDebugUtils.currentLine=13828105;
 //BA.debugLineNum = 13828105;BA.debugLine="Private t As String = prodsFijos.Get(p) 'Obtenem";
_t = BA.ObjectToString(_prodsfijos.Get(_p));
RDebugUtils.currentLine=13828106;
 //BA.debugLineNum = 13828106;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))));
RDebugUtils.currentLine=13828107;
 //BA.debugLineNum = 13828107;BA.debugLine="If thisLog Then Log($\"T: ${t}, prod ${p2.Get(\"id";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313828107",("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);};
RDebugUtils.currentLine=13828108;
 //BA.debugLineNum = 13828108;BA.debugLine="If thisLog Then Log(\"inventariosDisponiblesParaE";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313828108","inventariosDisponiblesParaEstaPromo="+BA.ObjectToString(_inventariosdisponiblesparaestapromo),0);};
RDebugUtils.currentLine=13828109;
 //BA.debugLineNum = 13828109;BA.debugLine="If inventariosDisponiblesParaEstaPromo.ContainsK";
if (_inventariosdisponiblesparaestapromo.ContainsKey((Object)(_t))) { 
RDebugUtils.currentLine=13828110;
 //BA.debugLineNum = 13828110;BA.debugLine="i = inventariosDisponiblesParaEstaPromo.get(t)";
_i = (int)(BA.ObjectToNumber(_inventariosdisponiblesparaestapromo.Get((Object)(_t))));
RDebugUtils.currentLine=13828111;
 //BA.debugLineNum = 13828111;BA.debugLine="If thisLog Then Log($\"Nuevo inventario de ${t}:";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313828111",("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);};
RDebugUtils.currentLine=13828112;
 //BA.debugLineNum = 13828112;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)))))+"")));
RDebugUtils.currentLine=13828113;
 //BA.debugLineNum = 13828113;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ok"));
 }else {
RDebugUtils.currentLine=13828115;
 //BA.debugLineNum = 13828115;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("No hay suficiente producto para la promocion."));
RDebugUtils.currentLine=13828116;
 //BA.debugLineNum = 13828116;BA.debugLine="LogColor(\"Sin suficiente inventario fijo: \" & t";
anywheresoftware.b4a.keywords.Common.LogImpl("313828116","Sin suficiente inventario fijo: "+_t,anywheresoftware.b4a.keywords.Common.Colors.Blue);
RDebugUtils.currentLine=13828117;
 //BA.debugLineNum = 13828117;BA.debugLine="Exit";
if (true) break;
 };
RDebugUtils.currentLine=13828119;
 //BA.debugLineNum = 13828119;BA.debugLine="If i - p2.Get(\"piezas\") < 0 Then";
if (_i-(double)(BA.ObjectToNumber(_p2.Get((Object)("piezas"))))<0) { 
RDebugUtils.currentLine=13828120;
 //BA.debugLineNum = 13828120;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("No hay suficiente producto para la promocion."));
RDebugUtils.currentLine=13828121;
 //BA.debugLineNum = 13828121;BA.debugLine="Exit";
if (true) break;
 };
 }
};
RDebugUtils.currentLine=13828124;
 //BA.debugLineNum = 13828124;BA.debugLine="If prodsFijos.Size = 0 Then inventariosDisponible";
if (_prodsfijos.getSize()==0) { 
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ok"));};
RDebugUtils.currentLine=13828125;
 //BA.debugLineNum = 13828125;BA.debugLine="If thisLog Then LogColor(\"Inventario final depues";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("313828125","Inventario final depues de FIJOS: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=13828126;
 //BA.debugLineNum = 13828126;BA.debugLine="Return inventariosDisponiblesParaEstaPromo";
if (true) return _inventariosdisponiblesparaestapromo;
RDebugUtils.currentLine=13828127;
 //BA.debugLineNum = 13828127;BA.debugLine="End Sub";
return null;
}
public static anywheresoftware.b4a.objects.collections.Map  _traemosinventariodisponibleparapromo(anywheresoftware.b4a.BA _ba,String _promo) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traemosinventariodisponibleparapromo", false))
	 {return ((anywheresoftware.b4a.objects.collections.Map) Debug.delegate(null, "traemosinventariodisponibleparapromo", new Object[] {_ba,_promo}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
anywheresoftware.b4a.objects.collections.Map _prods = null;
int _i = 0;
RDebugUtils.currentLine=13762560;
 //BA.debugLineNum = 13762560;BA.debugLine="Sub traemosInventarioDisponibleParaPromo(promo As";
RDebugUtils.currentLine=13762561;
 //BA.debugLineNum = 13762561;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13762562;
 //BA.debugLineNum = 13762562;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery2(\"SELECT CAT";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("SELECT CAT_GP_ID, CAT_GP_ALMACEN FROM CAT_GUNAPROD WHERE CAT_GP_ID IN (select CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = ?)",new String[]{_promo})));
RDebugUtils.currentLine=13762565;
 //BA.debugLineNum = 13762565;BA.debugLine="Private prods As Map";
_prods = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=13762566;
 //BA.debugLineNum = 13762566;BA.debugLine="prods.Initialize";
_prods.Initialize();
RDebugUtils.currentLine=13762567;
 //BA.debugLineNum = 13762567;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=13762568;
 //BA.debugLineNum = 13762568;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step6 = 1;
final int limit6 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit6 ;_i = _i + step6 ) {
RDebugUtils.currentLine=13762569;
 //BA.debugLineNum = 13762569;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=13762570;
 //BA.debugLineNum = 13762570;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")));
 }
};
 };
RDebugUtils.currentLine=13762575;
 //BA.debugLineNum = 13762575;BA.debugLine="Return prods";
if (true) return _prods;
RDebugUtils.currentLine=13762576;
 //BA.debugLineNum = 13762576;BA.debugLine="End Sub";
return null;
}
public static String  _revisaflp(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "revisaflp", false))
	 {return ((String) Debug.delegate(null, "revisaflp", new Object[] {_ba}));}
boolean _todobienflp = false;
RDebugUtils.currentLine=12124160;
 //BA.debugLineNum = 12124160;BA.debugLine="Sub revisaFLP 'ignore";
RDebugUtils.currentLine=12124161;
 //BA.debugLineNum = 12124161;BA.debugLine="LogColor(\"**** **** Revisamos FLP **** ****\", Col";
anywheresoftware.b4a.keywords.Common.LogImpl("312124161","**** **** Revisamos FLP **** ****",anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (78),(int) (0),(int) (227)));
RDebugUtils.currentLine=12124162;
 //BA.debugLineNum = 12124162;BA.debugLine="Private todoBienFLP As Boolean = True";
_todobienflp = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=12124163;
 //BA.debugLineNum = 12124163;BA.debugLine="Try";
try {RDebugUtils.currentLine=12124164;
 //BA.debugLineNum = 12124164;BA.debugLine="If Not(Tracker.FLP.IsInitialized) Then";
if (anywheresoftware.b4a.keywords.Common.Not(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsInitialized())) { 
RDebugUtils.currentLine=12124165;
 //BA.debugLineNum = 12124165;BA.debugLine="log2DB(\"revisaFLP: No esta inicializado ... 'Re";
_log2db(_ba,"revisaFLP: No esta inicializado ... 'Reinicializando FLP'");
RDebugUtils.currentLine=12124166;
 //BA.debugLineNum = 12124166;BA.debugLine="Tracker.FLP.Initialize(\"flp\")";
mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .Initialize((_ba.processBA == null ? _ba : _ba.processBA),"flp");
RDebugUtils.currentLine=12124167;
 //BA.debugLineNum = 12124167;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e10) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e10);RDebugUtils.currentLine=12124170;
 //BA.debugLineNum = 12124170;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsInitialized) ---";
anywheresoftware.b4a.keywords.Common.LogImpl("312124170","If Not(Tracker.FLP.IsInitialized) --- "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=12124172;
 //BA.debugLineNum = 12124172;BA.debugLine="Try";
try {RDebugUtils.currentLine=12124173;
 //BA.debugLineNum = 12124173;BA.debugLine="If Tracker.FLP.IsInitialized Then";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsInitialized()) { 
RDebugUtils.currentLine=12124174;
 //BA.debugLineNum = 12124174;BA.debugLine="Try";
try {RDebugUtils.currentLine=12124175;
 //BA.debugLineNum = 12124175;BA.debugLine="If Not(Tracker.FLP.IsConnected) Then";
if (anywheresoftware.b4a.keywords.Common.Not(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsConnected())) { 
RDebugUtils.currentLine=12124176;
 //BA.debugLineNum = 12124176;BA.debugLine="log2DB(\"revisaFLP: No esta conectado ... 'Rec";
_log2db(_ba,"revisaFLP: No esta conectado ... 'Reconectando FLP'");
RDebugUtils.currentLine=12124178;
 //BA.debugLineNum = 12124178;BA.debugLine="CallSubDelayed(Tracker,\"StartFLP\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()),"StartFLP");
RDebugUtils.currentLine=12124179;
 //BA.debugLineNum = 12124179;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e21) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e21);RDebugUtils.currentLine=12124182;
 //BA.debugLineNum = 12124182;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsConnected) -->";
anywheresoftware.b4a.keywords.Common.LogImpl("312124182","If Not(Tracker.FLP.IsConnected) --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=12124184;
 //BA.debugLineNum = 12124184;BA.debugLine="Try";
try {RDebugUtils.currentLine=12124185;
 //BA.debugLineNum = 12124185;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) { 
RDebugUtils.currentLine=12124188;
 //BA.debugLineNum = 12124188;BA.debugLine="log2DB(\"revisaFLP: 'No se esta actualizando,";
_log2db(_ba,"revisaFLP: 'No se esta actualizando, lo reiniciamos ...'");
RDebugUtils.currentLine=12124189;
 //BA.debugLineNum = 12124189;BA.debugLine="StartService(Tracker)";
anywheresoftware.b4a.keywords.Common.StartService((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()));
RDebugUtils.currentLine=12124190;
 //BA.debugLineNum = 12124190;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e30) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e30);RDebugUtils.currentLine=12124193;
 //BA.debugLineNum = 12124193;BA.debugLine="LogColor(\"If FLP.IsConnectctd and FLP.getLKL.I";
anywheresoftware.b4a.keywords.Common.LogImpl("312124193","If FLP.IsConnectctd and FLP.getLKL.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=12124196;
 //BA.debugLineNum = 12124196;BA.debugLine="If todoBienFLP Then LogColor(\" +++ +++ Sin error";
if (_todobienflp) { 
anywheresoftware.b4a.keywords.Common.LogImpl("312124196"," +++ +++ Sin errores en FLP",anywheresoftware.b4a.keywords.Common.Colors.Green);};
 } 
       catch (Exception e35) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e35);RDebugUtils.currentLine=12124198;
 //BA.debugLineNum = 12124198;BA.debugLine="LogColor(\"If Tracker.FLP.IsInitialized --> \"&Las";
anywheresoftware.b4a.keywords.Common.LogImpl("312124198","If Tracker.FLP.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=12124201;
 //BA.debugLineNum = 12124201;BA.debugLine="End Sub";
return "";
}
public static int  _revisamaxpromosprodsfijosporinventario(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _pm) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "revisamaxpromosprodsfijosporinventario", false))
	 {return ((Integer) Debug.delegate(null, "revisamaxpromosprodsfijosporinventario", new Object[] {_ba,_pm}));}
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;
RDebugUtils.currentLine=14221312;
 //BA.debugLineNum = 14221312;BA.debugLine="Sub revisaMaxPromosProdsFijosPorInventario(pm As M";
RDebugUtils.currentLine=14221313;
 //BA.debugLineNum = 14221313;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=14221314;
 //BA.debugLineNum = 14221314;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=14221315;
 //BA.debugLineNum = 14221315;BA.debugLine="Private t As List";
_t = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=14221316;
 //BA.debugLineNum = 14221316;BA.debugLine="t.Initialize";
_t.Initialize();
RDebugUtils.currentLine=14221317;
 //BA.debugLineNum = 14221317;BA.debugLine="t.Add(traeMaxPromos(pm)) ' Agregamos a la lista l";
_t.Add((Object)(_traemaxpromos(_ba,_pm)));
RDebugUtils.currentLine=14221318;
 //BA.debugLineNum = 14221318;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
RDebugUtils.currentLine=14221319;
 //BA.debugLineNum = 14221319;BA.debugLine="If thisLog Then LogColor($\"pm=${pm}\"$, Colors.Blu";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314221319",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14221320;
 //BA.debugLineNum = 14221320;BA.debugLine="Private invDispParaPromo As Map = traemosInventar";
_invdispparapromo = new anywheresoftware.b4a.objects.collections.Map();
_invdispparapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_pm.Get((Object)("id"))));
RDebugUtils.currentLine=14221321;
 //BA.debugLineNum = 14221321;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314221321",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
RDebugUtils.currentLine=14221322;
 //BA.debugLineNum = 14221322;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"))));
RDebugUtils.currentLine=14221323;
 //BA.debugLineNum = 14221323;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"))));
RDebugUtils.currentLine=14221324;
 //BA.debugLineNum = 14221324;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 ) {
RDebugUtils.currentLine=14221325;
 //BA.debugLineNum = 14221325;BA.debugLine="If thisLog Then Log($\"id=${idProdsFijos.Get(p)},";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314221325",("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);};
RDebugUtils.currentLine=14221326;
 //BA.debugLineNum = 14221326;BA.debugLine="If thisLog Then Log($\"${(invDispParaPromo.Get(id";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314221326",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsfijos.Get(_p))))/(double)(double)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p))))))+""),0);};
RDebugUtils.currentLine=14221327;
 //BA.debugLineNum = 14221327;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))))))+""));
RDebugUtils.currentLine=14221328;
 //BA.debugLineNum = 14221328;BA.debugLine="If thisLog Then Log(x(0))";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314221328",_x[(int) (0)],0);};
RDebugUtils.currentLine=14221329;
 //BA.debugLineNum = 14221329;BA.debugLine="t.Add(x(0).As(Int)) 'Solo guardamos la parte del";
_t.Add((Object)(((int)(Double.parseDouble(_x[(int) (0)])))));
 }
};
RDebugUtils.currentLine=14221331;
 //BA.debugLineNum = 14221331;BA.debugLine="t.Sort(True) 'Ordenamos la lista para que en el l";
_t.Sort(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=14221332;
 //BA.debugLineNum = 14221332;BA.debugLine="If thisLog Then LogColor($\"prodsFijos=${idProdsFi";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314221332",("prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsfijos.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14221333;
 //BA.debugLineNum = 14221333;BA.debugLine="If thisLog Then LogColor($\"prodsFijosPiezasReq=${";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314221333",("prodsFijosPiezasReq="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsfijospiezas.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14221334;
 //BA.debugLineNum = 14221334;BA.debugLine="If thisLog Then LogColor($\"invFijoXpromo=${invFij";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314221334",("invFijoXpromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invfijoxpromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14221335;
 //BA.debugLineNum = 14221335;BA.debugLine="LogColor(\"Max promos de prodsFijos POR inventario";
anywheresoftware.b4a.keywords.Common.LogImpl("314221335","Max promos de prodsFijos POR inventario = "+BA.ObjectToString(_t.Get((int) (0))),anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=14221336;
 //BA.debugLineNum = 14221336;BA.debugLine="Return t.Get(0) 'Regresamos el resultado mas pequ";
if (true) return (int)(BA.ObjectToNumber(_t.Get((int) (0))));
RDebugUtils.currentLine=14221337;
 //BA.debugLineNum = 14221337;BA.debugLine="End Sub";
return 0;
}
public static int  _revisamaxpromosprodsfijosporinventario2(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _pm) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "revisamaxpromosprodsfijosporinventario2", false))
	 {return ((Integer) Debug.delegate(null, "revisamaxpromosprodsfijosporinventario2", new Object[] {_ba,_pm}));}
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 = "";
RDebugUtils.currentLine=14155776;
 //BA.debugLineNum = 14155776;BA.debugLine="Sub revisaMaxPromosProdsFijosPorInventario2(pm As";
RDebugUtils.currentLine=14155777;
 //BA.debugLineNum = 14155777;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=14155778;
 //BA.debugLineNum = 14155778;BA.debugLine="If thisLog Then Log($\"pm=${pm}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155778",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),0);};
RDebugUtils.currentLine=14155780;
 //BA.debugLineNum = 14155780;BA.debugLine="Private invDispParaPromo As Map = traemosInventar";
_invdispparapromo = new anywheresoftware.b4a.objects.collections.Map();
_invdispparapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_pm.Get((Object)("id"))));
RDebugUtils.currentLine=14155781;
 //BA.debugLineNum = 14155781;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155781",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
RDebugUtils.currentLine=14155782;
 //BA.debugLineNum = 14155782;BA.debugLine="Private maxPromos As String = traeMaxPromos(pm)";
_maxpromos = BA.NumberToString(_traemaxpromos(_ba,_pm));
RDebugUtils.currentLine=14155783;
 //BA.debugLineNum = 14155783;BA.debugLine="Private maxPromosFijosXinv As Int = 1";
_maxpromosfijosxinv = (int) (1);
RDebugUtils.currentLine=14155784;
 //BA.debugLineNum = 14155784;BA.debugLine="Private fpf2, pdp2 As Int";
_fpf2 = 0;
_pdp2 = 0;
RDebugUtils.currentLine=14155785;
 //BA.debugLineNum = 14155785;BA.debugLine="Private salir As Boolean = False";
_salir = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=14155786;
 //BA.debugLineNum = 14155786;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"))));
RDebugUtils.currentLine=14155787;
 //BA.debugLineNum = 14155787;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"))));
RDebugUtils.currentLine=14155788;
 //BA.debugLineNum = 14155788;BA.debugLine="If thisLog Then Log($\"maxPromos=${maxPromos}, pro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155788",("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);};
RDebugUtils.currentLine=14155789;
 //BA.debugLineNum = 14155789;BA.debugLine="If thisLog Then LogColor($\"InvFijo disponible=${i";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155789",("InvFijo disponible="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14155790;
 //BA.debugLineNum = 14155790;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=14155791;
 //BA.debugLineNum = 14155791;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
RDebugUtils.currentLine=14155792;
 //BA.debugLineNum = 14155792;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 ) {
RDebugUtils.currentLine=14155793;
 //BA.debugLineNum = 14155793;BA.debugLine="invFijoXpromo.Put(pf.Get(p), pfp.Get(p))";
_invfijoxpromo.Put(_pf.Get(_p),_pfp.Get(_p));
 }
};
RDebugUtils.currentLine=14155795;
 //BA.debugLineNum = 14155795;BA.debugLine="If thisLog Then LogColor(\"Inv req. de prods fijos";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155795","Inv req. de prods fijos x promo"+BA.ObjectToString(_invfijoxpromo),anywheresoftware.b4a.keywords.Common.Colors.Green);};
RDebugUtils.currentLine=14155796;
 //BA.debugLineNum = 14155796;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 ) {
RDebugUtils.currentLine=14155797;
 //BA.debugLineNum = 14155797;BA.debugLine="If thisLog Then LogColor(\"Prods para promo \" & (";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155797","Prods para promo "+BA.NumberToString((_i+1)),anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
RDebugUtils.currentLine=14155798;
 //BA.debugLineNum = 14155798;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 ) {
RDebugUtils.currentLine=14155799;
 //BA.debugLineNum = 14155799;BA.debugLine="Private q2 As String = pf.Get(q)";
_q2 = BA.ObjectToString(_pf.Get(_q));
RDebugUtils.currentLine=14155800;
 //BA.debugLineNum = 14155800;BA.debugLine="If thisLog Then Log(\"q=\"&q2)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155800","q="+_q2,0);};
RDebugUtils.currentLine=14155802;
 //BA.debugLineNum = 14155802;BA.debugLine="fpf2 = pfp.Get(q) * i 'Multiplicamos las piezas";
_fpf2 = (int) ((double)(BA.ObjectToNumber(_pfp.Get(_q)))*_i);
RDebugUtils.currentLine=14155803;
 //BA.debugLineNum = 14155803;BA.debugLine="pdp2 = invDispParaPromo.Get(q2)";
_pdp2 = (int)(BA.ObjectToNumber(_invdispparapromo.Get((Object)(_q2))));
RDebugUtils.currentLine=14155804;
 //BA.debugLineNum = 14155804;BA.debugLine="If thisLog Then Log($\"pf=${q2}, Actual=${(i)},";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155804",("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);};
RDebugUtils.currentLine=14155805;
 //BA.debugLineNum = 14155805;BA.debugLine="If pdp2 - fpf2 < 0 Then 'Si el inventario es ne";
if (_pdp2-_fpf2<0) { 
RDebugUtils.currentLine=14155806;
 //BA.debugLineNum = 14155806;BA.debugLine="salir=True";
_salir = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=14155807;
 //BA.debugLineNum = 14155807;BA.debugLine="Exit";
if (true) break;
 };
 }
};
RDebugUtils.currentLine=14155810;
 //BA.debugLineNum = 14155810;BA.debugLine="If salir Then Exit";
if (_salir) { 
if (true) break;};
RDebugUtils.currentLine=14155811;
 //BA.debugLineNum = 14155811;BA.debugLine="maxPromosFijosXinv = i";
_maxpromosfijosxinv = _i;
 }
};
RDebugUtils.currentLine=14155813;
 //BA.debugLineNum = 14155813;BA.debugLine="If thisLog Then LogColor(\"InvFijo requerido x pro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314155813","InvFijo requerido x promo="+BA.ObjectToString(_invfijoxpromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14155814;
 //BA.debugLineNum = 14155814;BA.debugLine="LogColor(\"Maximo de promociones de prodsFijos POR";
anywheresoftware.b4a.keywords.Common.LogImpl("314155814","Maximo de promociones de prodsFijos POR inventario = "+BA.NumberToString(_maxpromosfijosxinv),anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=14155815;
 //BA.debugLineNum = 14155815;BA.debugLine="Return maxPromosFijosXinv";
if (true) return _maxpromosfijosxinv;
RDebugUtils.currentLine=14155816;
 //BA.debugLineNum = 14155816;BA.debugLine="End Sub";
return 0;
}
public static int  _revisamaxpromosprodsvariablesporinventario(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.collections.Map _pm) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "revisamaxpromosprodsvariablesporinventario", false))
	 {return ((Integer) Debug.delegate(null, "revisamaxpromosprodsvariablesporinventario", new Object[] {_ba,_pm}));}
boolean _thislog = false;
anywheresoftware.b4a.objects.collections.Map _invfijoxpromo = null;
int _totalprodsvariablesdisponibles = 0;
anywheresoftware.b4a.objects.collections.Map _invdispparapromo = null;
String _maxpromos = "";
int _maxpromosxfijos = 0;
anywheresoftware.b4a.objects.collections.List _idprodsvariables = null;
int _prodsvariablesrequeridos = 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 _x = 0;
int _i = 0;
RDebugUtils.currentLine=14286848;
 //BA.debugLineNum = 14286848;BA.debugLine="Sub revisaMaxPromosProdsVariablesPorInventario(pm";
RDebugUtils.currentLine=14286849;
 //BA.debugLineNum = 14286849;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=14286850;
 //BA.debugLineNum = 14286850;BA.debugLine="If thisLog Then Log(\"============================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286850","======================================================",0);};
RDebugUtils.currentLine=14286851;
 //BA.debugLineNum = 14286851;BA.debugLine="If thisLog Then Log(\"============================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286851","======================================================",0);};
RDebugUtils.currentLine=14286852;
 //BA.debugLineNum = 14286852;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=14286853;
 //BA.debugLineNum = 14286853;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
RDebugUtils.currentLine=14286854;
 //BA.debugLineNum = 14286854;BA.debugLine="Private totalProdsVariablesDisponibles As Int = 0";
_totalprodsvariablesdisponibles = (int) (0);
RDebugUtils.currentLine=14286855;
 //BA.debugLineNum = 14286855;BA.debugLine="If thisLog Then LogColor($\"pm=${pm}\"$, Colors.Blu";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286855",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14286856;
 //BA.debugLineNum = 14286856;BA.debugLine="Private invDispParaPromo As Map = traemosInventar";
_invdispparapromo = new anywheresoftware.b4a.objects.collections.Map();
_invdispparapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_pm.Get((Object)("id"))));
RDebugUtils.currentLine=14286857;
 //BA.debugLineNum = 14286857;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286857",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
RDebugUtils.currentLine=14286858;
 //BA.debugLineNum = 14286858;BA.debugLine="Private maxPromos As String = traeMaxPromos(pm)";
_maxpromos = BA.NumberToString(_traemaxpromos(_ba,_pm));
RDebugUtils.currentLine=14286859;
 //BA.debugLineNum = 14286859;BA.debugLine="Private maxPromosXFijos As Int = revisaMaxPromosP";
_maxpromosxfijos = _revisamaxpromosprodsfijosporinventario(_ba,_pm);
RDebugUtils.currentLine=14286860;
 //BA.debugLineNum = 14286860;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"))));
RDebugUtils.currentLine=14286861;
 //BA.debugLineNum = 14286861;BA.debugLine="Private prodsVariablesRequeridos As Int = pm.Get(";
_prodsvariablesrequeridos = (int)(BA.ObjectToNumber(_pm.Get((Object)("prodsVariablesRequeridos"))));
RDebugUtils.currentLine=14286862;
 //BA.debugLineNum = 14286862;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"))));
RDebugUtils.currentLine=14286863;
 //BA.debugLineNum = 14286863;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"))));
RDebugUtils.currentLine=14286864;
 //BA.debugLineNum = 14286864;BA.debugLine="For p = 0 To idProdsFijos.Size -1 'Generamos mapa";
{
final int step16 = 1;
final int limit16 = (int) (_idprodsfijos.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit16 ;_p = _p + step16 ) {
RDebugUtils.currentLine=14286865;
 //BA.debugLineNum = 14286865;BA.debugLine="invFijoXpromo.Put(idProdsFijos.Get(p), prodsFijo";
_invfijoxpromo.Put(_idprodsfijos.Get(_p),_prodsfijospiezas.Get(_p));
RDebugUtils.currentLine=14286866;
 //BA.debugLineNum = 14286866;BA.debugLine="Private idEsteProd As String = idProdsFijos.Get(";
_idesteprod = BA.ObjectToString(_idprodsfijos.Get(_p));
RDebugUtils.currentLine=14286867;
 //BA.debugLineNum = 14286867;BA.debugLine="Private invEsteProd As Int = invDispParaPromo.Ge";
_investeprod = (int)(BA.ObjectToNumber(_invdispparapromo.Get((Object)(_idesteprod))));
RDebugUtils.currentLine=14286868;
 //BA.debugLineNum = 14286868;BA.debugLine="Private pzasReqEsteProd As Int = prodsFijosPieza";
_pzasreqesteprod = (int)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p)));
RDebugUtils.currentLine=14286869;
 //BA.debugLineNum = 14286869;BA.debugLine="If thisLog Then Log($\"id=${idEsteProd}, inv=${in";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286869",("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);};
 }
};
RDebugUtils.currentLine=14286872;
 //BA.debugLineNum = 14286872;BA.debugLine="If thisLog Then LogColor($\"MaxPromos=${maxPromos}";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286872",("MaxPromos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromos))+", promosXFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromosxfijos))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14286873;
 //BA.debugLineNum = 14286873;BA.debugLine="If thisLog Then LogColor($\"prodsFijos=${idProdsFi";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286873",("prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsfijos.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14286874;
 //BA.debugLineNum = 14286874;BA.debugLine="If thisLog Then LogColor($\"prodsFijosPiezasReq=${";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286874",("prodsFijosPiezasReq="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsfijospiezas.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14286875;
 //BA.debugLineNum = 14286875;BA.debugLine="If thisLog Then LogColor($\"prodsVariables=${idPro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286875",("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);};
RDebugUtils.currentLine=14286876;
 //BA.debugLineNum = 14286876;BA.debugLine="If thisLog Then LogColor($\"invFijoXpromo=${invFij";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286876",("invFijoXpromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invfijoxpromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14286877;
 //BA.debugLineNum = 14286877;BA.debugLine="If thisLog Then Log($\"Prods variables disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286877",("Prods variables disponibles = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariablesdisponibles))+""),0);};
RDebugUtils.currentLine=14286878;
 //BA.debugLineNum = 14286878;BA.debugLine="Private maxPromosXVariables As Int = 0";
_maxpromosxvariables = (int) (0);
RDebugUtils.currentLine=14286879;
 //BA.debugLineNum = 14286879;BA.debugLine="For x = 1 To maxPromosXFijos";
{
final int step30 = 1;
final int limit30 = _maxpromosxfijos;
_x = (int) (1) ;
for (;_x <= limit30 ;_x = _x + step30 ) {
RDebugUtils.currentLine=14286880;
 //BA.debugLineNum = 14286880;BA.debugLine="If thisLog Then Log(\"===========================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286880","=====================================================",0);};
RDebugUtils.currentLine=14286881;
 //BA.debugLineNum = 14286881;BA.debugLine="If thisLog Then Log(\"===========================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286881","=====================================================",0);};
RDebugUtils.currentLine=14286882;
 //BA.debugLineNum = 14286882;BA.debugLine="For i = 0 To idProdsFijos.Size - 1";
{
final int step33 = 1;
final int limit33 = (int) (_idprodsfijos.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit33 ;_i = _i + step33 ) {
RDebugUtils.currentLine=14286883;
 //BA.debugLineNum = 14286883;BA.debugLine="If thisLog Then Log($\"FIJO - ${idProdsFijos.Get";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286883",("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);};
RDebugUtils.currentLine=14286884;
 //BA.debugLineNum = 14286884;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)));
 }
};
RDebugUtils.currentLine=14286886;
 //BA.debugLineNum = 14286886;BA.debugLine="If thisLog Then LogColor(\"Inv disponible despues";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286886","Inv disponible despues de restar fijos = "+BA.ObjectToString(_invdispparapromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=14286888;
 //BA.debugLineNum = 14286888;BA.debugLine="totalProdsVariablesDisponibles = 0";
_totalprodsvariablesdisponibles = (int) (0);
RDebugUtils.currentLine=14286889;
 //BA.debugLineNum = 14286889;BA.debugLine="For i = 0 To idProdsVariables.Size - 1 'Obtenemo";
{
final int step39 = 1;
final int limit39 = (int) (_idprodsvariables.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit39 ;_i = _i + step39 ) {
RDebugUtils.currentLine=14286890;
 //BA.debugLineNum = 14286890;BA.debugLine="If invDispParaPromo.ContainsKey(idProdsVariable";
if (_invdispparapromo.ContainsKey(_idprodsvariables.Get(_i))) { 
RDebugUtils.currentLine=14286891;
 //BA.debugLineNum = 14286891;BA.debugLine="totalProdsVariablesDisponibles = totalProdsVar";
_totalprodsvariablesdisponibles = (int) (_totalprodsvariablesdisponibles+(double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsvariables.Get(_i)))));
 };
 }
};
RDebugUtils.currentLine=14286895;
 //BA.debugLineNum = 14286895;BA.debugLine="If thisLog Then Log($\"Var disponibles -  var req";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286895",("Var disponibles -  var requeridos : "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariablesdisponibles))+" - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsvariablesrequeridos*_x))+""),0);};
RDebugUtils.currentLine=14286896;
 //BA.debugLineNum = 14286896;BA.debugLine="totalProdsVariablesDisponibles = totalProdsVaria";
_totalprodsvariablesdisponibles = (int) (_totalprodsvariablesdisponibles-(_prodsvariablesrequeridos*_x));
RDebugUtils.currentLine=14286897;
 //BA.debugLineNum = 14286897;BA.debugLine="If thisLog Then Log(\"prodsVariables disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286897","prodsVariables disponibles despues de promo = "+BA.NumberToString(_totalprodsvariablesdisponibles),0);};
RDebugUtils.currentLine=14286898;
 //BA.debugLineNum = 14286898;BA.debugLine="If totalProdsVariablesDisponibles < 0 Then Exit";
if (_totalprodsvariablesdisponibles<0) { 
if (true) break;};
RDebugUtils.currentLine=14286899;
 //BA.debugLineNum = 14286899;BA.debugLine="maxPromosXVariables = x";
_maxpromosxvariables = _x;
 }
};
RDebugUtils.currentLine=14286902;
 //BA.debugLineNum = 14286902;BA.debugLine="If thisLog Then LogColor(\"Max promos de prodsVari";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("314286902","Max promos de prodsVariables POR inventario = "+BA.NumberToString(_maxpromosxvariables),anywheresoftware.b4a.keywords.Common.Colors.Red);};
RDebugUtils.currentLine=14286903;
 //BA.debugLineNum = 14286903;BA.debugLine="Return maxPromosXVariables";
if (true) return _maxpromosxvariables;
RDebugUtils.currentLine=14286904;
 //BA.debugLineNum = 14286904;BA.debugLine="End Sub";
return 0;
}
public static String  _revisauug(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "revisauug", false))
	 {return ((String) Debug.delegate(null, "revisauug", new Object[] {_ba}));}
int _daa = 0;
RDebugUtils.currentLine=12058624;
 //BA.debugLineNum = 12058624;BA.debugLine="Sub revisaUUG 'ignore";
RDebugUtils.currentLine=12058625;
 //BA.debugLineNum = 12058625;BA.debugLine="Try";
try {RDebugUtils.currentLine=12058627;
 //BA.debugLineNum = 12058627;BA.debugLine="If Tracker.FLP.GetLastKnownLocation.IsInitialize";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().IsInitialized()) { 
RDebugUtils.currentLine=12058628;
 //BA.debugLineNum = 12058628;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())));
RDebugUtils.currentLine=12058629;
 //BA.debugLineNum = 12058629;BA.debugLine="If Starter.Logger Then LogColor($\"**** UUC \"${f";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("312058629",("**** 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)));};
RDebugUtils.currentLine=12058630;
 //BA.debugLineNum = 12058630;BA.debugLine="If daa > 40 And Tracker.FLP.GetLastKnownLocatio";
if (_daa>40 && mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()<35) { 
RDebugUtils.currentLine=12058631;
 //BA.debugLineNum = 12058631;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())}));
RDebugUtils.currentLine=12058632;
 //BA.debugLineNum = 12058632;BA.debugLine="If Starter.Logger Then Log(\"++++ Distancia a a";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("312058632","++++ Distancia a anterior="+BA.NumberToString(_daa)+"|"+"Precision="+BA.NumberToString(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()),0);};
 };
RDebugUtils.currentLine=12058634;
 //BA.debugLineNum = 12058634;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);RDebugUtils.currentLine=12058637;
 //BA.debugLineNum = 12058637;BA.debugLine="LogColor(\"If Tracker.FLP.GetLastKnownLocation.Is";
anywheresoftware.b4a.keywords.Common.LogImpl("312058637","If Tracker.FLP.GetLastKnownLocation.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=12058639;
 //BA.debugLineNum = 12058639;BA.debugLine="End Sub";
return "";
}
public static String  _traefecha(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traefecha", false))
	 {return ((String) Debug.delegate(null, "traefecha", new Object[] {_ba}));}
String _sdate = "";
String _stime = "";
RDebugUtils.currentLine=13369344;
 //BA.debugLineNum = 13369344;BA.debugLine="Sub traeFecha As String 'ignore";
RDebugUtils.currentLine=13369345;
 //BA.debugLineNum = 13369345;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MM/dd/yyyy");
RDebugUtils.currentLine=13369346;
 //BA.debugLineNum = 13369346;BA.debugLine="Private sDate As String =DateTime.Date(DateTime.N";
_sdate = anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=13369347;
 //BA.debugLineNum = 13369347;BA.debugLine="Private sTime As String =DateTime.Time(DateTime.N";
_stime = anywheresoftware.b4a.keywords.Common.DateTime.Time(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=13369348;
 //BA.debugLineNum = 13369348;BA.debugLine="Return sDate & sTime";
if (true) return _sdate+_stime;
RDebugUtils.currentLine=13369349;
 //BA.debugLineNum = 13369349;BA.debugLine="End Sub";
return "";
}
public static String  _traenombreclientev(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traenombreclientev", false))
	 {return ((String) Debug.delegate(null, "traenombreclientev", new Object[] {_ba,_id}));}
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _c = null;
String _n = "";
RDebugUtils.currentLine=15204352;
 //BA.debugLineNum = 15204352;BA.debugLine="Sub traeNombreClientev(id As String) As String";
RDebugUtils.currentLine=15204353;
 //BA.debugLineNum = 15204353;BA.debugLine="Private c As ResultSet = B4XPages.MainPage.skmt.E";
_c = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_c = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.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)(_id))+"'"))));
RDebugUtils.currentLine=15204354;
 //BA.debugLineNum = 15204354;BA.debugLine="Private n As String = \"N/A\"";
_n = "N/A";
RDebugUtils.currentLine=15204355;
 //BA.debugLineNum = 15204355;BA.debugLine="Do While c.NextRow";
while (_c.NextRow()) {
RDebugUtils.currentLine=15204356;
 //BA.debugLineNum = 15204356;BA.debugLine="n = c.GetString(\"CAT_CL_NOMBRE\")";
_n = _c.GetString("CAT_CL_NOMBRE");
 }
;
RDebugUtils.currentLine=15204358;
 //BA.debugLineNum = 15204358;BA.debugLine="Return n";
if (true) return _n;
RDebugUtils.currentLine=15204359;
 //BA.debugLineNum = 15204359;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _traeprodiddebd(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traeprodiddebd", false))
	 {return ((anywheresoftware.b4a.objects.collections.Map) Debug.delegate(null, "traeprodiddebd", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
RDebugUtils.currentLine=14417920;
 //BA.debugLineNum = 14417920;BA.debugLine="Sub traeProdIdDeBD As Map 'ignore";
RDebugUtils.currentLine=14417921;
 //BA.debugLineNum = 14417921;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=14417922;
 //BA.debugLineNum = 14417922;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=14417923;
 //BA.debugLineNum = 14417923;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select CAT_GP";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_TIPO,CAT_GP_SUBTIPO  from CAT_GUNAPROD where CAT_GP_NOMBRE In (Select PDESC from PROID)")));
RDebugUtils.currentLine=14417924;
 //BA.debugLineNum = 14417924;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=14417925;
 //BA.debugLineNum = 14417925;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=14417926;
 //BA.debugLineNum = 14417926;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 {
RDebugUtils.currentLine=14417928;
 //BA.debugLineNum = 14417928;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")});
 };
RDebugUtils.currentLine=14417930;
 //BA.debugLineNum = 14417930;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=14417931;
 //BA.debugLineNum = 14417931;BA.debugLine="Return m";
if (true) return _m;
RDebugUtils.currentLine=14417932;
 //BA.debugLineNum = 14417932;BA.debugLine="End Sub";
return null;
}
public static String  _traeprodnombre(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traeprodnombre", false))
	 {return ((String) Debug.delegate(null, "traeprodnombre", new Object[] {_ba,_id}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _h = null;
String _n = "";
RDebugUtils.currentLine=13172736;
 //BA.debugLineNum = 13172736;BA.debugLine="Sub traeProdNombre(id As String) As String";
RDebugUtils.currentLine=13172737;
 //BA.debugLineNum = 13172737;BA.debugLine="Private h As Cursor";
_h = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=13172738;
 //BA.debugLineNum = 13172738;BA.debugLine="Private n As String";
_n = "";
RDebugUtils.currentLine=13172739;
 //BA.debugLineNum = 13172739;BA.debugLine="h=B4XPages.MainPage.skmt.ExecQuery2(\"select CAT_G";
_h = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*keymon.lat.medicomed.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ",new String[]{_id.trim()})));
RDebugUtils.currentLine=13172740;
 //BA.debugLineNum = 13172740;BA.debugLine="If h.RowCount > 0 Then";
if (_h.getRowCount()>0) { 
RDebugUtils.currentLine=13172741;
 //BA.debugLineNum = 13172741;BA.debugLine="h.Position = 0";
_h.setPosition((int) (0));
RDebugUtils.currentLine=13172742;
 //BA.debugLineNum = 13172742;BA.debugLine="n = h.GetString(\"CAT_GP_NOMBRE\")";
_n = _h.GetString("CAT_GP_NOMBRE");
 };
RDebugUtils.currentLine=13172745;
 //BA.debugLineNum = 13172745;BA.debugLine="h.Close";
_h.Close();
RDebugUtils.currentLine=13172746;
 //BA.debugLineNum = 13172746;BA.debugLine="If n = Null Or n=\"\" Then n = \"N/A\"";
if (_n== null || (_n).equals("")) { 
_n = "N/A";};
RDebugUtils.currentLine=13172748;
 //BA.debugLineNum = 13172748;BA.debugLine="Return n";
if (true) return _n;
RDebugUtils.currentLine=13172749;
 //BA.debugLineNum = 13172749;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.collections.Map  _traetotalesclienteactual(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetotalesclienteactual", false))
	 {return ((anywheresoftware.b4a.objects.collections.Map) Debug.delegate(null, "traetotalesclienteactual", new Object[] {_ba}));}
anywheresoftware.b4a.objects.collections.Map _m = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c_prodsx = null;
RDebugUtils.currentLine=14614528;
 //BA.debugLineNum = 14614528;BA.debugLine="Sub traeTotalesClienteActual As Map";
RDebugUtils.currentLine=14614529;
 //BA.debugLineNum = 14614529;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=14614530;
 //BA.debugLineNum = 14614530;BA.debugLine="m.Initialize";
_m.Initialize();
RDebugUtils.currentLine=14614531;
 //BA.debugLineNum = 14614531;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 /*keymon.lat.medicomed.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")));
RDebugUtils.currentLine=14614532;
 //BA.debugLineNum = 14614532;BA.debugLine="c_prodsX.Position=0";
_c_prodsx.setPosition((int) (0));
RDebugUtils.currentLine=14614534;
 //BA.debugLineNum = 14614534;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"))});
RDebugUtils.currentLine=14614535;
 //BA.debugLineNum = 14614535;BA.debugLine="Return m";
if (true) return _m;
RDebugUtils.currentLine=14614536;
 //BA.debugLineNum = 14614536;BA.debugLine="End Sub";
return null;
}
}