示例#1
0
        private void BtnGenerarReporte_Click(object sender, EventArgs e)
        {
            ReporteGeneral abrir = new ReporteGeneral();

            abrir.Show();
            this.Hide();
        }
        public List <ReporteGeneral> GetReporteGeneral(DateTime dateInicio, DateTime dateFin, int?idDocente)
        {
            List <ReporteGeneral> listaReporte = new List <ReporteGeneral>();

            using (DbCommand command = Database.GetStoredProcCommand("[dbo].[SP_GET_REPORTE_GENERAL]"))
            {
                Database.AddInParameter(command, "@FECHA_INICIO", DbType.Date, dateInicio.ToString("dd/MM/yyyy"));
                Database.AddInParameter(command, "@FECHA_FIN", DbType.Date, dateFin.ToString("dd/MM/yyyy"));
                Database.AddInParameter(command, "@ID_DOCENTE", DbType.Int32, idDocente);

                using (IDataReader reader = Database.ExecuteReader(command))
                {
                    while (reader.Read())
                    {
                        ReporteGeneral reporte = new ReporteGeneral();

                        reporte.Fecha       = DataUtil.DbValueToDefault <DateTime>(reader["FECHA"]).ToString("dd/MM/yyyy");
                        reporte.Laboratorio = DataUtil.DbValueToDefault <string>(reader["LABORATORIO"]);
                        reporte.Docente     = DataUtil.DbValueToDefault <string>(reader["APELLIDOSYNOMBRES"]);
                        reporte.Curso       = DataUtil.DbValueToDefault <string>(reader["CURSO"]);
                        reporte.Carrera     = DataUtil.DbValueToDefault <string>(reader["CARRERA"]);
                        reporte.HoraInicio  = DataUtil.DbValueToDefault <TimeSpan>(reader["HORA_INICIO"]).ToString(@"hh\:mm");
                        if (reader["HORA_INGRESO"].ToString() == "")
                        {
                            reporte.HoraIngreso = "";
                        }
                        else
                        {
                            reporte.HoraIngreso = DataUtil.DbValueToDefault <TimeSpan>(reader["HORA_INGRESO"]).ToString(@"hh\:mm");
                        }
                        reporte.HoraFin = DataUtil.DbValueToDefault <TimeSpan>(reader["HORA_FIN"]).ToString(@"hh\:mm");
                        if (reader["HORA_SALIDA"].ToString() == "")
                        {
                            reporte.HoraSalida = "";
                        }
                        else
                        {
                            reporte.HoraSalida = DataUtil.DbValueToDefault <TimeSpan>(reader["HORA_SALIDA"]).ToString(@"hh\:mm");
                        }
                        reporte.Estado            = DataUtil.DbValueToDefault <string>(reader["ESTADO"]);
                        reporte.Observacion       = DataUtil.DbValueToDefault <string>(reader["OBSERVACIONES"]);
                        reporte.Tipo              = DataUtil.DbValueToDefault <string>(reader["TIPO"]);
                        reporte.DiferenciaEntrada = DataUtil.DbValueToDefault <int>(reader["DIFERENCIA_ENTRADA"]);

                        listaReporte.Add(reporte);
                    }
                }
            }

            return(listaReporte);
        }
示例#3
0
        public LinkedList <ReporteGeneral> ReporteMantenimientos()
        {
            SqlConnection sqlConnection = conexion.conexionCMEC();
            //SqlCommand sqlCommandCount = new SqlCommand("select count(esta_aprovado) from Propuesta_Mantenimiento_Preventivo group by esta_aprovado;", conexion);
            SqlCommand sqlCommand = new SqlCommand("select fecha, descripcion, estado, es_correctivo, r.usuario as responsable, placa_activo, u.numero_aula as aula, f.usuario as funcionario from Mantenimiento m  inner join Responsable r on m.id_responsable = r.id inner join Ubicacion u on m.id_ubicacion = u.id_ubicacion inner join Funcionario f on m.id_funcionario = f.id;", sqlConnection);

            SqlDataReader reader;
            LinkedList <ReporteGeneral> reportesGenerales = new LinkedList <ReporteGeneral>();

            sqlConnection.Open();
            reader = sqlCommand.ExecuteReader();

            while (reader.Read())
            {
                ReporteGeneral reporteGeneral = new ReporteGeneral();
                reporteGeneral.fecha       = Convert.ToDateTime(reader["fecha"].ToString());
                reporteGeneral.descripcion = reader["descripcion"].ToString();

                int estado = Convert.ToInt32(reader["estado"].ToString());
                reporteGeneral.estado = estado == 0 ? "En proceso" : estado == 1 ? "Aprobado" : "Borrado";

                bool esCorrectivo = Convert.ToBoolean(reader["es_correctivo"].ToString());
                reporteGeneral.es_correctivo = esCorrectivo? "Correctivo" : "Preventivo";

                reporteGeneral.responsable = reader["responsable"].ToString();
                reporteGeneral.placa       = reader["placa_activo"].ToString();
                reporteGeneral.aula        = reader["aula"].ToString();
                reporteGeneral.funcionario = reader["funcionario"].ToString();

                reportesGenerales.AddLast(reporteGeneral);
            }

            sqlConnection.Close();

            return(reportesGenerales);
        }
示例#4
0
        public List <ReporteGeneral> getReporteGeneral()
        {
            DataSet  ds = new DataSet();
            Database db = EnterpriseLibraryContainer.Current.GetInstance <Database>("Inventario");
            //Database db = DatabaseFactory.CreateDatabase();
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.AppendLine("SELECT ");
            sqlCommand.AppendLine("	  A.idItem AS id ");
            sqlCommand.AppendLine("	, ISNULL(A.NoSerie, '') As NoSerie ");
            sqlCommand.AppendLine("	, A.idTipoEquipo  ");
            sqlCommand.AppendLine("	, TE.Descripcion As TipoEquipo ");
            sqlCommand.AppendLine("	, A.idMarca ");
            sqlCommand.AppendLine("	, M.Descripcion	AS Marca ");
            sqlCommand.AppendLine("	, ISNULL(A.Modelo, '') AS Modelo ");
            sqlCommand.AppendLine("	, ISNULL(A.Procesador, '') as Procesador ");
            sqlCommand.AppendLine("	, ISNULL(A.RAM, '') as RAM ");
            sqlCommand.AppendLine("	, ISNULL(A.DiscoDuro, '') as DiscoDuro ");
            sqlCommand.AppendLine("	, A.idSistema ");
            sqlCommand.AppendLine("	, S.Descripcion AS SistemaOperativo ");
            sqlCommand.AppendLine("	, A.idProveedor ");
            sqlCommand.AppendLine("	, P.Descripcion	as Proveedor ");
            sqlCommand.AppendLine("	, ISNULL(A.Factura, '') as Factura ");
            sqlCommand.AppendLine("	, ISNULL(A.FechaCompra, '') as FechaCompra ");
            sqlCommand.AppendLine("	, ISNULL(A.Requisicion, '') as Requisicion ");
            sqlCommand.AppendLine("	, ISNULL(A.CentroCostosAdquisicion, '') AS CentroCostosAdquisicion ");
            sqlCommand.AppendLine("	, ISNULL(A.Responsiva, '') AS Responsiva ");
            sqlCommand.AppendLine("	, ISNULL(A.ValorPesos, '') AS ValorPesos ");
            sqlCommand.AppendLine("	, ISNULL(A.ValorUSD, '') AS ValorUSD ");
            sqlCommand.AppendLine("	, ISNULL(A.Stock, '') as Stock ");
            sqlCommand.AppendLine("	, ISNULL(A.CodigoCastor, '') AS CodigoCastor ");
            sqlCommand.AppendLine("	, A.idUsuario  ");
            sqlCommand.AppendLine("	, U.Nombre			as UsuarioAsignado ");
            sqlCommand.AppendLine("	, A.idUbicacion  ");
            sqlCommand.AppendLine("	, Ub.Descripcion	AS Ubicacion ");
            sqlCommand.AppendLine("	, A.idEstado ");
            sqlCommand.AppendLine("	, E.Descripcion		AS EstadoConservacion ");
            sqlCommand.AppendLine("	, RTRIM(ISNULL(A.Observacion1, '')) AS Observacion1 ");
            sqlCommand.AppendLine("	, RTRIM(ISNULL(A.Observacion2, '')) AS Observacion2 ");
            sqlCommand.AppendLine("	, RTRIM(ISNULL(A.Observacion3, '')) AS Observacion3 ");
            sqlCommand.AppendLine("	, A.PosibleFaltanteFlag ");
            sqlCommand.AppendLine("	, ISNULL(A.CambioRYS, '') AS CambioRYS ");
            sqlCommand.AppendLine("	, ISNULL(A.FechaMovimiento, '1/1/1900') as FechaMovimiento");
            sqlCommand.AppendLine("FROM Articulo A ");
            sqlCommand.AppendLine("	INNER JOIN TipoEquipo TE WITH(NOLOCK) on A.idTipoEquipo = TE.idTipoEquipo ");
            sqlCommand.AppendLine("	INNER JOIN Marca M	WITH(NOLOCK) ON A.idMarca = M.idMarca ");
            sqlCommand.AppendLine("	INNER JOIN SistemaOperativo S WITH(NOLOCK) ON A.idSistema = S.idSistema ");
            sqlCommand.AppendLine("	INNER JOIN Proveedor P WITH(NOLOCK) ON A.idProveedor = P.idProveedor ");
            sqlCommand.AppendLine("	INNER JOIN Usuario U WITH(NOLOCK) ON A.idUsuario = U.idUsuario ");
            sqlCommand.AppendLine("	INNER JOIN Ubicacion Ub WITH(NOLOCK) ON A.idUbicacion = Ub.idUbicacion ");
            sqlCommand.AppendLine("	INNER JOIN Estado E WITH(NOLOCK) ON A.idEstado = E.idEstado ");
            sqlCommand.AppendLine("ORDER BY A.idItem ");

            DbCommand selectCommand = null;

            selectCommand = db.GetSqlStringCommand(sqlCommand.ToString());

            try
            {
                ds = db.ExecuteDataSet(selectCommand);

                List <ReporteGeneral> lstReporteGeneral = new List <ReporteGeneral>();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        ReporteGeneral oReporteGeneral = new ReporteGeneral();
                        oReporteGeneral.id                      = Convert.ToInt32(dr["id"]);
                        oReporteGeneral.noSerie                 = dr["NoSerie"].ToString();
                        oReporteGeneral.idTipoEquipo            = Convert.ToInt32(dr["idTipoEquipo"]);
                        oReporteGeneral.tipoEquipo              = dr["TipoEquipo"].ToString();
                        oReporteGeneral.idMarca                 = Convert.ToInt32(dr["idMarca"]);
                        oReporteGeneral.marca                   = dr["Marca"].ToString();
                        oReporteGeneral.modelo                  = dr["Modelo"].ToString();
                        oReporteGeneral.procesador              = dr["Procesador"].ToString();
                        oReporteGeneral.rAM                     = dr["RAM"].ToString();
                        oReporteGeneral.discoDuro               = dr["DiscoDuro"].ToString();
                        oReporteGeneral.idSistema               = Convert.ToInt32(dr["idSistema"]);
                        oReporteGeneral.sistemaOperativo        = dr["SistemaOperativo"].ToString();
                        oReporteGeneral.idProveedor             = Convert.ToInt32(dr["idProveedor"]);
                        oReporteGeneral.proveedor               = dr["Proveedor"].ToString();
                        oReporteGeneral.factura                 = dr["Factura"].ToString();
                        oReporteGeneral.fechaCompra             = dr["FechaCompra"].ToString();
                        oReporteGeneral.requisicion             = dr["Requisicion"].ToString();
                        oReporteGeneral.centroCostosAdquisicion = dr["CentroCostosAdquisicion"].ToString();
                        oReporteGeneral.responsiva              = dr["Responsiva"].ToString();
                        oReporteGeneral.valorPesos              = dr["ValorPesos"].ToString();
                        oReporteGeneral.valorUSD                = dr["ValorUSD"].ToString();
                        oReporteGeneral.stock                   = dr["Stock"].ToString();
                        oReporteGeneral.codigoCastor            = dr["CodigoCastor"].ToString();
                        oReporteGeneral.idUsuario               = Convert.ToInt32(dr["idUsuario"]);
                        oReporteGeneral.usuarioAsignado         = dr["UsuarioAsignado"].ToString();
                        oReporteGeneral.idUbicacion             = Convert.ToInt32(dr["idUbicacion"]);
                        oReporteGeneral.ubicacion               = dr["Ubicacion"].ToString();
                        oReporteGeneral.idEstado                = Convert.ToInt32(dr["idEstado"]);
                        oReporteGeneral.estadoConservacion      = dr["EstadoConservacion"].ToString();
                        oReporteGeneral.observacion1            = dr["observacion1"].ToString();
                        oReporteGeneral.observacion2            = dr["observacion2"].ToString();
                        oReporteGeneral.observacion3            = dr["observacion3"].ToString();
                        oReporteGeneral.posibleFaltanteFlag     = Convert.ToBoolean(dr["PosibleFaltanteFlag"]);
                        oReporteGeneral.cambioRYS               = dr["CambioRYS"].ToString();
                        oReporteGeneral.fechaMovimiento         = dr["FechaMovimiento"].ToString();

                        lstReporteGeneral.Add(oReporteGeneral);
                    }
                }
                return(lstReporteGeneral);
            }
            catch (DataException ex)
            {
                throw ex;
            }
        }
