package medicomed.keymon.com.mx;


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

public class c_respaldodiario extends B4AClass.ImplB4AClass implements BA.SubDelegator{
    private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
    private void innerInitialize(BA _ba) throws Exception {
        if (ba == null) {
            ba = new BA(_ba, this, htSubs, "medicomed.keymon.com.mx.c_respaldodiario");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", medicomed.keymon.com.mx.c_respaldodiario.class).invoke(this, new Object[] {null});
        else
            ba.raiseEvent2(null, true, "class_globals", false);
    }

 public anywheresoftware.b4a.keywords.Common __c = null;
public anywheresoftware.b4a.objects.B4XViewWrapper _root = null;
public anywheresoftware.b4a.objects.B4XViewWrapper.XUI _xui = null;
public anywheresoftware.b4a.sql.SQL _skmt = null;
public anywheresoftware.b4a.sql.SQL _rkmt = null;
public String _safepath = "";
public String _fechahoy = "";
public boolean _skmtattached = false;
public b4a.example.dateutils _dateutils = null;
public medicomed.keymon.com.mx.main _main = null;
public medicomed.keymon.com.mx.starter _starter = null;
public medicomed.keymon.com.mx.appupdater _appupdater = null;
public medicomed.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public medicomed.keymon.com.mx.mapa_cliente _mapa_cliente = null;
public medicomed.keymon.com.mx.subs _subs = null;
public medicomed.keymon.com.mx.notificationservice _notificationservice = null;
public medicomed.keymon.com.mx.pendientes _pendientes = null;
public medicomed.keymon.com.mx.tracker _tracker = null;
public medicomed.keymon.com.mx.newinst2 _newinst2 = null;
public medicomed.keymon.com.mx.b4xpages _b4xpages = null;
public medicomed.keymon.com.mx.b4xcollections _b4xcollections = null;
public medicomed.keymon.com.mx.httputils2service _httputils2service = null;
public medicomed.keymon.com.mx.xuiviewsutils _xuiviewsutils = null;
public String  _agregacolumna(String _tabla,String _columna,String _tipo) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 129;BA.debugLine="Sub agregaColumna(tabla As String, columna As Stri";
 //BA.debugLineNum = 130;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try { //BA.debugLineNum = 131;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)(_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("SELECT COUNT(*) AS fCol FROM pragma_table_info('"+__c.SmartStringFormatter("",(Object)(_tabla))+"') WHERE name='"+__c.SmartStringFormatter("",(Object)(_columna))+"'"))));
 //BA.debugLineNum = 132;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 133;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 134;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("ALTER TABLE "+__c.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 135;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
__c.LogImpl("765929222",("Columna \""+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+__c.SmartStringFormatter("",(Object)(_tabla))+"\"."),0);
 };
 } 
       catch (Exception e9) {
			ba.setLastException(e9); //BA.debugLineNum = 138;BA.debugLine="Try";
try { //BA.debugLineNum = 139;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery($\"ALTER TAB";
_b4xpages._mainpage /*medicomed.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("ALTER TABLE "+__c.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 140;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
__c.LogImpl("765929227",("Columna \""+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+__c.SmartStringFormatter("",(Object)(_tabla))+"\".."),0);
 } 
       catch (Exception e13) {
			ba.setLastException(e13); //BA.debugLineNum = 142;BA.debugLine="Log(LastException)";
__c.LogImpl("765929229",BA.ObjectToString(__c.LastException(ba)),0);
 };
 };
 //BA.debugLineNum = 145;BA.debugLine="End Sub";
return "";
}
public String  _agregacolumna2(anywheresoftware.b4a.sql.SQL _db,String _tabla,String _columna,String _tipo) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 147;BA.debugLine="Sub agregaColumna2(db As SQL, tabla As String, col";
 //BA.debugLineNum = 148;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try { //BA.debugLineNum = 149;BA.debugLine="Private c As Cursor = db.ExecQuery($\"SELECT COUN";
_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)(_db.ExecQuery(("SELECT COUNT(*) AS fCol FROM pragma_table_info('"+__c.SmartStringFormatter("",(Object)(_tabla))+"') WHERE name='"+__c.SmartStringFormatter("",(Object)(_columna))+"'"))));
 //BA.debugLineNum = 150;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 151;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 152;BA.debugLine="db.ExecNonQuery($\"ALTER TABLE ${tabla} ADD COLU";
_db.ExecNonQuery(("ALTER TABLE "+__c.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 153;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
__c.LogImpl("765994758",("Columna \""+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+__c.SmartStringFormatter("",(Object)(_tabla))+"\"."),0);
 };
 } 
       catch (Exception e9) {
			ba.setLastException(e9); //BA.debugLineNum = 156;BA.debugLine="Try";
try { //BA.debugLineNum = 157;BA.debugLine="db.ExecNonQuery($\"ALTER TABLE ${tabla} ADD COLU";
_db.ExecNonQuery(("ALTER TABLE "+__c.SmartStringFormatter("",(Object)(_tabla))+" ADD COLUMN "+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+""));
 //BA.debugLineNum = 158;BA.debugLine="Log($\"Columna \"${columna} ${tipo}\", agregada a";
__c.LogImpl("765994763",("Columna \""+__c.SmartStringFormatter("",(Object)(_columna))+" "+__c.SmartStringFormatter("",(Object)(_tipo))+"\", agregada a \""+__c.SmartStringFormatter("",(Object)(_tabla))+"\".."),0);
 } 
       catch (Exception e13) {
			ba.setLastException(e13); //BA.debugLineNum = 160;BA.debugLine="Log(LastException)";
__c.LogImpl("765994765",BA.ObjectToString(__c.LastException(ba)),0);
 };
 };
 //BA.debugLineNum = 163;BA.debugLine="End Sub";
return "";
}
public String  _b4xpage_created(anywheresoftware.b4a.objects.B4XViewWrapper _root1) throws Exception{
 //BA.debugLineNum = 61;BA.debugLine="Private Sub B4XPage_Created (Root1 As B4XView)";
 //BA.debugLineNum = 62;BA.debugLine="Root = Root1";
_root = _root1;
 //BA.debugLineNum = 64;BA.debugLine="End Sub";
return "";
}
public String  _class_globals() throws Exception{
 //BA.debugLineNum = 1;BA.debugLine="Sub Class_Globals";
 //BA.debugLineNum = 2;BA.debugLine="Private Root As B4XView 'ignore";
_root = new anywheresoftware.b4a.objects.B4XViewWrapper();
 //BA.debugLineNum = 3;BA.debugLine="Private xui As XUI 'ignore";
_xui = new anywheresoftware.b4a.objects.B4XViewWrapper.XUI();
 //BA.debugLineNum = 4;BA.debugLine="Dim skmt, rkmt As SQL";
_skmt = new anywheresoftware.b4a.sql.SQL();
_rkmt = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 6;BA.debugLine="Dim safePath As String";
_safepath = "";
 //BA.debugLineNum = 7;BA.debugLine="Dim fechaHoy As String";
_fechahoy = "";
 //BA.debugLineNum = 8;BA.debugLine="Dim skmtAttached As Boolean = False";
_skmtattached = __c.False;
 //BA.debugLineNum = 9;BA.debugLine="End Sub";
return "";
}
public Object  _initialize(anywheresoftware.b4a.BA _ba) throws Exception{
innerInitialize(_ba);
anywheresoftware.b4a.objects.RuntimePermissions _rp = null;
String _dirp = "";
String _dir = "";
String[] _name = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
 //BA.debugLineNum = 12;BA.debugLine="Public Sub Initialize As Object";
 //BA.debugLineNum = 14;BA.debugLine="Dim rp As RuntimePermissions";
_rp = new anywheresoftware.b4a.objects.RuntimePermissions();
 //BA.debugLineNum = 15;BA.debugLine="Dim Dirp As String = File.DirInternal";
_dirp = __c.File.getDirInternal();
 //BA.debugLineNum = 16;BA.debugLine="Dim Dir As String";
_dir = "";
 //BA.debugLineNum = 18;BA.debugLine="Try";
try { //BA.debugLineNum = 19;BA.debugLine="File.MakeDir(Dirp,\"/kmts\")";
__c.File.MakeDir(_dirp,"/kmts");
 //BA.debugLineNum = 20;BA.debugLine="Dir = \"/kmts\"";
_dir = "/kmts";
 } 
       catch (Exception e8) {
			ba.setLastException(e8); //BA.debugLineNum = 23;BA.debugLine="Dir = \"\"";
_dir = "";
 };
 //BA.debugLineNum = 27;BA.debugLine="safePath = Dirp & Dir";
_safepath = _dirp+_dir;
 //BA.debugLineNum = 29;BA.debugLine="If Not(File.IsDirectory(Dirp, Dir)) Then safePath";
if (__c.Not(__c.File.IsDirectory(_dirp,_dir))) { 
_safepath = _rp.GetSafeDirDefaultExternal("kmts");};
 //BA.debugLineNum = 30;BA.debugLine="Private name() As String = Regex.split(\" \", Appli";
_name = __c.Regex.Split(" ",__c.Application.getLabelName());
 //BA.debugLineNum = 31;BA.debugLine="rkmt.Initialize(safePath,$\"${name(0)}.rkmt.km\"$,";
_rkmt.Initialize(_safepath,(""+__c.SmartStringFormatter("",(Object)(_name[(int) (0)]))+".rkmt.km"),__c.True);
 //BA.debugLineNum = 32;BA.debugLine="skmt.Initialize(File.DirInternal,\"kmt.db\", False)";
_skmt.Initialize(__c.File.getDirInternal(),"kmt.db",__c.False);
 //BA.debugLineNum = 33;BA.debugLine="rkmt.ExecNonQuery($\"create table if not exists pe";
_rkmt.ExecNonQuery(("create table if not exists pedidos (pe_folio NUMERIC, pe_desc NUMERIC, pe_costo_sin TEXT, pe_ruta TEXT, pe_cedis TEXT, pe_costo_tot NUMERIC, pe_costou NUMERIC, pe_cant NUMERIC, pe_pronombre TEXT, pe_proid TEXT, pe_cliente TEXT, pe_fecha TEXT, pe_usuario TEXT)"));
 //BA.debugLineNum = 34;BA.debugLine="agregaColumna2(rkmt,\"pedidos\",\"pe_cantc\",\"text\")";
_agregacolumna2(_rkmt,"pedidos","pe_cantc","text");
 //BA.debugLineNum = 35;BA.debugLine="agregaColumna2(rkmt,\"pedidos\",\"pe_bcajas\",\"text\")";
_agregacolumna2(_rkmt,"pedidos","pe_bcajas","text");
 //BA.debugLineNum = 36;BA.debugLine="agregaColumna2(rkmt,\"pedidos\", \"PE_IMPRESO\", \"INT";
_agregacolumna2(_rkmt,"pedidos","PE_IMPRESO","INT");
 //BA.debugLineNum = 37;BA.debugLine="Try 'Intentamos usar \"pragma_table_info\" para rev";
try { //BA.debugLineNum = 38;BA.debugLine="Private c As Cursor = rkmt.ExecQuery($\"SELECT CO";
_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)(_rkmt.ExecQuery(("SELECT COUNT(*) AS fCol FROM pragma_table_info('pedidos') WHERE name='pe_envio_ok'"))));
 //BA.debugLineNum = 39;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 40;BA.debugLine="If c.GetString(\"fCol\") = 0 Then 'Si no esta la c";
if ((_c.GetString("fCol")).equals(BA.NumberToString(0))) { 
 //BA.debugLineNum = 41;BA.debugLine="rkmt.ExecNonQuery($\"ALTER TABLE pedidos ADD COL";
_rkmt.ExecNonQuery(("ALTER TABLE pedidos ADD COLUMN pe_envio_ok INT"));
 //BA.debugLineNum = 42;BA.debugLine="Log($\"Columna \"pe_envio_ok INT\", agregada a \"pe";
__c.LogImpl("765470494",("Columna \"pe_envio_ok INT\", agregada a \"pedidos}\"."),0);
 };
 } 
       catch (Exception e27) {
			ba.setLastException(e27); //BA.debugLineNum = 45;BA.debugLine="Try";
try { //BA.debugLineNum = 46;BA.debugLine="rkmt.ExecNonQuery($\"ALTER TABLE pedidos ADD COL";
_rkmt.ExecNonQuery(("ALTER TABLE pedidos ADD COLUMN pe_envio_ok INT"));
 //BA.debugLineNum = 47;BA.debugLine="Log($\"Columna \"pe_envio_ok INT\", agregada a \"pe";
__c.LogImpl("765470499",("Columna \"pe_envio_ok INT\", agregada a \"pedidos\".."),0);
 } 
       catch (Exception e31) {
			ba.setLastException(e31); //BA.debugLineNum = 49;BA.debugLine="Log(LastException)";
__c.LogImpl("765470501",BA.ObjectToString(__c.LastException(ba)),0);
 };
 };
 //BA.debugLineNum = 52;BA.debugLine="rkmt.ExecNonQuery($\"create table if not exists in";
_rkmt.ExecNonQuery(("create table if not exists inventarios (cat_gp_iniciativa TEXT, cat_gp_tipoprod TEXT, cat_gp_dev TEXT, cat_gp_almacen NUMERIC, cat_gp_id TEXT, cat_gp_nombre TEXT, cat_gp_imp1 TEXT, cat_gp_imp2 TEXT, cat_gp_precio TEXT, cat_gp_clasif TEXT, cat_gp_sts TEXT, cat_gp_tipo TEXT, cat_gp_subtipo TEXT, cat_gp_tipoprod2 TEXT, fecha TEXT)"));
 //BA.debugLineNum = 53;BA.debugLine="rkmt.ExecNonQuery($\"create table if not exists pa";
_rkmt.ExecNonQuery(("create table if not exists paquetes (cat_dp_precio_simptos TEXT, cat_dp_precio TEXT, cat_dp_almacen TEXT, cat_dp_id TEXT, cat_dp_idprod TEXT, cat_dp_tipo TEXT, cat_dp_pzas TEXT, cat_dp_usuario TEXT, cat_dp_fecha TEXT, cat_dp_regalo TEXT, cat_dp_clasif TEXT, fecha TEXT)"));
 //BA.debugLineNum = 54;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
__c.DateTime.setDateFormat("MM/dd/yyyy");
 //BA.debugLineNum = 55;BA.debugLine="fechaHoy = DateTime.Date(DateTime.Now)";
_fechahoy = __c.DateTime.Date(__c.DateTime.getNow());
 //BA.debugLineNum = 56;BA.debugLine="revisaSkmtAttached";
_revisaskmtattached();
 //BA.debugLineNum = 57;BA.debugLine="Return Me";
if (true) return this;
 //BA.debugLineNum = 58;BA.debugLine="End Sub";
return null;
}
public String  _respaldainventarios() throws Exception{
String _inicio = "";
 //BA.debugLineNum = 93;BA.debugLine="Sub respaldaInventarios";
 //BA.debugLineNum = 95;BA.debugLine="Private inicio As String = DateTime.Now";
_inicio = BA.NumberToString(__c.DateTime.getNow());
 //BA.debugLineNum = 98;BA.debugLine="rkmt.BeginTransaction";
_rkmt.BeginTransaction();
 //BA.debugLineNum = 99;BA.debugLine="rkmt.ExecNonQuery($\"delete from inventarios where";
_rkmt.ExecNonQuery(("delete from inventarios where fecha = '"+__c.SmartStringFormatter("",(Object)(_fechahoy))+"'"));
 //BA.debugLineNum = 100;BA.debugLine="rkmt.ExecNonQuery($\"insert into inventarios (cat_";
_rkmt.ExecNonQuery(("insert into inventarios (cat_gp_iniciativa, cat_gp_tipoprod, cat_gp_dev, cat_gp_almacen, cat_gp_id, cat_gp_nombre, cat_gp_imp1, cat_gp_imp2, cat_gp_precio, cat_gp_clasif, cat_gp_sts, cat_gp_tipo, cat_gp_subtipo, fecha) select cat_gp_iniciativa, cat_gp_tipoprod, cat_gp_dev, cat_gp_almacen, cat_gp_id, cat_gp_nombre, cat_gp_imp1, cat_gp_imp2, cat_gp_precio, cat_gp_clasif, cat_gp_sts, cat_gp_tipo, cat_gp_subtipo, '"+__c.SmartStringFormatter("",(Object)(_fechahoy))+"' as fecha from skmt1.cat_gunaprod"));
 //BA.debugLineNum = 101;BA.debugLine="rkmt.TransactionSuccessful 'Si no se pone Transac";
_rkmt.TransactionSuccessful();
 //BA.debugLineNum = 102;BA.debugLine="rkmt.EndTransaction";
_rkmt.EndTransaction();
 //BA.debugLineNum = 104;BA.debugLine="End Sub";
return "";
}
public String  _respaldapaquetes() throws Exception{
String _inicio = "";
 //BA.debugLineNum = 107;BA.debugLine="Sub respaldaPaquetes";
 //BA.debugLineNum = 108;BA.debugLine="Private inicio As String = DateTime.Now";
_inicio = BA.NumberToString(__c.DateTime.getNow());
 //BA.debugLineNum = 110;BA.debugLine="rkmt.BeginTransaction";
_rkmt.BeginTransaction();
 //BA.debugLineNum = 112;BA.debugLine="rkmt.ExecNonQuery($\"delete from paquetes where fe";
_rkmt.ExecNonQuery(("delete from paquetes where fecha = '"+__c.SmartStringFormatter("",(Object)(_fechahoy))+"'"));
 //BA.debugLineNum = 113;BA.debugLine="rkmt.ExecNonQuery($\"insert into paquetes (cat_dp_";
_rkmt.ExecNonQuery(("insert into paquetes (cat_dp_precio_simptos, cat_dp_precio, cat_dp_almacen, cat_dp_id, cat_dp_idprod, cat_dp_tipo, cat_dp_pzas, cat_dp_usuario, cat_dp_fecha, cat_dp_regalo, cat_dp_clasif, fecha) select cat_dp_precio_simptos, cat_dp_precio, cat_dp_almacen, cat_dp_id, cat_dp_idprod, cat_dp_tipo, cat_dp_pzas, cat_dp_usuario, cat_dp_fecha, cat_dp_regalo, cat_dp_clasif, '"+__c.SmartStringFormatter("",(Object)(_fechahoy))+"' as fecha from skmt1.cat_detalles_paq"));
 //BA.debugLineNum = 114;BA.debugLine="rkmt.TransactionSuccessful 'Si no se pone Transac";
_rkmt.TransactionSuccessful();
 //BA.debugLineNum = 115;BA.debugLine="rkmt.EndTransaction";
_rkmt.EndTransaction();
 //BA.debugLineNum = 117;BA.debugLine="End Sub";
return "";
}
public String  _respaldapedido() throws Exception{
String _inicio = "";
 //BA.debugLineNum = 80;BA.debugLine="Sub respaldaPedido";
 //BA.debugLineNum = 81;BA.debugLine="Private inicio As String = DateTime.Now";
_inicio = BA.NumberToString(__c.DateTime.getNow());
 //BA.debugLineNum = 83;BA.debugLine="rkmt.BeginTransaction";
_rkmt.BeginTransaction();
 //BA.debugLineNum = 84;BA.debugLine="rkmt.ExecNonQuery($\"delete from pedidos where sub";
_rkmt.ExecNonQuery(("delete from pedidos where substr(pe_fecha, 1, 10) = '"+__c.SmartStringFormatter("",(Object)(_fechahoy))+"'"));
 //BA.debugLineNum = 85;BA.debugLine="rkmt.ExecNonQuery($\"insert into pedidos (pe_folio";
_rkmt.ExecNonQuery(("insert into pedidos (pe_folio, pe_desc, pe_costo_sin, pe_ruta, pe_cedis, pe_costo_tot, pe_costou, pe_cant, pe_pronombre, pe_proid, pe_cliente, pe_fecha, pe_usuario, pe_envio_ok,pe_cantc,pe_bcajas,PE_IMPRESO) select * from skmt1.pedido where substr(pe_fecha, 1, 10) = '"+__c.SmartStringFormatter("",(Object)(_fechahoy))+"'"));
 //BA.debugLineNum = 86;BA.debugLine="rkmt.TransactionSuccessful 'Si no se pone Transac";
_rkmt.TransactionSuccessful();
 //BA.debugLineNum = 87;BA.debugLine="rkmt.EndTransaction";
_rkmt.EndTransaction();
 //BA.debugLineNum = 89;BA.debugLine="End Sub";
return "";
}
public String  _revisaskmtattached() throws Exception{
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _rs = null;
 //BA.debugLineNum = 67;BA.debugLine="Sub revisaSkmtAttached";
 //BA.debugLineNum = 68;BA.debugLine="skmtAttached = False";
_skmtattached = __c.False;
 //BA.debugLineNum = 69;BA.debugLine="Dim rs As ResultSet = rkmt.ExecQuery(\"SELECT * FR";
_rs = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_rs = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(_rkmt.ExecQuery("SELECT * FROM pragma_database_list")));
 //BA.debugLineNum = 70;BA.debugLine="Do While rs.NextRow 'Revisamos si esta montada \"k";
while (_rs.NextRow()) {
 //BA.debugLineNum = 71;BA.debugLine="If rs.GetString(\"name\") = \"skmt1\" Then skmtAttac";
if ((_rs.GetString("name")).equals("skmt1")) { 
_skmtattached = __c.True;};
 }
;
 //BA.debugLineNum = 73;BA.debugLine="If Not(skmtAttached) Then";
if (__c.Not(_skmtattached)) { 
 //BA.debugLineNum = 74;BA.debugLine="rkmt.ExecNonQuery($\"attach database '${File.Comb";
_rkmt.ExecNonQuery(("attach database '"+__c.SmartStringFormatter("",(Object)(__c.File.Combine(__c.File.getDirInternal(),"kmt.db")))+"' as skmt1;"));
 //BA.debugLineNum = 75;BA.debugLine="skmtAttached = True";
_skmtattached = __c.True;
 };
 //BA.debugLineNum = 77;BA.debugLine="End Sub";
return "";
}
public String  _vacuum() throws Exception{
 //BA.debugLineNum = 119;BA.debugLine="Sub vacuum";
 //BA.debugLineNum = 121;BA.debugLine="rkmt.ExecNonQuery(\"vacuum;\")";
_rkmt.ExecNonQuery("vacuum;");
 //BA.debugLineNum = 122;BA.debugLine="End Sub";
return "";
}
public Object callSub(String sub, Object sender, Object[] args) throws Exception {
BA.senderHolder.set(sender);
if (BA.fastSubCompare(sub, "B4XPAGE_CREATED"))
	return _b4xpage_created((anywheresoftware.b4a.objects.B4XViewWrapper) args[0]);
return BA.SubDelegator.SubNotFound;
}
}
