Esempio n. 1
0
        public ActionResult ExportarComprobantesAnulados(DateTime FechaInicio, DateTime FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_FILE_DETAIL);
                return RedirectToAction("Index", "Admin");
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<ComprobanteDTO> listaTipo3 = repBL.getComprobantesEnEmpresa(objEmpresa.IdEmpresa, 3, FechaInicio, FechaFin);
            List<ComprobanteDTO> listaTipo4 = repBL.getComprobantesEnEmpresa(objEmpresa.IdEmpresa, 4, FechaInicio, FechaFin);

            listaTipo3.AddRange(listaTipo4);

            if (listaTipo3 == null || listaTipo3.Count == 0)
            {
                createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_EMPTY);
                return RedirectToAction("ComprobantesAnulados", "Admin");
            }

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            var rFechaFin = "Fecha de Cobro / Pago";
            var strEntidad = "Cliente / Proveedor";

            dt.Columns.Add("Fecha");
            dt.Columns.Add("Documento");
            dt.Columns.Add("Numero");
            dt.Columns.Add(strEntidad);
            /*if (idTipoComprobante == 3)
            { dt.Columns.Add("Proyecto"); }*/
            dt.Columns.Add("Moneda");
            dt.Columns.Add("Monto Sin IGV");
            dt.Columns.Add("Monto Total (MN)");
            dt.Columns.Add("Monto Total (ME)");
            dt.Columns.Add("Tipo Cambio");
            dt.Columns.Add("Partida de Presupuesto");
            dt.Columns.Add(rFechaFin);
            dt.Columns.Add("Usuario");
            dt.Columns.Add("Estado");
            dt.Columns.Add("Status");
            dt.Columns.Add("Comentario");

            foreach (var obj in listaTipo3)
            {
                System.Data.DataRow row = dt.NewRow();
                row["Fecha"] = obj.FechaEmision.ToString("dd/MMM/yyyy", CultureInfo.CreateSpecificCulture("en-GB"));
                row["Documento"] = obj.NombreTipoDocumento;
                row["Numero"] = obj.NroDocumento;
                row[strEntidad] = obj.NombreEntidad;
                /*if (idTipoComprobante == 1) { row["Proyecto"] = obj.NombreProyecto; }*/
                row["Moneda"] = obj.SimboloMoneda;
                row["Monto Sin IGV"] = obj.MontoSinIGV.ToString("N2", CultureInfo.InvariantCulture);
                row["Monto Total (MN)"] = obj.IdMoneda == 1 ? obj.Monto.ToString("N2", CultureInfo.InvariantCulture) : "";
                row["Monto Total (ME)"] = obj.IdMoneda != 1 ? obj.Monto.ToString("N2", CultureInfo.InvariantCulture) : "";
                row["Tipo Cambio"] = obj.TipoCambio.ToString("N2", CultureInfo.InvariantCulture);
                row["Partida de Presupuesto"] = obj.NombreCategoria;
                row[rFechaFin] = obj.FechaConclusion != null ? obj.FechaConclusion.GetValueOrDefault().ToString("dd/MMM/yyyy", CultureInfo.CreateSpecificCulture("en-GB")) : "-";
                row["Usuario"] = obj.NombreUsuario;
                row["Estado"] = obj.Estado ? "Activo" : "Inactivo";
                row["Status"] = obj.Ejecutado ? "Cancelado" : "Pendiente";
                row["Comentario"] = obj.Comentario;
                dt.Rows.Add(row);
            }

            GenerarPdf(dt, "Detalle de Comprobantes Anulados", "DetalleComprobantesAnulados", objEmpresa, FechaInicio, FechaFin, Response);

            createResponseMessage(CONSTANTES.SUCCESS, CONSTANTES.SUCCESS_FILE);
            return RedirectToAction("ComprobantesAnulados", "Admin");
        }