示例#5
0
        public RepSucursal(String rutadoc, String FechaMinima, string Fechamaxima, string CodigoDocumento, Boolean reporteindividual, Boolean reportesupervisor, String empleado, String sucursal)
        {
            //String FechaMinima = Convert.ToString(DateTime.Now.Day) + "/" + Convert.ToString(DateTime.Now.Month) + "/" + Convert.ToString(DateTime.Now.Year);
            SqlConnection sqlConn;

            SqlDataAdapter sqlDaDetalle;

            //.Reportes dsPc = new Reportes.Reportes();
            Reportes.DataSet1 dsPc = new Reportes.DataSet1();

            //FechaMinima = "26/09/2011";
            String Fecha;

            Fecha = FechaMinima.Replace("/", "");
            String strConn;
            string StrDetalle;

            strConn = ConfigurationManager.ConnectionStrings["dataexpressConnectionString"].ConnectionString;

            if ((CodigoDocumento == "01" || CodigoDocumento == "04") && reporteindividual == true && reportesupervisor == true)
            {
                StrDetalle = @"set dateformat ymd SELECT        IDcOMPROBANTE,Cat_Receptor.RFCREC, CAST(Cat_Receptor.NOMREC AS VARCHAR(30)) AS NOMREC, CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) AS TIPODOC, 
                         Dat_General.secuencial AS FOLFAC, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalDescuento * (- 1) 
                         ELSE Dat_General.totalDescuento END AS totalDescuento, Dat_General.fecha AS FECHA, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN Dat_General.subtotal12 * (- 1) ELSE Dat_General.subtotal12 END AS totalAntDesc, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.IVA12 * (- 1) ELSE Dat_General.IVA12 END AS IVA12, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalSinImpuestos * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS totalSinImpuestos, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) * (- 1) ELSE CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) 
                         END AS TOTAL, Dat_General.numeroAutorizacion, Dat_General.fechaAutorizacion, Dat_General.numDocModificado, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.totalSinImpuestos AS NUMERIC(18, 2)) * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS baseImponible, 0.00 AS Tarifa,IVA12 AS totalImpuestos
FROM            Dat_General INNER JOIN
                         Cat_Emisor ON Dat_General.id_Emisor = Cat_Emisor.IDEEMI INNER JOIN
                         Cat_Receptor ON Dat_General.id_Receptor = Cat_Receptor.IDEREC LEFT OUTER JOIN
                         Cat_Catalogo1_C ON Dat_General.codDoc = Cat_Catalogo1_C.codigo AND Cat_Catalogo1_C.tipo = 'Comprobante'
                WHERE 
                      ((Dat_General.estado =1 AND Dat_General.tipo ='E') or (Dat_General.estado =0 AND Dat_General.tipo ='L')) AND 
                      Dat_General.fecha>='" + FechaMinima + "' AND Dat_General.fecha<='" + Fechamaxima + @" 23:59:59.997' AND 
                      Dat_General.codDoc =" + CodigoDocumento;
            }
            else if ((CodigoDocumento == "01" || CodigoDocumento == "04") && reporteindividual == true && reportesupervisor == false)
            {
                StrDetalle = @"SELECT        IDcOMPROBANTE,Cat_Receptor.RFCREC, CAST(Cat_Receptor.NOMREC AS VARCHAR(30)) AS NOMREC, CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) AS TIPODOC, 
                         Dat_General.secuencial AS FOLFAC, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalDescuento * (- 1) 
                         ELSE Dat_General.totalDescuento END AS totalDescuento, Dat_General.fecha AS FECHA, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN Dat_General.subtotal12 * (- 1) ELSE Dat_General.subtotal12 END AS totalAntDesc, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.IVA12 * (- 1) ELSE Dat_General.IVA12 END AS IVA12, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalSinImpuestos * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS totalSinImpuestos, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) * (- 1) ELSE CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) 
                         END AS TOTAL, Dat_General.numeroAutorizacion, Dat_General.fechaAutorizacion, Dat_General.numDocModificado, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.totalSinImpuestos AS NUMERIC(18, 2)) * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS baseImponible, 0.00 AS Tarifa,IVA12 AS totalImpuestos
