Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            AllTransRpt rpt = new AllTransRpt();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void glassButton1_Click(object sender, EventArgs e)
        {
            string sort = "";

            if (radioButton1.Checked)
            {
                sort = "Order by [Employee Name],[Transaction Date]";
            }
            if (radioButton2.Checked)
            {
                sort = "Order by [Card Number],[Transaction Date]";
            }
            if (radioButton3.Checked)
            {
                sort = "Order by [Transaction Date]";
            }
            if (radioButton4.Checked)
            {
                sort = "Order by Department,[Card Number],[Transaction Date]";
            }

            _cmd = new SqlCommand(Str2 + sort, frmMainForm._MasterCon);
            //Str = "select [Employee Name] ,[Card Number],[Transaction Date],Time,Place,Job,Department from VTransactions " + FilterString;
            _cmd.CommandTimeout = 2000;
            _da = new SqlDataAdapter(_cmd);
            _Dt = new DataTable();
            _Dt.Reset();

            _da.Fill(_Dt);

            //////////////////////////////////////////////////////
            AllTransRpt EmpTransRpt = new AllTransRpt();
            //EmpTransRptAr EmpTransRptAr = new EmpTransRptAr();

            /////////////////////////////////////////////////////////////////////
            frmReportViewer2 Viewer = new frmReportViewer2();

            if (_Dt.Rows.Count == 0)
            {
                MessageBox.Show("Message_No_Records", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //////////////////////////////////////////////////////

            EmpTransRpt.Database.Tables["VAllTrans"].SetDataSource(_Dt);
            EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, dtpDateFrom.Text);
            EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_To.ParameterFieldName, dtpDateTo.Text);
            Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
            Viewer.ShowDialog();
            //////////////////////////////////////////////////////
            //////////////////////////////////////////////////////
        }