Android Open Source - philippine-income-tax-android Withholding Tax






From Project

Back to project page philippine-income-tax-android.

License

The source code is released under:

GNU General Public License

If you think the Android project philippine-income-tax-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.chrisbjr.android.philippineincometax.objects;
//from  w  w w . jav a2  s. co  m
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.math.BigDecimal;

@DatabaseTable(tableName = "withholding_tax")
public class WithholdingTax {

  @DatabaseField(generatedId = true)
  private int id;
  @DatabaseField
  private int withholdingTaxTypeId;
  @DatabaseField
  private int dependents;
  @DatabaseField
  private String computationFrequency;
  @DatabaseField
  private double taxableIncomeFrom;
  @DatabaseField
  private double taxableIncomeTo;
  @DatabaseField
  private double baseTax;
  @DatabaseField
  private double percentOver;

  private double taxableIncome = 0;

  public WithholdingTax() {
    // ORMLite needs this
  }

  public WithholdingTax(String[] csvLine) {
    this.id = Integer.parseInt(csvLine[0]);
    this.withholdingTaxTypeId = Integer.parseInt(csvLine[1]);
    this.dependents = Integer.parseInt(csvLine[2]);
    this.computationFrequency = csvLine[3];
    this.taxableIncomeFrom = Double.parseDouble(csvLine[4]);
    this.taxableIncomeTo = Double.parseDouble(csvLine[5]);
    this.baseTax = Double.parseDouble(csvLine[6]);
    this.percentOver = Double.parseDouble(csvLine[7]);
  }

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public int getWithholdingTaxTypeId() {
    return withholdingTaxTypeId;
  }

  public void setWithholdingTaxTypeId(int withholdingTaxTypeId) {
    this.withholdingTaxTypeId = withholdingTaxTypeId;
  }

  public int getDependents() {
    return dependents;
  }

  public void setDependents(int dependents) {
    this.dependents = dependents;
  }

  public String getComputationFrequency() {
    return computationFrequency;
  }

  public void setComputationFrequency(String computationFrequency) {
    this.computationFrequency = computationFrequency;
  }

  public double getTaxableIncomeFrom() {
    return taxableIncomeFrom;
  }

  public void setTaxableIncomeFrom(double taxableIncomeFrom) {
    this.taxableIncomeFrom = taxableIncomeFrom;
  }

  public double getTaxableIncomeTo() {
    return taxableIncomeTo;
  }

  public void setTaxableIncomeTo(double taxableIncomeTo) {
    this.taxableIncomeTo = taxableIncomeTo;
  }

  public double getBaseTax() {
    return baseTax;
  }

  public void setBaseTax(double baseTax) {
    this.baseTax = baseTax;
  }

  public double getPercentOver() {
    return percentOver;
  }

  public void setPercentOver(double percentOver) {
    this.percentOver = percentOver;
  }

  public double getTaxableIncome() {
    return taxableIncome;
  }

  public void setTaxableIncome(double taxableIncome) {
    this.taxableIncome = taxableIncome;
  }

  public double getWithholdingTaxAmount() {
    return round(
        ((getTaxableIncome() - getTaxableIncomeFrom()) * (getPercentOver() / 100))
            + getBaseTax(), 2);
  }

  private double round(double value, int places) {
    if (places < 0)
      throw new IllegalArgumentException();

    BigDecimal bd = new BigDecimal(value);
    bd = bd.setScale(places, BigDecimal.ROUND_HALF_UP);
    return Double.parseDouble(bd.toString());
  }

}




Java Source Code List

com.chrisbjr.android.philippineincometax.MainActivity.java
com.chrisbjr.android.philippineincometax.adapters.IncomeAdapter.java
com.chrisbjr.android.philippineincometax.calculator.CalculatorBrain.java
com.chrisbjr.android.philippineincometax.db.DatabaseConfigUtil.java
com.chrisbjr.android.philippineincometax.db.DatabaseHelper.java
com.chrisbjr.android.philippineincometax.db.DatabaseManager.java
com.chrisbjr.android.philippineincometax.models.IncomeTaxCalculationModel.java
com.chrisbjr.android.philippineincometax.models.NonTaxableIncomeModel.java
com.chrisbjr.android.philippineincometax.models.PagibigModel.java
com.chrisbjr.android.philippineincometax.models.PhilHealthModel.java
com.chrisbjr.android.philippineincometax.models.SssModel.java
com.chrisbjr.android.philippineincometax.models.TaxableIncomeModel.java
com.chrisbjr.android.philippineincometax.models.WithholdingTaxModel.java
com.chrisbjr.android.philippineincometax.objects.IncomeTaxCalculation.java
com.chrisbjr.android.philippineincometax.objects.NonTaxableIncome.java
com.chrisbjr.android.philippineincometax.objects.Pagibig.java
com.chrisbjr.android.philippineincometax.objects.Philhealth.java
com.chrisbjr.android.philippineincometax.objects.Sss.java
com.chrisbjr.android.philippineincometax.objects.TaxableIncome.java
com.chrisbjr.android.philippineincometax.objects.WithholdingTaxType.java
com.chrisbjr.android.philippineincometax.objects.WithholdingTax.java