protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Session["Respuesta"] = false; //[TODO: Hacer mensaje de confirmación que se muestra una sola vez, al querer eliminar algo en control ABM]
                this.tipo = typeof(Entidades.Entity_concepto);
                this.Titulo = "Conceptos de facturacion";

                                

                // Datagrid
                Storer st = new Storer(typeof(Entidades.Entity_concepto));
                st.ObjectToSqlDataSource(ref SqlDataSource1);
                OnShow();
                Store1.DataBind();
              

                //ComboBox
                 
                tipoCombo = typeof(Entidades.Entity_tasaiva);
                ComboBoxObjetos.Width = ComboBoxObjetos.Width;
                ValoresCombo = new SqlValor[] 
            { 
                new SqlValor("empresa_idempresa", ModuloSoporte.Global.CodEmpresa)
            };
                OnShowComboBox();

            
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Session["Respuesta"] = false; //[TODO: Hacer mensaje de confirmación que se muestra una sola vez, al querer eliminar algo en control ABM]
                this.tipo = typeof(Entidades.Entity_causasEmision);
                this.Titulo = "Causas de emision";

                Valores = new SqlValor[] 
            { 
                new SqlValor("empresa_idempresa", Global.CodEmpresa)
            };

                // Datagrid
                Storer st = new Storer(typeof(Entidades.Entity_causasEmision));
                st.ObjectToSqlDataSource(ref SqlDataSource1);
                OnShow();
                



            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[var] == null || Session[var].ToString().Equals(""))
            {
                if (!X.IsAjaxRequest)
                {
                    PrepararClienteCompensacion.PrepararCliente(var, "CompensacionComprobante.aspx", this);
                    Response.Redirect("PrepararClienteCompensacion.aspx");
                }
            }
            var codCliente = (int)Session[var];
           


            this.Tipo = typeof(Entity_comprobanteVenta);
            Valores = new SqlValor[] 
            { 
                new SqlValor("habilitado", 1),
                new SqlValor("empresa_idempresa", ContabilidadGlobal.Admin.CodEmpresa),
                new SqlValor("cliente_codCliente",codCliente)
            };


            // Datagrid
            Storer st = new Storer(typeof(Entidades.Entity_comprobanteVenta));
            st.ObjectToSqlDataSource(ref SqlDataSource1);
            OnShow();
            Store1.DataBind();


           
        }
        protected void Page_Load(object sender, EventArgs e)
        {

            try
            {
                Session["Respuesta"] = false; //[TODO: Hacer mensaje de confirmación que se muestra una sola vez, al querer eliminar algo en control ABM]
                this.tipo = typeof(Entidades.Entity_comprobanteVenta);
                this.Titulo = "Lista de Comprobantes Habilitados";

                Valores = new SqlValor[] 
            { 
                new SqlValor("habilitado", 1),
                new SqlValor("empresa_idempresa", 1)
            };


                // Datagrid
                Storer st = new Storer(typeof(Entidades.Entity_comprobanteVenta));
                st.ObjectToSqlDataSource(ref SqlDataSource1);
                OnShow();
                Store1.DataBind();



            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Session["Respuesta"] = false; //[TODO: Hacer mensaje de confirmación que se muestra una sola vez, al querer eliminar algo en control ABM]
                this.tipo = typeof(Entidades.Entity_talonario);
                this.Titulo = "Talonario";

            

                // Datagrid
                Storer st = new Storer(typeof(Entidades.Entity_talonario));
                st.ObjectToSqlDataSource(ref SqlDataSource1);                
            
            
              
                this.valoresCombo = new SqlValor[] { new SqlValor("tiposcomprobante_empresa_idempresa", Global.CodEmpresa) };
                OnShow();
                Store1.DataBind();
                /* Storer combo = new Storer(typeof(Entidades.Entity_tipocomprobante));   
               
                combo.ObjectToSqlDataSource(ref SqlDataSource2);                              
                Store2.DataBind();
                OnShowCombo();*/
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Session["Respuesta"] = false; //[TODO: Hacer mensaje de confirmación que se muestra una sola vez, al querer eliminar algo en control ABM]
                this.tipo = typeof(Entidades.Entity_talonario);
                this.Titulo = "Talonario";

                // Datagrid
                Storer st = new Storer(typeof(Entidades.Entity_talonario));
                st.ObjectToSqlDataSource(ref SqlDataSource1);                
                                
                OnShow();
                Store1.DataBind();

                //Combo Causa de emision
                Storer stcombo = new Storer(typeof(Entidades.Entity_tipocomprobante));
                OnshowTipo(stcombo);
                
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {

            Session["Respuesta"] = false; //[TODO: Hacer mensaje de confirmación que se muestra una sola vez, al querer eliminar algo en control ABM]
            this.tipo = typeof(Entidades.Entity_concepto);
            this.Titulo = "Conceptos de facturacion";
            
            // Datagrid
            Storer st = new Storer(typeof(Entidades.Entity_concepto));
            st.ObjectToSqlDataSource(ref SqlDataSource1);
            OnShow();
            Store1.DataBind();
            
            #warning terminar tema de los combobox
            
            //ComboTasaIva
            Storer sttasaiva = new Storer(typeof(Entity_tasaiva));
            OnshowTasaIva(sttasaiva);
            
            //ComboMonedas
            Storer stMonedas = new Storer(typeof(Entity_moneda));
            OnshowMoneda(stMonedas);
        }
        public void OnShow()
        {
            try
            {
                if (StringConnection.Equals(""))
                    StringConnection = CapaDatos.Datos.ConnectionString;

                Storer st = new WebHelper.Storer(Tipo);
                st.Valores = ValoresCombo;
                st.ValoresCombo = ValoresCombo;

                if (Insert.Equals(""))
                    Insert = st.GetInsert();
                if (Select.Equals(""))
                    Select = st.GetSelect();
                if (Update.Equals(""))
                    Update = st.GetUpdate();
                if (Delete.Equals(""))
                    Delete = st.GetDelete();

                this.SqlDataSource1.ProviderName = "MySql.Data.MySqlClient";
                this.SqlDataSource1.ConnectionString = StringConnection;
                this.SqlDataSource1.InsertCommand = Insert;
                this.SqlDataSource1.SelectCommand = Select;
                this.SqlDataSource1.UpdateCommand = Update;
                this.SqlDataSource1.DeleteCommand = Delete;

                st.ObjectToSqlDataSource(ref SqlDataSource1);
                st.ObjectToStore(ref Store1);
                // st.ObjectToGridPanel(ref GridPanel1);

                // Permisos de la tabla
                if (Permisos == null)
                    Permisos = ContabilidadGlobal.Admin.Permisos;

                if (!Permisos.Alta)
                {
                    this.btnInsert.Enabled = false;
                    this.btnInsert.Hide();
                    if (!Permisos.Modif)
                    {
                        this.btnSave.Enabled = false;
                        this.btnSave.Hide();
                    }
                }
                if (!Permisos.Baja)
                {
                    this.btnDelete.Enabled = false;
                    this.btnDelete.Hide();
                }

                cargarFiltros(st);
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }
        public void OnShowComboBox()
        {
            try
            {
                if (StringConnection.Equals(""))
                    StringConnection = CapaDatos.Datos.ConnectionString;

                Storer stc = new WebHelper.Storer(tipoCombo);
                stc.Valores = ValoresCombo;

                if (Select.Equals(""))
                    Select = stc.GetSelect();

                this.SqlDataSource1.ProviderName = "MySql.Data.MySqlClient";
                this.SqlDataSource1.ConnectionString = StringConnection;
                this.SqlDataSource1.SelectCommand = Select;

                stc.ObjectToSqlDataSource(ref SqlDataSource1);
                stc.ObjectToStore(ref Store3);
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error en " + this.ID);
            }
        }
        public void OnShow()
        {
            try
            {
                if (StringConnection.Equals(""))
                    StringConnection = CapaDatos.Datos.ConnectionString;

                Storer st = new WebHelper.Storer(Tipo);       

                if (Insert.Equals(""))
                    Insert = st.GetInsert();
                if (Select.Equals(""))
                    Select = st.GetSelect();
                if (Update.Equals(""))
                    Update = st.GetUpdate();
                if (Delete.Equals(""))
                    Delete = st.GetDelete();

                this.SqlDataSource1.ProviderName = "MySql.Data.MySqlClient";
                this.SqlDataSource1.ConnectionString = StringConnection;
                this.SqlDataSource1.InsertCommand = Insert;
                this.SqlDataSource1.SelectCommand = Select;
                this.SqlDataSource1.UpdateCommand = Update;
                this.SqlDataSource1.DeleteCommand = Delete;

                st.ObjectToSqlDataSource(ref SqlDataSource1);
                st.ObjectToStore(ref Store1);
                      
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }
        public void OnShowCredito()
        {
            try
            {
                if (StringConnection.Equals(""))
                    StringConnection = CapaDatos.Datos.ConnectionString;

                Storer st = new WebHelper.Storer(typeof(Entidades.Entity_ComprobanteCompra));
                st.Valores = Valores;
                st.ValoresCombo = ValoresCombo;

                //  if (Select.Equals(""))
                Select = st.GetSelect();

                this.SqlDataSource1.ProviderName = "MySql.Data.MySqlClient";
                this.SqlDataSource1.ConnectionString = StringConnection;
                this.SqlDataSource1.SelectCommand = Select;

                st.ObjectToSqlDataSource(ref SqlDataSource1);
                st.ObjectToStore(ref Store1);
          //      st.ObjectToGridPanel(ref GridPanelCredito);
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }
        public void OnShow()
        {
            try
            {
                //Harcoded here
                if (StringConnection.Equals(""))
                    StringConnection = CapaDatos.Datos.ConnectionString;
                //End hard

                Storer st = new WebHelper.Storer(Tipo);
                st.Valores = Valores;
                st.ValoresCombo = ValoresCombo;

                if (Insert.Equals(""))
                    Insert = st.GetInsert();
                if (Select.Equals(""))
                    Select = st.GetSelect();
                if (Update.Equals(""))
                    Update = st.GetUpdate();
                if (Delete.Equals(""))
                    Delete = st.GetDelete();

                this.SqlDataSource1.ProviderName = "MySql.Data.MySqlClient";
                this.SqlDataSource1.ConnectionString = StringConnection;
                this.SqlDataSource1.InsertCommand = Insert;
                this.SqlDataSource1.SelectCommand = Select;
                this.SqlDataSource1.UpdateCommand = Update;
                this.SqlDataSource1.DeleteCommand = Delete;

                st.ObjectToSqlDataSource(ref SqlDataSource1);
                st.ObjectToStore(ref Store1);
                st.ObjectToGridPanel(ref GridPanel1);

                //Aplicar cuestiones de seguridad
                if (Permisos == null)
                {
                    Permisos = Permisos.PermisosAdmin;
                }

                if (!Permisos.Alta)
                {
                    this.btnInsert.Enabled = false;
                    if (!Permisos.Modif)
                    {
                        this.btnSave.Enabled = false;
                    }
                }
                if (!Permisos.Baja)
                {
                    this.btnDelete.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }
        public void OnShowRegimenesEspeciales()
        {
            try
            {
                if (StringConnection.Equals(""))
                    StringConnection = CapaDatos.Datos.ConnectionString;

                Storer st = new WebHelper.Storer(typeof(Entity_regimenesEspeciales));
                st.Valores = Valores;
                //st.ValoresCombo = ValoresCombo;

              //  if (Select.Equals(""))
                    Select = st.GetSelect();

                this.SqlDataSource1.ProviderName = "MySql.Data.MySqlClient";
                this.SqlDataSource1.ConnectionString = StringConnection;
                this.SqlDataSource1.SelectCommand = Select;


                st.ObjectToSqlDataSource(ref SqlDataSource1);
                st.ObjectToStore(ref Store3);
                st.ObjectToGridPanel(ref GridPanelRegimenesEspeciales);
                cargarFiltros(st);
            }
            catch (Exception ex)
            {
                UIHelper.MostrarExcepcionSimple(ex, "Error");
            }
        }