Exemplo n.º 1
0
        public void DocVentaDev_ResumenMensual(int idEmpresa, int codigoUsuario, DateTime fechaInicio, DateTime fechaFinal, ref List <NotaCreditoKPIBE> lstKPI)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();
            List <gsDocVentaDev_ReporteDevMesResult> lstNotasCredito;
            List <NotaCreditoKPIBE> lstKPIPrevio = new List <NotaCreditoKPIBE>();
            int mes, anho;

            try
            {
                lstNotasCredito = objDocVentaBL.DocVentaDev_ReporteDevMes(idEmpresa, codigoUsuario, null, fechaInicio, fechaFinal);
                mes             = fechaInicio.Month;
                anho            = fechaInicio.Year;
                for (int i = anho * 100 + mes; i <= fechaFinal.Year * 100 + fechaFinal.Month; i = fechaInicio.Year * 100 + fechaInicio.Month)
                {
                    NotaCreditoKPIBE objNotaCreditoKPIBE = new NotaCreditoKPIBE();
                    objNotaCreditoKPIBE.Periodo  = fechaInicio.Year.ToString() + "-" + fechaInicio.Month.ToString();
                    objNotaCreditoKPIBE.Total    = (decimal)lstNotasCredito.FindAll(x => x.Mes == fechaInicio.Month && x.Anho == fechaInicio.Year).Sum(x => x.Neto);
                    objNotaCreditoKPIBE.TotalMes = (decimal)lstNotasCredito.FindAll(x => x.Mes == fechaInicio.Month && x.Anho == fechaInicio.Year && x.MesOrigen == fechaInicio.Month && x.AnhoOrigen == fechaInicio.Year).Sum(x => x.Neto);
                    fechaInicio = fechaInicio.AddMonths(1);
                    if (objNotaCreditoKPIBE.Total != 0)
                    {
                        lstKPIPrevio.Add(objNotaCreditoKPIBE);
                    }
                }
                lstKPI = lstKPIPrevio;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public void Rentabilidad_Producto(int idEmpresa, int codigoUsuario, DateTime fechaInicio, DateTime fechaFinal,
                                          ref List <DocVenta_RentaProdBE> lstRentaProd, ref gsConfigIndicadores_RentabilidadResult objConfigIndRenta)
        {
            DocVentaBL objDocVentaBL             = new DocVentaBL();
            List <DocVenta_RentaProdBE> lstRenta = new List <DocVenta_RentaProdBE>();

            try
            {
                ConfigIndicadoresBL objConfigIndicadoresBL = new ConfigIndicadoresBL();
                objConfigIndRenta = objConfigIndicadoresBL.ConfigIndicadores_Rentabilidad(idEmpresa, codigoUsuario, fechaFinal);

                gsDocVenta_ReporteVenta_MesResult mes = objDocVentaBL.DocVenta_ReporteVenta_Mes(idEmpresa, codigoUsuario, fechaInicio, fechaFinal).Single();
                List <gsDocVenta_ReporteVenta_MarcaProductoResult> lstProductos = objDocVentaBL.DocVenta_ReporteVenta_MarcaProducto(idEmpresa, codigoUsuario, null, null, null, fechaInicio, fechaFinal).FindAll(x => !string.IsNullOrEmpty(x.Descripcion));

                foreach (gsDocVenta_ReporteVenta_MarcaProductoResult producto in lstProductos)
                {
                    DocVenta_RentaProdBE objProductoBE = new DocVenta_RentaProdBE();
                    objProductoBE.Kardex       = Convert.ToInt32(producto.Kardex);
                    objProductoBE.Descripcion  = producto.Descripcion.Replace('\n', ' ');
                    objProductoBE.Rentabilidad = (decimal)producto.Rentabilidad;
                    if ((decimal)mes.ValorVenta > 0)
                    {
                        objProductoBE.PorcVenta = (decimal)producto.ValorVenta / (decimal)mes.ValorVenta * 100;
                    }
                    else
                    {
                        objProductoBE.PorcVenta = 0;
                    }
                    if (objProductoBE.Rentabilidad >= objConfigIndRenta.rentabilidadAlta)
                    {
                        if (objProductoBE.PorcVenta >= objConfigIndRenta.ventaAlta)
                        {
                            objProductoBE.Categoria = "VARA";
                        }
                        else
                        {
                            objProductoBE.Categoria = "VBRA";
                        }
                    }
                    else
                    {
                        if (objProductoBE.PorcVenta >= objConfigIndRenta.ventaAlta)
                        {
                            objProductoBE.Categoria = "VARB";
                        }
                        else
                        {
                            objProductoBE.Categoria = "VBRB";
                        }
                    }
                    objProductoBE.ValorVenta = (decimal)producto.ValorVenta;
                    lstRenta.Add(objProductoBE);
                }
                lstRentaProd = lstRenta;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public List <gsDocVenta_ReporteVenta_VendedorV2Result> DocVenta_ReporteVenta_VendedorZona(int idEmpresa, int codigoUsuario, string ID_Vendedor, DateTime fechaInicio, DateTime fechaFinal)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try {
                return(objDocVentaBL.DocVenta_ReporteVenta_VendedorZona(idEmpresa, codigoUsuario, ID_Vendedor, fechaInicio, fechaFinal));
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Exemplo n.º 4
0
        //[WebGet(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "ReporteVenta_ListarVendedores/{idEmpresa}/{codigoUsuario}/{mes}/{anho}")]
        public List <gsDocVenta_ReporteVenta_VendedorResult> ReporteVenta_ListarVendedores(string idEmpresa, string codigoUsuario, string ID_Vendedor, string mes, string anho)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try {
                return(objDocVentaBL.DocVenta_ReporteVenta_Vendedor(int.Parse(idEmpresa), int.Parse(codigoUsuario), ID_Vendedor, DateTime.Now.AddMonths(-1), DateTime.Now));
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Exemplo n.º 5
0
        public List <gsDocVenta_ListarResult> DocVenta_Listar(int idEmpresa, int codigoUsuario, DateTime fechaInicio, DateTime fechaFinal, string ID_Vendedor)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.DocVenta_Listar(idEmpresa, codigoUsuario, fechaInicio, fechaFinal, ID_Vendedor));
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Exemplo n.º 6
0
        public List <gsDocVenta_ReporteVenta_MarcaVendedor_InatecResult> DocVenta_ReporteVenta_MarcaVendedorInatec(int idEmpresa, int codigoUsuario, int?ID_Marca, DateTime fechaInicio, DateTime fechaFinal)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.DocVenta_ReporteVenta_MarcaVendedorInatec(idEmpresa, codigoUsuario, ID_Marca, fechaInicio, fechaFinal));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 7
0
        public List <gsReporteVentaPresupuesto_Producto2017Result> gsReporteVentaPresupuesto_Producto2017(int idEmpresa, int codigoUsuario, int anho, int mes, string id_vendedor)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.gsReporteVentaPresupuesto_Producto2017(idEmpresa, codigoUsuario, anho, mes, id_vendedor));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 8
0
        public List <gsReporte_PresupuestoVentasParetoResult> gsReporte_PresupuestoVentasPareto(int idEmpresa, int codigoUsuario, int anho1, int anho2, int mes1, int mes2, int id_zona, string id_vendedor, bool flag_Semillas)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.gsReporte_PresupuestoVentasPareto(idEmpresa, codigoUsuario, anho1, anho2, mes1, mes2, id_zona, id_vendedor, flag_Semillas));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 9
0
        public List <gsPronostico_Reporte_Planeamiento_MarcaResult> Pronostico_Planeamiento_Marca(int idEmpresa, int codigoUsuario, DateTime FechaDesde, DateTime FechaHasta, int id_zona, string id_vendedor)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.Pronostico_Planeamiento_Marca(idEmpresa, codigoUsuario, FechaDesde, FechaHasta, id_zona, id_vendedor));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 10
