function updateLineOfBusiness($nature_code, $capital, $last_gross = 0, $status = "PENDING")
 {
     // check if business type
     if (!isset($this->data_elems[TRANS_ID])) {
         $this->setError(-5, "Transaction not yet loaded, call loadTransaction before calling this function!");
         $this->debug("Transaction not yet loaded, call loadTransaction before calling this function!");
         return -5;
     }
     // check if transaction is business type of permit
     if (!isset($this->data_elems[TRANS_PERMIT_TYPE]) && $this->data_elems[TRANS_PERMIT_TYPE] != PERMIT_TYPE_BUSINESS) {
         $this->setError(-4, "Can't use function for non-business enterprise type of transactions!");
         $this->debug("Can't use function for non-business enterprise type of transactions!");
         return -4;
     }
     if (!($this->getData(TRANS_TRANSACTION_STATUS) == "ASSESSMENT" || $this->getData(TRANS_TRANSACTION_STATUS) == "APPLICATION")) {
         $this->setError(-5, "Can't use function on transactions if status is not assessment or application!");
         $this->debug("Can't use function on transactions if status is not assessment or application!");
         return -6;
     }
     // update transaction payment status with new line of business tax added
     $clsRef = new EBPLSSysRef($this->m_dbLink, EBPLS_BUSINESS_NATURE);
     $result = $clsRef->select($nature_code);
     if (is_array($result) && count($result["result"]) > 0) {
         ebpls_start_transaction($this->m_dbLink);
         // check if LOB exist already on transaction nature list
         // if exist return error else create LOB
         $clsNature = new EBPLSTransactionBusinessNature($this->m_dbLink, false);
         $clsNature->setData(TRANS_BUSNATURE_CAPITAL_INVESTMENT, $capital);
         $clsNature->setData(TRANS_BUSNATURE_LAST_GROSS, $last_gross);
         $clsNature->setData(TRANS_BUSNATURE_STATUS, $status);
         $ret = $clsNature->update($this->data_elems[TRANS_ID], $nature_code);
         if ($ret < 0) {
             $this->setError($ret, "updateLineOfBusiness :  error on creation of business nature record.");
             $this->debug("updateLineOfBusiness : error on creation of business nature record");
             ebpls_rollback_transaction($this->m_dbLink);
         } else {
             // delete line of business to business nature list!!!
             $clsBus = new EBPLSEnterprise($this->m_dbLink);
             $clsBus->updateBusinessNature($nature_code, $capital, $last_gross, $status);
             if ($clsBus->update($this->getData(TRANS_BUSINESS_ID), $admin, $user_level) < 0) {
                 $this->debug("updateLineOfBusiness : error on deleting line of business {$nature_code} on enterprise table.");
                 $this->setError(-5, "updateLineOfBusiness : error on deleting line of business {$nature_code} on enterprise table.");
                 ebpls_rollback_transaction($this->m_dbLink);
                 return $retAddFee;
             }
             $clsTransFee = new EBPLSTransactionFee($this->m_dbLink, false);
             if ($clsTransFee->view($this->data_elems[TRANS_ID], $result["result"][0]->getExtra()) > 0) {
                 $clsLOBTax = new EBPLSTransactionFee($this->m_dbLink, false);
                 $clsLOBTax->setData(TF_TAX_FEE_CODE, $result["result"][0]->getExtra());
                 $clsLOBTax->setData(TF_TAX_BUSINESS_NATURE_CODE, $nature_code);
                 $clsLOBTax->m_BusTaxCapital = $capital;
                 $clsLOBTax->m_BusTaxLastGross = $last_gross;
                 $this->debug("LOB Details " . $result["result"][0]->getCode() . " = " . $result["result"][0]->getDescription() . " : " . $result["result"][0]->getExtra() . "!");
                 $retUpdateFee = $this->updateFee($clsTransFee->getData(TF_FEE_ID), $clsLOBTax, $admin, $user_level);
                 if ($retUpdateFee < 0) {
                     $this->debug("updateLineOfBusiness : error on update line of business fee.");
                     $this->setError(-5, "updateLineOfBusiness : error on updating line of business fee.");
                     ebpls_rollback_transaction($this->m_dbLink);
                     return $retUpdateFee;
                 }
                 // if payment mode is set automatically recompute payment schedule
                 if ($this->isPaymentModeSet()) {
                     $this->setPaymentMode($this->getData(TRANS_PAYMENT_MODE), $this->getData(TRANS_PAYMENT_TAXFEE_DIVIDED), $admin, $user_level);
                 }
                 ebpls_commit_transaction($this->m_dbLink);
             } else {
                 ebpls_rollback_transaction($this->m_dbLink);
             }
         }
     } else {
         $this->setError(-2, "Cant load nature code {$nature_code}!");
         $this->debug("Cant load nature code {$nature_code}!");
         return -2;
     }
     return $ret;
 }