FROM            Dat_General INNER JOIN
                         Cat_Emisor ON Dat_General.id_Emisor = Cat_Emisor.IDEEMI INNER JOIN
                         Cat_Receptor ON Dat_General.id_Receptor = Cat_Receptor.IDEREC LEFT OUTER JOIN
                         Cat_Catalogo1_C ON Dat_General.codDoc = Cat_Catalogo1_C.codigo AND Cat_Catalogo1_C.tipo = 'Comprobante'
                WHERE 
                      ((Dat_General.estado =1 AND Dat_General.tipo ='E') or (Dat_General.estado =0 AND Dat_General.tipo ='L')) AND 
                      Dat_General.fecha>='" + FechaMinima + "' AND Dat_General.fecha<='" + Fechamaxima + @" 23:59:59.997' AND 
                      Dat_General.codDoc =" + CodigoDocumento + " ";
            }
            else if ((CodigoDocumento == "01" || CodigoDocumento == "04") && reporteindividual == false && reportesupervisor == true)
            {
                StrDetalle = @"SELECT        IDcOMPROBANTE,Cat_Receptor.RFCREC, CAST(Cat_Receptor.NOMREC AS VARCHAR(30)) AS NOMREC, CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) AS TIPODOC, 
                         Dat_General.secuencial AS FOLFAC, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalDescuento * (- 1) 
                         ELSE Dat_General.totalDescuento END AS totalDescuento, Dat_General.fecha AS FECHA, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN Dat_General.subtotal12 * (- 1) ELSE Dat_General.subtotal12 END AS totalAntDesc, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.IVA12 * (- 1) ELSE Dat_General.IVA12 END AS IVA12, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalSinImpuestos * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS totalSinImpuestos, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) * (- 1) ELSE CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) 
                         END AS TOTAL, Dat_General.numeroAutorizacion, Dat_General.fechaAutorizacion, Dat_General.numDocModificado, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.totalSinImpuestos AS NUMERIC(18, 2)) * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS baseImponible, 0.00 AS Tarifa,IVA12 AS totalImpuestos
FROM            Dat_General INNER JOIN
                         Cat_Emisor ON Dat_General.id_Emisor = Cat_Emisor.IDEEMI INNER JOIN
                         Cat_Receptor ON Dat_General.id_Receptor = Cat_Receptor.IDEREC LEFT OUTER JOIN
                         Cat_Catalogo1_C ON Dat_General.codDoc = Cat_Catalogo1_C.codigo AND Cat_Catalogo1_C.tipo = 'Comprobante'
                WHERE 
                      ((Dat_General.estado =1 AND Dat_General.tipo ='E') or (Dat_General.estado =0 AND Dat_General.tipo ='L')) AND 
                      Dat_General.fecha>='" + FechaMinima + "' AND Dat_General.fecha<='" + Fechamaxima + @" 23:59:59.997' AND 
                       Dat_General.codDoc =" + CodigoDocumento + "AND Dat_General.estab ='" + sucursal + "'";
            }
            else if (CodigoDocumento == "all" && reporteindividual == true && reportesupervisor == true)
            {
                StrDetalle = @"SELECT        IDcOMPROBANTE,Cat_Receptor.RFCREC, CAST(Cat_Receptor.NOMREC AS VARCHAR(30)) AS NOMREC, CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) AS TIPODOC, 
                         Dat_General.secuencial AS FOLFAC, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalDescuento * (- 1) 
                         ELSE Dat_General.totalDescuento END AS totalDescuento, Dat_General.fecha AS FECHA, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN Dat_General.subtotal12 * (- 1) ELSE Dat_General.subtotal12 END AS totalAntDesc, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.IVA12 * (- 1) ELSE Dat_General.IVA12 END AS IVA12, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalSinImpuestos * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS totalSinImpuestos, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) * (- 1) ELSE CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) 
                         END AS TOTAL, Dat_General.numeroAutorizacion, Dat_General.fechaAutorizacion, Dat_General.numDocModificado, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.totalSinImpuestos AS NUMERIC(18, 2)) * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS baseImponible, 0.00 AS Tarifa,IVA12 AS totalImpuestos
