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

            rpt.Site = this.Site;
            return(rpt);
        }
Beispiel #2
0
        private void BtnPrintPreview_Click(object sender, EventArgs e)
        {
            //DataTable dt = new DataTable();

            string sort = "";

            if (radioButton1.Checked)
            {
                sort = "Order by [NAME],DATE,[Enter Time]";
            }
            if (radioButton2.Checked)
            {
                sort = "Order by [CARD],DATE,[Enter Time]";
            }
            if (radioButton3.Checked)
            {
                sort = "Order by DATE,[Enter Time]";
            }
            if (radioButton4.Checked)
            {
                sort = "Order by Department,[CARD],DATE,[Enter Time]";
            }


            _cmd = new SqlCommand(Str + sort, frmMainForm._MasterCon);
            _cmd.CommandTimeout = 2000;
            //Str = "select CARD,NAME,JOB,Department,DATE,[Enter Time],[Exit Time],[WORK HOURS] from VTransaction_IN_OUT_FINAL " + FilterString;
            _da = new SqlDataAdapter(_cmd);
            _Dt = new DataTable();
            _Dt.Reset();
            _da.Fill(_Dt);

            //////////////////////////////////////////////////////


            /////////////////////////////////////////////////////////////////////

            frmReportViewer2 Viewer = new frmReportViewer2();

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

                return;
            }


            if (checkBoxSHIFT.Checked)
            {
                EmpShiftTransRpt EmpSHIFTTransRpt = new EmpShiftTransRpt();
                EmpSHIFTTransRpt.Database.Tables["VSHIFT_FINAL"].SetDataSource(_Dt);
                EmpSHIFTTransRpt.SetParameterValue(EmpSHIFTTransRpt.Parameter_From.ParameterFieldName, dtpDateFrom.Text);
                EmpSHIFTTransRpt.SetParameterValue(EmpSHIFTTransRpt.Parameter_To.ParameterFieldName, dtpDateTo.Text);
                Viewer.crystalReportViewer1.ReportSource = EmpSHIFTTransRpt;
            }
            else
            {
                EmpTransRpt EmpTransRpt = new EmpTransRpt();
                EmpTransRpt.Database.Tables["VTransaction_IN_OUT_FINAL"].SetDataSource(_Dt);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, dtpDateFrom.Text);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_To.ParameterFieldName, dtpDateTo.Text);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_ca_start.ParameterFieldName, maskedTextBox1.Text);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_ca_end.ParameterFieldName, maskedTextBox2.Text);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_ps_start.ParameterFieldName, maskedTextBox3.Text);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_ps_end.ParameterFieldName, maskedTextBox4.Text);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_service_start.ParameterFieldName, maskedTextBox5.Text);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_service_end.ParameterFieldName, maskedTextBox6.Text);
                Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
            }
            Viewer.ShowDialog();
        }