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

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        private void BtnPrintPreview_Click(object sender, EventArgs e)
        {
            string sort = "";

            /*if (radioButton1.Checked)
             * {
             *  if (rbut_find_in.Checked || rbut_find_out.Checked)
             *  {
             *      sort = " ) Order by [CRD_NAME],[ENT_TIME]";
             *  }
             *  else
             *  {
             *      sort = " ) Order by [CRD_NAME],[TRN_TIME]";
             *  }
             * }
             * if (radioButton2.Checked)
             * {
             *  if (rbut_find_in.Checked || rbut_find_out.Checked||rbut_find_att.Checked||rbut_find_abs.Checked)
             *  {
             *      sort = " ) Order by [CRD_NO]";
             *  }
             *  else
             *  {
             *      sort = " ) Order by [TRN_CARD_NO]";
             *  }
             * }
             * if (radioButton3.Checked)
             * {
             *  if (rbut_find_in.Checked || rbut_find_out.Checked)
             *  {
             *      sort = " ) Order by [ENT_TIME]";
             *  }
             *  else
             *  {
             *      sort = " ) Order by [TRN_TIME]";
             *  }
             * }
             * if (radioButton4.Checked)
             * {
             *  if (rbut_find_in.Checked || rbut_find_out.Checked || rbut_find_att.Checked || rbut_find_abs.Checked)
             *  {
             *      sort = " ) Order by [CRD_DEPARTMENT], [CRD_NO]";
             *  }
             *  else
             *  {
             *      sort = " ) Order by [CRD_DEPARTMENT],[TRN_CARD_NO]";
             *  }
             * }*/

            if (rbut_find_in.Checked || rbut_find_out.Checked)
            {
                _cmd = new SqlCommand(Str, frmMainForm._MasterCon);
                _cmd.CommandTimeout = 2000;
                _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;
                }
                In_COM_Rpt EmpTransRpt = new In_COM_Rpt();
                EmpTransRpt.Database.Tables[0].SetDataSource(_Dt);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, DateTime.Now.ToString("dd/MM/yyyy"));
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_IN_OUT.ParameterFieldName, IN_OUT);
                Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
                Viewer.ShowDialog();
            }
            else if (rbut_find_abs.Checked)
            {
                _cmd = new SqlCommand(Str, frmMainForm._MasterCon);
                _cmd.CommandTimeout = 2000;
                _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;
                }
                Absence_Rpt EmpTransRpt = new Absence_Rpt();
                EmpTransRpt.Database.Tables[0].SetDataSource(_Dt);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, DateTime.Now.ToString("dd/MM/yyyy"));
                Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
                Viewer.ShowDialog();
            }
            else if (rbut_find_att.Checked)
            {
                _cmd = new SqlCommand(Str, frmMainForm._MasterCon);
                _cmd.CommandTimeout = 2000;
                _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;
                }
                Attendance_Rpt EmpTransRpt = new Attendance_Rpt();
                EmpTransRpt.Database.Tables[0].SetDataSource(_Dt);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, DateTime.Now.ToString("dd/MM/yyyy"));
                Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
                Viewer.ShowDialog();
            }
            else if (rbut_OUT.Checked)
            {
                _cmd = new SqlCommand(Str, frmMainForm._MasterCon);
                _cmd.CommandTimeout = 2000;
                _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;
                }
                EmpOutRpt EmpTransRpt = new EmpOutRpt();
                EmpTransRpt.Database.Tables[0].SetDataSource(_Dt);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_DATE1.ParameterFieldName, dtpDateFrom.Value.ToString("dd/MM/yyyy"));
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_DATE2.ParameterFieldName, dtpDateTo.Value.ToString("dd/MM/yyyy"));
                Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
                Viewer.ShowDialog();
            }
        }
Example #3
0
        private void BtnPrintPreview_Click(object sender, EventArgs e)
        {
            if (rbut_find_in.Checked || rbut_find_out.Checked)
            {
                _cmd = new SqlCommand(Str, frmMainForm._MasterCon);
                _cmd.CommandTimeout = 2000;
                _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;
                }
                In_COM_Rpt EmpTransRpt = new In_COM_Rpt();
                EmpTransRpt.Database.Tables[0].SetDataSource(_Dt);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, DateTime.Now.ToString("dd/MM/yyyy"));
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_IN_OUT.ParameterFieldName, IN_OUT);
                Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
                Viewer.ShowDialog();
            }
            else if (rbut_find_abs.Checked)
            {
                _cmd = new SqlCommand(Str, frmMainForm._MasterCon);
                _cmd.CommandTimeout = 2000;
                _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;
                }
                Absence_Rpt EmpTransRpt = new Absence_Rpt();
                EmpTransRpt.Database.Tables[0].SetDataSource(_Dt);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, DateTime.Now.ToString("dd/MM/yyyy"));
                Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
                Viewer.ShowDialog();
            }
            else if (rbut_find_att.Checked)
            {
                _cmd = new SqlCommand(Str, frmMainForm._MasterCon);
                _cmd.CommandTimeout = 2000;
                _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;
                }
                Attendance_Rpt EmpTransRpt = new Attendance_Rpt();
                EmpTransRpt.Database.Tables[0].SetDataSource(_Dt);
                EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, DateTime.Now.ToString("dd/MM/yyyy"));
                Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
                Viewer.ShowDialog();
            }
        }