/** * View owner data, loads data using owner id as param * */ function view($owner_id) { $strValues[$key] = "*"; $strWhere[EBPLS_MOTORIZED_OWNER_ID] = $owner_id; $result = ebpls_select_data($this->m_dbLink, EBPLS_MOTORIZED_OPERATOR_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { $this->data_elems = $result[0]; return $result[0][EBPLS_MOTORIZED_OPERATOR_ID]; } else { $this->setError($result, get_db_error()); return -1; } }
/** * Get all permit requirements of a particular type of permit type. * **/ function get_permit_default_requirements($permit_type) { $strWhere[$permit_type] = $permit_type; $strValues[] = " * "; $result = ebpls_select_data($dbLink, "ebpls_permit_requirements", $strValues, $strWhere, NULL, NULL, "DESC", NULL); if (is_array($result)) { for ($i = 0; $i < count($result); $i++) { $record[] = $result[$i]; } return $record; } else { //print_r(get_db_error()); return NULL; } }
/** * 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; } }
function load() { $strValues[$key] = "*"; //$strWhere[BUSINESS_ID] = $this->business_id; $strWhere[NATURE_BUSINESS_NATURE_CODE] = $this->getData(NATURE_BUSINESS_NATURE_CODE); $result = ebpls_select_data($this->m_dbLink, NATURE_BUSINESS_REF_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { $this->data_elems[NATURE_BUSINESS_ID] = $this->business_id; $this->data_elems[NATURE_BUSINESS_NATURE_CODE] = $result[0][NATURE_BUSINESS_NATURE_CODE]; unset($this->data_elems[NATURE_BUSINESS_NATURE_DESC]); return 1; } else { if ($result < 0 || $result == "") { $this->setError(-1, "EBPLSEnterpriseNature with nature code " . $strWhere[NATURE_BUSINESS_NATURE_CODE] . " not found.[{$result}]"); } else { $this->setError($result, get_db_error()); } return -1; } }
function ebpls_select_data_bypage($dbLink, $strTable, $strColumns, $strWhere = NULL, $strGroupBy = NULL, $strOrder = NULL, $strOrderKey = NULL, $nPage = 1, $nMaxRecordPerPage = 20) { if ($nPage <= 0 || $nMaxRecordPerPage <= 0) { set_db_error(NULL, "Invalid page values [pg={$nPage},maxrec={$nMaxRecordPerPage}]"); return ERROR_DB_FUNCS_SELECTFAILED; } // build select sql $sqlArray = ebpls_select_data($dbLink, $strTable, $strColumns, $strWhere, $strGroupBy, $strOrder, $strOrderKey, 1, 1, true); $sqlCount = $sqlArray["count_sql"]; $sqlSelect = $sqlArray["select_sql"]; $res = @mysql_query($sqlCount, $dbLink); // count number of pages if ($res && ($row = mysql_fetch_array($res))) { $nTotalRecords = $row[0]; $nPageCount = floor($row[0] / $nMaxRecordPerPage); if ($row[0] % $nMaxRecordPerPage > 0) { $nPageCount++; } } // get offset using page number if ($nPage == 1) { $pgOffset = 0; } else { $pgOffset = ($nPage - 1) * $nMaxRecordPerPage; } $res = ebpls_select_data($dbLink, $strTable, $strColumns, $strWhere, $strGroupBy, $strOrder, $strOrderKey, $nMaxRecordPerPage, $pgOffset); if ($res < 0) { set_db_error($dbLink); return $res; } else { $page_record["total"] = $nTotalRecords; $page_record["count"] = count($res); $page_record["page"] = $nPage; $page_record["max_pages"] = $nPageCount; $page_record["page_count"] = $nPageCount; return array("result" => $res, "page_info" => $page_record); } }
function delete($owner_id) { $strWhere[OWNER_ID] = $owner_id; $strValues[] = "count(*) as cnt"; // check if owner have existing transactions $result = ebpls_select_data($this->m_dbLink, EBPLS_TRANSACTION_TABLE, $strValues, $strWhere, NULL, NULL, NULL, NULL); if (is_array($result) && $result[0]["cnt"] > 0) { $this->debug("DELETE OWNER FAILED, OWNER HAVE AN EXISTING TRANSACTION"); return -1; } else { if ($result < 0) { $this->debug("DELETE OWNER FAILED [error:{$ret},msg=" . get_db_error() . "]"); return -1; } } $result = ebpls_delete_data($this->m_dbLink, EBPLS_OCC_PERMIT_TABLE, $strWhere); if ($result < 0) { $this->setError($result, get_db_error()); } return $result; }
function view($code) { $strColumns[] = "*"; if ($code) { $strWhere[EBPLS_TAX_FEE_CODE] = $code; } else { $strWhere[EBPLS_TAX_FEE_CODE] = $this->data_elems[EBPLS_TAX_FEE_CODE]; } $ret = ebpls_select_data($this->m_dbLink, EBPLS_TAX_FEE_TABLE, $strColumns, $strWhere); if ($ret < 0) { $this->debug("VIEW EBPLS_TAX_FEE_TABLEFAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); return $ret; } else { $this->debug("VIEW EBPLS_TAX_FEE_TABLE SUCCESSFULL [{$ret}]"); $clsFormula = new TaxFeeFormula($this->m_dbLink, false); $clsFormula->view($ret[0][EBPLS_TAX_FORMULA_ID]); $ret[0][EBPLS_TAX_FORMULA] = unserialize($clsFormula->getData(EBPLS_FORMULAS_FORMULA_CLASS)); if ($ret[0][EBPLS_TAX_FORMULA]) { //print_r($ret[0][EBPLS_TAX_FORMULA]->getData()); $this->setData(NULL, $ret[0]); return $ret; } else { $this->setError(-2, "Invalid formula on unserialize : " . $ret[0][EBPLS_TAX_FORMULA_ID] . "!"); $this->debug("Invalid formula on unserialize : " . $ret[0][EBPLS_TAX_FORMULA_ID] . "!"); return -2; } } }
/** * 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; } }
/** * View owner data, loads data using owner id as param * */ function view($ped_code) { $strValues[$key] = "*"; $strWhere[FRANCHISE_PERMIT_ID] = $ped_code; $result = ebpls_select_data($this->m_dbLink, EBPLS_FRANCHISE_PERMIT_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { $this->m_nOwnerId = $result[0][FRANCHISE_OWNER_ID]; $this->data_elems = $result[0]; return 1; } else { $this->setError($result, get_db_error()); return -1; } }
function getTotalAmountDue($trans_id, $tax_fee_code = NULL, $payment_status = NULL) { $strValues[$key] = " sum(payment_total_amount_due) as t1,sum(payment_amount_paid) as t2,sum(payment_penalty_amount) as p1,sum(payment_penalty_amount_paid) as p2,sum(payment_interest_amount) as i1,sum(payment_interest_amount_paid) as i2 "; $strWhere[TPS_TRANS_ID] = $trans_id; if ($tax_fee_code != NULL) { $strWhere[TPS_PAYMENT_TAX_FEE_CODE] = $tax_fee_code; } if ($payment_status != NULL) { $strWhere[TPS_PAYMENT_STATUS] = $payment_status; } $result = ebpls_select_data($this->m_dbLink, TPS_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { $row = $result[0]; $amount_due = floatval($row["t1"]) - floatval($row["t2"]); $amount_due += floatval($row["p1"]) - floatval($row["p2"]); $amount_due += floatval($row["i1"]) - floatval($row["i2"]); //$this->debug("getTotalAmountDue ok, return $amount_due."); return round($amount_due, 2); } else { $this->setError($result, get_db_error()); return -1; } }
function existOnDefaultRequirements($tax_fee_code) { if (EBPLS_PDR_PR_TYPE_TAX == $this->m_strType) { $strWhere[EBPLS_PTR_TAX_FEE_CODE] = $tax_fee_code; } else { if (EBPLS_PDR_PR_TYPE_FEE == $this->m_strType) { $strWhere[EBPLS_PFR_TAX_FEE_CODE] = $tax_fee_code; } else { return false; } } $strValues[] = "*"; $result = ebpls_select_data($this->m_dbLink, $this->m_strTable, $strValues, $strWhere); if (is_array($result) && count($result) > 0) { return true; } else { return false; } }
function getPaymentList($trans_id) { $strValues[] = "*"; if ($trans_id == NULL) { $strWhere[TPOR_TRANS_ID] = $this->getData(TPOR_TRANS_ID); } else { $strWhere[TPOR_TRANS_ID] = $trans_id; } $records = ebpls_select_data($this->m_dbLink, TPOR_TABLE, $strValues, $strWhere); if (is_array($records)) { for ($i = 0; $i < count($records); $i++) { $clsOR = new EBPLSTransactionPaymentsOR($this->m_dbLink); $clsOR->setData(NULL, $records[$i]); $clsOR->getPaymentDetails($strWhere[TPOR_OR_NO]); $or_records[] = $clsOR; } return $or_records; } else { $this->setError(-1, "Unable to find OR # " . $strWhere[TPOR_OR_NO] . " Record."); return -1; } }
function loadCTC($id) { if ($this->m_ctcType == CTC_TYPE_BUSINESS) { $strWhere[CTC_BUSINESS_ID] = $id; } else { $strWhere[CTC_OWNER_ID] = $id; } $strWhere[CTC_DATE_ISSUED] = array(" like ", date("Y") . "%"); $strValues[] = "*"; $result = ebpls_select_data($this->m_dbLink, $this->m_strTable, $strValues, $strWhere); if (!is_array($result) && $result < 0) { $this->m_arrError["err_code"] = $result; $this->m_arrError["err_mesg"] = get_db_error(); return $result; } else { // transform result to EBPLCTC object $this->setData(NULL, $result[0]); return $result; } }
function computeTransactionTotalTaxFeeDue($trans_id) { $strValues[$key] = "sum(tax_total_amount_due)"; $strWhere[TF_TRANS_ID] = $trans_id; $result = ebpls_select_data($this->m_dbLink, TF_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { return $result[0][0]; } else { $this->setError($result, get_db_error()); return -1; } }
/** * View owner data, loads data using owner id as param * */ function view($fish_id) { $strValues[$key] = "*"; $strWhere[FISHERY_ID] = $fish_id; $result = ebpls_select_data($this->m_dbLink, FISHERY_PERMIT_TABLE, $strValues, $strWhere, NULL, $strOrderBy, "DESC", NULL); if (is_array($result)) { $this->m_nOwnerId = $result[0][FISHERY_OWNER_ID]; $this->data_elems = $result[0]; return 1; } else { $this->setError($result, get_db_error()); return -1; } }
function pagesearch($page = 1, $maxrec = 1000000000, $orderkey = CITY_MUNICIPALITY_CODE, $is_desc = true) { // select all columns $strValues1[] = "*"; $strValues2[] = "count(*)"; if ($orderkey != NULL) { $strOrder[$orderkey] = $orderkey; } else { $strOrder = $orderkey; } //echo $is_desc."Robert"; $result = ebpls_select_data($this->m_dbLink, EBPLS_ZIP_TABLE, $strValues1, $strWhere, NULL, $strOrder, $is_desc, $maxrec, $page); $rowcount = ebpls_select_data($this->m_dbLink, EBPLS_ZIP_TABLE, $strValues2, $strWhere, NULL, $strOrder, $is_desc, NULL, NULL); //$sqlCount = $rowcount["count_sql"]; $this->out = $result; $this->rcount = $rowcount; //echo $rowcount."VooDoo"; }
function view($formula_id) { $strColumns[] = "*"; if ($formula_id) { $strWhere[EBPLS_FORMULAS_FORMULA_ID] = $formula_id; } else { $strWhere[EBPLS_FORMULAS_FORMULA_ID] = $this->data_elems[EBPLS_FORMULAS_FORMULA_ID]; } $ret = ebpls_select_data($this->m_dbLink, EBPLS_FORMULAS_TABLE, $strColumns, $strWhere); if ($ret < 0) { //$this->debug( "VIEW FORMULA [error:$ret,msg=" . get_db_error() . "]" ); $this->setError($ret, get_db_error()); return $ret; } else { //$this->debug( "VIEW FORMULA SUCCESSFULL [$ret]" ); //$this->debug("CLS: " . $ret[0][EBPLS_FORMULAS_FORMULA_CLASS] ); $obj = unserialize($ret[0][EBPLS_FORMULAS_FORMULA_CLASS]); // check if formula is a valid unserializable stored object! if ($obj) { $this->setData(NULL, $ret[0]); return 1; } else { $this->setError(-1, "Error loading formula object!"); $this->debug("Error loading formula object!"); return -1; } } }
function getCheckPaymentList($trans_id, $check_status = NULL) { $strValues[] = "*"; if ($trans_id == NULL) { $strWhere[TPC_TRANS_ID] = $this->getData(TPC_TRANS_ID); } else { $strWhere[TPC_TRANS_ID] = $trans_id; } if ($check_status != NULL) { $strWhere[TPC_CHECK_STATUS] = $check_status; } $records = ebpls_select_data($this->m_dbLink, TPC_TABLE, $strValues, $strWhere); if (is_array($records)) { for ($i = 0; $i < count($records); $i++) { $clsCheck = new EBPLSTransactionPaymentsCheck($this->m_dbLink); $clsCheck->setData(NULL, $records[$i]); $check_records[$i] = $clsCheck; } return $check_records; } else { $this->setError(-1, "Unable to find Check Payment list with trans id # " . $strWhere[TPC_TRANS_ID] . " Record."); return -1; } }
function getList($trans_id, $status = NULL) { $strValues[] = "*"; $strWhere[TRANS_BUSNATURE_TRANS_ID] = $trans_id; if ($status != NULL) { $strWhere[TRANS_BUSNATURE_STATUS] = $status; } $records = ebpls_select_data($this->m_dbLink, TRANS_BUSNATURE_TABLE, $strValues, $strWhere); if (is_array($records) && count($records) > 0) { $this->setError(-1, "EBPLSTransactionBusinessNature found nature code = " . $strWhere[TRANS_BUSNATURE_BUSINESS_NATURE_CODE] . " Record."); for ($i = 0; $i < count($records); $i++) { $clsRec[$i] = new EBPLSTransactionBusinessNature($this->m_dbLink); $clsRec[$i]->setData(NULL, $records[$i]); } return $clsRec; } else { $this->setError(-1, "EBPLSTransactionBusinessNature nature code = " . $strWhere[TRANS_BUSNATURE_BUSINESS_NATURE_CODE] . " Record not found."); return -1; } }