FROM            Dat_General INNER JOIN
                         Cat_Emisor ON Dat_General.id_Emisor = Cat_Emisor.IDEEMI INNER JOIN
                         Cat_Receptor ON Dat_General.id_Receptor = Cat_Receptor.IDEREC LEFT OUTER JOIN
                         Cat_Catalogo1_C ON Dat_General.codDoc = Cat_Catalogo1_C.codigo AND Cat_Catalogo1_C.tipo = 'Comprobante'
                WHERE 
                       (Dat_General.codDoc='01' OR  Dat_General.codDoc='04') AND ((Dat_General.estado =1 AND Dat_General.tipo ='E') or 
                       (Dat_General.estado =0 AND Dat_General.tipo ='L')) AND 
                      Dat_General.fecha>='" + FechaMinima + "' AND Dat_General.fecha<='" + Fechamaxima + @" 23:59:59.997'";
            }
            else if (CodigoDocumento == "all" && reporteindividual == true && reportesupervisor == false)
            {
                StrDetalle = @"SELECT        IDcOMPROBANTE,Cat_Receptor.RFCREC, CAST(Cat_Receptor.NOMREC AS VARCHAR(30)) AS NOMREC, CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) AS TIPODOC, 
                         Dat_General.secuencial AS FOLFAC, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalDescuento * (- 1) 
                         ELSE Dat_General.totalDescuento END AS totalDescuento, Dat_General.fecha AS FECHA, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN Dat_General.subtotal12 * (- 1) ELSE Dat_General.subtotal12 END AS totalAntDesc, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.IVA12 * (- 1) ELSE Dat_General.IVA12 END AS IVA12, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalSinImpuestos * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS totalSinImpuestos, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) * (- 1) ELSE CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) 
                         END AS TOTAL, Dat_General.numeroAutorizacion, Dat_General.fechaAutorizacion, Dat_General.numDocModificado, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.totalSinImpuestos AS NUMERIC(18, 2)) * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS baseImponible, 0.00 AS Tarifa,IVA12 AS totalImpuestos
FROM            Dat_General INNER JOIN
                         Cat_Emisor ON Dat_General.id_Emisor = Cat_Emisor.IDEEMI INNER JOIN
                         Cat_Receptor ON Dat_General.id_Receptor = Cat_Receptor.IDEREC LEFT OUTER JOIN
                         Cat_Catalogo1_C ON Dat_General.codDoc = Cat_Catalogo1_C.codigo AND Cat_Catalogo1_C.tipo = 'Comprobante'
                WHERE 
                       (Dat_General.codDoc='01' OR  Dat_General.codDoc='04') AND ((Dat_General.estado =1 AND Dat_General.tipo ='E') or (Dat_General.estado =0 AND Dat_General.tipo ='L')) AND 
                      Dat_General.fecha>='" + FechaMinima + "' AND Dat_General.fecha<='" + Fechamaxima + @" 23:59:59.997' ";
            }
            else if (CodigoDocumento == "all" && reporteindividual == false && reportesupervisor == true)
            {
                StrDetalle = @"SELECT        IDcOMPROBANTE,Cat_Receptor.RFCREC, CAST(Cat_Receptor.NOMREC AS VARCHAR(30)) AS NOMREC, CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) AS TIPODOC, 
                         Dat_General.secuencial AS FOLFAC, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalDescuento * (- 1) 
                         ELSE Dat_General.totalDescuento END AS totalDescuento, Dat_General.fecha AS FECHA, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN Dat_General.subtotal12 * (- 1) ELSE Dat_General.subtotal12 END AS totalAntDesc, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.IVA12 * (- 1) ELSE Dat_General.IVA12 END AS IVA12, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN Dat_General.totalSinImpuestos * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS totalSinImpuestos, CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) 
                         WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) * (- 1) ELSE CAST(Dat_General.importeAPagar AS NUMERIC(18, 2)) 
                         END AS TOTAL, Dat_General.numeroAutorizacion, Dat_General.fechaAutorizacion, Dat_General.numDocModificado, 
                         CASE CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) WHEN 'NOTA DE CREDITO' THEN CAST(Dat_General.totalSinImpuestos AS NUMERIC(18, 2)) * (- 1) 
                         ELSE Dat_General.totalSinImpuestos END AS baseImponible, 0.00 AS Tarifa,IVA12 AS totalImpuestos
