private void btnDeletePayrollRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (PayrollDiffDetailGridView.GetFocusedRow() is PayrollDifferentialDetails item)
     {
         UnitOfWork unitOfWork = new UnitOfWork();
         unitOfWork.PayrollDifferentialDetailsRepo.Delete(x => x.Id == item.Id);
         unitOfWork.Save();
         Init();
     }
 }
        private void PayrollDiffDetailGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (PayrollDiffDetailGridView.GetRow(e.RowHandle) is PayrollDifferentialDetails item)
            {
                if (e.Column.Name == "colName")
                {
                    UnitOfWork unitOfWork = new UnitOfWork();
                    var        employee   = unitOfWork.EmployeesRepo.Find(x => x.Id == item.EmployeeId);
                    item.Designation  = employee.Position;
                    item.EmployeeName = employee.EmployeeName;
                    item.SalaryGrade  = employee.SG;
                }


                //if (e.Column.Name == "colNewRate" || e.Column.Name == "colOldRate")
                //{

                //    item.Amount = (item.NewRate ?? 0) - (item.OldRate ?? 0);

                //}
                item.Amount = (item.NewRate ?? 0) - (item.OldRate ?? 0);
                //if (e.Column.Name == "colMonth" || e.Column.Name == "colMidYear")
                //{
                //    item.DiffBonus = (item.Amount ?? 0) * (item.Month ?? 0);
                //    item.DiffBonus = item.DiffBonus + (item.DiffMidYearBonus?? 0);
                //    item.TotalAmount = item.DiffBonus;
                //}
                item.DiffBonus = (item.Amount ?? 0) * (item.Month ?? 0);
                item.DiffBonus = item.DiffBonus + (item.DiffMidYearBonus ?? 0);
                //string[] deductions = new string[] { "colPHPS", "colPIPS", "colGSISPS" };
                //if (deductions.Contains(e.Column.Name))
                //{
                //    var deduction = (item.GSISPS ?? 0) + (item.PHPS ?? 0) + (item.PIPS ?? 0);
                //    item.TotalAmount = (item.DiffBonus ?? 0) - deduction;
                //}

                item.TotalAmount = (item.DiffBonus ?? 0) - ((item.GSISPS ?? 0) + (item.PHPS ?? 0) + (item.PIPS ?? 0));
            }
        }