package SHARK2.keymon.com.mx;


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

public class subs {
private static subs mostCurrent = new subs();
public static Object getObject() {
    throw new RuntimeException("Code module does not support this method.");
}
 
public anywheresoftware.b4a.keywords.Common __c = null;
public static de.donmanfred.GZipStringswrapper _gzip = null;
public static anywheresoftware.b4a.objects.StringUtils _su = null;
public static anywheresoftware.b4a.phone.Phone _phn = null;
public static String _devmodel = "";
public static anywheresoftware.b4a.sql.SQL _kmt = null;
public static anywheresoftware.b4a.sql.SQL _errorlog = null;
public static String _ssid = "";
public static int _rutamaxpoints = 0;
public static int _rutahrsatras = 0;
public static boolean _subslogs = false;
public b4a.example.dateutils _dateutils = null;
public SHARK2.keymon.com.mx.main _main = null;
public SHARK2.keymon.com.mx.appupdater _appupdater = null;
public SHARK2.keymon.com.mx.mapa_cliente _mapa_cliente = null;
public SHARK2.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public SHARK2.keymon.com.mx.notificationservice _notificationservice = null;
public SHARK2.keymon.com.mx.pendientes _pendientes = null;
public SHARK2.keymon.com.mx.starter _starter = null;
public SHARK2.keymon.com.mx.tracker _tracker = null;
public SHARK2.keymon.com.mx.newinst2 _newinst2 = null;
public SHARK2.keymon.com.mx.b4xpages _b4xpages = null;
public SHARK2.keymon.com.mx.b4xcollections _b4xcollections = null;
public SHARK2.keymon.com.mx.httputils2service _httputils2service = null;
public SHARK2.keymon.com.mx.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=38862848;
 //BA.debugLineNum = 38862848;BA.debugLine="Sub panelVisible(panel As Panel, top As Int, left";
RDebugUtils.currentLine=38862849;
 //BA.debugLineNum = 38862849;BA.debugLine="panel.BringToFront";
_panel.BringToFront();
RDebugUtils.currentLine=38862850;
 //BA.debugLineNum = 38862850;BA.debugLine="panel.Visible = True";
_panel.setVisible(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=38862851;
 //BA.debugLineNum = 38862851;BA.debugLine="panel.Top = top";
_panel.setTop(_top);
RDebugUtils.currentLine=38862852;
 //BA.debugLineNum = 38862852;BA.debugLine="panel.Left = left";
_panel.setLeft(_left);
RDebugUtils.currentLine=38862853;
 //BA.debugLineNum = 38862853;BA.debugLine="End Sub";
return "";
}
public static String  _guardaappinfo(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.sql.SQL _skmt) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "guardaappinfo", false))
	 {return ((String) Debug.delegate(null, "guardaappinfo", new Object[] {_ba,_skmt}));}
RDebugUtils.currentLine=41943040;
 //BA.debugLineNum = 41943040;BA.debugLine="Sub guardaAppInfo(skmt As SQL)";
RDebugUtils.currentLine=41943041;
 //BA.debugLineNum = 41943041;BA.debugLine="skmt.ExecNonQuery(\"delete from CAT_VARIABLES wher";
_skmt.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'EMPRESA' or CAT_VA_DESCRIPCION = 'APP_NAME' or CAT_VA_DESCRIPCION = 'APP_VERSION'");
RDebugUtils.currentLine=41943042;
 //BA.debugLineNum = 41943042;BA.debugLine="skmt.ExecNonQuery($\"insert into CAT_VARIABLES (CA";
_skmt.ExecNonQuery(("insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_NAME', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.Application.getLabelName()))+"')"));
RDebugUtils.currentLine=41943043;
 //BA.debugLineNum = 41943043;BA.debugLine="skmt.ExecNonQuery($\"insert into CAT_VARIABLES (CA";
_skmt.ExecNonQuery(("insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_VERSION', '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.Application.getVersionName()))+"')"));
RDebugUtils.currentLine=41943044;
 //BA.debugLineNum = 41943044;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=41811968;
 //BA.debugLineNum = 41811968;BA.debugLine="Sub agregaColumna(tabla As String, columna As Stri";
RDebugUtils.currentLine=41811969;
 //BA.debugLineNum = 41811969;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try {RDebugUtils.currentLine=41811970;
 //BA.debugLineNum = 41811970;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("SELECT COUNT(*) AS fCol FROM pragma_table_info('"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+"') WHERE name='"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+"'"))));
RDebugUtils.currentLine=41811971;
 //BA.debugLineNum = 41811971;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=41811972;
 //BA.debugLineNum = 41811972;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
RDebugUtils.currentLine=41811973;
 //BA.debugLineNum = 41811973;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("ALTER TABLE "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipo))+""));
RDebugUtils.currentLine=41811974;
 //BA.debugLineNum = 41811974;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("541811974",("Columna \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+"\"."),0);
 };
 } 
       catch (Exception e9) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e9);RDebugUtils.currentLine=41811977;
 //BA.debugLineNum = 41811977;BA.debugLine="Try";
try {RDebugUtils.currentLine=41811978;
 //BA.debugLineNum = 41811978;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("ALTER TABLE "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipo))+""));
RDebugUtils.currentLine=41811979;
 //BA.debugLineNum = 41811979;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
anywheresoftware.b4a.keywords.Common.LogImpl("541811979",("Columna \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_columna))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tabla))+"\".."),0);
 } 
       catch (Exception e13) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e13);RDebugUtils.currentLine=41811981;
 //BA.debugLineNum = 41811981;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("541811981",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
 };
RDebugUtils.currentLine=41811984;
 //BA.debugLineNum = 41811984;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=39649280;
 //BA.debugLineNum = 39649280;BA.debugLine="Sub traeCliente As String 'ignore";
RDebugUtils.currentLine=39649281;
 //BA.debugLineNum = 39649281;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39649282;
 //BA.debugLineNum = 39649282;BA.debugLine="Private cl As String";
_cl = "";
RDebugUtils.currentLine=39649283;
 //BA.debugLineNum = 39649283;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select CUENTA from cuentaa")));
RDebugUtils.currentLine=39649284;
 //BA.debugLineNum = 39649284;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39649285;
 //BA.debugLineNum = 39649285;BA.debugLine="cl = c.GetString(\"CUENTA\")";
_cl = _c.GetString("CUENTA");
RDebugUtils.currentLine=39649286;
 //BA.debugLineNum = 39649286;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=39649287;
 //BA.debugLineNum = 39649287;BA.debugLine="Return cl";
if (true) return _cl;
RDebugUtils.currentLine=39649288;
 //BA.debugLineNum = 39649288;BA.debugLine="End Sub";
return "";
}
public static double  _traetotalclientepreventaparacredito(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetotalclientepreventaparacredito", false))
	 {return ((Double) Debug.delegate(null, "traetotalclientepreventaparacredito", new Object[] {_ba}));}
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
RDebugUtils.currentLine=40370176;
 //BA.debugLineNum = 40370176;BA.debugLine="Sub traeTotalClientepreventaparacredito As Double";
RDebugUtils.currentLine=40370177;
 //BA.debugLineNum = 40370177;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
RDebugUtils.currentLine=40370178;
 //BA.debugLineNum = 40370178;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("Select  PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0 AND PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA)",new String[]{"PREVENTA"})));
RDebugUtils.currentLine=40370179;
 //BA.debugLineNum = 40370179;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
RDebugUtils.currentLine=40370180;
 //BA.debugLineNum = 40370180;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
RDebugUtils.currentLine=40370182;
 //BA.debugLineNum = 40370182;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
RDebugUtils.currentLine=40370183;
 //BA.debugLineNum = 40370183;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
RDebugUtils.currentLine=40370186;
 //BA.debugLineNum = 40370186;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
RDebugUtils.currentLine=40370187;
 //BA.debugLineNum = 40370187;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
RDebugUtils.currentLine=40370188;
 //BA.debugLineNum = 40370188;BA.debugLine="End Sub";
return 0;
}
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=38993920;
 //BA.debugLineNum = 38993920;BA.debugLine="Sub centraPanel(elemento As Panel, anchoElementoSu";
RDebugUtils.currentLine=38993921;
 //BA.debugLineNum = 38993921;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=38993922;
 //BA.debugLineNum = 38993922;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=41680896;
 //BA.debugLineNum = 41680896;BA.debugLine="Sub pedidoGuardado As Boolean";
RDebugUtils.currentLine=41680897;
 //BA.debugLineNum = 41680897;BA.debugLine="Private guardado As Boolean = False";
_guardado = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=41680898;
 //BA.debugLineNum = 41680898;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select gestion from kmt_info where CAT_CL_CODIGO in (Select CUENTA from cuentaa)")));
RDebugUtils.currentLine=41680899;
 //BA.debugLineNum = 41680899;BA.debugLine="If g.RowCount > 0 Then";
if (_g.getRowCount()>0) { 
RDebugUtils.currentLine=41680900;
 //BA.debugLineNum = 41680900;BA.debugLine="g.Position=0";
_g.setPosition((int) (0));
RDebugUtils.currentLine=41680901;
 //BA.debugLineNum = 41680901;BA.debugLine="If g.GetString(\"gestion\") = \"2\" Or g.GetString(\"";
if ((_g.GetString("gestion")).equals("2") || (_g.GetString("gestion")).equals("3")) { 
_guardado = anywheresoftware.b4a.keywords.Common.True;};
 };
RDebugUtils.currentLine=41680904;
 //BA.debugLineNum = 41680904;BA.debugLine="Return guardado";
if (true) return _guardado;
RDebugUtils.currentLine=41680905;
 //BA.debugLineNum = 41680905;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=41484288;
 //BA.debugLineNum = 41484288;BA.debugLine="Sub borraPedidoClienteActual As String";
RDebugUtils.currentLine=41484302;
 //BA.debugLineNum = 41484302;BA.debugLine="Private thisC As Cursor";
_thisc = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=41484304;
 //BA.debugLineNum = 41484304;BA.debugLine="thisC=Starter.skmt.ExecQuery(\"select PE_PRONOMBRE";
_thisc = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select PE_PRONOMBRE, PE_PROID, PE_CANT, PE_FOLIO FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")));
RDebugUtils.currentLine=41484305;
 //BA.debugLineNum = 41484305;BA.debugLine="If thisC.RowCount>0 Then";
if (_thisc.getRowCount()>0) { 
RDebugUtils.currentLine=41484306;
 //BA.debugLineNum = 41484306;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=41484307;
 //BA.debugLineNum = 41484307;BA.debugLine="thisC.Position = i";
_thisc.setPosition(_i);
RDebugUtils.currentLine=41484318;
 //BA.debugLineNum = 41484318;BA.debugLine="If thisC.GetString(\"PE_FOLIO\") = \"VENTA\" Then";
if ((_thisc.GetString("PE_FOLIO")).equals("VENTA")) { 
RDebugUtils.currentLine=41484319;
 //BA.debugLineNum = 41484319;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update $";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_thisc.GetString("PE_FOLIO"))))+" set cat_gp_almacen = cat_gp_almacen + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_CANT")))+" where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_PROID")))+"'"));
RDebugUtils.currentLine=41484320;
 //BA.debugLineNum = 41484320;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"delete f";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("delete from pedido where  pe_cedis in (select pe_cedis from pedido where pe_pronombre = ?) and pe_cliente in (Select CUENTA from cuentaa) AND PE_FOLIO = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_thisc.GetString("PE_PRONOMBRE"),_thisc.GetString("PE_FOLIO")}));
 }else {
RDebugUtils.currentLine=41484322;
 //BA.debugLineNum = 41484322;BA.debugLine="Starter.skmt.ExecNonQuery($\"update CAT_GUNAPRO";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD set cat_gp_almacen = cat_gp_almacen + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_CANT")))+" where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_PROID")))+"'"));
RDebugUtils.currentLine=41484323;
 //BA.debugLineNum = 41484323;BA.debugLine="Starter.skmt.ExecNonQuery($\"update CAT_GUNAPRO";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD4 set cat_gp_almacen = cat_gp_almacen + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_CANT")))+" where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_PROID")))+"'"));
RDebugUtils.currentLine=41484324;
 //BA.debugLineNum = 41484324;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"delete f";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("delete from pedido where  pe_cedis in (select pe_cedis from pedido where pe_pronombre = ?) and pe_cliente in (Select CUENTA from cuentaa) AND PE_FOLIO = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_thisc.GetString("PE_PRONOMBRE"),_thisc.GetString("PE_FOLIO")}));
 };
RDebugUtils.currentLine=41484327;
 //BA.debugLineNum = 41484327;BA.debugLine="LogColor($\"update ${traeTablaProds(thisC.GetStr";
anywheresoftware.b4a.keywords.Common.LogImpl("541484327",("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traetablaprods(_ba,_thisc.GetString("PE_FOLIO"))))+" set cat_gp_almacen = cat_gp_almacen + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_CANT")))+" where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_thisc.GetString("PE_PROID")))+"'"),anywheresoftware.b4a.keywords.Common.Colors.Red);
 }
};
 };
RDebugUtils.currentLine=41484331;
 //BA.debugLineNum = 41484331;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from pedido_cli";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)");
RDebugUtils.currentLine=41484332;
 //BA.debugLineNum = 41484332;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from pedido whe";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)");
RDebugUtils.currentLine=41484333;
 //BA.debugLineNum = 41484333;BA.debugLine="Starter.skmt.ExecNonQuery(\"UPDATE kmt_info set ge";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE kmt_info set gestion = 0  where CAT_CL_CODIGO In (select cuenta from cuentaa)");
RDebugUtils.currentLine=41484334;
 //BA.debugLineNum = 41484334;BA.debugLine="Return 1";
if (true) return BA.NumberToString(1);
RDebugUtils.currentLine=41484335;
 //BA.debugLineNum = 41484335;BA.debugLine="End Sub";
return "";
}
public static String  _traeruta(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traeruta", false))
	 {return ((String) Debug.delegate(null, "traeruta", new Object[] {_ba,_cliente}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
RDebugUtils.currentLine=39518208;
 //BA.debugLineNum = 39518208;BA.debugLine="Sub traeRuta (cliente As String) As String 'ignore";
RDebugUtils.currentLine=39518209;
 //BA.debugLineNum = 39518209;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39518210;
 //BA.debugLineNum = 39518210;BA.debugLine="Private r As String";
_r = "";
RDebugUtils.currentLine=39518211;
 //BA.debugLineNum = 39518211;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select CAT_C";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"' UNION ALL select CAT_CL_RUTA from kmt_info2 where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"'"))));
RDebugUtils.currentLine=39518212;
 //BA.debugLineNum = 39518212;BA.debugLine="r = \"0\"";
_r = "0";
RDebugUtils.currentLine=39518213;
 //BA.debugLineNum = 39518213;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=39518214;
 //BA.debugLineNum = 39518214;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39518215;
 //BA.debugLineNum = 39518215;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
RDebugUtils.currentLine=39518217;
 //BA.debugLineNum = 39518217;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=39518218;
 //BA.debugLineNum = 39518218;BA.debugLine="Return r";
if (true) return _r;
RDebugUtils.currentLine=39518219;
 //BA.debugLineNum = 39518219;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 _c2 = null;
String _b = "";
RDebugUtils.currentLine=39321600;
 //BA.debugLineNum = 39321600;BA.debugLine="Sub traeAlmacen As String 'ignore";
RDebugUtils.currentLine=39321601;
 //BA.debugLineNum = 39321601;BA.debugLine="Private c2 As Cursor";
_c2 = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39321602;
 //BA.debugLineNum = 39321602;BA.debugLine="Private b As String";
_b = "";
RDebugUtils.currentLine=39321603;
 //BA.debugLineNum = 39321603;BA.debugLine="c2=B4XPages.MainPage.skmt.ExecQuery(\"select ID_AL";
_c2 = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select ID_ALMACEN from CAT_ALMACEN")));
RDebugUtils.currentLine=39321604;
 //BA.debugLineNum = 39321604;BA.debugLine="Log(c2.RowCount)";
anywheresoftware.b4a.keywords.Common.LogImpl("539321604",BA.NumberToString(_c2.getRowCount()),0);
RDebugUtils.currentLine=39321605;
 //BA.debugLineNum = 39321605;BA.debugLine="c2.Position = 0";
_c2.setPosition((int) (0));
RDebugUtils.currentLine=39321606;
 //BA.debugLineNum = 39321606;BA.debugLine="b = c2.GetString(\"ID_ALMACEN\")";
_b = _c2.GetString("ID_ALMACEN");
RDebugUtils.currentLine=39321607;
 //BA.debugLineNum = 39321607;BA.debugLine="Log(\"Esto es almacen !!!!!!! \" &c2.GetString(\"ID_";
anywheresoftware.b4a.keywords.Common.LogImpl("539321607","Esto es almacen !!!!!!! "+_c2.GetString("ID_ALMACEN")+" Esto es almacen !!!!!!!",0);
RDebugUtils.currentLine=39321608;
 //BA.debugLineNum = 39321608;BA.debugLine="Return b";
if (true) return _b;
RDebugUtils.currentLine=39321609;
 //BA.debugLineNum = 39321609;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=41353216;
 //BA.debugLineNum = 41353216;BA.debugLine="Sub actualizaTET(cliente As String)";
RDebugUtils.currentLine=41353217;
 //BA.debugLineNum = 41353217;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select * from PEDIDO_INICIO_FINAL where PIF_CLIENTE = ?",new String[]{_cliente})));
RDebugUtils.currentLine=41353218;
 //BA.debugLineNum = 41353218;BA.debugLine="Dim total As Long = 0";
_total = (long) (0);
RDebugUtils.currentLine=41353219;
 //BA.debugLineNum = 41353219;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=41353220;
 //BA.debugLineNum = 41353220;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=41353221;
 //BA.debugLineNum = 41353221;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=41353222;
 //BA.debugLineNum = 41353222;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=41353224;
 //BA.debugLineNum = 41353224;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=41353225;
 //BA.debugLineNum = 41353225;BA.debugLine="total = total + subtotal";
_total = (long) (_total+_subtotal);
 }
};
RDebugUtils.currentLine=41353229;
 //BA.debugLineNum = 41353229;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"update PED";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("update PEDIDO_CLIENTE set PC_TIEMPO_TIENDA = ? where PC_CLIENTE = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{BA.NumberToString(((_total/(double)1000)/(double)60)),_cliente}));
 };
RDebugUtils.currentLine=41353231;
 //BA.debugLineNum = 41353231;BA.debugLine="End Sub";
return "";
}
public static String  _borrapedidocredito(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "borrapedidocredito", false))
	 {return ((String) Debug.delegate(null, "borrapedidocredito", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _cpedidos = null;
int _i = 0;
String _productoid = "";
int _cantidad = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pcli = null;
RDebugUtils.currentLine=41549824;
 //BA.debugLineNum = 41549824;BA.debugLine="Sub borraPedidoCredito As String";
RDebugUtils.currentLine=41549825;
 //BA.debugLineNum = 41549825;BA.debugLine="Dim cPedidos As Cursor";
_cpedidos = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=41549826;
 //BA.debugLineNum = 41549826;BA.debugLine="cPedidos = Starter.skmt.ExecQuery(\"SELECT PE_PROI";
_cpedidos = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT PE_PROID, PE_CANT FROM PEDIDO WHERE PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA) AND PE_FOLIO = 'PREVENTA_CREDITO'")));
RDebugUtils.currentLine=41549828;
 //BA.debugLineNum = 41549828;BA.debugLine="If cPedidos.RowCount > 0 Then";
if (_cpedidos.getRowCount()>0) { 
RDebugUtils.currentLine=41549829;
 //BA.debugLineNum = 41549829;BA.debugLine="For i = 0 To cPedidos.RowCount - 1";
{
final int step4 = 1;
final int limit4 = (int) (_cpedidos.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
RDebugUtils.currentLine=41549830;
 //BA.debugLineNum = 41549830;BA.debugLine="cPedidos.Position = i";
_cpedidos.setPosition(_i);
RDebugUtils.currentLine=41549831;
 //BA.debugLineNum = 41549831;BA.debugLine="Dim productoId As String = cPedidos.GetString(\"";
_productoid = _cpedidos.GetString("PE_PROID");
RDebugUtils.currentLine=41549832;
 //BA.debugLineNum = 41549832;BA.debugLine="Dim cantidad As Int = cPedidos.GetInt(\"PE_CANT\"";
_cantidad = _cpedidos.GetInt("PE_CANT");
RDebugUtils.currentLine=41549834;
 //BA.debugLineNum = 41549834;BA.debugLine="Starter.skmt.ExecNonQuery2(\"UPDATE CAT_GUNAPROD";
mostCurrent._starter._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 String[]{BA.NumberToString(_cantidad),_productoid}));
RDebugUtils.currentLine=41549835;
 //BA.debugLineNum = 41549835;BA.debugLine="Starter.skmt.ExecNonQuery2(\"UPDATE CAT_GUNAPROD";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("UPDATE CAT_GUNAPROD4 SET CAT_GP_ALMACEN = CAT_GP_ALMACEN + ? WHERE CAT_GP_ID = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{BA.NumberToString(_cantidad),_productoid}));
 }
};
 };
RDebugUtils.currentLine=41549839;
 //BA.debugLineNum = 41549839;BA.debugLine="cPedidos.Close";
_cpedidos.Close();
RDebugUtils.currentLine=41549841;
 //BA.debugLineNum = 41549841;BA.debugLine="Starter.skmt.ExecNonQuery(\"DELETE FROM PEDIDO WHE";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("DELETE FROM PEDIDO WHERE PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA) AND PE_FOLIO = 'PREVENTA_CREDITO'");
RDebugUtils.currentLine=41549843;
 //BA.debugLineNum = 41549843;BA.debugLine="Log(\"Pedidos a crédito borrados correctamente.\")";
anywheresoftware.b4a.keywords.Common.LogImpl("541549843","Pedidos a crédito borrados correctamente.",0);
RDebugUtils.currentLine=41549844;
 //BA.debugLineNum = 41549844;BA.debugLine="Return \"1\"";
if (true) return "1";
RDebugUtils.currentLine=41549846;
 //BA.debugLineNum = 41549846;BA.debugLine="Dim pCli As Cursor = Starter.skmt.ExecQuery(\"sele";
_pcli = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_pcli = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select PE_CLIENTE, PE_FECHA, PE_CEDIS, 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=41549847;
 //BA.debugLineNum = 41549847;BA.debugLine="If pCli.RowCount > 0 Then";
if (_pcli.getRowCount()>0) { 
RDebugUtils.currentLine=41549848;
 //BA.debugLineNum = 41549848;BA.debugLine="pCli.Position = 0";
_pcli.setPosition((int) (0));
RDebugUtils.currentLine=41549849;
 //BA.debugLineNum = 41549849;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert int";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_pcli.GetString("PE_CLIENTE"),_pcli.GetString("PE_FECHA"),_pcli.GetString("PE_USUARIO"),_pcli.GetString("CANT_CLIE"),_pcli.GetString("TOTAL_CLIE"),mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ,mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ,_pcli.GetString("PE_CEDIS"),_pcli.GetString("TOTAL_CLIE_SIN")}));
 }else {
RDebugUtils.currentLine=41549851;
 //BA.debugLineNum = 41549851;BA.debugLine="Starter.skmt.ExecNonQuery(\"UPDATE KMT_INFO SET G";
mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE KMT_INFO SET GESTION = 0 WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)");
 };
RDebugUtils.currentLine=41549853;
 //BA.debugLineNum = 41549853;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=39780352;
 //BA.debugLineNum = 39780352;BA.debugLine="Sub traeUsuarioDeBD As String 'ignore";
RDebugUtils.currentLine=39780353;
 //BA.debugLineNum = 39780353;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39780354;
 //BA.debugLineNum = 39780354;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
RDebugUtils.currentLine=39780355;
 //BA.debugLineNum = 39780355;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
RDebugUtils.currentLine=39780356;
 //BA.debugLineNum = 39780356;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=39780357;
 //BA.debugLineNum = 39780357;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39780358;
 //BA.debugLineNum = 39780358;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
RDebugUtils.currentLine=39780359;
 //BA.debugLineNum = 39780359;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=39780360;
 //BA.debugLineNum = 39780360;BA.debugLine="Return u";
if (true) return _u;
RDebugUtils.currentLine=39780361;
 //BA.debugLineNum = 39780361;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=37093376;
 //BA.debugLineNum = 37093376;BA.debugLine="Sub fechaKMT(fecha As String) As String 'ignore";
RDebugUtils.currentLine=37093378;
 //BA.debugLineNum = 37093378;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=37093379;
 //BA.debugLineNum = 37093379;BA.debugLine="DateTime.DateFormat=\"yyMMddHHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMddHHmmss");
