package gunav2.keymon.com.mx;


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

public class c_historicobatyodos 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, "gunav2.keymon.com.mx.c_historicobatyodos");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", gunav2.keymon.com.mx.c_historicobatyodos.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 anywheresoftware.b4a.objects.PanelWrapper _p_nota = null;
public anywheresoftware.b4a.objects.PanelWrapper _panel1 = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_productohist = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_s1 = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_s2 = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_s3 = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_s4 = null;
public b4a.example3.customlistview _customlistview1 = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_promediohist = null;
public b4a.example.dateutils _dateutils = null;
public gunav2.keymon.com.mx.main _main = null;
public gunav2.keymon.com.mx.starter _starter = null;
public gunav2.keymon.com.mx.subs _subs = null;
public gunav2.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public gunav2.keymon.com.mx.appupdater _appupdater = null;
public gunav2.keymon.com.mx.firebasemessaging _firebasemessaging = null;
public gunav2.keymon.com.mx.tracker _tracker = null;
public gunav2.keymon.com.mx.newinst2 _newinst2 = null;
public gunav2.keymon.com.mx.b4xpages _b4xpages = null;
public gunav2.keymon.com.mx.b4xcollections _b4xcollections = null;
public gunav2.keymon.com.mx.httputils2service _httputils2service = null;
public gunav2.keymon.com.mx.xuiviewsutils _xuiviewsutils = null;
public String  _b4xpage_appear() throws Exception{
String _queryventas = "";
String _currentticket = "";
int _i = 0;
String _ticket = "";
String _fecha = "";
String _producto = "";
String _cant = "";
String _costo = "";
String _detalle = "";
 //BA.debugLineNum = 57;BA.debugLine="Sub B4XPage_Appear";
 //BA.debugLineNum = 58;BA.debugLine="Panel1.Visible = False";
_panel1.setVisible(__c.False);
 //BA.debugLineNum = 59;BA.debugLine="If Not(Starter.gps.GPSEnabled) Then";
if (__c.Not(_starter._gps /*anywheresoftware.b4a.gps.GPS*/ .getGPSEnabled())) { 
 //BA.debugLineNum = 60;BA.debugLine="ToastMessageShow(\"Es necesario tener el GPS ence";
__c.ToastMessageShow(BA.ObjectToCharSequence("Es necesario tener el GPS encendido"),__c.True);
 //BA.debugLineNum = 61;BA.debugLine="StartActivity(Starter.gps.LocationSettingsIntent";
__c.StartActivity(ba,(Object)(_starter._gps /*anywheresoftware.b4a.gps.GPS*/ .getLocationSettingsIntent()));
 };
 //BA.debugLineNum = 64;BA.debugLine="L_CANT.Text = \"\"";
_l_cant.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 65;BA.debugLine="L_TOTAL.Text = \"\"";
_l_total.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 67;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)(_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select count(*) as EXISTE from hist_ventastodos  WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) ORDER BY HVD_CODPROMO, HVD_COSTO_TOT ASC")));
 //BA.debugLineNum = 68;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 69;BA.debugLine="Existe = c.GetString(\"EXISTE\")";
_existe = _c.GetString("EXISTE");
 //BA.debugLineNum = 70;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 75;BA.debugLine="ListView1.Clear";
_listview1.Clear();
 //BA.debugLineNum = 76;BA.debugLine="ListView1.Visible = True";
_listview1.setVisible(__c.True);
 //BA.debugLineNum = 79;BA.debugLine="ListView1.Color = xui.Color_RGB(245, 245, 245)";
_listview1.setColor(_xui.Color_RGB((int) (245),(int) (245),(int) (245)));
 //BA.debugLineNum = 82;BA.debugLine="ListView1.SingleLineLayout.Label.TextSize = 16";
_listview1.getSingleLineLayout().Label.setTextSize((float) (16));
 //BA.debugLineNum = 84;BA.debugLine="ListView1.SingleLineLayout.Label.TextColor = xui.";
_listview1.getSingleLineLayout().Label.setTextColor(_xui.Color_RGB((int) (25),(int) (118),(int) (210)));
 //BA.debugLineNum = 85;BA.debugLine="ListView1.SingleLineLayout.Label.Typeface = Typef";
_listview1.getSingleLineLayout().Label.setTypeface(__c.Typeface.DEFAULT_BOLD);
 //BA.debugLineNum = 87;BA.debugLine="ListView1.SingleLineLayout.Label.Gravity = Bit.Or";
_listview1.getSingleLineLayout().Label.setGravity(__c.Bit.Or(__c.Gravity.CENTER_VERTICAL,__c.Gravity.CENTER_HORIZONTAL));
 //BA.debugLineNum = 88;BA.debugLine="ListView1.SingleLineLayout.ItemHeight = 50dip";
_listview1.getSingleLineLayout().setItemHeight(__c.DipToCurrent((int) (50)));
 //BA.debugLineNum = 91;BA.debugLine="ListView1.TwoLinesLayout.Label.TextSize = 16";
_listview1.getTwoLinesLayout().Label.setTextSize((float) (16));
 //BA.debugLineNum = 92;BA.debugLine="ListView1.TwoLinesLayout.Label.TextColor = xui.Co";
_listview1.getTwoLinesLayout().Label.setTextColor(_xui.Color_RGB((int) (33),(int) (33),(int) (33)));
 //BA.debugLineNum = 93;BA.debugLine="ListView1.TwoLinesLayout.Label.Typeface = Typefac";
_listview1.getTwoLinesLayout().Label.setTypeface(__c.Typeface.DEFAULT_BOLD);
 //BA.debugLineNum = 94;BA.debugLine="ListView1.TwoLinesLayout.Label.Gravity = Gravity.";
_listview1.getTwoLinesLayout().Label.setGravity(__c.Gravity.CENTER_VERTICAL);
 //BA.debugLineNum = 96;BA.debugLine="ListView1.TwoLinesLayout.SecondLabel.TextSize = 1";
_listview1.getTwoLinesLayout().SecondLabel.setTextSize((float) (15));
 //BA.debugLineNum = 98;BA.debugLine="ListView1.TwoLinesLayout.SecondLabel.TextColor =";
_listview1.getTwoLinesLayout().SecondLabel.setTextColor(_xui.Color_RGB((int) (56),(int) (142),(int) (60)));
 //BA.debugLineNum = 99;BA.debugLine="ListView1.TwoLinesLayout.SecondLabel.Typeface = T";
_listview1.getTwoLinesLayout().SecondLabel.setTypeface(__c.Typeface.DEFAULT_BOLD);
 //BA.debugLineNum = 100;BA.debugLine="ListView1.TwoLinesLayout.ItemHeight = 70dip ' Esp";
_listview1.getTwoLinesLayout().setItemHeight(__c.DipToCurrent((int) (70)));
 //BA.debugLineNum = 103;BA.debugLine="Dim queryVentas As String = $\" 		SELECT HVD_NUM_T";
_queryventas = ("\n"+"		SELECT HVD_NUM_TICKET, HVD_PRONOMBRE, HVD_CANT, HVD_COSTO_TOT, HVD_FECHA \n"+"		FROM hist_ventastodos \n"+"		WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) \n"+"		ORDER BY \n"+"			SUBSTR(HVD_FECHA, 7, 4) ASC,\n"+"			SUBSTR(HVD_FECHA, 4, 2) ASC,\n"+"			SUBSTR(HVD_FECHA, 1, 2) ASC,\n"+"			HVD_NUM_TICKET ASC,\n"+"			HVD_CODPROMO,\n"+"			HVD_COSTO_TOT ASC\n"+"	");
 //BA.debugLineNum = 116;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(queryVentas)";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (ba)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(_queryventas)));
 //BA.debugLineNum = 118;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 119;BA.debugLine="Dim currentTicket As String = \"\"";
