protected void ButtonProcessData_Click(object sender, EventArgs e) { TaxLevels.ImportTaxLevels(Country.FromCode(this.DropCountries.SelectedValue), this.TextTaxData.Text); ScriptManager.RegisterStartupScript(this, Page.GetType(), "alldone", "alert ('The income tax levels have been imported.');", true); this.TextTaxData.Text = string.Empty; }
private void PopulateGrid() { List <PayrollLineItem> lines = new List <PayrollLineItem>(); PayrollAdjustments adjustments = PayrollAdjustments.ForPayrollItem(_payrollItem); lines.Add(new PayrollLineItem("BASE SALARY", _payrollItem.BaseSalaryCents / 100.0)); double pay = _payrollItem.BaseSalaryCents / 100.0; foreach (PayrollAdjustment adjustment in adjustments) { if (adjustment.Type == PayrollAdjustmentType.GrossAdjustment) { pay += adjustment.AmountCents / 100.0; lines.Add(new PayrollLineItem(adjustment.Description, adjustment.AmountCents / 100.0)); } } lines.Add(new PayrollLineItem("GROSS SALARY", pay)); double subtractiveTax = TaxLevels.GetTax(_payrollItem.Country, _payrollItem.SubtractiveTaxLevelId, pay); if (subtractiveTax < 1.0) { // this is a percentage and not an absolute number subtractiveTax = pay * subtractiveTax; } lines.Add(new PayrollLineItem("Income Tax", -subtractiveTax)); pay -= subtractiveTax; foreach (PayrollAdjustment adjustment in adjustments) { if (adjustment.Type == PayrollAdjustmentType.NetAdjustment) { pay += adjustment.AmountCents / 100.0; lines.Add(new PayrollLineItem(adjustment.Description, adjustment.AmountCents / 100.0)); } } if (pay < 0.0) { lines.Add(new PayrollLineItem("Negative amount rolling over to next salary", -pay)); pay = 0.0; } lines.Add(new PayrollLineItem("NET SALARY PAYOUT", pay)); this.GridProjectedPayroll.DataSource = lines; this.GridProjectedPayroll.DataBind(); }