Ejemplo n.º 1
0
    protected void mnuNhanDoi_Click(object sender, DirectEventArgs e)
    {
        try
        {
            DAL.DanhSachCa ca = new DanhSachCaController().GetOneByMaCa(txtmaloaihdcoppy.Text);
            if (ca != null)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Mã ca đã tồn tại").Show();
                return;
            }

            DAL.DanhSachCa oldCa = new DanhSachCaController().GetByPrkey(int.Parse(hdfRecordID.Text));
            if (oldCa == null)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Không tìm thấy ca làm việc").Show();
            }
            DAL.DanhSachCa newCa = new DAL.DanhSachCa
            {
                BatDauQuetTheLan1        = oldCa.BatDauQuetTheLan1,
                BatDauQuetTheLan2        = oldCa.BatDauQuetTheLan2,
                BatDauQuetTheLan3        = oldCa.BatDauQuetTheLan3,
                BatDauQuetTheLan4        = oldCa.BatDauQuetTheLan4,
                BatDauTinhLamThemCuoiGio = oldCa.BatDauTinhLamThemCuoiGio,
                BatDauTinhLamThemDauGio  = oldCa.BatDauTinhLamThemDauGio,
                CreatedBy            = CurrentUser.ID,
                CreatedDate          = DateTime.Now,
                DangSuDung           = oldCa.DangSuDung,
                GioRa                = "",
                GioVao               = "",
                KetThucQuetTheLan1   = oldCa.KetThucQuetTheLan1,
                KetThucQuetTheLan2   = oldCa.KetThucQuetTheLan2,
                KetThucQuetTheLan3   = oldCa.KetThucQuetTheLan3,
                KetThucQuetTheLan4   = oldCa.KetThucQuetTheLan4,
                MaDonVi              = oldCa.MaDonVi,
                NghiGiuaCa           = oldCa.NghiGiuaCa,
                PhuCapCa             = oldCa.PhuCapCa,
                RaNgoaiKhongBiTruGio = oldCa.RaNgoaiKhongBiTruGio,
                SoPhutChoPhepDiMuon  = oldCa.SoPhutChoPhepDiMuon,
                SoPhutChoPhepVeSom   = oldCa.SoPhutChoPhepVeSom,
                TenCa                = oldCa.TenCa,
                ThoiGianApDungDen    = oldCa.ThoiGianApDungDen,
                ThoiGianApDungTu     = oldCa.ThoiGianApDungTu,
                TienLuongCa          = oldCa.TienLuongCa,
                VaoGiuaCa            = oldCa.VaoGiuaCa,
                MaCa   = txtmaloaihdcoppy.Text,
                LoaiCa = oldCa.LoaiCa
            };
            new DanhSachCaController().Insert(newCa);
            wdInputNewPrimaryKey.Hide();
            grp_DanhSachCa.Reload();
        }
        catch (Exception ex)
        {
            X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra: " + ex.Message).Show();
        }
    }
Ejemplo n.º 2
0
 protected void cbCaLamViecStore_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
 {
     try
     {
         DanhSachCaController controller = new DanhSachCaController();
         cbCaLamViecStore.DataSource = controller.GetByMaDonVi(Session["MaDonVi"].ToString());
         cbCaLamViecStore.DataBind();
     }
     catch (Exception ex)
     {
         X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
     }
 }