_currentticket = "";
 //BA.debugLineNum = 121;BA.debugLine="For i = 0 To c.RowCount - 1";
{
final int step32 = 1;
final int limit32 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit32 ;_i = _i + step32 ) {
 //BA.debugLineNum = 122;BA.debugLine="c.Position = i";
_c.setPosition(_i);
 //BA.debugLineNum = 124;BA.debugLine="Dim ticket As String = c.GetString(\"HVD_NUM_TIC";
_ticket = _c.GetString("HVD_NUM_TICKET");
 //BA.debugLineNum = 125;BA.debugLine="Dim fecha As String = c.GetString(\"HVD_FECHA\")";
_fecha = _c.GetString("HVD_FECHA");
 //BA.debugLineNum = 126;BA.debugLine="Dim producto As String = c.GetString(\"HVD_PRONO";
_producto = _c.GetString("HVD_PRONOMBRE");
 //BA.debugLineNum = 127;BA.debugLine="Dim cant As String = c.GetString(\"HVD_CANT\")";
_cant = _c.GetString("HVD_CANT");
 //BA.debugLineNum = 128;BA.debugLine="Dim costo As String = c.GetString(\"HVD_COSTO_TO";
_costo = _c.GetString("HVD_COSTO_TOT");
 //BA.debugLineNum = 132;BA.debugLine="If ticket <> currentTicket Then";
if ((_ticket).equals(_currentticket) == false) { 
 //BA.debugLineNum = 135;BA.debugLine="ListView1.AddSingleLine($\"🎫 TICKET: ${ticket}";
_listview1.AddSingleLine(BA.ObjectToCharSequence(("🎫 TICKET: "+__c.SmartStringFormatter("",(Object)(_ticket))+" | 📅 "+__c.SmartStringFormatter("",(Object)(_fecha))+"")));
 //BA.debugLineNum = 136;BA.debugLine="currentTicket = ticket";
_currentticket = _ticket;
 };
 //BA.debugLineNum = 140;BA.debugLine="Dim detalle As String = $\"📦 Cantidad: ${cant}";
_detalle = ("📦 Cantidad: "+__c.SmartStringFormatter("",(Object)(_cant))+"   |   💵 Total: $"+__c.SmartStringFormatter("",(Object)(_costo))+"");
 //BA.debugLineNum = 141;BA.debugLine="ListView1.AddTwoLines(producto, detalle)";
_listview1.AddTwoLines(BA.ObjectToCharSequence(_producto),BA.ObjectToCharSequence(_detalle));
 }
};
 };
 //BA.debugLineNum = 144;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 148;BA.debugLine="If Existe <> \"0\" Then";
if ((_existe).equals("0") == false) { 
 //BA.debugLineNum = 149;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"select SUM";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_b4xpages._mainpage /*gunav2.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_ventastodos where HVD_CLIENTE in (Select CUENTA from cuentaa)")));
 //BA.debugLineNum = 150;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 151;BA.debugLine="L_CANT.Text = c.GetString(\"PC_NOART\")";
_l_cant.setText(BA.ObjectToCharSequence(_c.GetString("PC_NOART")));
 //BA.debugLineNum = 152;BA.debugLine="L_TOTAL.Text = c.GetString(\"PC_MONTO\")";
_l_total.setText(BA.ObjectToCharSequence(_c.GetString("PC_MONTO")));
 //BA.debugLineNum = 153;BA.debugLine="c.Close";
_c.Close();
 };
 //BA.debugLineNum = 160;BA.debugLine="End Sub";
return "";
}
public String  _b4xpage_created(anywheresoftware.b4a.objects.B4XViewWrapper _root1) throws Exception{
 //BA.debugLineNum = 44;BA.debugLine="Private Sub B4XPage_Created (Root1 As B4XView)";
 //BA.debugLineNum = 45;BA.debugLine="Root = Root1";
_root = _root1;
 //BA.debugLineNum = 47;BA.debugLine="Root.LoadLayout(\"nota3\")";
_root.LoadLayout("nota3",ba);
 //BA.debugLineNum = 48;BA.debugLine="borra.Visible = False";
_borra.setVisible(__c.False);
 //BA.debugLineNum = 49;BA.debugLine="Titulo.Text = \"Acumulado\"";
_titulo.setText(BA.ObjectToCharSequence("Acumulado"));
 //BA.debugLineNum = 50;BA.debugLine="b_desc.Visible = False";
_b_desc.setVisible(__c.False);
 //BA.debugLineNum = 51;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="Private p_nota As Panel";
_p_nota = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 28;BA.debugLine="Private Panel1 As Panel";
_panel1 = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 29;BA.debugLine="Private l_productohist As Label";
_l_productohist = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 30;BA.debugLine="Private l_s1 As Label";
_l_s1 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 31;BA.debugLine="Private l_s2 As Label";
_l_s2 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 32;BA.debugLine="Private l_s3 As Label";
_l_s3 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 33;BA.debugLine="Private l_s4 As Label";
_l_s4 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 34;BA.debugLine="Private CustomListView1 As CustomListView";
_customlistview1 = new b4a.example3.customlistview();
 //BA.debugLineNum = 35;BA.debugLine="Private L_PROMEDIOHIST As Label";
_l_promediohist = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 36;BA.debugLine="End Sub";
return "";
}
public Object  _initialize(anywheresoftware.b4a.BA _ba) throws Exception{
innerInitialize(_ba);
 //BA.debugLineNum = 39;BA.debugLine="Public Sub Initialize As Object";
 //BA.debugLineNum = 40;BA.debugLine="Return Me";
if (true) return this;
 //BA.debugLineNum = 41;BA.debugLine="End Sub";
return null;
}
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;
}
}