RDebugUtils.currentLine=37093380;
 //BA.debugLineNum = 37093380;BA.debugLine="Dim nuevaFecha As String=DateTime.Date(fecha)";
_nuevafecha = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
RDebugUtils.currentLine=37093381;
 //BA.debugLineNum = 37093381;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=37093383;
 //BA.debugLineNum = 37093383;BA.debugLine="Return nuevaFecha";
if (true) return _nuevafecha;
RDebugUtils.currentLine=37093384;
 //BA.debugLineNum = 37093384;BA.debugLine="End Sub";
return "";
}
public static String  _logjobdoneresultados(anywheresoftware.b4a.BA _ba,SHARK2.keymon.com.mx.dbrequestmanager._dbresult _resultado) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "logjobdoneresultados", false))
	 {return ((String) Debug.delegate(null, "logjobdoneresultados", new Object[] {_ba,_resultado}));}
Object[] _records = null;
String _k = "";
RDebugUtils.currentLine=41877504;
 //BA.debugLineNum = 41877504;BA.debugLine="Sub logJobDoneResultados(resultado As DBResult)";
RDebugUtils.currentLine=41877505;
 //BA.debugLineNum = 41877505;BA.debugLine="For Each records() As Object In resultado.Rows";
{
final anywheresoftware.b4a.BA.IterableList group1 = _resultado.Rows /*anywheresoftware.b4a.objects.collections.List*/ ;
final int groupLen1 = group1.getSize()
;int index1 = 0;
;
for (; index1 < groupLen1;index1++){
_records = (Object[])(group1.Get(index1));
RDebugUtils.currentLine=41877506;
 //BA.debugLineNum = 41877506;BA.debugLine="LogColor($\"====== ${resultado.Tag} - REGISTROS =";
anywheresoftware.b4a.keywords.Common.LogImpl("541877506",("====== "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_resultado.Tag /*Object*/ )+" - REGISTROS = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_resultado.Rows /*anywheresoftware.b4a.objects.collections.List*/ .getSize()))+""),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (215),(int) (37),(int) (0)));
RDebugUtils.currentLine=41877507;
 //BA.debugLineNum = 41877507;BA.debugLine="For Each k As String In resultado.Columns.Keys";
{
final anywheresoftware.b4a.BA.IterableList group3 = _resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Keys();
final int groupLen3 = group3.getSize()
;int index3 = 0;
;
for (; index3 < groupLen3;index3++){
_k = BA.ObjectToString(group3.Get(index3));
RDebugUtils.currentLine=41877508;
 //BA.debugLineNum = 41877508;BA.debugLine="LogColor(k & \" = \" & records(resultado.Columns.";
anywheresoftware.b4a.keywords.Common.LogImpl("541877508",_k+" = "+BA.ObjectToString(_records[(int)(BA.ObjectToNumber(_resultado.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Get((Object)(_k))))]),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (215),(int) (37),(int) (0)));
 }
};
 }
};
RDebugUtils.currentLine=41877511;
 //BA.debugLineNum = 41877511;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=41287680;
 //BA.debugLineNum = 41287680;BA.debugLine="Sub guardaClienteHoraInicio(cliente As String)";
RDebugUtils.currentLine=41287681;
 //BA.debugLineNum = 41287681;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into PEDIDO_INICIO_FINAL(PIF_CLIENTE, PIF_HORA_INICIO, PIF_HORA_FINAL) VALUES(?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cliente),(Object)(anywheresoftware.b4a.keywords.Common.DateTime.getNow()),(Object)(0)}));
RDebugUtils.currentLine=41287683;
 //BA.debugLineNum = 41287683;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=39059456;
 //BA.debugLineNum = 39059456;BA.debugLine="Sub centraPanelV(elemento As Panel, altoElementoSu";
RDebugUtils.currentLine=39059457;
 //BA.debugLineNum = 39059457;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=39059458;
 //BA.debugLineNum = 39059458;BA.debugLine="End Sub";
return "";
}
public static double  _traetotalcliente(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetotalcliente", false))
	 {return ((Double) Debug.delegate(null, "traetotalcliente", new Object[] {_ba}));}
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
RDebugUtils.currentLine=40173568;
 //BA.debugLineNum = 40173568;BA.debugLine="Sub traeTotalCliente As Double";
RDebugUtils.currentLine=40173569;
 //BA.debugLineNum = 40173569;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
RDebugUtils.currentLine=40173570;
 //BA.debugLineNum = 40173570;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select  PE_COSTO_TOT from pedido where PE_CLIENTE <> 0 ")));
RDebugUtils.currentLine=40173571;
 //BA.debugLineNum = 40173571;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
RDebugUtils.currentLine=40173572;
 //BA.debugLineNum = 40173572;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
RDebugUtils.currentLine=40173574;
 //BA.debugLineNum = 40173574;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
RDebugUtils.currentLine=40173575;
 //BA.debugLineNum = 40173575;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
RDebugUtils.currentLine=40173578;
 //BA.debugLineNum = 40173578;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
RDebugUtils.currentLine=40173579;
 //BA.debugLineNum = 40173579;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
RDebugUtils.currentLine=40173580;
 //BA.debugLineNum = 40173580;BA.debugLine="End Sub";
return 0;
}
public static double  _traetotalclientepreventa(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetotalclientepreventa", false))
	 {return ((Double) Debug.delegate(null, "traetotalclientepreventa", new Object[] {_ba}));}
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
RDebugUtils.currentLine=40304640;
 //BA.debugLineNum = 40304640;BA.debugLine="Sub traeTotalClientepreventa As Double";
RDebugUtils.currentLine=40304641;
 //BA.debugLineNum = 40304641;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
RDebugUtils.currentLine=40304642;
 //BA.debugLineNum = 40304642;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("Select  PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0",new String[]{"PREVENTA_CONTADO"})));
RDebugUtils.currentLine=40304643;
 //BA.debugLineNum = 40304643;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
RDebugUtils.currentLine=40304644;
 //BA.debugLineNum = 40304644;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
RDebugUtils.currentLine=40304646;
 //BA.debugLineNum = 40304646;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
RDebugUtils.currentLine=40304647;
 //BA.debugLineNum = 40304647;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
RDebugUtils.currentLine=40304650;
 //BA.debugLineNum = 40304650;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
RDebugUtils.currentLine=40304651;
 //BA.debugLineNum = 40304651;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
RDebugUtils.currentLine=40304652;
 //BA.debugLineNum = 40304652;BA.debugLine="End Sub";
return 0;
}
public static double  _traetotalclienteventa(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetotalclienteventa", false))
	 {return ((Double) Debug.delegate(null, "traetotalclienteventa", new Object[] {_ba}));}
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
RDebugUtils.currentLine=40435712;
 //BA.debugLineNum = 40435712;BA.debugLine="Sub traeTotalClienteventa As Double";
RDebugUtils.currentLine=40435713;
 //BA.debugLineNum = 40435713;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
RDebugUtils.currentLine=40435714;
 //BA.debugLineNum = 40435714;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("Select  PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0",new String[]{"VENTA"})));
RDebugUtils.currentLine=40435715;
 //BA.debugLineNum = 40435715;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
RDebugUtils.currentLine=40435716;
 //BA.debugLineNum = 40435716;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
RDebugUtils.currentLine=40435718;
 //BA.debugLineNum = 40435718;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
RDebugUtils.currentLine=40435719;
 //BA.debugLineNum = 40435719;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
RDebugUtils.currentLine=40435722;
 //BA.debugLineNum = 40435722;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
RDebugUtils.currentLine=40435723;
 //BA.debugLineNum = 40435723;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
RDebugUtils.currentLine=40435724;
 //BA.debugLineNum = 40435724;BA.debugLine="End Sub";
return 0;
}
public static double  _traetotalclienteabordo(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetotalclienteabordo", false))
	 {return ((Double) Debug.delegate(null, "traetotalclienteabordo", new Object[] {_ba}));}
double _sumatotal = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _cursorprueba = null;
int _i = 0;
RDebugUtils.currentLine=40239104;
 //BA.debugLineNum = 40239104;BA.debugLine="Sub traeTotalClienteabordo As Double";
RDebugUtils.currentLine=40239105;
 //BA.debugLineNum = 40239105;BA.debugLine="Private sumaTotal As Double";
_sumatotal = 0;
RDebugUtils.currentLine=40239106;
 //BA.debugLineNum = 40239106;BA.debugLine="Private cursorprueba As Cursor = B4XPages.MainPag";
_cursorprueba = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_cursorprueba = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("Select  PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE = 0",new String[]{"ABORDO"})));
RDebugUtils.currentLine=40239107;
 //BA.debugLineNum = 40239107;BA.debugLine="For i= 0 To cursorprueba.RowCount -1";
{
final int step3 = 1;
final int limit3 = (int) (_cursorprueba.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit3 ;_i = _i + step3 ) {
RDebugUtils.currentLine=40239108;
 //BA.debugLineNum = 40239108;BA.debugLine="cursorprueba.Position = i";
_cursorprueba.setPosition(_i);
RDebugUtils.currentLine=40239110;
 //BA.debugLineNum = 40239110;BA.debugLine="sumaTotal =  sumaTotal +  cursorprueba.GetString";
_sumatotal = _sumatotal+(double)(Double.parseDouble(_cursorprueba.GetString("PE_COSTO_TOT")));
RDebugUtils.currentLine=40239111;
 //BA.debugLineNum = 40239111;BA.debugLine="sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, Fa";
_sumatotal = (double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.NumberFormat2(_sumatotal,(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)));
 }
};
RDebugUtils.currentLine=40239114;
 //BA.debugLineNum = 40239114;BA.debugLine="cursorprueba.Close";
_cursorprueba.Close();
RDebugUtils.currentLine=40239115;
 //BA.debugLineNum = 40239115;BA.debugLine="Return sumaTotal";
if (true) return _sumatotal;
RDebugUtils.currentLine=40239116;
 //BA.debugLineNum = 40239116;BA.debugLine="End Sub";
