public void UpdateNguocNhanVien_BaoHiem()
    {
        BHNHANVIEN_BAOHIEM nvbh = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(Convert.ToInt32(hdfIdNhanVien_BaoHiem.Text));

        nvbh.IDNhanVien_BaoHiem = Convert.ToInt32(hdfIdNhanVien_BaoHiem.Text);
        if (!string.IsNullOrEmpty(txtLuongDongBHXHMoi1.Text))
        {
            nvbh.LuongBaoHiem = Convert.ToDecimal(txtLuongDongBHXHMoi1.Text);
        }
        if (!string.IsNullOrEmpty(txtPhuCapTNNMoi1.Text))
        {
            nvbh.PhuCapTNN = Convert.ToDecimal(txtPhuCapTNNMoi1.Text);
        }
        if (!string.IsNullOrEmpty(txtPhuCapCVMoi1.Text))
        {
            nvbh.PhuCapCV = Convert.ToDecimal(txtPhuCapCVMoi1.Text);
        }
        if (!string.IsNullOrEmpty(txtPhuCapTNVKMoi1.Text))
        {
            nvbh.PhuCapTNVK = Convert.ToDecimal(txtPhuCapTNVKMoi1.Text);
        }

        NhanVien_BaoHiemController nvc = new NhanVien_BaoHiemController();

        nvc.UpdateNhanVien_BaoHiem(nvbh);
    }
    public int TinhSoThangDongBaoHiem(int idNhanVien, int ThoiGianDongTruoc)
    {
        var macb = new NhanVien_BaoHiemController().GetMaCBByIDNhanVienBH(idNhanVien);
        var rs   = (from t in dataContext.BangThanhToanLuongs
                    where t.MaCB == macb
                    select t).ToList();

        return(ThoiGianDongTruoc + rs.Count);
    }