FROM            Dat_General INNER JOIN
                         Cat_Emisor ON Dat_General.id_Emisor = Cat_Emisor.IDEEMI INNER JOIN
                         Cat_Receptor ON Dat_General.id_Receptor = Cat_Receptor.IDEREC LEFT OUTER JOIN
                         Cat_Catalogo1_C ON Dat_General.codDoc = Cat_Catalogo1_C.codigo AND Cat_Catalogo1_C.tipo = 'Comprobante'
                WHERE 
                       (Dat_General.codDoc='01' OR  Dat_General.codDoc='04') AND ((Dat_General.estado =1 AND Dat_General.tipo ='E') or (Dat_General.estado =0 AND Dat_General.tipo ='L')) AND 
                      Dat_General.fecha>='" + FechaMinima + "' AND Dat_General.fecha<='" + Fechamaxima + @" 23:59:59.997' AND"
                             + " Dat_General.estab ='" + sucursal + "'";
            }
            else if (CodigoDocumento == "07")
            {
                StrDetalle = @" SELECT Cat_Receptor.RFCREC, CAST(Cat_Receptor.NOMREC AS VARCHAR(30)) AS NOMREC, CAST(Cat_Catalogo1_C.descripcion AS VARCHAR(15)) AS TIPODOC, 
                         Dat_TotalConImpuestos.codigo, Dat_TotalConImpuestos.codigoPorcentaje, Dat_TotalConImpuestos.baseImponible, Dat_TotalConImpuestos.tarifa, Dat_TotalConImpuestos.valor, 
                         Dat_TotalConImpuestos.porcentajeRetener, Cat_Receptor.RFCREC AS RFCREC, Dat_General.secuencial AS FOLFAC, Dat_General.numeroAutorizacion, 
                         Dat_General.fechaAutorizacion,Dat_General.numDocModificado
                        FROM    Dat_Archivos INNER JOIN
                         Dat_General ON Dat_Archivos.IDEFAC = Dat_General.idComprobante INNER JOIN
                         Cat_Emisor ON Dat_General.id_Emisor = Cat_Emisor.IDEEMI INNER JOIN
                         Cat_Receptor ON Dat_General.id_Receptor = Cat_Receptor.IDEREC INNER JOIN
                         Dat_TotalConImpuestos ON Dat_General.idComprobante = Dat_TotalConImpuestos.id_Comprobante INNER JOIN
                         Cat_Catalogo1_C ON Dat_General.codDoc = Cat_Catalogo1_C.codigo AND Cat_Catalogo1_C.tipo = 'Comprobante'
                        WHERE
                      ((Dat_General.estado =1 AND Dat_General.tipo ='E') or (Dat_General.estado =0 AND Dat_General.tipo ='L')) and
                      Dat_General.fecha>='" + FechaMinima + "' AND Dat_General.fecha<='" + Fechamaxima + " 23:59:59.997' AND Dat_General.codDoc =" + CodigoDocumento;
            }
            else
            {
                StrDetalle = "";
            }

            try
            {
                //Crear los DataAdapters
                sqlConn = new SqlConnection(strConn);

                sqlDaDetalle = new SqlDataAdapter(StrDetalle, sqlConn);
                //Poblar las tablas del dataset desde los dataAdaperts
                dsPc.EnforceConstraints = false;

                if (CodigoDocumento == "01" || CodigoDocumento == "04")
                {
                    Reportes.dtsReporteIndividual dtsIndividual = new Reportes.dtsReporteIndividual();
                    sqlDaDetalle            = new SqlDataAdapter(StrDetalle, sqlConn);
                    dsPc.EnforceConstraints = false;
                    sqlDaDetalle.Fill(dtsIndividual, "RepDat_General");
                    ReporteFactNC rpt = new ReporteFactNC();
                    rpt.SetDataSource(dtsIndividual);
                    // crystalReportViewer1.ReportSource = rpt;
                    rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, rutadoc + ".xls");
                    rpt.Close();
                }
                if (CodigoDocumento == "07")
                {
                    Reportes.dtsReporteRetenciones dtsRetenciones = new Reportes.dtsReporteRetenciones();
                    sqlDaDetalle            = new SqlDataAdapter(StrDetalle, sqlConn);
                    dsPc.EnforceConstraints = false;
                    sqlDaDetalle.Fill(dtsRetenciones, "RepRetenciones");
                    RepRetenciones rpt = new RepRetenciones();
                    rpt.SetDataSource(dtsRetenciones);
                    // crystalReportViewer1.ReportSource = rpt;
                    rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, rutadoc + ".xls");
                    rpt.Close();
                }

                if (CodigoDocumento == "all")
                {
                    Reportes.dtsReporteGeneral dtsDat_General = new Reportes.dtsReporteGeneral();
                    sqlDaDetalle = new SqlDataAdapter(StrDetalle, sqlConn);
                    //Poblar las tablas del dataset desde los dataAdaperts
                    dsPc.EnforceConstraints = false;
                    sqlDaDetalle.Fill(dtsDat_General, "ReporteDat_General");
                    ReporteGeneral rpt = new ReporteGeneral();
                    rpt.SetDataSource(dtsDat_General);
                    // crystalReportViewer1.ReportSource = rpt;
                    rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, rutadoc + ".xls");
                    rpt.Close();
                }

                if (CodigoDocumento == "NA")
                {
                    Reportes.dtsReporteNA dtsNA = new Reportes.dtsReporteNA();
                    sqlDaDetalle            = new SqlDataAdapter(StrDetalle, sqlConn);
                    dsPc.EnforceConstraints = false;
                    sqlDaDetalle.Fill(dtsNA, "ReporteNA");
                    rptReporteNA rpt = new rptReporteNA();
                    rpt.SetDataSource(dtsNA);
                    // crystalReportViewer1.ReportSource = rpt;
                    rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, rutadoc + ".xls");
                    rpt.Close();
                }
                if (CodigoDocumento == "NE")
                {
                    Reportes.dtsReporteNE dtsNE = new Reportes.dtsReporteNE();
                    sqlDaDetalle            = new SqlDataAdapter(StrDetalle, sqlConn);
                    dsPc.EnforceConstraints = false;
                    sqlDaDetalle.Fill(dtsNE, "validarxmlecu");
                    rptReporteNE rpt = new rptReporteNE();
                    rpt.SetDataSource(dtsNE);
                    // crystalReportViewer1.ReportSource = rpt;
                    rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, rutadoc + ".xls");
                    rpt.Close();
                }
            }
            catch (Exception ex)
            {
                String archivo = System.AppDomain.CurrentDomain.BaseDirectory + @"reportes\docs\" + rutadoc + ".txt";
                using (System.IO.StreamWriter escritor = new System.IO.StreamWriter(rutadoc + ".txt"))
                {
                    escritor.WriteLine(ex.ToString());
                }
            }
        }