return 0;
}
public static String  _traeruta2(anywheresoftware.b4a.BA _ba,String _cliente) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traeruta2", false))
	 {return ((String) Debug.delegate(null, "traeruta2", new Object[] {_ba,_cliente}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _r = "";
RDebugUtils.currentLine=39583744;
 //BA.debugLineNum = 39583744;BA.debugLine="Sub traeRuta2 (cliente As String) As String 'ignor";
RDebugUtils.currentLine=39583745;
 //BA.debugLineNum = 39583745;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39583746;
 //BA.debugLineNum = 39583746;BA.debugLine="Private r As String";
_r = "";
RDebugUtils.currentLine=39583747;
 //BA.debugLineNum = 39583747;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select CAT_C";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"' UNION ALL select CAT_CL_RUTA from kmt_info2 where CAT_CL_CODIGO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"'"))));
RDebugUtils.currentLine=39583748;
 //BA.debugLineNum = 39583748;BA.debugLine="r = \"0\"";
_r = "0";
RDebugUtils.currentLine=39583749;
 //BA.debugLineNum = 39583749;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=39583750;
 //BA.debugLineNum = 39583750;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39583751;
 //BA.debugLineNum = 39583751;BA.debugLine="r = c.GetString(\"CAT_CL_RUTA\")";
_r = _c.GetString("CAT_CL_RUTA");
 };
RDebugUtils.currentLine=39583753;
 //BA.debugLineNum = 39583753;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=39583754;
 //BA.debugLineNum = 39583754;BA.debugLine="Return r";
if (true) return _r;
RDebugUtils.currentLine=39583755;
 //BA.debugLineNum = 39583755;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=38928384;
 //BA.debugLineNum = 38928384;BA.debugLine="Sub centraEtiqueta(elemento As Label, anchoElement";
RDebugUtils.currentLine=38928385;
 //BA.debugLineNum = 38928385;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=38928386;
 //BA.debugLineNum = 38928386;BA.debugLine="End Sub";
return "";
}
public static String  _traeinventario(anywheresoftware.b4a.BA _ba,String _id) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traeinventario", false))
	 {return ((String) Debug.delegate(null, "traeinventario", new Object[] {_ba,_id}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _inventario = "";
RDebugUtils.currentLine=42008576;
 //BA.debugLineNum = 42008576;BA.debugLine="Sub traeinventario(id As String) As String";
RDebugUtils.currentLine=42008577;
 //BA.debugLineNum = 42008577;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=42008578;
 //BA.debugLineNum = 42008578;BA.debugLine="Dim inventario As String = \"0\"";
_inventario = "0";
RDebugUtils.currentLine=42008579;
 //BA.debugLineNum = 42008579;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select CAT_G";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_GP_ALMACEN from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" where CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_id))+"'"))));
RDebugUtils.currentLine=42008581;
 //BA.debugLineNum = 42008581;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=42008582;
 //BA.debugLineNum = 42008582;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=42008583;
 //BA.debugLineNum = 42008583;BA.debugLine="inventario = c.GetString(\"CAT_GP_ALMACEN\")";
_inventario = _c.GetString("CAT_GP_ALMACEN");
 };
RDebugUtils.currentLine=42008585;
 //BA.debugLineNum = 42008585;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=42008586;
 //BA.debugLineNum = 42008586;BA.debugLine="Return inventario";
if (true) return _inventario;
RDebugUtils.currentLine=42008587;
 //BA.debugLineNum = 42008587;BA.debugLine="End Sub";
return "";
}
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=39387136;
 //BA.debugLineNum = 39387136;BA.debugLine="Sub traeProdNombre(id As String) As String";
RDebugUtils.currentLine=39387137;
 //BA.debugLineNum = 39387137;BA.debugLine="Private h As Cursor";
_h = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39387138;
 //BA.debugLineNum = 39387138;BA.debugLine="Private n As String";
_n = "";
RDebugUtils.currentLine=39387139;
 //BA.debugLineNum = 39387139;BA.debugLine="h=B4XPages.MainPage.skmt.ExecQuery2($\"select CAT_";
_h = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2(("select CAT_GP_NOMBRE from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" where CAT_GP_ID = ? "),new String[]{_id.trim()})));
RDebugUtils.currentLine=39387140;
 //BA.debugLineNum = 39387140;BA.debugLine="If h.RowCount > 0 Then";
if (_h.getRowCount()>0) { 
RDebugUtils.currentLine=39387141;
 //BA.debugLineNum = 39387141;BA.debugLine="h.Position = 0";
_h.setPosition((int) (0));
RDebugUtils.currentLine=39387142;
 //BA.debugLineNum = 39387142;BA.debugLine="n = h.GetString(\"CAT_GP_NOMBRE\")";
_n = _h.GetString("CAT_GP_NOMBRE");
 };
RDebugUtils.currentLine=39387145;
 //BA.debugLineNum = 39387145;BA.debugLine="h.Close";
_h.Close();
RDebugUtils.currentLine=39387146;
 //BA.debugLineNum = 39387146;BA.debugLine="If n = Null Or n=\"\" Then n = \"N/A\"";
if (_n== null || (_n).equals("")) { 
_n = "N/A";};
RDebugUtils.currentLine=39387148;
 //BA.debugLineNum = 39387148;BA.debugLine="Return n";
if (true) return _n;
RDebugUtils.currentLine=39387149;
 //BA.debugLineNum = 39387149;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=41418752;
 //BA.debugLineNum = 41418752;BA.debugLine="Sub traeTotalesClienteActual As Map";
RDebugUtils.currentLine=41418753;
 //BA.debugLineNum = 41418753;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=41418754;
 //BA.debugLineNum = 41418754;BA.debugLine="m.Initialize";
_m.Initialize();
RDebugUtils.currentLine=41418755;
 //BA.debugLineNum = 41418755;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select ifnull(sum(PE_CANT), 0) as cantProds, ifnull(sum(PE_COSTO_TOT), 0) as costoTotal FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")));
RDebugUtils.currentLine=41418756;
 //BA.debugLineNum = 41418756;BA.debugLine="c_prodsX.Position=0";
_c_prodsx.setPosition((int) (0));
RDebugUtils.currentLine=41418758;
 //BA.debugLineNum = 41418758;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=41418759;
 //BA.debugLineNum = 41418759;BA.debugLine="Return m";
if (true) return _m;
RDebugUtils.currentLine=41418760;
 //BA.debugLineNum = 41418760;BA.debugLine="End Sub";
return null;
}
public static String  _actualizaproducto(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,int _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _cantc,String _bcajas) throws Exception{
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,_cantc,_bcajas}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _antcant = 0;
int _difcant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pe = null;
RDebugUtils.currentLine=39976960;
 //BA.debugLineNum = 39976960;BA.debugLine="Sub actualizaProducto(cedis As String, costoU As S";
RDebugUtils.currentLine=39976961;
 //BA.debugLineNum = 39976961;BA.debugLine="Log(\"Entramos a actualiza producto\")";
anywheresoftware.b4a.keywords.Common.LogImpl("539976961","Entramos a actualiza producto",0);
RDebugUtils.currentLine=39976962;
 //BA.debugLineNum = 39976962;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from pedido where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"))));
RDebugUtils.currentLine=39976964;
 //BA.debugLineNum = 39976964;BA.debugLine="LogColor($\"actualizaProducto, c=${clienteId}, p=$";
anywheresoftware.b4a.keywords.Common.LogImpl("539976964",("actualizaProducto, c="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+", p="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+", nombre="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_nombre))+", cant="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+", cedis="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+", tipo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipoventa))+""),anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=39976965;
 //BA.debugLineNum = 39976965;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=39976966;
 //BA.debugLineNum = 39976966;BA.debugLine="Log(\"----->1<--------------\")";
anywheresoftware.b4a.keywords.Common.LogImpl("539976966","----->1<--------------",0);
RDebugUtils.currentLine=39976967;
 //BA.debugLineNum = 39976967;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39976968;
 //BA.debugLineNum = 39976968;BA.debugLine="Private antCant As Int = 0";
_antcant = (int) (0);
RDebugUtils.currentLine=39976969;
 //BA.debugLineNum = 39976969;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=39976970;
 //BA.debugLineNum = 39976970;BA.debugLine="Private difCant As Int = cant - antCant";
_difcant = (int) (_cant-_antcant);
RDebugUtils.currentLine=39976971;
 //BA.debugLineNum = 39976971;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update ped";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update pedido set pe_cant = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+", pe_costo_tot = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)((_cant*(double)(Double.parseDouble(_c.GetString("PE_COSTOU"))))))+", PE_CANTC = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cantc))+", PE_BCAJAS = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_bcajas))+" where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"));
RDebugUtils.currentLine=39976972;
 //BA.debugLineNum = 39976972;BA.debugLine="If B4XPages.MainPage.tipo_venta = \"VENTA\" Then";
if ((mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ).equals("VENTA")) { 
RDebugUtils.currentLine=39976973;
 //BA.debugLineNum = 39976973;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update ${";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" 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))+"' "));
 }else {
RDebugUtils.currentLine=39976975;
 //BA.debugLineNum = 39976975;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update CA";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD set cat_gp_almacen = cat_gp_almacen - ("+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_difcant))+") where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' "));
RDebugUtils.currentLine=39976976;
 //BA.debugLineNum = 39976976;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update CA";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD4 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=39976980;
 //BA.debugLineNum = 39976980;BA.debugLine="If cant = 0 Then";
if (_cant==0) { 
RDebugUtils.currentLine=39976981;
 //BA.debugLineNum = 39976981;BA.debugLine="Log(\"BORRAMOS PROD\")";
anywheresoftware.b4a.keywords.Common.LogImpl("539976981","BORRAMOS PROD",0);
RDebugUtils.currentLine=39976982;
 //BA.debugLineNum = 39976982;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"delete fr";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"));
RDebugUtils.currentLine=39976983;
 //BA.debugLineNum = 39976983;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")));
RDebugUtils.currentLine=39976984;
 //BA.debugLineNum = 39976984;BA.debugLine="pe.Position=0";
_pe.setPosition((int) (0));
RDebugUtils.currentLine=39976985;
 //BA.debugLineNum = 39976985;BA.debugLine="If pe.GetString(\"cuantosPedidos\") = 0 Then B4XP";
if ((_pe.GetString("cuantosPedidos")).equals(BA.NumberToString(0))) { 
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");};
 };
 }else {
RDebugUtils.currentLine=39976988;
 //BA.debugLineNum = 39976988;BA.debugLine="Log(\"----->2<--------------\")";
anywheresoftware.b4a.keywords.Common.LogImpl("539976988","----->2<--------------",0);
RDebugUtils.currentLine=39976990;
 //BA.debugLineNum = 39976990;BA.debugLine="If cant <> 0 Then guardaProductoSinGestion(cedis";
if (_cant!=0) { 
_guardaproductosingestion(_ba,_cedis,_costou,BA.NumberToString(_cant),_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas);};
 };
RDebugUtils.currentLine=39976992;
 //BA.debugLineNum = 39976992;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=39976993;
 //BA.debugLineNum = 39976993;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=39714816;
 //BA.debugLineNum = 39714816;BA.debugLine="Sub traeFecha As String 'ignore";
RDebugUtils.currentLine=39714817;
 //BA.debugLineNum = 39714817;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MM/dd/yyyy");
RDebugUtils.currentLine=39714818;
 //BA.debugLineNum = 39714818;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=39714819;
 //BA.debugLineNum = 39714819;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=39714820;
 //BA.debugLineNum = 39714820;BA.debugLine="Return sDate & sTime";
if (true) return _sdate+_stime;
RDebugUtils.currentLine=39714821;
 //BA.debugLineNum = 39714821;BA.debugLine="End Sub";
return "";
}
public static String  _actualizaproducto2(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,int _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _cantc,String _bcajas) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "actualizaproducto2", false))
	 {return ((String) Debug.delegate(null, "actualizaproducto2", new Object[] {_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
int _antcant = 0;
int _difcant = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _pe = null;
RDebugUtils.currentLine=40108032;
 //BA.debugLineNum = 40108032;BA.debugLine="Sub actualizaProducto2(cedis As String, costoU As";
RDebugUtils.currentLine=40108033;
 //BA.debugLineNum = 40108033;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select * from pedido where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"))));
RDebugUtils.currentLine=40108035;
 //BA.debugLineNum = 40108035;BA.debugLine="LogColor($\"actualizaProducto, c=${clienteId}, p=$";
anywheresoftware.b4a.keywords.Common.LogImpl("540108035",("actualizaProducto, c="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+", p="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+", nombre="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_nombre))+", cant="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+", cedis="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+", tipo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipoventa))+""),anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=40108037;
 //BA.debugLineNum = 40108037;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=40108038;
 //BA.debugLineNum = 40108038;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40108039;
 //BA.debugLineNum = 40108039;BA.debugLine="Private antCant As Int = 0";
_antcant = (int) (0);
RDebugUtils.currentLine=40108040;
 //BA.debugLineNum = 40108040;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=40108041;
 //BA.debugLineNum = 40108041;BA.debugLine="Private difCant As Int = cant - antCant";
_difcant = (int) (_cant-_antcant);
RDebugUtils.currentLine=40108042;
 //BA.debugLineNum = 40108042;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update ped";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update pedido set pe_cant = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+", pe_costo_tot = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(Double.parseDouble(_cantc))*(double)(Double.parseDouble(_c.GetString("PE_COSTOU"))))))+", PE_CANTC = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cantc))+", PE_BCAJAS = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_bcajas))+" where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"));
RDebugUtils.currentLine=40108044;
 //BA.debugLineNum = 40108044;BA.debugLine="If B4XPages.MainPage.tipo_venta = \"VENTA\" Then";
if ((mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ).equals("VENTA")) { 
RDebugUtils.currentLine=40108045;
 //BA.debugLineNum = 40108045;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update ${";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" 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))+"' "));
 }else {
RDebugUtils.currentLine=40108047;
 //BA.debugLineNum = 40108047;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update CA";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD set cat_gp_almacen = cat_gp_almacen - ("+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_difcant))+") where cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' "));
RDebugUtils.currentLine=40108048;
 //BA.debugLineNum = 40108048;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"update CA";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update CAT_GUNAPROD4 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=40108051;
 //BA.debugLineNum = 40108051;BA.debugLine="If cant = 0 Then";
if (_cant==0) { 
RDebugUtils.currentLine=40108052;
 //BA.debugLineNum = 40108052;BA.debugLine="Log(\"BORRAMOS PROD\")";
anywheresoftware.b4a.keywords.Common.LogImpl("540108052","BORRAMOS PROD",0);
RDebugUtils.currentLine=40108053;
 //BA.debugLineNum = 40108053;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"delete fr";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("delete from pedido where pe_cedis = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cedis))+"' and pe_proid = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"' and pe_cliente = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_clienteid))+"' AND PE_FOLIO = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ))+"'"));
RDebugUtils.currentLine=40108054;
 //BA.debugLineNum = 40108054;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")));
RDebugUtils.currentLine=40108055;
 //BA.debugLineNum = 40108055;BA.debugLine="pe.Position=0";
_pe.setPosition((int) (0));
RDebugUtils.currentLine=40108056;
 //BA.debugLineNum = 40108056;BA.debugLine="If pe.GetString(\"cuantosPedidos\") = 0 Then B4XP";
if ((_pe.GetString("cuantosPedidos")).equals(BA.NumberToString(0))) { 
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");};
 };
 }else {
RDebugUtils.currentLine=40108060;
 //BA.debugLineNum = 40108060;BA.debugLine="If cant <> 0 Then guardaProductoSinGestion2(cedi";
if (_cant!=0) { 
_guardaproductosingestion2(_ba,_cedis,_costou,BA.NumberToString(_cant),_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas);};
 };
RDebugUtils.currentLine=40108062;
 //BA.debugLineNum = 40108062;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=40108063;
 //BA.debugLineNum = 40108063;BA.debugLine="End Sub";
return "";
}
public static String  _totalpedido(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "totalpedido", false))
	 {return ((String) Debug.delegate(null, "totalpedido", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _ct = null;
String _ptotal = "";
String _tempt = "";
RDebugUtils.currentLine=39452672;
 //BA.debugLineNum = 39452672;BA.debugLine="Sub totalPedido As String";
RDebugUtils.currentLine=39452673;
 //BA.debugLineNum = 39452673;BA.debugLine="Private cT As Cursor = Starter.skmt.ExecQuery($\"s";
_ct = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_ct = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select sum(PE_COSTO_TOT) as total from PEDIDO where PE_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"))));
RDebugUtils.currentLine=39452674;
 //BA.debugLineNum = 39452674;BA.debugLine="Private pTotal As String = \"0\"";
_ptotal = "0";
RDebugUtils.currentLine=39452675;
 //BA.debugLineNum = 39452675;BA.debugLine="If cT.RowCount > 0 Then";
if (_ct.getRowCount()>0) { 
RDebugUtils.currentLine=39452676;
 //BA.debugLineNum = 39452676;BA.debugLine="cT.Position = 0";
_ct.setPosition((int) (0));
RDebugUtils.currentLine=39452678;
 //BA.debugLineNum = 39452678;BA.debugLine="Private tempT As String = cT.GetLong(\"total\")";
_tempt = BA.NumberToString(_ct.GetLong("total"));
RDebugUtils.currentLine=39452679;
 //BA.debugLineNum = 39452679;BA.debugLine="If tempT <> \"null\" And tempT <> Null Then";
if ((_tempt).equals("null") == false && _tempt!= null) { 
RDebugUtils.currentLine=39452681;
 //BA.debugLineNum = 39452681;BA.debugLine="pTotal = tempT";
_ptotal = _tempt;
 };
 };
RDebugUtils.currentLine=39452685;
 //BA.debugLineNum = 39452685;BA.debugLine="cT.Close";
_ct.Close();
RDebugUtils.currentLine=39452686;
 //BA.debugLineNum = 39452686;BA.debugLine="Return pTotal";
if (true) return _ptotal;
RDebugUtils.currentLine=39452687;
 //BA.debugLineNum = 39452687;BA.debugLine="End Sub";
return "";
}
public static String  _traetipocliente2(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetipocliente2", false))
	 {return ((String) Debug.delegate(null, "traetipocliente2", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _x = null;
String _tc = "";
RDebugUtils.currentLine=36831232;
 //BA.debugLineNum = 36831232;BA.debugLine="Sub traeTipoCliente2 As String";
RDebugUtils.currentLine=36831233;
 //BA.debugLineNum = 36831233;BA.debugLine="Private x As Cursor";
_x = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=36831234;
 //BA.debugLineNum = 36831234;BA.debugLine="Private tc As String = \"DETALLE\"";
_tc = "DETALLE";
RDebugUtils.currentLine=36831235;
 //BA.debugLineNum = 36831235;BA.debugLine="x = Starter.skmt.ExecQuery($\"select IFNULL(CAT_CL";
_x = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select IFNULL(CAT_CL_TIPOCLIENTE,\"DETALLE\") AS CAT_CL_TIPOCLIENTE from kmt_info where cat_cl_codigo in (select cuenta from cuentaa)"))));
RDebugUtils.currentLine=36831236;
 //BA.debugLineNum = 36831236;BA.debugLine="If x.RowCount > 0 Then";
if (_x.getRowCount()>0) { 
RDebugUtils.currentLine=36831237;
 //BA.debugLineNum = 36831237;BA.debugLine="x.Position = 0";
_x.setPosition((int) (0));
RDebugUtils.currentLine=36831238;
 //BA.debugLineNum = 36831238;BA.debugLine="Log(\"aQUI\")";
anywheresoftware.b4a.keywords.Common.LogImpl("536831238","aQUI",0);
RDebugUtils.currentLine=36831239;
 //BA.debugLineNum = 36831239;BA.debugLine="Log(x.GetString(\"CAT_CL_TIPOCLIENTE\"))";
anywheresoftware.b4a.keywords.Common.LogImpl("536831239",_x.GetString("CAT_CL_TIPOCLIENTE"),0);
RDebugUtils.currentLine=36831240;
 //BA.debugLineNum = 36831240;BA.debugLine="If x.GetString(\"CAT_CL_TIPOCLIENTE\") = \"null\" Or";
if ((_x.GetString("CAT_CL_TIPOCLIENTE")).equals("null") || _x.GetString("CAT_CL_TIPOCLIENTE")== null || (_x.GetString("CAT_CL_TIPOCLIENTE")).equals(BA.NumberToString(0)) || (_x.GetString("CAT_CL_TIPOCLIENTE")).equals("0")) { 
RDebugUtils.currentLine=36831241;
 //BA.debugLineNum = 36831241;BA.debugLine="tc = \"DETALLE\"";
_tc = "DETALLE";
RDebugUtils.currentLine=36831242;
 //BA.debugLineNum = 36831242;BA.debugLine="Log(\"Aqui\")";
anywheresoftware.b4a.keywords.Common.LogImpl("536831242","Aqui",0);
 }else {
RDebugUtils.currentLine=36831244;
 //BA.debugLineNum = 36831244;BA.debugLine="tc = x.GetString(\"CAT_CL_TIPOCLIENTE\")";
_tc = _x.GetString("CAT_CL_TIPOCLIENTE");
RDebugUtils.currentLine=36831245;
 //BA.debugLineNum = 36831245;BA.debugLine="Log(\"Aqui2\")";
anywheresoftware.b4a.keywords.Common.LogImpl("536831245","Aqui2",0);
 };
 };
RDebugUtils.currentLine=36831251;
 //BA.debugLineNum = 36831251;BA.debugLine="Log(tc)";
anywheresoftware.b4a.keywords.Common.LogImpl("536831251",_tc,0);
RDebugUtils.currentLine=36831252;
 //BA.debugLineNum = 36831252;BA.debugLine="Return tc";
if (true) return _tc;
RDebugUtils.currentLine=36831253;
 //BA.debugLineNum = 36831253;BA.debugLine="End Sub";
return "";
}
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=40894464;
 //BA.debugLineNum = 40894464;BA.debugLine="Sub procesaPromocion(idPromo As String, cliente As";
RDebugUtils.currentLine=40894465;
 //BA.debugLineNum = 40894465;BA.debugLine="Private thisLog As Boolean = True  'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=40894466;
 //BA.debugLineNum = 40894466;BA.debugLine="Private inicioContador As String = DateTime.Now";
_iniciocontador = BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=40894467;
 //BA.debugLineNum = 40894467;BA.debugLine="If thisLog Then LogColor($\"********* Iniciamos re";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540894467",("********* Iniciamos revision de Promo "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idpromo))+" *********"),anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
RDebugUtils.currentLine=40894469;
 //BA.debugLineNum = 40894469;BA.debugLine="Private pm As Map = traePromo(idPromo, cliente)";
_pm = new anywheresoftware.b4a.objects.collections.Map();
_pm = _traepromo(_ba,_idpromo,_cliente);
RDebugUtils.currentLine=40894470;
 //BA.debugLineNum = 40894470;BA.debugLine="If thisLog Then LogColor(pm, Colors.Blue)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540894470",BA.ObjectToString(_pm),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=40894471;
 //BA.debugLineNum = 40894471;BA.debugLine="If pm.Get(\"resultado\") = \"ok\" Then 'Si encontramo";
if ((_pm.Get((Object)("resultado"))).equals((Object)("ok"))) { 
RDebugUtils.currentLine=40894473;
 //BA.debugLineNum = 40894473;BA.debugLine="If thisLog Then LogColor($\"Promociones permitida";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540894473",("Promociones permitidas="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traemaxpromos(_ba,_pm)))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=40894474;
 //BA.debugLineNum = 40894474;BA.debugLine="If thisLog Then Log(\"Promos vendidas: \" & traePr";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540894474","Promos vendidas: "+BA.NumberToString(_traepromosvendidas(_ba,_idpromo,_cliente)),0);};
RDebugUtils.currentLine=40894475;
 //BA.debugLineNum = 40894475;BA.debugLine="If traePromosVendidas(idPromo, cliente) >= traeM";
if (_traepromosvendidas(_ba,_idpromo,_cliente)>=_traemaxpromos(_ba,_pm)) { 
RDebugUtils.currentLine=40894476;
 //BA.debugLineNum = 40894476;BA.debugLine="If thisLog Then LogColor(\"Ya se vendieron las p";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540894476","Ya se vendieron las promos PERMITIDAS para el cliente",anywheresoftware.b4a.keywords.Common.Colors.Red);};
RDebugUtils.currentLine=40894477;
 //BA.debugLineNum = 40894477;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=40894480;
 //BA.debugLineNum = 40894480;BA.debugLine="Private inventarioSinFijos As Map = restaFijosPr";
_inventariosinfijos = new anywheresoftware.b4a.objects.collections.Map();
_inventariosinfijos = _restafijospromo(_ba,_pm);
RDebugUtils.currentLine=40894481;
 //BA.debugLineNum = 40894481;BA.debugLine="If thisLog Then LogColor(\"inventariosfijos=\"&inv";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540894481","inventariosfijos="+BA.ObjectToString(_inventariosinfijos),anywheresoftware.b4a.keywords.Common.Colors.Green);};
RDebugUtils.currentLine=40894483;
 //BA.debugLineNum = 40894483;BA.debugLine="If inventarioSinFijos.Get(\"resultado\") = \"ok\" Th";
if ((_inventariosinfijos.Get((Object)("resultado"))).equals((Object)("ok"))) { 
RDebugUtils.currentLine=40894485;
 //BA.debugLineNum = 40894485;BA.debugLine="Private pv As Boolean =  alcanzanLosVariablesPa";
_pv = _alcanzanlosvariablesparapromo(_ba,_pm,_inventariosinfijos);
RDebugUtils.currentLine=40894486;
 //BA.debugLineNum = 40894486;BA.debugLine="If thisLog Then Log(\"Alcanzan los variables? --";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540894486","Alcanzan los variables? --> "+BA.ObjectToString(_pv),0);};
RDebugUtils.currentLine=40894487;
 //BA.debugLineNum = 40894487;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=40894489;
 //BA.debugLineNum = 40894489;BA.debugLine="If thisLog Then LogColor(\"NO HAY INVENTARIO SUF";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540894489","NO HAY INVENTARIO SUFICIENTE "+_idpromo,anywheresoftware.b4a.keywords.Common.Colors.Red);};
RDebugUtils.currentLine=40894490;
 //BA.debugLineNum = 40894490;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=40894496;
 //BA.debugLineNum = 40894496;BA.debugLine="LogColor(\"TIEMPO DE PROCESO ESTA PROMO: \" & ((Dat";
anywheresoftware.b4a.keywords.Common.LogImpl("540894496","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=40894497;
 //BA.debugLineNum = 40894497;BA.debugLine="End Sub";
return null;
}
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=41746432;
 //BA.debugLineNum = 41746432;BA.debugLine="Sub hayPedido As Boolean";
RDebugUtils.currentLine=41746433;
 //BA.debugLineNum = 41746433;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select count(PE_CLIENTE) as hayPedido from PEDIDO where PE_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_traecliente(_ba)))+"'"))));
RDebugUtils.currentLine=41746434;
 //BA.debugLineNum = 41746434;BA.debugLine="thisC.Position=0";
_thisc.setPosition((int) (0));
RDebugUtils.currentLine=41746435;
 //BA.debugLineNum = 41746435;BA.debugLine="Private hay As Boolean = False";
_hay = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=41746436;
 //BA.debugLineNum = 41746436;BA.debugLine="If thisC.GetInt(\"hayPedido\") > 0 Then hay = True";
if (_thisc.GetInt("hayPedido")>0) { 
_hay = anywheresoftware.b4a.keywords.Common.True;};
RDebugUtils.currentLine=41746438;
 //BA.debugLineNum = 41746438;BA.debugLine="Return hay";
if (true) return _hay;
RDebugUtils.currentLine=41746439;
 //BA.debugLineNum = 41746439;BA.debugLine="End Sub";
return false;
}
public static String  _actualizaproductodinamico(anywheresoftware.b4a.BA _ba,String _cedis,float _costou,int _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _cantc,String _bcajas,String _dirigida,int _uvm,String _presentacion) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "actualizaproductodinamico", false))
	 {return ((String) Debug.delegate(null, "actualizaproductodinamico", new Object[] {_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas,_dirigida,_uvm,_presentacion}));}
String _qbusqueda = "";
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
String _tablainventario = "";
int _antcant = 0;
int _difcant = 0;
float _nuevocostotot = 0f;
String _qupdate = "";
String _qdelete = "";
int _totalrestante = 0;
RDebugUtils.currentLine=42074112;
 //BA.debugLineNum = 42074112;BA.debugLine="Sub actualizaProductoDinamico(cedis As String, cos";
RDebugUtils.currentLine=42074113;
 //BA.debugLineNum = 42074113;BA.debugLine="Log(\"--- Iniciando Actualización Dinámica ---\")";
anywheresoftware.b4a.keywords.Common.LogImpl("542074113","--- Iniciando Actualización Dinámica ---",0);
RDebugUtils.currentLine=42074116;
 //BA.debugLineNum = 42074116;BA.debugLine="Dim qBusqueda As String = \"SELECT PE_CANT, PE_COS";
_qbusqueda = "SELECT PE_CANT, PE_COSTOU FROM pedido WHERE pe_cedis = ? "+"AND pe_proid = ? AND pe_cliente = ? AND PE_FOLIO = ? "+"AND PE_DIRIGIDA = ? AND PE_PRESENTACION = ? AND PE_UVM = ?";
RDebugUtils.currentLine=42074120;
 //BA.debugLineNum = 42074120;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2(_qbusqueda,new String[]{_cedis,_prodid,_clienteid,_tipoventa,_dirigida,_presentacion,BA.NumberToString(_uvm)})));
RDebugUtils.currentLine=42074124;
 //BA.debugLineNum = 42074124;BA.debugLine="Dim tablaInventario As String = Starter.tabla";
_tablainventario = mostCurrent._starter._tabla /*String*/ ;
RDebugUtils.currentLine=42074127;
 //BA.debugLineNum = 42074127;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=42074129;
 //BA.debugLineNum = 42074129;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=42074130;
 //BA.debugLineNum = 42074130;BA.debugLine="Dim antCant As Int = c.GetInt(\"PE_CANT\")";
_antcant = _c.GetInt("PE_CANT");
RDebugUtils.currentLine=42074131;
 //BA.debugLineNum = 42074131;BA.debugLine="Dim difCant As Int = cant - antCant";
_difcant = (int) (_cant-_antcant);
RDebugUtils.currentLine=42074133;
 //BA.debugLineNum = 42074133;BA.debugLine="If cant > 0 Then";
if (_cant>0) { 
RDebugUtils.currentLine=42074135;
 //BA.debugLineNum = 42074135;BA.debugLine="Dim nuevoCostoTot As Float = (cant / uvm) * cos";
_nuevocostotot = (float) ((_cant/(double)_uvm)*_costou);
RDebugUtils.currentLine=42074137;
 //BA.debugLineNum = 42074137;BA.debugLine="Dim qUpdate As String = \"UPDATE pedido SET pe_c";
_qupdate = "UPDATE pedido SET pe_cant = ?, pe_costo_tot = ?, PE_CANTC = ?, PE_BCAJAS = ? "+"WHERE pe_cedis = ? AND pe_proid = ? AND pe_cliente = ? AND PE_FOLIO = ? "+"AND PE_PRESENTACION = ? AND PE_UVM = ?";
RDebugUtils.currentLine=42074141;
 //BA.debugLineNum = 42074141;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(qUpdate, A";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(_qupdate,anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_nuevocostotot),(Object)(_cantc),(Object)(_bcajas),(Object)(_cedis),(Object)(_prodid),(Object)(_clienteid),(Object)(_tipoventa),(Object)(_presentacion),(Object)(_uvm)}));
RDebugUtils.currentLine=42074145;
 //BA.debugLineNum = 42074145;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"UPDATE ${";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("UPDATE "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tablainventario))+" 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))+"'"));
 }else {
RDebugUtils.currentLine=42074148;
 //BA.debugLineNum = 42074148;BA.debugLine="Dim qDelete As String = \"DELETE FROM pedido WHE";
_qdelete = "DELETE FROM pedido WHERE pe_cedis = ? AND pe_proid = ? AND pe_cliente = ? "+"AND PE_FOLIO = ? AND PE_PRESENTACION = ? AND PE_UVM = ?";
RDebugUtils.currentLine=42074151;
 //BA.debugLineNum = 42074151;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(qDelete, A";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(_qdelete,anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cedis),(Object)(_prodid),(Object)(_clienteid),(Object)(_tipoventa),(Object)(_presentacion),(Object)(_uvm)}));
RDebugUtils.currentLine=42074154;
 //BA.debugLineNum = 42074154;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"UPDATE ${";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("UPDATE "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tablainventario))+" SET cat_gp_almacen = cat_gp_almacen + "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_antcant))+" WHERE cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"));
RDebugUtils.currentLine=42074157;
 //BA.debugLineNum = 42074157;BA.debugLine="Dim totalRestante As Int = B4XPages.MainPage.sk";
_totalrestante = (int)(Double.parseDouble(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuerySingleResult("SELECT count(*) FROM pedido WHERE pe_cliente = '"+_clienteid+"'")));
RDebugUtils.currentLine=42074158;
 //BA.debugLineNum = 42074158;BA.debugLine="If totalRestante = 0 Then";
if (_totalrestante==0) { 
RDebugUtils.currentLine=42074159;
 //BA.debugLineNum = 42074159;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"DELETE FR";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("DELETE FROM pedido_cliente WHERE PC_CLIENTE = '"+_clienteid+"'");
 };
 };
 }else {
RDebugUtils.currentLine=42074164;
 //BA.debugLineNum = 42074164;BA.debugLine="If cant > 0 Then";
if (_cant>0) { 
RDebugUtils.currentLine=42074165;
 //BA.debugLineNum = 42074165;BA.debugLine="guardaProductoSinGestionDinamico(cedis, costoU,";
_guardaproductosingestiondinamico(_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas,_dirigida,_uvm,_presentacion);
 };
 };
RDebugUtils.currentLine=42074168;
 //BA.debugLineNum = 42074168;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=42074169;
 //BA.debugLineNum = 42074169;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=41222144;
 //BA.debugLineNum = 41222144;BA.debugLine="Sub traeProdIdDeBD As Map 'ignore";
RDebugUtils.currentLine=41222145;
 //BA.debugLineNum = 41222145;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=41222146;
 //BA.debugLineNum = 41222146;BA.debugLine="Private m As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=41222147;
 //BA.debugLineNum = 41222147;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery($\"select CAT_G";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_TIPO,CAT_GP_SUBTIPO  from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" where CAT_GP_NOMBRE In (Select PDESC from PROID)"))));
RDebugUtils.currentLine=41222148;
 //BA.debugLineNum = 41222148;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=41222149;
 //BA.debugLineNum = 41222149;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=41222150;
 //BA.debugLineNum = 41222150;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=41222152;
 //BA.debugLineNum = 41222152;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=41222154;
 //BA.debugLineNum = 41222154;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=41222155;
 //BA.debugLineNum = 41222155;BA.debugLine="Return m";
if (true) return _m;
RDebugUtils.currentLine=41222156;
 //BA.debugLineNum = 41222156;BA.debugLine="End Sub";
return null;
}
public static String  _guardaproductosingestion(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,String _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _cantc,String _bcajas) throws Exception{
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,_cantc,_bcajas}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
RDebugUtils.currentLine=39911424;
 //BA.debugLineNum = 39911424;BA.debugLine="Sub guardaProductoSinGestion(cedis As String, cost";
RDebugUtils.currentLine=39911426;
 //BA.debugLineNum = 39911426;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39911427;
 //BA.debugLineNum = 39911427;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA,PE_COSTO_SIN,PE_FOLIO,PE_ENVIO_OK,PE_CANTC,PE_BCAJAS) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,0,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cedis),(Object)(((double)(Double.parseDouble(_cant))*(double)(Double.parseDouble(_costou)))),(Object)(_costou),(Object)(_cant),(Object)(_nombre),(Object)(_prodid),(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_rutav),(Object)(_preciosin),(Object)(_tipoventa),(Object)(_cantc),(Object)(_bcajas)}));
RDebugUtils.currentLine=39911428;
 //BA.debugLineNum = 39911428;BA.debugLine="If B4XPages.MainPage.tipo_venta = \"VENTA\" Then";
if ((mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ).equals("VENTA")) { 
RDebugUtils.currentLine=39911429;
 //BA.debugLineNum = 39911429;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update ${";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 }else {
RDebugUtils.currentLine=39911431;
 //BA.debugLineNum = 39911431;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update CA";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update CAT_GUNAPROD set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
RDebugUtils.currentLine=39911432;
 //BA.debugLineNum = 39911432;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update CA";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update CAT_GUNAPROD4 set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 };
RDebugUtils.currentLine=39911434;
 //BA.debugLineNum = 39911434;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")));
RDebugUtils.currentLine=39911435;
 //BA.debugLineNum = 39911435;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39911436;
 //BA.debugLineNum = 39911436;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");
RDebugUtils.currentLine=39911437;
 //BA.debugLineNum = 39911437;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_c.GetString("CANT_CLIE")),(Object)(_c.GetString("TOTAL_CLIE")),(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
RDebugUtils.currentLine=39911438;
 //BA.debugLineNum = 39911438;BA.debugLine="End Sub";
return "";
}
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.List _prodsvariables2 = null;
anywheresoftware.b4a.objects.collections.List _prodsvariablesprecios = null;
anywheresoftware.b4a.objects.collections.List _prodsvariablesprecios2 = null;
anywheresoftware.b4a.objects.collections.Map _prods = null;
anywheresoftware.b4a.objects.collections.Map _tipos = null;
int _i = 0;
String _pvr = "";
String _pvr2 = "";
RDebugUtils.currentLine=40501248;
 //BA.debugLineNum = 40501248;BA.debugLine="Sub traePromo(promo As String, cliente As String)";
RDebugUtils.currentLine=40501249;
 //BA.debugLineNum = 40501249;BA.debugLine="Private inicioContador As String = DateTime.Now";
_iniciocontador = BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=40501250;
 //BA.debugLineNum = 40501250;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select * from promos_comp where cat_pa_id = '"+_promo+"'")));
RDebugUtils.currentLine=40501251;
 //BA.debugLineNum = 40501251;BA.debugLine="Private siHistorico As String = 0";
_sihistorico = BA.NumberToString(0);
RDebugUtils.currentLine=40501252;
 //BA.debugLineNum = 40501252;BA.debugLine="Private promoMap As Map";
_promomap = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=40501253;
 //BA.debugLineNum = 40501253;BA.debugLine="Private prodsFijos, prodsFijosPrecios, prodsFijos";
_prodsfijos = new anywheresoftware.b4a.objects.collections.List();
_prodsfijosprecios = new anywheresoftware.b4a.objects.collections.List();
_prodsfijospiezas = new anywheresoftware.b4a.objects.collections.List();
_prodsvariables = new anywheresoftware.b4a.objects.collections.List();
_prodsvariables2 = new anywheresoftware.b4a.objects.collections.List();
_prodsvariablesprecios = new anywheresoftware.b4a.objects.collections.List();
_prodsvariablesprecios2 = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=40501254;
 //BA.debugLineNum = 40501254;BA.debugLine="promoMap.Initialize";
_promomap.Initialize();
RDebugUtils.currentLine=40501255;
 //BA.debugLineNum = 40501255;BA.debugLine="prodsFijos.Initialize";
_prodsfijos.Initialize();
RDebugUtils.currentLine=40501256;
 //BA.debugLineNum = 40501256;BA.debugLine="prodsFijosPrecios.Initialize";
_prodsfijosprecios.Initialize();
RDebugUtils.currentLine=40501257;
 //BA.debugLineNum = 40501257;BA.debugLine="prodsFijosPiezas.Initialize";
_prodsfijospiezas.Initialize();
RDebugUtils.currentLine=40501258;
 //BA.debugLineNum = 40501258;BA.debugLine="prodsVariables.Initialize";
_prodsvariables.Initialize();
RDebugUtils.currentLine=40501259;
 //BA.debugLineNum = 40501259;BA.debugLine="prodsVariables2.Initialize";
_prodsvariables2.Initialize();
RDebugUtils.currentLine=40501260;
 //BA.debugLineNum = 40501260;BA.debugLine="prodsVariablesPrecios.Initialize";
_prodsvariablesprecios.Initialize();
RDebugUtils.currentLine=40501261;
 //BA.debugLineNum = 40501261;BA.debugLine="prodsVariablesPrecios2.Initialize";
_prodsvariablesprecios2.Initialize();
RDebugUtils.currentLine=40501262;
 //BA.debugLineNum = 40501262;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40501263;
 //BA.debugLineNum = 40501263;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=40501264;
 //BA.debugLineNum = 40501264;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select count(*) as hist from HIST_PROMOS where HP_CLIENTE = '"+_cliente+"' and HP_CODIGO_PROMOCION = '"+_promo+"'")));
RDebugUtils.currentLine=40501265;
 //BA.debugLineNum = 40501265;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40501266;
 //BA.debugLineNum = 40501266;BA.debugLine="If c.GetString(\"hist\") > 0 Then siHistorico = 1";
if ((double)(Double.parseDouble(_c.GetString("hist")))>0) { 
_sihistorico = BA.NumberToString(1);};
RDebugUtils.currentLine=40501267;
 //BA.debugLineNum = 40501267;BA.debugLine="promoMap.Put(\"historico\", siHistorico)";
_promomap.Put((Object)("historico"),(Object)(_sihistorico));
RDebugUtils.currentLine=40501268;
 //BA.debugLineNum = 40501268;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("Select * from CAT_DETALLES_PAQ where CAT_DP_ID = '"+_promo+"'")));
RDebugUtils.currentLine=40501269;
 //BA.debugLineNum = 40501269;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40501270;
 //BA.debugLineNum = 40501270;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=40501271;
 //BA.debugLineNum = 40501271;BA.debugLine="Private prods, tipos As Map";
_prods = new anywheresoftware.b4a.objects.collections.Map();
_tipos = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=40501272;
 //BA.debugLineNum = 40501272;BA.debugLine="prods.Initialize";
_prods.Initialize();
RDebugUtils.currentLine=40501273;
 //BA.debugLineNum = 40501273;BA.debugLine="tipos.Initialize";
_tipos.Initialize();
RDebugUtils.currentLine=40501274;
 //BA.debugLineNum = 40501274;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step26 = 1;
final int limit26 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit26 ;_i = _i + step26 ) {
RDebugUtils.currentLine=40501275;
 //BA.debugLineNum = 40501275;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=40501276;
 //BA.debugLineNum = 40501276;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=40501277;
 //BA.debugLineNum = 40501277;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=40501278;
 //BA.debugLineNum = 40501278;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"0\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("0")) { 
RDebugUtils.currentLine=40501279;
 //BA.debugLineNum = 40501279;BA.debugLine="prodsFijos.Add(c.GetString(\"CAT_DP_IDPROD\"))";
_prodsfijos.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
RDebugUtils.currentLine=40501280;
 //BA.debugLineNum = 40501280;BA.debugLine="prodsFijosPrecios.Add(c.GetString(\"CAT_DP_PREC";
_prodsfijosprecios.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
RDebugUtils.currentLine=40501281;
 //BA.debugLineNum = 40501281;BA.debugLine="prodsFijosPiezas.Add(c.GetString(\"CAT_DP_PZAS\"";
_prodsfijospiezas.Add((Object)(_c.GetString("CAT_DP_PZAS")));
 };
RDebugUtils.currentLine=40501283;
 //BA.debugLineNum = 40501283;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"1\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("1")) { 
RDebugUtils.currentLine=40501284;
 //BA.debugLineNum = 40501284;BA.debugLine="prodsVariables.Add(c.GetString(\"CAT_DP_IDPROD\"";
_prodsvariables.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
RDebugUtils.currentLine=40501285;
 //BA.debugLineNum = 40501285;BA.debugLine="prodsVariablesPrecios.Add(c.GetString(\"CAT_DP_";
_prodsvariablesprecios.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
 };
RDebugUtils.currentLine=40501287;
 //BA.debugLineNum = 40501287;BA.debugLine="If c.GetString(\"CAT_DP_TIPO\") = \"2\" Then";
if ((_c.GetString("CAT_DP_TIPO")).equals("2")) { 
RDebugUtils.currentLine=40501289;
 //BA.debugLineNum = 40501289;BA.debugLine="prodsVariables2.Add(c.GetString(\"CAT_DP_IDPROD";
_prodsvariables2.Add((Object)(_c.GetString("CAT_DP_IDPROD")));
RDebugUtils.currentLine=40501290;
 //BA.debugLineNum = 40501290;BA.debugLine="prodsVariablesPrecios2.Add(c.GetString(\"CAT_DP";
_prodsvariablesprecios2.Add((Object)(_c.GetString("CAT_DP_PRECIO")));
 };
 }
};
RDebugUtils.currentLine=40501295;
 //BA.debugLineNum = 40501295;BA.debugLine="promoMap.Put(\"productos\", prods) 'Mapa con los p";