Esempio n. 2
0
        public ActionResult ExportarComprobantesAsociados_EnProyecto(int idProyecto, int idEntidadResponsable, DateTime FechaInicio, DateTime FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_FILE_DETAIL);
                return RedirectToAction("Proyecto", "Admin", new { id = idProyecto, idEntidad = idEntidadResponsable });
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<ComprobanteDTO> lista = repBL.getComprobantes_ConProyecto(objEmpresa.IdEmpresa, idProyecto, FechaInicio, FechaFin);

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Fecha");
            dt.Columns.Add("Modalidad");
            dt.Columns.Add("Documento");
            dt.Columns.Add("Numero");
            dt.Columns.Add("Proyecto");
            dt.Columns.Add("Monto Total");

            foreach (var obj in lista)
            {
                System.Data.DataRow row = dt.NewRow();
                row["Fecha"] = obj.FechaEmision.ToString("dd/MMM/yyyy", CultureInfo.CreateSpecificCulture("en-GB"));
                row["Modalidad"] = obj.IdTipoComprobante == 1 ? "Ingreso" : "Egreso";
                row["Documento"] = obj.NombreTipoDocumento;
                row["Numero"] = obj.NroDocumento;
                row["Proyecto"] = obj.NombreProyecto;
                row["Monto Total"] = obj.Monto.ToString("N2", CultureInfo.InvariantCulture);
                dt.Rows.Add(row);
            }
            GenerarPdf(dt, "Comprobantes Asociados a Proyecto", "ComprobantesAsociados_A_Proyecto", objEmpresa, FechaInicio, FechaFin, Response);

            createResponseMessage(CONSTANTES.SUCCESS, CONSTANTES.SUCCESS_FILE);
            return RedirectToAction("Proyecto", "Admin", new { id = idProyecto, idEntidad = idEntidadResponsable });
        }
Esempio n. 3
0
        public ActionResult ExportarLibros(int idTipoCuenta, DateTime? FechaInicio, DateTime? FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_FILE_DETAIL);
                return RedirectToAction("Libros", "Admin");
            }

            string tipo = idTipoCuenta == 1 ? "Bancarios" : "Administrativos";
            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<CuentaBancariaDTO> lstCuentas = repBL.getCuentasBancariasEnEmpresa(objEmpresa.IdEmpresa, idTipoCuenta, FechaInicio.GetValueOrDefault(), FechaFin.GetValueOrDefault());

            if (lstCuentas == null || lstCuentas.Count == 0)
            {
                createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_EMPTY);
                return RedirectToAction("Libros" + tipo, "Admin");
            }

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Nombre");
            dt.Columns.Add("Fecha");
            dt.Columns.Add("Moneda");
            string miSaldo = idTipoCuenta == 1 ? "Saldo Disponible" : "Saldo Total";
            dt.Columns.Add(miSaldo);
            if (idTipoCuenta == 1) { dt.Columns.Add("Saldo Bancario"); }
            dt.Columns.Add("Estado");

            foreach (var obj in lstCuentas)
            {
                System.Data.DataRow row = dt.NewRow();
                row["Nombre"] = obj.NombreCuenta;
                row["Fecha"] = obj.FechaConciliacion.ToString("yyyy/MM/dd", CultureInfo.InvariantCulture);
                row["Moneda"] = obj.SimboloMoneda;
                row[3] = obj.SaldoDisponible.ToString("N2", CultureInfo.InvariantCulture);
                if (idTipoCuenta == 1) { row["Saldo Bancario"] = obj.SaldoBancario.ToString("N2", CultureInfo.CreateSpecificCulture("en-GB")); }
                row["Estado"] = obj.Estado ? "Activo" : "Inactivo";
                dt.Rows.Add(row);
            }

            GenerarPdf(dt, "Detalle de Libros", "DetalleLibros", objEmpresa, FechaInicio, FechaFin, Response);

            createResponseMessage(CONSTANTES.SUCCESS, CONSTANTES.SUCCESS_FILE);
            return RedirectToAction("Libros" + tipo, "Admin");
        }
