Example #1
0
        private void zTestForm_Load(object sender, EventArgs e)
        {
            //DataTable tableCheck = SqlDataAccessHelper.ExecuteQueryString("select * from CheckInOut ");
            //gridControl1.DataSource = tableCheck;

            BUS.BUS_ChamCong busChamCong = new BUS_ChamCong();
            busChamCong.XemCong(m_DSNV, KhoangTG);
            var result = (from cNgayCong ngayCong in m_DSNV[0].DSNgayDaCC
                          select new
            {
                m_DSNV[0].MaCC,
                ngayCong.Ngay,
                ngayCong.Tre,
                ngayCong.Som,
                ngayCong.VaoSauCa,
                ngayCong.RaTruocCa,
                LamViec = ngayCong.LamViec.ToString(@"hh\:mm"),
                LamDem = ngayCong.LamDem.ToString(@"hh\:mm"),
                ngayCong.PhuCapDem,
                DinhMuc = ngayCong.DinhMucCong,
                Tong = ngayCong.TongCong,
                ngayCong.TongPhuCap
            }).ToList();

            gridControl2.DataSource = result;
            DataTable tableCIO = SqlDataAccessHelper.ExecuteQueryString("Select * from CIO");

            gridControl1.DataSource = tableCIO;
        }
Example #2
0
        private void btnThucHien_XemCong_Click(object sender, EventArgs e)
        {
            //1. validate ngày bắt đầu, kết thúc
            //2. chỉ cho xem các ngày chưa kết lương, các ngày đã kết lương thì xem bên chỗ khác
            DateTime NgayBD_XemCong, NgayKT_XemCong;

            if (Validate_NgayBD_NgayKT(dateEdit_NgayBDCC, dateEdit_NgayKTCC, out NgayBD_XemCong, out NgayKT_XemCong) == false)
            {
                return;
            }

            if (Validate_NgayXemCong(NgayBD_XemCong, NgayKT_XemCong) == false)
            {
                return;
            }

            List <cUserInfo> dsnv_DuocChon = new List <cUserInfo>();

            LayDSNV_DuocChon(gridView_DSNV, dsnv_DuocChon);
            BUS_ChamCong   busChamCong = new BUS_ChamCong();
            FromToDateTime khoangTg    = new FromToDateTime {
                From = NgayBD_XemCong, To = NgayKT_XemCong
            };                                                                                                       //đã bỏ phần giờ, lấy phần ngày

            busChamCong.XemCong(dsnv_DuocChon, khoangTg);

            DataTable    table_KQ_XemCong;
            BUS_NhanVien busNhanVien = new BUS_NhanVien();

            busNhanVien.XuatDataTableXemCong(dsnv_DuocChon, out table_KQ_XemCong);
            gridControl_BangCC.DataSource = table_KQ_XemCong;

            //ReloadThongKe();
        }
Example #3
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            splashScreenManager1.ShowWaitForm();
            string    fromDate    = dtpFromDay.Text + " " + dtpFromTime.Text;
            string    toDate      = dtpToDay.Text + " " + dtpToTime.Text;
            DataTable dtAttrecord = BUS_ChamCong.LoadAttrecord(fromDate, toDate, txtTimNV.Text, lkBoPhan.EditValue.ToString());

            grdChamCong.DataSource = dtAttrecord;
            splashScreenManager1.CloseWaitForm();
        }
