/** * 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); $owner_id = $this->data_elems[FRANCHISE_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[FRANCHISE_APPLICATION_DATE] = $dt; $this->data_elems[FRANCHISE_FOR_YEAR] = $nYear; $this->setPermitRegistrationDates($dt, $dt, $nYear); $strValues = $this->data_elems; // create permit $ret = ebpls_insert_data($this->m_dbLink, EBPLS_FRANCHISE_PERMIT_TABLE, $strValues); if ($ret < 0) { $this->debug("CREATE PEDDLERS PERMIT FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); } else { $this->debug("CREAT PEDDLER OK {$ret}"); $this->data_elems[FRANCHISE_PERMIT_ID] = $ret; $this->m_strPermitNo = $ret; $this->m_strPermitType = PERMIT_TYPE_FRANCHISE; } return $ret; } else { $this->debug("CREATE PEDDLERS PERMIT FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE PEDDLERS FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
/** * View owner data, loads data using owner id as param * */ function view($bus_code) { $strValues[$key] = "*"; $strWhere[BE_BUSINESS_PERMIT_ID] = $bus_code; $result = ebpls_select_data($this->m_dbLink, EBPLS_BUSINESS_PERMIT_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { $owner = new EBPLSOwner($this->m_dbLink); $owner->view($result[0][BE_OWNER_ID]); $this->setOwner($owner); $this->data_elems = $result[0]; return 1; } else { $this->setError($result, get_db_error()); return -1; } }
/** * View owner data, loads data using bus id as param * */ function view($bus_id) { $strValues[$key] = "*"; $strWhere[BUSINESS_ID] = $bus_id; $result = ebpls_select_data($this->m_dbLink, EBPLS_BUSINESS_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { $owner = new EBPLSOwner($this->m_dbLink); $owner->view($result[0][BUSINESS_OWNER_ID]); $this->data_elems = $result[0]; $this->m_objOwner = $owner; return 1; } else { if ($result < 0 || $result == "") { $this->setError(-1, "Business with business id {$bus_id} not found"); } else { $this->setError($result, get_db_error()); } return -1; } }
$ctc_owner_id = $owner_id; } if (!isset($ctc_business_id) && !isset($ctc_owner_id) && ($cmd == CTC_CMD_NEW || $cmd == "")) { ?> <script language='Javascript'> window.location='<?php echo getURI(eBPLS_PAGE_CTC_SEARCH); ?> '; </script> <?php } else { if ($cmd == CTC_CMD_NEW && (isset($ctc_business_id) || isset($ctc_owner_id))) { // load onwer info $clsOwner = new EBPLSOwner($dbLink); $clsOwner->view($ctc_owner_id); $HTTP_POST_VARS["ctc_first_name"] = $clsOwner->getData(OWNER_FIRST_NAME); $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
$bus_type = 'BUS'; //--- get the parameters $tx_code = trim($tx_code); $status_of_application = trim($status_of_application); $permit_type = trim($permit_type); $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');
/** * View owner data, loads data using owner id as param * */ function view($mot_code) { $strValues[$key] = "*"; $strWhere[MOTORIZED_OPERATOR_PERMIT_ID] = $mot_code; //echo "<hr>code : $mot_code <hr>"; $result = ebpls_select_data($this->m_dbLink, EBPLS_MOTORIZED_OPERATOR_PERMIT_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { $owner = new EBPLSOwner($this->m_dbLink); //$owner->load( $result[0][MOTORIZED_OPERATOR_PERMIT_ID] ); $owner->view($result[0][MOTORIZED_OWNER_ID]); $this->setOwner($owner); $this->data_elems = $result[0]; return 1; } else { $this->setError($result, get_db_error()); return -1; } }
function getOwnerInfo() { if (!is_numeric($this->getData(TRANS_ID))) { $this->debug("getOwnerInfo Failed, transaction not loaded, load by invoking loadTransaction."); return -1; } if (!is_numeric($this->getData(TRANS_OWNER_ID))) { $this->debug("getOwnerInfo Fatal Failed, onwer id not set."); return -1; } $clsOwnerGet = new EBPLSOwner($this->m_dbLink); $this->debug("GET OWNER INFO ON TRANS : " . $this->getData(TRANS_OWNER_ID)); if ($clsOwnerGet->view($this->getData(TRANS_OWNER_ID)) > 0) { return $clsOwnerGet; } else { $this->debug("getOnwerInfo Failed, cannot load owner record of owner with owner id " . $this->getData(TRANS_OWNER_ID) . "."); return -2; } }