Esempio n. 1
0
        public InformeVentasPorcentualPeriodoxClienteRpt GetVentasPorcentualPeriodoxClienteReport(VentasList list, QueryConditions conditions)
        {
            List <VentasInfo> pList = new List <VentasInfo>();

            foreach (VentasInfo item in list)
            {
                pList.Add(item);
            }

            if (pList.Count == 0)
            {
                return(null);
            }

            InformeVentasPorcentualPeriodoxClienteRpt doc = new InformeVentasPorcentualPeriodoxClienteRpt();

            doc.SetDataSource(pList);

            FormatHeader(doc);

            return(doc);
        }
        protected void PorcentualAction(Library.Invoice.QueryConditions conditions, string filtro)
        {
            bool   detalle = Detallado_RB.Checked;
            string title   = this.Text;

            if (PorcentualBeneficios_RB.Checked)
            {
                title = "Informe Estadístico: Porcentual de Beneficios";
            }
            else if (PorcentualVentas_RB.Checked)
            {
                title = "Informe Estadísitico: Porcentual de Ventas";
            }
            if (!AgruparMeses_CB.Checked)
            {
                title += " por Periodo";
            }
            CommonReportMng reportMng = new CommonReportMng(AppContext.ActiveSchema, title, filtro);

            ReportFormat format = new ReportFormat();

            format.Orden = CrystalDecisions.Shared.SortDirection.DescendingOrder;

            if (Cliente_RB.Checked)
            {
                if (detalle)
                {
                    if (PorcentualVentas_RB.Checked)
                    {
                        if (AgruparMeses_CB.Checked)
                        {
                            _list = VentasList.GetListByClientePorcentualVenta(conditions);
                        }
                        else
                        {
                            _list = VentasList.GetListByClientePorcentualVentaPeriodo(conditions);
                        }
                    }
                    else if (PorcentualBeneficios_RB.Checked)
                    {
                        if (AgruparMeses_CB.Checked)
                        {
                            _list = VentasList.GetListByClientePorcentualBeneficio(conditions);
                        }
                        else
                        {
                            _list = VentasList.GetListByClientePorcentualBeneficioPeriodo(conditions);
                        }
                    }

                    if (AgruparMeses_CB.Checked)
                    {
                        PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

                        InformeVentasPorcentualxClienteRpt rpt = reportMng.GetVentasPorcentualxClienteReport(_list, conditions);
                        PgMng.FillUp();

                        if (Informe_RB.Checked)
                        {
                            ShowReport(rpt);
                        }
                        else
                        {
                            ShowClientesChart();
                        }
                    }
                    else
                    {
                        PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

                        InformeVentasPorcentualPeriodoxClienteRpt rpt = reportMng.GetVentasPorcentualPeriodoxClienteReport(_list, conditions);
                        PgMng.FillUp();

                        if (Informe_RB.Checked)
                        {
                            ShowReport(rpt);
                        }
                    }
                }
            }
            else if (Producto_RB.Checked)
            {
                if (PorcentualVentas_RB.Checked)
                {
                    _list = VentasList.GetListByProductoPorcentualVenta(conditions);
                }
                else if (PorcentualBeneficios_RB.Checked)
                {
                    _list = VentasList.GetListByProductoPorcentualBeneficio(conditions);
                }

                PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

                InformeVentasPorcentualxProductoRpt rpt = reportMng.GetVentasPorcentualxProductoReport(_list, conditions);
                PgMng.FillUp();

                if (Informe_RB.Checked)
                {
                    ShowReport(rpt);
                }
                else
                {
                    ShowProductosChart();
                }
            }
        }