示例#6
0
        private Reporte GenerarReporte(int cedulaReporte, DateTime fechaReporte)
        {
            //Inicio el reporte
            _reporteBLL = new ReporteGeneral(cedulaReporte, fechaReporte);
            _reporteBLL.IniciarReporte();

            //Inicio el reporte modelo de vista
            Reporte reporteVista = new Reporte();

            //Trae el tipo de cambio para mostrar y asigna datos
            reporteVista.TipoCambio        = _reporteBLL.GetTipoCambio();
            reporteVista.UnidadNegocio     = _reporteBLL.GetUnidadNegocio();
            reporteVista.FechaContratacion = _reporteBLL.GetFechaContratacion();

            //Asigna lo correspondiente a creditos
            var reporteTipoCreditosBLL = _reporteBLL.GetReporteTipoCreditos();

            reporteVista.listaTipoCreditos     = Mapper.Map <List <RTipoCreditos> >(reporteTipoCreditosBLL);
            reporteVista.TotalComisionCreditos = reporteVista.listaTipoCreditos.Sum(x => x.TotalComision);

            //Asigna lo correspondiente a productos
            var reporteProductosBLL = _reporteBLL.GetReporteProductos();

            reporteVista.listaProductos         = Mapper.Map <List <RProductos> >(reporteProductosBLL);
            reporteVista.TotalComisionProductos = reporteVista.listaProductos.Sum(x => x.TotalComision);

            //Asigna lo correspondiente a cdps
            var reporteCDPsBLL = _reporteBLL.GetReporteTipoCDPs();

            reporteVista.listaCDPs         = Mapper.Map <List <RCDPs> >(reporteCDPsBLL);
            reporteVista.TotalComisionCDPs = reporteVista.listaCDPs.Sum(x => x.TotalComision);

            //Suma las comisiones
            reporteVista.TotalGenerado = reporteVista.TotalComisionCreditos.Value + reporteVista.TotalComisionProductos + reporteVista.TotalComisionCDPs.Value;

            //Asignacion del salario
            Salario salarioBLL      = Mapper.Map <Salario>(_reporteBLL.GetSalario());
            int     mesesTrabajados = _reporteBLL.GetMesesTrabajados();

            if (mesesTrabajados <= salarioBLL.MesesInicio)
            {
                reporteVista.Salario       = salarioBLL.SalarioInicio;
                reporteVista.Bono          = reporteVista.TotalGenerado < salarioBLL.BonoInicio ? salarioBLL.BonoInicio : 0;
                reporteVista.TotalGenerado = reporteVista.Bono != 0 ? reporteVista.Bono : reporteVista.TotalGenerado;
            }
            else
            {
                reporteVista.Salario = salarioBLL.Base;
                reporteVista.Bono    = 0;
            }

            reporteVista.TotalGenerado += reporteVista.Salario;

            //Asigna los IDPs para mostrarlos en el reporte
            reporteVista.Estado_IDP.IDP_Creditos   = _reporteBLL.GetIDPCredito();
            reporteVista.Estado_IDP.IDP_CDPs       = _reporteBLL.GetIDPsCDP();
            reporteVista.Estado_IDP.TipoProductos  = Mapper.Map <List <RTProducto_IDP> >(_reporteBLL.GetIDPsProductos());
            reporteVista.Estado_IDP.Metas_Creditos = _reporteBLL.GetMetaCredito();
            reporteVista.Estado_IDP.Metas_CDPs     = _reporteBLL.GetMetaCDP();
            reporteVista.Estado_IDP.TotalIDP       = _reporteBLL.GetTotalIDP();

            return(reporteVista);
        }
示例#7
0
        //Metodo para cargar los datos en la grilla.
        private void cs_pxCargarDgvComprobanteselectronicos(string fechainicio, string fechafin)
        {
            dgComprobantesFacturas.ItemsSource = null;
            dgComprobantesFacturas.Items.Clear();
            lista_reporte_facturas = new List <ReporteGeneral>();
            //Obtener comporbantes segun fecha selecionada para facturas y notas.
            registros          = new clsEntityDocument(localDB).cs_pxObtenerFiltroReporteGeneral("", "", "", fechainicio, fechafin, "'01','07','08'", false);
            facturas_emitidos  = 0;
            facturas_aceptadas = 0;
            facturas_sinestado = 0;
            facturas_rechazado = 0;
            facturas_debaja    = 0;

            fcredito_emitidos  = 0;
            fcredito_aceptadas = 0;
            fcredito_sinestado = 0;
            fcredito_rechazado = 0;
            fcredito_debaja    = 0;

            fdebito_emitidos  = 0;
            fdebito_aceptadas = 0;
            fdebito_sinestado = 0;
            fdebito_rechazado = 0;
            fdebito_debaja    = 0;
            //si existen registros
            if (registros != null)
            {
                //Recorrer los registros y realizar los calculos para mostrar en el resumen general.
                foreach (var item in registros)
                {
                    if (item.Cs_tag_InvoiceTypeCode == "01")
                    {
                        facturas_emitidos++;
                        switch (item.Cs_pr_EstadoSUNAT)
                        {
                        case "0":
                            facturas_aceptadas++;
                            break;

                        case "1":
                            facturas_rechazado++;
                            break;

                        case "2":
                            facturas_sinestado++;
                            break;

                        case "3":
                            facturas_debaja++;
                            break;

                        default:
                            break;
                        }
                    }
                    if (item.Cs_tag_InvoiceTypeCode == "07")
                    {
                        fcredito_emitidos++;
                        switch (item.Cs_pr_EstadoSUNAT)
                        {
                        case "0":
                            fcredito_aceptadas++;
                            break;

                        case "1":
                            fcredito_rechazado++;
                            break;

                        case "2":
                            fcredito_sinestado++;
                            break;

                        case "3":
                            fcredito_debaja++;
                            break;

                        default:
                            break;
                        }
                    }
                    if (item.Cs_tag_InvoiceTypeCode == "08")
                    {
                        fdebito_emitidos++;
                        switch (item.Cs_pr_EstadoSUNAT)
                        {
                        case "0":
                            fdebito_aceptadas++;
                            break;

                        case "1":
                            fdebito_rechazado++;
                            break;

                        case "2":
                            fdebito_sinestado++;
                            break;

                        case "3":
                            fdebito_debaja++;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }

            //Adicionar informacion de factura a grid.
            itemRow           = new ReporteGeneral();
            itemRow.TipoTexto = "FACTURA ELECTRONICA";
            itemRow.Tipo      = "01";
            itemRow.Rechazado = facturas_rechazado.ToString();
            itemRow.SinEstado = facturas_sinestado.ToString();
            itemRow.DeBaja    = facturas_debaja.ToString();
            itemRow.Aceptado  = facturas_aceptadas.ToString();
            itemRow.Emitidos  = facturas_emitidos.ToString();
            lista_reporte_facturas.Add(itemRow);
            //Adicionar informacion de nota de credito a grid.
            itemRow           = new ReporteGeneral();
            itemRow.TipoTexto = "NOTA DE CREDITO ELECTRONICA";
            itemRow.Tipo      = "07";
            itemRow.Rechazado = fcredito_rechazado.ToString();
            itemRow.SinEstado = fcredito_sinestado.ToString();
            itemRow.DeBaja    = fcredito_debaja.ToString();
            itemRow.Aceptado  = fcredito_aceptadas.ToString();
            itemRow.Emitidos  = fcredito_emitidos.ToString();
            lista_reporte_facturas.Add(itemRow);
            //Adicionar informacion de factura a grid.
            itemRow           = new ReporteGeneral();
            itemRow.TipoTexto = "NOTA DE DEBITO ELECTRONICA";
            itemRow.Tipo      = "08";
            itemRow.Rechazado = fdebito_rechazado.ToString();
            itemRow.SinEstado = fdebito_sinestado.ToString();
            itemRow.DeBaja    = fdebito_debaja.ToString();
            itemRow.Aceptado  = fdebito_aceptadas.ToString();
            itemRow.Emitidos  = fdebito_emitidos.ToString();
            lista_reporte_facturas.Add(itemRow);

            dgComprobantesFacturas.ItemsSource = lista_reporte_facturas;


            dgComprobantesBoletas.ItemsSource = null;
            dgComprobantesBoletas.Items.Clear();
            lista_reporte_boletas = new List <ReporteGeneral>();
            //Obtener comporbantes segun fecha selecionada para boletas y notas.
            registros         = new clsEntityDocument(localDB).cs_pxObtenerFiltroReporteGeneral("", "", "", fechainicio, fechafin, "'03','07','08'", true);
            boletas_emitidos  = 0;
            boletas_aceptadas = 0;
            boletas_sinestado = 0;
            boletas_rechazado = 0;
            boletas_debaja    = 0;

            bcredito_emitidos  = 0;
            bcredito_aceptadas = 0;
            bcredito_sinestado = 0;
            bcredito_rechazado = 0;
            bcredito_debaja    = 0;

            bdebito_emitidos  = 0;
            bdebito_aceptadas = 0;
            bdebito_sinestado = 0;
            bdebito_rechazado = 0;
            bdebito_debaja    = 0;
            //Si existen registros
            if (registros != null)
            {
                //Recorrer los registros para realizar los calculos y mostrar en el resumen.
                foreach (var item in registros)
                {
                    if (item.Cs_tag_InvoiceTypeCode == "03")
                    {
                        boletas_emitidos++;
                        switch (item.Cs_pr_EstadoSUNAT)
                        {
                        case "0":
                            boletas_aceptadas++;
                            break;

                        case "1":
                            boletas_rechazado++;
                            break;

                        case "2":
                            boletas_sinestado++;
                            break;

                        case "3":
                            boletas_debaja++;
                            break;

                        default:
                            break;
                        }
                    }
                    if (item.Cs_tag_InvoiceTypeCode == "07")
                    {
                        bcredito_emitidos++;
                        switch (item.Cs_pr_EstadoSUNAT)
                        {
                        case "0":
                            bcredito_aceptadas++;
                            break;

                        case "1":
                            bcredito_rechazado++;
                            break;

                        case "2":
                            bcredito_sinestado++;
                            break;

                        case "3":
                            bcredito_debaja++;
                            break;

                        default:
                            break;
                        }
                    }
                    if (item.Cs_tag_InvoiceTypeCode == "08")
                    {
                        bdebito_emitidos++;
                        switch (item.Cs_pr_EstadoSUNAT)
                        {
                        case "0":
                            bdebito_aceptadas++;
                            break;

                        case "1":
                            bdebito_rechazado++;
                            break;

                        case "2":
                            bdebito_sinestado++;
                            break;

                        case "3":
                            bdebito_debaja++;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }

            //Adicionar informacion de boleta a grid.
            itemRow           = new ReporteGeneral();
            itemRow.TipoTexto = "BOLETA DE VENTA ELECTRONICA";
            itemRow.Tipo      = "03";
            itemRow.Rechazado = boletas_rechazado.ToString();
            itemRow.SinEstado = boletas_sinestado.ToString();
            itemRow.DeBaja    = boletas_debaja.ToString();
            itemRow.Aceptado  = boletas_aceptadas.ToString();
            itemRow.Emitidos  = boletas_emitidos.ToString();
            lista_reporte_boletas.Add(itemRow);
            //Adicionar informacion de nota de credito a grid.
            itemRow           = new ReporteGeneral();
            itemRow.TipoTexto = "NOTA DE CREDITO ELECTRONICA";
            itemRow.Tipo      = "07";
            itemRow.Rechazado = bcredito_rechazado.ToString();
            itemRow.SinEstado = bcredito_sinestado.ToString();
            itemRow.DeBaja    = bcredito_debaja.ToString();
            itemRow.Aceptado  = bcredito_aceptadas.ToString();
            itemRow.Emitidos  = bcredito_emitidos.ToString();
            lista_reporte_boletas.Add(itemRow);
            //Adicionar informacion de factura a grid.
            itemRow           = new ReporteGeneral();
            itemRow.TipoTexto = "NOTA DE DEBITO ELECTRONICA";
            itemRow.Tipo      = "08";
            itemRow.Rechazado = bdebito_rechazado.ToString();
            itemRow.SinEstado = bdebito_sinestado.ToString();
            itemRow.DeBaja    = bdebito_debaja.ToString();
            itemRow.Aceptado  = bdebito_aceptadas.ToString();
            itemRow.Emitidos  = bdebito_emitidos.ToString();
            lista_reporte_boletas.Add(itemRow);

            dgComprobantesBoletas.ItemsSource = lista_reporte_boletas;
        }