Ejemplo n.º 3
0
    private void SetEditor()
    {
        int count;
        List <DanhSachCaInfo> data = new DanhSachCaController().GetAll(0, 100, Session["MaDonVI"].ToString(), "", out count);

        this.Store2.DataSource = DataHandler.GetInstance().ExecuteDataTable("select ID,MaCa,TenCa,GioVao,GioRa from ChamCong.DanhSachCa where MaDonVi = N'" + Session["MaDonVI"].ToString() + "'");
        this.Store2.DataBind();

        foreach (var col in grpDanhSachBangPhanCaThang.ColumnModel.Columns)
        {
            //     Ext.Net.MultiCombo cbWorkingStatus = new MultiCombo();
            Ext.Net.ComboBox cbWorkingStatus = new ComboBox();
            cbWorkingStatus.StoreID        = "Store2";
            cbWorkingStatus.Width          = 60;
            cbWorkingStatus.ListWidth      = 300;
            cbWorkingStatus.ID             = "cb" + col.ColumnID;
            cbWorkingStatus.TypeAhead      = true;
            cbWorkingStatus.ForceSelection = true;
            //    cbWorkingStatus.SelectionMode = MultiSelectMode.Selection;
            cbWorkingStatus.DisplayField  = "TenCa";
            cbWorkingStatus.ValueField    = "MaCa";
            cbWorkingStatus.Editable      = false;
            cbWorkingStatus.Mode          = DataLoadMode.Local;
            cbWorkingStatus.ItemSelector  = "tr.list-item";
            cbWorkingStatus.Template.Html = @"
                                            <tpl for=""."">
						                        <tpl if=""[xindex] == 1"">
							                        <table class=""cbStates-list"">
								                        <tr>
									                        <th>Mã ca</th>
									                        <th>Tên ca</th>
								                        </tr>
						                        </tpl>
						                        <tr class=""list-item"">
							                        <td style=""padding:3px 0px;"">{MaCa}</td>
							                        <td>{TenCa} ({GioVao} đến {GioRa})</td>
						                        </tr>
						                        <tpl if=""[xcount-xindex]==0"">
							                        </table>
						                        </tpl>
					                        </tpl>
                                            ";

            if (col.ColumnID.StartsWith("Ngay"))
            {
                col.Editor.Add(cbWorkingStatus);
                // col.DataIndex = "MaCa";
            }
        }
    }
Ejemplo n.º 4
0
    protected void EditCaLamViec(object sender, DirectEventArgs e)
    {
        try
        {
            DAL.DanhSachCa ca = new DanhSachCaController().GetByPrkey(int.Parse(hdfRecordID.Text));
            if (ca == null)
            {
                Dialog.ShowNotification("Không tìm thấy dữ liệu");
                return;
            }
            txtMaCa.Text  = ca.MaCa;
            txtTenCa.Text = ca.TenCa;
            txtPhuCapCa.SetValue(ca.PhuCapCa);
            txtLuongCuaCa.SetValue(ca.TienLuongCa);
            txtTongSoGio.SetValue(ca.TongGio);
            cbxLoaiCa.SetValue(ca.LoaiCa);
            //cbxNgayApDung.SetValue(ca.NgayApDung);
            //
            if (ca.GioVao != "")
            {
                tfBatDauCa.Text = ca.GioVao;
            }
            if (ca.NghiGiuaCa != "")
            {
                tfNghiNuaCaDau.Text = ca.NghiGiuaCa;
            }
            //if (ca.BatDauTinhLamThemDauGio != "")
            //    tfBatDauLamThemDauGio.SetValue(ca.BatDauTinhLamThemDauGio);
            if (ca.VaoGiuaCa != "")
            {
                tfBatDauCaSau.Text = ca.VaoGiuaCa;
            }
            if (ca.GioRa != "")
            {
                tfKetThucCaSau.Text = ca.GioRa;
            }
            //if (ca.BatDauTinhLamThemCuoiGio != "")
            //    tfBatDauLamThemCuoiGio.SetValue(ca.BatDauTinhLamThemCuoiGio);
            //
            chkRaNgoaiKhongBiTruGio.Checked = bool.Parse(ca.RaNgoaiKhongBiTruGio.ToString());
            //
            if (ca.BatDauQuetTheLan1 != "")
            {
                tfDauCaTu.Text = ca.BatDauQuetTheLan1;
            }
            if (ca.KetThucQuetTheLan1 != "")
            {
                tfDauCaDen.Text = ca.KetThucQuetTheLan1;
            }
            if (ca.BatDauQuetTheLan2 != "")
            {
                tfGiuaCaRaTu.Text = ca.BatDauQuetTheLan2;
            }
            if (ca.KetThucQuetTheLan2 != "")
            {
                tfGiuaCaRaDen.Text = ca.KetThucQuetTheLan2;
            }
            if (ca.BatDauQuetTheLan3 != "")
            {
                tfGiuaCaVaoTu.Text = ca.BatDauQuetTheLan3;
            }
            if (ca.KetThucQuetTheLan3 != "")
            {
                tfGiuaCaVaoDen.Text = ca.KetThucQuetTheLan3;
            }
            if (ca.BatDauQuetTheLan4 != "")
            {
                tfCuoiCaTu.Text = ca.BatDauQuetTheLan4;
            }
            if (ca.KetThucQuetTheLan4 != "")
            {
                tfCuoiCaDen.Text = ca.KetThucQuetTheLan4;
            }
            //
            //if (!SoftCore.Util.GetInstance().IsDateNull(ca.ThoiGianApDungTu))
            //    dfApDungTu.SetValue(ca.ThoiGianApDungTu);
            //if (!SoftCore.Util.GetInstance().IsDateNull(ca.ThoiGianApDungDen))
            //    dfApDungDen.SetValue(ca.ThoiGianApDungDen);
            //
            txtSoPhutChoPhepDiMuon.SetValue(ca.SoPhutChoPhepDiMuon);
            txtSoPhutChoPhepVeSom.SetValue(ca.SoPhutChoPhepVeSom);
            chkDangSuDung.Checked = ca.DangSuDung;

            txtMaCa.Disabled      = true;
            wdThemCaLamViec.Title = "Sửa thông tin phân ca";
            wdThemCaLamViec.Icon  = Icon.ClockEdit;

            wdThemCaLamViec.Show();
        }
        catch
        {
            throw;
        }
    }
