Example #1
0
        /// <summary>
        ///
        /// </summary>
        private void DisplayTotalOverGrade()
        {
            // init default from date, to date
            var fromDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            var toDate   = fromDate.AddMonths(3).AddDays(-1);

            // count total
            var total = SalaryDecisionController.CountOverGrade(fromDate, toDate);

            // update panel title
            pnlOverGrade.Title += " <b id='pOutFrameSalaryId' style='color:red;'>({0} cán bộ)</b>".FormatWith(total);
        }
Example #2
0
        protected void InitWindowFluctuation(object sender, DirectEventArgs e)
        {
            int id;

            if (!int.TryParse(hdfKeyRecord.Text, out id) || id <= 0)
            {
                return;
            }
            var recordId   = int.Parse(hdfRecordId.Text);
            var hs         = RecordController.GetById(recordId);
            var hsTeam     = TeamController.GetByRecordId(recordId);
            var hsSalary   = SalaryDecisionController.GetCurrent(recordId);
            var hsContract = ContractController.GetByConditionRecord(recordId);

            if (hs != null)
            {
                cbxChonCanBo.SelectedItem.Text = hs.FullName;
                txtEmployeeCode.Text           = hs.EmployeeCode;
                txtDepartment.Text             = hs.DepartmentName;
                txtBirthDate.Text = hs.BirthDateVn;
                txtPosition.Text  = hs.PositionName;
            }

            txtTeam.Text            = hsTeam.TeamName;
            txtConstruction.Text    = hsTeam.ConstructionName;
            txtSalaryInsurance.Text = hsSalary.InsuranceSalary.ToString();
            txtInsuranceSubmit.Text = (hsSalary.InsuranceSalary * (decimal)0.32).ToString();
            txtContractNumber.Text  = hsContract.ContractNumber;
            if (hsContract.ContractDate != null)
            {
                txtContractDate.SelectedDate = (DateTime)hsContract.ContractDate;
            }
            if (hsContract.EffectiveDate != null)
            {
                txtEffectiveDate.SelectedDate = (DateTime)hsContract.EffectiveDate;
            }
            var fluc = hr_FluctuationInsuranceServices.GetById(Convert.ToInt32(hdfKeyRecord.Text));

            txtReason.Text = fluc.Reason;
            if (fluc.Type == false)
            {
                rbIncrease.Checked = true;
            }
            else
            {
                rbDecrease.Checked = true;
            }

            wdCreateFluctuation.Title = @"Cập nhật quyết định tăng giảm BHXH, BHYT, BHTN";
            wdCreateFluctuation.Show();
            hdfCommandName.Text = @"Update";
            hdfChonCanBo.Text   = hsTeam.RecordId.ToString();
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        public void DisplayTotalNextRaise()
        {
            // init default from date, to date
            var fromDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            var toDate   = fromDate.AddMonths(3).AddDays(-1);

            // count total
            var total = SalaryDecisionController.CountNextRaise(fromDate, toDate);

            // update panel title
            pnlNextRaise.Title += " <b id='pCBCCVCDenKyNangLuong' style='color:red;'>({0} cán bộ)</b>".FormatWith(total);
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cboEmployee_Selected(object sender, DirectEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(cboEmployee.SelectedItem.Value))
                {
                    var record = RecordController.GetById(Convert.ToInt32(cboEmployee.SelectedItem.Value));
                    if (record != null)
                    {
                        // bind record data
                        txtDepartmentName.Text = record.DepartmentName;
                        txtPositionName.Text   = record.PositionName;
                        txtJobTitleName.Text   = record.JobTitleName;

                        // get current salary decision
                        var salaryDecsion = SalaryDecisionController.GetCurrent(record.Id);
                        if (salaryDecsion != null)
                        {
                            // bind current salary decision
                            txtCurrName.Text             = salaryDecsion.Name;
                            txtCurrDecisionNumber.Text   = salaryDecsion.DecisionNumber;
                            txtCurrDecisionDate.Text     = salaryDecsion.DecisionDate.ToString("dd/MM/yyyy");
                            txtCurrSignerName.Text       = salaryDecsion.SignerName;
                            txtCurrSignerPosition.Text   = salaryDecsion.SignerPosition;
                            txtCurrContractTypeName.Text = salaryDecsion.ContractTypeName;
                            txtCurrBasicSalary.Text      = salaryDecsion.BasicSalary.ToString("#,###");
                            txtCurrFactor.Text           = salaryDecsion.Factor.ToString("#,###.00");
                            txtCurrGrossSalary.Text      = salaryDecsion.GrossSalary.ToString("#,###");
                            txtCurrNetSalary.Text        = salaryDecsion.NetSalary.ToString("#,###");
                            txtCurrContractSalary.Text   = salaryDecsion.ContractSalary.ToString("#,###");
                            txtCurrInsuranceSalary.Text  = salaryDecsion.InsuranceSalary.ToString("#,###");
                            txtCurrPercentageLeader.Text = salaryDecsion.PercentageLeader.ToString("0.00 %");

                            // bind new salary decision
                            txtBasicSalary.Text         = salaryDecsion.BasicSalary.ToString("#,###");
                            txtPercentageLeader.Text    = salaryDecsion.PercentageLeader.ToString("0.00");
                            txtPercentageOverGrade.Text = salaryDecsion.PercentageOverGrade.ToString("0.00");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // show dilog
                Dialog.ShowError(ex);

                // log exception
                SystemLogController.Create(new SystemLogModel(CurrentUser.User.UserName, "Diễn biến lương - cboEmployee_Selected", ex));
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void storeNextRaise_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            var fromDate = ConvertUtils.GetStartDayOfMonth();
            var toDate   = fromDate.AddMonths(3).AddDays(-1);

            if (!DatetimeHelper.IsNull(dfFromDate.SelectedDate) && !DatetimeHelper.IsNull(dfToDate.SelectedDate))
            {
                fromDate = dfFromDate.SelectedDate;
                toDate   = dfToDate.SelectedDate;
            }

            storeNextRaise.DataSource = SalaryDecisionController.GetNextRaise(fromDate, toDate);
            storeNextRaise.DataBind();
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void storeOutFrameSalary_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            var fromDate = ConvertUtils.GetStartDayOfMonth();
            var toDate   = fromDate.AddMonths(3).AddDays(-1);

            if (!DatetimeHelper.IsNull(dateFieldFromDate.SelectedDate) && !DatetimeHelper.IsNull(dateFieldToDate.SelectedDate))
            {
                fromDate = dateFieldFromDate.SelectedDate;
                toDate   = dateFieldToDate.SelectedDate;
            }

            storeOutFrameSalary.DataSource = SalaryDecisionController.GetOverGrade(fromDate, toDate);
            storeOutFrameSalary.DataBind();
        }
Example #7
0
        /// <summary>
        /// Insert or Update decision one employee
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InsertOrUpdate(object sender, DirectEventArgs e)
        {
            try
            {
                // init model
                var model = new SalaryDecisionModel()
                {
                    EditedBy = CurrentUser.User.UserName
                };
                // check id
                if (!string.IsNullOrEmpty(hdfId.Text) && Convert.ToInt32(hdfId.Text) > 0)
                {
                    var result = SalaryDecisionController.GetById(Convert.ToInt32(hdfId.Text));;
                    if (result != null)
                    {
                        model = result;
                    }
                }
                // set new props for model
                model.Status = !string.IsNullOrEmpty(hdfStatus.Text) ? (SalaryDecisionStatus)Convert.ToInt32(hdfStatus.Text) : SalaryDecisionStatus.Approved;

                //edit data
                EditData(model);

                // check model id
                if (model.Id > 0)
                {
                    // update
                    SalaryDecisionController.Update(model);
                }
                else
                {
                    // set created user
                    model.CreatedBy = CurrentUser.User.UserName;
                    // insert
                    SalaryDecisionController.Create(model);
                }
                // hide window
                wdSetting.Hide();
                //reset form
                ResetForm();
                // reload data
                gpSalaryDecision.Reload();
            }
            catch (Exception exception)
            {
                Dialog.ShowError(exception);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDownloadAttachFile_Click(object sender, DirectEventArgs e)
        {
            try
            {
                if (hdfRecordId.Text == "")
                {
                    X.Msg.Alert("Thông báo từ hệ thống", "Không tìm thấy quyết định lương").Show();
                }

                var hsl = SalaryDecisionController.GetById(Convert.ToInt32(hdfRecordId.Text));
                DownloadAttachFile("sal_SalaryDecision", hsl.AttachFileName);
            }
            catch (Exception ex)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra: " + ex.Message).Show();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDelete_Click(object sender, DirectEventArgs e)
        {
            try
            {
                foreach (var item in RowSelectionModel1.SelectedRows)
                {
                    // delete salary decision
                    SalaryDecisionController.Delete(int.Parse(item.RecordID));
                }

                btnEdit.Disabled   = true;
                btnDelete.Disabled = true;
                gridDecisionSalaryEnterprise.Reload();
            }
            catch (Exception ex)
            {
                X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
            }
        }
Example #10
0
 protected void cbxChonCanBo_Selected(object sender, DirectEventArgs e)
 {
     try
     {
         var id         = int.Parse(cbxChonCanBo.SelectedItem.Value);
         var hs         = RecordController.GetById(id);
         var hsTeam     = TeamController.GetByRecordId(id);
         var hsSalary   = SalaryDecisionController.GetCurrent(id);
         var hsContract = ContractController.GetByConditionRecord(id);
         if (hs == null)
         {
             return;
         }
         txtEmployeeCode.Text    = hs.EmployeeCode;
         txtBirthDate.Text       = hs.BirthDateVn;
         txtDepartment.Text      = hs.DepartmentName;
         txtPosition.Text        = hs.PositionName;
         txtTeam.Text            = hsTeam.TeamName;
         txtConstruction.Text    = hsTeam.ConstructionName;
         txtSalaryInsurance.Text = hsSalary.InsuranceSalary.ToString();
         if (hsSalary.InsuranceSalary != null)
         {
             txtInsuranceSubmit.Text = (hsSalary.InsuranceSalary * (decimal)0.32).ToString();
         }
         txtContractNumber.Text = hsContract.ContractNumber;
         if (hsContract.ContractDate != null)
         {
             txtContractDate.SelectedDate = (DateTime)hsContract.ContractDate;
         }
         if (hsContract.EffectiveDate != null)
         {
             txtEffectiveDate.SelectedDate = (DateTime)hsContract.EffectiveDate;
         }
     }
     catch (Exception ex)
     {
         ExtNet.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra khi chọn cán bộ: " + ex.Message).Show();
     }
 }
Example #11
0
 /// <summary>
 /// Delete catalog
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Delete(object sender, DirectEventArgs e)
 {
     try
     {
         // init id
         var param = e.ExtraParams["Id"];
         // parse id
         if (!int.TryParse(param, out var id) || id <= 0)
         {
             // parse error, show error
             Dialog.ShowError("Có lỗi xảy ra trong quá trình xử lý");
             return;
         }
         // delete
         SalaryDecisionController.Delete(id);
         // reload data
         gpSalaryDecision.Reload();
     }
     catch (Exception exception)
     {
         Dialog.ShowError(exception);
     }
 }
Example #12
0
        /// <summary>
        /// Insert or Update decision many employee
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InsertMany(object sender, DirectEventArgs e)
        {
            try
            {
                foreach (var employee in chkEmployeeRowSelection.SelectedRows)
                {
                    // init model
                    var model = new SalaryDecisionModel
                    {
                        RecordId  = Convert.ToInt32(employee.RecordID),
                        CreatedBy = CurrentUser.User.UserName,
                        EditedBy  = CurrentUser.User.UserName,
                        Status    = !string.IsNullOrEmpty(hdfStatus.Text)
                            ? (SalaryDecisionStatus)Convert.ToInt32(hdfStatus.Text)
                            : SalaryDecisionStatus.Approved
                    };

                    //edit data
                    EditDataMany(model);

                    // insert
                    SalaryDecisionController.Create(model);
                }

                // hide window
                wdSettingMany.Hide();
                //reset form
                ResetForm();
                // reload data
                gpSalaryDecision.Reload();
            }
            catch (Exception exception)
            {
                Dialog.ShowError(exception);
            }
        }
        /// <summary>
        /// Sửa thông tin quyết định lương
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEdit_Click(object sender, DirectEventArgs e)
        {
            try
            {
                var hsLuong = SalaryDecisionController.GetById(Convert.ToInt32(hdfRecordId.Text));
                if (hsLuong == null)
                {
                    X.Msg.Alert("Thông báo từ hệ thống", "Không tìm thấy quyết định lương").Show();
                    return;
                }

                // load general information for employee
                var hs = RecordController.GetById(hsLuong.RecordId);
                if (hs != null)
                {
                    hdfChooseEmployee.Text = hs.Id.ToString();
                    cbxChooseEmployee.Text = hs.FullName;
                    txtDepartment.Text     = hs.DepartmentName;
                    txtPosition.Text       = hs.PositionName;
                    txtJob.Text            = hs.JobTitleName;
                }

                // load newest salary decision information
                var hsl = SalaryDecisionController.GetCurrent(hsLuong.RecordId);
                if (hsl != null)
                {
                    //if (txtDecisionNumberOld.Visible == true && !string.IsNullOrEmpty(hsl.DecisionNumber))
                    //    txtDecisionNumberOld.Text = hsl.DecisionNumber;
                    //if (txtDecisionNameOld.Visible == true && !string.IsNullOrEmpty(hsl.DecisionName))
                    //    txtDecisionNameOld.Text = hsl.DecisionName;
                    //if (DecisionDateOld.Visible == true)
                    //    DecisionDateOld.SetValue(hsl.DecisionDate);
                    //if (txtDecisionMakerOld.Visible == true && hsl.DecisionMaker != null)
                    //    txtDecisionMakerOld.Text = hsl.DecisionMaker;
                    //if (EffectiveDateOld.Visible == true)
                    //    EffectiveDateOld.SetValue(hsl.EffectiveDate);
                    //if (txtSalaryBasicOld.Visible == true && hsl.SalaryBasic != null)
                    //    txtSalaryBasicOld.SetValue(hsl.SalaryBasic);
                    //txtSalaryGrossOld.SetValue(hsl.SalaryGross);
                    //txtSalaryNetOld.SetValue(hsl.SalaryNet);
                    //if (txtSalaryInsuranceOld.Visible == true && hsl.SalaryInsurance != null)
                    //    txtSalaryInsuranceOld.SetValue(hsl.SalaryInsurance);
                    //if (txtOtherAllowanceOld.Visible == true && hsl.OtherAllowance != null)
                    //    txtOtherAllowanceOld.SetValue(hsl.OtherAllowance);
                    //if (txtResponsibilityAllowanceOld.Visible == true && hsl.ResponsibilityAllowance != null)
                    //    txtResponsibilityAllowanceOld.SetValue(hsl.ResponsibilityAllowance);
                    //if (txtAreaAllowanceOld.Visible == true && hsl.AreaAllowance != null)
                    //    txtAreaAllowanceOld.SetValue(hsl.AreaAllowance);

                    var strContractTypeOldId =
                        hr_ContractServices.GetFieldValueById(hsLuong.ContractId, "ContractTypeId");
                    if (!string.IsNullOrEmpty(strContractTypeOldId))
                    {
                        var contractTypeOldName =
                            cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeOldId), "Name");
                        txtContractTypeOld.Text = "" + contractTypeOldName;
                    }
                }

                // load current decision information
                //if (txtDecisionNumberNew.Visible)
                //    txtDecisionNumberNew.Text = hsLuong.DecisionNumber;
                //if (DecisionDateNew.Visible)
                //    DecisionDateNew.SetValue(hsLuong.DecisionDate);
                //if (txtDecisionNameNew.Visible)
                //    txtDecisionNameNew.Text = hsLuong.DecisionName;
                //if (EffectiveDateNew.Visible)
                //    EffectiveDateNew.SetValue(hsLuong.EffectiveDate);
                //if (txtDecisionMakerNew.Visible)
                //    txtDecisionMakerNew.Text = hsLuong.DecisionMaker;
                //cbxMakerPosition.Text = hsLuong.MakerPosition;
                var strContractTypeId = hr_ContractServices.GetFieldValueById(hsLuong.ContractId, "ContractTypeId");
                if (!string.IsNullOrEmpty(strContractTypeId))
                {
                    var contractTypeName =
                        cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeId), "Name");
                    cbxContractTypeNew.Text = "" + contractTypeName;
                    hdfContractTypeNew.SetValue(strContractTypeId);
                }

                // them ten nguoi qd
                if (composifieldAttach.Visible)
                {
                    hdfAttachFile.Text = hsLuong.AttachFileName;
                    if (!string.IsNullOrEmpty(hsLuong.AttachFileName))
                    {
                        hdfAttachFile.Text    = hsLuong.AttachFileName;
                        uploadAttachFile.Text = GetFileName(hsLuong.AttachFileName);
                    }
                }

                if (txtNoteNew.Visible)
                {
                    txtNoteNew.Text = hsLuong.Note;
                }
                //txtSalaryBasicNew.SetValue(hsLuong.SalaryBasic);
                //txtSalaryContractNew.SetValue(hsLuong.SalaryContract);
                //txtSalaryGrossNew.SetValue(hsLuong.SalaryGross);
                //txtSalaryNetNew.SetValue(hsLuong.SalaryNet);
                //txtSalaryInsuranceNew.SetValue(hsLuong.SalaryInsurance);
                //txtSalaryFactorNew.SetValue(hsLuong.SalaryFactor.ToString().Replace(".", ","));
                //txtPercentageSalaryNew.SetValue(hsLuong.PercentageSalary);
                //txtOtherAllowanceNew.SetValue(hsLuong.OtherAllowance);
                //txtAreaAllowanceNew.SetValue(hsLuong.AreaAllowance);
                //txtPositionAllowanceNew.SetValue(hsLuong.PositionAllowance);
                //txtResponsibilityAllowanceNew.SetValue(hsLuong.ResponsibilityAllowance);
                //txtBranchAllowanceNew.SetValue(hsLuong.BranchAllowance);
                // update form information
                wdCreateDecisionSalary.Title = @"Cập nhật thông tin quyết định lương";
                wdCreateDecisionSalary.Icon  = Icon.Pencil;
                btnUpdate.Hide();
                btnUpdateEdit.Show();
                btnUpdateClose.Hide();
                wdCreateDecisionSalary.Show();
            }
            catch (Exception ex)
            {
                X.MessageBox.Alert("Có lỗi xảy ra: ", ex.Message).Show();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cbxChooseEmployee_Selected(object sender, DirectEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(cbxChooseEmployee.SelectedItem.Value))
                {
                    int recordId = Convert.ToInt32(cbxChooseEmployee.SelectedItem.Value);
                    var hs       = RecordController.GetById(recordId);
                    if (hs != null)
                    {
                        // set general infomation
                        txtPosition.Text   = hs.PositionName;
                        txtJob.Text        = hs.JobTitleName;
                        txtDepartment.Text = hs.DepartmentName;

                        // get newest salary development
                        var hsl = SalaryDecisionController.GetCurrent(recordId);
                        if (hsl != null)
                        {
                            //if (!string.IsNullOrEmpty(hsl.DecisionNumber))
                            //    txtDecisionNumberOld.Text = hsl.DecisionNumber;
                            //if (hsl.DecisionName != null)
                            //    txtDecisionNameOld.Text = hsl.DecisionName;
                            //DecisionDateOld.SetValue(hsl.DecisionDate);
                            //EffectiveDateOld.SetValue(hsl.EffectiveDate);
                            //if (hsl.SalaryBasic != null)
                            //    txtSalaryBasicOld.SetValue(hsl.SalaryBasic);
                            //if (hsl.SalaryInsurance != null)
                            //    txtSalaryInsuranceOld.SetValue(hsl.SalaryInsurance);
                            //if (hsl.OtherAllowance != null)
                            //    txtOtherAllowanceOld.SetValue(hsl.OtherAllowance);
                            //var strContractTypeId =
                            //    hr_ContractServices.GetFieldValueById(hsl.ContractId, "ContractTypeId");
                            //if (!string.IsNullOrEmpty(strContractTypeId))
                            //{
                            //    var contractTypeName =
                            //        cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeId),
                            //            "Name");
                            //    txtContractTypeOld.Text = "" + contractTypeName;
                            //}

                            //if (hsl.BranchAllowance != null)
                            //    txtBranchAllowanceOld.SetValue(hsl.BranchAllowance);
                        }
                        else
                        {
                            txtDecisionNumberOld.Text = "";
                            txtDecisionNameOld.Text   = "";
                            DecisionDateOld.SetValue("");
                            txtDecisionMakerOld.Text = "";
                            EffectiveDateOld.SetValue("");
                            txtSalaryBasicOld.Text     = "";
                            txtSalaryInsuranceOld.Text = "";
                            txtOtherAllowanceOld.Text  = "";
                            txtContractTypeOld.Text    = "";
                        }
                    }
                    else
                    {
                        txtPosition.Text   = "";
                        txtJob.Text        = "";
                        txtDepartment.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra khi chọn cán bộ: " + ex.Message).Show();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdateHL_Click(object sender, DirectEventArgs e)
        {
            try
            {
                var salaryController = new SalaryDecisionController();
                // upload file
                string path = string.Empty;
                if (cpfAttachHL.Visible && uploadAttachFileHL.HasFile)
                {
                    path = UploadFile(uploadAttachFileHL, Constant.PathDecisionSalary);
                }

                var rs = JSON.Deserialize <List <SalaryDecisionModel> >(e.ExtraParams["json"]);
                foreach (var created in rs)
                {
                    var hsl = new sal_SalaryDecision();

                    // decision information
                    if (txtDecisionNumberHL.Visible)
                    {
                        hsl.DecisionNumber = txtDecisionNumberHL.Text.Trim();
                    }
                    if (txtDecisionNameHL.Visible)
                    {
                        hsl.Name = txtDecisionNameHL.Text.Trim();
                    }
                    if (DecisionDateHL.Visible && !DatetimeHelper.IsNull(DecisionDateHL.SelectedDate))
                    {
                        hsl.DecisionDate = DecisionDateHL.SelectedDate;
                    }
                    if (EffectiveDateHL.Visible && !DatetimeHelper.IsNull(EffectiveDateHL.SelectedDate))
                    {
                        hsl.EffectiveDate = EffectiveDateHL.SelectedDate;
                    }
                    if (txtDecisionMakerHL.Visible && !string.IsNullOrEmpty(txtDecisionMakerHL.Text))
                    {
                        hsl.SignerName = txtDecisionMakerHL.Text;
                    }
                    var makerPosition = hdfIsMakerPositionHL.Text == @"0" ? cbxMakerPositionHL.Text : cbxMakerPositionHL.SelectedItem.Text;
                    //hsl.SignerPosition = makerPosition;
                    hsl.AttachFileName = path != "" ? path : hdfAttachFileHL.Text;
                    hsl.Note           = txtNoteHL.Text;
                    // salary information
                    hsl.RecordId  = created.RecordId;
                    hsl.QuantumId = created.QuantumId;
                    //hsl.SalaryFactor = created.SalaryFactor;
                    //hsl.SalaryBasic = created.SalaryBasic;
                    //hsl.SalaryContract = created.SalaryContract;
                    //hsl.SalaryInsurance = created.SalaryInsurance;
                    //hsl.OutFrame = created.OutFrame;
                    hsl.CreatedBy   = CurrentUser.User.UserName;
                    hsl.CreatedDate = DateTime.Now;
                    SalaryDecisionController.Create(new SalaryDecisionModel(hsl));
                }

                if (e.ExtraParams["close"] == "True")
                {
                    wdCreateDecisionSalaryHL.Hide();
                }

                gridDecisionSalaryEnterprise.Reload();
            }
            catch (Exception ex)
            {
                Dialog.ShowError(ex.Message);
            }
        }
Example #16
0
        /// <summary>
        /// #############################################
        /// Create salary decision for employee
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCapNhat_Click(object sender, DirectEventArgs e)
        {
            try
            {
                var controller = new SalaryDecisionController();
                var hsl        = new sal_SalaryDecision();
                var util       = new Util();

                // upload file
                string path = string.Empty;
                if (fufTepTinDinhKem.HasFile)
                {
                    path = UploadFile(fufTepTinDinhKem, Constant.PathDecisionSalary);
                }

                // decide information
                if (!string.IsNullOrEmpty(hdfChonCanBo.Text))
                {
                    hsl.RecordId = Convert.ToInt32(hdfChonCanBo.Text);
                }

                if (txtSoQDMoi.Visible)
                {
                    hsl.DecisionNumber = txtSoQDMoi.Text;
                }
                if (!util.IsDateNull(dfNgayQDMoi.SelectedDate))
                {
                    hsl.DecisionDate = dfNgayQDMoi.SelectedDate;
                }
                if (txtTenQDMoi.Visible)
                {
                    hsl.Name = txtTenQDMoi.Text;
                }
                if (!util.IsDateNull(dfNgayHieuLucMoi.SelectedDate))
                {
                    hsl.EffectiveDate = dfNgayHieuLucMoi.SelectedDate;
                }
                if (txtNguoiQD.Visible)
                {
                    hsl.SignerName = txtNguoiQD.Text;
                }
                var makerPosition = string.Empty;
                if (hdfIsMakerPosition.Text == @"0")
                {
                    makerPosition = cbxMakerPosition.Text;
                }
                else
                {
                    makerPosition = cbxMakerPosition.SelectedItem.Text;
                }
                hsl.SignerPosition = makerPosition;
                if (cbHopDongLoaiHopDongMoi.SelectedItem.Value != null)
                {
                    hsl.ContractId = Convert.ToInt32(hdfLoaiHopDong.Text);
                }

                // attach file
                if (path != "")
                {
                    hsl.AttachFileName = path;
                }
                else
                {
                    hsl.AttachFileName = hdfTepTinDinhKem.Text;
                }
                if (txtGhiChuMoi.Visible)
                {
                    hsl.Note = txtGhiChuMoi.Text;
                }

                // salary information
                if (cbx_ngachMoi.Visible)
                {
                    hsl.QuantumId = Convert.ToInt32(hdfQuantumId.Text);
                }
                if (cbxBacMoi.Visible)
                {
                    hsl.SalaryGrade = hdfSalaryGrade.Text;
                }
                if (txtHeSoLuongMoi.Visible && !string.IsNullOrEmpty(txtHeSoLuongMoi.Text))
                {
                    hsl.SalaryFactor = double.Parse(txtHeSoLuongMoi.Text.Replace('.', ','));
                }
                if (txtMucLuongMoi.Visible && !string.IsNullOrEmpty(txtMucLuongMoi.Text))
                {
                    hsl.SalaryBasic = double.Parse(txtMucLuongMoi.Text.Replace('.', ','));
                }
                if (txtLuongDongBHMoi.Visible && !string.IsNullOrEmpty(txtLuongDongBHMoi.Text))
                {
                    hsl.SalaryInsurance = double.Parse(txtLuongDongBHMoi.Text.Replace('.', ','));
                }
                if (txtBacLuongNBMoi.Visible)
                {
                    hsl.SalaryGradeLift = txtBacLuongNBMoi.Text;
                }
                if (dfNgayHLNBMoi.Visible && !util.IsDateNull(dfNgayHLNBMoi.SelectedDate))
                {
                    hsl.SalaryGradeDate = dfNgayHLNBMoi.SelectedDate;
                }
                if (txtVuotKhungMoi.Visible && !string.IsNullOrEmpty(txtVuotKhungMoi.Text))
                {
                    hsl.OutFrame = double.Parse("0" + txtVuotKhungMoi.Text);
                }
                if (txtThamnien.Visible && !string.IsNullOrEmpty(txtThamnien.Text))
                {
                    hsl.Seniority = double.Parse("0" + txtThamnien.Text);
                }
                if (chkNangNgach.Checked == true)
                {
                    hsl.IsLiftQuantum = true;
                }
                if (dfSalaryRaiseNextDate.Visible && !util.IsDateNull(dfSalaryRaiseNextDate.SelectedDate))
                {
                    hsl.SalaryRaiseNextDate = dfSalaryRaiseNextDate.SelectedDate;
                }
                hsl.CreatedBy   = CurrentUser.User.UserName;
                hsl.CreatedDate = DateTime.Now;

                if (e.ExtraParams["Command"] == "Edit")
                {
                    hsl.Id = int.Parse("0" + hdfRecordId.Text);
                    controller.Update(hsl);
                    wdTaoQuyetDinhLuong.Hide();
                }
                else
                {
                    // add salary decision
                    controller.Insert(hsl);
                    if (e.ExtraParams["Close"] == "True")
                    {
                        wdTaoQuyetDinhLuong.Hide();
                    }
                    else
                    {
                        RM.RegisterClientScriptBlock("resetform1",
                                                     "ResetWdTaoQuyetDinhLuong(); Ext.net.DirectMethods.GenerateSoQD();");
                    }
                }

                RM.RegisterClientScriptBlock("rlgr", "Store1.reload();");
            }
            catch (Exception ex)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra khi lưu quyết định lương: " + ex.Message).Show();
            }
        }
Example #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        private void InitFormUpdate(int id)
        {
            // get current decision
            var model = SalaryDecisionController.GetById(id);

            if (model != null)
            {
                // get previous decision
                var previousDecision = SalaryDecisionController.GetPrevious(model.RecordId);

                // bind previous data
                if (previousDecision != null)
                {
                    txtCurrName.Text             = previousDecision.Name;
                    txtCurrDecisionNumber.Text   = previousDecision.DecisionNumber;
                    txtCurrDecisionDate.Text     = previousDecision.DecisionDate.ToString("dd/MM/yyyy");
                    txtCurrSignerName.Text       = previousDecision.SignerName;
                    txtCurrSignerPosition.Text   = previousDecision.SignerPosition;
                    txtCurrContractTypeName.Text = previousDecision.ContractTypeName;
                    txtCurrBasicSalary.Text      = previousDecision.BasicSalary.ToString("#,###");
                    txtCurrFactor.Text           = previousDecision.Factor.ToString("#,##0.00");
                    txtCurrGrossSalary.Text      = previousDecision.GrossSalary.ToString("#,###");
                    txtCurrNetSalary.Text        = previousDecision.NetSalary.ToString("#,###");
                    txtCurrContractSalary.Text   = previousDecision.ContractSalary.ToString("#,###");
                    txtCurrInsuranceSalary.Text  = previousDecision.InsuranceSalary.ToString("#,###");
                    txtCurrPercentageLeader.Text = previousDecision.PercentageLeader.ToString("0.00 %");
                }

                // bind current salary decision
                cboEmployee.Text             = model.EmployeeName;
                hdfEmployee.Text             = model.RecordId.ToString();
                txtName.Text                 = model.Name;
                txtDepartmentName.Text       = model.DepartmentName;
                txtPositionName.Text         = model.PositionName;
                txtJobTitleName.Text         = model.JobTitleName;
                cboContractType.Text         = model.ContractTypeName;
                txtDecisionNumber.Text       = model.DecisionNumber;
                dfDecisionDate.SelectedDate  = model.DecisionDate;
                dfEffectiveDate.SelectedDate = model.EditedDate;
                txtSignerName.Text           = model.SignerName;
                hdfPosition.Text             = model.SignerPositionId.ToString();
                cboPosition.Text             = model.SignerPosition;
                txtNote.Text                 = model.Note;
                txtBasicSalary.Text          = model.BasicSalary.ToString("#,###");
                txtFactor.Text               = model.Factor.ToString("#,##0.00");
                txtGrossSalary.Text          = model.GrossSalary.ToString("#,###");
                txtNetSalary.Text            = model.NetSalary.ToString("#,###");
                txtContractSalary.Text       = model.ContractSalary.ToString("#,###");
                txtInsuranceSalary.Text      = model.InsuranceSalary.ToString("#,###");
                txtPercentageSalary.Text     = model.PercentageSalary.ToString("0.00");
                txtPercentageLeader.Text     = model.PercentageLeader.ToString("0.00");
                txtPercentageOverGrade.Text  = model.PercentageOverGrade.ToString("0.00");
                // get file upload
                if (cfAttachFile.Visible)
                {
                    hdfAttachFile.Text = model.AttachFileName;
                    if (!string.IsNullOrEmpty(model.AttachFileName))
                    {
                        hdfAttachFile.Text = model.AttachFileName;
                        fufAttachFile.Text = GetFileName(model.AttachFileName);
                    }
                }
                //insurance
                var insurance = FluctuationInsuranceController.GetByRecordId(model.RecordId, model.EffectiveDate.Month, model.EffectiveDate.Year);

                if (insurance != null)
                {
                    hdfReason.Text        = insurance.ReasonId.ToString();
                    cboReason.Text        = insurance.ReasonName;
                    hdfInsuranceType.Text = ((int)insurance.Type).ToString();
                    if (insurance.Type != 0)
                    {
                        cboInsuranceType.Text = insurance.TypeName;
                    }
                    if (!string.IsNullOrEmpty(hdfInsuranceType.Text))
                    {
                        cboReason.Show();
                    }
                }
                else
                {
                    //reset insurance
                    ResetInsurance();
                }
            }
        }
Example #18
0
        /// <summary>
        /// Sửa thông tin quyết định lương
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEdit_Click(object sender, DirectEventArgs e)
        {
            try
            {
                var hsLuong = SalaryDecisionController.GetById(Convert.ToInt32(hdfRecordId.Text));
                if (hsLuong == null)
                {
                    X.Msg.Alert("Thông báo từ hệ thống", "Không tìm thấy quyết định lương").Show();
                    return;
                }

                // load general information for employee
                var hs = RecordController.GetById(hsLuong.RecordId);
                if (hs != null)
                {
                    hdfChonCanBo.Text  = hs.Id.ToString();
                    cbxChonCanBo.Text  = hs.FullName;
                    txtDepartment.Text = hs.DepartmentName;
                    txtChucVu.Text     = hs.PositionName;
                    txtCongViec.Text   = hs.JobTitleName;
                }

                // load newest salary decision information
                var hsl = SalaryDecisionController.GetByIdConditionRecord(hsLuong.RecordId);
                if (hsl != null)
                {
                    if (txtSoQDCu.Visible == true && !string.IsNullOrEmpty(hsl.DecisionNumber))
                    {
                        txtSoQDCu.Text = hsl.DecisionNumber;
                    }
                    if (txtTenQDCu.Visible == true && !string.IsNullOrEmpty(hsl.DecisionName))
                    {
                        txtTenQDCu.Text = hsl.DecisionName;
                    }
                    if (dfNgayQDCu.Visible == true)
                    {
                        dfNgayQDCu.SetValue(hsl.DecisionDate);
                    }
                    if (txtNguoiQDCu.Visible == true && hsl.DecisionMaker != null)
                    {
                        txtNguoiQDCu.Text = hsl.DecisionMaker;
                    }
                    if (dfNgayCoHieuLucCu.Visible == true)
                    {
                        dfNgayCoHieuLucCu.SetValue(hsl.EffectiveDate);
                    }
                    if (cbxNgachCu.Visible == true)
                    {
                        if (string.IsNullOrEmpty(hsl.QuantumCode))
                        {
                            cbxNgachCu.SetValue("");
                        }
                        else
                        {
                            cbxNgachCu.SetValue(hsl.QuantumName);
                        }
                    }

                    if (txtBacLuongCu.Visible == true && !string.IsNullOrEmpty(hsl.SalaryGrade))
                    {
                        txtBacLuongCu.Text = hsl.SalaryGrade;
                    }
                    if (txtHeSoLuongCu.Visible == true && hsl.SalaryFactor != null)
                    {
                        txtHeSoLuongCu.SetValue(hsl.SalaryFactor);
                    }
                    if (txtMucLuongCu.Visible == true && hsl.SalaryBasic != null)
                    {
                        txtMucLuongCu.SetValue(hsl.SalaryBasic);
                    }
                    if (txtLuongDongBHCu.Visible == true && hsl.SalaryInsurance != null)
                    {
                        txtLuongDongBHCu.SetValue(hsl.SalaryInsurance);
                    }
                    if (txtPhuCapKhacCu.Visible == true && hsl.OtherAllowance != null)
                    {
                        txtPhuCapKhacCu.SetValue(hsl.OtherAllowance);
                    }
                    if (txtPCTrachNhiemCu.Visible == true && hsl.ResponsibilityAllowance != null)
                    {
                        txtPCTrachNhiemCu.SetValue(hsl.ResponsibilityAllowance);
                    }
                    if (txtPCKhuVucCu.Visible == true && hsl.AreaAllowance != null)
                    {
                        txtPCKhuVucCu.SetValue(hsl.AreaAllowance);
                    }
                    if (txtVuotKhungCu.Visible == true && hsl.OutFrame != null)
                    {
                        txtVuotKhungCu.SetValue(hsl.OutFrame);
                    }
                    var strContractTypeOldId =
                        hr_ContractServices.GetFieldValueById(hsLuong.ContractId, "ContractTypeId");
                    if (!string.IsNullOrEmpty(strContractTypeOldId))
                    {
                        var contractTypeOldName =
                            cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeOldId), "Name");
                        cbHopDongLoaiHopDongCu.Text = "" + contractTypeOldName;
                    }
                }

                // load current decision information
                if (txtSoQDMoi.Visible == true)
                {
                    txtSoQDMoi.Text = hsLuong.DecisionNumber;
                }
                if (dfNgayQDMoi.Visible == true)
                {
                    dfNgayQDMoi.SetValue(hsLuong.DecisionDate);
                }
                if (txtTenQDMoi.Visible == true)
                {
                    txtTenQDMoi.Text = hsLuong.DecisionName;
                }
                if (dfNgayHieuLucMoi.Visible == true)
                {
                    dfNgayHieuLucMoi.SetValue(hsLuong.EffectiveDate);
                }
                if (txtNguoiQD.Visible == true)
                {
                    txtNguoiQD.Text = hsLuong.DecisionMaker;
                }
                if (dfSalaryRaiseNextDate.Visible == true)
                {
                    dfSalaryRaiseNextDate.SetValue(hsl.SalaryRaiseNextDate);
                }
                cbxMakerPosition.Text = hsLuong.MakerPosition;
                var strContractTypeId = hr_ContractServices.GetFieldValueById(hsLuong.ContractId, "ContractTypeId");
                if (!string.IsNullOrEmpty(strContractTypeId))
                {
                    var contractTypeName =
                        cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeId), "Name");
                    cbHopDongLoaiHopDongMoi.Text = "" + contractTypeName;
                    hdfLoaiHopDong.SetValue(strContractTypeId);
                }

                // them ten nguoi qd
                if (composifieldAttach.Visible == true)
                {
                    hdfTepTinDinhKem.Text = hsLuong.AttachFileName;
                    if (!string.IsNullOrEmpty(hsLuong.AttachFileName))
                    {
                        hdfTepTinDinhKem.Text = hsLuong.AttachFileName;
                        fufTepTinDinhKem.Text = GetFileName(hsLuong.AttachFileName);
                    }
                }

                if (txtGhiChuMoi.Visible == true)
                {
                    txtGhiChuMoi.Text = hsLuong.Note;
                }
                // load current salary information
                if (cbx_ngachMoi.Visible == true)
                {
                    if (string.IsNullOrEmpty(hsl.QuantumCode))
                    {
                        hdfQuantumId.SetValue("");
                        cbx_ngachMoi.SetValue("");
                    }
                    else
                    {
                        hdfQuantumId.SetValue(hsl.QuantumId);
                        cbx_ngachMoi.SetValue(hsl.QuantumName);
                    }
                }

                if (cbxBacMoi.Visible == true)
                {
                    hdfSalaryGrade.SetValue(hsLuong.SalaryGrade);
                    cbxBacMoi.SetValue("Bậc " + hsLuong.SalaryGrade);
                }

                if (txtHeSoLuongMoi.Visible == true)
                {
                    txtHeSoLuongMoi.SetValue(hsLuong.SalaryFactor);
                }
                if (txtMucLuongMoi.Visible == true)
                {
                    txtMucLuongMoi.SetValue(hsLuong.SalaryBasic);
                }
                if (txtLuongDongBHMoi.Visible == true)
                {
                    txtLuongDongBHMoi.SetValue(hsLuong.SalaryInsurance);
                }
                if (txtBacLuongNBMoi.Visible == true)
                {
                    txtBacLuongNBMoi.Text = hsLuong.SalaryGradeLift;
                }
                if (dfNgayHLNBMoi.Visible == true && !Util.GetInstance().IsDateNull(hsLuong.SalaryGradeDate))
                {
                    dfNgayHLNBMoi.SetValue(hsLuong.SalaryGradeDate);
                }
                if (txtPhuCapKhacMoi.Visible == true)
                {
                    txtPhuCapKhacMoi.SetValue(hsLuong.OtherAllowance);
                }
                if (txtPhuCapChucVuMoi.Visible == true)
                {
                    txtPhuCapChucVuMoi.SetValue(hsLuong.PositionAllowance);
                }
                if (txtVuotKhungMoi.Visible == true)
                {
                    txtVuotKhungMoi.SetValue(hsLuong.OutFrame);
                }
                txtThamnien.SetValue(hsLuong.Seniority);
                if (txtPhuCapTrachNhiemMoi.Visible == true)
                {
                    txtPhuCapTrachNhiemMoi.SetValue(hsLuong.ResponsibilityAllowance);
                }
                if (txtPhuCapKhuVucMoi.Visible == true)
                {
                    txtPhuCapKhuVucMoi.SetValue(hsLuong.AreaAllowance);
                }
                txtPCNganh.SetValue(hsLuong.BranchAllowance);

                // update form information
                wdTaoQuyetDinhLuong.Title = "Cập nhật thông tin quyết định lương";
                wdTaoQuyetDinhLuong.Icon  = Icon.Pencil;
                btnCapNhat.Hide();
                btnCapNhatSua.Show();
                btnCapNhatDongLai.Hide();
                wdTaoQuyetDinhLuong.Show();
            }
            catch (Exception ex)
            {
                X.MessageBox.Alert("Có lỗi xảy ra: ", ex.Message).Show();
            }
        }
Example #19
0
        protected void cbxChonCanBo_Selected(object sender, DirectEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(cbxChonCanBo.SelectedItem.Value))
                {
                    int recordId = Convert.ToInt32(cbxChonCanBo.SelectedItem.Value);
                    var hs       = RecordController.GetById(recordId);
                    if (hs != null)
                    {
                        // set general infomation
                        txtChucVu.Text     = hs.PositionName;
                        txtCongViec.Text   = hs.JobTitleName;
                        txtDepartment.Text = hs.DepartmentName;

                        // get newest salary development
                        var hsl = SalaryDecisionController.GetByIdConditionRecord(recordId);
                        if (hsl != null)
                        {
                            if (!string.IsNullOrEmpty(hsl.DecisionNumber))
                            {
                                txtSoQDCu.Text = hsl.DecisionNumber;
                            }
                            if (hsl.DecisionName != null)
                            {
                                txtTenQDCu.Text = hsl.DecisionName;
                            }
                            dfNgayQDCu.SetValue(hsl.DecisionDate);
                            //if (hsl.HOSO != null)
                            //    txtNguoiQDCu.Text = hsl.HOSO.HO_TEN;
                            dfNgayCoHieuLucCu.SetValue(hsl.EffectiveDate);
                            cbxNgachCu.SetValue(hsl.QuantumName);

                            if (!string.IsNullOrEmpty(hsl.SalaryGrade))
                            {
                                txtBacLuongCu.Text = "Bậc " + hsl.SalaryGrade;
                            }
                            if (hsl.SalaryFactor != null)
                            {
                                txtHeSoLuongCu.SetValue(hsl.SalaryFactor);
                            }
                            if (hsl.SalaryBasic != null)
                            {
                                txtMucLuongCu.SetValue(hsl.SalaryBasic);
                            }
                            if (hsl.SalaryInsurance != null)
                            {
                                txtLuongDongBHCu.SetValue(hsl.SalaryInsurance);
                            }
                            if (hsl.OtherAllowance != null)
                            {
                                txtPhuCapKhacCu.SetValue(hsl.OtherAllowance);
                            }
                            if (hsl.OutFrame != null)
                            {
                                txtVuotKhungCu.SetValue(hsl.OutFrame);
                            }
                            var strContractTypeId =
                                hr_ContractServices.GetFieldValueById(hsl.ContractId, "ContractTypeId");
                            if (!string.IsNullOrEmpty(strContractTypeId))
                            {
                                var contractTypeName =
                                    cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeId),
                                                                               "Name");
                                cbHopDongLoaiHopDongCu.Text = "" + contractTypeName;
                            }

                            if (hsl.Seniority != null)
                            {
                                txtThamNienCu.SetValue(hsl.Seniority);
                            }
                            if (hsl.BranchAllowance != null)
                            {
                                txtPCNganhCu.SetValue(hsl.BranchAllowance);
                            }
                        }
                        else
                        {
                            txtSoQDCu.Text  = "";
                            txtTenQDCu.Text = "";
                            dfNgayQDCu.SetValue("");
                            txtNguoiQDCu.Text = "";
                            dfNgayCoHieuLucCu.SetValue("");
                            cbxNgachCu.Text             = "";
                            txtBacLuongCu.Text          = "";
                            txtHeSoLuongCu.Text         = "";
                            txtMucLuongCu.Text          = "";
                            txtLuongDongBHCu.Text       = "";
                            txtPhuCapKhacCu.Text        = "";
                            txtVuotKhungCu.Text         = "";
                            cbHopDongLoaiHopDongCu.Text = "";
                        }
                    }
                    else
                    {
                        txtChucVu.Text     = "";
                        txtCongViec.Text   = "";
                        txtDepartment.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra khi chọn cán bộ: " + ex.Message).Show();
            }
        }
Example #20
0
        protected void btnCapNhatHL_Click(object sender, DirectEventArgs e)
        {
            try
            {
                Util util             = new Util();
                var  salaryController = new SalaryDecisionController();

                string errorStr = string.Empty;
                // upload file
                string path = string.Empty;
                if (cpfAttachHL.Visible && fufTepTinDinhKemHL.HasFile)
                {
                    path = UploadFile(fufTepTinDinhKemHL, Constant.PathDecisionSalary);
                }

                var rs = JSON.Deserialize <List <SalaryDecisionModel> >(e.ExtraParams["json"]);
                foreach (var created in rs)
                {
                    var hsl = new sal_SalaryDecision();

                    // decision information
                    if (txtSoQDHL.Visible)
                    {
                        hsl.DecisionNumber = txtSoQDHL.Text.Trim();
                    }
                    if (txtTenQDHL.Visible)
                    {
                        hsl.Name = txtTenQDHL.Text.Trim();
                    }
                    if (dfNgayQDHL.Visible && !util.IsDateNull(dfNgayQDHL.SelectedDate))
                    {
                        hsl.DecisionDate = dfNgayQDHL.SelectedDate;
                    }
                    if (dfNgayHieuLucHL.Visible && !util.IsDateNull(dfNgayHieuLucHL.SelectedDate))
                    {
                        hsl.EffectiveDate = dfNgayHieuLucHL.SelectedDate;
                    }
                    if (txtNguoiQDHL.Visible && !string.IsNullOrEmpty(txtNguoiQDHL.Text))
                    {
                        hsl.SignerName = txtNguoiQDHL.Text;
                    }
                    var makerPosition = string.Empty;
                    if (hdfIsMakerPositionHL.Text == @"0")
                    {
                        makerPosition = cbxMakerPositionHL.Text;
                    }
                    else
                    {
                        makerPosition = cbxMakerPositionHL.SelectedItem.Text;
                    }
                    hsl.SignerPosition = makerPosition;
                    if (path != "")
                    {
                        hsl.AttachFileName = path;
                    }
                    else
                    {
                        hsl.AttachFileName = hdfTepTinDinhKemHL.Text;
                    }
                    hsl.Note = txtGhiChuHL.Text;
                    // salary information
                    hsl.RecordId        = created.RecordId;
                    hsl.QuantumId       = created.QuantumId;
                    hsl.SalaryGrade     = created.SalaryGrade;
                    hsl.SalaryFactor    = created.SalaryFactor;
                    hsl.SalaryBasic     = created.SalaryBasic;
                    hsl.SalaryInsurance = created.SalaryInsurance;
                    hsl.OutFrame        = created.OutFrame;
                    hsl.CreatedBy       = CurrentUser.User.UserName;
                    hsl.CreatedDate     = DateTime.Now;
                    salaryController.Insert(hsl);
                }

                if (e.ExtraParams["close"] == "True")
                {
                    wdTaoQuyetDinhLuongHangLoat.Hide();
                }
                else
                {
                    RM.RegisterClientScriptBlock("resetform",
                                                 "ResetWdTaoQuyetDinhLuongHangLoat(); Ext.net.DirectMethods.GenerateSoQDHL();");
                }

                GridPanel1.Reload();
                RM.RegisterClientScriptBlock("rlst", "Store1.reload();");
            }
            catch (Exception ex)
            {
                Dialog.ShowError(ex.Message);
            }
        }