_promomap.Put((Object)("productos"),(Object)(_prods.getObject()));
RDebugUtils.currentLine=40501296;
 //BA.debugLineNum = 40501296;BA.debugLine="promoMap.Put(\"tipos\", tipos) 'Mapa con los produ";
_promomap.Put((Object)("tipos"),(Object)(_tipos.getObject()));
RDebugUtils.currentLine=40501297;
 //BA.debugLineNum = 40501297;BA.debugLine="promoMap.Put(\"prodsFijos\", prodsFijos) 'Lista de";
_promomap.Put((Object)("prodsFijos"),(Object)(_prodsfijos.getObject()));
RDebugUtils.currentLine=40501298;
 //BA.debugLineNum = 40501298;BA.debugLine="promoMap.Put(\"prodsVariables\", prodsVariables) '";
_promomap.Put((Object)("prodsVariables"),(Object)(_prodsvariables.getObject()));
RDebugUtils.currentLine=40501299;
 //BA.debugLineNum = 40501299;BA.debugLine="promoMap.Put(\"prodsVariables2\", prodsVariables2)";
_promomap.Put((Object)("prodsVariables2"),(Object)(_prodsvariables2.getObject()));
RDebugUtils.currentLine=40501300;
 //BA.debugLineNum = 40501300;BA.debugLine="promoMap.Put(\"prodsFijosCant\", prodsFijos.Size)";
_promomap.Put((Object)("prodsFijosCant"),(Object)(_prodsfijos.getSize()));
RDebugUtils.currentLine=40501301;
 //BA.debugLineNum = 40501301;BA.debugLine="promoMap.Put(\"prodsFijosPrecios\", prodsFijosPrec";
_promomap.Put((Object)("prodsFijosPrecios"),(Object)(_prodsfijosprecios.getObject()));
RDebugUtils.currentLine=40501302;
 //BA.debugLineNum = 40501302;BA.debugLine="promoMap.Put(\"prodsFijosPiezas\", prodsFijosPieza";
_promomap.Put((Object)("prodsFijosPiezas"),(Object)(_prodsfijospiezas.getObject()));
RDebugUtils.currentLine=40501303;
 //BA.debugLineNum = 40501303;BA.debugLine="promoMap.Put(\"prodsVariablesCant\", prodsVariable";
_promomap.Put((Object)("prodsVariablesCant"),(Object)(_prodsvariables.getSize()));
RDebugUtils.currentLine=40501304;
 //BA.debugLineNum = 40501304;BA.debugLine="promoMap.Put(\"prodsVariables2Cant\", prodsVariabl";
_promomap.Put((Object)("prodsVariables2Cant"),(Object)(_prodsvariables2.getSize()));
RDebugUtils.currentLine=40501305;
 //BA.debugLineNum = 40501305;BA.debugLine="promoMap.Put(\"prodsVariablesPrecios\", prodsVaria";
_promomap.Put((Object)("prodsVariablesPrecios"),(Object)(_prodsvariablesprecios.getObject()));
RDebugUtils.currentLine=40501306;
 //BA.debugLineNum = 40501306;BA.debugLine="promoMap.Put(\"prodsVariablesPrecios2\", prodsVari";
_promomap.Put((Object)("prodsVariablesPrecios2"),(Object)(_prodsvariablesprecios2.getObject()));
RDebugUtils.currentLine=40501307;
 //BA.debugLineNum = 40501307;BA.debugLine="promoMap.Put(\"resultado\", \"ok\")";
_promomap.Put((Object)("resultado"),(Object)("ok"));
 }else {
RDebugUtils.currentLine=40501309;
 //BA.debugLineNum = 40501309;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=40501311;
 //BA.debugLineNum = 40501311;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery2($\"Select CA";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2(("Select CAT_GP_STS, CAT_GP_IMP1, CAT_GP_NOMBRE from "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" where CAT_GP_ID = ?"),new String[]{_promo})));
RDebugUtils.currentLine=40501312;
 //BA.debugLineNum = 40501312;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40501313;
 //BA.debugLineNum = 40501313;BA.debugLine="Private pvr As String = 0";
_pvr = BA.NumberToString(0);
RDebugUtils.currentLine=40501314;
 //BA.debugLineNum = 40501314;BA.debugLine="Private pvr2 As String = 0";
_pvr2 = BA.NumberToString(0);
RDebugUtils.currentLine=40501315;
 //BA.debugLineNum = 40501315;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=40501316;
 //BA.debugLineNum = 40501316;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40501317;
 //BA.debugLineNum = 40501317;BA.debugLine="pvr = c.GetString(\"CAT_GP_STS\")";
_pvr = _c.GetString("CAT_GP_STS");
RDebugUtils.currentLine=40501318;
 //BA.debugLineNum = 40501318;BA.debugLine="pvr2 = c.GetString(\"CAT_GP_IMP1\")";
_pvr2 = _c.GetString("CAT_GP_IMP1");
RDebugUtils.currentLine=40501319;
 //BA.debugLineNum = 40501319;BA.debugLine="If pvr = Null Or pvr = \"null\" Then pvr = 0";
if (_pvr== null || (_pvr).equals("null")) { 
_pvr = BA.NumberToString(0);};
RDebugUtils.currentLine=40501320;
 //BA.debugLineNum = 40501320;BA.debugLine="If pvr2 = Null Or pvr2 = \"null\" Then pvr2 = 0";
if (_pvr2== null || (_pvr2).equals("null")) { 
_pvr2 = BA.NumberToString(0);};
RDebugUtils.currentLine=40501321;
 //BA.debugLineNum = 40501321;BA.debugLine="promoMap.Put(\"prodsVariablesRequeridos\", pvr) 'C";
_promomap.Put((Object)("prodsVariablesRequeridos"),(Object)(_pvr));
RDebugUtils.currentLine=40501322;
 //BA.debugLineNum = 40501322;BA.debugLine="promoMap.Put(\"prodsVariables2Requeridos\", pvr2)";
_promomap.Put((Object)("prodsVariables2Requeridos"),(Object)(_pvr2));
RDebugUtils.currentLine=40501323;
 //BA.debugLineNum = 40501323;BA.debugLine="promoMap.put(\"descripcion\", c.GetString(\"CAT_GP_";
_promomap.Put((Object)("descripcion"),(Object)(_c.GetString("CAT_GP_NOMBRE")));
 };
RDebugUtils.currentLine=40501325;
 //BA.debugLineNum = 40501325;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=40501330;
 //BA.debugLineNum = 40501330;BA.debugLine="Return promoMap";
if (true) return _promomap;
RDebugUtils.currentLine=40501331;
 //BA.debugLineNum = 40501331;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=40566784;
 //BA.debugLineNum = 40566784;BA.debugLine="Sub traemosInventarioDisponibleParaPromo(promo As";
RDebugUtils.currentLine=40566785;
 //BA.debugLineNum = 40566785;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=40566786;
 //BA.debugLineNum = 40566786;BA.debugLine="Log(\"ESTAMOS VIENDO INVENTARIO\")";
anywheresoftware.b4a.keywords.Common.LogImpl("540566786","ESTAMOS VIENDO INVENTARIO",0);
RDebugUtils.currentLine=40566787;
 //BA.debugLineNum = 40566787;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery2($\"SELECT CA";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2(("SELECT CAT_GP_ID, CAT_GP_ALMACEN FROM "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" WHERE CAT_GP_ID IN (select CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = ?)"),new String[]{_promo})));
RDebugUtils.currentLine=40566790;
 //BA.debugLineNum = 40566790;BA.debugLine="Private prods As Map";
_prods = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=40566791;
 //BA.debugLineNum = 40566791;BA.debugLine="prods.Initialize";
_prods.Initialize();
RDebugUtils.currentLine=40566792;
 //BA.debugLineNum = 40566792;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=40566794;
 //BA.debugLineNum = 40566794;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step7 = 1;
final int limit7 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit7 ;_i = _i + step7 ) {
RDebugUtils.currentLine=40566795;
 //BA.debugLineNum = 40566795;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=40566796;
 //BA.debugLineNum = 40566796;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=40566801;
 //BA.debugLineNum = 40566801;BA.debugLine="Return prods";
if (true) return _prods;
RDebugUtils.currentLine=40566802;
 //BA.debugLineNum = 40566802;BA.debugLine="End Sub";
return null;
}
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=41025536;
 //BA.debugLineNum = 41025536;BA.debugLine="Sub revisaMaxPromosProdsFijosPorInventario(pm As M";
RDebugUtils.currentLine=41025537;
 //BA.debugLineNum = 41025537;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=41025538;
 //BA.debugLineNum = 41025538;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=41025539;
 //BA.debugLineNum = 41025539;BA.debugLine="Private t As List";
_t = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=41025540;
 //BA.debugLineNum = 41025540;BA.debugLine="t.Initialize";
_t.Initialize();
RDebugUtils.currentLine=41025541;
 //BA.debugLineNum = 41025541;BA.debugLine="t.Add(traeMaxPromos(pm)) ' Agregamos a la lista l";
_t.Add((Object)(_traemaxpromos(_ba,_pm)));
RDebugUtils.currentLine=41025542;
 //BA.debugLineNum = 41025542;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
RDebugUtils.currentLine=41025543;
 //BA.debugLineNum = 41025543;BA.debugLine="If thisLog Then LogColor($\"pm=${pm}\"$, Colors.Blu";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541025543",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41025544;
 //BA.debugLineNum = 41025544;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=41025545;
 //BA.debugLineNum = 41025545;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541025545",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
RDebugUtils.currentLine=41025546;
 //BA.debugLineNum = 41025546;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=41025547;
 //BA.debugLineNum = 41025547;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=41025548;
 //BA.debugLineNum = 41025548;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=41025549;
 //BA.debugLineNum = 41025549;BA.debugLine="If thisLog Then Log($\"id=${idProdsFijos.Get(p)},";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541025549",("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=41025550;
 //BA.debugLineNum = 41025550;BA.debugLine="If thisLog Then Log($\"${(invDispParaPromo.Get(id";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541025550",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(((double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsfijos.Get(_p))))/(double)(double)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p))))))+""),0);};
RDebugUtils.currentLine=41025551;
 //BA.debugLineNum = 41025551;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=41025552;
 //BA.debugLineNum = 41025552;BA.debugLine="If thisLog Then Log(x(0))";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541025552",_x[(int) (0)],0);};
RDebugUtils.currentLine=41025553;
 //BA.debugLineNum = 41025553;BA.debugLine="t.Add(x(0).As(Int)) 'Solo guardamos la parte del";
_t.Add((Object)(((int)(Double.parseDouble(_x[(int) (0)])))));
 }
};
RDebugUtils.currentLine=41025555;
 //BA.debugLineNum = 41025555;BA.debugLine="t.Sort(True) 'Ordenamos la lista para que en el l";
_t.Sort(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=41025556;
 //BA.debugLineNum = 41025556;BA.debugLine="If thisLog Then LogColor($\"prodsFijos=${idProdsFi";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541025556",("prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsfijos.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41025557;
 //BA.debugLineNum = 41025557;BA.debugLine="If thisLog Then LogColor($\"prodsFijosPiezasReq=${";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541025557",("prodsFijosPiezasReq="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsfijospiezas.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41025558;
 //BA.debugLineNum = 41025558;BA.debugLine="If thisLog Then LogColor($\"invFijoXpromo=${invFij";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541025558",("invFijoXpromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invfijoxpromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41025560;
 //BA.debugLineNum = 41025560;BA.debugLine="Return t.Get(0) 'Regresamos el resultado mas pequ";
if (true) return (int)(BA.ObjectToNumber(_t.Get((int) (0))));
RDebugUtils.currentLine=41025561;
 //BA.debugLineNum = 41025561;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;
int _totalprodsvariables2disponibles = 0;
anywheresoftware.b4a.objects.collections.Map _invdispparapromo = null;
String _maxpromos = "";
int _maxpromosxfijos = 0;
anywheresoftware.b4a.objects.collections.List _idprodsvariables = null;
anywheresoftware.b4a.objects.collections.List _idprodsvariables2 = null;
int _prodsvariablesrequeridos = 0;
int _prodsvariables2requeridos = 0;
anywheresoftware.b4a.objects.collections.List _prodsfijospiezas = null;
anywheresoftware.b4a.objects.collections.List _idprodsfijos = null;
int _p = 0;
String _idesteprod = "";
int _investeprod = 0;
int _pzasreqesteprod = 0;
int _maxpromosxvariables = 0;
int _maxpromosxvariables2 = 0;
int _x = 0;
int _i = 0;
RDebugUtils.currentLine=41091072;
 //BA.debugLineNum = 41091072;BA.debugLine="Sub revisaMaxPromosProdsVariablesPorInventario(pm";
RDebugUtils.currentLine=41091073;
 //BA.debugLineNum = 41091073;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=41091074;
 //BA.debugLineNum = 41091074;BA.debugLine="If thisLog Then Log(\"============================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091074","======================================================",0);};
RDebugUtils.currentLine=41091075;
 //BA.debugLineNum = 41091075;BA.debugLine="If thisLog Then Log(\"============================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091075","======================================================",0);};
RDebugUtils.currentLine=41091076;
 //BA.debugLineNum = 41091076;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=41091077;
 //BA.debugLineNum = 41091077;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
RDebugUtils.currentLine=41091078;
 //BA.debugLineNum = 41091078;BA.debugLine="Private totalProdsVariablesDisponibles As Int = 0";
_totalprodsvariablesdisponibles = (int) (0);
RDebugUtils.currentLine=41091079;
 //BA.debugLineNum = 41091079;BA.debugLine="Private totalProdsVariables2Disponibles As Int =";
_totalprodsvariables2disponibles = (int) (0);
RDebugUtils.currentLine=41091080;
 //BA.debugLineNum = 41091080;BA.debugLine="If thisLog Then LogColor($\"pm=${pm}\"$, Colors.Blu";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091080",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41091081;
 //BA.debugLineNum = 41091081;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=41091082;
 //BA.debugLineNum = 41091082;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091082",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
RDebugUtils.currentLine=41091083;
 //BA.debugLineNum = 41091083;BA.debugLine="Private maxPromos As String = traeMaxPromos(pm)";
_maxpromos = BA.NumberToString(_traemaxpromos(_ba,_pm));
RDebugUtils.currentLine=41091084;
 //BA.debugLineNum = 41091084;BA.debugLine="Private maxPromosXFijos As Int = revisaMaxPromosP";
_maxpromosxfijos = _revisamaxpromosprodsfijosporinventario(_ba,_pm);
RDebugUtils.currentLine=41091085;
 //BA.debugLineNum = 41091085;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=41091086;
 //BA.debugLineNum = 41091086;BA.debugLine="Private idProdsVariables2 As List = pm.Get(\"prods";
_idprodsvariables2 = new anywheresoftware.b4a.objects.collections.List();
_idprodsvariables2 = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_pm.Get((Object)("prodsVariables2"))));
RDebugUtils.currentLine=41091087;
 //BA.debugLineNum = 41091087;BA.debugLine="Private prodsVariablesRequeridos As Int = pm.Get(";
_prodsvariablesrequeridos = (int)(BA.ObjectToNumber(_pm.Get((Object)("prodsVariablesRequeridos"))));
RDebugUtils.currentLine=41091088;
 //BA.debugLineNum = 41091088;BA.debugLine="Private prodsVariables2Requeridos As Int = pm.Get";
