function add($admin) { if ($this->m_dbLink) { $this->data_elems[EBPLS_ACCT_CODE_DATE_REGISTERED] = date("Y-m-d H:i:s"); $this->data_elems[EBPLS_ACCT_CODE_UPDATED] = date("Y-m-d H:i:s"); $this->data_elems[EBPLS_UPDATED_BY] = $admin; if (($error_num = $this->validateData()) > 0) { $strValues = $this->getData(); $ret = ebpls_insert_data($this->m_dbLink, EBPLS_COT_TABLE, $strValues); if ($ret < 0) { $this->debug("CREATE TAX FEE SYSREF FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); return $ret; } else { $this->debug("CREATE TAX FEE SYSREF SUCCESSFULL [{$ret}]"); return $ret; } } else { $this->debug("CREATE TAX FEE SYSREF FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE TAX FEE SYSREF FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
function add($admin) { $this->debug("Formulatype : " . $this->getData(EBPLS_FORMULAS_FORMULA_TYPE)); if ($this->m_dbLink) { $this->data_elems[EBPLS_FORMULAS_CREATE_TS] = date("Y-m-d H:i:s"); $this->data_elems[EBPLS_FORMULAS_UPDATE_TS] = date("Y-m-d H:i:s"); $this->data_elems[EBPLS_FORMULAS_ADMIN] = $admin; $obj = $this; unset($obj->err_code); unset($obj->err_mesg); $this->data_elems[EBPLS_FORMULAS_FORMULA_CLASS] = serialize($obj); if (($error_num = $this->validateData()) > 0) { $strValues = $this->getData(); $ret = ebpls_insert_data($this->m_dbLink, EBPLS_FORMULAS_TABLE, $strValues); if ($ret < 0) { $this->debug("CREATE FORMULA FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); return $ret; } else { $this->debug("FORMULA : " . $this->data_elems[EBPLS_FORMULAS_FORMULA_CLASS]->formula); $this->debug("CREATE FORMULA SYSREF SUCCESSFULL [{$ret}]"); return 1; } } else { $this->debug("CREATE FORMULA FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE FORMULA FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
/** * Adds new Industry Sector to ebls_INDUSTRY_SECTOR table * */ function add() { if ($this->m_dbLink) { if (($error_num = $this->validateData()) > 0) { $strValues = $this->data_elems; $ret = ebpls_insert_data($this->m_dbLink, EBPLS_ZIP_TABLE, $strValues); if ($ret < 0) { //$this->debug( "CREATE OCCUPNACY TYPE FAILED" ); //$this->setError( $ret, get_db_error() ); return $ret; } else { //$this->debug( "CREATE OCCUPNACY TYPE SUCCESSFULL" ); $this->data_elems[ZIP_CODE] = $ret; return $ret; } } else { //$this->debug( "CREATE INDUSTRY FAILED" ); return $error_num; } } else { //$this->debug( "CREATE OWNER FAILED INVALID DB LINK $this->m_dbLink" ); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
function add() { if ($this->validateData() > 0) { $ts = time(); $nYear = date("Y", $ts); $dt = date("Y-m-d H:i:s", $ts); $this->data_elems[TR_TS_SUBMITTED] = $dt; $this->data_elems[TR_TS_UPDATE] = $dt; $this->data_elems[TR_TS_CREATE] = $dt; $strValues = $this->data_elems; $ret = ebpls_insert_data($this->m_dbLink, TR_TABLE, $strValues); if ($ret < 0) { $this->debug("TR ADD ERROR : {$ret}"); $this->setError(-1, get_db_error()); return $ret; } else { $this->debug("TR ADD OK : {$ret}"); return $ret; } } else { $this->debug("TR ADD TRANS REQ FAILED : {$ret}"); $this->setError(-1, "TR ADD TRANS REQ FAILED validate data failed : {$ret}"); return -1; } }
function addTaxFeeList($arr_tax_fee_code) { if (is_array($arr_tax_fee_code)) { foreach ($arr_tax_fee_code as $key => $nature_code) { $strValues[EBPLS_BUSINESS_NATURE_NATURE_CODE] = $nature_code; $strValues[EBPLS_BUSINESS_NATURE_TAXFEES_TAX_FEE_CODE] = $tax_fee_code; $strValues[EBPLS_BUSINESS_NATURE_TAXFEES_CREATE_TS] = date("Y-m-d H:i:S"); $strValues[EBPLS_BUSINESS_NATURE_TAXFEES_ADMIN] = $admin; ebpls_insert_data($this->m_dbLink, EBPLS_BUSINESS_NATURE_TAXFEES_TABLE, $strValues); } } }
function addCheckPayment($trans_id, $check_name, $check_no, $check_amount, $check_date, $admin) { $this->data_elems[TPC_TRANS_ID] = $trans_id; $this->data_elems[TPC_CHECK_NO] = $check_no; $this->data_elems[TPC_CHECK_NAME] = $check_name; $this->data_elems[TPC_CHECK_STATUS] = CHECK_STATUS_PENDING; $this->data_elems[TPC_CHECK_AMOUNT] = $check_amount; $this->data_elems[TPC_CHECK_ISSUE_DATE] = $check_date; $this->data_elems[TPC_TS_CREATE] = date("Y-m-d H:i:s"); $this->data_elems[TPC_ADMIN] = $admin; $this->data_elems[TPC_TS_LAST_UPDATE] = date("Y-m-d H:i:s"); $ret = ebpls_insert_data($this->m_dbLink, TPC_TABLE, $this->data_elems); if ($ret > 0) { $this->data_elems[TPC_CHECK_ID] = $ret; } return $ret; }
/** * 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; } }
function add() { if ($this->m_dbLink) { $this->data_elems[TRANS_BUSNATURE_FOR_YEAR] = date("Y"); $this->data_elems[TRANS_BUSNATURE_TS_CREATE] = date("Y-m-d H:i:s"); $this->data_elems[TRANS_BUSNATURE_TS_UPDATE] = date("Y-m-d H:i:s"); if (($error_num = $this->validateData()) > 0) { $strValues = $this->getData(); $ret = ebpls_insert_data($this->m_dbLink, TRANS_BUSNATURE_TABLE, $strValues); if ($ret < 0) { $this->debug("CREATE EBPLSTransactionBusinessNature FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); return $ret; } else { $this->debug("CREATE EBPLSTransactionBusinessNature SUCCESSFULL [{$ret}]"); return 1; } } else { //print_r($this->getError()); $this->debug("CREATE EBPLSTransactionBusinessNature FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE EBPLSTransactionBusinessNature FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
function add() { if ($this->m_dbLink) { $this->data_elems[EBPLS_MOTORIZED_VEH_CREATE_TS] = date("Y-d-m H:i:s"); $this->data_elems[EBPLS_MOTORIZED_VEH_UPDATED_TS] = date("Y-d-m H:i:s"); if (($error_num = $this->validateData()) > 0) { $strValues = $this->data_elems; $this->debug("DATE : " . $this->data_elems[EBPLS_MOTORIZED_VEH_CREATE_TS]); $ret = ebpls_insert_data($this->m_dbLink, EBPLS_MOTORIZED_VEHICLES_TABLE, $strValues); if ($ret < 0) { $this->debug("CREATE MOTORIZED VEH FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); return $ret; } else { $this->debug("CREATE MOTORIZED VEH SUCCESSFULL [{$ret}]"); $this->data_elems[EBPLS_MOTORIZED_VEH_MOTOR_ID] = $ret; return $ret; } } else { $this->debug("CREATE MOTORIZED VEH FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE MOTORIZED VEH FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
/** * Creats a CTC entry, will automatically validate data set ( data is set using setData( key, value) method ). * */ function create() { if ($this->m_dbLink) { mysql_query("LOCK TABLES", $this->m_dbLink); $this->computeTax(); if (($error_num = $this->validateData()) > 0) { if ($this->m_ctcType == CTC_TYPE_INDIVIDUAL) { $m_strLastCode = get_next_system_code($this->m_dbLink, CODES_CTC_IND_COL); } else { $m_strLastCode = get_next_system_code($this->m_dbLink, CODES_CTC_BUS_COL); } $this->data_elems[CTC_CODE] = $m_strLastCode; $this->data_elems[CTC_DATE_ISSUED] = date("Y-m-d H:i:s"); $this->data_elems[CTC_ACCT_CODE] = "CTC PAYMENT"; $strValues = $this->data_elems; $ret = ebpls_insert_data($this->m_dbLink, $this->m_strTable, $strValues); if ($ret < 0) { $this->debug("CREATE CTC FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->m_arrError["err_code"] = $ret; $this->m_arrError["err_mesg"] = get_db_error(); } else { $this->debug("CREATE CTC SUCCESSFULL [{$m_strLastCode}]"); $this->data_elems[CTC_CODE] = $m_strLastCode; if ($this->m_ctcType == CTC_TYPE_INDIVIDUAL) { $ret_ctc_code = update_system_code($this->m_dbLink, CODES_CTC_IND_COL, $m_strLastCode); } else { $ret_ctc_code = update_system_code($this->m_dbLink, CODES_CTC_BUS_COL, $m_strLastCode); } } } else { $this->debug("CREATE CTC FAILED DUE TO INVALID DATA INPUT"); $ret = $error_num; } mysql_query("UNLOCK TABLES", $this->m_dbLink); return $ret; } else { $this->setError(-1, "CREATE CTC FAILED DUE TO INVALID DB LINK"); $this->debug("CREATE CTC FAILED DUE TO INVALID DB LINK"); return -1; } }
function add($creator) { $dt = date("Y-m-d H:i:s"); $this->data_elems[NATURE_BUSINESS_APPLICATION_STATUS] = "PENDING"; $this->data_elems[NATURE_BUSINESS_APPLICATION_YEAR] = date("Y"); $this->data_elems[NATURE_UPDATED_BY] = $creator; $this->data_elems[NATURE_UPDATED_LAST_TS] = $dt; $this->data_elems[NATURE_CREATE_TS] = $dt; $strValues = $this->data_elems; $ret = ebpls_insert_data($this->m_dbLink, NATURE_BUSINESS_TABLE, $strValues); if ($ret < 0) { $this->setError(-1, "Insert error : " . get_db_error()); $this->debug("Add Business nature failed"); } else { $this->debug("Add Business nature ok. {$creator}"); } return $ret; }
function add() { $dt = date("Y-m-d H:i:s"); $this->data_elems[TPORD_TS] = $dt; $strValues = $this->data_elems; //print_r($strValues); if ($this->validateData() > 0) { $ret = ebpls_insert_data($this->m_dbLink, TPORD_TABLE, $strValues); if ($ret < 0) { $this->debug("TPORD ADD DETAIL ERROR : {$ret}"); return $ret; } else { $this->debug("TPORD ADD DETAIL OK : {$ret}"); $this->data_elems[TPORD_OR_DETAIL_ID] = $ret; return $ret; } } else { $this->debug("TPORD ADD DETAIL FAILED."); $trans_obj->m_arrError = $this->getError(); return -1; } }
function add() { if ($this->m_dbLink) { $this->data_elems[$this->m_strTimeStamp] = date("Y-m-d H:i:s"); if (($error_num = $this->validateData()) > 0) { $strValues = $this->getData(); $ret = ebpls_insert_data($this->m_dbLink, $this->m_strTable, $strValues); if ($ret < 0) { $this->debug("CREATE PDF SYSREF FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); return $ret; } else { //$this->data_elems[EBPLS_PDR_PR_ID] = $ret; $this->debug("CREATE PDF SYSREF SUCCESSFULL [{$ret}]"); return $ret; } } else { $this->debug("CREATE PDF SYSREF FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE PDF SYSREF FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
function addExtra($code, $desc, $tf_code, $user) { if ($this->m_dbLink) { $this->setData($this->m_strCodeKey, $code); $this->setData($this->m_strDescKey, $desc); $this->setData($this->m_strAdminKey, $user); $this->data_elems[$this->m_strCreateKey] = date("Y-m-d H:i:s"); $this->data_elems[$this->m_strUpdateKey] = date("Y-m-d H:i:s"); if ($this->m_strTableKeyConst == EBPLS_BUSINESS_NATURE) { $this->data_elems[SYSREF_NATURE_TAX_FEE_CODE] = $tf_code[0]; $this->data_elems[SYSREF_NATURE_TAX_FEE_CODE2] = $tf_code[1]; } $strValues = $this->getData(); if (($error_num = $this->validateData()) > 0) { $ret = ebpls_insert_data($this->m_dbLink, $this->m_strTableKey, $strValues); if ($ret < 0) { $this->debug("CREATE SYSREF {$this->m_strTableKey} FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); return $ret; } else { $this->debug("CREATE {$this->m_strTableKey} SUCCESSFULL [{$ret}]"); return $ret; } } else { $this->debug("CREATE {$this->m_strTableKey} FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE {$this->m_strTableKey} FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
function add(&$trans_obj, $creator) { if ($this->loadFeeCodeData() < 0) { $trans_obj->setError(-1, "Unable to load fee data with feecode : " . $trans_obj->getData(TRANS_FEE_ID)); return -1; } if ($this->validateData() > 0) { $ts = time(); $dt = date("Y-m-d H:i:s", $ts); $this->data_elems[TF_LAST_UPDATED_TS] = $dt; $this->data_elems[TF_TS_CREATE] = $dt; $this->data_elems[TF_TRANS_ID] = $trans_obj->getData(TRANS_ID); $this->data_elems[TF_PERMIT_TYPE] = $trans_obj->getPermitType(); $this->data_elems[TF_PERMIT_ID] = $trans_obj->getPermitId(); $this->data_elems[TF_LAST_UPDATED_BY] = $creator; if (($computeRet = $this->computeTaxTotalAmounDue()) < 0) { $trans_obj->setError(-1, "computeTaxTotalAmounDue failed with feecode : " . $this->getData(TF_TAX_FEE_CODE) . ", return {$computeRet}!"); return -2; } unset($this->data_elems[TF_TAX_FORMULA]); $strValues = $this->data_elems; $ret = ebpls_insert_data($this->m_dbLink, TF_TABLE, $strValues); if ($ret < 0) { $this->debug("TF ADD ERROR : {$ret}"); $trans_obj->setError($ret, get_db_error()); return $ret; } else { $this->debug("TF ADD OK : {$ret}"); $this->data_elems[TF_FEE_ID] = $ret; return $ret; } } else { $this->debug("TF ADD FEE FAILED."); $trans_obj->m_arrError = $this->getError(); return -1; } }
function _addINTERNAL(&$trans_obj, $group_id, $fee_id, $tax_fee_code, $account_code, $payment_mode, $date_due, $amount_due, $creator) { $this->data_elems[TPS_PAYMENT_DATE] = null; $this->data_elems[TPS_PAYMENT_REMARKS] = "Added " . date("Y-m-d H:i:s") . " by {$creator}.\n"; $this->data_elems[TPS_FEE_ID] = $fee_id; $this->data_elems[TPS_GROUP_ID] = $group_id; $this->data_elems[TPS_PAYMENT_MODE] = $payment_mode; $this->data_elems[TPS_PAYMENT_TAX_FEE_CODE] = $tax_fee_code; $this->data_elems[TPS_PAYMENT_ACCOUNT_CODE] = $account_code; $this->data_elems[TPS_PAYMENT_DUE_DATE] = $date_due; $this->data_elems[TPS_PAYMENT_STATUS] = TPS_PAYMENT_STATE_UNPAID; $this->data_elems[TPS_PAYMENT_TOTAL_AMOUNT_DUE] = $amount_due; $this->data_elems[TPS_TRANS_ID] = $trans_obj->getData(TRANS_ID); $dt = date("Y-m-d H:i:s"); $this->data_elems[TPS_PAYMENT_LAST_UPDATED_BY] = $creator; $this->data_elems[TPS_PAYMENT_LAST_UPDATE_TS] = $dt; if ($this->validateData() > 0) { $strValues = $this->data_elems; //print_r($strValues); $ret = ebpls_insert_data($this->m_dbLink, TPS_TABLE, $strValues); if ($ret < 0) { $this->debug("TPS ADD ERROR : {$ret}"); $trans_obj->setError($ret, get_db_error()); return $ret; } else { $this->debug("TPS ADD OK : {$ret}"); return $ret; } $this->debug("TPS ADD FEE FAILED."); $trans_obj->m_arrError = $this->getError(); return -1; } else { return -1; } }
/** * Adds new owner to ebls_owner table * */ function add() { if ($this->m_dbLink) { if (($error_num = $this->validateData()) > 0) { ebpls_start_transaction($this->m_dbLink); $this->data_elems[OWNER_REG_DATE] = date("Y-d-m H:i:s"); $this->data_elems[OWNER_LASTUPDATED] = date("Y-d-m H:i:s"); $strValues = $this->data_elems; $this->debug("DATE : " . $this->data_elems[OWNER_REG_DATE]); $ret = ebpls_insert_data($this->m_dbLink, EBPLS_OWNER_TABLE, $strValues); if ($ret < 0) { $this->debug("CREATE OWNER FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); ebpls_rollback_transaction($this->m_dbLink); return $ret; } else { $this->debug("CREATE OWNER SUCCESSFULL [{$ret}]"); $this->data_elems[OWNER_ID] = $ret; ebpls_commit_transaction($this->m_dbLink); return $ret; } } else { $this->debug("CREATE OWNER FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE OWNER FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }