private void glassButton3_Click(object sender, EventArgs e)
        {
            _cmd = new SqlCommand("select PHOTO from T_IMAGE", frmMainForm._MasterCon);
            _da  = new SqlDataAdapter(_cmd);
            DataTable dt2 = new DataTable();

            _da.Fill(dt2);
            frmEmpMange r = new frmEmpMange();

            byte[] imageData;

            imageData            = r.ReadFile(Application.StartupPath + @"\back.BMP");
            dt2.Rows[0]["PHOTO"] = imageData;

            if (!checkBox2.Checked)
            {
                rptCardBack      card       = new rptCardBack();
                frmReportViewer2 viewreport = new frmReportViewer2();
                card.Database.Tables["T_IMAGE"].SetDataSource(dt2);
                viewreport.crystalReportViewer1.ReportSource = card;
                viewreport.ShowDialog();
            }
            else
            {
                rptCardBack_PS   card       = new rptCardBack_PS();
                frmReportViewer2 viewreport = new frmReportViewer2();
                card.Database.Tables["T_IMAGE"].SetDataSource(dt2);
                viewreport.crystalReportViewer1.ReportSource = card;
                viewreport.ShowDialog();
            }
        }
        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();
            //////////////////////////////////////////////////////
            //////////////////////////////////////////////////////
        }