_prodsvariables2requeridos = (int)(BA.ObjectToNumber(_pm.Get((Object)("prodsVariables2Requeridos"))));
RDebugUtils.currentLine=41091089;
 //BA.debugLineNum = 41091089;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=41091090;
 //BA.debugLineNum = 41091090;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=41091091;
 //BA.debugLineNum = 41091091;BA.debugLine="For p = 0 To idProdsFijos.Size -1 'Generamos mapa";
{
final int step19 = 1;
final int limit19 = (int) (_idprodsfijos.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit19 ;_p = _p + step19 ) {
RDebugUtils.currentLine=41091092;
 //BA.debugLineNum = 41091092;BA.debugLine="invFijoXpromo.Put(idProdsFijos.Get(p), prodsFijo";
_invfijoxpromo.Put(_idprodsfijos.Get(_p),_prodsfijospiezas.Get(_p));
RDebugUtils.currentLine=41091093;
 //BA.debugLineNum = 41091093;BA.debugLine="Private idEsteProd As String = idProdsFijos.Get(";
_idesteprod = BA.ObjectToString(_idprodsfijos.Get(_p));
RDebugUtils.currentLine=41091094;
 //BA.debugLineNum = 41091094;BA.debugLine="Private invEsteProd As Int = invDispParaPromo.Ge";
_investeprod = (int)(BA.ObjectToNumber(_invdispparapromo.Get((Object)(_idesteprod))));
RDebugUtils.currentLine=41091095;
 //BA.debugLineNum = 41091095;BA.debugLine="Private pzasReqEsteProd As Int = prodsFijosPieza";
_pzasreqesteprod = (int)(BA.ObjectToNumber(_prodsfijospiezas.Get(_p)));
RDebugUtils.currentLine=41091096;
 //BA.debugLineNum = 41091096;BA.debugLine="If thisLog Then Log($\"id=${idEsteProd}, inv=${in";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091096",("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=41091099;
 //BA.debugLineNum = 41091099;BA.debugLine="If thisLog Then LogColor($\"MaxPromos=${maxPromos}";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091099",("MaxPromos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromos))+", promosXFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_maxpromosxfijos))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41091100;
 //BA.debugLineNum = 41091100;BA.debugLine="If thisLog Then LogColor($\"prodsFijos=${idProdsFi";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091100",("prodsFijos="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsfijos.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41091101;
 //BA.debugLineNum = 41091101;BA.debugLine="If thisLog Then LogColor($\"prodsFijosPiezasReq=${";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091101",("prodsFijosPiezasReq="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsfijospiezas.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41091102;
 //BA.debugLineNum = 41091102;BA.debugLine="If thisLog Then LogColor($\"prodsVariables=${idPro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091102",("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=41091103;
 //BA.debugLineNum = 41091103;BA.debugLine="If thisLog Then LogColor($\"prodsVariables2=${idPr";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091103",("prodsVariables2="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_idprodsvariables2.getObject()))+""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.CRLF))+"Variables2 Req="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsvariables2requeridos))+" "),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41091104;
 //BA.debugLineNum = 41091104;BA.debugLine="If thisLog Then LogColor($\"invFijoXpromo=${invFij";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091104",("invFijoXpromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invfijoxpromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41091105;
 //BA.debugLineNum = 41091105;BA.debugLine="If thisLog Then Log($\"Prods variables disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091105",("Prods variables disponibles = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariablesdisponibles))+""),0);};
RDebugUtils.currentLine=41091106;
 //BA.debugLineNum = 41091106;BA.debugLine="If thisLog Then Log($\"Prods variables2 disponible";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091106",("Prods variables2 disponibles = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariables2disponibles))+""),0);};
RDebugUtils.currentLine=41091107;
 //BA.debugLineNum = 41091107;BA.debugLine="Private maxPromosXVariables As Int = 0";
_maxpromosxvariables = (int) (0);
RDebugUtils.currentLine=41091108;
 //BA.debugLineNum = 41091108;BA.debugLine="Private maxPromosXVariables2 As Int = 0";
_maxpromosxvariables2 = (int) (0);
RDebugUtils.currentLine=41091109;
 //BA.debugLineNum = 41091109;BA.debugLine="For x = 1 To maxPromosXFijos";
{
final int step36 = 1;
final int limit36 = _maxpromosxfijos;
_x = (int) (1) ;
for (;_x <= limit36 ;_x = _x + step36 ) {
RDebugUtils.currentLine=41091110;
 //BA.debugLineNum = 41091110;BA.debugLine="If thisLog Then Log(\"===========================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091110","=====================================================",0);};
RDebugUtils.currentLine=41091111;
 //BA.debugLineNum = 41091111;BA.debugLine="If thisLog Then Log(\"===========================";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091111","=====================================================",0);};
RDebugUtils.currentLine=41091112;
 //BA.debugLineNum = 41091112;BA.debugLine="For i = 0 To idProdsFijos.Size - 1";
{
final int step39 = 1;
final int limit39 = (int) (_idprodsfijos.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit39 ;_i = _i + step39 ) {
RDebugUtils.currentLine=41091113;
 //BA.debugLineNum = 41091113;BA.debugLine="If thisLog Then Log($\"FIJO - ${idProdsFijos.Get";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091113",("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=41091114;
 //BA.debugLineNum = 41091114;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=41091116;
 //BA.debugLineNum = 41091116;BA.debugLine="If thisLog Then LogColor(\"Inv disponible despues";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091116","Inv disponible despues de restar fijos = "+BA.ObjectToString(_invdispparapromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=41091118;
 //BA.debugLineNum = 41091118;BA.debugLine="totalProdsVariablesDisponibles = 0";
_totalprodsvariablesdisponibles = (int) (0);
RDebugUtils.currentLine=41091119;
 //BA.debugLineNum = 41091119;BA.debugLine="totalProdsVariables2Disponibles = 0";
_totalprodsvariables2disponibles = (int) (0);
RDebugUtils.currentLine=41091120;
 //BA.debugLineNum = 41091120;BA.debugLine="For i = 0 To idProdsVariables.Size - 1 'Obtenemo";
{
final int step46 = 1;
final int limit46 = (int) (_idprodsvariables.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit46 ;_i = _i + step46 ) {
RDebugUtils.currentLine=41091121;
 //BA.debugLineNum = 41091121;BA.debugLine="If invDispParaPromo.ContainsKey(idProdsVariable";
if (_invdispparapromo.ContainsKey(_idprodsvariables.Get(_i))) { 
RDebugUtils.currentLine=41091122;
 //BA.debugLineNum = 41091122;BA.debugLine="totalProdsVariablesDisponibles = totalProdsVar";
_totalprodsvariablesdisponibles = (int) (_totalprodsvariablesdisponibles+(double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsvariables.Get(_i)))));
 };
 }
};
RDebugUtils.currentLine=41091125;
 //BA.debugLineNum = 41091125;BA.debugLine="For i = 0 To idProdsVariables2.Size - 1 'Obtenem";
{
final int step51 = 1;
final int limit51 = (int) (_idprodsvariables2.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit51 ;_i = _i + step51 ) {
RDebugUtils.currentLine=41091126;
 //BA.debugLineNum = 41091126;BA.debugLine="If invDispParaPromo.ContainsKey(idProdsVariable";
if (_invdispparapromo.ContainsKey(_idprodsvariables2.Get(_i))) { 
RDebugUtils.currentLine=41091127;
 //BA.debugLineNum = 41091127;BA.debugLine="totalProdsVariables2Disponibles = totalProdsVa";
_totalprodsvariables2disponibles = (int) (_totalprodsvariables2disponibles+(double)(BA.ObjectToNumber(_invdispparapromo.Get(_idprodsvariables2.Get(_i)))));
 };
 }
};
RDebugUtils.currentLine=41091131;
 //BA.debugLineNum = 41091131;BA.debugLine="If thisLog Then Log($\"Var disponibles -  var req";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091131",("Var disponibles -  var requeridos : "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_totalprodsvariablesdisponibles))+" - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodsvariablesrequeridos*_x))+""),0);};
RDebugUtils.currentLine=41091132;
 //BA.debugLineNum = 41091132;BA.debugLine="totalProdsVariablesDisponibles = totalProdsVaria";
_totalprodsvariablesdisponibles = (int) (_totalprodsvariablesdisponibles-(_prodsvariablesrequeridos*_x));
RDebugUtils.currentLine=41091133;
 //BA.debugLineNum = 41091133;BA.debugLine="totalProdsVariables2Disponibles = totalProdsVari";
_totalprodsvariables2disponibles = (int) (_totalprodsvariables2disponibles-(_prodsvariables2requeridos*_x));
RDebugUtils.currentLine=41091134;
 //BA.debugLineNum = 41091134;BA.debugLine="If thisLog Then Log(\"prodsVariables disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091134","prodsVariables disponibles despues de promo = "+BA.NumberToString(_totalprodsvariablesdisponibles),0);};
RDebugUtils.currentLine=41091135;
 //BA.debugLineNum = 41091135;BA.debugLine="If thisLog Then Log(\"prodsVariables2 disponibles";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091135","prodsVariables2 disponibles despues de promo = "+BA.NumberToString(_totalprodsvariables2disponibles),0);};
RDebugUtils.currentLine=41091136;
 //BA.debugLineNum = 41091136;BA.debugLine="If totalProdsVariablesDisponibles < 0 Then Exit";
if (_totalprodsvariablesdisponibles<0) { 
if (true) break;};
RDebugUtils.currentLine=41091137;
 //BA.debugLineNum = 41091137;BA.debugLine="If totalProdsVariables2Disponibles < 0 Then Exit";
if (_totalprodsvariables2disponibles<0) { 
if (true) break;};
RDebugUtils.currentLine=41091138;
 //BA.debugLineNum = 41091138;BA.debugLine="maxPromosXVariables = x";
_maxpromosxvariables = _x;
 }
};
RDebugUtils.currentLine=41091141;
 //BA.debugLineNum = 41091141;BA.debugLine="If thisLog Then LogColor(\"Max promos de prodsVari";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("541091141","Max promos de prodsVariables POR inventario = "+BA.NumberToString(_maxpromosxvariables),anywheresoftware.b4a.keywords.Common.Colors.Red);};
RDebugUtils.currentLine=41091142;
 //BA.debugLineNum = 41091142;BA.debugLine="Return maxPromosXVariables";
if (true) return _maxpromosxvariables;
RDebugUtils.currentLine=41091143;
 //BA.debugLineNum = 41091143;BA.debugLine="End Sub";
return 0;
}
public static String  _centraboton(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ButtonWrapper _elemento,int _anchoelementosuperior) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "centraboton", false))
	 {return ((String) Debug.delegate(null, "centraboton", new Object[] {_ba,_elemento,_anchoelementosuperior}));}
RDebugUtils.currentLine=36896768;
 //BA.debugLineNum = 36896768;BA.debugLine="Sub centraBoton(elemento As Button, anchoElementoS";
RDebugUtils.currentLine=36896769;
 //BA.debugLineNum = 36896769;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=36896770;
 //BA.debugLineNum = 36896770;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=37683200;
 //BA.debugLineNum = 37683200;BA.debugLine="Sub revisaBD 'ignore";
RDebugUtils.currentLine=37683204;
 //BA.debugLineNum = 37683204;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=37683205;
 //BA.debugLineNum = 37683205;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=37683206;
 //BA.debugLineNum = 37683206;BA.debugLine="LogColor(\"copiamos kmt.db de \"&File.DirAssets &";
anywheresoftware.b4a.keywords.Common.LogImpl("537683206","copiamos kmt.db de "+anywheresoftware.b4a.keywords.Common.File.getDirAssets()+" a "+mostCurrent._starter._ruta /*String*/ ,anywheresoftware.b4a.keywords.Common.Colors.Green);
 };
RDebugUtils.currentLine=37683208;
 //BA.debugLineNum = 37683208;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=37683209;
 //BA.debugLineNum = 37683209;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=37683211;
 //BA.debugLineNum = 37683211;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS bita";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)");
RDebugUtils.currentLine=37683213;
 //BA.debugLineNum = 37683213;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS ABON";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS ABONOSP(NOTA TEXT, CLIENTE TEXT, SALDO_PENDIENTE TEXT)");
RDebugUtils.currentLine=37683214;
 //BA.debugLineNum = 37683214;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS CLIE";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CLIENTE_NUEVO(CN_ID_CLIENTE TEXT, CN_NOMBRE TEXT, CN_enviado text)");
RDebugUtils.currentLine=37683215;
 //BA.debugLineNum = 37683215;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS RUTA";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS RUTA_SUPLENCIA(RS_RUTA TEXT)");
RDebugUtils.currentLine=37683216;
 //BA.debugLineNum = 37683216;BA.debugLine="Try 'Si no existe la columna PC_ENVIO_OK la agreg";
try {RDebugUtils.currentLine=37683217;
 //BA.debugLineNum = 37683217;BA.debugLine="kmt.ExecQuery(\"select count(PC_ENVIO_OK) from PE";
_kmt.ExecQuery("select count(PC_ENVIO_OK) from PEDIDO_CLIENTE");
 } 
       catch (Exception e14) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e14);RDebugUtils.currentLine=37683219;
 //BA.debugLineNum = 37683219;BA.debugLine="Try";
try {RDebugUtils.currentLine=37683220;
 //BA.debugLineNum = 37683220;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE PEDIDO_CLIENTE AD";
_kmt.ExecNonQuery("ALTER TABLE PEDIDO_CLIENTE ADD COLUMN PC_ENVIO_OK INTEGER");
 } 
       catch (Exception e17) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e17);RDebugUtils.currentLine=37683222;
 //BA.debugLineNum = 37683222;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_ENVI";
anywheresoftware.b4a.keywords.Common.LogImpl("537683222","No pudimos agregar la columna PC_ENVIO_OK.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=37683223;
 //BA.debugLineNum = 37683223;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("537683223",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=37683227;
 //BA.debugLineNum = 37683227;BA.debugLine="Try 'Si no existe la columna CAT_CL_DIAS_VISITA l";
try {RDebugUtils.currentLine=37683228;
 //BA.debugLineNum = 37683228;BA.debugLine="kmt.ExecQuery(\"select count(CAT_CL_DIAS_VISITA)";
_kmt.ExecQuery("select count(CAT_CL_DIAS_VISITA) from kmt_info2");
 } 
       catch (Exception e24) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e24);RDebugUtils.currentLine=37683230;
 //BA.debugLineNum = 37683230;BA.debugLine="Try";
try {RDebugUtils.currentLine=37683231;
 //BA.debugLineNum = 37683231;BA.debugLine="kmt.ExecNonQuery(\"ALTER TABLE kmt_info2 ADD COL";
_kmt.ExecNonQuery("ALTER TABLE kmt_info2 ADD COLUMN CAT_CL_DIAS_VISITA TEXT");
 } 
       catch (Exception e27) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e27);RDebugUtils.currentLine=37683233;
 //BA.debugLineNum = 37683233;BA.debugLine="LogColor(\"No pudimos agregar la columna CAT_CL_";
anywheresoftware.b4a.keywords.Common.LogImpl("537683233","No pudimos agregar la columna CAT_CL_DIAS_VISITA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=37683234;
 //BA.debugLineNum = 37683234;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("537683234",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=37683238;
 //BA.debugLineNum = 37683238;BA.debugLine="Try 'Si no existe la columna PC_ENVIO_OK la agreg";
try {RDebugUtils.currentLine=37683239;
 //BA.debugLineNum = 37683239;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=37683241;
 //BA.debugLineNum = 37683241;BA.debugLine="Try";
try {RDebugUtils.currentLine=37683242;
 //BA.debugLineNum = 37683242;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=37683244;
 //BA.debugLineNum = 37683244;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_TIEM";
anywheresoftware.b4a.keywords.Common.LogImpl("537683244","No pudimos agregar la columna PC_TIEMPO_TIENDA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=37683245;
 //BA.debugLineNum = 37683245;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("537683245",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=37683248;
 //BA.debugLineNum = 37683248;BA.debugLine="Try 'Si no existe la columna PC_FACTURA la agrega";
try {RDebugUtils.currentLine=37683249;
 //BA.debugLineNum = 37683249;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=37683251;
 //BA.debugLineNum = 37683251;BA.debugLine="Try";
try {RDebugUtils.currentLine=37683252;
 //BA.debugLineNum = 37683252;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=37683254;
 //BA.debugLineNum = 37683254;BA.debugLine="LogColor(\"No pudimos agregar la columna PC_FACT";
anywheresoftware.b4a.keywords.Common.LogImpl("537683254","No pudimos agregar la columna PC_FACTURA.",anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=37683255;
 //BA.debugLineNum = 37683255;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("537683255",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=37683258;
 //BA.debugLineNum = 37683258;BA.debugLine="kmt.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS bita";
_kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)");
RDebugUtils.currentLine=37683260;
 //BA.debugLineNum = 37683260;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=37683263;
 //BA.debugLineNum = 37683263;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=37683264;
 //BA.debugLineNum = 37683264;BA.debugLine="errorLog.ExecNonQuery(\"CREATE TABLE IF NOT EXISTS";
_errorlog.ExecNonQuery("CREATE TABLE IF NOT EXISTS errores(fecha INTEGER, error TEXT)");
RDebugUtils.currentLine=37683265;
 //BA.debugLineNum = 37683265;BA.debugLine="End Sub";
return "";
}
public static String  _guardaproductosingestion2(anywheresoftware.b4a.BA _ba,String _cedis,String _costou,String _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _cantc,String _bcajas) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "guardaproductosingestion2", false))
	 {return ((String) Debug.delegate(null, "guardaproductosingestion2", new Object[] {_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
RDebugUtils.currentLine=40042496;
 //BA.debugLineNum = 40042496;BA.debugLine="Sub guardaProductoSinGestion2(cedis As String, cos";
RDebugUtils.currentLine=40042498;
 //BA.debugLineNum = 40042498;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=40042499;
 //BA.debugLineNum = 40042499;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA,PE_COSTO_SIN,PE_FOLIO,PE_ENVIO_OK,PE_CANTC,PE_BCAJAS) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,0,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cedis),(Object)(((double)(Double.parseDouble(_cantc))*(double)(Double.parseDouble(_costou)))),(Object)(_costou),(Object)(_cant),(Object)(_nombre),(Object)(_prodid),(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_rutav),(Object)(_preciosin),(Object)(_tipoventa),(Object)(_cantc),(Object)(_bcajas)}));
RDebugUtils.currentLine=40042500;
 //BA.debugLineNum = 40042500;BA.debugLine="If B4XPages.MainPage.tipo_venta = \"VENTA\" Then";
if ((mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._tipo_venta /*String*/ ).equals("VENTA")) { 
RDebugUtils.currentLine=40042501;
 //BA.debugLineNum = 40042501;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update ${";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 }else {
RDebugUtils.currentLine=40042503;
 //BA.debugLineNum = 40042503;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update CA";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update CAT_GUNAPROD set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
RDebugUtils.currentLine=40042504;
 //BA.debugLineNum = 40042504;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update CA";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update CAT_GUNAPROD4 set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
 };
RDebugUtils.currentLine=40042506;
 //BA.debugLineNum = 40042506;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")));
RDebugUtils.currentLine=40042507;
 //BA.debugLineNum = 40042507;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40042508;
 //BA.debugLineNum = 40042508;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");
RDebugUtils.currentLine=40042509;
 //BA.debugLineNum = 40042509;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_c.GetString("CANT_CLIE")),(Object)(_c.GetString("TOTAL_CLIE")),(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
RDebugUtils.currentLine=40042510;
 //BA.debugLineNum = 40042510;BA.debugLine="End Sub";
return "";
}
public static String  _guardaproductosingestiondinamico(anywheresoftware.b4a.BA _ba,String _cedis,float _costou,int _cant,String _nombre,String _prodid,String _clienteid,String _fecha,String _usuario,String _rutav,String _preciosin,String _tipoventa,String _cantc,String _bcajas,String _dirigida,int _uvm,String _presentacion) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "guardaproductosingestiondinamico", false))
	 {return ((String) Debug.delegate(null, "guardaproductosingestiondinamico", new Object[] {_ba,_cedis,_costou,_cant,_nombre,_prodid,_clienteid,_fecha,_usuario,_rutav,_preciosin,_tipoventa,_cantc,_bcajas,_dirigida,_uvm,_presentacion}));}
float _costototal = 0f;
String _query = "";
String _tablainventario = "";
RDebugUtils.currentLine=42139648;
 //BA.debugLineNum = 42139648;BA.debugLine="Sub guardaProductoSinGestionDinamico(cedis As Stri";
RDebugUtils.currentLine=42139650;
 //BA.debugLineNum = 42139650;BA.debugLine="Dim costoTotal As Float = (cant / uvm) * costoU";
_costototal = (float) ((_cant/(double)_uvm)*_costou);
RDebugUtils.currentLine=42139652;
 //BA.debugLineNum = 42139652;BA.debugLine="Dim query As String = \"INSERT INTO PEDIDO (PE_CED";
_query = "INSERT INTO PEDIDO (PE_CEDIS, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, "+"PE_CLIENTE, PE_FECHA, PE_USUARIO, PE_RUTA, PE_COSTO_SIN, PE_FOLIO, PE_ENVIO_OK, "+"PE_CANTC, PE_BCAJAS, PE_DIRIGIDA, PE_UVM, PE_PRESENTACION) "+"VALUES(?,?,?,?,?,?,?,?,?,?,?,?,0,?,?,?,?,?)";
RDebugUtils.currentLine=42139657;
 //BA.debugLineNum = 42139657;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(query, Array";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(_query,anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cedis),(Object)(_costototal),(Object)(_costou),(Object)(_cant),(Object)(_nombre),(Object)(_prodid),(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_rutav),(Object)(_preciosin),(Object)(_tipoventa),(Object)(_cantc),(Object)(_bcajas),(Object)(_dirigida),(Object)(_uvm),(Object)(_presentacion)}));
RDebugUtils.currentLine=42139661;
 //BA.debugLineNum = 42139661;BA.debugLine="Dim tablaInventario As String = Starter.tabla";
_tablainventario = mostCurrent._starter._tabla /*String*/ ;
RDebugUtils.currentLine=42139664;
 //BA.debugLineNum = 42139664;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"UPDATE ${ta";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("UPDATE "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tablainventario))+" SET cat_gp_almacen = cat_gp_almacen - "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cant))+" WHERE cat_gp_id = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_prodid))+"'"));
RDebugUtils.currentLine=42139667;
 //BA.debugLineNum = 42139667;BA.debugLine="SincronizarTotalesEncabezado(clienteId, fecha, us";
_sincronizartotalesencabezado(_ba,_clienteid,_fecha,_usuario,_cedis);
RDebugUtils.currentLine=42139668;
 //BA.debugLineNum = 42139668;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;
int _totalprodsvariables2 = 0;
anywheresoftware.b4a.objects.collections.List _prodsvariables = null;
anywheresoftware.b4a.objects.collections.List _prodsvariables2 = null;
int _p = 0;
String _t = "";
String _p2 = "";
boolean _res = false;
boolean _res1 = false;
boolean _res2 = false;
RDebugUtils.currentLine=40697856;
 //BA.debugLineNum = 40697856;BA.debugLine="Sub alcanzanLosVariablesParaPromo(promoMap As Map,";
RDebugUtils.currentLine=40697857;
 //BA.debugLineNum = 40697857;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=40697858;
 //BA.debugLineNum = 40697858;BA.debugLine="If thisLog Then LogColor(\"Inventario inicial: \"&i";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540697858","Inventario inicial: "+BA.ObjectToString(_inventariosinfijos),anywheresoftware.b4a.keywords.Common.Colors.Gray);};
RDebugUtils.currentLine=40697859;
 //BA.debugLineNum = 40697859;BA.debugLine="Private totalProdsVariables As Int = 0";
_totalprodsvariables = (int) (0);
RDebugUtils.currentLine=40697860;
 //BA.debugLineNum = 40697860;BA.debugLine="Private totalProdsVariables2 As Int = 0";
_totalprodsvariables2 = (int) (0);
RDebugUtils.currentLine=40697862;
 //BA.debugLineNum = 40697862;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=40697863;
 //BA.debugLineNum = 40697863;BA.debugLine="Private prodsVariables2 As List = promoMap.get(\"p";
_prodsvariables2 = new anywheresoftware.b4a.objects.collections.List();
_prodsvariables2 = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_promomap.Get((Object)("prodsVariables2"))));
RDebugUtils.currentLine=40697864;
 //BA.debugLineNum = 40697864;BA.debugLine="For p = 0 To prodsVariables.Size - 1";
{
final int step7 = 1;
final int limit7 = (int) (_prodsvariables.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit7 ;_p = _p + step7 ) {
RDebugUtils.currentLine=40697865;
 //BA.debugLineNum = 40697865;BA.debugLine="Private t As String = prodsVariables.Get(p) 'Obt";
_t = BA.ObjectToString(_prodsvariables.Get(_p));
RDebugUtils.currentLine=40697867;
 //BA.debugLineNum = 40697867;BA.debugLine="If inventarioSinFijos.ContainsKey(t) Then 'Si ex";
if (_inventariosinfijos.ContainsKey((Object)(_t))) { 
RDebugUtils.currentLine=40697868;
 //BA.debugLineNum = 40697868;BA.debugLine="Private p2 As String = inventarioSinFijos.Get(t";
_p2 = BA.ObjectToString(_inventariosinfijos.Get((Object)(_t)));
RDebugUtils.currentLine=40697870;
 //BA.debugLineNum = 40697870;BA.debugLine="totalProdsVariables = totalProdsVariables + p2";
_totalprodsvariables = (int) (_totalprodsvariables+(double)(Double.parseDouble(_p2)));
RDebugUtils.currentLine=40697872;
 //BA.debugLineNum = 40697872;BA.debugLine="If thisLog Then Log($\"prod ${t}, hay: ${p2}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540697872",("prod "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+", hay: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_p2))+""),0);};
 };
 }
};
RDebugUtils.currentLine=40697875;
 //BA.debugLineNum = 40697875;BA.debugLine="For p = 0 To prodsVariables2.Size - 1";
{
final int step15 = 1;
final int limit15 = (int) (_prodsvariables2.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit15 ;_p = _p + step15 ) {
RDebugUtils.currentLine=40697876;
 //BA.debugLineNum = 40697876;BA.debugLine="Private t As String = prodsVariables2.Get(p) 'Ob";
_t = BA.ObjectToString(_prodsvariables2.Get(_p));
RDebugUtils.currentLine=40697877;
 //BA.debugLineNum = 40697877;BA.debugLine="If inventarioSinFijos.ContainsKey(t) Then 'Si ex";
if (_inventariosinfijos.ContainsKey((Object)(_t))) { 
RDebugUtils.currentLine=40697878;
 //BA.debugLineNum = 40697878;BA.debugLine="Private p2 As String = inventarioSinFijos.Get(t";
_p2 = BA.ObjectToString(_inventariosinfijos.Get((Object)(_t)));
RDebugUtils.currentLine=40697879;
 //BA.debugLineNum = 40697879;BA.debugLine="totalProdsVariables2 = totalProdsVariables2 + p";
_totalprodsvariables2 = (int) (_totalprodsvariables2+(double)(Double.parseDouble(_p2)));
RDebugUtils.currentLine=40697880;
 //BA.debugLineNum = 40697880;BA.debugLine="If thisLog Then Log($\"prod ${t}, hay: ${p2}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540697880",("prod "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_t))+", hay: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_p2))+""),0);};
 };
 }
};
RDebugUtils.currentLine=40697883;
 //BA.debugLineNum = 40697883;BA.debugLine="If thisLog Then Log(\"Total prods variables=\" & to";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540697883","Total prods variables="+BA.NumberToString(_totalprodsvariables)+", requeridos="+BA.ObjectToString(_promomap.Get((Object)("prodsVariablesRequeridos"))),0);};
RDebugUtils.currentLine=40697884;
 //BA.debugLineNum = 40697884;BA.debugLine="If thisLog Then Log(\"Total prods variables2=\" & t";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540697884","Total prods variables2="+BA.NumberToString(_totalprodsvariables2)+", requeridos2="+BA.ObjectToString(_promomap.Get((Object)("prodsVariables2Requeridos"))),0);};
RDebugUtils.currentLine=40697885;
 //BA.debugLineNum = 40697885;BA.debugLine="Private res As Boolean = False";
_res = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=40697886;
 //BA.debugLineNum = 40697886;BA.debugLine="Private res1 As Boolean = False";
_res1 = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=40697887;
 //BA.debugLineNum = 40697887;BA.debugLine="Private res2 As Boolean = False";
_res2 = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=40697892;
 //BA.debugLineNum = 40697892;BA.debugLine="If totalProdsVariables > 0 And totalProdsVariable";
if (_totalprodsvariables>0 && _totalprodsvariables>=(double)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariablesRequeridos"))))) { 
RDebugUtils.currentLine=40697893;
 //BA.debugLineNum = 40697893;BA.debugLine="res1 = True 'Si el total de inventario de produc";
_res1 = anywheresoftware.b4a.keywords.Common.True;
 };
RDebugUtils.currentLine=40697895;
 //BA.debugLineNum = 40697895;BA.debugLine="If promoMap.Get(\"prodsVariablesRequeridos\").As (I";
if (((int)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariablesRequeridos")))))==0) { 
_res1 = anywheresoftware.b4a.keywords.Common.True;};
RDebugUtils.currentLine=40697896;
 //BA.debugLineNum = 40697896;BA.debugLine="If totalProdsVariables2 > 0 And totalProdsVariabl";
if (_totalprodsvariables2>0 && _totalprodsvariables2>=(double)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariables2Requeridos"))))) { 
RDebugUtils.currentLine=40697897;
 //BA.debugLineNum = 40697897;BA.debugLine="res2 = True 'Si el total de inventario de produc";
_res2 = anywheresoftware.b4a.keywords.Common.True;
 };
RDebugUtils.currentLine=40697899;
 //BA.debugLineNum = 40697899;BA.debugLine="If promoMap.Get(\"prodsVariables2Requeridos\").As(I";
if (((int)(BA.ObjectToNumber(_promomap.Get((Object)("prodsVariables2Requeridos")))))==0) { 
_res2 = anywheresoftware.b4a.keywords.Common.True;};
RDebugUtils.currentLine=40697900;
 //BA.debugLineNum = 40697900;BA.debugLine="If res1 And res2 Then 'Solo si son verdadero los";
if (_res1 && _res2) { 
RDebugUtils.currentLine=40697901;
 //BA.debugLineNum = 40697901;BA.debugLine="res = True";
_res = anywheresoftware.b4a.keywords.Common.True;
 }else {
RDebugUtils.currentLine=40697903;
 //BA.debugLineNum = 40697903;BA.debugLine="res = False";
_res = anywheresoftware.b4a.keywords.Common.False;
 };
RDebugUtils.currentLine=40697906;
 //BA.debugLineNum = 40697906;BA.debugLine="Return res";
if (true) return _res;
RDebugUtils.currentLine=40697907;
 //BA.debugLineNum = 40697907;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=38404096;
 //BA.debugLineNum = 38404096;BA.debugLine="Sub borraArribaDe100Errores 'ignore";
RDebugUtils.currentLine=38404097;
 //BA.debugLineNum = 38404097;BA.debugLine="revisaBD";
_revisabd(_ba);
RDebugUtils.currentLine=38404098;
 //BA.debugLineNum = 38404098;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("538404098","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=38404099;
 //BA.debugLineNum = 38404099;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=38404100;
 //BA.debugLineNum = 38404100;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=38404101;
 //BA.debugLineNum = 38404101;BA.debugLine="Log(\"Borramos mas de 100 de errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("538404101","Borramos mas de 100 de errorLog",0);
RDebugUtils.currentLine=38404102;
 //BA.debugLineNum = 38404102;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=38469632;
 //BA.debugLineNum = 38469632;BA.debugLine="Sub borraArribaDe600RenglonesBitacora 'ignore";
RDebugUtils.currentLine=38469633;
 //BA.debugLineNum = 38469633;BA.debugLine="revisaBD";
_revisabd(_ba);
RDebugUtils.currentLine=38469634;
 //BA.debugLineNum = 38469634;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("538469634","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=38469635;
 //BA.debugLineNum = 38469635;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=38469636;
 //BA.debugLineNum = 38469636;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=38469637;
 //BA.debugLineNum = 38469637;BA.debugLine="Log(\"Borramos mas de 600 de bitacora\")";
anywheresoftware.b4a.keywords.Common.LogImpl("538469637","Borramos mas de 600 de bitacora",0);
RDebugUtils.currentLine=38469638;
 //BA.debugLineNum = 38469638;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=38207488;
 //BA.debugLineNum = 38207488;BA.debugLine="Sub borraLogDB 'ignore";
RDebugUtils.currentLine=38207489;
 //BA.debugLineNum = 38207489;BA.debugLine="LogColor(\"Borramos BD de log\", Colors.Magenta)";
anywheresoftware.b4a.keywords.Common.LogImpl("538207489","Borramos BD de log",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
RDebugUtils.currentLine=38207490;
 //BA.debugLineNum = 38207490;BA.debugLine="kmt.ExecNonQuery(\"delete from bitacora\")";
_kmt.ExecNonQuery("delete from bitacora");
RDebugUtils.currentLine=38207491;
 //BA.debugLineNum = 38207491;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=38207492;
 //BA.debugLineNum = 38207492;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=37617664;
 //BA.debugLineNum = 37617664;BA.debugLine="Sub borramosArchivoGPS 'ignore";
RDebugUtils.currentLine=37617665;
 //BA.debugLineNum = 37617665;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=37617666;
 //BA.debugLineNum = 37617666;BA.debugLine="Dim s As String = \"\"";
_s = "";
RDebugUtils.currentLine=37617667;
 //BA.debugLineNum = 37617667;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
RDebugUtils.currentLine=37617668;
 //BA.debugLineNum = 37617668;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
RDebugUtils.currentLine=37617669;
 //BA.debugLineNum = 37617669;BA.debugLine="out.Close";
_out.Close();
RDebugUtils.currentLine=37617670;
 //BA.debugLineNum = 37617670;BA.debugLine="End Sub";
return "";
}
public static String  _traetablaprods(anywheresoftware.b4a.BA _ba,String _tipoventa) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetablaprods", false))
	 {return ((String) Debug.delegate(null, "traetablaprods", new Object[] {_ba,_tipoventa}));}
String _tablaprods = "";
RDebugUtils.currentLine=41615360;
 //BA.debugLineNum = 41615360;BA.debugLine="Sub traeTablaProds(tipoventa As String) As String";
RDebugUtils.currentLine=41615361;
 //BA.debugLineNum = 41615361;BA.debugLine="Private tablaProds As String = \"cat_gunaprod2\"";
_tablaprods = "cat_gunaprod2";
RDebugUtils.currentLine=41615363;
 //BA.debugLineNum = 41615363;BA.debugLine="If tipoventa = \"ABORDO\" Or tipoventa = \"PREVENTA_";
if ((_tipoventa).equals("ABORDO") || (_tipoventa).equals("PREVENTA_CONTADO")) { 
RDebugUtils.currentLine=41615364;
 //BA.debugLineNum = 41615364;BA.debugLine="tablaProds = \"cat_gunaprod\"";
_tablaprods = "cat_gunaprod";
 }else 
{RDebugUtils.currentLine=41615365;
 //BA.debugLineNum = 41615365;BA.debugLine="Else If tipoventa = \"RECARGA\" Then";
if ((_tipoventa).equals("RECARGA")) { 
RDebugUtils.currentLine=41615366;
 //BA.debugLineNum = 41615366;BA.debugLine="tablaProds = \"cat_gunaprod3\"";
_tablaprods = "cat_gunaprod3";
 }else 
{RDebugUtils.currentLine=41615367;
 //BA.debugLineNum = 41615367;BA.debugLine="Else If tipoventa = \"PREVENTA_CREDITO\" Then";
if ((_tipoventa).equals("PREVENTA_CREDITO")) { 
RDebugUtils.currentLine=41615368;
 //BA.debugLineNum = 41615368;BA.debugLine="tablaProds = \"cat_gunaprod4\"";
_tablaprods = "cat_gunaprod4";
 }}}
;
RDebugUtils.currentLine=41615371;
 //BA.debugLineNum = 41615371;BA.debugLine="LogColor($\"Tipo= ${tipoventa}, tabla=${tablaProds";
anywheresoftware.b4a.keywords.Common.LogImpl("541615371",("Tipo= "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tipoventa))+", tabla="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_tablaprods))+""),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (200),(int) (136),(int) (0)));
RDebugUtils.currentLine=41615372;
 //BA.debugLineNum = 41615372;BA.debugLine="Return tablaProds";
