package medicomed.keymon.com.mx;


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

public class c_historico 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_historico");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", medicomed.keymon.com.mx.c_historico.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.gps.GPS _g = null;
public String _clie_id = "";
public String _sdate = "";
public String _stime = "";
public String _usuario = "";
public anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
public String _ruta = "";
public anywheresoftware.b4a.objects.ButtonWrapper _regresar = null;
public anywheresoftware.b4a.objects.ListViewWrapper _listview1 = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_cant = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_total = null;
public anywheresoftware.b4a.objects.ButtonWrapper _borra = null;
public String _existe = "";
public String _result = "";
public anywheresoftware.b4a.objects.LabelWrapper _titulo = null;
public anywheresoftware.b4a.objects.ButtonWrapper _b_desc = null;
public anywheresoftware.b4a.objects.ListViewWrapper _listview2 = null;
public com.rootsoft.togglelibrary.ToggleLibrary _tgl = null;
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  _b4xpage_appear() throws Exception{
int _i = 0;
anywheresoftware.b4a.objects.LabelWrapper _label1 = null;
anywheresoftware.b4a.objects.LabelWrapper _label2 = null;
 //BA.debugLineNum = 51;BA.debugLine="Sub B4XPage_Appear";
 //BA.debugLineNum = 52;BA.debugLine="If Not(Starter.gps.GPSEnabled) Then";
if (__c.Not(_starter._gps /*anywheresoftware.b4a.gps.GPS*/ .getGPSEnabled())) { 
 //BA.debugLineNum = 53;BA.debugLine="ToastMessageShow(\"Es necesario tener el GPS ence";
__c.ToastMessageShow(BA.ObjectToCharSequence("Es necesario tener el GPS encendido"),__c.True);
 //BA.debugLineNum = 54;BA.debugLine="StartActivity(Starter.gps.LocationSettingsIntent";
__c.StartActivity(ba,(Object)(_starter._gps /*anywheresoftware.b4a.gps.GPS*/ .getLocationSettingsIntent()));
 };
 //BA.debugLineNum = 56;BA.debugLine="L_CANT.Text =\"\"";
_l_cant.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 57;BA.debugLine="L_TOTAL.Text=\"\"";
_l_total.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 58;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select count(";
_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 EXISTE from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa)")));
 //BA.debugLineNum = 59;BA.debugLine="C.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 60;BA.debugLine="Existe = C.GetString(\"EXISTE\")";
_existe = _c.GetString("EXISTE");
 //BA.debugLineNum = 61;BA.debugLine="C.Close";
_c.Close();
 //BA.debugLineNum = 62;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select HVD_CL";
_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 HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,HVD_COSTO_TOT from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_PRONOMBRE asc")));
 //BA.debugLineNum = 63;BA.debugLine="ListView1.Clear";
_listview1.Clear();
 //BA.debugLineNum = 64;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 65;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step14 = 1;
final int limit14 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit14 ;_i = _i + step14 ) {
 //BA.debugLineNum = 66;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 67;BA.debugLine="Dim label1 As Label";
_label1 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 68;BA.debugLine="label1 = ListView1.TwoLinesLayout.Label";
_label1 = _listview1.getTwoLinesLayout().Label;
 //BA.debugLineNum = 69;BA.debugLine="label1.TextSize = 15";
_label1.setTextSize((float) (15));
 //BA.debugLineNum = 70;BA.debugLine="label1.TextColor = Colors.Black";
_label1.setTextColor(__c.Colors.Black);
 //BA.debugLineNum = 71;BA.debugLine="Dim label2 As Label";
_label2 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 72;BA.debugLine="label2 = ListView1.TwoLinesLayout.SecondLabel";
_label2 = _listview1.getTwoLinesLayout().SecondLabel;
 //BA.debugLineNum = 73;BA.debugLine="label2.TextSize = 10";
_label2.setTextSize((float) (10));
 //BA.debugLineNum = 74;BA.debugLine="label2.TextColor = Colors.Blue";
_label2.setTextColor(__c.Colors.Blue);
 //BA.debugLineNum = 75;BA.debugLine="ListView1.AddTwoLines(c.GetString(\"HVD_PRONOMBR";
_listview1.AddTwoLines(BA.ObjectToCharSequence(_c.GetString("HVD_PRONOMBRE")),BA.ObjectToCharSequence("Cantidad #"+_c.GetString("HVD_CANT")+" SubTotal $"+_c.GetString("HVD_COSTO_TOT")));
 }
};
 };
 //BA.debugLineNum = 78;BA.debugLine="If Existe <> 0 Then";