Exemple #3
0
        private void Btncancel_Click(object sender, EventArgs e)
        {
            _cmd            = new SqlCommand();
            _cmd.Connection = _MasterCon;
            if (comboBox1.SelectedIndex == 0)
            {
                _cmd.CommandText = "SELECT EMPLOYEE_CARDS.PhotoBytes , EMPLOYEE_CARDS.CRD_NO, EMPLOYEE_CARDS.CRD_NAME, rtrim(convert(char(20),AA.TRN_TIME,103))+' '+rtrim(convert(char(20),AA.TRN_TIME,24))as TRN_TIME, EMPLOYEE_CARDS.CRD_JOB, EMPLOYEE_CARDS.CRD_DEPARTMENT, AA.TRN_PLACE   FROM     (SELECT     MAX(TRN_TIME) AS TRN_TIME, TRN_CARD_NO, TRN_PLACE FROM         EMPLOYEE_TRANSACTIONS_MONITOR WHERE     (TRN_PLACE = 'In') AND TRN_TIME>(dbo.GET_MAX_OUT(TRN_CARD_NO)) AND (TRN_TIME BETWEEN DATEADD(dd,-1,GETDATE()) AND GETDATE()) GROUP BY TRN_CARD_NO, TRN_PLACE) AS AA INNER JOIN EMPLOYEE_CARDS ON EMPLOYEE_CARDS.CRD_NO = AA.TRN_CARD_NO ORDER BY TRN_TIME";
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                _cmd.CommandText = "SELECT EMPLOYEE_CARDS.PhotoBytes , EMPLOYEE_CARDS.CRD_NO, EMPLOYEE_CARDS.CRD_NAME, rtrim(convert(char(20),AA.TRN_TIME,103))+' '+rtrim(convert(char(20),AA.TRN_TIME,24))as TRN_TIME, EMPLOYEE_CARDS.CRD_JOB, EMPLOYEE_CARDS.CRD_DEPARTMENT, AA.TRN_PLACE   FROM     (SELECT     MAX(TRN_TIME) AS TRN_TIME, TRN_CARD_NO, TRN_PLACE ,TRN_MACHINE FROM         EMPLOYEE_TRANSACTIONS_MONITOR WHERE     (TRN_PLACE = 'In')AND TRN_MACHINE IN ('in','out') AND TRN_TIME>(dbo.GET_MAX_OUT(TRN_CARD_NO)) AND (TRN_TIME BETWEEN DATEADD(dd,-1,GETDATE()) AND GETDATE()) GROUP BY TRN_CARD_NO, TRN_PLACE,TRN_MACHINE) AS AA INNER JOIN EMPLOYEE_CARDS ON EMPLOYEE_CARDS.CRD_NO = AA.TRN_CARD_NO ORDER BY TRN_TIME";
            }
            else if (comboBox1.SelectedIndex == 2)
            {
                _cmd.CommandText = "SELECT EMPLOYEE_CARDS.PhotoBytes , EMPLOYEE_CARDS.CRD_NO, EMPLOYEE_CARDS.CRD_NAME, rtrim(convert(char(20),AA.TRN_TIME,103))+' '+rtrim(convert(char(20),AA.TRN_TIME,24))as TRN_TIME, EMPLOYEE_CARDS.CRD_JOB, EMPLOYEE_CARDS.CRD_DEPARTMENT, AA.TRN_PLACE   FROM     (SELECT     MAX(TRN_TIME) AS TRN_TIME, TRN_CARD_NO, TRN_PLACE ,TRN_MACHINE FROM         EMPLOYEE_TRANSACTIONS_MONITOR WHERE     (TRN_PLACE = 'In')AND TRN_MACHINE IN ('new in','new out') AND TRN_TIME>(dbo.GET_MAX_OUT(TRN_CARD_NO)) AND (TRN_TIME BETWEEN DATEADD(dd,-1,GETDATE()) AND GETDATE()) GROUP BY TRN_CARD_NO, TRN_PLACE,TRN_MACHINE) AS AA INNER JOIN EMPLOYEE_CARDS ON EMPLOYEE_CARDS.CRD_NO = AA.TRN_CARD_NO ORDER BY TRN_TIME";
            }
            _cmd.CommandTimeout = 2000;
            _da = new SqlDataAdapter(_cmd);
            DataTable _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");
            Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
            Viewer.ShowDialog();
        }
        private void glassButton1_Click(object sender, EventArgs e)
        {
            _cmd                = new SqlCommand();
            _cmd.Connection     = frmMainForm._MasterCon;
            _cmd.CommandType    = CommandType.StoredProcedure;
            _cmd.CommandText    = "GET_NUM_HOURS";
            _cmd.CommandTimeout = 2000;
            _cmd.Parameters.Add("@FROMDATE", SqlDbType.VarChar).Value = dtpDateFrom.Value.ToString("yyyy/MM/dd");
            _cmd.Parameters.Add("@TODATE", SqlDbType.VarChar).Value   = dtpDateTo.Value.ToString("yyyy/MM/dd");
            //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;
            //}
            SummaryRpt Rpt = new SummaryRpt();

            Rpt.Database.Tables["GET_NUM_HOURS;1"].SetDataSource(_Dt);
            Rpt.SetParameterValue(Rpt.Parameter_From.ParameterFieldName, dtpDateFrom.Text);
            Rpt.SetParameterValue(Rpt.Parameter_To.ParameterFieldName, dtpDateTo.Text);
            Rpt.SetParameterValue(Rpt.Parameter_FROMDATE.ParameterFieldName, dtpDateFrom.Value.ToString("yyyy/MM/dd"));
            Rpt.SetParameterValue(Rpt.Parameter_TODATE.ParameterFieldName, dtpDateFrom.Value.ToString("yyyy/MM/dd"));
            Viewer.crystalReportViewer1.ReportSource = Rpt;
            Viewer.ShowDialog();
        }
        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();
            }
        }
Exemple #6
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();
            }
        }
Exemple #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand(); cmd.CommandTimeout = 2000;

            cmd.Connection = frmMainForm._MasterCon;
            string FilterString = "";
            bool   FilterFlag   = false;
            string inFilter     = "";

            if (cmbLocation.SelectedItem != null)
            {
                string initalFilter = "";
                if (!FilterFlag)
                {
                    initalFilter = " where ";
                    FilterFlag   = true;
                }
                else
                {
                    initalFilter = " and ";
                }

                FilterString += initalFilter + " LOCATION ='" + cmbLocation.SelectedItem.ToString() + "' ";
            }
            if (cmbCompany.SelectedItem != null)
            {
                string initalFilter = "";
                if (!FilterFlag)
                {
                    initalFilter = " where ";
                    FilterFlag   = true;
                }
                else
                {
                    initalFilter = " and ";
                }

                FilterString += initalFilter + " COMPANY = '" + cmbCompany.SelectedItem.ToString() + "' ";
            }

            if (cmbDep.SelectedValue.ToString() != "")
            {
                string initalFilter = "";
                if (!FilterFlag)
                {
                    initalFilter = " where ";
                    FilterFlag   = true;
                }
                else
                {
                    initalFilter = " and ";
                }

                FilterString += initalFilter + "CRD_DEPARTMENT = '" + cmbDep.SelectedValue.ToString() + "'";
            }

            if (cmb_permit.SelectedValue.ToString() != "")
            {
                string initalFilter = "";
                if (!FilterFlag)
                {
                    initalFilter = " where ";
                    FilterFlag   = true;
                }
                else
                {
                    initalFilter = " and ";
                }

                FilterString += initalFilter + " PERMITION = '" + cmb_permit.SelectedValue.ToString() + "' and (VALID_TO between '" + dateTimePickerValid.Text + "' and '" + dateTimePickervalidTo.Text + "')  ";
            }

            if (cmb_status.SelectedValue.ToString() != "")
            {
                string initalFilter = "";
                if (!FilterFlag)
                {
                    initalFilter = " where ";
                    FilterFlag   = true;
                }
                else
                {
                    initalFilter = " and ";
                }

                FilterString += initalFilter + " STATUS = '" + cmb_permit.SelectedValue.ToString() + "'";
            }

            if (checkBox1.Checked)
            {
                string initalFilter = "";
                if (!FilterFlag)
                {
                    initalFilter = " where ";
                    FilterFlag   = true;
                }
                else
                {
                    initalFilter = " and ";
                }

                FilterString += initalFilter + " IN_JOB = 1";
            }

            if (!checkBox1.Checked)
            {
                string initalFilter = "";
                if (!FilterFlag)
                {
                    initalFilter = " where ";
                    FilterFlag   = true;
                }
                else
                {
                    initalFilter = " and ";
                }

                FilterString += initalFilter + " IN_JOB = 0";
            }
            inFilter = "";
            if (!FilterFlag)
            {
                inFilter   = " where ";
                FilterFlag = true;
            }
            else
            {
                inFilter = " and ";
            }

            FilterString += inFilter + " CRD_NAME NOT LIKE '%V' ";

            cmd.CommandText = "SELECT EMPLOYEE_CARDS.CRD_NO, EMPLOYEE_CARDS.CRD_NAME, EMPLOYEE_CARDS.CRD_STARTING_DATE, EMPLOYEE_CARDS.CRD_EXPIRY_DATE, EMPLOYEE_CARDS.CRD_JOB, EMPLOYEE_CARDS.CRD_LAST_TRANSACTION_TYPE, EMPLOYEE_CARDS.CRD_DEPARTMENT,EMPLOYEE_CARDS.LOCATION,EMPLOYEE_CARDS.COMPANY FROM EMPLOYEE_CARDS  " + FilterString + "    order by CRD_NAME";
            DataTable      dt  = new DataTable();
            SqlDataAdapter _da = new SqlDataAdapter(cmd);

            _da.Fill(dt);

            frmReportViewer2 Viewer = new frmReportViewer2();
            EmployeeRpt2     rpt    = new EmployeeRpt2();

            rpt.Database.Tables[0].SetDataSource(dt);

            Viewer.crystalReportViewer1.ReportSource = rpt;
            Viewer.ShowDialog();
            this.Close();
        }
        private void glassButton2_Click(object sender, EventArgs e)
        {
            //string sort = "";
            //if (radioButton1.Checked)
            //{
            //    sort = "Order by [NAME],[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();
            _cmd.Connection     = frmMainForm._MasterCon;
            _cmd.CommandType    = CommandType.StoredProcedure;
            _cmd.CommandText    = "GET_REAL_TIME";
            _cmd.CommandTimeout = 2000;

            //_cmd.Parameters.Add("@FROMDATE", SqlDbType.VarChar).Value = "'"+dtpDateFrom.Value.ToString("yyyy/MM/dd")+"'";
            //_cmd.Parameters.Add("@TODATE", SqlDbType.VarChar).Value = "'" + dtpDateTo.Value.ToString("yyyy/MM/dd")+"'";
            //_cmd.Parameters.Add("@DEP", SqlDbType.VarChar).Value = "'" + cmbDep.SelectedValue.ToString()+"'";
            //_cmd.Parameters.Add("@CARD", SqlDbType.VarChar).Value = "'" + cmbEmployee.SelectedValue.ToString()+"'";
            //_cmd.Parameters.Add("@LOC", SqlDbType.VarChar).Value = "'Cairo'";
            //_cmd.Parameters.Add("@COM", SqlDbType.VarChar).Value = "'PhPC'";

            _cmd.Parameters.Add("@FROMDATE", SqlDbType.VarChar).Value = dtpDateFrom.Value.ToString("yyyy/MM/dd");
            _cmd.Parameters.Add("@TODATE", SqlDbType.VarChar).Value   = dtpDateTo.Value.ToString("yyyy/MM/dd");
            _cmd.Parameters.Add("@DEP", SqlDbType.VarChar).Value      = cmbDep.SelectedValue.ToString();
            _cmd.Parameters.Add("@CARD", SqlDbType.VarChar).Value     = cmbEmployee.SelectedValue.ToString();
            _cmd.Parameters.Add("@LOC", SqlDbType.VarChar).Value      = "Cairo";
            _cmd.Parameters.Add("@COM", SqlDbType.VarChar).Value      = "PhPC";

            //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);

            /*_cmd = new SqlCommand(Str3 + 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);
             */
            //////////////////////////////////////////////////////
            EmpTrans_REAL_Rpt EmpTransRpt = new EmpTrans_REAL_Rpt();
            //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["GET_REAL_TIME"].SetDataSource(_Dt);
            EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_From.ParameterFieldName, dtpDateFrom.Text);
            EmpTransRpt.SetParameterValue(EmpTransRpt.Parameter_To.ParameterFieldName, dtpDateTo.Text);
            Viewer.crystalReportViewer1.ReportSource = EmpTransRpt;
            Viewer.ShowDialog();
            //////////////////////////////////////////////////////
            //////////////////////////////////////////////////////
        }
        private void glassButton2_Click(object sender, EventArgs e)
        {
            rptVisitorCard card = new rptVisitorCard();

            frmReportViewer2 viewreport = new frmReportViewer2();
            DataTable        dt         = new DataTable();
            string           floor;

            try
            {
                _cmd = new SqlCommand("select * from EMPLOYEE_CARDS where CRD_NO='" + txtCardNo.Text + "'", frmMainForm._MasterCon);
                _da  = new SqlDataAdapter(_cmd);
                _da.Fill(dt);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            frmEmpMange r = new frmEmpMange();

            byte[] imageData;

            if (radioButton1.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor1.jpg");
                floor     = radioButton1.Text;
            }
            else if (radioButton2.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor2.jpg");
                floor     = radioButton2.Text;
            }
            else if (radioButton3.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor3.jpg");
                floor     = radioButton3.Text;
            }
            else if (radioButton4.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor4.jpg");
                floor     = radioButton4.Text;
            }
            else if (radioButton5.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor5.jpg");
                floor     = radioButton5.Text;
            }
            else if (radioButton6.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor6.jpg");
                floor     = radioButton6.Text;
            }
            else if (radioButton7.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor7.jpg");
                floor     = radioButton7.Text;
            }
            else if (radioButton8.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor8.jpg");
                floor     = radioButton8.Text;
            }
            else if (radioButton9.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor9.jpg");
                floor     = radioButton9.Text;
            }
            else //if (radioButton10.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Blank_Visitor.jpg");
                floor     = "";
            }
            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("There is no member");
                return;
            }


            dt.Rows[0]["PhotoBytes"] = imageData;
            card.Database.Tables["EMPLOYEE_CARDS"].SetDataSource(dt);

            card.SetParameterValue(card.Parameter_Num.ParameterFieldName, txtCardNo.Text);

            card.SetParameterValue(card.Parameter_Floor.ParameterFieldName, floor);
            if (checkBox1.Checked)
            {
                card.SetParameterValue(card.Parameter_Visitor.ParameterFieldName, txtCompanyName.Text);
            }
            else
            {
                card.SetParameterValue(card.Parameter_Visitor.ParameterFieldName, "Visitor");
            }
            viewreport.crystalReportViewer1.ReportSource = card;

            viewreport.ShowDialog();
        }
        private void glassButton3_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
             * {*/
            EmpTransRptWithG EmpTransRpt = new EmpTransRptWithG();

            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();
        }