Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     CrystalDecisions.CrystalReports.Engine.ReportClass report = this.ContratoEmpreteiro1;
     CrystalDecisions.Shared.ParameterField             parm;
     parm = report.ParameterFields["Contrato"];
     parm.CurrentValues.Clear();
     parm.CurrentValues.AddValue(TxtBoxContrato.Text);
     report.SetDatabaseLogon("scoop", "scoop", @"PMC0091SRVSIPA1", "scoop");
     crystalReportViewer1.ReportSource = report;
     crystalReportViewer1.Refresh();
 }
 private void GerarButton_Click(object sender, EventArgs e)
 {
     if (!checkBox1.Checked)
     {
         CrystalDecisions.CrystalReports.Engine.ReportClass report = this.ServicoMedicao1;
         CrystalDecisions.Shared.ParameterField             parm;
         parm = report.ParameterFields["DataInicial"];
         parm.CurrentValues.Clear();
         parm.CurrentValues.AddValue(DataInicialDTP.Value.Date.ToShortDateString());
         parm = report.ParameterFields["DataFinal"];
         parm.CurrentValues.AddValue(DataFinalDTP.Value.Date.ToShortDateString());
         report.SetDatabaseLogon("scoop", "scoop", @"pmc0091srvsipa1", "scoop");
         crystalReportViewer1.ReportSource = report;
         crystalReportViewer1.Refresh();
     }
     else
     {
         CrystalDecisions.CrystalReports.Engine.ReportClass report = this.ServicoMedicaoTOP1;
         report.SetDatabaseLogon("scoop", "scoop", @"pmc0091srvsipa1", "scoop");
         crystalReportViewer1.ReportSource = report;
         crystalReportViewer1.Refresh();
     }
 }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            CrystalDecisions.CrystalReports.Engine.ReportClass report = this.RelatorioMedicao1;
            this.RelatorioMedicao1.RecordSelectionFormula = "";
            if (DotacaoFiltro != null)
            {
                this.RelatorioMedicao1.RecordSelectionFormula = DotacaoFiltro;
                if (TipoObraFiltro != null)
                {
                    this.RelatorioMedicao1.RecordSelectionFormula += " and " + TipoObraFiltro;
                    if (BairroFiltro != null)
                    {
                        this.RelatorioMedicao1.RecordSelectionFormula += " and " + BairroFiltro;
                        if (EmpreteiraFiltro != null)
                        {
                            this.RelatorioMedicao1.RecordSelectionFormula += " and " + EmpreteiraFiltro;
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                        else
                        {
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                    }
                    else
                    {
                        if (EmpreteiraFiltro != null)
                        {
                            this.RelatorioMedicao1.RecordSelectionFormula += " and " + EmpreteiraFiltro;
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                        else
                        {
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                    }
                }
                else
                {
                    if (BairroFiltro != null)
                    {
                        this.RelatorioMedicao1.RecordSelectionFormula += " and " + BairroFiltro;
                        if (EmpreteiraFiltro != null)
                        {
                            this.RelatorioMedicao1.RecordSelectionFormula += " and " + EmpreteiraFiltro;
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                        else
                        {
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                    }
                }
            }
            else
            {
                if (TipoObraFiltro != null)
                {
                    this.RelatorioMedicao1.RecordSelectionFormula += TipoObraFiltro;
                    if (BairroFiltro != null)
                    {
                        this.RelatorioMedicao1.RecordSelectionFormula += " and " + BairroFiltro;
                        if (EmpreteiraFiltro != null)
                        {
                            this.RelatorioMedicao1.RecordSelectionFormula += " and " + EmpreteiraFiltro;
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                        else
                        {
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                    }
                    else
                    {
                        if (EmpreteiraFiltro != null)
                        {
                            this.RelatorioMedicao1.RecordSelectionFormula += " and " + EmpreteiraFiltro;
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                        else
                        {
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                    }
                }
                else
                {
                    if (BairroFiltro != null)
                    {
                        this.RelatorioMedicao1.RecordSelectionFormula += BairroFiltro;
                        if (EmpreteiraFiltro != null)
                        {
                            this.RelatorioMedicao1.RecordSelectionFormula += " and " + EmpreteiraFiltro;
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                        else
                        {
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";;
                            }
                        }
                    }
                    else
                    {
                        if (EmpreteiraFiltro != null)
                        {
                            this.RelatorioMedicao1.RecordSelectionFormula += EmpreteiraFiltro;
                            if (PeriodoFiltro != null)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula += " and {Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";
                            }
                        }
                        else
                        {
                            if (!PeriodoChkBox.Checked)
                            {
                                this.RelatorioMedicao1.RecordSelectionFormula = "{Medicao.Dt_Criacao} in DateTime (" + DtInicialdateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ") to DateTime (" + DtFinaldateTimePicker.Value.Date.ToString("yyyy,MM,dd,HH,mm,ss") + ")";
                            }
                        }
                    }
                }
            }

            this.RelatorioMedicao1.Refresh();


            CrystalDecisions.Shared.ParameterField parm;
            parm = report.ParameterFields["Filtro"];
            parm.CurrentValues.Clear();
            parm.CurrentValues.AddValue(DotacaoFiltro == ""?"":"Dotação Orçamentaria" + " " + TipoObraFiltro == ""?"":"Tipo Orçamento" + " " + BairroFiltro == ""?"":"Bairro" + " " + EmpreteiraFiltro == ""?"":"Empreteira" + " " + PeriodoFiltro == ""?"":"Periodo ");
            report.SetDatabaseLogon("scoop", "scoop", @"PMC0091SRVSIPA1", "scoop", true);
            crystalReportViewer1.ReportSource = report;
            crystalReportViewer1.Refresh();
        }