if (true) return _tablaprods;
RDebugUtils.currentLine=41615373;
 //BA.debugLineNum = 41615373;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=39190528;
 //BA.debugLineNum = 39190528;BA.debugLine="Sub buscaDBUsuario As String 'ignore";
RDebugUtils.currentLine=39190529;
 //BA.debugLineNum = 39190529;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39190530;
 //BA.debugLineNum = 39190530;BA.debugLine="Private usuario As String = \"SinUsuario\"";
_usuario = "SinUsuario";
RDebugUtils.currentLine=39190531;
 //BA.debugLineNum = 39190531;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=39190532;
 //BA.debugLineNum = 39190532;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39190533;
 //BA.debugLineNum = 39190533;BA.debugLine="If c.RowCount > 0 Then usuario = c.GetString(\"USU";
if (_c.getRowCount()>0) { 
_usuario = _c.GetString("USUARIO");};
RDebugUtils.currentLine=39190534;
 //BA.debugLineNum = 39190534;BA.debugLine="Return usuario";
if (true) return _usuario;
RDebugUtils.currentLine=39190535;
 //BA.debugLineNum = 39190535;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=39124992;
 //BA.debugLineNum = 39124992;BA.debugLine="Sub centraProgressBar(elemento As ProgressBar, anc";
RDebugUtils.currentLine=39124993;
 //BA.debugLineNum = 39124993;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=39124994;
 //BA.debugLineNum = 39124994;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=36962304;
 //BA.debugLineNum = 36962304;BA.debugLine="Sub compress(str As String) As String 'ignore";
RDebugUtils.currentLine=36962306;
 //BA.debugLineNum = 36962306;BA.debugLine="Dim compressed() As Byte = GZip.compress(str)";
_compressed = _gzip.compress(_str);
RDebugUtils.currentLine=36962309;
 //BA.debugLineNum = 36962309;BA.debugLine="Dim base64 As String = su.EncodeBase64(compressed";
_base64 = _su.EncodeBase64(_compressed);
RDebugUtils.currentLine=36962310;
 //BA.debugLineNum = 36962310;BA.debugLine="Log($\"Comprimido: ${base64.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("536962310",("Comprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_base64.length()))+""),0);
RDebugUtils.currentLine=36962312;
 //BA.debugLineNum = 36962312;BA.debugLine="Return base64";
if (true) return _base64;
RDebugUtils.currentLine=36962313;
 //BA.debugLineNum = 36962313;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=38797312;
 //BA.debugLineNum = 38797312;BA.debugLine="Sub copiaDB(result As Boolean) 'ignore";
RDebugUtils.currentLine=38797313;
 //BA.debugLineNum = 38797313;BA.debugLine="ToastMessageShow(\"copiaDB\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("copiaDB"),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=38797314;
 //BA.debugLineNum = 38797314;BA.debugLine="If result Then";
if (_result) { 
RDebugUtils.currentLine=38797315;
 //BA.debugLineNum = 38797315;BA.debugLine="Dim p As String";
_p = "";
RDebugUtils.currentLine=38797316;
 //BA.debugLineNum = 38797316;BA.debugLine="If File.ExternalWritable Then";
if (anywheresoftware.b4a.keywords.Common.File.getExternalWritable()) { 
RDebugUtils.currentLine=38797317;
 //BA.debugLineNum = 38797317;BA.debugLine="p = File.DirInternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 }else {
RDebugUtils.currentLine=38797320;
 //BA.debugLineNum = 38797320;BA.debugLine="p = File.DirInternal";
_p = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 };
RDebugUtils.currentLine=38797323;
 //BA.debugLineNum = 38797323;BA.debugLine="Dim theDir As String";
_thedir = "";
RDebugUtils.currentLine=38797324;
 //BA.debugLineNum = 38797324;BA.debugLine="Try";
try {RDebugUtils.currentLine=38797325;
 //BA.debugLineNum = 38797325;BA.debugLine="File.MakeDir(File.DirInternal,\"kmts\")";
anywheresoftware.b4a.keywords.Common.File.MakeDir(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmts");
RDebugUtils.currentLine=38797326;
 //BA.debugLineNum = 38797326;BA.debugLine="theDir = \"/kmts\"";
_thedir = "/kmts";
 } 
       catch (Exception e14) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e14);RDebugUtils.currentLine=38797328;
 //BA.debugLineNum = 38797328;BA.debugLine="theDir = \"\"";
_thedir = "";
 };
RDebugUtils.currentLine=38797330;
 //BA.debugLineNum = 38797330;BA.debugLine="Try";
try {RDebugUtils.currentLine=38797331;
 //BA.debugLineNum = 38797331;BA.debugLine="File.Copy(File.DirInternal,\"kmt.db\",File.DirInt";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db",anywheresoftware.b4a.keywords.Common.File.getDirInternal()+_thedir,"cedex_kmt.db");
RDebugUtils.currentLine=38797332;
 //BA.debugLineNum = 38797332;BA.debugLine="File.Copy(File.DirInternal,\"errorLog.db\",File.D";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"errorLog.db",anywheresoftware.b4a.keywords.Common.File.getDirInternal()+_thedir,"cedex_errorLog.db");
RDebugUtils.currentLine=38797333;
 //BA.debugLineNum = 38797333;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=38797335;
 //BA.debugLineNum = 38797335;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=38797337;
 //BA.debugLineNum = 38797337;BA.debugLine="Log(\"rootExternal=\"&p)";
anywheresoftware.b4a.keywords.Common.LogImpl("538797337","rootExternal="+_p,0);
RDebugUtils.currentLine=38797338;
 //BA.debugLineNum = 38797338;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
anywheresoftware.b4a.keywords.Common.LogImpl("538797338","File.DirInternal="+anywheresoftware.b4a.keywords.Common.File.getDirInternal(),0);
RDebugUtils.currentLine=38797339;
 //BA.debugLineNum = 38797339;BA.debugLine="Log(\"File.DirInternal=\"&File.DirInternal)";
anywheresoftware.b4a.keywords.Common.LogImpl("538797339","File.DirInternal="+anywheresoftware.b4a.keywords.Common.File.getDirInternal(),0);
 }else {
RDebugUtils.currentLine=38797341;
 //BA.debugLineNum = 38797341;BA.debugLine="ToastMessageShow(\"Sin permisos\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Sin permisos"),anywheresoftware.b4a.keywords.Common.False);
 };
RDebugUtils.currentLine=38797343;
 //BA.debugLineNum = 38797343;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=41156608;
 //BA.debugLineNum = 41156608;BA.debugLine="Sub cuantosVariablesTengoBD(promo As String) As St";
RDebugUtils.currentLine=41156619;
 //BA.debugLineNum = 41156619;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=38600704;
 //BA.debugLineNum = 38600704;BA.debugLine="Sub dameErroresJSON(SQL As SQL, maxErrores As Int,";
RDebugUtils.currentLine=38600705;
 //BA.debugLineNum = 38600705;BA.debugLine="Log(\"dameErroresJSON\")";
anywheresoftware.b4a.keywords.Common.LogImpl("538600705","dameErroresJSON",0);
RDebugUtils.currentLine=38600706;
 //BA.debugLineNum = 38600706;BA.debugLine="Private j As JSONGenerator";
_j = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
RDebugUtils.currentLine=38600707;
 //BA.debugLineNum = 38600707;BA.debugLine="Private lim As String";
_lim = "";
RDebugUtils.currentLine=38600708;
 //BA.debugLineNum = 38600708;BA.debugLine="Private cur As ResultSet";
_cur = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
RDebugUtils.currentLine=38600709;
 //BA.debugLineNum = 38600709;BA.debugLine="Private l As List";
_l = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=38600710;
 //BA.debugLineNum = 38600710;BA.debugLine="Private i As Int = 0";
_i = (int) (0);
RDebugUtils.currentLine=38600711;
 //BA.debugLineNum = 38600711;BA.debugLine="l.Initialize";
_l.Initialize();
RDebugUtils.currentLine=38600712;
 //BA.debugLineNum = 38600712;BA.debugLine="Dim m, m2 As Map";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m2 = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=38600713;
 //BA.debugLineNum = 38600713;BA.debugLine="m2.Initialize";
_m2.Initialize();
RDebugUtils.currentLine=38600714;
 //BA.debugLineNum = 38600714;BA.debugLine="If maxErrores = 0 Then lim = \"\" Else lim = \"limit";
if (_maxerrores==0) { 
_lim = "";}
else {
_lim = "limit "+BA.NumberToString(_maxerrores);};
RDebugUtils.currentLine=38600715;
 //BA.debugLineNum = 38600715;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=38600716;
 //BA.debugLineNum = 38600716;BA.debugLine="Do While cur.NextRow";
while (_cur.NextRow()) {
RDebugUtils.currentLine=38600717;
 //BA.debugLineNum = 38600717;BA.debugLine="m.Initialize";
_m.Initialize();
RDebugUtils.currentLine=38600718;
 //BA.debugLineNum = 38600718;BA.debugLine="m.Put(\"fecha\", cur.GetString(\"fecha\"))";
_m.Put((Object)("fecha"),(Object)(_cur.GetString("fecha")));
RDebugUtils.currentLine=38600719;
 //BA.debugLineNum = 38600719;BA.debugLine="m.Put(\"error\", cur.GetString(\"error\"))";
_m.Put((Object)("error"),(Object)(_cur.GetString("error")));
RDebugUtils.currentLine=38600720;
 //BA.debugLineNum = 38600720;BA.debugLine="m2.Put(i,m)";
_m2.Put((Object)(_i),(Object)(_m.getObject()));
RDebugUtils.currentLine=38600721;
 //BA.debugLineNum = 38600721;BA.debugLine="i = i + 1";
_i = (int) (_i+1);
 }
;
RDebugUtils.currentLine=38600723;
 //BA.debugLineNum = 38600723;BA.debugLine="cur.Close";
_cur.Close();
RDebugUtils.currentLine=38600724;
 //BA.debugLineNum = 38600724;BA.debugLine="j.Initialize(m2)";
_j.Initialize(_m2);
RDebugUtils.currentLine=38600725;
 //BA.debugLineNum = 38600725;BA.debugLine="Log(j.ToString)";
anywheresoftware.b4a.keywords.Common.LogImpl("538600725",_j.ToString(),0);
RDebugUtils.currentLine=38600726;
 //BA.debugLineNum = 38600726;BA.debugLine="If comprimido Then";
if (_comprimido) { 
RDebugUtils.currentLine=38600727;
 //BA.debugLineNum = 38600727;BA.debugLine="Return compress(j.ToString)";
if (true) return _compress(_ba,_j.ToString());
 }else {
RDebugUtils.currentLine=38600729;
 //BA.debugLineNum = 38600729;BA.debugLine="Return j.ToString";
if (true) return _j.ToString();
 };
RDebugUtils.currentLine=38600731;
 //BA.debugLineNum = 38600731;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=37421056;
 //BA.debugLineNum = 37421056;BA.debugLine="Sub dameRuta(inicioRuta As String, origenRuta As S";
RDebugUtils.currentLine=37421058;
 //BA.debugLineNum = 37421058;BA.debugLine="Dim fechaInicio As String";
_fechainicio = "";
RDebugUtils.currentLine=37421059;
 //BA.debugLineNum = 37421059;BA.debugLine="Try 'incioRuta es numero";
try {RDebugUtils.currentLine=37421060;
 //BA.debugLineNum = 37421060;BA.debugLine="inicioRuta = inicioRuta * 1";
_inicioruta = BA.NumberToString((double)(Double.parseDouble(_inicioruta))*1);
RDebugUtils.currentLine=37421062;
 //BA.debugLineNum = 37421062;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=37421064;
 //BA.debugLineNum = 37421064;BA.debugLine="fechaInicio = fechaInicioHoy";
_fechainicio = _fechainiciohoy(_ba);
 };
RDebugUtils.currentLine=37421067;
 //BA.debugLineNum = 37421067;BA.debugLine="If subsLogs Then Log(\"fechaInicio: \"&fechaInicio&";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("537421067","fechaInicio: "+_fechainicio+" | rutaHrsAtras="+BA.NumberToString(_rutahrsatras),0);};
RDebugUtils.currentLine=37421068;
 //BA.debugLineNum = 37421068;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=37421069;
 //BA.debugLineNum = 37421069;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=37421070;
 //BA.debugLineNum = 37421070;BA.debugLine="If subsLogs Then Log(\"select FECHA, LAT, LON from";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("537421070","select FECHA, LAT, LON from "+_origenruta+" where FECHA > "+_fechainicio+" order by FECHA desc limit "+BA.NumberToString(_rutamaxpoints),0);};
RDebugUtils.currentLine=37421071;
 //BA.debugLineNum = 37421071;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=37421072;
 //BA.debugLineNum = 37421072;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=37421073;
 //BA.debugLineNum = 37421073;BA.debugLine="Dim ruta2 As String = \"\"";
_ruta2 = "";
RDebugUtils.currentLine=37421074;
 //BA.debugLineNum = 37421074;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=37421075;
 //BA.debugLineNum = 37421075;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=37421076;
 //BA.debugLineNum = 37421076;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=37421077;
 //BA.debugLineNum = 37421077;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=37421078;
 //BA.debugLineNum = 37421078;BA.debugLine="B4XPages.MainPage.fechaRuta = c.GetString(\"FECH";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._fecharuta /*String*/  = _c.GetString("FECHA");
 }
};
 };
RDebugUtils.currentLine=37421081;
 //BA.debugLineNum = 37421081;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=37421082;
 //BA.debugLineNum = 37421082;BA.debugLine="Return compress(ruta2)";
if (true) return _compress(_ba,_ruta2);
RDebugUtils.currentLine=37421083;
 //BA.debugLineNum = 37421083;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=37945344;
 //BA.debugLineNum = 37945344;BA.debugLine="Sub fechaInicioHoy As String 'ignore";
RDebugUtils.currentLine=37945345;
 //BA.debugLineNum = 37945345;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=37945346;
 //BA.debugLineNum = 37945346;BA.debugLine="DateTime.DateFormat=\"yyMMdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMdd");
RDebugUtils.currentLine=37945347;
 //BA.debugLineNum = 37945347;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=37945348;
 //BA.debugLineNum = 37945348;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=37945349;
 //BA.debugLineNum = 37945349;BA.debugLine="Log(\"Hoy=\"&h)";
anywheresoftware.b4a.keywords.Common.LogImpl("537945349","Hoy="+_h,0);
RDebugUtils.currentLine=37945350;
 //BA.debugLineNum = 37945350;BA.debugLine="Return h";
if (true) return _h;
RDebugUtils.currentLine=37945351;
 //BA.debugLineNum = 37945351;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=39256064;
 //BA.debugLineNum = 39256064;BA.debugLine="Sub dameUsuarioDeDB As String 'ignore";
RDebugUtils.currentLine=39256065;
 //BA.debugLineNum = 39256065;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39256066;
 //BA.debugLineNum = 39256066;BA.debugLine="Private u As String = \"SinUsuario\"";
_u = "SinUsuario";
RDebugUtils.currentLine=39256067;
 //BA.debugLineNum = 39256067;BA.debugLine="If Not(kmt.IsInitialized) Then revisaBD";
if (anywheresoftware.b4a.keywords.Common.Not(_kmt.IsInitialized())) { 
_revisabd(_ba);};
RDebugUtils.currentLine=39256068;
 //BA.debugLineNum = 39256068;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=39256069;
 //BA.debugLineNum = 39256069;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39256070;
 //BA.debugLineNum = 39256070;BA.debugLine="If c.RowCount > 0 Then u = c.GetString(\"USUARIO\")";
if (_c.getRowCount()>0) { 
_u = _c.GetString("USUARIO");};
RDebugUtils.currentLine=39256071;
 //BA.debugLineNum = 39256071;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=39256072;
 //BA.debugLineNum = 39256072;BA.debugLine="Return u";
if (true) return _u;
RDebugUtils.currentLine=39256073;
 //BA.debugLineNum = 39256073;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=37027840;
 //BA.debugLineNum = 37027840;BA.debugLine="Sub decompress(base64 As String) As String 'ignore";
RDebugUtils.currentLine=37027841;
 //BA.debugLineNum = 37027841;BA.debugLine="Dim decompressedbytes() As Byte = su.DecodeBase64";
_decompressedbytes = _su.DecodeBase64(_base64);
RDebugUtils.currentLine=37027843;
 //BA.debugLineNum = 37027843;BA.debugLine="Dim bc As ByteConverter";
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
RDebugUtils.currentLine=37027844;
 //BA.debugLineNum = 37027844;BA.debugLine="Dim uncompressed As String = bc.StringFromBytes(d";
_uncompressed = _bc.StringFromBytes(_decompressedbytes,"UTF8");
RDebugUtils.currentLine=37027845;
 //BA.debugLineNum = 37027845;BA.debugLine="Log($\"Descomprimido: ${uncompressed.Length}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("537027845",("Descomprimido: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_uncompressed.length()))+""),0);
RDebugUtils.currentLine=37027847;
 //BA.debugLineNum = 37027847;BA.debugLine="Return uncompressed";
if (true) return _uncompressed;
RDebugUtils.currentLine=37027848;
 //BA.debugLineNum = 37027848;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=37552128;
 //BA.debugLineNum = 37552128;BA.debugLine="Sub deleteErrorLog_DB 'ignore";
RDebugUtils.currentLine=37552129;
 //BA.debugLineNum = 37552129;BA.debugLine="errorLog.ExecNonQuery(\"delete from errores\")";
_errorlog.ExecNonQuery("delete from errores");
RDebugUtils.currentLine=37552130;
 //BA.debugLineNum = 37552130;BA.debugLine="errorLog.ExecNonQuery(\"vacuum;\")";
_errorlog.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=37552131;
 //BA.debugLineNum = 37552131;BA.debugLine="ToastMessageShow(\"BD Errores Borrada\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("BD Errores Borrada"),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=37552132;
 //BA.debugLineNum = 37552132;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=37486592;
 //BA.debugLineNum = 37486592;BA.debugLine="Sub deleteGPS_DB 'ignore";
RDebugUtils.currentLine=37486593;
 //BA.debugLineNum = 37486593;BA.debugLine="kmt.ExecNonQuery(\"delete from RUTA_GPS\")";
_kmt.ExecNonQuery("delete from RUTA_GPS");
RDebugUtils.currentLine=37486594;
 //BA.debugLineNum = 37486594;BA.debugLine="kmt.ExecNonQuery(\"vacuum;\")";
_kmt.ExecNonQuery("vacuum;");
RDebugUtils.currentLine=37486595;
 //BA.debugLineNum = 37486595;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=37486596;
 //BA.debugLineNum = 37486596;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=38666240;
 //BA.debugLineNum = 38666240;BA.debugLine="Sub fechaKMT2Ticks(fKMT As String) As Long 'ignore";
RDebugUtils.currentLine=38666241;
 //BA.debugLineNum = 38666241;BA.debugLine="Try";
try {RDebugUtils.currentLine=38666242;
 //BA.debugLineNum = 38666242;BA.debugLine="If fKMT.Length = 12 Then";
if (_fkmt.length()==12) { 
RDebugUtils.currentLine=38666243;
 //BA.debugLineNum = 38666243;BA.debugLine="Private parteFecha As String = fKMT.SubString2(";
_partefecha = _fkmt.substring((int) (0),(int) (6));
RDebugUtils.currentLine=38666244;
 //BA.debugLineNum = 38666244;BA.debugLine="Private parteHora As String = fKMT.SubString(6)";
_partehora = _fkmt.substring((int) (6));
RDebugUtils.currentLine=38666245;
 //BA.debugLineNum = 38666245;BA.debugLine="Private OrigFormat As String = DateTime.DateFor";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=38666246;
 //BA.debugLineNum = 38666246;BA.debugLine="DateTime.DateFormat=\"yymmdd\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yymmdd");
RDebugUtils.currentLine=38666247;
 //BA.debugLineNum = 38666247;BA.debugLine="DateTime.TimeFormat=\"HHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setTimeFormat("HHmmss");
RDebugUtils.currentLine=38666248;
 //BA.debugLineNum = 38666248;BA.debugLine="Private ticks As Long = DateTime.DateTimeParse(";
_ticks = anywheresoftware.b4a.keywords.Common.DateTime.DateTimeParse(_partefecha,_partehora);
RDebugUtils.currentLine=38666249;
 //BA.debugLineNum = 38666249;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=38666250;
 //BA.debugLineNum = 38666250;BA.debugLine="Return ticks";
if (true) return _ticks;
 }else {
RDebugUtils.currentLine=38666252;
 //BA.debugLineNum = 38666252;BA.debugLine="Log(\"Formato de fecha incorrecto, debe de ser '";
anywheresoftware.b4a.keywords.Common.LogImpl("538666252","Formato de fecha incorrecto, debe de ser 'YYMMDDHHMMSS', no '"+_fkmt+"' largo="+BA.NumberToString(_fkmt.length()),0);
RDebugUtils.currentLine=38666253;
 //BA.debugLineNum = 38666253;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
 } 
       catch (Exception e16) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e16);RDebugUtils.currentLine=38666256;
 //BA.debugLineNum = 38666256;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("538666256",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
RDebugUtils.currentLine=38666257;
 //BA.debugLineNum = 38666257;BA.debugLine="LogColor($\"Fecha dada: ${fKMT}, Parte Fecha: ${p";
anywheresoftware.b4a.keywords.Common.LogImpl("538666257",("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=38666258;
 //BA.debugLineNum = 38666258;BA.debugLine="Return 0";
if (true) return (long) (0);
 };
RDebugUtils.currentLine=38666260;
 //BA.debugLineNum = 38666260;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=36700160;
 //BA.debugLineNum = 36700160;BA.debugLine="Sub getPhnId As String 'ignore";
RDebugUtils.currentLine=36700162;
 //BA.debugLineNum = 36700162;BA.debugLine="devModel = phn.Model";
_devmodel = _phn.getModel();
RDebugUtils.currentLine=36700163;
 //BA.debugLineNum = 36700163;BA.debugLine="If devModel.Length <= 3 Then 'Si phn.Model esta e";
if (_devmodel.length()<=3) { 
RDebugUtils.currentLine=36700164;
 //BA.debugLineNum = 36700164;BA.debugLine="Dim t As String = phn.GetSettings(\"android_id\")";
_t = _phn.GetSettings("android_id");
RDebugUtils.currentLine=36700165;
 //BA.debugLineNum = 36700165;BA.debugLine="devModel = t";
_devmodel = _t;
 };
RDebugUtils.currentLine=36700167;
 //BA.debugLineNum = 36700167;BA.debugLine="If devModel.Length >= 3 Then 'Si tenemos valor pa";
if (_devmodel.length()>=3) { 
RDebugUtils.currentLine=36700168;
 //BA.debugLineNum = 36700168;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=36700170;
 //BA.debugLineNum = 36700170;BA.debugLine="Else If devModel.Length < 3 Then ' Si no tenemos";
if (_devmodel.length()<3) { 
RDebugUtils.currentLine=36700171;
 //BA.debugLineNum = 36700171;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=36700172;
 //BA.debugLineNum = 36700172;BA.debugLine="devModel = s";
_devmodel = _s;
 }}
;
RDebugUtils.currentLine=36700176;
 //BA.debugLineNum = 36700176;BA.debugLine="Return devModel";
if (true) return _devmodel;
RDebugUtils.currentLine=36700177;
 //BA.debugLineNum = 36700177;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=37748736;
 //BA.debugLineNum = 37748736;BA.debugLine="Sub getSSID  'ignore";
RDebugUtils.currentLine=37748741;
 //BA.debugLineNum = 37748741;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=37289984;
 //BA.debugLineNum = 37289984;BA.debugLine="Sub guardaInfoEnArchivo(coords As String) 'ignore";
RDebugUtils.currentLine=37289986;
 //BA.debugLineNum = 37289986;BA.debugLine="Dim OrigFormat As String=DateTime.DateFormat  'sa";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=37289987;
 //BA.debugLineNum = 37289987;BA.debugLine="DateTime.DateFormat=\"MMM-dd HH:mm:ss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MMM-dd HH:mm:ss");
RDebugUtils.currentLine=37289988;
 //BA.debugLineNum = 37289988;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=37289989;
 //BA.debugLineNum = 37289989;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=37289991;
 //BA.debugLineNum = 37289991;BA.debugLine="Dim ubic As String = coords&\",\"&lastUpdate";
_ubic = _coords+","+_lastupdate;
RDebugUtils.currentLine=37289992;
 //BA.debugLineNum = 37289992;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=37289993;
 //BA.debugLineNum = 37289993;BA.debugLine="Dim s As String = ubic & CRLF";
_s = _ubic+anywheresoftware.b4a.keywords.Common.CRLF;
RDebugUtils.currentLine=37289994;
 //BA.debugLineNum = 37289994;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
RDebugUtils.currentLine=37289995;
 //BA.debugLineNum = 37289995;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
RDebugUtils.currentLine=37289996;
 //BA.debugLineNum = 37289996;BA.debugLine="out.Close";
_out.Close();
RDebugUtils.currentLine=37289997;
 //BA.debugLineNum = 37289997;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=37355520;
 //BA.debugLineNum = 37355520;BA.debugLine="Sub guardaInfoEnBD(coords As String) 'ignore";
RDebugUtils.currentLine=37355521;
 //BA.debugLineNum = 37355521;BA.debugLine="Log(\"Guardamos ubicacion en BD - \"&coords)";
anywheresoftware.b4a.keywords.Common.LogImpl("537355521","Guardamos ubicacion en BD - "+_coords,0);
RDebugUtils.currentLine=37355522;
 //BA.debugLineNum = 37355522;BA.debugLine="Try";
try {RDebugUtils.currentLine=37355523;
 //BA.debugLineNum = 37355523;BA.debugLine="Dim latlon() As String = Regex.Split(\"\\|\", coord";
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split("\\|",_coords);
RDebugUtils.currentLine=37355524;
 //BA.debugLineNum = 37355524;BA.debugLine="If latlon.Length < 2 Then latlon = Regex.Split(\"";
if (_latlon.length<2) { 
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split(",",_coords);};
RDebugUtils.currentLine=37355525;
 //BA.debugLineNum = 37355525;BA.debugLine="If subsLogs Then Log(\"LatLon=\"&latlon)";
if (_subslogs) { 
anywheresoftware.b4a.keywords.Common.LogImpl("537355525","LatLon="+BA.ObjectToString(_latlon),0);};
RDebugUtils.currentLine=37355526;
 //BA.debugLineNum = 37355526;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=37355528;
 //BA.debugLineNum = 37355528;BA.debugLine="LogColor(LastException, Colors.red)";
anywheresoftware.b4a.keywords.Common.LogImpl("537355528",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=37355530;
 //BA.debugLineNum = 37355530;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=39845888;
 //BA.debugLineNum = 39845888;BA.debugLine="Sub guardaProducto(cedis As String, costoU As Stri";
RDebugUtils.currentLine=39845890;
 //BA.debugLineNum = 39845890;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=39845891;
 //BA.debugLineNum = 39845891;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO  PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA,PE_COSTO_SIN,PE_FOLIO) VALUES(?,?,?,?,?,?,?,?,?,?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cedis),(Object)(((double)(Double.parseDouble(_cant))*(double)(Double.parseDouble(_costou)))),(Object)(_costou),(Object)(_cant),(Object)(_nombre),(Object)(_prodid),(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_rutav),(Object)(_preciosin),(Object)(_tipoventa)}));
RDebugUtils.currentLine=39845892;
 //BA.debugLineNum = 39845892;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2($\"update ${S";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2(("update "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._starter._tabla /*String*/ ))+" set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "),anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cant),(Object)(_prodid)}));
RDebugUtils.currentLine=39845893;
 //BA.debugLineNum = 39845893;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")));
RDebugUtils.currentLine=39845894;
 //BA.debugLineNum = 39845894;BA.debugLine="c.Position=0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=39845895;
 //BA.debugLineNum = 39845895;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"delete from";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)");
RDebugUtils.currentLine=39845896;
 //BA.debugLineNum = 39845896;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"insert into";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_clienteid),(Object)(_fecha),(Object)(_usuario),(Object)(_c.GetString("CANT_CLIE")),(Object)(_c.GetString("TOTAL_CLIE")),(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis),(Object)(_c.GetString("TOTAL_CLIE_SIN"))}));
RDebugUtils.currentLine=39845897;
 //BA.debugLineNum = 39845897;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"UPDATE kmt_i";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("UPDATE kmt_info set gestion = 2  where CAT_CL_CODIGO In (select cuenta from cuentaa)");
RDebugUtils.currentLine=39845898;
 //BA.debugLineNum = 39845898;BA.debugLine="End Sub";
return "";
}
public static String  _sincronizartotalesencabezado(anywheresoftware.b4a.BA _ba,String _idclie,String _fecha,String _usuario,String _cedis) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "sincronizartotalesencabezado", false))
	 {return ((String) Debug.delegate(null, "sincronizartotalesencabezado", new Object[] {_ba,_idclie,_fecha,_usuario,_cedis}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _res = null;
RDebugUtils.currentLine=42205184;
 //BA.debugLineNum = 42205184;BA.debugLine="Private Sub SincronizarTotalesEncabezado(idClie As";
RDebugUtils.currentLine=42205186;
 //BA.debugLineNum = 42205186;BA.debugLine="Dim res As Cursor = B4XPages.MainPage.skmt.ExecQu";
_res = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_res = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("SELECT SUM(pe_costo_tot) as TOTAL, SUM(PE_CANT) as CANT FROM PEDIDO WHERE PE_CLIENTE = '"+_idclie+"'")));
RDebugUtils.currentLine=42205187;
 //BA.debugLineNum = 42205187;BA.debugLine="res.Position = 0";
_res.setPosition((int) (0));
RDebugUtils.currentLine=42205190;
 //BA.debugLineNum = 42205190;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"DELETE FROM";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("DELETE FROM pedido_cliente WHERE PC_CLIENTE = '"+_idclie+"'");
RDebugUtils.currentLine=42205192;
 //BA.debugLineNum = 42205192;BA.debugLine="If res.GetInt(\"CANT\") > 0 Then";
if (_res.GetInt("CANT")>0) { 
RDebugUtils.currentLine=42205194;
 //BA.debugLineNum = 42205194;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INT";
mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO, PC_LON, PC_LAT, PC_ALMACEN) VALUES (?,?,?,?,?,?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_idclie),(Object)(_fecha),(Object)(_usuario),(Object)(_res.GetString("CANT")),(Object)(_res.GetString("TOTAL")),(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._lat_gps /*String*/ ),(Object)(_cedis)}));
 };
RDebugUtils.currentLine=42205197;
 //BA.debugLineNum = 42205197;BA.debugLine="res.Close";
_res.Close();
RDebugUtils.currentLine=42205198;
 //BA.debugLineNum = 42205198;BA.debugLine="End Sub";
return "";
}
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=38535168;
 //BA.debugLineNum = 38535168;BA.debugLine="Sub insertaRenglonesPruebaEnErrorLog 'ignore";
RDebugUtils.currentLine=38535169;
 //BA.debugLineNum = 38535169;BA.debugLine="revisaBD";
_revisabd(_ba);
RDebugUtils.currentLine=38535170;
 //BA.debugLineNum = 38535170;BA.debugLine="Log(\"insertamos 50 renglones a errorLog\")";
anywheresoftware.b4a.keywords.Common.LogImpl("538535170","insertamos 50 renglones a errorLog",0);
RDebugUtils.currentLine=38535171;
 //BA.debugLineNum = 38535171;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=38535172;
 //BA.debugLineNum = 38535172;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=38535173;
 //BA.debugLineNum = 38535173;BA.debugLine="Log(x)";
anywheresoftware.b4a.keywords.Common.LogImpl("538535173",BA.NumberToString(_x),0);
 }
};
RDebugUtils.currentLine=38535175;
 //BA.debugLineNum = 38535175;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=38731776;
 //BA.debugLineNum = 38731776;BA.debugLine="Sub InstallAPK(dir As String, apk As String) 'igno";
RDebugUtils.currentLine=38731777;
 //BA.debugLineNum = 38731777;BA.debugLine="If File.Exists(dir, apk) Then";
if (anywheresoftware.b4a.keywords.Common.File.Exists(_dir,_apk)) { 
RDebugUtils.currentLine=38731778;
 //BA.debugLineNum = 38731778;BA.debugLine="Dim i As Intent";
_i = new anywheresoftware.b4a.objects.IntentWrapper();
RDebugUtils.currentLine=38731779;
 //BA.debugLineNum = 38731779;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=38731780;
 //BA.debugLineNum = 38731780;BA.debugLine="i.SetType(\"application/vnd.android.package-archi";
_i.SetType("application/vnd.android.package-archive");
RDebugUtils.currentLine=38731781;
 //BA.debugLineNum = 38731781;BA.debugLine="StartActivity(i)";
anywheresoftware.b4a.keywords.Common.StartActivity((_ba.processBA == null ? _ba : _ba.processBA),(Object)(_i.getObject()));
 };
RDebugUtils.currentLine=38731783;
 //BA.debugLineNum = 38731783;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=37814272;
 //BA.debugLineNum = 37814272;BA.debugLine="Sub JSON2Map(theJson As String) As Map 'ignore";
RDebugUtils.currentLine=37814274;
 //BA.debugLineNum = 37814274;BA.debugLine="Try";
try {RDebugUtils.currentLine=37814275;
 //BA.debugLineNum = 37814275;BA.debugLine="Private json As JSONParser";
_json = new anywheresoftware.b4a.objects.collections.JSONParser();
RDebugUtils.currentLine=37814276;
 //BA.debugLineNum = 37814276;BA.debugLine="json.Initialize(theJson)";
_json.Initialize(_thejson);
RDebugUtils.currentLine=37814277;
 //BA.debugLineNum = 37814277;BA.debugLine="Return json.NextObject";
if (true) return _json.NextObject();
 } 
       catch (Exception e6) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e6);RDebugUtils.currentLine=37814279;
 //BA.debugLineNum = 37814279;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("537814279",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
RDebugUtils.currentLine=37814280;
 //BA.debugLineNum = 37814280;BA.debugLine="log2DB(\"JSON2Map: \"&LastException)";
_log2db(_ba,"JSON2Map: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)));
RDebugUtils.currentLine=37814281;
 //BA.debugLineNum = 37814281;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=37814282;
 //BA.debugLineNum = 37814282;BA.debugLine="Return m";
if (true) return _m;
 };
RDebugUtils.currentLine=37814284;
 //BA.debugLineNum = 37814284;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=38010880;
 //BA.debugLineNum = 38010880;BA.debugLine="Sub log2DB(texto As String) 'ignore";
RDebugUtils.currentLine=38010881;
 //BA.debugLineNum = 38010881;BA.debugLine="LogColor(fechaKMT(DateTime.Now)&\" - log2BD: '\"&te";
anywheresoftware.b4a.keywords.Common.LogImpl("538010881",_fechakmt(_ba,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))+" - log2BD: '"+_texto+"'",anywheresoftware.b4a.keywords.Common.Colors.LightGray);
RDebugUtils.currentLine=38010882;
 //BA.debugLineNum = 38010882;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=38010883;
 //BA.debugLineNum = 38010883;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=37879808;
 //BA.debugLineNum = 37879808;BA.debugLine="Sub map2JSON(m As Map) As String 'ignore";
RDebugUtils.currentLine=37879811;
 //BA.debugLineNum = 37879811;BA.debugLine="Dim jg As JSONGenerator";
_jg = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
RDebugUtils.currentLine=37879812;
 //BA.debugLineNum = 37879812;BA.debugLine="jg.Initialize(m)";
_jg.Initialize(_m);
RDebugUtils.currentLine=37879813;
 //BA.debugLineNum = 37879813;BA.debugLine="Dim t As String = jg.ToString";
_t = _jg.ToString();
RDebugUtils.currentLine=37879814;
 //BA.debugLineNum = 37879814;BA.debugLine="Return t";
if (true) return _t;
RDebugUtils.currentLine=37879815;
 //BA.debugLineNum = 37879815;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=38076416;
 //BA.debugLineNum = 38076416;BA.debugLine="Sub masDeXXMins(hora As Int, mins As Int) As Boole";
RDebugUtils.currentLine=38076417;
 //BA.debugLineNum = 38076417;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=38076418;
 //BA.debugLineNum = 38076418;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
RDebugUtils.currentLine=38076420;
 //BA.debugLineNum = 38076420;BA.debugLine="Return False";
if (true) return anywheresoftware.b4a.keywords.Common.False;
 };
RDebugUtils.currentLine=38076422;
 //BA.debugLineNum = 38076422;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=38141952;
 //BA.debugLineNum = 38141952;BA.debugLine="Sub masDeXXMinsKMT(hora As String, mins As Int) As";
RDebugUtils.currentLine=38141953;
 //BA.debugLineNum = 38141953;BA.debugLine="Try";
try {RDebugUtils.currentLine=38141955;
 //BA.debugLineNum = 38141955;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=38141957;
 //BA.debugLineNum = 38141957;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 }else {
RDebugUtils.currentLine=38141960;
 //BA.debugLineNum = 38141960;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=38141963;
 //BA.debugLineNum = 38141963;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("538141963",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),0);
 };
RDebugUtils.currentLine=38141965;
 //BA.debugLineNum = 38141965;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=37158912;
 //BA.debugLineNum = 37158912;BA.debugLine="Sub notiHigh(title As String, body As String, acti";
RDebugUtils.currentLine=37158913;
 //BA.debugLineNum = 37158913;BA.debugLine="Private notif As Notification";
_notif = new anywheresoftware.b4a.objects.NotificationWrapper();
RDebugUtils.currentLine=37158914;
 //BA.debugLineNum = 37158914;BA.debugLine="notif.Initialize2(notif.IMPORTANCE_HIGH)";
_notif.Initialize2(_notif.IMPORTANCE_HIGH);
RDebugUtils.currentLine=37158915;
 //BA.debugLineNum = 37158915;BA.debugLine="notif.Icon = \"icon\"";
_notif.setIcon("icon");
RDebugUtils.currentLine=37158916;
 //BA.debugLineNum = 37158916;BA.debugLine="notif.Vibrate = False";
