コード例 #1
0
        private void btnImpresion_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvTransferencia.SelectedRows.Count == 1)
                {
                    this.Visible = false;
                    TransferenciaMaterialesGeneral       Datos      = this.ObtenerDatosReporte();
                    frmVerReporteTransferenciaMateriales VerReporte = new frmVerReporteTransferenciaMateriales(Datos.IDTransferencia);
                    VerReporte.ShowDialog();
                    VerReporte.Dispose();

                    this.Visible = true;
                }
                else
                {
                    MessageBox.Show("Seleccione una fila.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                LogError.AddExcFileTxt(ex, "frmTransferenciaMateriales ~ btnImpresion_Click");
                MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
 public TransferenciaMaterialesGeneral ObtenerTransferenciaMaterialesGeneral(string Conexion, int IDReporte)
 {
     try
     {
         TransferenciaMaterialesGeneral Resultado = new TransferenciaMaterialesGeneral();
         DataSet Ds = SqlHelper.ExecuteDataset(Conexion, "Produccion.spCSLDB_get_TransferenciaMaterialesGeneralXID", IDReporte);
         if (Ds != null)
         {
             if (Ds.Tables.Count == 1)
             {
                 DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                 while (Dr.Read())
                 {
                     Resultado.EmpleadoO = !Dr.IsDBNull(Dr.GetOrdinal("NombreOrigen")) ? Dr.GetString(Dr.GetOrdinal("NombreOrigen")) : string.Empty;
                     Resultado.EmpleadoD = !Dr.IsDBNull(Dr.GetOrdinal("NombreDestino")) ? Dr.GetString(Dr.GetOrdinal("NombreDestino")) : string.Empty;
                 }
                 Dr.Close();
             }
         }
         return(Resultado);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
        public TransferenciaMaterialesGeneral ObtenerDetalleReporteTransferenciaMateriales(string Conexion, int IDReporte)
        {
            try
            {
                TransferenciaMaterialesGeneral Resultado = new TransferenciaMaterialesGeneral();
                DataSet Ds = SqlHelper.ExecuteDataset(Conexion, "Produccion.spCSLDB_get_TransferenciaMaterialesXID", IDReporte);
                if (Ds != null)
                {
                    if (Ds.Tables.Count == 1)
                    {
                        List <TransferenciaMaterialesDetalle> Lista = new List <TransferenciaMaterialesDetalle>();
                        TransferenciaMaterialesDetalle        Item;
                        DataTableReader Dr2 = Ds.Tables[0].CreateDataReader();
                        while (Dr2.Read())
                        {
                            Item                   = new TransferenciaMaterialesDetalle();
                            Item.FechaInicio       = !Dr2.IsDBNull(Dr2.GetOrdinal("FechaInicio")) ? Dr2.GetDateTime(Dr2.GetOrdinal("FechaInicio")) : DateTime.MinValue;
                            Item.Producto          = !Dr2.IsDBNull(Dr2.GetOrdinal("Producto")) ? Dr2.GetString(Dr2.GetOrdinal("Producto")) : string.Empty;
                            Item.Clave             = !Dr2.IsDBNull(Dr2.GetOrdinal("Clave")) ? Dr2.GetString(Dr2.GetOrdinal("Clave")) : string.Empty;
                            Item.CantidadMetrica   = !Dr2.IsDBNull(Dr2.GetOrdinal("CantidadMetrica")) ? Dr2.GetInt32(Dr2.GetOrdinal("CantidadMetrica")) : 0;
                            Item.TipoMetrica       = !Dr2.IsDBNull(Dr2.GetOrdinal("TipoMetrica")) ? Dr2.GetString(Dr2.GetOrdinal("TipoMetrica")) : string.Empty;
                            Item.CantidadUsos      = !Dr2.IsDBNull(Dr2.GetOrdinal("CantidadUsos")) ? Dr2.GetInt32(Dr2.GetOrdinal("CantidadUsos")) : 0;
                            Item.Consumo           = !Dr2.IsDBNull(Dr2.GetOrdinal("Consumo")) ? Dr2.GetInt32(Dr2.GetOrdinal("Consumo")) : 0;
                            Item.DiasTranscurridos = !Dr2.IsDBNull(Dr2.GetOrdinal("DiasTranscurridos")) ? Dr2.GetInt32(Dr2.GetOrdinal("DiasTranscurridos")) : 0;

                            Lista.Add(Item);
                        }
                        Dr2.Close();
                        Resultado.Detalle = Lista;
                    }
                }

                TransferenciaMaterialesGeneral var = ObtenerTransferenciaMaterialesGeneral(Conexion, IDReporte);
                Resultado.EmpleadoO = var.EmpleadoO;
                Resultado.EmpleadoD = var.EmpleadoD;
                return(Resultado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        /// <summary>
        /// Obtiene los datos del reporte
        /// </summary>
        /// <returns></returns>
        private TransferenciaMaterialesGeneral ObtenerDatosReporte()
        {
            try
            {
                TransferenciaMaterialesGeneral DatosAux = new TransferenciaMaterialesGeneral();
                Int32 RowData = this.dgvTransferencia.Rows.GetFirstRow(DataGridViewElementStates.Selected);
                if (RowData > -1)
                {
                    int             ID        = 0;
                    DataGridViewRow FilaDatos = this.dgvTransferencia.Rows[RowData];
                    int.TryParse(FilaDatos.Cells["IDTransferencia"].Value.ToString(), out ID);

                    DatosAux.IDTransferencia = ID;
                }
                return(DatosAux);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        private void GenerarReporteTransferenciaMateriales()
        {
            try
            {
                reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
                reportViewer1.ZoomMode    = ZoomMode.Percent;
                reportViewer1.ZoomPercent = 100;
                reportViewer1.LocalReport.DataSources.Clear();
                TransferenciaMateriales_Negocio Neg          = new TransferenciaMateriales_Negocio();
                TransferenciaMaterialesGeneral  DatosReporte = Neg.ObtenerDetalleReporteTransferenciaMateriales(Comun.Conexion, IDReporte);
                reportViewer1.LocalReport.EnableExternalImages = true;
                ReportParameter[] Parametros = new ReportParameter[7];
                Parametros[0] = new ReportParameter("Empresa", Comun.NombreComercial);
                Parametros[1] = new ReportParameter("Eslogan", Comun.Eslogan);
                Parametros[2] = new ReportParameter("Direccion", Comun.Direccion);
                Parametros[3] = new ReportParameter("TituloReporte", "REPORTE TRANSFERENCIA DE MATERIALES");
                if (File.Exists(@"Resources\Documents\" + Comun.UrlLogo.ToLower()))
                {
                    string Aux = new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\" + Comun.UrlLogo.ToLower())).AbsoluteUri;
                    Parametros[4] = new ReportParameter("UrlLogo", new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\" + Comun.UrlLogo.ToLower())).AbsoluteUri);
                }
                else
                {
                    Parametros[4] = new ReportParameter("UrlLogo", new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\Default.jpg")).AbsoluteUri);
                }

                Parametros[5] = new ReportParameter("EmpleadoO", DatosReporte.EmpleadoO);
                Parametros[6] = new ReportParameter("EmpleadoD", DatosReporte.EmpleadoD);
                this.reportViewer1.LocalReport.ReportEmbeddedResource = "StephManager.Informes.Reportes.TransferenciaMateriales.rdlc";
                reportViewer1.LocalReport.SetParameters(Parametros);
                reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("TransferenciaMateriales", DatosReporte.Detalle));
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }