Ejemplo n.º 1
0
        private void actionFilter(TypeReportView typeReport)
        {
            var cliente = gridViewCliente.GetFocusedRow <CliFor>();

            this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
            if (barToggleSwitchCliente.Checked && cliente == null)
            {
                XMessageIts.Mensagem("Informe o cliente antes de consultar ou desmarque a opção: \"Filtra Por Cliente\"");
            }
            else
            {
                if (barToggleSwitchCliente.Checked == false)
                {
                    cliente = null;
                }


                if (lookUpFilial1.Matriz == null || lookUpFilial1.Matriz.IdMatriz == 0)
                {
                    XMessageIts.Mensagem("Selecione a filial para continuar !");
                }
                else
                {
                    //gera os parametros pro relatório relatorios
                    //encapsula e obtem os paramentros
                    var param = indexarParam(cliente);

                    string reportName = "ReportLancamentosFinanceiros";

                    if (cbAgrupar.SelectedIndex == 1)
                    {
                        reportName = "ReportLancamentosFinanceirosAgrupado";
                    }

                    //cria o relatorio e avise que nao precisa setar parametros padrão
                    XtraReport report = ReportUtil.CreateReportByName(reportName, false);

                    if (report != null)
                    {
                        //seta os paramentros
                        param.SetParams(report);

                        //gera relatorio
                        ReportUtil.ShowPreviewReport(report);
                    }
                }
            }
            this.Cursor = System.Windows.Forms.Cursors.Default;
        }
Ejemplo n.º 2
0
        private void ActionFilter(TypeReportView typeReport)
        {
            var status    = findStatusVenda();
            var preFiltro = findPreFiltro();
            var agrupar   = findAgrupamento();
            var cliente   = gridViewCliente.GetFocusedRow <CliFor>();


            if (barToggleSwitchCliente.Checked && cliente == null)
            {
                XMessageIts.Mensagem("Informe o cliente antes de consultar ou desmarque a opção: \"Filtra Por Cliente\"");

                //filtre pelo cliente
                return;
            }
            else if (barToggleSwitchCliente.Checked == false)
            {
                cliente = null;
            }

            if (cliente != null)
            {
                //gera relatorio
                if (typeReport == TypeReportView.Report)
                {
                    new RptVendasPorCliente(cliente, dtInicio.Value, dtFinal.Value, status, agrupar).Run();
                }
                //exiba no grid
                else
                {
                    var result = _vendaFilter
                                 .FindVendasByPeriodo(cliente, dtInicio.Value, dtFinal.Value,
                                                      status, agrupar);

                    var vendas = result != null?result.ToList() : null;

                    new XFrmProducaoVendas(vendas).Show();
                }
            }
            //filtra pelo status
            //os filtro predefinidos se encarregam de indexar as datas
            else
            {
                if (typeReport == TypeReportView.Report)
                {
                    //filtra pelo status
                    //o filtro por periodo é habilitado e preenchido automaticamente
                    //pelas opções do usuário
                    new RptSinteticoVenda(dtInicio.Value, dtFinal.Value, status, agrupar).Run();
                }

                else
                {
                    //exiba no grid
                    var result = _vendaFilter
                                 .FindVendasByPeriodo(dtInicio.Value, dtFinal.Value, status, agrupar);

                    var vendas = result != null?result.ToList() : null;

                    new XFrmProducaoVendas(vendas).Show();
                }
            }
        }