Example #4
0
 private void btnAddCountDelete_Click(object sender, EventArgs e)
 {
     if (radioGroup.SelectedIndex == 1)
     {
         if (DialogResult.Yes != MessageBox.Show(this, "Bạn có chắc chắn?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
         {
             return;
         }
         else
         {
             DataTable dt = new DataTable();
             foreach (GridColumn column in gridView1.Columns)
             {
                 dt.Columns.Add(column.FieldName, column.ColumnType);
             }
             for (int i = 0; i < gridView1.DataRowCount; i++)
             {
                 DataRow row = dt.NewRow();
                 foreach (GridColumn column in gridView1.Columns)
                 {
                     row[column.FieldName] = gridView1.GetRowCellValue(i, column);
                 }
                 dt.Rows.Add(row);
             }
             if (dt != null && dt.Rows.Count > 0)
             {
                 bool sKetQua = BUS_ChamCong.DeleteAttCount(dt, ad_user_id);
                 if (sKetQua)
                 {
                     MessageBox.Show("Xóa thành công!", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     //string maCa = lkShift.EditValue.ToString();
                     //string attDate = dateEdit.DateTime.Date.ToString("yyyy-MM-dd");
                     //string boPhan = lkBoPhan.EditValue.ToString();
                     //string tinhTrang = radioGroup.EditValue.ToString();
                     //DataTable dtCheckin = BUS_ChamCong.LoadCheckin(attDate, tinhTrang, boPhan, maCa);
                     gridDiemDanh.DataSource = null;
                 }
                 else
                 {
                     MessageBox.Show("Xóa không thành công!", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Xóa không thành công!", "Không thành công.", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Vui lòng lựa chọn loại công việc = 'xem danh sách đã điểm danh'!", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #5
0
        private void Search_Click(object sender, EventArgs e)
        {
            splashScreenManager5.ShowWaitForm();
            if (dateEdit.DateTime.Date > dateEdit1.DateTime.Date)
            {
                MessageBox.Show("Ngày bắt đầu không được nhỏ hơn ngày kết thúc", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (string.Compare(dateEdit.DateTime.ToString("MM"), dateEdit1.DateTime.ToString("MM")) != 0)
                {
                    MessageBox.Show("Ngày bắt đầu và ngày kết thúc phải trong cùng một tháng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string maCa;
                    if (lkShift.EditValue == null)
                    {
                        maCa = "0";
                    }
                    else
                    {
                        maCa = lkShift.EditValue.ToString();
                    }
                    // Add a title to the chart (if necessary).
                    chartControl1.Titles.Clear();
                    chartTitle1.Text = "BIỂU ĐỒ NHÂN SỰ\n(" + dateEdit.DateTime.ToString("dd/MM/yyyy") + " - " + dateEdit1.DateTime.ToString("dd/MM/yyyy") + ")";
                    chartTitle1.Font = new Font("Times New Roman", 15, FontStyle.Bold);
                    chartControl1.Titles.Add(chartTitle1);

                    // Add a title to the chart (if necessary).
                    chartControl2.Titles.Clear();
                    chartTitle2.Text = "BIỂU ĐỒ TỈ LỆ NGƯỜI VẮNG\n(" + dateEdit.DateTime.ToString("dd/MM/yyyy") + " - " + dateEdit1.DateTime.ToString("dd/MM/yyyy") + ")";
                    chartTitle2.Font = new Font("Times New Roman", 15, FontStyle.Bold);
                    chartControl2.Titles.Add(chartTitle2);

                    dtChart1 = BUS_ChamCong.ChartDiemDanh(dateEdit.DateTime.ToString("yyyy-MM-dd"), dateEdit1.DateTime.ToString("yyyy-MM-dd"), lkBoPhan.EditValue.ToString(), maCa);
                    dtChart2 = Utility.CopyChart(dtChart1, dateEdit.DateTime.ToString("dd"), dateEdit1.DateTime.ToString("dd"));
                    CreateChart(dtChart1, dtChart2);
                }
            }
            splashScreenManager5.CloseWaitForm();
        }
Example #6
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (radioGroup.SelectedIndex == 0)
     {
         DataTable dt = new DataTable();
         foreach (GridColumn column in gridView1.Columns)
         {
             dt.Columns.Add(column.FieldName, column.ColumnType);
         }
         for (int i = 0; i < gridView1.DataRowCount; i++)
         {
             DataRow row = dt.NewRow();
             foreach (GridColumn column in gridView1.Columns)
             {
                 row[column.FieldName] = gridView1.GetRowCellValue(i, column);
             }
             dt.Rows.Add(row);
         }
         if (dt != null && dt.Rows.Count > 0)
         {
             bool sKetQua = BUS_ChamCong.InsertAttCount(ad_user_id, dt);
             if (sKetQua)
             {
                 MessageBox.Show("Điểm danh thành công!", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.gridDiemDanh.DataSource = null;
             }
             else
             {
                 MessageBox.Show("Điểm danh không thành công!", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Điểm danh không thành công!", "Không thành công.", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Vui lòng chọn loại công việc = 'thực hiện điểm danh'!", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #7
0
        private void btnThucHien_CCThang_Click(object sender, EventArgs e)
        {
            //1. kiểm tra tháng chấm công hợp lệ, lấy dsnv ( chưa chọn thì báo)
            DateTime thangChamCong;

            if (Validate_ThangChamCong(dateEdit_ThangCC, out thangChamCong) == false)
            {
                return;
            }

            List <cUserInfo> dsnv_duocChon = new List <cUserInfo>();

            LayDSNV_DuocChon(gridView_DSNV, dsnv_duocChon);

            BUS_ChamCong   busChamCong = new BUS_ChamCong();
            FromToDateTime khoangTg    = new FromToDateTime {
                From = MyUtility.FirstDayOfMonth(thangChamCong), To = MyUtility.LastDayOfMonth(thangChamCong)
            };

            busChamCong.ChamCong2(dsnv_duocChon, khoangTg);
        }
Example #8
0
        public void GridViewLookupEdit()
        {
            #region Ghi chú
            // Create an in-place LookupEdit control.
            //RepositoryItemLookUpEdit repositoryItemGridLookUpEdit1 = new RepositoryItemLookUpEdit();
            DataTable dtAbsent = BUS_ChamCong.LoadAbsent();
            repositoryItemLookUpEdit1.DataSource    = dtAbsent;
            repositoryItemLookUpEdit1.ValueMember   = "id";
            repositoryItemLookUpEdit1.DisplayMember = "description";
            repositoryItemLookUpEdit1.NullText      = "Chọn lý do vắng";


            // Enable the "best-fit" functionality mode in which columns have proportional widths and the popup window is resized to fit all the columns.
            repositoryItemLookUpEdit1.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
            // Specify the dropdown height.
            repositoryItemLookUpEdit1.DropDownRows = dtAbsent.Rows.Count;

            // Enable the automatic completion feature. In this mode, when the dropdown is closed,
            // the text in the edit box is automatically completed if it matches a DisplayMember field value of one of dropdown rows.
            repositoryItemLookUpEdit1.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;
            // Specify the column against which an incremental search is performed in SearchMode.AutoComplete and SearchMode.OnlyInPopup modes
            repositoryItemLookUpEdit1.AutoSearchColumnIndex = 1;

            // Optionally hide the Description column in the dropdown.
            repositoryItemLookUpEdit1.PopulateColumns();
            repositoryItemLookUpEdit1.Columns["id"].Visible = false;

            // Assign the in-place LookupEdit control to the grid's CategoryID column.
            // Note that the data types of the "ID" and "CategoryID" fields match.
            repositoryItemDateEdit1.NullText = string.Empty;
            repositoryItemDateEdit2.NullText = string.Empty;

            gridView1.Columns["att_reason"].ColumnEdit = repositoryItemLookUpEdit1;
            //gridView1.Columns["created"].ColumnEdit = repositoryItemDateEdit1;
            //gridView1.Columns["updated"].ColumnEdit = repositoryItemDateEdit2;
            gridView1.BestFitColumns();
            #endregion
        }
Example #9
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            string maCa;

            if (lkShift.EditValue != null)
            {
                maCa = lkShift.EditValue.ToString();
            }
            else
            {
                maCa = "0";
            }
            string fromDate = dateEdit.DateTime.Date.ToString("yyyy-MM-dd");
            string toDate   = dateEdit1.DateTime.Date.ToString("yyyy-MM-dd");
            string boPhan   = lkBoPhan.EditValue.ToString();
            string mode     = radioGroup.EditValue.ToString();

            splashScreenManager5.ShowWaitForm();
            dtReportDiemDanh        = BUS_ChamCong.ReportDiemDanh(fromDate, toDate, mode, boPhan, maCa);
            gridDiemDanh.DataSource = dtReportDiemDanh;
            GridViewLookupEdit();
            splashScreenManager5.CloseWaitForm();
        }
        private void btnChamCong_Click(object sender, EventArgs e)
        {
            DateTime Thang = dateNavigator1.DateTime;

            Thang = MyUtility.FirstDayOfMonth(Thang);
            //1. xác định danh sach nhan vien dang check;  LẬP DS nhân viên đó để chấm công
            List <int> listUEN;

            GetList_UEN_Checked(checkedDSNV, out listUEN);            // lấy danh sách các mã nhân viên check vì checkcomboBox ko cho phép lấy datarowview
            List <cUserInfo> listDSNV;
            BUS_NhanVien     busNhanVien = new BUS_NhanVien();

            busNhanVien.KhoiTaoDSNV_DuocChon(listUEN, this.m_NhanVienDR, this.m_SelectedPhong, this.m_AllNhomCa, out listDSNV);
            BUS_ChamCong busChamCong = new BUS_ChamCong();
            //busChamCong.ChamCong2(listDSNV, new FromToDateTime{From=MyUtility.FirstDayOfMonth(Thang), To = MyUtility.LastDayOfMonth(Thang)});
            zTestForm frm = new zTestForm()
            {
                m_DSNV = listDSNV, KhoangTG = new FromToDateTime {
                    From = MyUtility.FirstDayOfMonth(Thang), To = MyUtility.LastDayOfMonth(Thang)
                }
            };

            frm.Show();
        }
Example #11
0
 public frm_QLChamCong()
 {
     InitializeComponent();
     busCC = new BUS_ChamCong();
 }
Example #12
0
        public frmAttReport(string ad_user_id, string ad_org_id, DataTable dtProcess)
        {
            InitializeComponent();
            dateEdit.DateTime  = DateTime.Now;
            dateEdit1.DateTime = DateTime.Now;
            this.ad_user_id    = ad_user_id;
            this.ad_org_id     = ad_org_id;
            this.dtProcess     = dtProcess;
            dtCa     = BUS_Ca.LoadCaShift(DateTime.Now.Date, ad_org_id);
            dtboPhan = BUS_BoPhan.LoadBoPhan(ad_org_id);
            utility.SearchProcess(this.Controls, dtProcess);

            #region Chart control 1
            // Create an empty Bar series and add it to the chart.
            chartControl1.Series.Add(series1);
            series1.View.Color = Color.Green;

            chartControl1.Series.Add(series2);
            series2.View.Color = Color.DarkGoldenrod;

            chartControl1.Series.Add(series3);
            series3.View.Color = Color.Red;

            chartControl1.Series.Add(series4);
            series4.View.Color = Color.Red;

            //Show point view lable and customize it
            chartControl1.Series["Tổng số người"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            SideBySideBarSeriesLabel label1 = chartControl1.Series["Tổng số người"].Label as SideBySideBarSeriesLabel;
            if (label1 != null)
            {
                label1.Position = BarSeriesLabelPosition.Top;
            }

            chartControl1.Series["Số người vắng"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            SideBySideBarSeriesLabel label2 = chartControl1.Series["Số người vắng"].Label as SideBySideBarSeriesLabel;
            if (label2 != null)
            {
                label2.Position = BarSeriesLabelPosition.Top;
            }

            chartControl1.Series["Số người nghỉ việc"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            SideBySideBarSeriesLabel label3 = chartControl1.Series["Số người nghỉ việc"].Label as SideBySideBarSeriesLabel;
            if (label3 != null)
            {
                label3.Position = BarSeriesLabelPosition.Top;
            }

            chartControl1.Series["Tỉ lệ người vắng(%)"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            SideBySideBarSeriesLabel label4 = chartControl1.Series["Tỉ lệ người vắng(%)"].Label as SideBySideBarSeriesLabel;
            if (label4 != null)
            {
                label4.Position = BarSeriesLabelPosition.Top;
            }

            // Cast Diagram to the XYDiagram type.
            XYDiagram diagram = chartControl1.Diagram as XYDiagram;
            diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
            diagram.AxisY.Title.Text       = "Số lượng người";
            diagram.AxisY.Title.Font       = new Font("Times New Roman", 10, FontStyle.Regular);

            // Add a title to the chart (if necessary).
            chartTitle1.Text = "BIỂU ĐỒ NHÂN SỰ\n(" + "01" + DateTime.Now.ToString("/MM/yyyy") + " - " + DateTime.Now.ToString("dd/MM/yyyy") + ")";
            chartTitle1.Font = new Font("Times New Roman", 15, FontStyle.Bold);
            chartControl1.Titles.Add(chartTitle1);

            // Control legend & position
            chartControl1.Legend.Visibility          = DevExpress.Utils.DefaultBoolean.True;
            chartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
            chartControl1.Legend.AlignmentVertical   = LegendAlignmentVertical.BottomOutside;
            chartControl1.Legend.Direction           = LegendDirection.LeftToRight;
            chartControl1.Legend.EquallySpacedItems  = true;

            //Create secondary Y-Axis, and add them to the chart's diagram
            SecondaryAxisY myAxisY2 = new SecondaryAxisY("Y-Axis2");
            ((XYDiagram)chartControl1.Diagram).SecondaryAxesY.Add(myAxisY2);

            //Assign series4 to the created axis
            ((LineSeriesView)series4.View).AxisY = myAxisY2;

            //Customize the apperance of the secondary axis
            myAxisY2.Title.Text       = "Tỉ lệ người vắng(%)";
            myAxisY2.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
            myAxisY2.Title.TextColor  = Color.Red;
            myAxisY2.Title.Font       = new Font("Times New Roman", 10, FontStyle.Regular);
            myAxisY2.Label.TextColor  = Color.Red;
            myAxisY2.Color            = Color.Red;
            #endregion

            #region Chart control 2
            // Add a title to the chart (if necessary).
            chartControl2.Titles.Clear();
            chartTitle2.Text = "BIỂU ĐỒ TỈ LỆ NGƯỜI VẮNG\n(" + "01" + DateTime.Now.ToString("/MM/yyyy") + " - " + DateTime.Now.ToString("dd/MM/yyyy") + ")";
            chartTitle2.Font = new Font("Times New Roman", 15, FontStyle.Bold);
            chartControl2.Titles.Add(chartTitle2);


            #endregion
            dtChart1 = BUS_ChamCong.ChartDiemDanh(DateTime.Now.ToString("yyyy-MM-") + "01", DateTime.Now.ToString("yyyy-MM-dd"), ad_org_id, "0");
            dtChart2 = Utility.CopyChart(dtChart1, "01", DateTime.Now.ToString("dd"));
            CreateChart(dtChart1, dtChart2);
        }