Esempio n. 1
0
        private EmployeeSalaryHeadModel GetEmployeeBasicSalaryHeadModel()
        {
            EmployeeSalaryHeadModel BasicSalary = null;

            try
            {
                //get basic salary head info
                int basicSalaryHeadID = Program.LIST_DEFAULTS.Where(x => x.ID == (int)APP_DEFAULT_VALUES.BasicSalaryHeadID).FirstOrDefault().DEFAULT_VALUE;
                BasicSalary = _AllounceList.Where(X => X.SalaryHeadID == basicSalaryHeadID).FirstOrDefault();
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlEmployeeCTC::GetEmployeeBasicSalaryHeadModel", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(BasicSalary);
        }
Esempio n. 2
0
 private void gridAllounces_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int salaryHeadID = (int)gridAllounces.Rows[e.RowIndex].Cells["SalaryHeadID"].Value;
         EmployeeSalaryHeadModel model = _AllounceList.Where(x => x.SalaryHeadID == salaryHeadID).FirstOrDefault();
         if (model != null)
         {
             UpdateEmployeeCTCInfo(model, SALARY_HEAD_TYPE.ALLOUNCE);
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlEmployeeCTC::gridAllounces_CellDoubleClick", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 3
0
 private void gridDeductions_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int salaryHeadID = (int)gridDeductions.Rows[e.RowIndex].Cells["SalaryHeadID"].Value;
         // get the object from _DeductionsList collection for the selected SlaryHEadID
         EmployeeSalaryHeadModel model = _DeductionList.Where(x => x.SalaryHeadID == salaryHeadID).FirstOrDefault();
         if (model != null)
         {
             UpdateEmployeeCTCInfo(model, SALARY_HEAD_TYPE.DEDUCTION);
         }
         // PopulateDefaultDeductionGrid();
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlEmployeeCTC::gridDeductions_CellDoubleClick", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 4
0
        private void UpdateEmployeeCTCInfo(EmployeeSalaryHeadModel model, SALARY_HEAD_TYPE headType)
        {
            EmployeeSalaryHeadModel prevModel = null;

            try
            {
                frmAddEditEmployeeWiseSalaryHeadValue frm = new frmAddEditEmployeeWiseSalaryHeadValue(model);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    this.Cursor = Cursors.WaitCursor;
                    switch (headType)
                    {
                    case SALARY_HEAD_TYPE.ALLOUNCE:
                        prevModel = _AllounceList.Where(x => x.SalaryHeadID == frm.MODEL.SalaryHeadID).FirstOrDefault();
                        break;

                    case SALARY_HEAD_TYPE.DEDUCTION:
                        prevModel = _DeductionList.Where(x => x.SalaryHeadID == frm.MODEL.SalaryHeadID).FirstOrDefault();
                        break;
                    }

                    if (model.IsSelected)
                    {
                        if (prevModel.ApplicableChargesType == ITEM_CHARGE_TYPE.PERCENTAGE)
                        {
                            if (prevModel.HeadForCalculation == SalaryHeadCalculatedOn.PERCENT_OF_BASIC)
                            {
                                EmployeeSalaryHeadModel basic = this.GetEmployeeBasicSalaryHeadModel();
                                if (basic != null)
                                {
                                    prevModel.SalaryHeadAmount = (basic.SalaryHeadAmount * prevModel.ApplicableChargesValue) / 100;
                                }
                            }
                            if (prevModel.HeadForCalculation == SalaryHeadCalculatedOn.PERCENT_OF_GROSS)
                            {
                                decimal gross = decimal.Parse(txtTotalAllounce.Text.Trim());
                                prevModel.SalaryHeadAmount = (gross * prevModel.ApplicableChargesValue) / 100;
                            }
                            if (prevModel.HeadForCalculation == SalaryHeadCalculatedOn.PERCENT_OF_BASIC_AND_DA)
                            {
                                int     basicSalaryHeadID = Program.LIST_DEFAULTS.Where(X => X.ID == (int)APP_DEFAULT_VALUES.BasicSalaryHeadID).FirstOrDefault().DEFAULT_VALUE;
                                decimal basicAmount       = _AllounceList.Where(x => x.SalaryHeadID == basicSalaryHeadID).FirstOrDefault().SalaryHeadAmount;

                                int     daSalaryHeadID = Program.LIST_DEFAULTS.Where(X => X.ID == (int)APP_DEFAULT_VALUES.daSalaryHeadID).FirstOrDefault().DEFAULT_VALUE;
                                decimal daAmount       = _AllounceList.Where(x => x.SalaryHeadID == daSalaryHeadID).FirstOrDefault().SalaryHeadAmount;


                                prevModel.SalaryHeadAmount = ((basicAmount + daAmount) * model.ApplicableChargesValue) / 100;
                            }
                        }
                        if (prevModel.ApplicableChargesType == ITEM_CHARGE_TYPE.LUMPSUM)
                        {
                            prevModel.SalaryHeadAmount = prevModel.ApplicableChargesValue;
                        }
                    }
                    else
                    {
                        model.ApplicableChargesType  = ITEM_CHARGE_TYPE.NONE;
                        model.ApplicableChargesValue = 0;
                        model.SalaryHeadAmount       = 0;
                    }

                    gridAllounces.DataSource  = _AllounceList;
                    gridDeductions.DataSource = _DeductionList;
                    gridAllounces.Refresh();
                    gridDeductions.Refresh();
                    RefreshSummaryControls();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlEmployeeCTC::UpdateEmployeeCTCInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }
 public frmAddEditEmployeeWiseSalaryHeadValue(EmployeeSalaryHeadModel selItem)
 {
     InitializeComponent();
     MODEL = selItem;
 }