Exemple #3
0
    //click vào nút thêm, hoặc sửa. load thông tin của nhân viên
    protected void btnAddXemTheoNhanVien_Click(object sender, DirectEventArgs e)
    {
        //txtThoiGianDong1.StyleSpec = "color:black";
        //txtSoNgayNghi1.StyleSpec = "color:black";
        //new BaoHiemController().ClearControl(wdXemTheoNhanVien);
        DAL.BHNHANVIEN_BAOHIEM nvbh = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByIDNhanVien_BaoHiem(int.Parse(hdfIDNhanVienBaoHiem.Text));
        txtMaCanBo1.Text = nvbh.MaNhanVien;
        txtHoTen1.Text   = nvbh.HoTen;
        if (!Util.GetInstance().IsDateNull(nvbh.NgaySinh))
        {
            dfNgaySinh1.SelectedDate = (DateTime)nvbh.NgaySinh;
        }
        txtSoSoBHXH1.Text     = nvbh.SoSoBHXH;
        txtSoCMND1.Text       = nvbh.SoCMTND;
        txtThoiGianDong1.Text = new BaoHiemController().ChuyenSoThangDongBH(Convert.ToInt32(nvbh.ThoiGianDongBaoHiem));
        ThoiGianDongBHXH      = Convert.ToInt32(nvbh.ThoiGianDongBaoHiem);

        if (string.IsNullOrEmpty(nvbh.SoSoBHXH))
        {
            txtSoSoBHXH1.StyleSpec = "color:red;";
            Dialog.ShowNotification("Nhân viên này chưa có số sổ BHXH");
        }
        // chkDaThanhToan1.Checked = true;
        if (hdfwdShow.Text == "Sua")
        {
            int iddieukienhuong;
            DAL.BHCHITIETCHEDOBAOHIEM chitiet = new CheDoBaoHiemController().GetChiTietCheDoBaoHiemByID(int.Parse(hdfIDChiTietCheDoBaoHiem.Text));
            iddieukienhuong = chitiet.IDBangTinhCheDoBaoHiem;
            DAL.BHBANGTINHCHEDOBAOHIEM bangtinh = new BangTinhCheDoBaoHiemController().GetByPrKey(chitiet.IDBangTinhCheDoBaoHiem);
            //cbbCheDo1Store
            // RM.RegisterClientScriptBlock("abc","cbbCheDo1Store.reload();");
            cbbCheDo1.SetValue(bangtinh.IDCheDoBaoHiem);
            hdfIDCheDoBaoHiem.Text = bangtinh.IDCheDoBaoHiem.ToString();
            RM.RegisterClientScriptBlock("abc", "cbbDieuKienHuong1Store.reload();");
            hdfDieuKienHuong.Text = bangtinh.IDBangTinhCheDoBaoHiem.ToString();
            cbbDieuKienHuong1.SetValue(iddieukienhuong);
            cbbDieuKienHuong1.Text = bangtinh.TenDieuKienHuong;
            if (!Util.GetInstance().IsDateNull(chitiet.NgayBatDau))
            {
                dfNgayBatDau1.SelectedDate = chitiet.NgayBatDau;
            }
            if (!Util.GetInstance().IsDateNull(chitiet.NgayKetThuc))
            {
                dfNgayKetThuc1.SelectedDate = chitiet.NgayKetThuc;
            }
            txtSoTienDeNghi1.Text   = chitiet.SoTienDeNghi.ToString();
            txtSoNgayNghi1.Text     = chitiet.SoNgayNghi.ToString();
            chkDaThanhToan1.Checked = chitiet.TinhTrangThanhToan;
            txtChiTieuLuong1.Text   = chitiet.TienLuongTinhHuong.ToString();
            txtGhiChu1.Text         = chitiet.GhiChu;
            txtLuyKe1.Text          = new CheDoBaoHiemController().TinhSoNgayNghiNhanVien(int.Parse(hdfIDNhanVienBaoHiem.Text), int.Parse(hdfIDCheDoBaoHiem.Text)).ToString();
        }
    }
    [DirectMethod] //khi kích vào nút sửa, tự động load dữ liệu biến động
    public void loadThongTinBienDong()
    {              // thay đổi title icon windown
        wdThemSuaBienDongNhanVien.Title = "Sửa biến động cho nhân viên";
        wdThemSuaBienDongNhanVien.Icon  = Icon.Pencil;
        ChiTietNhanVienBienDongInfo bdbh = new QuanLyBienDongBaoHiemController().GetByIDBienDongBaoHiem(int.Parse(hdfChiTietID.Text));

        txtMaCanBo1.Text  = bdbh.MaNhanVien;
        txtHoTen1.Text    = bdbh.HoTen;
        dfNgaySinh1.Value = bdbh.NgaySinh;
        txtSoSoBHXH1.Text = bdbh.MaSo;
        // thông tin về truy thu thoái thu
        nfTruyThuBHXH.Text  = bdbh.TruyThuBHXH.ToString();
        nfTruyThuBHYT.Text  = bdbh.TruyThuBHYT.ToString();
        nfThoaiThuBHXH.Text = bdbh.ThoaiThuBHXH.ToString();
        nfThoaiThuBHYT.Text = bdbh.ThoaiThuBHYT.ToString();
        //thong tin nhan vien
        DAL.BHNHANVIEN_BAOHIEM hs = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(hdfMaNhanVien.Value.ToString());
        txtLuongDongBH1.Text      = hs.LuongBaoHiem.ToString();
        txtThoiGianDongBHXH1.Text = new BaoHiemController().ChuyenSoThangDongBH((int)hs.ThoiGianDongBaoHiem);
        // check
        chkBHTN1.SetValue(hs.DangDongBHTN);
        chkBHYT1.SetValue(hs.DangDongBHYT);
        chkBHXH1.SetValue(hs.DangDongBHXH);
        hdfIsBHXH.Text = hs.DangDongBHXH.ToString();
        hdfIsBHYT.Text = hs.DangDongBHYT.ToString();
        hdfIsBHTN.Text = hs.DangDongBHTN.ToString();

        //thông tin quy định biến động
        DAL.BHQUYDINHBIENDONG qdbd = new BHQUYDINHBIENDONGController().Lay1QuyDinhBienDong(bdbh.IDQuyDinhBienDong);
        //set 1 số id cho hiddenfield
        hdfIdNhanVien_BaoHiem.Text = hs.IDNhanVien_BaoHiem.ToString();
        hdfIDQuyDinhBienDong.Text  = qdbd.IDQuyDinhBienDong.ToString();
        hdfIDLoaiCheDo.Text        = qdbd.IDCheDoBaoHiem.ToString();
        hdfMaLoaiBienDong.Text     = qdbd.MaBienDong;
        tgfChonBienDong1.Text      = qdbd.TenBienDong;  //dt.Rows[0]["TenBienDong"].ToString();
        hdfMaLoaiBienDong.Text     = qdbd.MaBienDong;
        chkBHXH1.Checked           = (bool)qdbd.IsBHXH; // (bool)dt.Rows[0]["IsBHXH"];
        chkBHYT1.Checked           = (bool)qdbd.IsBHYT; // (bool)dt.Rows[0]["IsBHYT"];
        chkBHTN1.Checked           = (bool)qdbd.IsBHTN; // (bool)dt.Rows[0]["IsBHTN"];
        if (qdbd.IDCheDoBaoHiem != null)
        {
            hdfIDLoaiCheDo.Text = qdbd.IDCheDoBaoHiem.ToString();
            //       RM.RegisterClientScriptBlock("rlst", "#{cbbLoaiCheDo1_Store}.reload();");
        }
        hdfIDQuyDinhBienDong.Text = qdbd.IDQuyDinhBienDong.ToString();// dt.Rows[0]["IDQuyDinhBienDong"].ToString();


        txtLuongDongBHXHCu1.Text  = bdbh.TienLuongCu.ToString();
        txtPhuCapTNVKCu1.Text     = bdbh.PhuCapTNVKCu.ToString();
        txtPhuCapTNNCu1.Text      = bdbh.PhuCapNgheCu.ToString();
        txtPhuCapCVCu1.Text       = bdbh.PhuCapCVCu.ToString();
        txtLuongDongBHXHMoi1.Text = bdbh.TienLuongMoi.ToString();
        txtPhuCapCVMoi1.Text      = bdbh.PhuCapCVMoi.ToString();
        txtPhuCapTNNMoi1.Text     = bdbh.PhuCapTNNgheMoi.ToString();
        txtPhuCapTNVKMoi1.Text    = bdbh.PhuCapTNVKMoi.ToString();
        txtLuongDongBHXHMoi1.Text = bdbh.TienLuongMoi.ToString();
        //if (qdbd.LoaiAnhHuong == "TMD" || qdbd.LoaiAnhHuong == "GMD")
        //{
        //    RM.RegisterClientScriptBlock("rl10", "#{pnlThongTinLuong1}.enable();");//#{tabPanel1}.addTab(#{pnlThongTinLuong1});
        //}
        //else
        //{
        //    RM.RegisterClientScriptBlock("rl11", "#{pnlThongTinLuong1}.disable();");//#{tabPanel1}.closeTab(#{pnlThongTinLuong1}, 'hide');
        //}

        //if (qdbd.LoaiAnhHuong == "TruyThu" || qdbd.LoaiAnhHuong == "ThoaiThu")
        //{
        //    RM.RegisterClientScriptBlock("rl2", "#{pnlTruyThoaithu1}.enable();");//#{tabPanel1}.addTab(#{pnlThongTinLuong1});
        //}
        //else
        //{
        //    RM.RegisterClientScriptBlock("rl13", "#{pnlTruyThoaithu1}.disable();");//#{tabPanel1}.closeTab(#{pnlThongTinLuong1}, 'hide');
        //    //RM.RegisterClientScriptBlock("rl4", "#{tabPanel}.closeTab(#{pnlTruyThoaithu}, 'hide');");
        //}

        dfTuNgay1.Value = bdbh.TuNgay.Value;
        if (bdbh.DenNgay != null)
        {
            dfDenNgay1.Value = bdbh.DenNgay;
        }
        if (bdbh.ThangDangKy.HasValue)
        {
            dfNgayDangKyVoiCQBH.Value = bdbh.ThangDangKy.Value;
        }
        chkDaCoSo.Checked      = (bool)bdbh.DaCoSo;
        chkKhongTraThe.Checked = (bool)bdbh.KhongTraThe;
        txtDienGiai1.Text      = bdbh.DienGiai;
        //Thông tin chế độ.
    }
    [DirectMethod]//khi kích vào nút thêm, tự động load dữ liệu của nhân viên
    public void loadThongTinNhanVien()
    {
        btnLayThayDoiTuQuyetDinhLuong.Disabled = false;
        BHNHANVIEN_BAOHIEM hs = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(hdfMaNhanVien.Value.ToString());

        txtMaCanBo1.Text           = hs.MaNhanVien;
        dfNgaySinh1.Value          = hs.NgaySinh;
        txtLuongDongBH1.Text       = hs.LuongBaoHiem.ToString();
        txtHoTen1.Text             = hs.HoTen;
        txtSoSoBHXH1.Text          = hs.SoSoBHXH;
        txtThoiGianDongBHXH1.Text  = new BaoHiemController().ChuyenSoThangDongBH(Convert.ToInt32(hs.ThoiGianDongBaoHiem));
        hdfIdNhanVien_BaoHiem.Text = hs.IDNhanVien_BaoHiem.ToString();
        //set check vaf hidden field cho check
        chkBHTN1.Checked = (bool)hs.DangDongBHTN;
        chkBHYT1.Checked = (bool)hs.DangDongBHYT;
        chkBHXH1.Checked = (bool)hs.DangDongBHXH;
        hdfIsBHXH.Text   = hs.DangDongBHXH.ToString();
        hdfIsBHYT.Text   = hs.DangDongBHYT.ToString();
        hdfIsBHTN.Text   = hs.DangDongBHTN.ToString();
        //if (hs.TrangThaiCapTheBHYT != null)
        //    chkKhongTraThe.Checked = hs.TrangThaiCapTheBHYT == "DaCapThe" ? true : false;
        chkKhongTraThe.Checked = false;
        if (hs.TrangThaiCapSoBHXH != null)
        {
            chkDaCoSo.Checked = hs.TrangThaiCapSoBHXH == "DaCapSo" ? true : false;
        }
        if (!string.IsNullOrEmpty(hs.LuongBaoHiem.ToString()))
        {
            txtLuongDongBHXHCu1.Text  = hs.LuongBaoHiem.ToString();
            txtLuongDongBHXHMoi1.Text = txtLuongDongBHXHCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapCV.ToString()))
        {
            txtPhuCapCVCu1.Text  = hs.PhuCapCV.ToString();
            txtPhuCapCVMoi1.Text = txtPhuCapCVCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapTNVK.ToString()))
        {
            txtPhuCapTNVKCu1.Text  = hs.PhuCapTNVK.ToString();
            txtPhuCapTNVKMoi1.Text = txtPhuCapTNVKCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapTNN.ToString()))
        {
            txtPhuCapTNNCu1.Text  = hs.PhuCapTNN.ToString();
            txtPhuCapTNNMoi1.Text = txtPhuCapTNNCu1.Text;
        }
        dfTuNgay1.SelectedDate = DateTime.Now;
        #region Xử lý thay đổi thông tin lương từ quyết định lương
        txtTTLuongBHCu.Text  = txtLuongDongBHXHCu1.Text;
        txtTTPhuCapCVCu.Text = txtPhuCapCVCu1.Text;
        txtTTPCTNVKCu.Text   = txtPhuCapTNVKCu1.Text;
        txtTTPCTNNCu.Text    = txtPhuCapTNNCu1.Text;
        string   soquyetdinh;
        string   tenquyetdinh;
        DateTime?ngayky;
        DateTime?Ngayhieuluc;
        DateTime?Hethieuluc;
        decimal? luongbaohiem;
        decimal? phucapcv;
        decimal? phucaptnn;
        decimal? phucaptnvk;
        decimal? phucapkhac;
        new BaoHiemController().TTQuyetDinhLuongMoiNhat(hs.IDNhanVien_BaoHiem, out soquyetdinh, out tenquyetdinh, out ngayky, out Ngayhieuluc, out Hethieuluc, out luongbaohiem, out phucapcv, out phucaptnn, out phucaptnvk, out phucapkhac);
        txtTTSoQD.Text  = soquyetdinh;
        txtTTTenQD.Text = tenquyetdinh;
        if (!new SoftCore.Util().IsDateNull(Ngayhieuluc))
        {
            dfTTNgayHieuLuc.SelectedDate = (DateTime)Ngayhieuluc;
        }
        if (!new SoftCore.Util().IsDateNull(Hethieuluc))
        {
            dfTTNgayHetHieuLuc.SelectedDate = (DateTime)Hethieuluc;
        }

        if (luongbaohiem != null)
        {
            txtTTLuongBHMoi.Text      = luongbaohiem.ToString();
            txtLuongDongBHXHMoi1.Text = txtLuongDongBHXHCu1.Text;
        }
        if (phucapcv != null)
        {
            txtTTPhuCapCVMoi.Text = phucapcv.ToString();
            txtPhuCapCVMoi1.Text  = txtPhuCapCVCu1.Text;
        }
        if (phucaptnn != null)
        {
            txtTTPCTNNMoi.Text    = phucaptnn.ToString();
            txtPhuCapTNNMoi1.Text = txtPhuCapTNNCu1.Text;
        }
        if (phucaptnvk != null)
        {
            txtTTPCTNVKMoi.Text    = phucaptnvk.ToString();
            txtPhuCapTNVKMoi1.Text = txtPhuCapTNVKCu1.Text;
        }
        #endregion
    }
    //sự kiện cập nhật sửa
    protected void btnCapNhatSua_Click(object sender, DirectEventArgs e)
    {
        QuanLyBienDongBaoHiemController qlbd = new QuanLyBienDongBaoHiemController();
        BHBIENDONGBAOHIEM bdbh = qlbd.GetBienDongBaoHiemByID(int.Parse(hdfChiTietID.Text));

        bdbh.IDQuyDinhBienDong = int.Parse(hdfIDQuyDinhBienDong.Text);
        bdbh.TuNgay            = (DateTime)dfTuNgay1.Value;

        if (!SoftCore.Util.GetInstance().IsDateNull(dfDenNgay1.SelectedDate))
        {
            bdbh.DenNgay = (DateTime)dfDenNgay1.Value;
        }
        if (!SoftCore.Util.GetInstance().IsDateNull(dfNgayDangKyVoiCQBH.SelectedDate))
        {
            bdbh.ThangDangKy = (DateTime)dfNgayDangKyVoiCQBH.Value;
        }
        DAL.BHQUYDINHBIENDONG qdbd = new BHQUYDINHBIENDONGController().Lay1QuyDinhBienDong(bdbh.IDQuyDinhBienDong);
        bdbh.Loai = qdbd.LoaiAnhHuong;
        BHNHANVIEN_BAOHIEM hs = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(hdfMaNhanVien.Value.ToString());

        if (!string.IsNullOrEmpty(hs.LuongBaoHiem.ToString()))
        {
            txtLuongDongBHXHCu1.Text  = hs.LuongBaoHiem.ToString();
            txtLuongDongBHXHMoi1.Text = txtLuongDongBHXHCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapCV.ToString()))
        {
            txtPhuCapCVCu1.Text  = hs.PhuCapCV.ToString();
            txtPhuCapCVMoi1.Text = txtPhuCapCVCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapTNVK.ToString()))
        {
            txtPhuCapTNVKCu1.Text  = hs.PhuCapTNVK.ToString();
            txtPhuCapTNVKMoi1.Text = txtPhuCapTNVKCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapTNN.ToString()))
        {
            txtPhuCapTNNCu1.Text  = hs.PhuCapTNN.ToString();
            txtPhuCapTNNMoi1.Text = txtPhuCapTNNCu1.Text;
        }
        if (qdbd.LoaiAnhHuong == "TMD" || qdbd.LoaiAnhHuong == "GMD")
        {
            bdbh.TienLuongCu     = txtLuongDongBHXHCu1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHCu1.Text.Replace('.', ','));
            bdbh.PhuCapTNVKCu    = txtPhuCapTNVKCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNVKCu1.Text.Replace('.', ','));
            bdbh.PhuCapNgheCu    = txtPhuCapTNNCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNNCu1.Text.Replace('.', ','));
            bdbh.PhuCapCVCu      = txtPhuCapCVCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapCVCu1.Text.Replace('.', ','));
            bdbh.TienLuongMoi    = txtLuongDongBHXHMoi1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHMoi1.Text.Replace('.', ','));
            bdbh.PhuCapCVMoi     = txtPhuCapCVMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapCVMoi1.Text.Replace('.', ','));
            bdbh.PhuCapTNNgheMoi = txtPhuCapTNNMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNNMoi1.Text.Replace('.', ','));
            bdbh.PhuCapTNVKMoi   = txtPhuCapTNVKMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNVKMoi1.Text.Replace('.', ','));
            bdbh.TienLuongMoi    = txtLuongDongBHXHMoi1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHMoi1.Text.Replace('.', ','));

            if (e.ExtraParams["Command"] == "Insert")
            {
                if (hdfMaLoaiBienDong.Text == "TMD" || hdfMaLoaiBienDong.Text == "GMD")
                {
                    UpdateNguocNhanVien_BaoHiem();
                }
            }
        }
        else if (qdbd.LoaiAnhHuong == "TruyThu")
        {
            bdbh.TruyThuBHXH = nfTruyThuBHXH.Text == "" ? 0 : Convert.ToDecimal(nfTruyThuBHXH.Text.Replace('.', ','));
            bdbh.TruyThuBHYT = nfTruyThuBHYT.Text == "" ? 0 : Convert.ToDecimal(nfTruyThuBHYT.Text.Replace('.', ','));
        }
        else if (qdbd.LoaiAnhHuong == "ThoaiThu")
        {
            bdbh.ThoaiThuBHYT = nfThoaiThuBHYT.Text == "" ? 0 : Convert.ToDecimal(nfThoaiThuBHYT.Text.Replace('.', ','));
            bdbh.ThoaiThuBHXH = nfThoaiThuBHXH.Text == "" ? 0 : Convert.ToDecimal(nfThoaiThuBHXH.Text.Replace('.', ','));
        }
        else
        {
            bdbh.TienLuongCu     = txtLuongDongBHXHCu1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHCu1.Text.Replace('.', ','));
            bdbh.PhuCapTNVKCu    = txtPhuCapTNVKCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNVKCu1.Text.Replace('.', ','));
            bdbh.PhuCapNgheCu    = txtPhuCapTNNCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNNCu1.Text.Replace('.', ','));
            bdbh.PhuCapCVCu      = txtPhuCapCVCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapCVCu1.Text.Replace('.', ','));
            bdbh.TienLuongMoi    = txtLuongDongBHXHMoi1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHMoi1.Text.Replace('.', ','));
            bdbh.PhuCapCVMoi     = txtPhuCapCVMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapCVMoi1.Text.Replace('.', ','));
            bdbh.PhuCapTNNgheMoi = txtPhuCapTNNMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNNMoi1.Text.Replace('.', ','));
            bdbh.PhuCapTNVKMoi   = txtPhuCapTNVKMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNVKMoi1.Text.Replace('.', ','));
            bdbh.TienLuongMoi    = txtLuongDongBHXHMoi1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHMoi1.Text.Replace('.', ','));
        }

        bdbh.KhongTraThe = chkKhongTraThe.Checked;
        bdbh.DaCoSo      = chkDaCoSo.Checked;
        bdbh.DienGiai    = txtDienGiai1.Text;
        qlbd.UpdateBienDongBaoHiem(bdbh);

        //update tinh trangg dong cho nhan vien
        BHNHANVIEN_BAOHIEM nvbh = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(Convert.ToInt32(hdfIdNhanVien_BaoHiem.Text));

        nvbh.IDNhanVien_BaoHiem = Convert.ToInt32(hdfIdNhanVien_BaoHiem.Text);
        nvbh.DangDongBHXH       = chkBHXH1.Checked;
        nvbh.DangDongBHYT       = chkBHYT1.Checked;
        nvbh.DangDongBHTN       = chkBHTN1.Checked;
        new NhanVien_BaoHiemController().UpdateNhanVien_BaoHiem(nvbh);


        Dialog.ShowNotification("Thông báo", "Đã cập nhật thành công");
        if (e.ExtraParams["Close"] == "True")
        {
            wdThemSuaBienDongNhanVien.Hide();
        }
        grpChiTietNhanVien.Reload();
        grpBienDongBaoHiem.Reload();
    }
    // sự kiện nút lưu thêm
    protected void bt_addclick(object sender, DirectEventArgs e)
    {
        //get usercontrol all
        DAL.BHBIENDONGBAOHIEM bdbh = new DAL.BHBIENDONGBAOHIEM();
        bdbh.MaNhanVien         = txtMaCanBo1.Text;
        bdbh.HoTen              = txtHoTen1.Text;
        bdbh.NgaySinh           = Convert.ToDateTime(dfNgaySinh1.Value);
        bdbh.MaSo               = txtSoSoBHXH1.Text;
        bdbh.IDQuyDinhBienDong  = Convert.ToInt32(hdfIDQuyDinhBienDong.Text);
        bdbh.IDNhanVien_BaoHiem = Convert.ToInt32(hdfIdNhanVien_BaoHiem.Text);
        bdbh.TuNgay             = Convert.ToDateTime(dfTuNgay1.Value);
        if (Radio1.Checked == true)
        {
            bdbh.TruyThuBHXH = decimal.Parse("0" + NumberField2.Text);
            bdbh.TruyThuBHYT = decimal.Parse("0" + NumberField3.Text);
        }
        else if (Radio2.Checked == true)
        {
            bdbh.ThoaiThuBHXH = decimal.Parse("0" + NumberField2.Text);
            bdbh.ThoaiThuBHYT = decimal.Parse("0" + NumberField3.Text);
        }
        if (!new SoftCore.Util().IsDateNull(dfDenNgay1.SelectedDate))
        {
            bdbh.DenNgay = Convert.ToDateTime(dfDenNgay1.Value);
        }
        DAL.BHQUYDINHBIENDONG qdbd = new BHQUYDINHBIENDONGController().Lay1QuyDinhBienDong(bdbh.IDQuyDinhBienDong);
        BHNHANVIEN_BAOHIEM    hs   = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(hdfMaNhanVien.Value.ToString());

        if (!string.IsNullOrEmpty(hs.LuongBaoHiem.ToString()))
        {
            txtLuongDongBHXHCu1.Text  = hs.LuongBaoHiem.ToString();
            txtLuongDongBHXHMoi1.Text = txtLuongDongBHXHCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapCV.ToString()))
        {
            txtPhuCapCVCu1.Text  = hs.PhuCapCV.ToString();
            txtPhuCapCVMoi1.Text = txtPhuCapCVCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapTNVK.ToString()))
        {
            txtPhuCapTNVKCu1.Text  = hs.PhuCapTNVK.ToString();
            txtPhuCapTNVKMoi1.Text = txtPhuCapTNVKCu1.Text;
        }
        if (!string.IsNullOrEmpty(hs.PhuCapTNN.ToString()))
        {
            txtPhuCapTNNCu1.Text  = hs.PhuCapTNN.ToString();
            txtPhuCapTNNMoi1.Text = txtPhuCapTNNCu1.Text;
        }

        if (qdbd.LoaiAnhHuong == "TMD" || qdbd.LoaiAnhHuong == "GMD")
        {
            bdbh.TienLuongCu     = txtLuongDongBHXHCu1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHCu1.Text.Replace('.', ','));
            bdbh.PhuCapTNVKCu    = txtPhuCapTNVKCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNVKCu1.Text.Replace('.', ','));
            bdbh.PhuCapNgheCu    = txtPhuCapTNNCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNNCu1.Text.Replace('.', ','));
            bdbh.PhuCapCVCu      = txtPhuCapCVCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapCVCu1.Text.Replace('.', ','));
            bdbh.TienLuongMoi    = txtLuongDongBHXHMoi1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHMoi1.Text.Replace('.', ','));
            bdbh.PhuCapCVMoi     = txtPhuCapCVMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapCVMoi1.Text.Replace('.', ','));
            bdbh.PhuCapTNNgheMoi = txtPhuCapTNNMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNNMoi1.Text.Replace('.', ','));
            bdbh.PhuCapTNVKMoi   = txtPhuCapTNVKMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNVKMoi1.Text.Replace('.', ','));
            bdbh.TienLuongMoi    = txtLuongDongBHXHMoi1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHMoi1.Text.Replace('.', ','));
        }
        if (qdbd.LoaiAnhHuong == "TLD")
        {
            bdbh.TienLuongCu     = 0;
            bdbh.PhuCapTNVKCu    = 0;
            bdbh.PhuCapNgheCu    = 0;
            bdbh.PhuCapCVCu      = 0;
            bdbh.TienLuongMoi    = txtLuongDongBHXHMoi1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHMoi1.Text.Replace('.', ','));
            bdbh.PhuCapCVMoi     = txtPhuCapCVMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapCVMoi1.Text.Replace('.', ','));
            bdbh.PhuCapTNNgheMoi = txtPhuCapTNNMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNNMoi1.Text.Replace('.', ','));
            bdbh.PhuCapTNVKMoi   = txtPhuCapTNVKMoi1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNVKMoi1.Text.Replace('.', ','));
            bdbh.TienLuongMoi    = txtLuongDongBHXHMoi1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHMoi1.Text.Replace('.', ','));
        }
        if (qdbd.LoaiAnhHuong == "GLD")
        {
            bdbh.TienLuongCu     = txtLuongDongBHXHCu1.Text == "" ? 0 : Convert.ToDecimal(txtLuongDongBHXHCu1.Text.Replace('.', ','));
            bdbh.PhuCapTNVKCu    = txtPhuCapTNVKCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNVKCu1.Text.Replace('.', ','));
            bdbh.PhuCapNgheCu    = txtPhuCapTNNCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapTNNCu1.Text.Replace('.', ','));
            bdbh.PhuCapCVCu      = txtPhuCapCVCu1.Text == "" ? 0 : Convert.ToDecimal(txtPhuCapCVCu1.Text.Replace('.', ','));
            bdbh.TienLuongMoi    = 0;
            bdbh.PhuCapCVMoi     = 0;
            bdbh.PhuCapTNNgheMoi = 0;
            bdbh.PhuCapTNVKMoi   = 0;
            bdbh.TienLuongMoi    = 0;
        }
        if (qdbd.LoaiAnhHuong.Contains("TruyThu"))
        {
            bdbh.TruyThuBHXH = nfTruyThuBHXH.Text == "" ? 0 : Convert.ToDecimal(nfTruyThuBHXH.Text.Replace('.', ','));
            bdbh.TruyThuBHYT = nfTruyThuBHYT.Text == "" ? 0 : Convert.ToDecimal(nfTruyThuBHYT.Text.Replace('.', ','));
        }
        if (qdbd.LoaiAnhHuong.Contains("ThoaiThu"))
        {
            bdbh.ThoaiThuBHXH = nfThoaiThuBHXH.Text == "" ? 0 : Convert.ToDecimal(nfThoaiThuBHXH.Text.Replace('.', ','));
            bdbh.ThoaiThuBHYT = nfThoaiThuBHYT.Text == "" ? 0 : Convert.ToDecimal(nfThoaiThuBHYT.Text.Replace('.', ','));
        }
        bdbh.DaCoSo      = chkDaCoSo.Checked;
        bdbh.KhongTraThe = chkKhongTraThe.Checked;
        bdbh.DienGiai    = txtDienGiai1.Text;
        bdbh.UserID      = CurrentUser.ID;
        bdbh.MaDonVi     = Session["MaDonVi"].ToString();
        bdbh.DateCreate  = DateTime.Now;
        //bdbh.ThangDangKy = DateTime.Now;
        if (!SoftCore.Util.GetInstance().IsDateNull(dfNgayDangKyVoiCQBH.SelectedDate))
        {
            bdbh.ThangDangKy = (DateTime)dfNgayDangKyVoiCQBH.Value;
        }
        bdbh.ChucVu = "";

        //update tinh trangg dong cho nhan vien
        BHNHANVIEN_BAOHIEM nvbh = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(Convert.ToInt32(hdfIdNhanVien_BaoHiem.Text));

        nvbh.IDNhanVien_BaoHiem = Convert.ToInt32(hdfIdNhanVien_BaoHiem.Text);
        nvbh.DangDongBHXH       = chkBHXH1.Checked;
        nvbh.DangDongBHYT       = chkBHYT1.Checked;
        nvbh.DangDongBHTN       = chkBHTN1.Checked;
        bdbh.NgaySinh           = nvbh.NgaySinh;
        bdbh.GioiTinh           = nvbh.GioiTinh ?? true;
        bdbh.Loai = qdbd.LoaiAnhHuong;

        new QuanLyBienDongBaoHiemController().InsertBienDongBaoHiem(bdbh);
        new NhanVien_BaoHiemController().UpdateNhanVien_BaoHiem(nvbh);
        Dialog.ShowNotification("Thông báo", "Đã cập nhật thành công");
        if (e.ExtraParams["Command"] == "Insert")
        {
            if (hdfMaLoaiBienDong.Text == "TMD" || hdfMaLoaiBienDong.Text == "GMD")
            {
                UpdateNguocNhanVien_BaoHiem();
            }
        }


        if (e.ExtraParams["Close"] == "True")
        {
            //wdThemSuaBienDongNhanVien.Hide();
            wdThemSuaBienDongNhanVien.Hide();
        }
        grpChiTietNhanVien.Reload();
        grpBienDongBaoHiem.Reload();
        // update ngược lại bảng NHANVIEN_BAOHIEM
    }
Exemple #8
0
    //sự kiện nhấn nút lưu sửa
    public void btnSuaThongTin_Click(object sender, DirectEventArgs e)
    {
        NhanVien_BaoHiemController nvc = new NhanVien_BaoHiemController();

        DAL.BHNHANVIEN_BAOHIEM nvbh = nvc.GetNhanVien_BaoHiemByMaNhanVien(hdfIDNhanVienBaoHiem.Text);

        if (txtHoTenMoi.Text != "")
        {
            nvbh.HoTen = txtHoTenMoi.Text;
            nvbh.Ten   = new CommonUtil().GetFirstNamFromFullName(txtHoTenMoi.Text);
        }

        if (!string.IsNullOrEmpty(nfNgayMoi.Text) && !string.IsNullOrEmpty(nfThangMoi.Text) && !string.IsNullOrEmpty(nfNamMoi.Text))
        {
            nvbh.NgaySinh = new DateTime(int.Parse(nfNamMoi.Text), int.Parse(nfThangMoi.Text), int.Parse(nfNgayMoi.Text));
        }
        if (cbbGioiTinhMoi.SelectedIndex > -1)
        {
            nvbh.GioiTinh = cbbGioiTinhMoi.Value.ToString() != "0";
        }
        if (!string.IsNullOrEmpty(txtSoCMNDMoi.Text))
        {
            nvbh.SoCMTND = txtSoCMNDMoi.Text;
        }
        if (!string.IsNullOrEmpty(nfNgayCapMoi.Text) && !string.IsNullOrEmpty(nfThangCapMoi.Text) && !string.IsNullOrEmpty(nfNamCapMoi.Text))
        {
            nvbh.NgayCapCMTND = new DateTime(int.Parse(nfNamCapMoi.Text), int.Parse(nfThangCapMoi.Text), int.Parse(nfNgayCapMoi.Text));
        }
        if (cbbNoiCapCMNDMoi.SelectedIndex > -1)
        {
            nvbh.NoiCapCMTND = cbbNoiCapCMNDMoi.Value.ToString();
        }
        if (!string.IsNullOrEmpty(txtDiaChiMoi.Text))
        {
            nvbh.DiaChiLienHe = txtDiaChiMoi.Text;
        }
        nvbh.NoiDangKyKCB            = txtNoiDangKyKCBMoi.Value == null ? "" : txtNoiDangKyKCBMoi.Value.ToString();
        nvbh.SoTheBHYT               = txtSoTheBHYTSua.Text;
        nvbh.TuThangBHYT             = bhc.SetValueDatetime(spinTuNamBHYTSua, cbbTuThangBHYTSua, 1);
        nvbh.DenThangBHYT            = bhc.SetValueDatetime(spinDenNamBHYTSua, cbbDenThangBHYTSua, 1);
        nvbh.BHXHTrangThaiDangKyCQBH = chkDaDangKyCQBHSua.Checked;
        nvbh.NgayDangKyBHXH          = bhc.SetValueDatetime(spinNamDangKyBHXHSua, cbbThangDangKyBHXHSua, 1);
        nvbh.DangDongBHXH            = chkDongBHXH.Checked;
        nvbh.DangDongBHYT            = chkDongBHYT.Checked;
        nvbh.DangDongBHTN            = chkDongBHTN.Checked;

        //nvbh.TrangThaiCapSoBHXH = cbbTrangThaiCapSoSua.SelectedItem.Value;
        nvbh.TrangThaiCapSoBHXH = hdfTrangThaiCapSoSua.Text;
        //nvbh.TrangThaiCapTheBHYT = cboTrangThaiCapThe.SelectedItem.Value;
        nvbh.TrangThaiCapTheBHYT = hdfTrangThaiCapThe.Text;
        nvbh.NoiCapSoBHXH        = hdfNoiCapSoBHXHSua.Text;
        nvbh.SoSoBHXH            = txtSoSoBHXHSua.Text;


        if (!string.IsNullOrEmpty(txtLuongBaoHiemSua.Text))
        {
            nvbh.LuongBaoHiem = decimal.Parse(txtLuongBaoHiemSua.Text);
        }
        if (!string.IsNullOrEmpty(txtPhuCapCVSua.Text))
        {
            nvbh.PhuCapCV = decimal.Parse(txtPhuCapCVSua.Text);
        }
        if (!string.IsNullOrEmpty(txtPhuCapKhacSua.Text))
        {
            nvbh.PhuCapKhac = decimal.Parse(txtPhuCapKhacSua.Text);
        }
        if (!string.IsNullOrEmpty(txtPhuCapTNNgheSua.Text))
        {
            nvbh.PhuCapTNN = decimal.Parse(txtPhuCapTNNgheSua.Text);
        }
        if (!string.IsNullOrEmpty(txtPhuCapTNVKSua.Text))
        {
            nvbh.PhuCapTNVK = decimal.Parse(txtPhuCapTNVKSua.Text);
        }

        //if (dfNgayCapSoBHXHSua.Value != null && !dfNgayCapSoBHXHSua.SelectedDate.ToString().Contains("0001"))
        //    nvbh.NgayCapSoBHXH = dfNgayCapSoBHXHSua.SelectedDate;
        if (!Util.GetInstance().IsDateNull(dfNgayCapSoBHXHSua.SelectedDate))
        {
            nvbh.NgayCapSoBHXH = dfNgayCapSoBHXHSua.SelectedDate;
        }
        int thangold = nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy;

        nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy = int.Parse(nfSoThangDongTruocSua.Text == "" ? "0" : nfSoThangDongTruocSua.Text) + int.Parse(nfSoNamDongTruocSua.Text == "" ? "0" : nfSoNamDongTruocSua.Text) * 12;
        nvbh.ThoiGianDongBaoHiem = (nvbh.ThoiGianDongBaoHiem - thangold) + nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy;

        nvc.UpdateNhanVien_BaoHiem(nvbh);

        #region update ngược lại bảng hồ sơ
        var      hsc  = new HoSoController();
        DAL.HOSO hoso = hsc.GetByMaCB(hdfIDNhanVienBaoHiem.Text);
        if (!string.IsNullOrEmpty(txtHoTenMoi.Text))
        {
            hoso.HO_TEN = txtHoTenMoi.Text;
            hoso.TEN_CB = new CommonUtil().GetFirstNamFromFullName(txtHoTenMoi.Text);
        }
        else
        {
            hoso.HO_TEN = txtHoTenCu.Text;
        }
        if (!string.IsNullOrEmpty(nfNgayMoi.Text) && !string.IsNullOrEmpty(nfThangMoi.Text) && !string.IsNullOrEmpty(nfNamMoi.Text))
        {
            hoso.NGAY_SINH = new DateTime(int.Parse(nfNamMoi.Text), int.Parse(nfThangMoi.Text), int.Parse(nfNgayMoi.Text));
        }
        else if (!string.IsNullOrEmpty(nfNgayCu.Text) && !string.IsNullOrEmpty(nfThangCu.Text) && !string.IsNullOrEmpty(nfNamCu.Text))
        {
            hoso.NGAY_SINH = new DateTime(int.Parse(nfNamCu.Text), int.Parse(nfThangCu.Text), int.Parse(nfNgayCu.Text));
        }
        if (cbbGioiTinhMoi.SelectedIndex > -1)
        {
            hoso.MA_GIOITINH = cbbGioiTinhMoi.Value.ToString() == "0" ? "F" : "M";
        }
        else
        {
            hoso.MA_GIOITINH = cbbGioiTinhCu.Value.ToString() == "0" ? "F" : "M";
        }
        if (!string.IsNullOrEmpty(txtSoCMNDMoi.Text))
        {
            hoso.SO_CMND = txtSoCMNDMoi.Text;
        }
        else
        {
            hoso.SO_CMND = txtSoCMNDCu.Text;
        }
        if (!string.IsNullOrEmpty(nfNgayCapMoi.Text) && !string.IsNullOrEmpty(nfThangCapMoi.Text) && !string.IsNullOrEmpty(nfNamCapMoi.Text))
        {
            hoso.NGAYCAP_CMND = new DateTime(int.Parse(nfNamCapMoi.Text), int.Parse(nfThangCapMoi.Text), int.Parse(nfNgayCapMoi.Text));
        }
        else if (!string.IsNullOrEmpty(nfNgayCapCu.Text) && !string.IsNullOrEmpty(nfThangCapCu.Text) && !string.IsNullOrEmpty(nfNamCapCu.Text))
        {
            hoso.NGAYCAP_CMND = new DateTime(int.Parse(nfNamCapCu.Text), int.Parse(nfThangCapCu.Text), int.Parse(nfNgayCapCu.Text));
        }
        if (cbbNoiCapCMNDMoi.SelectedIndex > -1)
        {
            hoso.MA_NOICAP_CMND = cbbNoiCapCMNDMoi.Value.ToString();
        }
        if (!string.IsNullOrEmpty(txtDiaChiMoi.Text))
        {
            hoso.DIA_CHI_LH = txtDiaChiMoi.Text;
        }
        else
        {
            hoso.DIA_CHI_LH = txtDiaChiCu.Text;
        }
        if (!string.IsNullOrEmpty(hdfNoiDungKyKCBMoi.Text))
        {
            hoso.MA_NOI_KCB = hdfNoiDungKyKCBMoi.Text;
        }
        if (!string.IsNullOrEmpty(txtSoTheBHYTSua.Text))
        {
            hoso.SOTHE_BHYT = txtSoTheBHYTSua.Text;
        }
        if (cbbTuThangBHYTSua.SelectedIndex > -1 && !string.IsNullOrEmpty(spinTuNamBHYTSua.Value.ToString()))
        {
            hoso.NGAY_DONGBH = new DateTime(int.Parse(spinTuNamBHYTSua.Text), int.Parse(cbbTuThangBHYTSua.Value.ToString()), 1);
        }
        if (cbbDenThangBHYTSua.SelectedIndex > -1 && !string.IsNullOrEmpty(spinDenNamBHYTSua.Value.ToString()))
        {
            hoso.NGAY_HETHAN_BHYT = new DateTime(int.Parse(spinDenNamBHYTSua.Text), int.Parse(cbbDenThangBHYTSua.Value.ToString()), 1);
        }
        //nvbh.NoiCapSoBHXH = txtNoiCapSoBHXHSua.Text;
        if (!string.IsNullOrEmpty(txtSoSoBHXHSua.Text))
        {
            hoso.SOTHE_BHXH = txtSoSoBHXHSua.Text;
        }
        hsc.UpDateHoSoBaoHiem(hoso);
        #endregion
        grpQuanLyThongTinBaoHiem.Reload();
        wdThayDoiThongTin.Hide();
    }
Exemple #9
0
    [DirectMethod] // sự kiện khi nháy vào nút sửa hoặc dbclick
    public void SuaThongTinNhanVien(string manhanvien)
    {
        TabPanel1.ActiveTab = pnlThongTinChung;
        DAL.BHNHANVIEN_BAOHIEM nvbh = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(manhanvien);
        DAL.HOSO hoso = new HoSoController().GetByMaCB(manhanvien);
        txtHoTenCu.Text = nvbh.HoTen;
        if (nvbh.NgaySinh != null && !nvbh.NgaySinh.ToString().Contains("0001"))
        {
            nfNgayCu.Value  = DateTime.Parse(nvbh.NgaySinh.ToString()).Day;
            nfThangCu.Value = DateTime.Parse(nvbh.NgaySinh.ToString()).Month;
            nfNamCu.Value   = DateTime.Parse(nvbh.NgaySinh.ToString()).Year;
        }
        cbbGioiTinhCu.Value  = nvbh.GioiTinh == false ? 0 : 1;
        txtSoCMNDCu.Text     = hoso.SO_CMND;
        cbbNoiCapCMNDCu.Text = new DM_NOICAP_CMNDController().GetTenByMa(nvbh.NoiCapCMTND);
        // txtSoCMNDCu.Text = nvbh.SoCMTND;
        if (nvbh.NgayCapCMTND != null && !nvbh.NgayCapCMTND.ToString().Contains("0001"))
        {
            nfNgayCapCu.Value  = DateTime.Parse(nvbh.NgayCapCMTND.ToString()).Day;
            nfThangCapCu.Value = DateTime.Parse(nvbh.NgayCapCMTND.ToString()).Month;
            nfNamCapCu.Value   = DateTime.Parse(nvbh.NgayCapCMTND.ToString()).Year;
        }
        txtDiaChiCu.Text       = nvbh.DiaChiLienHe;
        txtNoiDangKyKCBCu.Text = new DM_NOI_KCBController().GetTenByMa(nvbh.NoiDangKyKCB);


        if (nvbh.HoTen != hoso.HO_TEN)
        {
            txtHoTenMoi.Text = hoso.HO_TEN;
        }
        if (nvbh.NgaySinh != hoso.NGAY_SINH)
        {
            if (hoso.NGAY_SINH != null && !hoso.NGAY_SINH.ToString().Contains("0001"))
            {
                nfNgayMoi.Value  = DateTime.Parse(hoso.NGAY_SINH.ToString()).Day;
                nfThangMoi.Value = DateTime.Parse(hoso.NGAY_SINH.ToString()).Month;
                nfNamMoi.Value   = DateTime.Parse(hoso.NGAY_SINH.ToString()).Year;
            }
        }
        if (nvbh.GioiTinh != (hoso.MA_GIOITINH != "F"))
        {
            cbbGioiTinhMoi.Value = (hoso.MA_GIOITINH != "F");
        }
        if (nvbh.SoCMTND != hoso.SO_CMND)
        {
            txtSoCMNDMoi.Text = nvbh.SoCMTND;
        }
        if (nvbh.NgayCapCMTND != hoso.NGAYCAP_CMND)
        {
            if (hoso.NGAYCAP_CMND != null && !hoso.NGAYCAP_CMND.ToString().Contains("0001"))
            {
                nfNgayCapMoi.Value  = DateTime.Parse(hoso.NGAYCAP_CMND.ToString()).Day;
                nfThangCapMoi.Value = DateTime.Parse(hoso.NGAYCAP_CMND.ToString()).Month;
                nfNamCapMoi.Value   = DateTime.Parse(hoso.NGAYCAP_CMND.ToString()).Year;
            }
        }
        if (hoso.MA_NOICAP_CMND != null)
        {
            if (nvbh.NoiCapCMTND != hoso.MA_NOICAP_CMND)
            {
                cbbNoiCapCMNDMoi.Value = hoso.MA_NOICAP_CMND;
            }
        }
        if (nvbh.DiaChiLienHe != hoso.DIA_CHI_LH)
        {
            txtDiaChiMoi.Text = hoso.DIA_CHI_LH;
        }

        if (nvbh.NoiDangKyKCB != hoso.MA_NOI_KCB)
        {
            txtNoiDangKyKCBMoi.Text = new DM_NOI_KCBController().GetTenByMa(hoso.MA_NOI_KCB);
            txtNoiDangKyKCBMoi.SelectedItem.Value = hoso.MA_NOI_KCB;
        }
        //txtNoiDangKyKCBMoi.Value = hoso.MA_NOI_KCB;

        txtLuongBaoHiemSua.Text = nvbh.LuongBaoHiem.ToString();
        txtPhuCapCVSua.Text     = nvbh.PhuCapCV.ToString();
        txtPhuCapKhacSua.Text   = nvbh.PhuCapKhac.ToString();
        txtPhuCapTNNgheSua.Text = nvbh.PhuCapTNN.ToString();
        txtPhuCapTNVKSua.Text   = nvbh.PhuCapTNVK.ToString();

        txtSoTheBHYTSua.Text = nvbh.SoTheBHYT;


        if (!Util.GetInstance().IsDateNull(nvbh.TuThangBHYT))
        {
            cbbTuThangBHYTSua.Value = nvbh.TuThangBHYT.Value.Month;
            spinTuNamBHYTSua.Value  = nvbh.TuThangBHYT.Value.Year;
        }
        if (!Util.GetInstance().IsDateNull(nvbh.DenThangBHYT))
        {
            cbbDenThangBHYTSua.Value = nvbh.DenThangBHYT.Value.Month;
            spinDenNamBHYTSua.Value  = nvbh.DenThangBHYT.Value.Year;
        }
        chkDaDangKyCQBHSua.Checked = bool.Parse(nvbh.BHXHTrangThaiDangKyCQBH.ToString());
        if (nvbh.NgayDangKyBHXH != null && !nvbh.NgayDangKyBHXH.ToString().Contains("0001"))
        {
            cbbThangDangKyBHXHSua.Value = nvbh.NgayDangKyBHXH.Value.Month;
            spinNamDangKyBHXHSua.Value  = nvbh.NgayDangKyBHXH.Value.Year;
        }
        if (!string.IsNullOrEmpty(nvbh.TrangThaiCapSoBHXH))
        {
            cbbTrangThaiCapSoSua.Value = nvbh.TrangThaiCapSoBHXH;
            hdfTrangThaiCapSoSua.SetValue(nvbh.TrangThaiCapSoBHXH);
        }
        if (!string.IsNullOrEmpty(nvbh.TrangThaiCapTheBHYT))
        {
            cboTrangThaiCapThe.Value = nvbh.TrangThaiCapTheBHYT;
            hdfTrangThaiCapThe.SetValue(nvbh.TrangThaiCapTheBHYT);
        }
        else
        {
            hdfTrangThaiCapThe.SetValue("ChuaCapThe");
        }
        //txtNoiCapSoBHXHSua.Text = nvbh.NoiCapSoBHXH;
        if (!string.IsNullOrEmpty(nvbh.NoiCapSoBHXH))
        {
            hdfNoiCapSoBHXHSua.Text = nvbh.NoiCapSoBHXH;
            txtNoiCapSoBHXHSua.Text = new DM_NOICAPBAOHIEMXHController().GetTenByMa(nvbh.NoiCapSoBHXH);
        }
        if (!string.IsNullOrEmpty(nvbh.SoSoBHXH))
        {
            txtSoSoBHXHSua.Text = nvbh.SoSoBHXH;
        }
        if (nvbh.NgayCapSoBHXH != null && !nvbh.NgayCapSoBHXH.ToString().Contains("0001"))
        {
            dfNgayCapSoBHXHSua.SetValue(nvbh.NgayCapSoBHXH);
        }

        chkDongBHXH.Checked = nvbh.DangDongBHXH;
        chkDongBHYT.Checked = nvbh.DangDongBHYT;
        chkDongBHTN.Checked = nvbh.DangDongBHTN;

        nfSoThangDongTruocSua.Text = (nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy % 12).ToString();
        nfSoNamDongTruocSua.Text   = (nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy / 12).ToString();
        RM.RegisterClientScriptBlock("rsSinhNoiDung", "SinhNoiDung();");
        wdThayDoiThongTin.Show();
    }
