示例#1
0
        private void CrystalReport2()
        {
            Cursor.Current = Cursors.WaitCursor;

            string strServer   = "tcp:192.168.1.100,49172";
            string strDatabase = "SrisDb";
            string strUserId   = "miso_server";
            string strPwd      = "miso4321";

            var month = metroComboBox1.GetItemText(metroComboBox1.SelectedItem);
            var year  = metroComboBox2.GetItemText(metroComboBox2.SelectedItem);


            crystalReportViewer1.SelectionFormula = "monthname(month({ServiceRequestInfoes.DateAccomplished})) Like '*" + month + "*'" + " AND " +
                                                    "Year({ServiceRequestInfoes.DateAccomplished})= " + year +
                                                    " AND {ServiceRequestInfoes.Status} = True";

            rpt_Monthly report1 = new rpt_Monthly();

            report1.DataSourceConnections[0].SetConnection(strServer, strDatabase, strUserId, strPwd);
            report1.SetParameterValue("MonthLabel", month);
            // report1.SetParameterValue("param_year", year);

            crystalReportViewer1.ShowPrintButton  = true;
            crystalReportViewer1.ShowExportButton = true;
            crystalReportViewer1.ReportSource     = report1;
            Cursor.Current = Cursors.Default;
        }
示例#2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rpt_Monthly rpt = new rpt_Monthly();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#3
0
        private void bt_MonthlyReport_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            var month = metroComboBox1.GetItemText(metroComboBox1.SelectedItem);
            var year  = metroComboBox2.GetItemText(metroComboBox2.SelectedItem);

            crystalReportViewer1.SelectionFormula = "monthname(month({ServiceRequestInfoes.DateAccomplished})) Like '*" + month + "*'" + " AND " + "Year({ServiceRequestInfoes.DateAccomplished})= " + year + "";
            //crystalReportViewer1.SelectionFormula = "monthname(month({ServiceRequestInfoes.DateAccomplished})) Like '*" + month + "*'";
            rpt_Monthly report1 = new rpt_Monthly();

            report1.SetParameterValue("MonthLabel", month);

            crystalReportViewer1.ShowPrintButton  = true;
            crystalReportViewer1.ShowExportButton = true;
            crystalReportViewer1.ReportSource     = report1;
            Cursor.Current = Cursors.Default;
        }