Exemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            In_COM_Rpt rpt = new In_COM_Rpt();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
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();
            }
        }