Example #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        private void InitFormUpdate(int id)
        {
            // get current decision
            var model = SalaryDecisionController.GetById(id);

            if (model != null)
            {
                // get previous decision
                var previousDecision = SalaryDecisionController.GetPrevious(model.RecordId);

                // bind previous data
                if (previousDecision != null)
                {
                    txtCurrName.Text             = previousDecision.Name;
                    txtCurrDecisionNumber.Text   = previousDecision.DecisionNumber;
                    txtCurrDecisionDate.Text     = previousDecision.DecisionDate.ToString("dd/MM/yyyy");
                    txtCurrSignerName.Text       = previousDecision.SignerName;
                    txtCurrSignerPosition.Text   = previousDecision.SignerPosition;
                    txtCurrContractTypeName.Text = previousDecision.ContractTypeName;
                    txtCurrQuantumCode.Text      = previousDecision.QuantumCode;
                    txtCurrGrade.Text            = previousDecision.Grade.ToString();
                    txtCurrQuantumCode.Text      = previousDecision.QuantumCode;
                    txtCurrFactor.Text           = previousDecision.Factor.ToString("#,##0.00");
                    txtCurrSalaryLevel.Text      = previousDecision.Salary.ToString("#,###");
                    txtCurrContractSalary.Text   = previousDecision.ContractSalary.ToString("#,###");
                    txtCurrInsuranceSalary.Text  = previousDecision.InsuranceSalary.ToString("#,###");
                    txtCurrPercentageLeader.Text = previousDecision.PercentageLeader.ToString("0.00 %");
                }

                // bind current salary decision
                cboEmployee.Text             = model.EmployeeName;
                hdfEmployee.Text             = model.RecordId.ToString();
                txtName.Text                 = model.Name;
                txtDepartmentName.Text       = model.DepartmentName;
                txtPositionName.Text         = model.PositionName;
                txtJobTitleName.Text         = model.JobTitleName;
                cboContractType.Text         = model.ContractTypeName;
                txtDecisionNumber.Text       = model.DecisionNumber;
                dfDecisionDate.SelectedDate  = model.DecisionDate;
                dfEffectiveDate.SelectedDate = model.EditedDate;
                txtSignerName.Text           = model.SignerName;
                hdfPosition.Text             = model.SignerPositionId.ToString();
                cboPosition.Text             = model.SignerPosition;
                txtNote.Text                 = model.Note;
                hdfQuantumId.Text            = model.QuantumId.ToString();
                cboQuantum.Text              = model.QuantumName;
                hdfSalaryGrade.Text          = model.Grade.ToString();
                cboSalaryGrade.Text          = @"Bậc " + model.Grade;
                txtFactor.Text               = model.Factor.ToString("#,##0.00");
                txtSalaryLevel.Text          = model.Salary.ToString("##,###");
                txtPercentageSalary.Text     = model.PercentageSalary.ToString("0.00");
                txtPercentageLeader.Text     = model.PercentageLeader.ToString("0.00");
                // get file upload
                if (cfAttachFile.Visible)
                {
                    hdfAttachFile.Text = model.AttachFileName;
                    if (!string.IsNullOrEmpty(model.AttachFileName))
                    {
                        hdfAttachFile.Text = model.AttachFileName;
                        fufAttachFile.Text = GetFileName(model.AttachFileName);
                    }
                }
            }
        }
        /// <summary>
        /// #############################################
        /// Create salary decision for employee
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, DirectEventArgs e)
        {
            try
            {
                var hsl = new sal_SalaryDecision();
                // upload file
                var path = string.Empty;
                if (uploadAttachFile.HasFile)
                {
                    path = UploadFile(uploadAttachFile, Constant.PathDecisionSalary);
                }

                // decide information
                if (!string.IsNullOrEmpty(hdfChooseEmployee.Text))
                {
                    hsl.RecordId = Convert.ToInt32(hdfChooseEmployee.Text);
                }
                if (txtDecisionNumberNew.Visible)
                {
                    hsl.DecisionNumber = txtDecisionNumberNew.Text;
                }
                if (!DatetimeHelper.IsNull(DecisionDateNew.SelectedDate))
                {
                    hsl.DecisionDate = DecisionDateNew.SelectedDate;
                }
                if (txtDecisionNameNew.Visible)
                {
                    hsl.Name = txtDecisionNameNew.Text;
                }
                if (!DatetimeHelper.IsNull(EffectiveDateNew.SelectedDate))
                {
                    hsl.EffectiveDate = EffectiveDateNew.SelectedDate;
                }
                if (txtDecisionMakerNew.Visible)
                {
                    hsl.SignerName = txtDecisionMakerNew.Text;
                }
                var makerPosition = hdfIsMakerPosition.Text == @"0" ? cbxMakerPosition.Text : cbxMakerPosition.SelectedItem.Text;
                //hsl.SignerPosition = makerPosition;
                if (cbxContractTypeNew.SelectedItem.Value != null)
                {
                    hsl.ContractId = Convert.ToInt32(hdfContractTypeNew.Text);
                }

                // attach file
                hsl.AttachFileName = path != "" ? path : hdfAttachFile.Text;
                if (txtNoteNew.Visible)
                {
                    hsl.Note = txtNoteNew.Text;
                }
                // salary information
                //if (!string.IsNullOrEmpty(txtSalaryBasicNew.Text))
                //    hsl.SalaryBasic = double.Parse(txtSalaryBasicNew.Text);
                //if (!string.IsNullOrEmpty(txtSalaryContractNew.Text))
                //    hsl.SalaryContract = double.Parse(txtSalaryContractNew.Text);
                //if (!string.IsNullOrEmpty(txtSalaryGrossNew.Text))
                //    hsl.SalaryGross = double.Parse(txtSalaryGrossNew.Text);
                //if (!string.IsNullOrEmpty(txtSalaryNetNew.Text))
                //    hsl.SalaryNet = double.Parse(txtSalaryNetNew.Text);
                //if (!string.IsNullOrEmpty(txtPercentageSalaryNew.Text))
                //    hsl.PercentageSalary = double.Parse(txtPercentageSalaryNew.Text);
                //if (!string.IsNullOrEmpty(txtSalaryInsuranceNew.Text))
                //    hsl.SalaryInsurance = double.Parse(txtSalaryInsuranceNew.Text);
                //if (!string.IsNullOrEmpty(txtSalaryFactorNew.Text))
                //    hsl.SalaryFactor = double.Parse(txtSalaryFactorNew.Text);
                hsl.CreatedBy   = CurrentUser.User.UserName;
                hsl.CreatedDate = DateTime.Now;

                if (e.ExtraParams["Command"] == "Edit")
                {
                    hsl.Id = int.Parse("0" + hdfRecordId.Text);
                    SalaryDecisionController.Update(new SalaryDecisionModel(hsl));
                    wdCreateDecisionSalary.Hide();
                }
                else
                {
                    // add salary decision
                    SalaryDecisionController.Create(new SalaryDecisionModel(hsl));
                    if (e.ExtraParams["Close"] == "True")
                    {
                        wdCreateDecisionSalary.Hide();
                    }
                }

                gridDecisionSalaryEnterprise.Reload();
            }
            catch (Exception ex)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra khi lưu quyết định lương: " + ex.Message).Show();
            }
        }