0
        public List <gsReporteVentaPresupuesto_ProductoResult> gsReporte_PronosticoVentas(int idEmpresa, int codigoUsuario, int anho, int mes, int id_zona)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.gsReporte_PronosticoVentas(idEmpresa, codigoUsuario, anho, mes, id_zona));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 11
0
        public List <gsVentaPronostico_vs_RealResult> gsVentaPronostico_vs_Real(int idEmpresa, int codigoUsuario, DateTime FechaDesde, DateTime FechaHasta, int id_zona, string id_vendedor)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.gsVentaPronostico_vs_Real(idEmpresa, codigoUsuario, FechaDesde, FechaHasta, id_zona, id_vendedor));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 12
0
        public List <gsDocVenta_ConsultarVentaMarcaResult> DocVenta_ConsultarVentaMarca(int idEmpresa, int codigoUsuario, string ID_Cliente, DateTime fechaInicio, DateTime fechaFinal)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.DocVenta_ConsultarVentaMarca(idEmpresa, codigoUsuario, ID_Cliente, fechaInicio, fechaFinal));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <gsDocVenta_ListarTransGratuitasResult> DocVenta_ListarTransGratuitas(int idEmpresa, int codigoUsuario, DateTime fechaInicio, DateTime fechaFinal)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.DocVenta_ListarTransGratuitas(idEmpresa, codigoUsuario, fechaInicio, fechaFinal));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 14
