Esempio n. 1
0
        public void ConsultaDatosReporte(Sesion sesion, InvExcesoInventario inventario, ref List <InvExcesoInventario> List)
        {
            try
            {
                SqlDataReader      dr        = null;
                CapaDatos.CD_Datos CapaDatos = new CapaDatos.CD_Datos(sesion.Emp_Cnx);

                string[] Parametros = { "@Id_Emp", "@Id_Cd" };
                object[] Valores    = { sesion.Id_Emp, sesion.Id_Cd };

                SqlCommand sqlcmd = CapaDatos.GenerarSqlCommand("spReporteExcesoInventario", ref dr, Parametros, Valores);

                InvExcesoInventario excesoinventario;
                while (dr.Read())
                {
                    excesoinventario = new InvExcesoInventario();
                    List.Add(excesoinventario);
                }

                CapaDatos.LimpiarSqlcommand(ref sqlcmd);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        private void Mostrar(bool a_pantalla)
        {
            Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID];
            InvExcesoInventario inventario = new InvExcesoInventario();
            int error = 0;

            inventario.Id_Cd = sesion.Id_Cd_Ver;// Convert.ToInt32(CmbCentro.SelectedValue);
            if (!string.IsNullOrEmpty(txtProducto.Text))
            {
                boton(txtProducto.Text, ref error);
                inventario.Producto  = txtProducto.Text;
                inventario.Productos = txtProducto.Text;
            }
            else
            {
                inventario.Productos = "Todos";
            }

            inventario.Tipo           = Convert.ToInt32(cmbTipo.SelectedValue);
            inventario.Tipos          = cmbTipo.SelectedItem.Text;
            inventario.Tipo_prov      = Convert.ToInt32(cmbTipoProveedor.SelectedValue);
            inventario.Tipo_proveedor = cmbTipoProveedor.SelectedItem.Text;
            if (rbEstadistica.Checked == true)
            {
                inventario.Mostrar  = 1;
                inventario.Fecha    = DateTime.Now;
                inventario.Mostrars = rbEstadistica.Text;
            }
            if (rbFecha.Checked == true)
            {
                inventario.Mostrar = 2;
                if (txtFecha.SelectedDate.HasValue)
                {
                    inventario.Fecha    = Convert.ToDateTime(txtFecha.SelectedDate.Value);
                    inventario.Mostrars = inventario.Fecha.ToShortDateString();
                }
                else
                {
                    Alerta("Ingrese una fecha válida");
                    return;
                }
            }
            if (rbInventario.Checked == true)
            {
                inventario.Exceso             = 1;
                inventario.ExcesosInventarios = rbInventario.Text;
            }
            if (rbInventariorota.Checked == true)
            {
                inventario.Exceso             = 2;
                inventario.ExcesosInventarios = rbInventariorota.Text;
            }
            if (rbInventarionorota.Checked == true)
            {
                inventario.Exceso             = 3;
                inventario.ExcesosInventarios = rbInventarionorota.Text;
            }
            ArrayList ALValorParametrosInternos = new ArrayList();
            string    nombreEmpresa             = sesion.Emp_Nombre; //"Key Química S.A. de C.V";
            string    nombreSucursal            = sesion.Cd_Nombre;  // CmbCentro.SelectedItem.Text;//sesion.Cd_Nombre;
            DateTime  Fechalocal = DateTime.Now;

            //datos de filtros
            ALValorParametrosInternos.Add(inventario.ExcesosInventarios);
            ALValorParametrosInternos.Add(inventario.Productos);
            ALValorParametrosInternos.Add(inventario.Tipos);
            ALValorParametrosInternos.Add(inventario.Tipo_proveedor);
            ALValorParametrosInternos.Add(inventario.Mostrars);
            ALValorParametrosInternos.Add(inventario.Producto);
            ALValorParametrosInternos.Add(inventario.Tipo);
            ALValorParametrosInternos.Add(inventario.Tipo_prov);
            ALValorParametrosInternos.Add(inventario.Mostrar);
            ALValorParametrosInternos.Add(inventario.Fecha);
            ALValorParametrosInternos.Add(inventario.Exceso);
            //parametros para el cuerpo del reporte
            ALValorParametrosInternos.Add(sesion.Id_Emp);
            ALValorParametrosInternos.Add(inventario.Id_Cd);
            ALValorParametrosInternos.Add(sesion.U_Nombre);
            ALValorParametrosInternos.Add(Fechalocal);
            ALValorParametrosInternos.Add(nombreEmpresa);
            ALValorParametrosInternos.Add(nombreSucursal);
            //conexion
            ALValorParametrosInternos.Add(sesion.Emp_Cnx);

            Type instance = null;

            if (a_pantalla)
            {
                instance = typeof(LibreriaReportes.Rep_excesosInventarios2);
            }
            else
            {
                instance = typeof(LibreriaReportes.ExpRep_excesosInventarios2);
            }
            if (error == 0)
            {
                //NOTA: El estatus de impresión, lo pone cuando el reporte se carga
                if (_PermisoImprimir)
                {
                    if (a_pantalla)
                    {
                        Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = null;
                        Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = ALValorParametrosInternos;
                        Session["assembly" + Session.SessionID + HF_ClvPag.Value] = instance.AssemblyQualifiedName;
                        RAM1.ResponseScripts.Add("AbrirReporteCve('" + HF_ClvPag.Value + "');");
                    }
                    else
                    {
                        ImprimirXLS(ALValorParametrosInternos, instance);
                    }
                }
                else
                {
                    Alerta("No tiene permiso para imprimir");
                }
            }
        }