コード例 #1
0
 public IList <ReporteSalidaConCostosInfo> obtenerReporte(ReporteSalidasConCostoParametrosInfo parametros)
 {
     try
     {
         Logger.Info();
         Dictionary <string, object> parameters = AuxReporteSalidaConCostosDAL.obtenerReporte(parametros);
         DataSet ds = Retrieve("ReporteSalidasConCosto", parameters);
         IList <ReporteSalidaConCostosInfo> result = null;
         if (ValidateDataSet(ds))
         {
             result = MapReporteSalidaConCostosDAL.obtenerReporte(ds);
         }
         return(result);
     }
     catch (SqlException ex)
     {
         Logger.Error(ex);
         throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
     }
     catch (DataException ex)
     {
         Logger.Error(ex);
         throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
     }
 }
コード例 #2
0
 /// <summary>
 /// Obtiene parametros para obtener el reporte de muertes de ganado.
 /// </summary>
 /// <param name="filtro"></param>
 /// <returns></returns>
 public static Dictionary <string, object> obtenerReporte(ReporteSalidasConCostoParametrosInfo DatosConsulta)
 {
     try
     {
         Logger.Info();
         var parametros =
             new Dictionary <string, object>
         {
             { "@OrganizacionID", DatosConsulta.OrganizacionID },
             { "@FechaInicial", DatosConsulta.FechaInicial },
             { "@FechaFinal", DatosConsulta.FechaFinal },
             { "@TipoSalida", DatosConsulta.TipoSalida },
             { "@TipoProceso", DatosConsulta.TipoProceso },
             { "@EsDetallado", DatosConsulta.EsDetallado },
         };
         return(parametros);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
     }
 }
コード例 #3
0
        private void generarReporte()
        {
            DateTime dtFechaInicial               = new DateTime(DtpFechaInicial.SelectedDate.Value.Year, DtpFechaInicial.SelectedDate.Value.Month, DtpFechaInicial.SelectedDate.Value.Day);
            DateTime dtFechaFinal                 = new DateTime(DtpFechaFin.SelectedDate.Value.Year, DtpFechaFin.SelectedDate.Value.Month, DtpFechaFin.SelectedDate.Value.Day);
            int      iOrganizacionID              = int.Parse(skAyudaOrganizacion.Clave);
            int      iTipoSalida                  = int.Parse(cmbTipoSalida.SelectedValue.ToString());
            int      iTipoProceso                 = int.Parse(cmbTipoProceso.SelectedValue.ToString());
            String   sVistaCostos                 = cmbVerCostos.Text;
            ReporteSalidaConCostosBL salidaBL     = new ReporteSalidaConCostosBL();
            Boolean            bSalidaVentaMuerte = false;
            Boolean            bDetallado         = false;
            SalidaConCostoInfo salidas            = new SalidaConCostoInfo();

            if (sVistaCostos.ToUpper().Trim() == "DETALLADOS")
            {
                bDetallado = true;
            }
            ReporteSalidasConCostoParametrosInfo parametros = new ReporteSalidasConCostoParametrosInfo
            {
                OrganizacionID = iOrganizacionID,
                FechaInicial   = dtFechaInicial,
                FechaFinal     = dtFechaFinal,
                TipoSalida     = iTipoSalida,
                TipoProceso    = iTipoProceso,
                EsDetallado    = bDetallado
            };
            IList <ReporteSalidaConCostosInfo> resultadoInfo = salidaBL.obtenerReporte(parametros);

            if (resultadoInfo != null)
            {
                if (TipoMovimiento.Muerte.GetHashCode().ToString() == iTipoSalida.ToString() || TipoMovimiento.Muerte.GetHashCode().ToString() == iTipoSalida.ToString())
                {
                    bSalidaVentaMuerte = true;
                }



                foreach (ReporteSalidaConCostosInfo salida in resultadoInfo)
                {
                    salida.esSalidaVentaOMuerte = bSalidaVentaMuerte;
                    salida.esDetallado          = bDetallado;
                    salida.Leyenda     = organizacionLocal.Descripcion;
                    salida.RangoFechas = "De " + dtFechaInicial.Day.ToString().PadLeft(2, '0') + "-" + dtFechaInicial.Month.ToString().PadLeft(2, '0') + dtFechaInicial.Year.ToString() +
                                         " hasta" + dtFechaFinal.Day.ToString().PadLeft(2, '0') + "-" + dtFechaFinal.Month.ToString().PadLeft(2, '0') + dtFechaFinal.Year.ToString();
                    salida.NombreReporte = Properties.Resources.ReporteSalidaConCosto_NombreReporte;
                }

                var encabezado = new ReporteEncabezadoInfo
                {
                    Titulo       = Properties.Resources.ReporteSalidaConCosto_Titulo,
                    FechaInicio  = dtFechaInicial,
                    FechaFin     = dtFechaFinal,
                    Organizacion = Properties.Resources.ReporteSalidaConCosto_Titulo + " (" + organizacionLocal.Division + ")"
                };

                var    documento      = new ReportDocument();
                String directorioBase = String.Empty;
                if (AppDomain.CurrentDomain.BaseDirectory.Substring(AppDomain.CurrentDomain.BaseDirectory.Length - 1, 1) == "\\")
                {
                    directorioBase = AppDomain.CurrentDomain.BaseDirectory.Substring(0, AppDomain.CurrentDomain.BaseDirectory.Length - 1);
                }
                else
                {
                    directorioBase = AppDomain.CurrentDomain.BaseDirectory.ToString();
                }
                var reporte = String.Format("{0}{1}", directorioBase, "\\Reporte\\RptReporteSalidaConCostosDetallado.rpt");
                documento.Load(reporte);

                documento.DataSourceConnections.Clear();
                documento.SetDataSource(resultadoInfo);
                documento.Refresh();

                var forma = new ReportViewer(documento, encabezado.Titulo);
                forma.MostrarReporte();
                forma.Show();
                for (int i = 0; i < resultadoInfo.Count; i++)
                {
                    GC.SuppressFinalize(resultadoInfo[i]);
                }
                GC.SuppressFinalize(resultadoInfo);
            }
            else
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.ReporteSalidaConCosto_Msg_SinInformacion,
                                  MessageBoxButton.OK, MessageImage.Warning);
            }
        }
コード例 #4
0
        public IList <SIE.Services.Info.Info.ReporteSalidaConCostosInfo> obtenerReporte(ReporteSalidasConCostoParametrosInfo DatosConsulta)
        {
            try
            {
                Logger.Info();

                return(ReporteSalidaConCostosDL.obtenerReporte(DatosConsulta));
            }
            catch (ExcepcionGenerica)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
        }