private void Calulate() { DateTime startDate = dtpStartWorkDate.Value.Date; DateTime endDate = DateTime.Now.Date; decimal salary = Convert.ToDecimal(txtSalary.Text); decimal rate = ComboBoxHelper.GetSelectedValueFromComboBox <decimal>(cboProvidentFundRate); decimal providentFundCalculator = ProvidentFundCalculator.GetCalulateProvidentFund(startDate, endDate, salary, rate); lbTatalPVD.Text = providentFundCalculator.ToString("N2"); }
private void CalulateOnGird() { if (gridViewDisplay.DataSource == null) { return; } List <EmployeeLogDetail> providentFunds = gridViewDisplay.DataSource as List <EmployeeLogDetail>; foreach (EmployeeLogDetail provident in providentFunds) { decimal providentFundCalculator = ProvidentFundCalculator.GetCalulateProvidentFund(provident.Month, provident.CompanyPaidPercent, provident.Salary, provident.PVDRate); provident.ProvidentFundCollect = providentFundCalculator; } lbTatalPVD.Text = providentFunds.Sum(a => a.ProvidentFundCollect).ToString("N2"); }
private void GridViewDisplay_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } decimal rate = Convert.ToDecimal(gridViewDisplay["cboPVDRate", e.RowIndex].Value); gridViewDisplay.Rows[e.RowIndex].Cells[nameof(EmployeeLogDetail.PVDRate)].Value = rate; decimal month = Convert.ToDecimal(gridViewDisplay[nameof(EmployeeLogDetail.Month), e.RowIndex].Value); decimal salary = Convert.ToDecimal(gridViewDisplay[nameof(EmployeeLogDetail.Salary), e.RowIndex].Value); decimal companyPaidPercent = Convert.ToDecimal(gridViewDisplay[nameof(EmployeeLogDetail.CompanyPaidPercent), e.RowIndex].Value); decimal providentFundCollect = ProvidentFundCalculator.GetCalulateProvidentFund(month, companyPaidPercent, salary, rate); gridViewDisplay.Rows[e.RowIndex].Cells[nameof(EmployeeLogDetail.ProvidentFundCollect)].Value = providentFundCollect; }