echo getURI(eBPLS_PAGE_CTC_INPUT); ?> "> <!---// start of the table //--> <table border=0 cellspacing=0 cellpadding=0 width='520'> <tr><td align="center" valign="center" class='titleblue'> Community Tax Certificate Application</td></tr> <tr><td align="center" valign="center" class='normal' height=10> </td></tr> <?php // create will validate values set if ok if ($clsCTC->create() < 0) { print_r($clsCTC->getError()); echo '<tr><td align="center" valign="center" class="normal" height=10><hr>ERROR ON CREATE. PLEASE CHECK VALUES<hr></td></tr>'; } else { //--- get the data $ctcData = null; $ctcData = $clsCTC->getData(); if (!strcasecmp($comm_tax_cert_type, 'individual')) { ?> <!---// start of displaying the individual CTC //--> <tr> <td align="center" valign="center" class='title'> <!-- start of CTC formating //--> <table border=0 cellspacing=0 cellpadding=0 width='520'> <tr> <td align="center" valign="top" width=520> <table border=0 cellspacing=1 cellpadding=0 width=520 bgcolor='#202366'> <tr> <td align="center" valign="center" bgcolor='#ffffff' width=240 class='normaltax' colspan=2>COMMUNITY TAX CERTIFICATE</td> <td align="center" valign="center" bgcolor='#ffffff' width=100 class='normalgray'>INDIVIDUAL</td> <td align="center" valign="center" width=180 height=20 bgcolor='#ffffff' class='normaltax'><?php echo $ctcData['comm_tax_cert_code'];
function newTransaction(&$permit, $creator, $user_level, $action = TRANS_TYPE_NEW) { if ($action != TRANS_TYPE_NEW && $action != TRANS_TYPE_RENEW) { $this->debug("newTransaction Failed, Action value passed {$action} not recognized, actions allowed are TRANS_TYPE_NEW and TRANS_TYPE_RENEW."); $this->setError(-1, "newTransaction Failed, Action value passed {$action} not recognized, actions allowed are TRANS_TYPE_NEW and TRANS_TYPE_RENEW."); return -1; } // NOTE : check if there exist a transaction involving the same NEW/RENEWAL of user/business of the current year // if exist return error // else resume transaction if (is_a($permit, "EBPLSPermit")) { // insert to transaction table $this->data_elems[TRANS_BUSINESS_ID] = 0; $this->data_elems[TRANS_TYPE] = $action; $this->data_elems[TRANS_PAYMENT_STATUS] = TPS_PAYMENT_STATE_UNPAID; $this->m_objPermit = $permit; if (is_a($permit, "EBPLSMotorizedPermit")) { $this->data_elems[TRANS_OWNER_ID] = $permit->getData(MOTORIZED_OWNER_ID); } else { if (is_a($permit, "EBPLSOccupationalPermit")) { $this->data_elems[TRANS_OWNER_ID] = $permit->getData(OCCUPATIONAL_OWNER_ID); } else { if (is_a($permit, "EBPLSPeddlersPermit")) { $this->data_elems[TRANS_OWNER_ID] = $permit->getData(PEDDLERS_OWNER_ID); } else { if (is_a($permit, "EBPLSFranchisePermit")) { $this->data_elems[TRANS_OWNER_ID] = $permit->getData(FRANCHISE_OWNER_ID); } else { if (is_a($permit, "EBPLSFisheryPermit")) { $this->data_elems[TRANS_OWNER_ID] = $permit->getData(FISHERY_OWNER_ID); } else { if (is_a($permit, "EBPLSEnterprisePermit")) { $arrNature = $permit->getLineOfBusiness(); if (!is_array($arrNature) || count($arrNature) == 0) { $this->debug("Business Permit no business nature attached."); $this->setError(-1, "Business Permit no business nature attached."); return -2; } $this->data_elems[TRANS_OWNER_ID] = $permit->getData(BE_OWNER_ID); $this->data_elems[TRANS_BUSINESS_ID] = $permit->getData(BE_BUSINESS_ID); } else { $this->debug("Permit class passed of unknown subclass."); $this->setError(-1, "Permit class passed of uknown subclass."); return -1; } } } } } } ebpls_start_transaction($this->m_dbLink); if ($permit->newApplication($creator, $user_level) <= 0) { $this->debug("Create Permit Failed."); $this->setError(-1, "Create Permit Failed."); ebpls_rollback_transaction($this->m_dbLink); return -1; } $this->debug("PERMIT ID = " . $permit->getPermitNo()); $this->data_elems[TRANS_PERMIT_NO] = $permit->getPermitNo(); $this->data_elems[TRANS_PERMIT_TYPE] = $permit->getPermitType(); // get next transaction code $app_code = get_next_system_code($this->m_dbLink, CODES_APP_COL); $this->data_elems[TRANS_APPLICATION_CODE] = $app_code; $this->data_elems[TRANS_TRANSACTION_DATE] = date("Y-m-d H:i:s"); $this->data_elems[TRANS_APPLICATION_DATE] = date("Y-m-d H:i:s"); $this->data_elems[TRANS_ADMIN_USER] = $creator; $this->data_elems[TRANS_TRANSACTION_STATUS] = TRANS_STATUS_APPLICATION; $this->data_elems[TRANS_APPLICATION_CODE] = $app_code; $strValues = $this->data_elems; $ret = ebpls_insert_data($this->m_dbLink, EBPLS_TRANSACTION_TABLE, $strValues); if ($ret > 0) { // create default application requirements $req_create = create_permit_requirements($this->m_dbLink, $ret, $permit->getPermitNo(), $permit->getPermitType(), $creator, "APP", $action); if ($req_create < 0) { $this->setError(-1, get_db_error()); } // create default fees $fee_create = create_permit_requirements($this->m_dbLink, $ret, $permit->getPermitNo(), $permit->getPermitType(), $creator, "FEE", $action); if ($fee_create < 0) { $this->setError(-1, get_db_error()); } // create default payable taxes $tax_nature_create = create_permit_requirements($this->m_dbLink, $ret, $permit->getPermitNo(), $permit->getPermitType(), $creator, "TAX", $action); if ($tax_nature_create < 0) { $this->setError(-1, get_db_error()); } else { // link ctc to application if CTC is one of the requirements if (is_a($permit, "EBPLSEnterprisePermit")) { $clsCTC = new EBPLSCTC($this->m_dbLink, CTC_TYPE_BUSINESS); $ctcRet = $clsCTC->loadCTC($this->data_elems[TRANS_BUSINESS_ID]); $clsReq = new EBPLSTransactionRequirement($this->m_dbLink); } else { $clsCTC = new EBPLSCTC($this->m_dbLink, CTC_TYPE_INDIVIDUAL); $ctcRet = $clsCTC->loadCTC($this->data_elems[TRANS_OWNER_ID]); $clsReq = new EBPLSTransactionRequirement($this->m_dbLink); } // System config must have a requirement record with key CTC identifying Comm. Tax Certificate $clsReq->setData(TR_REQUIREMENT_CODE, "CTC"); $clsReq->setData(TR_TRANS_ID, $ret); // only update if ctc exist!!! 10/26/2004 9:32PM - stephen if ($ctcRet > 0) { $clsReq->setData(TR_REF_NO, $clsCTC->getData(CTC_CODE)); $clsReq->setData(TR_STATUS, "SUBMITTED"); $clsReq->update(); } } $this->data_elems[TRANS_ID] = $ret; // create default business nature taxes if ($permit->getPermitType() == PERMIT_TYPE_BUSINESS) { $arrNature = $permit->getLineOfBusiness(); for ($i = 0; $i < count($arrNature); $i++) { // naturecode,capital,last_gross,nocommit (let this functio do the commit on db) $fee_nature_create = $this->addLineOfBusiness($arrNature[$i][0], $arrNature[$i][1], $arrNature[$i][2], $creator, false); if ($fee_nature_create < 0) { $this->setError($fee_nature_create, get_db_error()); //print_r($this->getError()); break; } } } else { $fee_nature_create = 1; } // update application system code $ret_app_code = update_system_code($this->m_dbLink, CODES_APP_COL, $app_code); if ($ret_app_code < 0) { $this->setError(-1, "FATAL ERROR : failed to update app code on codes table. [ret_app_code = {$ret_app_code}, req_create = {$req_create}, fee_create= {$fee_create}, fee_nature_create = {$fee_nature_create} ]"); } if ($ret_app_code < 0 || $req_create < 0 || $fee_create < 0 || $fee_nature_create < 0) { $this->debug("FATAL ERROR : failed to create transaction child records. [ret_app_code = {$ret_app_code}, req_create = {$req_create}, fee_create= {$fee_create}, fee_nature_create = {$fee_nature_create} ]"); $call_ret = -1; } else { $this->debug("Create transaction record ok.[trans_id={$ret}]"); $this->data_elems[TRANS_ID] = $ret; $call_ret = 1; } } else { $this->debug("FATAL ERROR : failed to create transaction record."); $this->setError(-1, get_db_error()); $call_ret = -1; } if ($call_ret < 0) { // rollback caused by error return on any of the sql executed above... ebpls_rollback_transaction($this->m_dbLink); return $call_ret; } else { ebpls_commit_transaction($this->m_dbLink); return $call_ret; } } else { $this->debug("Transaction create failed, {$permit} is not an instance of EBPLSPermit class!"); $this->setError(-1, "Transaction create failed, {$permit} is not an instance of EBPLSPermit class!"); return -1; } }
} if ($clsCTC->create() < 0) { echo "CTC ADD ERROR"; $clsCTC->printError(); } else { $HTTP_POST_VARS["ctc_code"] = $clsCTC->getData(CTC_CODE); print_ctc_viewer($HTTP_POST_VARS["ctc_type"], $HTTP_POST_VARS, false); } break; case CTC_CMD_RENEW: $clsCTC = new EBPLSCTC($dbLink, $ctc_type, $debug); if ($clsCTC->load($ctc_code) < 0) { echo "<P><font class=ctc_note_red>Unable to find CTC# {$ctc_code}</font><BR>"; } else { print_ctc_type_form($ctc_type, $cmd); print_ctc_form($ctc_type, $clsCTC->getData()); } break; case CTC_CMD_FIND: print_ctc_type_form($ctc_type, $cmd); if (count($HTTP_POST_VARS)) { print_ctc_search_form($ctc_type, $HTTP_POST_VARS); } else { print_ctc_search_form($ctc_type, $HTTP_GET_VARS); } break; } ?> </td> </tr> <tr><td align="center" valign="center" class='title' height=10></td></tr>
Gender </td> <td align="center" valign="center" class='normalbold' width=50 bgcolor='#c0c0c0'> Civil Status </td> <td align="center" valign="center" class='normalbold' width=50 bgcolor='#c0c0c0'> Certificate Type </td> </tr> <?php if ($total_ctcRecords == 0) { echo '<tr><td align="center" valign="center" class="errmsg" height=10 colspan=9 bgcolor="#ffffff"><hr>NO RECORD FOUND !<hr></td></tr>'; } else { //--- check if renew if ($is_ctc_renew and $code_found > 0) { display_record($clsCTC->getData(), true); } else { $ctc_records = $ctcRecords["result"]; for ($i = 0; $i < count($ctcRecords["result"]); $i++) { display_record($ctc_records[$i]->getData(), $is_ctc_renew); } } } ?> <tr> <td align="center" valign="center" class="normal" height=10 colspan=9 bgcolor='#ffffff'> <img src='images/blank.gif' height=10><br> <input type='BUTTON' name='_BACK' onClick='javascript:history.go(-1)' value='B A C K'> <?php if ($total_ctcRecords > 0) { echo " <input type='SUBMIT' name='_PROCESS' value='{$process_button}'>";