_notif.setVibrate(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=37158917;
 //BA.debugLineNum = 37158917;BA.debugLine="notif.Sound = False";
_notif.setSound(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=37158918;
 //BA.debugLineNum = 37158918;BA.debugLine="notif.AutoCancel = True";
_notif.setAutoCancel(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=37158919;
 //BA.debugLineNum = 37158919;BA.debugLine="Log(\"notiHigh: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("537158919","notiHigh: "+_title,0);
RDebugUtils.currentLine=37158920;
 //BA.debugLineNum = 37158920;BA.debugLine="notif.SetInfo(title, body, activity)";
_notif.SetInfoNew((_ba.processBA == null ? _ba : _ba.processBA),BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),_activity);
RDebugUtils.currentLine=37158922;
 //BA.debugLineNum = 37158922;BA.debugLine="notif.Notify(777)";
_notif.Notify((int) (777));
RDebugUtils.currentLine=37158923;
 //BA.debugLineNum = 37158923;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=37224448;
 //BA.debugLineNum = 37224448;BA.debugLine="Sub notiLowReturn(title As String, Body As String,";
RDebugUtils.currentLine=37224449;
 //BA.debugLineNum = 37224449;BA.debugLine="Private notification As Notification";
_notification = new anywheresoftware.b4a.objects.NotificationWrapper();
RDebugUtils.currentLine=37224450;
 //BA.debugLineNum = 37224450;BA.debugLine="notification.Initialize2(notification.IMPORTANCE_";
_notification.Initialize2(_notification.IMPORTANCE_LOW);
RDebugUtils.currentLine=37224451;
 //BA.debugLineNum = 37224451;BA.debugLine="Log(\"notiLowReturn: \"&title)";
anywheresoftware.b4a.keywords.Common.LogImpl("537224451","notiLowReturn: "+_title,0);
RDebugUtils.currentLine=37224452;
 //BA.debugLineNum = 37224452;BA.debugLine="notification.Icon = \"icon\"";
_notification.setIcon("icon");
RDebugUtils.currentLine=37224453;
 //BA.debugLineNum = 37224453;BA.debugLine="notification.Sound = False";
_notification.setSound(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=37224454;
 //BA.debugLineNum = 37224454;BA.debugLine="notification.Vibrate = False";
_notification.setVibrate(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=37224455;
 //BA.debugLineNum = 37224455;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=37224456;
 //BA.debugLineNum = 37224456;BA.debugLine="notification.Notify(id)";
_notification.Notify(_id);
RDebugUtils.currentLine=37224458;
 //BA.debugLineNum = 37224458;BA.debugLine="Return notification";
if (true) return _notification;
RDebugUtils.currentLine=37224459;
 //BA.debugLineNum = 37224459;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=40763392;
 //BA.debugLineNum = 40763392;BA.debugLine="Sub traeMaxPromos(pm As Map) As Int";
RDebugUtils.currentLine=40763449;
 //BA.debugLineNum = 40763449;BA.debugLine="Private thisLog As Boolean = False 'Si es verdade";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=40763450;
 //BA.debugLineNum = 40763450;BA.debugLine="Private maxPromos As List";
_maxpromos = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=40763451;
 //BA.debugLineNum = 40763451;BA.debugLine="Private vendidas As Int = 0";
_vendidas = (int) (0);
RDebugUtils.currentLine=40763452;
 //BA.debugLineNum = 40763452;BA.debugLine="maxPromos.Initialize";
_maxpromos.Initialize();
RDebugUtils.currentLine=40763454;
 //BA.debugLineNum = 40763454;BA.debugLine="If thisLog Then Log(pm)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540763454",BA.ObjectToString(_pm),0);};
RDebugUtils.currentLine=40763455;
 //BA.debugLineNum = 40763455;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=40763456;
 //BA.debugLineNum = 40763456;BA.debugLine="maxPromos.Add(pm.Get(\"maxPromos\")) 'Agregamos max";
_maxpromos.Add(_pm.Get((Object)("maxPromos")));
RDebugUtils.currentLine=40763457;
 //BA.debugLineNum = 40763457;BA.debugLine="maxPromos.Add(pm.Get(\"maxXcliente\")) 'Agregamos m";
_maxpromos.Add(_pm.Get((Object)("maxXcliente")));
RDebugUtils.currentLine=40763458;
 //BA.debugLineNum = 40763458;BA.debugLine="maxPromos.Sort(True)";
_maxpromos.Sort(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=40763461;
 //BA.debugLineNum = 40763461;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select sum(PE_CANT) as vendidas from PEDIDO where PE_PROID = ? and PE_CLIENTE = ? ",new String[]{(BA.ObjectToString(_pm.Get((Object)("id")))).trim(),_traecliente(_ba).trim()})));
RDebugUtils.currentLine=40763462;
 //BA.debugLineNum = 40763462;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=40763463;
 //BA.debugLineNum = 40763463;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40763464;
 //BA.debugLineNum = 40763464;BA.debugLine="vendidas = c.GetInt(\"vendidas\")";
_vendidas = _c.GetInt("vendidas");
 };
RDebugUtils.currentLine=40763471;
 //BA.debugLineNum = 40763471;BA.debugLine="Return maxPromos.Get(0) - vendidas 'Regresamos el";
if (true) return (int) ((double)(BA.ObjectToNumber(_maxpromos.Get((int) (0))))-_vendidas);
RDebugUtils.currentLine=40763473;
 //BA.debugLineNum = 40763473;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=40828928;
 //BA.debugLineNum = 40828928;BA.debugLine="Sub traePromosVendidas(promo As String, cliente As";
RDebugUtils.currentLine=40828929;
 //BA.debugLineNum = 40828929;BA.debugLine="Private c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=40828930;
 //BA.debugLineNum = 40828930;BA.debugLine="Private pv As Int = 0";
_pv = (int) (0);
RDebugUtils.currentLine=40828931;
 //BA.debugLineNum = 40828931;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 /*SHARK2.keymon.com.mx.b4xmainpage*/ (_ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select PE_CANT from PEDIDO where PE_PROID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_promo))+"' and PE_CLIENTE = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_cliente))+"'"))));
RDebugUtils.currentLine=40828932;
 //BA.debugLineNum = 40828932;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=40828933;
 //BA.debugLineNum = 40828933;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=40828934;
 //BA.debugLineNum = 40828934;BA.debugLine="pv = c.GetInt(\"PE_CANT\")";
_pv = _c.GetInt("PE_CANT");
 };
RDebugUtils.currentLine=40828936;
 //BA.debugLineNum = 40828936;BA.debugLine="Return pv";
if (true) return _pv;
RDebugUtils.currentLine=40828937;
 //BA.debugLineNum = 40828937;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=40632320;
 //BA.debugLineNum = 40632320;BA.debugLine="Sub restaFijosPromo(promoMap As Map) As Map 'ignor";
RDebugUtils.currentLine=40632321;
 //BA.debugLineNum = 40632321;BA.debugLine="Private thisLog As Boolean = True 'Si es verdader";
_thislog = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=40632322;
 //BA.debugLineNum = 40632322;BA.debugLine="Private inventariosDisponiblesParaEstaPromo As Ma";
_inventariosdisponiblesparaestapromo = new anywheresoftware.b4a.objects.collections.Map();
_inventariosdisponiblesparaestapromo = _traemosinventariodisponibleparapromo(_ba,BA.ObjectToString(_promomap.Get((Object)("id"))));
RDebugUtils.currentLine=40632323;
 //BA.debugLineNum = 40632323;BA.debugLine="If thisLog Then LogColor(\"InvDisponible: \" & inve";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540632323","InvDisponible: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Red);};
RDebugUtils.currentLine=40632324;
 //BA.debugLineNum = 40632324;BA.debugLine="If thisLog Then LogColor(\"Inventario inicial ante";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540632324","Inventario inicial antes de FIJOS: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Gray);};
RDebugUtils.currentLine=40632325;
 //BA.debugLineNum = 40632325;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"resultad";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ko"));
RDebugUtils.currentLine=40632326;
 //BA.debugLineNum = 40632326;BA.debugLine="Private i As Int";
_i = 0;
RDebugUtils.currentLine=40632327;
 //BA.debugLineNum = 40632327;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=40632328;
 //BA.debugLineNum = 40632328;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=40632329;
 //BA.debugLineNum = 40632329;BA.debugLine="For p = 0 To prodsFijos.Size - 1";
{
final int step9 = 1;
final int limit9 = (int) (_prodsfijos.getSize()-1);
_p = (int) (0) ;
for (;_p <= limit9 ;_p = _p + step9 ) {
RDebugUtils.currentLine=40632330;
 //BA.debugLineNum = 40632330;BA.debugLine="Private t As String = prodsFijos.Get(p) 'Obtenem";
_t = BA.ObjectToString(_prodsfijos.Get(_p));
RDebugUtils.currentLine=40632331;
 //BA.debugLineNum = 40632331;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=40632332;
 //BA.debugLineNum = 40632332;BA.debugLine="If thisLog Then Log($\"T: ${t}, prod ${p2.Get(\"id";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540632332",("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=40632333;
 //BA.debugLineNum = 40632333;BA.debugLine="If thisLog Then Log(\"inventariosDisponiblesParaE";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540632333","inventariosDisponiblesParaEstaPromo="+BA.ObjectToString(_inventariosdisponiblesparaestapromo),0);};
RDebugUtils.currentLine=40632334;
 //BA.debugLineNum = 40632334;BA.debugLine="If inventariosDisponiblesParaEstaPromo.ContainsK";
if (_inventariosdisponiblesparaestapromo.ContainsKey((Object)(_t))) { 
RDebugUtils.currentLine=40632335;
 //BA.debugLineNum = 40632335;BA.debugLine="i = inventariosDisponiblesParaEstaPromo.get(t)";
_i = (int)(BA.ObjectToNumber(_inventariosdisponiblesparaestapromo.Get((Object)(_t))));
RDebugUtils.currentLine=40632336;
 //BA.debugLineNum = 40632336;BA.debugLine="If thisLog Then Log($\"Nuevo inventario de ${t}:";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540632336",("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=40632337;
 //BA.debugLineNum = 40632337;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=40632338;
 //BA.debugLineNum = 40632338;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ok"));
 }else {
RDebugUtils.currentLine=40632340;
 //BA.debugLineNum = 40632340;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("No hay suficiente producto para la promocion."));
RDebugUtils.currentLine=40632341;
 //BA.debugLineNum = 40632341;BA.debugLine="LogColor(\"Sin suficiente inventario fijo: \" & t";
anywheresoftware.b4a.keywords.Common.LogImpl("540632341","Sin suficiente inventario fijo: "+_t,anywheresoftware.b4a.keywords.Common.Colors.Blue);
RDebugUtils.currentLine=40632342;
 //BA.debugLineNum = 40632342;BA.debugLine="Exit";
if (true) break;
 };
RDebugUtils.currentLine=40632344;
 //BA.debugLineNum = 40632344;BA.debugLine="If i - p2.Get(\"piezas\") < 0 Then";
if (_i-(double)(BA.ObjectToNumber(_p2.Get((Object)("piezas"))))<0) { 
RDebugUtils.currentLine=40632345;
 //BA.debugLineNum = 40632345;BA.debugLine="inventariosDisponiblesParaEstaPromo.Put(\"result";
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("No hay suficiente producto para la promocion."));
RDebugUtils.currentLine=40632346;
 //BA.debugLineNum = 40632346;BA.debugLine="Exit";
if (true) break;
 };
 }
};
RDebugUtils.currentLine=40632349;
 //BA.debugLineNum = 40632349;BA.debugLine="If prodsFijos.Size = 0 Then inventariosDisponible";
if (_prodsfijos.getSize()==0) { 
_inventariosdisponiblesparaestapromo.Put((Object)("resultado"),(Object)("ok"));};
RDebugUtils.currentLine=40632350;
 //BA.debugLineNum = 40632350;BA.debugLine="If thisLog Then LogColor(\"Inventario final depues";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540632350","Inventario final depues de FIJOS: "+BA.ObjectToString(_inventariosdisponiblesparaestapromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=40632351;
 //BA.debugLineNum = 40632351;BA.debugLine="Return inventariosDisponiblesParaEstaPromo";
if (true) return _inventariosdisponiblesparaestapromo;
RDebugUtils.currentLine=40632352;
 //BA.debugLineNum = 40632352;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=38338560;
 //BA.debugLineNum = 38338560;BA.debugLine="Sub revisaFLP 'ignore";
RDebugUtils.currentLine=38338561;
 //BA.debugLineNum = 38338561;BA.debugLine="LogColor(\"**** **** Revisamos FLP **** ****\", Col";
anywheresoftware.b4a.keywords.Common.LogImpl("538338561","**** **** Revisamos FLP **** ****",anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (78),(int) (0),(int) (227)));
RDebugUtils.currentLine=38338562;
 //BA.debugLineNum = 38338562;BA.debugLine="Private todoBienFLP As Boolean = True";
_todobienflp = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=38338563;
 //BA.debugLineNum = 38338563;BA.debugLine="Try";
try {RDebugUtils.currentLine=38338564;
 //BA.debugLineNum = 38338564;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=38338565;
 //BA.debugLineNum = 38338565;BA.debugLine="log2DB(\"revisaFLP: No esta inicializado ... 'Re";
_log2db(_ba,"revisaFLP: No esta inicializado ... 'Reinicializando FLP'");
RDebugUtils.currentLine=38338566;
 //BA.debugLineNum = 38338566;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=38338567;
 //BA.debugLineNum = 38338567;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e10) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e10);RDebugUtils.currentLine=38338570;
 //BA.debugLineNum = 38338570;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsInitialized) ---";
anywheresoftware.b4a.keywords.Common.LogImpl("538338570","If Not(Tracker.FLP.IsInitialized) --- "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=38338572;
 //BA.debugLineNum = 38338572;BA.debugLine="Try";
try {RDebugUtils.currentLine=38338573;
 //BA.debugLineNum = 38338573;BA.debugLine="If Tracker.FLP.IsInitialized Then";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .IsInitialized()) { 
RDebugUtils.currentLine=38338574;
 //BA.debugLineNum = 38338574;BA.debugLine="Try";
try {RDebugUtils.currentLine=38338575;
 //BA.debugLineNum = 38338575;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=38338576;
 //BA.debugLineNum = 38338576;BA.debugLine="log2DB(\"revisaFLP: No esta conectado ... 'Rec";
_log2db(_ba,"revisaFLP: No esta conectado ... 'Reconectando FLP'");
RDebugUtils.currentLine=38338578;
 //BA.debugLineNum = 38338578;BA.debugLine="CallSubDelayed(Tracker,\"StartFLP\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()),"StartFLP");
RDebugUtils.currentLine=38338579;
 //BA.debugLineNum = 38338579;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e21) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e21);RDebugUtils.currentLine=38338582;
 //BA.debugLineNum = 38338582;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsConnected) -->";
anywheresoftware.b4a.keywords.Common.LogImpl("538338582","If Not(Tracker.FLP.IsConnected) --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=38338584;
 //BA.debugLineNum = 38338584;BA.debugLine="Try";
try {RDebugUtils.currentLine=38338585;
 //BA.debugLineNum = 38338585;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=38338588;
 //BA.debugLineNum = 38338588;BA.debugLine="log2DB(\"revisaFLP: 'No se esta actualizando,";
_log2db(_ba,"revisaFLP: 'No se esta actualizando, lo reiniciamos ...'");
RDebugUtils.currentLine=38338589;
 //BA.debugLineNum = 38338589;BA.debugLine="StartService(Tracker)";
anywheresoftware.b4a.keywords.Common.StartService((_ba.processBA == null ? _ba : _ba.processBA),(Object)(mostCurrent._tracker.getObject()));
RDebugUtils.currentLine=38338590;
 //BA.debugLineNum = 38338590;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e30) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e30);RDebugUtils.currentLine=38338593;
 //BA.debugLineNum = 38338593;BA.debugLine="LogColor(\"If FLP.IsConnectctd and FLP.getLKL.I";
anywheresoftware.b4a.keywords.Common.LogImpl("538338593","If FLP.IsConnectctd and FLP.getLKL.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=38338596;
 //BA.debugLineNum = 38338596;BA.debugLine="If todoBienFLP Then LogColor(\" +++ +++ Sin error";
if (_todobienflp) { 
anywheresoftware.b4a.keywords.Common.LogImpl("538338596"," +++ +++ Sin errores en FLP",anywheresoftware.b4a.keywords.Common.Colors.Green);};
 } 
       catch (Exception e35) {
			(_ba.processBA == null ? _ba : _ba.processBA).setLastException(e35);RDebugUtils.currentLine=38338598;
 //BA.debugLineNum = 38338598;BA.debugLine="LogColor(\"If Tracker.FLP.IsInitialized --> \"&Las";
anywheresoftware.b4a.keywords.Common.LogImpl("538338598","If Tracker.FLP.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=38338601;
 //BA.debugLineNum = 38338601;BA.debugLine="End Sub";
return "";
}
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=40960000;
 //BA.debugLineNum = 40960000;BA.debugLine="Sub revisaMaxPromosProdsFijosPorInventario2(pm As";
RDebugUtils.currentLine=40960001;
 //BA.debugLineNum = 40960001;BA.debugLine="Private thisLog As Boolean = False";
_thislog = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=40960002;
 //BA.debugLineNum = 40960002;BA.debugLine="If thisLog Then Log($\"pm=${pm}\"$)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960002",("pm="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pm.getObject()))+""),0);};
RDebugUtils.currentLine=40960004;
 //BA.debugLineNum = 40960004;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=40960005;
 //BA.debugLineNum = 40960005;BA.debugLine="If thisLog Then Log($\"invDispParaPromo=${invDispP";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960005",("invDispParaPromo="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),0);};
RDebugUtils.currentLine=40960006;
 //BA.debugLineNum = 40960006;BA.debugLine="Private maxPromos As String = traeMaxPromos(pm)";
_maxpromos = BA.NumberToString(_traemaxpromos(_ba,_pm));
RDebugUtils.currentLine=40960007;
 //BA.debugLineNum = 40960007;BA.debugLine="Private maxPromosFijosXinv As Int = 1";
_maxpromosfijosxinv = (int) (1);
RDebugUtils.currentLine=40960008;
 //BA.debugLineNum = 40960008;BA.debugLine="Private fpf2, pdp2 As Int";
_fpf2 = 0;
_pdp2 = 0;
RDebugUtils.currentLine=40960009;
 //BA.debugLineNum = 40960009;BA.debugLine="Private salir As Boolean = False";
_salir = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=40960010;
 //BA.debugLineNum = 40960010;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=40960011;
 //BA.debugLineNum = 40960011;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=40960012;
 //BA.debugLineNum = 40960012;BA.debugLine="If thisLog Then Log($\"maxPromos=${maxPromos}, pro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960012",("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=40960013;
 //BA.debugLineNum = 40960013;BA.debugLine="If thisLog Then LogColor($\"InvFijo disponible=${i";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960013",("InvFijo disponible="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_invdispparapromo.getObject()))+""),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=40960014;
 //BA.debugLineNum = 40960014;BA.debugLine="Private invFijoXpromo As Map";
_invfijoxpromo = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=40960015;
 //BA.debugLineNum = 40960015;BA.debugLine="invFijoXpromo.Initialize";
_invfijoxpromo.Initialize();
RDebugUtils.currentLine=40960016;
 //BA.debugLineNum = 40960016;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=40960017;
 //BA.debugLineNum = 40960017;BA.debugLine="invFijoXpromo.Put(pf.Get(p), pfp.Get(p))";
_invfijoxpromo.Put(_pf.Get(_p),_pfp.Get(_p));
 }
};
RDebugUtils.currentLine=40960019;
 //BA.debugLineNum = 40960019;BA.debugLine="If thisLog Then LogColor(\"Inv req. de prods fijos";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960019","Inv req. de prods fijos x promo"+BA.ObjectToString(_invfijoxpromo),anywheresoftware.b4a.keywords.Common.Colors.Green);};
RDebugUtils.currentLine=40960020;
 //BA.debugLineNum = 40960020;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=40960021;
 //BA.debugLineNum = 40960021;BA.debugLine="If thisLog Then LogColor(\"Prods para promo \" & (";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960021","Prods para promo "+BA.NumberToString((_i+1)),anywheresoftware.b4a.keywords.Common.Colors.Magenta);};
RDebugUtils.currentLine=40960022;
 //BA.debugLineNum = 40960022;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=40960023;
 //BA.debugLineNum = 40960023;BA.debugLine="Private q2 As String = pf.Get(q)";
_q2 = BA.ObjectToString(_pf.Get(_q));
RDebugUtils.currentLine=40960024;
 //BA.debugLineNum = 40960024;BA.debugLine="If thisLog Then Log(\"q=\"&q2)";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960024","q="+_q2,0);};
RDebugUtils.currentLine=40960026;
 //BA.debugLineNum = 40960026;BA.debugLine="fpf2 = pfp.Get(q) * i 'Multiplicamos las piezas";
_fpf2 = (int) ((double)(BA.ObjectToNumber(_pfp.Get(_q)))*_i);
RDebugUtils.currentLine=40960027;
 //BA.debugLineNum = 40960027;BA.debugLine="pdp2 = invDispParaPromo.Get(q2)";
_pdp2 = (int)(BA.ObjectToNumber(_invdispparapromo.Get((Object)(_q2))));
RDebugUtils.currentLine=40960028;
 //BA.debugLineNum = 40960028;BA.debugLine="If thisLog Then Log($\"pf=${q2}, Actual=${(i)},";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960028",("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=40960029;
 //BA.debugLineNum = 40960029;BA.debugLine="If pdp2 - fpf2 < 0 Then 'Si el inventario es ne";
if (_pdp2-_fpf2<0) { 
RDebugUtils.currentLine=40960030;
 //BA.debugLineNum = 40960030;BA.debugLine="salir=True";
_salir = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=40960031;
 //BA.debugLineNum = 40960031;BA.debugLine="Exit";
if (true) break;
 };
 }
};
RDebugUtils.currentLine=40960034;
 //BA.debugLineNum = 40960034;BA.debugLine="If salir Then Exit";
if (_salir) { 
if (true) break;};
RDebugUtils.currentLine=40960035;
 //BA.debugLineNum = 40960035;BA.debugLine="maxPromosFijosXinv = i";
_maxpromosfijosxinv = _i;
 }
};
RDebugUtils.currentLine=40960037;
 //BA.debugLineNum = 40960037;BA.debugLine="If thisLog Then LogColor(\"InvFijo requerido x pro";
if (_thislog) { 
anywheresoftware.b4a.keywords.Common.LogImpl("540960037","InvFijo requerido x promo="+BA.ObjectToString(_invfijoxpromo),anywheresoftware.b4a.keywords.Common.Colors.Blue);};
RDebugUtils.currentLine=40960038;
 //BA.debugLineNum = 40960038;BA.debugLine="LogColor(\"Maximo de promociones de prodsFijos POR";
anywheresoftware.b4a.keywords.Common.LogImpl("540960038","Maximo de promociones de prodsFijos POR inventario = "+BA.NumberToString(_maxpromosfijosxinv),anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=40960039;
 //BA.debugLineNum = 40960039;BA.debugLine="Return maxPromosFijosXinv";
if (true) return _maxpromosfijosxinv;
RDebugUtils.currentLine=40960040;
 //BA.debugLineNum = 40960040;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=38273024;
 //BA.debugLineNum = 38273024;BA.debugLine="Sub revisaUUG 'ignore";
RDebugUtils.currentLine=38273025;
 //BA.debugLineNum = 38273025;BA.debugLine="Try";
try {RDebugUtils.currentLine=38273027;
 //BA.debugLineNum = 38273027;BA.debugLine="If Tracker.FLP.GetLastKnownLocation.IsInitialize";
if (mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().IsInitialized()) { 
RDebugUtils.currentLine=38273028;
 //BA.debugLineNum = 38273028;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=38273029;
 //BA.debugLineNum = 38273029;BA.debugLine="If Starter.Logger Then LogColor($\"**** UUC \"${f";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("538273029",("**** 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=38273030;
 //BA.debugLineNum = 38273030;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=38273031;
 //BA.debugLineNum = 38273031;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=38273032;
 //BA.debugLineNum = 38273032;BA.debugLine="If Starter.Logger Then Log(\"++++ Distancia a a";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("538273032","++++ Distancia a anterior="+BA.NumberToString(_daa)+"|"+"Precision="+BA.NumberToString(mostCurrent._tracker._flp /*uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper*/ .GetLastKnownLocation().getAccuracy()),0);};
 };
RDebugUtils.currentLine=38273034;
 //BA.debugLineNum = 38273034;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=38273037;
 //BA.debugLineNum = 38273037;BA.debugLine="LogColor(\"If Tracker.FLP.GetLastKnownLocation.Is";
anywheresoftware.b4a.keywords.Common.LogImpl("538273037","If Tracker.FLP.GetLastKnownLocation.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(_ba)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=38273039;
 //BA.debugLineNum = 38273039;BA.debugLine="End Sub";
return "";
}
public static String  _traetipocliente(anywheresoftware.b4a.BA _ba) throws Exception{
RDebugUtils.currentModule="subs";
if (Debug.shouldDelegate(null, "traetipocliente", false))
	 {return ((String) Debug.delegate(null, "traetipocliente", new Object[] {_ba}));}
anywheresoftware.b4a.sql.SQL.CursorWrapper _x = null;
String _tc = "";
RDebugUtils.currentLine=36765696;
 //BA.debugLineNum = 36765696;BA.debugLine="Sub traeTipoCliente As String";
RDebugUtils.currentLine=36765697;
 //BA.debugLineNum = 36765697;BA.debugLine="Private x As Cursor";
_x = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=36765698;
 //BA.debugLineNum = 36765698;BA.debugLine="Private tc As String = \"DETALLE\"";
_tc = "DETALLE";
RDebugUtils.currentLine=36765699;
 //BA.debugLineNum = 36765699;BA.debugLine="x = Starter.skmt.ExecQuery($\"select IFNULL(CAT_CL";
_x = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select IFNULL(CAT_CL_TIPOCLIENTE,\"DETALLE\") AS CAT_CL_TIPOCLIENTE from kmt_info where cat_cl_codigo in (select cuenta from cuentaa)"))));
RDebugUtils.currentLine=36765700;
 //BA.debugLineNum = 36765700;BA.debugLine="If x.RowCount > 0 Then";
if (_x.getRowCount()>0) { 
RDebugUtils.currentLine=36765701;
 //BA.debugLineNum = 36765701;BA.debugLine="x.Position = 0";
_x.setPosition((int) (0));
RDebugUtils.currentLine=36765702;
 //BA.debugLineNum = 36765702;BA.debugLine="If x.GetString(\"CAT_CL_TIPOCLIENTE\") = \"null\" Or";
if ((_x.GetString("CAT_CL_TIPOCLIENTE")).equals("null") || _x.GetString("CAT_CL_TIPOCLIENTE")== null) { 
RDebugUtils.currentLine=36765703;
 //BA.debugLineNum = 36765703;BA.debugLine="tc = \"DETALLE\"";
_tc = "DETALLE";
 }else {
RDebugUtils.currentLine=36765705;
 //BA.debugLineNum = 36765705;BA.debugLine="tc = x.GetString(\"CAT_CL_TIPOCLIENTE\")";
_tc = _x.GetString("CAT_CL_TIPOCLIENTE");
 };
 };
RDebugUtils.currentLine=36765710;
 //BA.debugLineNum = 36765710;BA.debugLine="Return tc";
if (true) return _tc;
RDebugUtils.currentLine=36765711;
 //BA.debugLineNum = 36765711;BA.debugLine="End Sub";
return "";
}
}