Exemplo n.º 1
0
  private APUnitTaxCalculationInfo prepareUnitCalcInfo(
      final Property property, final Floor floor, final BoundaryCategory boundaryCategory) {
    final APUnitTaxCalculationInfo unitTaxCalculationInfo = new APUnitTaxCalculationInfo();
    BigDecimal builtUpArea = BigDecimal.ZERO;
    BigDecimal floorMrv = BigDecimal.ZERO;
    BigDecimal floorBuildingValue = BigDecimal.ZERO;
    BigDecimal floorSiteValue = BigDecimal.ZERO;
    BigDecimal floorGrossArv = BigDecimal.ZERO;
    BigDecimal floorDepreciation = BigDecimal.ZERO;
    BigDecimal floorNetArv = BigDecimal.ZERO;

    builtUpArea = BigDecimal.valueOf(floor.getBuiltUpArea().getArea());
    floorMrv = calculateFloorMrv(builtUpArea, boundaryCategory);
    floorBuildingValue = calculateFloorBuildingValue(floorMrv);
    floorSiteValue = calculateFloorSiteValue(floorMrv);
    floorGrossArv = floorBuildingValue.multiply(new BigDecimal(12));
    floorDepreciation = calculateFloorDepreciation(floorGrossArv, floor);
    if (property.getPropertyDetail().isStructure())
      floorNetArv = floorGrossArv.subtract(floorDepreciation);
    else
      floorNetArv =
          floorSiteValue
              .multiply(new BigDecimal(12))
              .add(floorGrossArv.subtract(floorDepreciation));
    unitTaxCalculationInfo.setFloorNumber(FLOOR_MAP.get(floor.getFloorNo()));
    unitTaxCalculationInfo.setBaseRateEffectiveDate(boundaryCategory.getFromDate());
    unitTaxCalculationInfo.setBaseRate(
        BigDecimal.valueOf(boundaryCategory.getCategory().getCategoryAmount()));
    unitTaxCalculationInfo.setMrv(floorMrv);
    unitTaxCalculationInfo.setBuildingValue(floorBuildingValue);
    unitTaxCalculationInfo.setSiteValue(floorSiteValue);
    unitTaxCalculationInfo.setGrossARV(floorGrossArv);
    unitTaxCalculationInfo.setDepreciation(floorDepreciation);
    unitTaxCalculationInfo.setNetARV(floorNetArv.setScale(0, BigDecimal.ROUND_HALF_UP));
    return unitTaxCalculationInfo;
  }
Exemplo n.º 2
0
  private APUnitTaxCalculationInfo calculateVacantLandTax(
      final Property property, final Date occupancyDate) {
    final APUnitTaxCalculationInfo unitTaxCalculationInfo = new APUnitTaxCalculationInfo();

    unitTaxCalculationInfo.setFloorNumber("0");
    unitTaxCalculationInfo.setBaseRateEffectiveDate(occupancyDate);
    unitTaxCalculationInfo.setCapitalValue(
        new BigDecimal(property.getPropertyDetail().getCurrentCapitalValue()));
    unitTaxCalculationInfo.setNetARV(unitTaxCalculationInfo.getCapitalValue());
    return unitTaxCalculationInfo;
  }
Exemplo n.º 3
0
  /**
   * @param property Property Object
   * @param applicableTaxes List of Applicable Taxes
   * @param occupationDate Minimum Occupancy Date among all the units
   * @return
   */
  @Override
  public HashMap<Installment, TaxCalculationInfo> calculatePropertyTax(
      final Property property, final Date occupationDate) {

    Boundary propertyZone = null;
    BigDecimal totalNetArv = BigDecimal.ZERO;
    BoundaryCategory boundaryCategory = null;
    // TODO move method prepareApplicableTaxes to tax calculator
    final List<String> applicableTaxes = prepareApplicableTaxes(property);
    final List<Installment> taxInstallments = getInstallmentListByStartDate(occupationDate);
    propertyZone = property.getBasicProperty().getPropertyID().getZone();

    for (final Installment installment : taxInstallments) {
      totalTaxPayable = BigDecimal.ZERO;
      final APTaxCalculationInfo taxCalculationInfo = addPropertyInfo(property);

      if (betweenOrBefore(occupationDate, installment.getFromDate(), installment.getToDate())) {
        if (property
            .getPropertyDetail()
            .getPropertyTypeMaster()
            .getCode()
            .equals(OWNERSHIP_TYPE_VAC_LAND)) {
          final APUnitTaxCalculationInfo unitTaxCalculationInfo =
              calculateVacantLandTax(property, occupationDate);
          totalNetArv = totalNetArv.add(unitTaxCalculationInfo.getNetARV());
          taxCalculationInfo.addUnitTaxCalculationInfo(unitTaxCalculationInfo);
          calculateApplicableTaxes(
              applicableTaxes,
              unitTaxCalculationInfo,
              installment,
              property.getPropertyDetail().getPropertyTypeMaster().getCode());
          totalTaxPayable = totalTaxPayable.add(unitTaxCalculationInfo.getTotalTaxPayable());
        } else
          for (final Floor floorIF : property.getPropertyDetail().getFloorDetails())
            if (floorIF != null) {
              // TODO think about, these beans to be client
              // specific
              boundaryCategory =
                  getBoundaryCategory(
                      propertyZone,
                      installment,
                      floorIF.getPropertyUsage().getId(),
                      occupationDate);
              final APUnitTaxCalculationInfo unitTaxCalculationInfo =
                  prepareUnitCalcInfo(property, floorIF, boundaryCategory);
              totalNetArv = totalNetArv.add(unitTaxCalculationInfo.getNetARV());

              calculateApplicableTaxes(
                  applicableTaxes,
                  unitTaxCalculationInfo,
                  installment,
                  property.getPropertyDetail().getPropertyTypeMaster().getCode());

              totalTaxPayable = totalTaxPayable.add(unitTaxCalculationInfo.getTotalTaxPayable());
              taxCalculationInfo.addUnitTaxCalculationInfo(unitTaxCalculationInfo);
            }
        taxCalculationInfo.setTotalNetARV(totalNetArv);
        taxCalculationInfo.setTotalTaxPayable(totalTaxPayable);
        taxCalculationInfo.setTaxCalculationInfoXML(generateTaxCalculationXML(taxCalculationInfo));
        taxCalculationMap.put(installment, taxCalculationInfo);
      }
    }
    return taxCalculationMap;
  }