0
        public gsDocVenta_BuscarResult DocVenta_Buscar(int idEmpresa, int codigoUsuario, decimal Op, ref List <gsDocVenta_BuscarDetalleResult> lstDetalle)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.DocVenta_Buscar(idEmpresa, codigoUsuario, Op, ref lstDetalle));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 15
0
        public List <gsDocVenta_ControlCosto_MarcaProductoResult> DocVenta_ControlCosto_MarcaProducto(int idEmpresa, int codigoUsuario, DateTime fechaInicio, DateTime fechaFinal, int?kardex)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.DocVenta_ControlCosto_MarcaProducto(idEmpresa, codigoUsuario, fechaInicio, fechaFinal, kardex));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 16
0
        public List <ReporteVentas_R3_1Result> ReporteVentas_R3_1(int idEmpresa, int codigoUsuario, DateTime FechaDesde, DateTime FechaHasta, int id_zona, string id_vendedor)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.ReporteVentas_R3_1(idEmpresa, codigoUsuario, FechaDesde, FechaHasta, id_zona, id_vendedor));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 17
0
        public List <gsReporte_ProyeccionVentasParetoResult> gsReporte_ProyeccionVentasPareto(int idEmpresa, int codigoUsuario, int anhoAnterior, int AnhoActual, int mesInicio, int mesFinal, int id_zona)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.gsReporte_ProyeccionVentasPareto(idEmpresa, codigoUsuario, anhoAnterior, AnhoActual, mesInicio, mesFinal, id_zona));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 18
0
        public List <gsDocVenta_ReporteVenta_MarcaProductoResult> DocVenta_ReporteVenta_MarcaProducto(int idEmpresa, int codigoUsuario, int?ID_Marca, int?ID_Zona, string ID_Cliente, DateTime fechaInicio, DateTime fechaFinal)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                return(objDocVentaBL.DocVenta_ReporteVenta_MarcaProducto(idEmpresa, codigoUsuario, ID_Marca, ID_Zona, ID_Cliente, fechaInicio, fechaFinal));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 19
0
        public void PresupuestadoVentas_RegistrarBulkCopy(int idEmpresa, int codigoUsuario, DateTime Fecha, int Id_Zona, string Id_Vendedor, string Id_Cliente, int moneda, DataTable tabla)
        {
            DocVentaBL objDocVentaBL;

            try
            {
                objDocVentaBL = new DocVentaBL();
                objDocVentaBL.PresupuestoVentas_RegistrarBulkCopy(idEmpresa, codigoUsuario, Fecha, Id_Zona, Id_Vendedor, Id_Cliente, moneda, tabla);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 20
0
 public List <gsPresupuesto_ZonaResult> Presupuesto_Zona(int idEmpresa, int codigoUsuario, DateTime FechaDesde, DateTime FechaHasta, int id_zona, string id_vendedor)
 {
     DocVentaBL objDocVentaBL = new DocVentaBL();
     {
         try
         {
             return(objDocVentaBL.Presupuesto_Zona(idEmpresa, codigoUsuario, FechaDesde, FechaHasta, id_zona, id_vendedor));
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Exemplo n.º 21
0
        public void Zona_Registrar(int idEmpresa, int codigoUsuario, int idPermiso, int id_zona, int estado)
        {
            DocVentaBL objDocVentaBL;

            try
            {
                objDocVentaBL = new DocVentaBL();
                objDocVentaBL.Zona_Registrar(idEmpresa, codigoUsuario, idPermiso, id_zona, estado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 22
0
        public void ProyectadoVentas_Registrar(int idEmpresa, int codigoUsuario, int ID_Pronostico, DateTime Fecha, int Id_Item, decimal precio, decimal costo, int cantidad, decimal importe, bool aprobacion, int anho, int mes, int Id_Zona, string Id_Vendedor, string Id_Cliente, int moneda)
        {
            DocVentaBL objDocVentaBL;

            try
            {
                objDocVentaBL = new DocVentaBL();
                objDocVentaBL.ProyectadoVentas_Registrar(idEmpresa, codigoUsuario, ID_Pronostico, Fecha, Id_Item, precio, costo, cantidad, importe, true, anho, mes, Id_Zona, Id_Vendedor, Id_Cliente, moneda);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 23
0
        public void DocVentaDev_KPIMotivo(int idEmpresa, int codigoUsuario, DateTime fechaInicio, DateTime fechaFinal, ref List <DocVentaDev_KPIMotivoBE> lstMotivo)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();
            List <gsDocVentaDev_ReporteDevMotivoResult> lstMotivoDet;
            List <DocVentaDev_KPIMotivoBE> lst = new List <DocVentaDev_KPIMotivoBE>();
            decimal total = 0;
            int     conta = 0;

            try
            {
                lstMotivoDet = objDocVentaBL.DocVentaDev_ReporteDevMotivo(idEmpresa, codigoUsuario, null, fechaInicio, fechaFinal);
                if (lstMotivoDet.FindAll(x => x.Mes == fechaFinal.Month && x.Anho == fechaFinal.Year).Sum(x => x.Neto) == 0)
                {
                    lstMotivoDet = lstMotivoDet.FindAll(x => x.Mes == fechaInicio.Month && x.Anho == fechaInicio.Year);
                }
                else
                {
                    lstMotivoDet = lstMotivoDet.FindAll(x => x.Mes == fechaFinal.Month && x.Anho == fechaFinal.Year);
                }
                lstMotivoDet = lstMotivoDet.OrderByDescending(x => x.Neto).ToList();
                total        = (decimal)lstMotivoDet.Sum(x => x.Neto);
                foreach (gsDocVentaDev_ReporteDevMotivoResult motivo in lstMotivoDet)
                {
                    DocVentaDev_KPIMotivoBE objMotivoBE = new DocVentaDev_KPIMotivoBE();
                    objMotivoBE.Motivo     = motivo.Motivo.ToUpper();
                    objMotivoBE.Porcentaje = Math.Round((decimal)(motivo.Neto / total) * 100, 0);
                    objMotivoBE.Monto      = Math.Round((decimal)motivo.Neto, 2);
                    lst.Add(objMotivoBE);
                    conta++;
                    if (conta == 5)
                    {
                        break;
                    }
                }
                if (conta == 5)
                {
                    DocVentaDev_KPIMotivoBE objMotivoBE = new DocVentaDev_KPIMotivoBE();
                    objMotivoBE.Motivo     = "OTROS";
                    objMotivoBE.Porcentaje = 100 - lst.Sum(x => x.Porcentaje);
                    objMotivoBE.Monto      = total - lst.Sum(x => x.Monto);
                    lst.Add(objMotivoBE);
                }
                lstMotivo = lst;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 24
0
        public List <Listar_Unidad_BIResult> Listar_Unidad_BI(int idEmpresa, int codigoUsuario)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                List <Listar_Unidad_BIResult> lista = new List <Listar_Unidad_BIResult>();

                lista = objDocVentaBL.Listar_Unidad_BI(idEmpresa, codigoUsuario);

                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 25
0
        public List <Listar_Zona_BIResult> Listar_Zona_BI(int idEmpresa, int codigoUsuario, DateTime FechaDesde, DateTime FechaHasta, string Nombre_Zona)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                List <Listar_Zona_BIResult> lista = new List <Listar_Zona_BIResult>();

                lista = objDocVentaBL.Listar_Zona_BI(idEmpresa, codigoUsuario, FechaDesde, FechaHasta, Nombre_Zona);

                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 26
0
        public List <ReporteVentas_EstadoResultadosResult> ReporteVentas_Resultados(int idEmpresa, int codigoUsuario, DateTime FechaDesde, DateTime FechaHasta, string Nombre_Zona, string NombreUnidad)
        {
            DocVentaBL objDocVentaBL = new DocVentaBL();

            try
            {
                List <ReporteVentas_EstadoResultadosResult> lista = new List <ReporteVentas_EstadoResultadosResult>();

                lista = objDocVentaBL.ReporteVentas_Resultados(idEmpresa, codigoUsuario, FechaDesde, FechaHasta, Nombre_Zona, NombreUnidad);

                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 27
0
        public int PermisosReportes_Registrar(int idEmpresa, int codigoUsuario, int idUsuario, int idReporte, int Activo)
        {
            DocVentaBL objDocVentaBL;
            int        idPermiso = 0;

            try
            {
                objDocVentaBL = new DocVentaBL();
                idPermiso     = objDocVentaBL.PermisosReportes_Registrar(idEmpresa, codigoUsuario, idUsuario, idReporte, Activo);

                return(idPermiso);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 28
0
        public List <ZonasReporte_ListarResult> ZonasReporte_Listar(int idEmpresa, int codigoUsuario, int idUsuario, int idReporte)
        {
            DocVentaBL objDocVentaBL;

            try
            {
                List <ZonasReporte_ListarResult> lstZonas = new List <ZonasReporte_ListarResult>();
                objDocVentaBL = new DocVentaBL();
                lstZonas      = objDocVentaBL.ZonasReporte_Listar(idEmpresa, codigoUsuario, idUsuario, idReporte);

                return(lstZonas);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 29
0
        public List <ReportesIntranet_ListarResult> ReportesIntranet_Lista(int idUsuario)
        {
            DocVentaBL objDocVentaBL;

            try
            {
                List <ReportesIntranet_ListarResult> list = new List <ReportesIntranet_ListarResult>();
                objDocVentaBL = new DocVentaBL();
                list          = objDocVentaBL.ReportesIntranet_Lista(idUsuario);

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 30
0
        public List <ZonasPermisos_ListarResult> ZonaPersonal_Listar(int idEmpresa, int codigoUsuario, int id_Permiso)
        {
            DocVentaBL objDocVentaBL;

            try
            {
                List <ZonasPermisos_ListarResult> list = new List <ZonasPermisos_ListarResult>();

                objDocVentaBL = new DocVentaBL();
                list          = objDocVentaBL.ZonaPersonal_Listar(idEmpresa, codigoUsuario, id_Permiso);

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }