示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptEmployeeMonth rpt = new rptEmployeeMonth();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnShow_Click(object sender, EventArgs e)
        {
            rptEmployeeMonth       oRpt = new rptEmployeeMonth();
            ParameterFields        ps   = new ParameterFields();
            ParameterField         p    = new ParameterField();
            ParameterDiscreteValue pdc  = new ParameterDiscreteValue();

            SetDBLogonForReport(oRpt);
            p.Name    = "@mCod";
            pdc.Value = Convert.ToInt32(cmbMonthTab2.SelectedValue);
            p.CurrentValues.Add(pdc);
            ps.Add(p);
            ParameterField         p2   = new ParameterField();
            ParameterDiscreteValue pdc2 = new ParameterDiscreteValue();

            p2.Name    = "@empid";
            pdc2.Value = Convert.ToInt32(cmbEmpTab2.SelectedValue);
            p2.CurrentValues.Add(pdc2);
            ps.Add(p2);
            ParameterField         p3   = new ParameterField();
            ParameterDiscreteValue pdc3 = new ParameterDiscreteValue();

            p3.Name    = "@status";
            pdc3.Value = cmbFlag.SelectedValue.ToString();
            p3.CurrentValues.Add(pdc3);
            ps.Add(p3);
            ParameterField         p5   = new ParameterField();
            ParameterDiscreteValue pdc5 = new ParameterDiscreteValue();

            p5.Name = "@All";
            if (rbShowAll.Checked == true)
            {
                pdc5.Value = 1;
            }
            else
            {
                pdc5.Value = 0;
            }
            p5.CurrentValues.Add(pdc5);
            ps.Add(p5);
            ParameterField         p4   = new ParameterField();
            ParameterDiscreteValue pdc4 = new ParameterDiscreteValue();

            p4.Name = "@YorN";
            string YorN = "N";

            if (rbEqual.Checked == true)
            {
                YorN = "Y";
            }
            pdc4.Value = YorN;
            p4.CurrentValues.Add(pdc4);
            ps.Add(p4);
            crystalReportViewer1.ParameterFieldInfo = ps;
            crystalReportViewer1.ReportSource       = oRpt;
            crystalReportViewer1.Show();
        }