Exemplo n.º 4
0
  public APUnitTaxCalculationInfo calculateApplicableTaxes(
      final List<String> applicableTaxes,
      final APUnitTaxCalculationInfo unitTaxCalculationInfo,
      final Installment installment,
      final String propTypeCode) {

    BigDecimal totalTaxPayable = BigDecimal.ZERO;
    EgDemandReasonDetails reasonDetail = null;
    APMiscellaneousTax miscellaneousTax = null;
    final BigDecimal alv = unitTaxCalculationInfo.getNetARV();
    BigDecimal generalTax = BigDecimal.ZERO;
    BigDecimal educationTax = BigDecimal.ZERO;
    BigDecimal calculatedTax = BigDecimal.ZERO;
    LOGGER.debug("calculateApplicableTaxes - ALV: " + alv);
    LOGGER.debug("calculateApplicableTaxes - applicableTaxes: " + applicableTaxes);

    for (final String applicableTax : applicableTaxes) {
      if (applicableTax.equals(DEMANDRSN_CODE_GENERAL_TAX)
          || applicableTax.equals(DEMANDRSN_CODE_VACANT_TAX)) {
        reasonDetail = getDemandReasonDetails(applicableTax, alv, installment).get(0);
        calculatedTax =
            alv.multiply(reasonDetail.getPercentage().divide(new BigDecimal("100")))
                .setScale(0, BigDecimal.ROUND_HALF_UP);
        generalTax = calculatedTax;
      }
      if (applicableTax.equals(DEMANDRSN_CODE_EDUCATIONAL_CESS)) {
        reasonDetail = getDemandReasonDetails(applicableTax, generalTax, installment).get(0);
        calculatedTax =
            generalTax
                .multiply(reasonDetail.getPercentage().divide(new BigDecimal("100")))
                .setScale(0, BigDecimal.ROUND_HALF_UP);
        educationTax = calculatedTax;
      }
      if (applicableTax.equals(DEMANDRSN_CODE_LIBRARY_CESS)) {
        reasonDetail =
            getDemandReasonDetails(applicableTax, generalTax.add(educationTax), installment).get(0);
        calculatedTax =
            generalTax
                .add(educationTax)
                .multiply(reasonDetail.getPercentage().divide(new BigDecimal("100")))
                .setScale(0, BigDecimal.ROUND_HALF_UP);
      }
      if (applicableTax.equals(DEMANDRSN_CODE_GENERAL_TAX)
          || applicableTax.equals(DEMANDRSN_CODE_EDUCATIONAL_CESS)
          || applicableTax.equals(DEMANDRSN_CODE_LIBRARY_CESS)) {
        if (propTypeCode.equals(PropertyTaxConstants.OWNERSHIP_TYPE_CENTRAL_GOVT_335))
          calculatedTax = calculatedTax.multiply(new BigDecimal(0.335));
        if (propTypeCode.equals(PropertyTaxConstants.OWNERSHIP_TYPE_CENTRAL_GOVT_50))
          calculatedTax = calculatedTax.multiply(new BigDecimal(0.5));
        if (propTypeCode.equals(PropertyTaxConstants.OWNERSHIP_TYPE_CENTRAL_GOVT_70))
          calculatedTax = calculatedTax.multiply(new BigDecimal(0.7));
      }
      calculatedTax = roundOffToNearestEven(calculatedTax);
      miscellaneousTax = new APMiscellaneousTax();
      miscellaneousTax.setTaxName(applicableTax);
      miscellaneousTax.setTotalCalculatedTax(calculatedTax);
      totalTaxPayable = totalTaxPayable.add(calculatedTax);
      unitTaxCalculationInfo.addMiscellaneousTaxes(miscellaneousTax);
    }
    unitTaxCalculationInfo.setTotalTaxPayable(totalTaxPayable);
    return unitTaxCalculationInfo;
  }