Esempio n. 4
0
        public ActionResult ExportarMovimientos(int idLibro, DateTime? FechaInicio, DateTime? FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_FILE_DETAIL);
                return RedirectToAction("Libros", "Admin");
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            CuentaBancariaDTO CuentaBancaria = repBL.getCuentaBancaria(idLibro, FechaInicio.GetValueOrDefault(), FechaFin.GetValueOrDefault());

            if (CuentaBancaria == null || CuentaBancaria.listaMovimiento.Count == 0)
            {
                createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_EMPTY);
                return RedirectToAction("Libros", "Admin");
            }

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Fecha");
            dt.Columns.Add("Movimiento");
            dt.Columns.Add("Detalle");
            dt.Columns.Add("Moneda");
            dt.Columns.Add("Monto");
            dt.Columns.Add("Partida de Presupuesto");
            dt.Columns.Add("Entidad");
            dt.Columns.Add("Numero de documento");
            dt.Columns.Add("Estado");
            dt.Columns.Add("Usuario");
            dt.Columns.Add("Activo");
            dt.Columns.Add("Comentario");

            foreach (var obj in CuentaBancaria.listaMovimiento)
            {
                System.Data.DataRow row = dt.NewRow();
                row["Fecha"] = obj.Fecha.ToString("dd/MMM/yyyy", CultureInfo.CreateSpecificCulture("en-GB")); ;
                row["Movimiento"] = obj.IdTipoMovimiento == 1 ? "Entrada" : "Salida";
                row["Detalle"] = obj.NroOperacion;
                row["Moneda"] = CuentaBancaria.SimboloMoneda;
                row["Monto"] = obj.IdTipoMovimiento == 1 ? obj.Monto.ToString("N2", CultureInfo.InvariantCulture) : (-1 * obj.Monto).ToString("N2", CultureInfo.InvariantCulture);
                row["Partida de Presupuesto"] = obj.NombreCategoria == null ? "N/A" : obj.NombreCategoria;
                row["Entidad"] = obj.NombreEntidadR;
                row["Numero de documento"] = obj.NumeroDocumento != null ? obj.NumeroDocumento : obj.NumeroDocumento2 != null ? obj.NumeroDocumento2 : "N/A";
                row["Estado"] = obj.IdEstadoMovimiento == 1 ? "Pendiente" : "Realizado";
                row["Usuario"] = obj.NombreUsuario;
                row["Activo"] = obj.Estado ? "Activo" : "Inactivo";
                row["Comentario"] = obj.Comentario;
                dt.Rows.Add(row);
            }

            GenerarPdf(dt, "Detalle de Movimientos en la Cuenta - " + CuentaBancaria.NombreCuenta, "DetalleMovimientosEnLibro", objEmpresa, FechaInicio, FechaFin, Response);

            createResponseMessage(CONSTANTES.SUCCESS, CONSTANTES.SUCCESS_FILE);
            return RedirectToAction("Libros", "Admin");
        }
