private void LoadHDTV(string loaiHD)
 {
     if (loaiHD == "all")
     {
         gridItem.DataSource = dttv;
         if (dttv.Rows.Count > 0)
         {
             DataView dv = new DataView();
             dv           = dttv.DefaultView;
             dv.RowFilter = "";
         }
     }
     else if (loaiHD == "now")
     {
         gridItem.DataSource = dttv;
         if (dttv.Rows.Count > 0)
         {
             DataView dv = new DataView();
             dv           = dttv.DefaultView;
             dv.RowFilter = "IsCurrent='" + true + "' and Status<3";
         }
     }
     else if (loaiHD == "end")
     {
         Class.NhanVien_HopDong_ThoiVu tv = new Class.NhanVien_HopDong_ThoiVu();
         DataTable dttv2 = tv.HRM_CONTRACT_SEASON_GetListExpiration();
         gridItem.DataSource = dttv2;
     }
 }
        private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int SelectedRow = gridItemDetail.FocusedRowHandle;

            if (SelectedRow >= 0)
            {
                DataRow drow   = gridItemDetail.GetDataRow(SelectedRow);
                string  _value = drow["ContractCode"].ToString();
                string  _manv  = drow["EmployeeCode"].ToString();
                if (Class.App.ConfirmDeletion() == DialogResult.No)
                {
                    return;
                }

                Class.NhanVien_HopDong_ThoiVu hd = new Class.NhanVien_HopDong_ThoiVu();
                hd.ContractCode = _value;
                hd.EmployeeCode = _manv;
                if (hd.Delete())
                {
                    Class.App.DeleteSuccessfully();
                    HRM_CONTRACT_SEASON_GetList();
                }
                else
                {
                    Class.App.DeleteNotSuccessfully();
                }
            }
        }
Beispiel #3
0
        private void call_info(string Form_name, string code)
        {
            Class.NhanVien_HopDong_ThoiVu hd = new Class.NhanVien_HopDong_ThoiVu();
            hd.ContractCode = code;
            DataTable dt = hd.HRM_CONTRACT_SEASON_Get();

            txtSigner.Text            = dt.Rows[0]["Signer"].ToString();
            txtSignerNationality.Text = dt.Rows[0]["SignerNationality"].ToString();
            txtSignerPosition.Text    = dt.Rows[0]["SignerPosition"].ToString();
            txtCompany.Text           = dt.Rows[0]["Company"].ToString();
            txtAddress.Text           = dt.Rows[0]["Address"].ToString();
            txtTel.Text               = dt.Rows[0]["Tel"].ToString();
            checkIsCurrent.Checked    = (bool)dt.Rows[0]["IsCurrent"];
            txtEmployeeCode.EditValue = dt.Rows[0]["EmployeeCode"].ToString();
            Class.NhanVien_ThoiVu nv = new Class.NhanVien_ThoiVu();
            nv.EmployeeCode = dt.Rows[0]["EmployeeCode"].ToString();
            DataTable dtinfo = nv.HRM_EMPLOYEE_SEASON_Get();

            txtFullName.Text        = dtinfo.Rows[0]["FirstName"].ToString() + " " + dtinfo.Rows[0]["LastName"].ToString();
            dateBirthday.DateTime   = (DateTime)dtinfo.Rows[0]["Birthday"];
            txtPosition.Text        = dtinfo.Rows[0]["Position"].ToString();
            txtNationality.Text     = dtinfo.Rows[0]["Nationality"].ToString();
            txtIDCard.Text          = dtinfo.Rows[0]["IDCard"].ToString();
            dateIDCardDate.DateTime = (DateTime)dtinfo.Rows[0]["IDCardDate"];
            txtIDCardPlace.Text     = dtinfo.Rows[0]["IDCardPlace"].ToString();
            txtBranchName.Text      = dtinfo.Rows[0]["BranchName"].ToString();

            //tab thong tin hop dong

            txtContractCode.Text  = dt.Rows[0]["ContractCode"].ToString();
            txtContractTime.Text  = dt.Rows[0]["ContractTime"].ToString();
            txtContractYear.Text  = dt.Rows[0]["ContractYear"].ToString();
            dateSignDate.DateTime = (DateTime)dt.Rows[0]["SignDate"];
            dateFromDate.DateTime = (DateTime)dt.Rows[0]["FromDate"];
            if (dt.Rows[0]["ToDate"] != DBNull.Value)
            {
                dateToDate.DateTime = (DateTime)dt.Rows[0]["ToDate"];
            }
            txtBasicSalary.Value = (decimal)dt.Rows[0]["BasicSalary"];
            txtPayForm.Text      = dt.Rows[0]["PayForm"].ToString();
            txtPayDate.Value     = (int)dt.Rows[0]["PayDate"];
            txtAllowance.Text    = dt.Rows[0]["Allowance"].ToString();
            txtInsurance.Text    = dt.Rows[0]["Insurance"].ToString();
            txtWorkTime.Text     = dt.Rows[0]["WorkTime"].ToString();
            txtDescription.Text  = dt.Rows[0]["Description"].ToString();
        }
        private void btnPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int SelectedRow = gridItemDetail.FocusedRowHandle;

            if (SelectedRow >= 0)
            {
                Waiting.ShowWaitForm();
                Waiting.SetWaitFormDescription("Đang tải trang in hợp đồng thời vụ");
                DataRow drow   = gridItemDetail.GetDataRow(SelectedRow);
                string  _value = drow["ContractCode"].ToString();
                Class.NhanVien_HopDong_ThoiVu hd = new Class.NhanVien_HopDong_ThoiVu();
                hd.ContractCode = _value;
                DataTable dt = hd.HRM_CONTRACT_SEASON_GetPrintByCode();

                // Reports.reportHopDongThoiVu rp = new Reports.reportHopDongThoiVu();
                //   rp.DataSource = dt;
                // rp.ShowDesigner();
                //   rp.ShowPreview();
                Waiting.CloseWaitForm();
            }
        }
 public void HRM_CONTRACT_SEASON_GetList()
 {
     Class.NhanVien_HopDong_ThoiVu hdtv = new Class.NhanVien_HopDong_ThoiVu();
     dttv = hdtv.HRM_CONTRACT_SEASON_GetList();
     gridItem.DataSource = dttv;
 }
