コード例 #1
0
ファイル: IditTrustTool.java プロジェクト: paulstay/APN
  /* (non-Javadoc)
   * @see com.teag.estate.EstatePlanningTool#calculate()
   */
  @Override
  public void calculate() {

    int tableLength = 60;
    iditTable = new double[tableLength][11];
    Calendar cal = Calendar.getInstance();
    Date now = new Date();
    cal.setTime(now);

    double gratValue = (noteValue + secOrigValue) * (1 - noteFlpDiscount) * noteFlpLPInterest;

    zCalc zc = new zCalc();
    zc.StartUp();
    optimalGratRate = zc.zGRATZO(afrRate, term, 0, 4, 0);
    remainderInterest = 45000;
    remainderPaymentRate =
        zc.zANNRATETARGET(
            gratValue, remainderInterest, afrRate, term, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0);
    zc.ShutDown();

    gratPayment = gratValue * remainderPaymentRate;
    double assetPay = noteValue * noteFlpLPInterest * noteInterest;
    double secPay = gratPayment - assetPay;
    double taxableEstate = gratValue - secPay;

    int year = cal.get(Calendar.YEAR);

    double fet = getFetTax(year);

    iditTable[0][0] = 1;
    iditTable[0][1] = year++;
    iditTable[0][2] = assetOrigValue; // Original Asset (real estate value)
    iditTable[0][3] = assetPay; // Calculated GratPayment of real estate;
    iditTable[0][4] = secOrigValue; // Original Securities value we will be zeroint it out
    iditTable[0][5] = secOrigValue * secGrowth;
    iditTable[0][6] = secPay;
    iditTable[0][7] = taxableEstate;
    iditTable[0][8] = taxableEstate * fet;
    iditTable[0][9] = fet;
    iditTable[0][10] =
        iditTable[0][2] + iditTable[0][4] + iditTable[0][5] - iditTable[0][6] - iditTable[0][8];

    for (int i = 1; i < tableLength; i++) {

      fet = getFetTax(year);
      iditTable[i][0] = i + 1;
      iditTable[i][1] = year++;
      iditTable[i][2] = iditTable[i - 1][2] * (1 + (assetOrigGrowth + assetOrigIncome)) - assetPay;
      double sTmp = iditTable[i - 1][4] + iditTable[i - 1][5] - iditTable[i - 1][6];
      if (sTmp < 0) sTmp = 0;
      iditTable[i][4] = sTmp;
      iditTable[i][5] = iditTable[i][4] * secGrowth;
      if (i > getTerm() - 1) {
        iditTable[i][3] = 0;
        iditTable[i][6] = 0;
        iditTable[i][7] = 0;
      } else {
        iditTable[i][3] = assetPay;
        iditTable[i][6] = secPay;
        iditTable[i][7] = iditTable[i - 1][7] - secPay;
      }
      iditTable[i][8] = iditTable[i][7] * fet;
      iditTable[i][9] = fet;
      iditTable[i][10] =
          iditTable[i][2] + iditTable[i][4] + iditTable[i][5] - iditTable[i][6] - iditTable[i][8];
      if (i > getTerm() - 1) {
        assetPay = 0;
        secPay = 0;
      }
    }
  }
コード例 #2
0
ファイル: GratTrustTool.java プロジェクト: paulstay/APN
  // This method uses zcalc heavily.
  public void calculate() {
    zCalc zcalc = new zCalc();
    zcalc.StartUp();

    /*
    int yr = (int) age;

    if( startTerm != 1) {
    	yr = (int)((startTerm -1 ) + age);
    }
    */
    optimalPaymentRate = zcalc.zGRATZO(afrRate, (int) termLength, annuityIncrease, annuityFreq, 0);

    if (annuity == 0) {
      if (discountValue == 0) annuity = optimalPaymentRate * value;
      else annuity = optimalPaymentRate * discountValue;
    }

    lifeExp = zcalc.zLE((int) age, 0, 0, 0, 0, 0, 11);
    annuityPaymentRate = annuity / discountValue;
    annuityFactor = zcalc.zGRATAF(afrRate, (int) termLength, 0, 0, annuityIncrease, annuityFreq, 0);
    actualPaymentRate = annuityPaymentRate;
    taxableGift =
        zcalc.zGRATGIFT(
            afrRate,
            (int) termLength,
            0,
            0,
            annuityIncrease,
            annuityFreq,
            discountValue,
            annuityPaymentRate,
            0);
    remainderInterest = taxableGift;
    annuityInterest = discountValue - remainderInterest;

    if (actualPaymentRate > optimalPaymentRate) {
      federalRev = true;
    } else {
      federalRev = false;
    }

    totalInterest = discountValue;
    retainedAnnuityInterest = totalInterest - taxableGift;

    Date now = new Date();
    GregorianCalendar cal = new GregorianCalendar();
    cal.setTime(now);
    int year = cal.get(Calendar.YEAR);
    if (spousePriorGifts > 0) {
      totalGiftTaxPayable =
          zcalc.zFGT(taxableGift, priorGifts + spousePriorGifts, 0, 0, year, 0, 0);
    } else {
      totalGiftTaxPayable = zcalc.zFGT(taxableGift, priorGifts, 0, 0, year, 0, 0);
    }

    gratBenefit =
        zcalc.zGRATBEN(
            afrRate,
            (int) termLength,
            growthRate,
            annuityIncrease,
            annuityFreq,
            value,
            annuityPaymentRate,
            0);

    estateTaxSavings = estateTaxRate * (gratBenefit - taxableGift);

    if (taxableGift > 0) leverage = value / taxableGift;

    zcalc.ShutDown();
  }