function computeTaxTotalAmounDue($depth = 0)
 {
     if ($depth == 1) {
         return 0;
     }
     // terminate recursive call on comutetax
     // load the tax/fee record with its attached formula
     $clsTaxFeeRef = new EBPLTaxFeeSysRef($this->m_dbLink, false);
     $res_formula = $clsTaxFeeRef->select($this->getData(TF_TAX_FEE_CODE));
     if (is_array($res_formula)) {
         $clsTaxFormula = $res_formula["result"][0]->getData(EBPLS_TAX_FORMULA);
         if ($clsTaxFormula) {
             // pass paramters to formula before computation
             for ($i = 1; $i <= TF_TAX_MAX_PARAMS; $i++) {
                 $clsTaxFormula->setParameterValue($i, $this->getData(constant("TF_TAX_TAXABLE_AMOUNT{$i}")) + 0.0);
             }
             // process prerequisite tax/fees if there are any
             $arr_parameters = $clsTaxFormula->getParameterDescription(null, true);
             $this->debug("param cnt : " . count($arr_parameters));
             foreach ($arr_parameters as $key => $value) {
                 if (eregi("^\\[TF=(.*)\\]\$", $value, $arrTaxFeeCode) && eregi("^x([0-9]+)\$", $key, $arrIndex)) {
                     $clsTaxFeeTmp = new EBPLSTransactionFee($this->m_dbLink, false);
                     $res_formula = $clsTaxFeeTmp->view($this->getData(TF_TRANS_ID), $arrTaxFeeCode[1]);
                     if ($res_formula) {
                         $clsTaxFeeTmp->computeTaxTotalAmounDue(1);
                         $this->debug("Tax/Fee Amount: " . $clsTaxFeeTmp->getData(TF_TAX_TOTAL_AMOUNT_DUE) . "!");
                         $this->setData(constant("TF_TAX_TAXABLE_AMOUNT" . $arrIndex[1]), $clsTaxFeeTmp->getData(TF_TAX_TOTAL_AMOUNT_DUE));
                         $clsTaxFormula->setParameterValue($arrIndex[1], floatval($clsTaxFeeTmp->getData(TF_TAX_TOTAL_AMOUNT_DUE)));
                     } else {
                         $this->setError(-6, "Unable to load prerequisite tax/fee " . $arrTaxFeeCode[1] . "!");
                         $this->debug("Unable to load prerequisite tax/fee " . $arrTaxFeeCode[1] . "!");
                         return -6;
                     }
                 } else {
                     $this->debug("no match on {$value}");
                 }
             }
             $clsTaxFormula->setParameterTagValue("[CAPITAL]", $this->m_BusTaxCapital);
             $clsTaxFormula->setParameterTagValue("[LAST_GROSS]", $this->m_BusTaxLastGross);
             $index1 = $clsTaxFormula->getParameterTagValueIndex("[CAPITAL]");
             if ($index1) {
                 $this->setData(constant("TF_TAX_TAXABLE_AMOUNT" . $index1), $this->m_BusTaxCapital);
             }
             $index2 = $clsTaxFormula->getParameterTagValueIndex("[LAST_GROSS]");
             if ($index2) {
                 $this->setData(constant("TF_TAX_TAXABLE_AMOUNT" . $index2), $this->m_BusTaxLastGross);
             }
             $this->debug("FORMULA {$index1}=" . $this->m_BusTaxCapital . ",{$index2}=" . $this->m_BusTaxLastGross . "<BR>");
             // compute
             $tax_amount = $clsTaxFormula->computeTax($this->m_BusTaxCapital, $this->m_BusTaxLastGross);
             if ($tax_amount >= 0) {
                 $this->data_elems[TF_TAX_TOTAL_AMOUNT_DUE] = $tax_amount;
                 $this->debug("FORMULA compuation OK<BR>");
                 return 1;
             } else {
                 $this->setError(-1, $clsTaxFormula->getError());
                 return $tax_amount;
             }
         } else {
             $this->setError(-5, "Unable to load formula of tax/fee " . $this->getData(TF_TAX_FEE_CODE) . "!");
             $this->debug("Unable to load formula of tax/fee " . $this->getData(TF_TAX_FEE_CODE) . "!");
             return -5;
         }
     } else {
         $this->data_elems[TF_TAX_TOTAL_AMOUNT_DUE] = 0;
         $this->debug("FORMULA ERROR (cant find tax/fee code : " . $this->getData(TF_TAX_FEE_CODE) . "<BR>");
         return -4;
     }
 }