Beispiel #6
0
        private void Update_HopDongLaoDong()
        {
            Waiting.ShowWaitForm();
            Waiting.SetWaitFormDescription("Đang khởi tạo yêu cầu..");

            Class.NhanVien_HopDong_ThoiVu hd = new Class.NhanVien_HopDong_ThoiVu();
            hd.ContractCode      = txtContractCode.Text;
            hd.EmployeeCode      = txtEmployeeCode.EditValue.ToString();
            hd.ContractTime      = txtContractTime.Text;
            hd.ContractYear      = int.Parse(txtContractYear.Text);
            hd.SignDate          = dateSignDate.DateTime;
            hd.FromDate          = dateFromDate.DateTime;
            hd.ToDate            = dateToDate.DateTime;
            hd.BasicSalary       = txtBasicSalary.Value;
            hd.PayForm           = txtPayForm.Text;
            hd.PayDate           = txtPayDate.Text;
            hd.Allowance         = txtAllowance.Text;
            hd.Insurance         = txtInsurance.Text;
            hd.WorkTime          = txtWorkTime.Text;
            hd.Signer            = txtSigner.Text;
            hd.SignerPosition    = txtSignerPosition.Text;
            hd.SignerNationality = txtSignerNationality.Text;
            hd.Company           = txtCompany.Text;
            hd.Address           = txtAddress.Text;
            hd.Tel         = txtTel.Text;
            hd.Description = txtDescription.Text;
            hd.IsCurrent   = checkIsCurrent.Checked;

            if (txtContractCode.Enabled == true)
            {
                Waiting.SetWaitFormDescription("Đang thực hiện thêm..");
                if (hd.Insert())
                {
                    Waiting.SetWaitFormDescription("Đang tải dữ liệu..");

                    (this.Owner as frmDanhSachHopDong_Season).HRM_CONTRACT_SEASON_GetList();

                    Waiting.CloseWaitForm();
                    Class.App.SaveSuccessfully();
                }
                else
                {
                    Waiting.CloseWaitForm();
                    Class.App.SaveNotSuccessfully();
                }
            }
            else
            {
                Waiting.SetWaitFormDescription("Đang thực hiện cập nhật..");
                if (hd.Update())
                {
                    Waiting.SetWaitFormDescription("Đang tải dữ liệu..");
                    (this.Owner as frmDanhSachHopDong_Season).HRM_CONTRACT_SEASON_GetList();
                    Waiting.CloseWaitForm();
                    Class.App.SaveSuccessfully();
                }
                else
                {
                    Waiting.CloseWaitForm();
                    Class.App.SaveNotSuccessfully();
                }
            }
        }
Beispiel #7
0
        private void xulyTaoCodeHopdong()
        {
            if (_Add_New == true)
            {
                if (txtFullName.Text != "[Họ và tên nhân viên]")
                {
                    Class.NhanVien_HopDong_ThoiVu hd = new Class.NhanVien_HopDong_ThoiVu();
                    hd.ContractYear = int.Parse(txtContractYear.Text);
                    DataTable dt = hd.HRM_CONTRACT_SEASON_GetByYear();
                    hd.EmployeeCode = txtEmployeeCode.EditValue.ToString();
                    DataTable dthdbynv = hd.HRM_CONTRACT_SEASON_GetByEmployee();

                    if (dt.Rows.Count > 0)
                    {
                        string   _idCheck;
                        string[] cat;
                        int      next_ID  = 0;
                        int      next_ID2 = 0;
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            _idCheck = dt.Rows[i]["ContractCode"].ToString();
                            cat      = _idCheck.Split('-');
                            next_ID2 = int.Parse(cat.GetValue(0).ToString());
                            if ((next_ID2 - next_ID) > 1)
                            {
                                break;
                            }
                            next_ID = int.Parse(cat.GetValue(0).ToString());
                        }
                        next_ID++;
                        if (next_ID.ToString().Length == 1)
                        {
                            txtContractCode.Text = "00" + next_ID.ToString() + "-" + txtContractYear.Text;
                        }
                        if (next_ID.ToString().Length == 2)
                        {
                            txtContractCode.Text = "0" + next_ID.ToString() + "-" + txtContractYear.Text;
                        }
                        if (next_ID.ToString().Length == 3)
                        {
                            txtContractCode.Text = next_ID.ToString() + "-" + txtContractYear.Text;
                        }
                    }
                    else
                    {
                        txtContractCode.Text = "001-" + txtContractYear.Text;
                    }
                    // kiem tra ky hop dong truc tiep ko co thu viec
                    int solanHD = 1;
                    solanHD = dthdbynv.Rows.Count + 1;

                    txtContractCode.Text = txtContractCode.Text + "/HDTVu-Lan" + solanHD;

                    if (dthdbynv.Rows.Count > 0)
                    {
                        if (dthdbynv.Rows[dthdbynv.Rows.Count - 1]["ToDate"] != DBNull.Value)
                        {
                            DateTime _dateNgaykt     = (DateTime)dthdbynv.Rows[dthdbynv.Rows.Count - 1]["ToDate"];
                            DateTime _dateNgayKyTiep = _dateNgaykt.AddDays(1);
                            dateFromDate.DateTime = _dateNgayKyTiep;
                            dateSignDate.DateTime = _dateNgayKyTiep;
                            dateFromDate_Validated(null, null);
                        }
                    }
                    else
                    {
                        // la HDTV se lay ngay tu ngay bat dau lam viec
                        dateFromDate.DateTime = DateBegin;
                        dateSignDate.DateTime = DateBegin;
                        dateFromDate_Validated(null, null);
                    }
                }
                else
                {
                    MessageBox.Show("Vui Lòng chọn nhân viên ký hợp đồng trước");
                    TabControl.SelectedTabPage = TabPage1;
                }
            }
            //txtContractTime_SelectedIndexChanged(null, null);
            // tam thoi han che khong cho lam lap 4 hop dong lao dong
            //if (txtContractCode.Text.Contains("Lan4"))
            //{
            //    MessageBox.Show("Hợp đồng Lao động chỉ chấp nhận nhỏ hơn 4 lần, Vui lòng kiểm tra lại hoặc liên hệ Người Quản Trị", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
        }