Ejemplo n.º 5
0
    protected void btnCapNhat_Click(object sender, DirectEventArgs e)
    {
        try
        {
            LinqProvider         linq         = new LinqProvider();
            DanhSachCaController dsController = new DanhSachCaController();
            DAL.DanhSachCa       ca           = new DAL.DanhSachCa();
            if (e.ExtraParams["Command"] == "Edit")
            {
                ca = linq.GetDataContext().DanhSachCas.Where(t => t.ID == int.Parse(hdfRecordID.Text)).FirstOrDefault();
            }
            else
            {
                string lyDo = "";
                if (KiemTraTrungNgayNghiLe(txtMaCa.Text, ref lyDo))
                {
                    X.Msg.Alert("Thông báo từ hệ thống", lyDo + " Vui lòng nhập mã ca khác!").Show();
                    return;
                }
            }
            ca.MaCa  = txtMaCa.Text;
            ca.TenCa = txtTenCa.Text;
            if (txtPhuCapCa.Text != "")
            {
                ca.PhuCapCa = double.Parse(txtPhuCapCa.Text.Replace('.', ','));
            }
            if (txtLuongCuaCa.Text != "")
            {
                ca.TienLuongCa = double.Parse(txtLuongCuaCa.Text.Replace('.', ','));
            }
            if (txtTongSoGio.Text != "")
            {
                ca.TongGio = double.Parse(txtTongSoGio.Text.Replace('.', ','));
            }
            ca.LoaiCa = int.Parse("0" + hdfLoaiCa.Text);
            //   ca.NgayApDung = cbxNgayApDung.SelectedItem.Value;
            //
            ca.GioVao     = GetTime(tfBatDauCa.Text);
            ca.GioRa      = GetTime(tfKetThucCaSau.Text);
            ca.NghiGiuaCa = GetTime(tfNghiNuaCaDau.Text);
            ca.VaoGiuaCa  = GetTime(tfBatDauCaSau.Text);
            //ca.BatDauTinhLamThemDauGio = GetTime(tfBatDauLamThemDauGio.Text);
            //ca.BatDauTinhLamThemCuoiGio = GetTime(tfBatDauLamThemCuoiGio.Text);
            //
            ca.RaNgoaiKhongBiTruGio = chkRaNgoaiKhongBiTruGio.Checked;
            //
            ca.BatDauQuetTheLan1  = GetTime(tfDauCaTu.Text);
            ca.KetThucQuetTheLan1 = GetTime(tfDauCaDen.Text);
            ca.BatDauQuetTheLan2  = GetTime(tfGiuaCaRaTu.Text);
            ca.KetThucQuetTheLan2 = GetTime(tfGiuaCaRaDen.Text);
            ca.BatDauQuetTheLan3  = GetTime(tfGiuaCaVaoTu.Text);
            ca.KetThucQuetTheLan3 = GetTime(tfGiuaCaVaoDen.Text);
            ca.BatDauQuetTheLan4  = GetTime(tfCuoiCaTu.Text);
            ca.KetThucQuetTheLan4 = GetTime(tfCuoiCaDen.Text);
            //
            //if (!SoftCore.Util.GetInstance().IsDateNull(dfApDungTu.SelectedDate))
            //    ca.ThoiGianApDungTu = dfApDungTu.SelectedDate;
            //if (!SoftCore.Util.GetInstance().IsDateNull(dfApDungDen.SelectedDate))
            //    ca.ThoiGianApDungDen = dfApDungDen.SelectedDate;
            //
            if (txtSoPhutChoPhepDiMuon.Text != "")
            {
                ca.SoPhutChoPhepDiMuon = double.Parse(txtSoPhutChoPhepDiMuon.Text);
            }
            if (txtSoPhutChoPhepVeSom.Text != "")
            {
                ca.SoPhutChoPhepVeSom = double.Parse(txtSoPhutChoPhepVeSom.Text);
            }
            ca.DangSuDung = chkDangSuDung.Checked;
            //
            ca.MaDonVi     = Session["MaDonVi"].ToString();
            ca.CreatedBy   = CurrentUser.ID;
            ca.CreatedDate = DateTime.Now;

            if (e.ExtraParams["Command"] == "Edit")
            {
                ca.ID = int.Parse(hdfRecordID.Text);
                dsController.Update(ca);
                Dialog.ShowNotification("Cập nhật dữ liệu thành công!");
                grp_DanhSachCa.Reload();
                wdThemCaLamViec.Hide();
            }
            else
            {
                DAL.DanhSachCa tmp = dsController.GetOneByMaCa(ca.MaCa);
                if (tmp != null)
                {
                    X.Msg.Alert("Thông báo", "Mã ca đã tồn tại. Vui lòng nhập mã ca khác!").Show();
                    return;
                }
                dsController.Insert(ca);
                Dialog.ShowNotification("Thêm mới thành công ca!");
                grp_DanhSachCa.Reload();
            }
            if (e.ExtraParams["Closed"] == "True")
            {
                wdThemCaLamViec.Hide();
            }
            else
            {
                ResourceManager1.RegisterClientScriptBlock("rl1f", "resetForm();");
            }
        }
        catch (Exception ex)
        {
            X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message).Show();
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Hàm tính toán tổng hợp công
    /// </summary>
    /// <param name="lists">Danh sách thông tin chấm công cần tính</param>
    /// <param name="isNew"><b>true</b> nếu tổng hợp mới, <b>false</b> nếu cập nhật lại</param>
    private string TinhToanThongTinCong(List <TongHopCongTheoThangInfo> lists, bool isNew)
    {
        try
        {
            TimeController timeController = new TimeController();
            string         error          = "";
            #region lấy các cấu hình cho tổng hợp công
            // lấy các ngày cuối tuần trong tháng
            List <string> listWeekend = timeController.GetWeekKend(Session["MaDonVi"].ToString());

            // lấy danh sách chấm công đặc biệt
            Dictionary <string, int> dicSpecialEmployee = new Dictionary <string, int>();

            List <DAL.DanhSachNhanVienChamCongDacBiet> listEmployees = new DieuKienChamCongDacBietController().GetByAll();
            foreach (var item in listEmployees)
            {
                dicSpecialEmployee.Add(item.MaCB, item.SoLanChitTay);
            }
            // lấy ngày công chuẩn
            //double ngayCongChuan = timeController.GetNumberDayOfWork();
            #endregion

            // lấy tháng
            DAL.DanhSachBangTongHopCong thcong = new DanhSachBangTongHopCongController().GetById(int.Parse(hdfIdBangTongHopCong.Text));
            //int maxDays = 31;//DateTime.DaysInMonth(thcong.Nam, thcong.Thang);
            int tong = 0;

            foreach (var item in lists)
            {
                try
                {
                    tong++;
                    #region các tham biến
                    double tongGioCongDinhMuc = 0, tongGioCongThucTe = 0;
                    int    tongPhutDiTre = 0, tongPhutVeSom = 0, tongSoPhutLamThuaGio = 0;
                    int    tongSoPhutLamThemNgayThuong = 0, tongSoPhutLamThemNgayNghi = 0, tongSoPhutLamThemNgayLe = 0;
                    double nghiLe = 0, nghiPhep = 0, nghiCheDo = 0, nghiBu = 0, nghiKhongLuong = 0;
                    int    tongSoLamQuenQuetThe = 0, tongSoLanDiMuon = 0, tongSoLanVeSom = 0;
                    string ngayLe = "", thongKeCaLamViec = "";
                    float  tongCaLamViecNgayThuong = 0, tongCaLamViecNgayNghi = 0, tongCaLamViecNgayLe = 0, tongThoiGianRaNgoaiBiTruGio = 0, tongCaNghi = 0;
                    bool   isFail = false;
                    int    soLanChitTayBatBuoc = -1;

                    if (dicSpecialEmployee.ContainsKey(item.MA_CB))
                    {
                        soLanChitTayBatBuoc = dicSpecialEmployee[item.MA_CB];
                    }

                    // thống kê ca làm việc định dạng MaCa1=a,MaCa2=b
                    Dictionary <string, int> dicThongKeCaLamViec = new Dictionary <string, int>();
                    #endregion

                    // tính toán các ngày nghỉ
                    //if (soLanChitTayBatBuoc == -1)
                    new TongHopCongController().GetNgayNghi(item.MA_CB, thcong.FromDate, thcong.ToDate, ref ngayLe, ref nghiLe, ref nghiPhep,
                                                            ref nghiCheDo, ref nghiBu, ref nghiKhongLuong, Session["MaDonVi"].ToString());

                    DateTime day = thcong.FromDate;
                    while (day <= thcong.ToDate)
                    {
                        #region tổng hợp thông tin trong một ngày
                        try
                        {
                            #region các biến cục bộ
                            double gioCongDinhMuc = 0, gioCongThucTe = 0;
                            int    soPhutDiTre = 0, soPhutVeSom = 0, soPhutDiSom = 0, soPhutVeMuon = 0;
                            int    soPhutLamThemNgayThuong = 0, soPhutLamThemNgayNghi = 0, soPhutLamThemNgayLe = 0, soPhutLamThuaGio = 0;
                            int    soLanQuenQuetThe = 0, soLanDiMuon = 0, soLanVeSom = 0;
                            float  soCaLamViecNgayThuong = 0, soCaLamViecNgayNghi = 0, soCaLamViecNgayLe = 0, thoiGianRaNgoaiBiTruGio = 0, soCaNghi = 0;
                            string thoiGianDiFirst = "", thoiGianVeLast = "";

                            DAL.DanhSachCa ca = new DanhSachCa();
                            #endregion

                            try
                            {
                                // lấy ca làm việc của cán bộ
                                ca = new DanhSachCaController().GetByMaChamCong(item.MaChamCong, day, Session["MaDonVi"].ToString());

                                #region cập nhật thống kê ca làm việc
                                if (ca == null)
                                {
                                    continue;
                                }
                                #endregion

                                // tính các tham số liên quan
                                if (soLanChitTayBatBuoc == -1)
                                {
                                    new TongHopCongController().GetCaLamViecTrongNgay(ngayLe.Split(','), listWeekend, item.MaChamCong, day, ca, ref dicThongKeCaLamViec,
                                                                                      ref gioCongDinhMuc, ref gioCongThucTe, ref soPhutDiTre, ref soPhutVeSom, ref soPhutDiSom, ref soPhutVeMuon,
                                                                                      ref soPhutLamThemNgayThuong, ref soPhutLamThemNgayNghi, ref soPhutLamThemNgayLe,
                                                                                      ref soLanQuenQuetThe, ref soLanDiMuon, ref soLanVeSom, ref soPhutLamThuaGio,
                                                                                      ref soCaLamViecNgayThuong, ref soCaLamViecNgayNghi, ref soCaLamViecNgayLe, ref thoiGianRaNgoaiBiTruGio, ref soCaNghi,
                                                                                      ref thoiGianDiFirst, ref thoiGianVeLast);

                                    //new TongHopCongController().GetCaLamViecTrongNgay1(ngayLe.Split(','), listWeekend, item.MaChamCong, day, ca, ref gioCongDinhMuc,
                                    //    ref gioCongThucTe, ref soPhutDiTre, ref soPhutVeSom, ref thoiGianDiFirst, ref thoiGianVeLast, ref thoiGianRaNgoaiBiTruGio,
                                    //    ref soLanDiMuon, ref soLanVeSom);
                                }
                                else
                                {
                                    List <DAL.VaoRaCa> dsVaoRaCa = new VaoRaCaController().GetByMaChamCongAndDay(item.MaChamCong, day);

                                    if (dsVaoRaCa.Count >= soLanChitTayBatBuoc)
                                    {
                                        //gioCongDinhMuc += ca.TongGio != null ? ca.TongGio.Value : 0;
                                        //gioCongThucTe += (ca.TongGio != null ? ca.TongGio.Value : 0) * 60;
                                        if (ca.NghiGiuaCa != "" && ca.VaoGiuaCa != "")
                                        {
                                            gioCongThucTe         += 1;
                                            soCaLamViecNgayThuong += 1;
                                        }
                                        else
                                        {
                                            gioCongThucTe         += 0.5;
                                            soCaLamViecNgayThuong += (float)0.5;
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                isFail = true;
                                error += ex.Message + "<br />";
                            }

                            #region tính các thời gian liên quan
                            DAL.TongHopCongTheoNgay theoNgay = new TongHopCongTheoNgay();
                            theoNgay.MaCa       = ca.MaCa;
                            theoNgay.MaChamCong = item.MaChamCong;
                            theoNgay.NgayThang  = day;
                            //theoNgay.SoLanDiMuon = soLanDiMuon;
                            //theoNgay.SoLanVeSom = soLanVeSom;
                            //theoNgay.SoNgayCong = Math.Round((gioCongThucTe / ca.TongGio == 0 ? 1 : ca.TongGio), 1);
                            theoNgay.SoPhutDiMuon = soPhutDiTre;
                            //theoNgay.SoPhutDiSom = soPhutVeSom;
                            //theoNgay.SoPhutLamThemNgayLe = soPhutLamThemNgayLe;
                            //theoNgay.SoPhutLamThemNgayNghi = soPhutLamThemNgayNghi;
                            //theoNgay.SoPhutLamThemNgayThuong = soPhutLamThemNgayThuong;
                            //theoNgay.SoPhutLamThuaGio = soPhutLamThuaGio;
                            //theoNgay.SoPhutLamViec = gioCongThucTe;
                            //theoNgay.SoPhutRaNgoai =
                            //tongGioCongDinhMuc += gioCongDinhMuc;
                            //tongGioCongThucTe += gioCongThucTe;
                            //tongPhutDiTre += soPhutDiTre;
                            //tongPhutVeSom += soPhutVeSom;
                            //tongSoPhutLamThemNgayThuong += soPhutLamThemNgayThuong;
                            //tongSoPhutLamThemNgayNghi += soPhutLamThemNgayNghi;
                            //tongSoPhutLamThemNgayLe += soPhutLamThemNgayLe;
                            //tongSoLamQuenQuetThe += soLanQuenQuetThe;
                            //tongSoLanDiMuon += soLanDiMuon;
                            //tongSoLanVeSom += soLanVeSom;
                            //tongSoPhutLamThuaGio += soPhutLamThuaGio;

                            //tongCaLamViecNgayThuong += soCaLamViecNgayThuong;
                            //tongCaLamViecNgayNghi += soCaLamViecNgayNghi;
                            //tongCaLamViecNgayLe += soCaLamViecNgayLe;
                            //tongThoiGianRaNgoaiBiTruGio += thoiGianRaNgoaiBiTruGio;
                            //tongCaNghi += soCaNghi;
                            #endregion

                            day.AddDays(1);
                        }
                        catch (Exception ex)
                        {
                            error += ex.Message + "<br />";
                        }
                        #endregion
                    }

                    // thống kê số ca làm việc của từng cán bộ
                    if (soLanChitTayBatBuoc == -1)
                    {
                        thongKeCaLamViec = new TongHopCongController().GetThongKeCaLamViec(dicThongKeCaLamViec);
                    }

                    #region Cập nhật vào bảng tổng hợp công
                    //DAL.TongHopCong cong = new TongHopCong()
                    //{
                    //    MA_CB = item.MA_CB,
                    //    IdDanhSachBangTongHopCong = int.Parse(hdfIdBangTongHopCong.Text),
                    //    SoPhutDiTre = tongPhutDiTre,
                    //    SoPhutLamThemNgayLe = tongSoPhutLamThemNgayLe,
                    //    SoPhutLamThemNgayNghi = tongSoPhutLamThemNgayNghi,
                    //    SoPhutLamThemNgayThuong = tongSoPhutLamThemNgayThuong,
                    //    GioCongThucTe = tongGioCongThucTe,  // tính theo phút
                    //    GioCongDinhMuc = tongGioCongDinhMuc,
                    //    SoPhutVeSom = tongPhutVeSom,
                    //    NghiBu = nghiBu,
                    //    NghiKhongLuong = nghiKhongLuong,
                    //    NghiCheDo = nghiCheDo,
                    //    NghiLe = nghiLe,
                    //    NghiPhep = nghiPhep,
                    //    TinhToanSai = isFail,
                    //    SoLanQuenQuetThe = tongSoLamQuenQuetThe,
                    //    SoLanDiTre = tongSoLanDiMuon,
                    //    SoLanVeSom = tongSoLanVeSom,
                    //    TongThoiGianLamThuaGio = tongSoPhutLamThuaGio,
                    //    ThongKeCaLamViec = thongKeCaLamViec,
                    //    TongCaLamViecNgayThuong = tongCaLamViecNgayThuong,
                    //    TongCaLamViecNgayNghi = tongCaLamViecNgayNghi,
                    //    TongCaLamViecNgayLe = tongCaLamViecNgayLe,
                    //    ThoiGianRaNgoaiBiTru = tongThoiGianRaNgoaiBiTruGio,
                    //    TongCaNghi = tongCaNghi,
                    //};
                    //if (isNew == true)
                    //{
                    //    new TongHopCongController().Insert(cong);
                    //}
                    //else
                    //{
                    //    cong.ID = item.ID;
                    //    new TongHopCongController().Update(cong);
                    //}
                    #endregion
                }
                catch (Exception ex)
                {
                    error += ex.Message + "<br />";
                }
            }
            X.Msg.Alert("", error).Show();
            return("");
        }
        catch (Exception ex)
        {
            X.Msg.Alert("Thông báo từ hệ thống", ex.Message).Show();
            return(ex.Message);
        }
    }