Exemple #10
0
    //lưu nhân viên đóng mới
    public void btnLuuThem_Click(object sender, DirectEventArgs e)
    {
        //Kiểm tra nhân viên này đã được lưu ở trên bảng BHNhanVien_BaoHiem chưa
        NhanVien_BaoHiemController nbc = new NhanVien_BaoHiemController();

        if (new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(txtMaCanBo.Text) != null)
        {
            RM.RegisterClientScriptBlock("relTrungCanBo", " alert('Cán bộ này đã được quản lý ở phân hệ bảo hiểm');");
            return;
        }
        if (nfSoThangDongTruocThem.Text == "")
        {
            RM.RegisterClientScriptBlock("relChuaNhapThoiGian", " alert('Bạn chưa nhập thời gian đóng trước khi vào công ty cho cán bộ này');");
        }
        // Lưu thông tin vào bảng bhNhanVien_BaoHiem
        NhanVien_BaoHiemController nvc = new NhanVien_BaoHiemController();
        HoSoController             hsc = new HoSoController();

        DAL.HOSO hoso = hsc.GetByMaCB(txtMaCanBo.Text);

        DAL.BHNHANVIEN_BAOHIEM nvbh = new DAL.BHNHANVIEN_BAOHIEM();
        nvbh.IDNhanVien_BaoHiem = int.Parse(hoso.PR_KEY.ToString());
        nvbh.MaNhanVien         = hoso.MA_CB;
        nvbh.HoTen    = hoso.HO_TEN;
        nvbh.Ten      = new CommonUtil().GetFirstNamFromFullName(hoso.HO_TEN);
        nvbh.GioiTinh = hoso.MA_GIOITINH != "F";
        nvbh.NgaySinh = hoso.NGAY_SINH;
        nvbh.HoKhauThuongTruTamTru = hoso.HO_KHAU;
        nvbh.DiaChiLienHe          = hoso.DIA_CHI_LH;
        nvbh.SoCMTND      = hoso.SO_CMND;
        nvbh.NgayCapCMTND = new SoftCore.Util().IsDateNull(hoso.NGAYCAP_CMND) ? null : hoso.NGAYCAP_CMND;
        nvbh.NoiCapCMTND  = hoso.MA_NOICAP_CMND ?? "";
        nvbh.MaChucVu     = hoso.MA_CHUCVU;
        nvbh.LuongBaoHiem = decimal.Parse(nfLuongBaoHiem.Value.ToString());
        nvbh.LoaiBHYT     = "";

        string[] arr = hdfPhuCap.Text.Split(';');
        nvbh.PhuCapCV   = int.Parse(arr[0]);
        nvbh.PhuCapKhac = int.Parse(arr[3]);
        nvbh.PhuCapTNVK = int.Parse(arr[2]);
        nvbh.PhuCapTNN  = int.Parse(arr[1]);
        // hdfPhuCap.Text = phucapcv.ToString() + ";" + phucaptnn.ToString() + ";" + phucaptnvk.ToString() + ";" + phucapkhac.ToString();
        nvbh.NoiDangKyKCB            = hoso.MA_NOI_KCB;
        nvbh.SoTheBHYT               = txtSoTheBHYT.Text;
        nvbh.TuThangBHYT             = new BaoHiemController().SetValueDatetime(spinTuNamBHYT, cbbTuThangBHYT, 1);
        nvbh.DenThangBHYT            = new BaoHiemController().SetValueDatetime(spinDenNamBHYT, cbbDenThangBHYT, 1);
        nvbh.BHXHTrangThaiDangKyCQBH = chkTrangThaiDangKy.Checked;
        nvbh.NgayDangKyBHXH          = new BaoHiemController().SetValueDatetime(spinNamBHXH, cbbThangBHXH, 1);
        //nvbh.TrangThaiCapSoBHXH = cbbTrangthaiCapSo.SelectedItem.Value ?? "ChuaCapSo";
        nvbh.TrangThaiCapSoBHXH = hdfTrangThaiCapSo.Text;
        //nvbh.TrangThaiCapTheBHYT = cbbTrangThaiCapThe.SelectedItem.Value ?? "ChuaCapThe";
        nvbh.TrangThaiCapTheBHYT = hdfTrangThaiCapThe.Text;
        nvbh.NoiCapSoBHXH        = txtNoiCapSoBHXH.Text;
        nvbh.SoSoBHXH            = txtSoSoBHXH.Text;
        if (!util.IsDateNull(dfNgayCapSo.SelectedDate))
        {
            nvbh.NgayCapSoBHXH = dfNgayCapSo.SelectedDate;
        }
        nvbh.DangDongBHXH = chkBHXH.Checked;
        nvbh.DangDongBHYT = chkBHYT.Checked;
        nvbh.DangDongBHTN = chkBHTN.Checked;

        nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy = int.Parse(nfSoThangDongTruocThem.Text == "" ? "0" : nfSoThangDongTruocThem.Text) + int.Parse(nfSoNamDongTruocThem.Text == "" ? "0" : nfSoNamDongTruocThem.Text) * 12;
        //nvbh.ThoiGianDongBaoHiem = nvc.TinhSoThangDongBaoHiem(nvbh.IDNhanVien_BaoHiem, nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy);
        nvbh.ThoiGianDongBaoHiem = nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy;
        nvbh.MaDonVi             = Session["MaDonVi"].ToString();
        nvbh.UserID     = CurrentUser.ID;
        nvbh.DateCreate = DateTime.Now;

        QuanLyThongTinBaoHiemController qlc = new QuanLyThongTinBaoHiemController();

        qlc.LuuNhanVienDongMoi(nvbh);
        Dialog.ShowNotification("Cập nhật dữ liệu thành công");

        if (e.ExtraParams["Close"] == "True")
        {
            wdThongTinDongBHNhanVien.Hide();

            RM.RegisterClientScriptBlock("rs30", "grpQuanLyThongTinBaoHiem_store.reload();");
        }
        else
        {
            RM.RegisterClientScriptBlock("rs32", "grpQuanLyThongTinBaoHiem_store.reload();");
        }
        RM.RegisterClientScriptBlock("rs31", "resetFormThem();");
    }
    public void BindData(ReportFilter rp)
    {
        //string filter dạng hoten_bh,ngaysinh_bh,thangsinh_bh,namsinh_bh,gioitinh_bh,socmnd_bh,ngaycmnd_bh,thangcmnd_bh,namcmnd_bh,noicapcmnd_bh,diachi_bh,noidangky_bh,noidungthaydoi,manhanvien_baohiem
        string hoten_bh           = rp.WhereClause.Split(',')[0];
        string ngaysinh_bh        = rp.WhereClause.Split(',')[1];
        string thangsinh_bh       = rp.WhereClause.Split(',')[2];
        string namsinh_bh         = rp.WhereClause.Split(',')[3];
        string gioitinh_bh        = rp.WhereClause.Split(',')[4];
        string socmnd_bh          = rp.WhereClause.Split(',')[5];
        string ngaycmnd_bh        = rp.WhereClause.Split(',')[6];
        string thangcmnd_bh       = rp.WhereClause.Split(',')[7];
        string namcmnd_bh         = rp.WhereClause.Split(',')[8];
        string noicapcmnd_bh      = rp.WhereClause.Split(',')[9];
        string diachi_bh          = rp.WhereClause.Split(',')[10];
        string noidangky_bh       = rp.WhereClause.Split(',')[11];
        string noidungthaydoi     = rp.WhereClause.Split(',')[12];
        string manhanvien_baohiem = rp.WhereClause.Split(',')[13];

        DAL.BHNHANVIEN_BAOHIEM nvbh = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(manhanvien_baohiem);
        if (!string.IsNullOrEmpty(hoten_bh))
        {
            xrlhoten.Text = "- Tên tôi là (viết chữ in hoa có dấu): " + hoten_bh.ToUpper();
        }
        else
        {
            if (!string.IsNullOrEmpty(nvbh.HoTen))
            {
                xrlhoten.Text = "- Tên tôi là (viết chữ in hoa có dấu): " + nvbh.HoTen.ToUpper();
            }
        }
        if (!string.IsNullOrEmpty(ngaysinh_bh) && !string.IsNullOrEmpty(thangsinh_bh) && !string.IsNullOrEmpty(namsinh_bh))
        {
            xrlnamsinh.Text = "- Ngày tháng năm sinh: " + ngaysinh_bh + "/" + thangsinh_bh + "/" + namsinh_bh;
        }
        else
        {
            if (nvbh.NgaySinh != null && !nvbh.NgaySinh.ToString().Contains("0001"))
            {
                xrlnamsinh.Text = "- Ngày tháng năm sinh: " + Convert.ToDateTime(nvbh.NgaySinh).Day + "/" + Convert.ToDateTime(nvbh.NgaySinh).Month + "/" + Convert.ToDateTime(nvbh.NgaySinh).Year;
            }
        }
        if (!string.IsNullOrEmpty(gioitinh_bh))
        {
            if (gioitinh_bh == "0")
            {
                xrlgioitinh.Text = "Giới tính: " + "Nữ";
            }
            else
            {
                xrlgioitinh.Text = "Giới tính: " + "Nam";
            }
        }
        else
        {
            if (!string.IsNullOrEmpty(nvbh.GioiTinh.ToString()))
            {
                if (nvbh.GioiTinh == true)
                {
                    xrlgioitinh.Text = "Giới tính: " + "Nam";
                }
                else
                {
                    xrlgioitinh.Text = "Giới tính: " + "Nữ";
                }
            }
        }
        string tendonvi = new DM_DONVIController().GetNameById(nvbh.MaDonVi);

        if (!string.IsNullOrEmpty(tendonvi))
        {
            xrldonvi.Text = "- Đơn vị: " + tendonvi;
        }
        if (!string.IsNullOrEmpty(socmnd_bh))
        {
            xrlcmt.Text = "- CMT số: " + socmnd_bh;
        }
        else
        {
            if (!string.IsNullOrEmpty(nvbh.SoCMTND))
            {
                xrlcmt.Text = "- CMT số: " + nvbh.SoCMTND;
            }
        }
        if (!string.IsNullOrEmpty(noicapcmnd_bh))
        {
            xrlnoicap.Text = "nơi cấp: " + noicapcmnd_bh;
        }
        else
        {
            if (!string.IsNullOrEmpty(nvbh.NoiCapCMTND))
            {
                xrlnoicap.Text = "nơi cấp: " + nvbh.NoiCapCMTND;
            }
        }
        if (!string.IsNullOrEmpty(ngaycmnd_bh) && !string.IsNullOrEmpty(thangcmnd_bh) && !string.IsNullOrEmpty(namcmnd_bh))
        {
            xrlngaycap.Text = "ngày cấp: " + ngaycmnd_bh + "/" + thangcmnd_bh + "/" + namcmnd_bh;
        }
        else
        {
            // txtSoCMNDCu.Text = nvbh.SoCMTND;
            if (nvbh.NgayCapCMTND != null && !nvbh.NgayCapCMTND.ToString().Contains("0001"))
            {
                xrlngaycap.Text = "ngày cấp: " + Convert.ToDateTime(nvbh.NgayCapCMTND).Day + "/" + Convert.ToDateTime(nvbh.NgayCapCMTND).Month + "/" + Convert.ToDateTime(nvbh.NgayCapCMTND).Year;
            }
        }
        if (!string.IsNullOrEmpty(noidungthaydoi))
        {
            xrlnoidungthaydoi.Text = noidungthaydoi;
        }
    }
    /// <summary>
    /// Cập nhật lại các thủ tục
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void CapNhatThuTuc_Click(object sender, DirectEventArgs e)
    {
        try
        {
            // upload file
            string path = string.Empty;
            if (fufTepTinDinhKem.HasFile)
            {
                string directory = Server.MapPath("");
                path = UploadFile(fufTepTinDinhKem, "File/ThoiViec");
            }

            // cập nhật thủ tục
            DAL.DanhSachCanBoThoiViec tv = new DAL.DanhSachCanBoThoiViec();
            tv.ID = int.Parse("0" + hdfRecordID.Text);
            if (!dfNgayNghi.SelectedDate.ToString().Contains("0001"))
            {
                tv.NgayNghi = dfNgayNghi.SelectedDate;
            }
            if (cbx_lydonghi.SelectedItem.Value != null)
            {
                tv.MaLyDoNghi = cbx_lydonghi.SelectedItem.Value;
            }
            tv.DaTraTheBHYT = bool.Parse(cbTraTheBHYT.SelectedItem.Value);
            if (!dfNgayTraThe.SelectedDate.ToString().Contains("0001"))
            {
                tv.NgayTraThe = dfNgayTraThe.SelectedDate;
            }
            tv.DaTraSoBHXH = bool.Parse(cbSoBHXH.SelectedItem.Value);
            if (!dfNgayTraSo.SelectedDate.ToString().Contains("0001"))
            {
                tv.NgayTraSo = dfNgayTraSo.SelectedDate;
            }
            if (hdfCanBoDuyet.Text != "")
            {
                tv.FrCBDuyetNghi = decimal.Parse("0" + hdfCanBoDuyet.Text);
            }
            tv.IsBelongToBlackList = chkThemVaoDsHanChe.Checked;
            if (cbxLyDoHanChe.SelectedItem.Value != null)
            {
                tv.MaLyDoBiHanChe = int.Parse(cbxLyDoHanChe.SelectedItem.Value);
            }
            tv.DaHoanThanhThuTuc = chkHoanTatThuTuc.Checked;
            tv.GhiChu            = txtGhiChuTV.Text;
            tv.SoQuyetDinh       = txtSoQuyetDinh.Text;
            if (path != "")
            {
                tv.AttachFile = path;
            }
            else
            {
                tv.AttachFile = hdfTepTinDinhKem.Text;
            }

            //    if (tv.DaHoanThanhThuTuc == true)
            //      {
            //bool htTaiSan = new BanGiaoTaiSanController().KiemTraHoanThanhBGTaiSan(tv.ID);
            //if (htTaiSan == false)
            //{
            //    X.Msg.Alert("Thông báo", "Bạn không thể cập nhật trạng thái Hoàn tất thủ tục khi chưa hoàn thành bàn giao tất cả tài sản").Show();
            //    return;
            //}
            //bool htCongNo = new ThanhToanCongNoController().KiemTraHoanThanhCongNo(tv.ID);
            //if (htCongNo == false)
            //{
            //    X.Msg.Alert("Thông báo", "Bạn không thể cập nhật trạng thái Hoàn tất thủ tục khi chưa hoàn thành thanh toán công nợ").Show();
            //    return;
            //}
            // }

            new DanhSachCanBoThoiViecController().UpdateThuTuc(tv);
            if (tv.DaHoanThanhThuTuc == true)
            {
                // cập nhật trạng thái đã nghỉ trong bảng HOSO
                DAL.HOSO hs = new DAL.HOSO();
                DAL.DanhSachCanBoThoiViec ds = new DanhSachCanBoThoiViecController().GetByID(tv.ID);
                hs.PR_KEY       = ds.PrKeyHoSo;
                hs.DA_NGHI      = true;
                hs.NGAY_NGHI    = tv.NgayNghi;
                hs.MA_LYDO_NGHI = tv.MaLyDoNghi;
                new DanhSachCanBoThoiViecController().UpdateNghiViecHoSo(hs);

                // cập nhật thông tin bảo hiểm nhân viên (trạng thái đã trả thẻ hay chưa)
                DAL.BHNHANVIEN_BAOHIEM nvbh = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByIDNhanVien_BaoHiem(int.Parse(ds.PrKeyHoSo.ToString()));
                if (nvbh != null)
                {
                    if (tv.DaTraSoBHXH == true)
                    {
                        nvbh.TrangThaiCapSoBHXH = "DaTraSo";
                    }
                    if (tv.DaTraTheBHYT == true)
                    {
                        nvbh.TrangThaiCapTheBHYT = "DaTraThe";
                    }
                    new NhanVien_BaoHiemController().UpdateNhanVien_BaoHiem(nvbh);
                }
            }
            RM.RegisterClientScriptBlock("rsl", "Store1.reload();wdCapNhatThuTuc.hide(); LoadDataInSouthPanel();");
        }
        catch (Exception ex)
        {
            X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString()).Show();
        }
    }