if ((_existe).equals(BA.NumberToString(0)) == false) { 
 //BA.debugLineNum = 79;BA.debugLine="c=B4XPages.MainPage.skmt.ExecQuery(\"select SUM(H";
_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 SUM(HVD_CANT) AS PC_NOART, SUM(HVD_COSTO_TOT) AS PC_MONTO from HIST_VENTAS where HVD_CLIENTE in (Select CUENTA from cuentaa)")));
 //BA.debugLineNum = 80;BA.debugLine="C.Position=0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 81;BA.debugLine="L_CANT.Text = c.GetString(\"PC_NOART\")";
_l_cant.setText(BA.ObjectToCharSequence(_c.GetString("PC_NOART")));
 //BA.debugLineNum = 82;BA.debugLine="L_TOTAL.Text = c.GetString(\"PC_MONTO\")";
_l_total.setText(BA.ObjectToCharSequence(_c.GetString("PC_MONTO")));
 };
 //BA.debugLineNum = 84;BA.debugLine="End Sub";
return "";
}
public anywheresoftware.b4a.keywords.Common.ResumableSubWrapper  _b4xpage_closerequest() throws Exception{
ResumableSub_B4XPage_CloseRequest rsub = new ResumableSub_B4XPage_CloseRequest(this);
rsub.resume(ba, null);
return (anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.keywords.Common.ResumableSubWrapper(), rsub);
}
public static class ResumableSub_B4XPage_CloseRequest extends BA.ResumableSub {
public ResumableSub_B4XPage_CloseRequest(medicomed.keymon.com.mx.c_historico parent) {
this.parent = parent;
}
medicomed.keymon.com.mx.c_historico parent;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
{
parent.__c.ReturnFromResumableSub(this,null);return;}
case 0:
//C
this.state = -1;
 //BA.debugLineNum = 98;BA.debugLine="B4XPages.ShowPage(\"Cliente\")";
parent._b4xpages._showpage /*String*/ (ba,"Cliente");
 //BA.debugLineNum = 99;BA.debugLine="Return False";
if (true) {
parent.__c.ReturnFromResumableSub(this,(Object)(parent.__c.False));return;};
 //BA.debugLineNum = 100;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public String  _b4xpage_created(anywheresoftware.b4a.objects.B4XViewWrapper _root1) throws Exception{
 //BA.debugLineNum = 35;BA.debugLine="Private Sub B4XPage_Created (Root1 As B4XView)";
 //BA.debugLineNum = 36;BA.debugLine="Root = Root1";
_root = _root1;
 //BA.debugLineNum = 38;BA.debugLine="ruta = File.DirInternal";
_ruta = __c.File.getDirInternal();
 //BA.debugLineNum = 39;BA.debugLine="Root.LoadLayout(\"nota\")";
_root.LoadLayout("nota",ba);
 //BA.debugLineNum = 40;BA.debugLine="borra.Visible = False";
_borra.setVisible(__c.False);
 //BA.debugLineNum = 41;BA.debugLine="Titulo.Text = \"Acumulado\"";
_titulo.setText(BA.ObjectToCharSequence("Acumulado"));
 //BA.debugLineNum = 42;BA.debugLine="b_desc.Visible = False";
_b_desc.setVisible(__c.False);
 //BA.debugLineNum = 43;BA.debugLine="If File.Exists(ruta, \"kmt.db\") = False Then";
if (__c.File.Exists(_ruta,"kmt.db")==__c.False) { 
 //BA.debugLineNum = 44;BA.debugLine="File.Copy(File.DirAssets, \"kmt.db\", ruta, \"kmt.d";
__c.File.Copy(__c.File.getDirAssets(),"kmt.db",_ruta,"kmt.db");
 };
 //BA.debugLineNum = 47;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 = 5;BA.debugLine="Dim g As GPS";
_g = new anywheresoftware.b4a.gps.GPS();
 //BA.debugLineNum = 6;BA.debugLine="Dim clie_id As String";
_clie_id = "";
 //BA.debugLineNum = 7;BA.debugLine="Dim sDate,sTime As String";
_sdate = "";
_stime = "";
 //BA.debugLineNum = 8;BA.debugLine="Dim usuario As String";
_usuario = "";
 //BA.debugLineNum = 10;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 11;BA.debugLine="Dim ruta As String";
_ruta = "";
 //BA.debugLineNum = 12;BA.debugLine="Dim Regresar As Button";
_regresar = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 15;BA.debugLine="Dim ListView1 As ListView";
_listview1 = new anywheresoftware.b4a.objects.ListViewWrapper();
 //BA.debugLineNum = 16;BA.debugLine="Dim L_CANT As Label";
_l_cant = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 17;BA.debugLine="Dim L_TOTAL As Label";
_l_total = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 18;BA.debugLine="Dim borra As Button";
_borra = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 19;BA.debugLine="Dim Existe As String";
_existe = "";
 //BA.debugLineNum = 20;BA.debugLine="Dim result As String";
_result = "";
 //BA.debugLineNum = 23;BA.debugLine="Private Titulo As Label";
_titulo = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 24;BA.debugLine="Private b_desc As Button";
_b_desc = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 25;BA.debugLine="Private ListView2 As ListView";
_listview2 = new anywheresoftware.b4a.objects.ListViewWrapper();
 //BA.debugLineNum = 26;BA.debugLine="Dim tgl As Toggle";
_tgl = new com.rootsoft.togglelibrary.ToggleLibrary();
 //BA.debugLineNum = 27;BA.debugLine="End Sub";
return "";
}
public String  _gps_locationchanged(anywheresoftware.b4a.gps.LocationWrapper _location1) throws Exception{
 //BA.debugLineNum = 86;BA.debugLine="Sub GPS_LocationChanged (Location1 As Location)";
 //BA.debugLineNum = 89;BA.debugLine="End Sub";
return "";
}
public Object  _initialize(anywheresoftware.b4a.BA _ba) throws Exception{
innerInitialize(_ba);
 //BA.debugLineNum = 30;BA.debugLine="Public Sub Initialize As Object";
 //BA.debugLineNum = 31;BA.debugLine="Return Me";
if (true) return this;
 //BA.debugLineNum = 32;BA.debugLine="End Sub";
return null;
}
public String  _listview1_itemclick(int _position,Object _value) throws Exception{
anywheresoftware.b4a.objects.LabelWrapper _label1 = null;
int _i = 0;
 //BA.debugLineNum = 107;BA.debugLine="Sub ListView1_ItemClick (Position As Int, Value As";
 //BA.debugLineNum = 108;BA.debugLine="ListView2.Visible = True";
_listview2.setVisible(__c.True);
 //BA.debugLineNum = 109;BA.debugLine="ListView1.Visible = False";
_listview1.setVisible(__c.False);
 //BA.debugLineNum = 110;BA.debugLine="Dim label1 As Label";
_label1 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 111;BA.debugLine="For i=0 To 20";
{
final int step4 = 1;
final int limit4 = (int) (20);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
 //BA.debugLineNum = 112;BA.debugLine="label1 = ListView2.SingleLineLayout.Label";
_label1 = _listview2.getSingleLineLayout().Label;
 //BA.debugLineNum = 113;BA.debugLine="label1.TextSize = 15";
_label1.setTextSize((float) (15));
 //BA.debugLineNum = 114;BA.debugLine="label1.TextColor = Colors.Black";
_label1.setTextColor(__c.Colors.Black);
 //BA.debugLineNum = 115;BA.debugLine="ListView2.AddSingleLine(i)";
_listview2.AddSingleLine(BA.ObjectToCharSequence(_i));
 }
};
 //BA.debugLineNum = 117;BA.debugLine="End Sub";
return "";
}
public String  _listview2_itemclick(int _position,Object _value) throws Exception{
 //BA.debugLineNum = 102;BA.debugLine="Sub ListView2_ItemClick (Position As Int, Value As";
 //BA.debugLineNum = 103;BA.debugLine="ListView2.Visible = False";
_listview2.setVisible(__c.False);
 //BA.debugLineNum = 104;BA.debugLine="ListView1.Visible = True";
_listview1.setVisible(__c.True);
 //BA.debugLineNum = 105;BA.debugLine="End Sub";
return "";
}
public String  _regresar_click() throws Exception{
 //BA.debugLineNum = 91;BA.debugLine="Sub Regresar_Click";
 //BA.debugLineNum = 92;BA.debugLine="B4XPages.ShowPage(\"Cliente\")";
_b4xpages._showpage /*String*/ (ba,"Cliente");
 //BA.debugLineNum = 93;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]);
if (BA.fastSubCompare(sub, "GPS_LOCATIONCHANGED"))
	return _gps_locationchanged((anywheresoftware.b4a.gps.LocationWrapper) args[0]);
return BA.SubDelegator.SubNotFound;
}
}