Esempio n. 5
0
        public ActionResult GenerarRep_Ventas_Gastos_Por_Mes(int year)
        {
            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<LiquidezDTO> lista = repBL.getGestionMensual(objEmpresa.IdEmpresa, year);

            if (lista == null)
                return RedirectToAction("ReportesGestion", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Mes");
            dt.Columns.Add("Detalle");
            dt.Columns.Add("Monto Con IGV");
            dt.Columns.Add("Monto Sin IGV");

            //int mesActual = DateTime.Now.Month;

            foreach (var obj in lista)
            {
                PintarGestionPorMesIE(obj, dt);
            }

            GenerarPdf6(dt, "Ventas-Gastos por Mes", "Ventas-Gastos_por_Mes", objEmpresa, Response);

            return RedirectToAction("ReportesGestion", new { message = 2 });
        }
Esempio n. 6
0
        public ActionResult GenerarRep_Ventas_Por_Mes(int year)
        {
            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<LiquidezDTO> lista = repBL.getGestionMensual(objEmpresa.IdEmpresa, year);

            if (lista == null)
                return RedirectToAction("ReportesGestion", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Mes");
            dt.Columns.Add("Monto Con IGV");
            dt.Columns.Add("Monto Sin IGV");

            //int mesActual = DateTime.Now.Month;

            foreach (var obj in lista)
            {
                DataRow row = dt.NewRow();
                row["Mes"] = obj.nombreMes;
                row["Monto Con IGV"] = obj.Ingreso.ToString("N2", CultureInfo.InvariantCulture);
                row["Monto Sin IGV"] = obj.Ingreso_SinIGV.ToString("N2", CultureInfo.InvariantCulture);
                dt.Rows.Add(row);
            }

            DataRow rowFinal = dt.NewRow();
            rowFinal["Mes"] = "TOTAL";
            rowFinal["Monto Con IGV"] = lista.Sum(x => x.Ingreso).ToString("N2", CultureInfo.InvariantCulture);
            rowFinal["Monto Sin IGV"] = lista.Sum(x => x.Ingreso_SinIGV).ToString("N2", CultureInfo.InvariantCulture);
            dt.Rows.Add(rowFinal);

            GenerarPdf6(dt, "Ventas por Mes", "Ventas_por_Mes", objEmpresa, Response);

            return RedirectToAction("ReportesGestion", new { message = 2 });
        }
Esempio n. 7
0
        public ActionResult GenerarRep_DetalleIngresosYGastosPorPartidaDePresupuesto(int IdCategoria, DateTime? FechaInicio, DateTime? FechaFin)
        {
            if (FechaInicio == null || FechaFin == null || IdCategoria == 0)
            {
                return RedirectToAction("ReportesPresupuestos", new { message = 1 });
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();

            CategoriaR_DTO catArbol = repBL.getDetalleIngresosYGastos_PorPartidaDePresupuesto(IdCategoria, objEmpresa.IdEmpresa, FechaInicio.GetValueOrDefault(), FechaFin.GetValueOrDefault());

            if (catArbol == null)
                return RedirectToAction("ReportesPresupuestos", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Nivel");
            dt.Columns.Add("Partida");
            dt.Columns.Add("Fecha");
            dt.Columns.Add("Entidad");
            dt.Columns.Add("Documento");
            dt.Columns.Add("# Documento");
            dt.Columns.Add("Moneda");
            dt.Columns.Add("Monto Sin IGV");
            dt.Columns.Add("Area(s)");
            dt.Columns.Add("Comentario");

            DataRow rowP = dt.NewRow();
            rowP["Nivel"] = catArbol.Nivel;
            rowP["Partida"] = catArbol.Nombre;
            dt.Rows.Add(rowP);
            foreach (var obj in catArbol.Comprobantes)
            {
                System.Data.DataRow row = dt.NewRow();
                row["Fecha"] = obj.Fecha.ToString("dd/MMM/yyyy", CultureInfo.CreateSpecificCulture("en-GB"));
                row["Entidad"] = obj.NombreEntidad;
                row["Documento"] = obj.NombreDocumento;
                row["# Documento"] = obj.NroDocumento;
                row["Moneda"] = obj.Moneda;
                row["Monto Sin IGV"] = obj.MontoSinIGV.ToString("N2", CultureInfo.InvariantCulture);
                row["Area(s)"] = obj.Areas;
                row["Comentario"] = obj.Comentario;

                dt.Rows.Add(row);
            }
            PintarGastoPorPartidaPresupuesto(catArbol.Hijos.ToList(), dt);

            GenerarPdf2(dt, "Movimientos por Partida de Presupuesto", "Movimientos_porPartidaDePresupuesto", objEmpresa, FechaInicio, FechaFin, Response);

            return RedirectToAction("ReportesPresupuestos", new { message = 2 });
        }
Esempio n. 8
0
        public ActionResult GenerarRep_FacturacionPorHonorarios(DateTime? FechaInicio, DateTime? FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                return RedirectToAction("ReportesGestion", new { message = 1 });
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<HonorarioDTO> lstHonorariosMontos = repBL.getHonorariosEnEmpresa(objEmpresa.IdEmpresa, FechaInicio, FechaFin);

            if (lstHonorariosMontos == null)
                return RedirectToAction("ReportesGestion", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Modalidad");
            dt.Columns.Add("Monto con IGV");
            dt.Columns.Add("Monto sin IGV");
            dt.Columns.Add("Porcentaje");

            Decimal SumaTotal = lstHonorariosMontos.Sum(x => x.Monto);

            foreach (var obj in lstHonorariosMontos)
            {
                DataRow row = dt.NewRow();
                row["Modalidad"] = obj.Nombre;
                row["Monto con IGV"] = obj.Monto.ToString("N2", CultureInfo.InvariantCulture);
                row["Monto sin IGV"] = obj.Monto_SinIGV.ToString("N2", CultureInfo.InvariantCulture);
                Decimal porcentaje = SumaTotal == 0 ? 0 : obj.Monto / SumaTotal;
                obj.Porcentaje = porcentaje;
                row["Porcentaje"] = porcentaje.ToString("P2", CultureInfo.InvariantCulture);
                dt.Rows.Add(row);
            }

            System.Data.DataRow rowFinal = dt.NewRow();
            rowFinal[0] = "TOTAL";
            rowFinal[1] = SumaTotal.ToString("N2", CultureInfo.InvariantCulture);
            rowFinal[2] = lstHonorariosMontos.Sum(x => x.Porcentaje).ToString("P2", CultureInfo.InvariantCulture);
            dt.Rows.Add(rowFinal);

            GenerarPdf(dt, "Ventas por Modalidad de Pago", "VentasPorModalidadDePago", objEmpresa, FechaInicio, FechaFin, Response);

            return RedirectToAction("ReportesGestion", new { message = 2 });
        }
Esempio n. 9
0
        public ActionResult GenerarRep_DocumentosIngresoYEgresoPagadosYPorCobrar(int IdTipoComprobante, DateTime? FechaInicio, DateTime? FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                return RedirectToAction("ReportesGestion", new { message = 1 });
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();

            List<ComprobanteDTO> lstComprobantes = repBL.getComprobantesIngresosYEgresosEnEmpresa(objEmpresa.IdEmpresa, IdTipoComprobante, FechaInicio.GetValueOrDefault(), FechaFin.GetValueOrDefault());
            //List<ComprobanteDTO> lstPagados = lstComprobantes.Where(x => x.Ejecutado).OrderBy(x => x.FechaEmision).ToList();
            //List<ComprobanteDTO> lstPorCobrar = lstComprobantes.Where(x => !x.Ejecutado).OrderBy(x => x.FechaEmision).ToList();
            if (lstComprobantes == null)
                return RedirectToAction("ReportesGestion", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            string Entidad = IdTipoComprobante == 1 ? "Cliente" : "Entidad";
            string FechaEjecucion = IdTipoComprobante == 1 ? "Fecha Estimada de Cobro" : "Fecha Estimada de Pago";
            int neleCols = 13;

            dt.Columns.Add("Numero");
            dt.Columns.Add("Documento");
            dt.Columns.Add("Fecha");
            dt.Columns.Add("Status");
            dt.Columns.Add(Entidad);
            if (IdTipoComprobante == 1)
            { dt.Columns.Add("Proyecto"); neleCols = 14; }
            dt.Columns.Add("Moneda");
            dt.Columns.Add("Monto Sin IGV");
            dt.Columns.Add("Monto Total");
            dt.Columns.Add("Partida de Presupuesto");
            dt.Columns.Add("Monto Pendiente");
            dt.Columns.Add("Modalidad");
            dt.Columns.Add(FechaEjecucion);
            dt.Columns.Add("Fecha Cancelación");
            dt.Columns.Add("Dias transcurridos Emisión - Cancelación");
            dt.Columns.Add("Dias Vencidos");
            dt.Columns.Add("Comentarios");

            List<bool> Ejecutados = new List<bool>() { true, false };
            DateTime FechaActual = DateTime.Now;


            foreach (var elem in Ejecutados)
            {
                List<ComprobanteDTO> lista = lstComprobantes.Where(x => x.Ejecutado == elem).OrderBy(x => x.FechaEmision).ToList();

                foreach (var obj in lista)
                {
                    System.Data.DataRow row = dt.NewRow();
                    row["Numero"] = obj.NroDocumento;
                    row["Documento"] = obj.NombreTipoDocumento;
                    //row["Fecha"] = obj.FechaEmision.ToString("d", CultureInfo.CreateSpecificCulture("es-PE"));
                    row["Fecha"] = obj.FechaEmision.ToString("dd/MMM/yyyy", CultureInfo.CreateSpecificCulture("en-GB"));
                    row["Status"] = obj.Ejecutado ? "Cancelado" : "Pendiente";
                    row[Entidad] = obj.NombreEntidad;
                    if (IdTipoComprobante == 1)
                    { row["Proyecto"] = obj.NombreProyecto; }
                    row["Moneda"] = obj.SimboloMoneda;
                    row["Monto Sin IGV"] = obj.MontoSinIGV.ToString("N2", CultureInfo.InvariantCulture);
                    row["Monto Total"] = obj.Monto.ToString("N2", CultureInfo.InvariantCulture);
                    row["Partida de Presupuesto"] = obj.NombreCategoria;
                    row["Monto Pendiente"] = obj.Ejecutado ? "0.00" : obj.MontoIncompleto.ToString("N2", CultureInfo.InvariantCulture);
                    row["Modalidad"] = obj.nHonorario;
                    row[FechaEjecucion] = obj.FechaConclusion != null ? obj.FechaConclusion.GetValueOrDefault().ToString("dd/MMM/yyyy", CultureInfo.CreateSpecificCulture("en-GB")) : "-";
                    row["Fecha Cancelación"] = obj.FechaPago != null ? obj.FechaPago.GetValueOrDefault().ToString("dd/MMM/yyyy", CultureInfo.CreateSpecificCulture("en-GB")) : "-";
                    //Dias transcurridos Emisión - Cancelación
                    row[neleCols] = obj.FechaPago != null ? (obj.Ejecutado ? obj.FechaPago.GetValueOrDefault().Subtract(obj.FechaEmision).Days.ToString() : "-") : "-";
                    row["Dias Vencidos"] = obj.Ejecutado ? "0" : obj.FechaConclusion != null ? (FechaActual - obj.FechaConclusion.GetValueOrDefault()).Days.ToString() : "N/A";
                    row["Comentarios"] = obj.Comentario;
                    dt.Rows.Add(row);
                }
                /*if (elem != Ejecutados.Last())
                {
                    DataRow space = dt.NewRow();
                    dt.Rows.Add(space);
                }*/
            }

            string titulo = IdTipoComprobante == 1 ? "Documentos Cobrados y por Cobrar" : "Documentos Pagados y por Pagar";
            string nombreFile = IdTipoComprobante == 1 ? "DocumentosCobrados_y_porCobrar" : "DocumentosPagados_y_porPagar";

            GenerarPdf2(dt, titulo, nombreFile, objEmpresa, FechaInicio, FechaFin, Response);

            return RedirectToAction("ReportesGestion", new { message = 2 });
        }
Esempio n. 10
0
        public ActionResult GenerarRep_FacturacionPorVendedor(DateTime? FechaInicio, DateTime? FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                return RedirectToAction("ReportesGestion", new { message = 1 });
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<ResponsableDTO> lstVendedores = repBL.getFacturacionPorVendedores(objEmpresa.IdEmpresa, FechaInicio, FechaFin);

            if (lstVendedores == null)
                return RedirectToAction("ReportesGestion", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Consultores");
            dt.Columns.Add("Monto con IGV");
            dt.Columns.Add("Monto sin IGV");
            dt.Columns.Add("Porcentaje");

            Decimal SumaTotal = lstVendedores.Sum(x => x.Monto);
            Decimal SumaTotal_SinIGV = lstVendedores.Sum(x => x.MontoSinIGV);

            foreach (var obj in lstVendedores)
            {
                System.Data.DataRow row = dt.NewRow();
                row["Consultores"] = obj.Nombre;
                row["Monto con IGV"] = obj.Monto;
                row["Monto sin IGV"] = obj.MontoSinIGV;
                Decimal porcentaje = SumaTotal == 0 ? 0 : obj.Monto / SumaTotal;
                row["Porcentaje"] = porcentaje.ToString("P2", CultureInfo.InvariantCulture);
                dt.Rows.Add(row);
            }

            System.Data.DataRow rowFinal = dt.NewRow();
            rowFinal["Consultores"] = "TOTAL";
            rowFinal["Monto con IGV"] = SumaTotal.ToString("N2", CultureInfo.InvariantCulture);
            rowFinal["Monto sin IGV"] = SumaTotal_SinIGV.ToString("N2", CultureInfo.InvariantCulture);
            dt.Rows.Add(rowFinal);

            GenerarPdf(dt, "Ventas por Consultores", "VentasPorConsultores", objEmpresa, FechaInicio, FechaFin, Response);

            return RedirectToAction("ReportesGestion", new { message = 2 });
        }
Esempio n. 11
0
        public ActionResult GenerarRep_IngresosEgresosPorAreas(DateTime? FechaInicio, DateTime? FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                return RedirectToAction("ReportesGestion", new { message = 1 });
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<AreaDTO> lstAreasIE = repBL.getIngresosEgresosAreas(objEmpresa.IdEmpresa, FechaInicio, FechaFin);

            if (lstAreasIE == null)
                return RedirectToAction("ReportesGestion", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Áreas");
            //dt.Columns.Add("V/G");
            dt.Columns.Add("Movimiento");
            dt.Columns.Add("Monto Con IGV");
            dt.Columns.Add("Monto Sin IGV");

            foreach (var obj in lstAreasIE)
            {
                if (!(obj.Ingresos == 0 && obj.Egresos == 0))
                { PintarAreasIE(obj, dt); }
            }

            GenerarPdf(dt, "Ventas y Gastos por &Aacute;reas", "VentasYGastosPorAreas", objEmpresa, FechaInicio, FechaFin, Response);

            return RedirectToAction("ReportesGestion", new { message = 2 });
        }
Esempio n. 12
0
        public ActionResult GenerarRep_FacturacionPorAreas(DateTime? FechaInicio, DateTime? FechaFin)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                return RedirectToAction("ReportesGestion", new { message = 1 });
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);

            ReportesBL repBL = new ReportesBL();
            List<AreaDTO> lstAreasMontos = repBL.getAreasEnEmpresa(objEmpresa.IdEmpresa, FechaInicio, FechaFin);

            if (lstAreasMontos == null)
                return RedirectToAction("ReportesGestion", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Áreas");
            dt.Columns.Add("Clientes");
            dt.Columns.Add("Monto con IGV");
            dt.Columns.Add("Monto sin IGV");
            dt.Columns.Add("Porcentaje");

            Decimal SumaTotal = lstAreasMontos.Sum(x => x.SumaClientes);
            Decimal SumaTotal_SinIGV = lstAreasMontos.Sum(x => x.SumaClientes_SinIGV);

            foreach (var obj in lstAreasMontos)
            {
                if (obj.SumaClientes != 0)
                { PintarAreas(obj, SumaTotal, dt); }
            }

            System.Data.DataRow rowFinal = dt.NewRow();
            rowFinal[0] = "TOTAL";
            rowFinal[2] = SumaTotal.ToString("N2", CultureInfo.InvariantCulture);
            rowFinal[3] = SumaTotal_SinIGV.ToString("N2", CultureInfo.InvariantCulture);
            dt.Rows.Add(rowFinal);

            GridView gv = new GridView();

            gv.DataSource = dt;
            gv.AllowPaging = false;
            gv.DataBind();

            if (dt.Rows.Count > 0)
            {
                PintarCabeceraTabla(gv);
                //PintarIntercaladoCategorias(gv);

                AddSuperHeader(gv, "Ventas por &aacute;reas - Empresa:" + objEmpresa.Nombre);
                //Cabecera principal
                AddWhiteHeader(gv, 1, "");
                AddWhiteHeader(gv, 2, "PERIODO: " + FechaInicio.GetValueOrDefault().ToShortDateString() + " - " + FechaFin.GetValueOrDefault().ToShortDateString());
                AddWhiteHeader(gv, 3, "Moneda: (" + objEmpresa.SimboloMoneda + ")");

                //PintarCategorias(gv);

                Response.ClearContent();
                Response.Buffer = true;
                Response.AddHeader("content-disposition", "attachment; filename=" + "VentasPorAreas_" + objEmpresa.Nombre + "_" + DateTime.Now.ToString("dd-MM-yyyy") + ".xls");
                Response.ContentType = "application/ms-excel";
                Response.Charset = "";

                StringWriter sw = new StringWriter();
                HtmlTextWriter htw = new HtmlTextWriter(sw);
                gv.RenderControl(htw);
                Response.Output.Write(sw.ToString());
                Response.Flush();
                Response.End();
                htw.Close();
                sw.Close();
            }
            return RedirectToAction("ReportesGestion", new { message = 2 });
        }
Esempio n. 13
0
        public ActionResult GenerarRep_AvanceDePresupuesto(DateTime FechaInicio, DateTime FechaFin, int periodo)
        {
            if (FechaInicio == null || FechaFin == null)
            {
                return RedirectToAction("ReportesPresupuestos", new { message = 1 });
            }

            EmpresaDTO objEmpresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa);
            PeriodoDTO objPeriodo = (new PeriodoBL()).getPeriodoEnEmpresa(objEmpresa.IdEmpresa, periodo);

            ReportesBL repBL = new ReportesBL();
            List<CategoriaDTO> lstCatsMontos = repBL.AvanceDePresupuesto(objEmpresa.IdEmpresa, FechaInicio, FechaFin);

            //Sumatoria de Presupuestos de Padres y armado de Arbol
            List<CategoriaDTO> lstCats = repBL.getCategoriasTreeEnEmpresa(lstCatsMontos, objEmpresa.IdEmpresa);
            //Arbol de presupuestos
            CategoriaBL catBL = new CategoriaBL();
            //List<CategoriaDTO> arbolPresupuestos = repBL.getCategoriasPresupuestosTreeEnEmpresa(objEmpresa.IdEmpresa, 0);
            List<CategoriaDTO> arbolPresupuestos = repBL.getCategoriasPresupuestosTree_PorPeriodo_EnEmpresa(objEmpresa.IdEmpresa, 0, periodo);

            if (lstCats == null)
                return RedirectToAction("ReportesPresupuestos", new { message = 2 });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Clear();

            dt.Columns.Add("Nivel");
            dt.Columns.Add("Partida de Presupuesto");
            dt.Columns.Add("MONTO SIN IGV");
            dt.Columns.Add("PRESUPUESTO SIN IGV");
            dt.Columns.Add("EJECUCION DEL PRESUPUESTO");

            //Suma de Padres de Nivel 0
            //Decimal SumaPadres0 = lstCatsMontos.Where(x => x.IdCategoriaPadre == null).Sum(x => x.Presupuesto.GetValueOrDefault());
            //Decimal SumaPresupuesto = arbolPresupuestos.Sum(x => x.Presupuesto.GetValueOrDefault());

            /*System.Data.DataRow auxRow = dt.NewRow();
            auxRow[0] = ""; auxRow[1] = ""; auxRow[2] = SumaPadres0.ToString("N2", CultureInfo.InvariantCulture); auxRow[3] = SumaPresupuesto.ToString("N2", CultureInfo.InvariantCulture); auxRow[4] = (SumaPresupuesto == 0) ? "0.00%" : (SumaPresupuesto / SumaPresupuesto).ToString("P2", CultureInfo.InvariantCulture);
            dt.Rows.Add(auxRow);*/

            foreach (var obj in arbolPresupuestos)
            {
                PintarArbolPadre(obj, lstCatsMontos, objEmpresa, dt);
            }

            GridView gv = new GridView();

            gv.DataSource = dt;
            gv.AllowPaging = false;
            gv.DataBind();

            if (dt.Rows.Count > 0)
            {
                PintarCabeceraTabla(gv);
                //PintarIntercaladoCategorias(gv);

                AddSuperHeader(gv, "Ejecucion de Presupuesto - Empresa:" + objEmpresa.Nombre);
                //Cabecera principal
                //AddWhiteHeader(gv, 1, "");
                AddWhiteHeader(gv, 1, "FECHAS: " + FechaInicio.ToShortDateString() + " - " + FechaFin.ToShortDateString());
                AddWhiteHeader(gv, 2, "PERIODO: " + objPeriodo.Nombre + " (" + objPeriodo.FechaInicio.ToShortDateString() + " - " + objPeriodo.FechaFin.ToShortDateString() + ")");
                AddWhiteHeader(gv, 3, "MONEDA: (" + objEmpresa.SimboloMoneda + ")");

                PintarCategorias(gv);

                Response.ClearContent();
                Response.Buffer = true;
                Response.AddHeader("content-disposition", "attachment; filename=" + "EjecucionDePresupuesto_" + objEmpresa.Nombre + "_" + DateTime.Now.ToString("dd-MM-yyyy") + ".xls");
                Response.ContentType = "application/ms-excel";
                Response.Charset = "";

                StringWriter sw = new StringWriter();
                HtmlTextWriter htw = new HtmlTextWriter(sw);
                gv.RenderControl(htw);
                Response.Output.Write(sw.ToString());
                Response.Flush();
                Response.End();
                htw.Close();
                sw.Close();
            }
            return RedirectToAction("ReportesPresupuestos", new { message = 2 });
        }