function printBusinessPermit(&$transObj, $additional_info = NULL) { $permit_type = $transObj->getPermitType(); $permit = $transObj->getPermit(); $owner = $transObj->getOwnerInfo(); $clsBus = new EBPLSEnterprise($this->m_dbLink, false); $clsBus->view($transObj->getData(TRANS_BUSINESS_ID)); // header $header_template = $this->m_strTemplatesPath . "bus/header.html"; // footer $footer_template = $this->m_strTemplatesPath . "bus/footer.html"; // body // item 1 -> onwer info $infoPath = $this->m_strTemplatesPath . "bus/business_info.html"; $strContent = constructTemplate($infoPath, $owner->getData()); // item 2 -> business info $strContent = constructTemplate($strContent, $clsBus->getData(), false); // item 3 -> line of business $strLOBTemplatePath = $this->m_strTemplatesPath . "bus/line_of_business_record.html"; $arrLOB = $transObj->getLineOfBusiness(); for ($i = 0; $i < count($arrLOB); $i++) { $arrLOB[$i]->data_elems[TRANS_BUSNATURE_CAPITAL_INVESTMENT] = number_format($arrLOB[$i]->getData(TRANS_BUSNATURE_CAPITAL_INVESTMENT), 2); $arrLOB[$i]->data_elems[TRANS_BUSNATURE_LAST_GROSS] = number_format($arrLOB[$i]->getData(TRANS_BUSNATURE_LAST_GROSS), 2); $tmpRec = constructTemplate($strLOBTemplatePath, $arrLOB[$i]->getData()) . "\n"; $arrLOBRec[] = $tmpRec; } // ctc info // payables taxes/fees $strFeesTemplatePath = $this->m_strTemplatesPath . "bus/fees_record.html"; $arrFees = $transObj->getFeesList(); $total_fees = 0; for ($i = 0; $i < count($arrFees); $i++) { $total_fees += $arrFees[$i]->getData(TF_TAX_TOTAL_AMOUNT_DUE); $arrFees[$i]->data_elems[TF_TAX_TOTAL_AMOUNT_DUE] = number_format($arrFees[$i]->getData(TF_TAX_TOTAL_AMOUNT_DUE), 2); $tmpRec = constructTemplate($strFeesTemplatePath, $arrFees[$i]->getData()) . "\n"; $arrFeesData[] = $tmpRec; } // create template header $strHeader = constructTemplate($header_template, $additional_info); // create template footer $strFooter = constructTemplate($footer_template, $additional_info); $strContent = str_replace("[REPORTS_HEADER]", $strHeader, $strContent); $strContent = str_replace("[REPORTS_FOOTER]", $strFooter, $strContent); $strContent = str_replace("[RECORDS_LOB]", join("\n", $arrLOBRec), $strContent); $strContent = str_replace("[RECORDS_FEES]", join("\n", $arrFeesData), $strContent); $strContent = str_replace("[TOTAL_FEES]", number_format($total_fees, 2), $strContent); echo $strContent; }
/** * Adds new occ permit application, creates an instance of EBPLSTransaction class, accessible using getTransaction of EBPLSPermit class. * Instance of EBPLSTransaction class identifies the Permit application status and requirements status in the system. * */ function newApplication($creator, $user_level) { if ($this->m_dbLink) { $clsOwner = new EBPLSOwner($this->m_dbLink); unset($this->data_elems[BE_BUSINESS_PERMIT_ID]); $owner_id = $this->data_elems[BE_OWNER_ID]; if ($clsOwner->view($owner_id) <= 0) { $this->debug("Onwer with owner id {$owner_id} not found."); return -1; } // check business id $bus_id = $this->data_elems[BE_BUSINESS_ID]; $clsEnterprise = new EBPLSEnterprise($this->m_dbLink); $ret = $clsEnterprise->view($bus_id); if ($ret < 0) { $this->debug("Business with bus id {$bus_id} not found."); return -1; } $owner_id = $this->data_elems[BE_OWNER_ID]; if ($clsOwner->view($owner_id) <= 0) { $this->debug("Onwer with owner id {$owner_id} not found."); return -1; } $this->setOwner($clsOwner); if (($error_num = $this->validateData()) > 0) { // create reg ts $ts = time(); $nYear = date("Y", $ts); $dt = date("Y-m-d H:i:s", $ts); $this->data_elems[BE_APPLICATION_DATE] = $dt; $this->data_elems[BE_FOR_YEAR] = $nYear; $this->setPermitRegistrationDates($dt, $dt, $nYear); $strValues = $this->data_elems; // create permit $ret = ebpls_insert_data($this->m_dbLink, EBPLS_BUSINESS_PERMIT_TABLE, $strValues); if ($ret < 0) { $this->debug("CREATE BUS PERMIT FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); } else { $this->debug("CREAT BUS OK {$ret}"); $this->data_elems[BE_BUSINESS_PERMIT_ID] = $ret; $this->m_strPermitNo = $ret; $this->m_strPermitType = PERMIT_TYPE_BUSINESS; } return $ret; } else { $this->debug("CREATE BUS PERMIT FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE BUS FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
/** * * **/ function update($bus_id, $admin, $user_level) { $bus_id = $bus_id == NULL ? $this->getData(BUSINESS_ID) : $bus_id; $this->data_elems[BUSINESS_ID] = $bus_id; if (!is_numeric($bus_id) || $bus_id == NULL || $bus_id == "" || $bus_id <= 0) { $this->debug("Update failed, invalid business id value = {$bus_id}."); return -2; } $clsTmp = new EBPLSEnterprise($this->m_dbLink, $this->m_bDebug); if ($clsTmp->view($bus_id) < 0) { $this->debug("Update failed, business with id '{$bus_id}' not found."); return -1; } if ($this->m_arrBusinessNatureDelete != NULL) { $this->debug("UPDATE BUS ENTERPRISE DELETE Nature"); for ($i = 0; $i < count($this->m_arrBusinessNatureDelete); $i++) { $clsENature = new EBPLSEnterpriseNature($this->m_dbLink, $this, $this->m_bDebug); $clsENature->setData(NATURE_BUSINESS_NATURE_CODE, $this->m_arrBusinessNatureDelete[$i]); $clsENature->delete(); } } else { $this->debug("UPDATE BUS ENTERPRISE DELETE Nature NOT EXECUTED"); } if ($this->m_arrBusinessNatureUpdate != NULL) { $this->debug("UPDATE BUS ENTERPRISE UPDATE Nature"); for ($i = 0; $i < count($this->m_arrBusinessNatureUpdate); $i++) { $clsENature = $this->m_arrBusinessNatureUpdate[$i]; $clsENature->update(); } } else { $this->debug("UPDATE BUS ENTERPRISE UPDATE Nature NOT EXECUTED"); } if ($this->m_arrBusinessNatureAdd != NULL) { $this->debug("UPDATE BUS ENTERPRISE ADD Nature"); for ($i = 0; $i < count($this->m_arrBusinessNatureAdd); $i++) { $clsNature = $this->m_arrBusinessNatureAdd[$i]; $clsNature->setData(NATURE_BUSINESS_ID, $bus_id); $clsNature->add($admin); } } else { $this->debug("UPDATE BUS ENTERPRISE ADD Nature NOT EXECUTED"); } // exclude those not changed $arrData = $this->getData(); foreach ($arrData as $key => $value) { if ($arrData[$key] != NULL) { // remove keys using index number, bug on view method on this class if (!is_numeric($key)) { $strValues[$key] = $value; } } } if (($error_num = $this->validateData(true)) > 0) { $strWhere[BUSINESS_ID] = $bus_id; $ret = ebpls_update_data($this->m_dbLink, EBPLS_BUSINESS_TABLE, $strValues, $strWhere); if ($ret < 0) { $this->setError($ret, get_db_error()); $this->debug("UPDATE BUS ENTERPRISE FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $ret; } else { $this->debug("UPDATE BUSINESS ENTERPRISE SUCCESSFULL [{$ret}]"); return $ret; } } else { $this->debug("UPDATE BUSINESS ENTERPRISE FAILED [error:{$ret},msg=" . get_db_error() . "]"); return -1; } }
$HTTP_POST_VARS["ctc_middle_name"] = $clsOwner->getData(OWNER_MIDDLE_NAME); $HTTP_POST_VARS["ctc_last_name"] = $clsOwner->getData(OWNER_LAST_NAME); $HTTP_POST_VARS["ctc_tin_no"] = $clsOwner->getData(OWNER_TIN_NO); $HTTP_POST_VARS["ctc_birth_date"] = $clsOwner->getData(OWNER_BIRTH_DATE); $HTTP_POST_VARS["ctc_civil_status"] = strtoupper($clsOwner->getData(OWNER_CIVIL_STATUS)); $HTTP_POST_VARS["ctc_citizenship"] = $clsOwner->getData(OWNER_CITIZENSHIP); $HTTP_POST_VARS["ctc_gender"] = $clsOwner->getData(OWNER_GENDER); $HTTP_POST_VARS["ctc_address"] = $clsOwner->getData(OWNER_HOUSE_NO) . " " . $clsOwner->getData(OWNER_STREET); //$HTTP_POST_VARS["ctc_icr_no"] = $clsOwner->getData(OWNER_ICR_NO); $HTTP_POST_VARS["ctc_owner_id"] = $clsOwner->getData(OWNER_ID); $ctc_type = "INDIVIDUAL"; if (intval($ctc_business_id)) { $ctc_type = "BUSINESS"; // load business enterprise info $clsBus = new EBPLSEnterprise($dbLink); $clsBus->view($ctc_business_id); $HTTP_POST_VARS["ctc_company"] = $clsBus->getData(BUSINESS_NAME); $HTTP_POST_VARS["ctc_tin_no"] = $clsBus->getData(BUSINESS_TIN_REG_NO); $HTTP_POST_VARS["ctc_place_of_incorporation"] = $clsBus->getData(BUSINESS_TIN_REG_NO); $HTTP_POST_VARS["ctc_company_address "] = $clsBus->getData(BUSINESS_LOT_NO) . " " . $clsBus->getData(BUSINESS_STREET); $HTTP_POST_VARS["ctc_place_issued"] = $clsBus->getData(BUSINESS_TIN_REG_NO); $HTTP_POST_VARS["ctc_date_issued"] = $clsBus->getData(BUSINESS_DATE_ESTABLISHED); $HTTP_POST_VARS["ctc_business_id"] = $clsBus->getData(BUSINESS_ID); } } } ?> <div align="CENTER"> <!---// start of the table //--> <table border=0 cellspacing=0 cellpadding=0 width='100%'> <tr><td align="center" valign="center" class='header'>Community Tax Certificate </td></tr>
$permit_no = trim($permit_no); $owner_id = trim($owner_id); $method_of_application = trim($method_of_application); $is_new = true; //--- check first the method method_of_application NEW $submit_button_name = 'S U B M I T'; if (!strcasecmp($child_reload, 'reload')) { //log_err("refresh"); //--- get the owner $clsOwner = new EBPLSOwner($dbLink, $debug); $clsOwner->view(trim($child_reload_owner_id)); $owner_datarow = $clsOwner->getData(); //--- get the business name if (strlen(trim($child_reload_permit_no)) > 0) { $clsEnterprise = new EBPLSEnterprise($dbLink, $debug); $permit_id = $clsEnterprise->view(trim($child_reload_permit_no)); $datarow = $clsEnterprise->getData(); //--- get the business_nature_list $business_nature_list = $clsEnterprise->getBusinessNatureList($datarow[BUSINESS_ID]); } } //--- chk the sublevels /*if( ! is_valid_sublevels(27) or ! is_valid_sublevels(28) ) { setUrlRedirect('index.php?part=999'); } */ ?> <link rel="stylesheet" href="stylesheets/default.css" type="text/css"/> <script language='Javascript' src='javascripts/default.js'></script>