예제 #1
0
파일: ebpls104.php 프로젝트: laiello/ebpls
$comm_tax_cert_acct_code = trim($comm_tax_cert_acct_code);
$comm_tax_cert_place_issued = trim($comm_tax_cert_place_issued);
$comm_tax_cert_type = trim($comm_tax_cert_type);
$comm_tax_cert_tin_no = trim($comm_tax_cert_tin_no);
$comm_tax_cert_place_of_birth = trim($comm_tax_cert_place_of_birth);
$comm_tax_cert_height = trim($comm_tax_cert_height);
$comm_tax_cert_weight = trim($comm_tax_cert_weight);
$comm_tax_cert_citizenship = trim($comm_tax_cert_citizenship);
$comm_tax_cert_occupation = trim($comm_tax_cert_occupation);
$comm_tax_cert_icr_no = trim($comm_tax_cert_icr_no);
//--- calculate the tax
$sub_total = number_format($comm_tax_cert_last_gross * CTC_PERCENTAGE + (!strcasecmp($comm_tax_cert_type, 'individual') ? CTC_INDIVIDUAL_CONST_AMT : CTC_BUSINESS_CONST_AMT), 2, '.', '');
$comm_tax_cert_amount_due = $sub_total;
$comm_tax_cert_amount_paid = $sub_total;
// insert ctc
$clsCTC = new EBPLSCTC($dbLink, $debug);
$clsCTC->setData(COMM_TAX_CERT_OWNER_FIRST_NAME, $comm_tax_cert_owner_first_name);
$clsCTC->setData(COMM_TAX_CERT_OWNER_MIDDLE_NAME, $comm_tax_cert_owner_middle_name);
$clsCTC->setData(COMM_TAX_CERT_OWNER_LAST_NAME, $comm_tax_cert_owner_last_name);
$clsCTC->setData(COMM_TAX_CERT_OWNER_BIRTH_DATE, $comm_tax_cert_owner_birth_date);
$clsCTC->setData(COMM_TAX_CERT_OWNER_ADDRESS, $comm_tax_cert_owner_address);
$clsCTC->setData(COMM_TAX_CERT_OWNER_GENDER, $comm_tax_cert_owner_gender);
$clsCTC->setData(COMM_TAX_CERT_OWNER_CIVIL_STATUS, $comm_tax_cert_owner_civil_status);
$clsCTC->setData(COMM_TAX_CERT_LAST_GROSS, $comm_tax_cert_last_gross);
$clsCTC->setData(COMM_TAX_CERT_AMOUNT_DUE, $comm_tax_cert_amount_due);
$clsCTC->setData(COMM_TAX_CERT_AMOUNT_PAID, $comm_tax_cert_amount_paid);
$clsCTC->setData(COMM_TAX_CERT_ACCT_CODE, $comm_tax_cert_acct_code);
$clsCTC->setData(COMM_TAX_CERT_PLACE_ISSUED, $comm_tax_cert_place_issued);
$clsCTC->setData(COMM_TAX_CERT_TYPE, $comm_tax_cert_type);
$clsCTC->setData(COMM_TAX_CERT_OWNER_TINNO, $comm_tax_cert_tin_no);
$clsCTC->setData(COMM_TAX_CERT_OWNER_PLACE_OF_BIRTH, $comm_tax_cert_place_of_birth);
예제 #2
0
파일: ebpls106.php 프로젝트: laiello/ebpls
<?php

//	@eBPLS_PAGE_CTC_PROCESS : ctc process page
//	-  will process the ctc from the criteria passed
require_once "ebpls-php-lib/ebpls.ctc.class.php";
require_once "lib/ebpls.lib.php";
require_once "lib/ebpls.utils.php";
define('CTC_INDIVIDUAL_CONST_AMT', 5.0);
define('CTC_BUSINESS_CONST_AMT', 500.0);
define('CTC_PERCENTAGE', 0.001);
//--- get connection from DB
$dbLink = get_db_connection();
global $ThUserData;
$debug = false;
$clsCTC = new EBPLSCTC($dbLink, $ctcDebug);
//--- search for renewal
$clsCTC->load(trim($comm_tax_cert_code));
$ctcData = $clsCTC->getData();
?>
<link rel="stylesheet" href="stylesheets/default.css" type="text/css"/>
<script language='Javascript' src='javascripts/default.js'></script>
<div align="CENTER">
<!-- 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'>BUSINESS</td>
						<td align="center" valign="center" width=180 height=20  bgcolor='#ffffff' class='normaltax'><?php 
예제 #3
0
파일: ebpls103.php 프로젝트: laiello/ebpls
//	@eBPLS_PAGE_CTC_INPUT : ctc input page
//	-  will process the ctc from the criteria passed
require_once "ebpls-php-lib/ebpls.ctc.class.php";
require_once "lib/ebpls.lib.php";
require_once "lib/ebpls.utils.php";
define('CTC_PLACE_ISSSUED', "Pateros, Metro Manila");
define('CTC_INDIVIDUAL_CONST_AMT', 5);
define('CTC_BUSINESS_CONST_AMT', 500);
//--- get connection from DB
$dbLink = get_db_connection();
//--- check first the method method_of_application NEW/RENEW
$is_ctc_renew = false;
$ctcDebug = false;
$is_ctc_renew = true;
$clsCTC = new EBPLSCTC($dbLink, $ctcDebug);
if (!strcasecmp($method_of_application, 'renew')) {
    //--- search for renewal
    $code_found = $clsCTC->load(trim($comm_tax_cert_code));
    $ctcData = $clsCTC->getData();
} else {
    //--- set to default
    $ctcData['comm_tax_cert_place_issued'] = CTC_PLACE_ISSSUED;
}
?>
<link rel="stylesheet" href="stylesheets/default.css" type="text/css"/>
<script language='Javascript' src='javascripts/default.js'></script>
<div align="CENTER">
<br>
<!---// start of the table //-->
<table border=0 cellspacing=0 cellpadding=0   width='520'>
예제 #4
0
파일: ebpls101.php 프로젝트: laiello/ebpls
function print_ctc_form($type, $form_elem_values)
{
    $dbLink = get_db_connection();
    $is_ctc_renew = false;
    $ctcDebug = false;
    $is_ctc_renew = true;
    $clsCTC = new EBPLSCTC($dbLink, $ctcDebug);
    if ($type == "") {
        $type = CTC_TYPE_INDIVIDUAL;
    }
    //--- make a script that will calculate the tax
    //$ctc_additional_tax1_due=((int)($ctc_addtional_tax1)/1000));
    $tax_a1_fields = array("in" => array("document._FRM.ctc_additional_tax1"), "out" => "document._FRM.ctc_additional_tax1_due");
    $tax_a2_fields = array("in" => array("document._FRM.ctc_additional_tax2"), "out" => "document._FRM.ctc_additional_tax2_due");
    if ($type == CTC_TYPE_INDIVIDUAL) {
        $tax_a3_fields = array("in" => array("document._FRM.ctc_additional_tax3"), "out" => "document._FRM.ctc_additional_tax3_due");
        $basic_tax_field = array("in" => array('document._FRM.ctc_tax_exempted'), "out" => 'document._FRM.ctc_basic_tax');
        $out_total_interest_due = array("in" => array("x1" => 'document._FRM.current_month', "x2" => 'document._FRM.ctc_total_amount_due'), "out" => 'document._FRM.ctc_total_interest_due');
        $out_total_amount_due = array("in" => array("x1" => 'document._FRM.ctc_basic_tax', "x2" => 'document._FRM.ctc_additional_tax1_due', "x3" => 'document._FRM.ctc_additional_tax2_due', "x4" => 'document._FRM.ctc_additional_tax3_due'), "out" => 'document._FRM.ctc_total_amount_due');
        $out_total_paid_due = array("in" => array("x1" => 'document._FRM.ctc_total_amount_due', "x2" => 'document._FRM.ctc_total_interest_due'), "out" => 'document._FRM.ctc_total_paid');
    } else {
        $basic_tax_field = array("in" => NULL, "out" => 'document._FRM.ctc_basic_tax');
        $out_total_interest_due = array("in" => array("x1" => 'document._FRM.current_month', "x2" => 'document._FRM.ctc_total_amount_due'), "out" => 'document._FRM.ctc_total_interest_due');
        $out_total_amount_due = array("in" => array("x1" => 'document._FRM.ctc_basic_tax', "x2" => 'document._FRM.ctc_additional_tax1_due', "x3" => 'document._FRM.ctc_additional_tax2_due'), "out" => 'document._FRM.ctc_total_amount_due');
        $out_total_paid_due = array("in" => array("x1" => 'document._FRM.ctc_total_amount_due', "x2" => 'document._FRM.ctc_total_interest_due'), "out" => 'document._FRM.ctc_total_paid');
    }
    ?>
<P><BR>
<script language=Javascript>

function checkCitizenship() {

	if ( document._FRM.ctc_citizenship.selectedIndex > 1 ) {

		document._FRM.ctc_icr_no.disabled = false;

	} else {

		document._FRM.ctc_icr_no.disabled = true;
		document._FRM.ctc_icr_no.value = '';

	}

}

//--- start CTC application page scripts
function validate_ctc_form_application()
{

		var _FRM = document._FRM
		var msgTitle = "Community Tax Certificate Application\n";

		if ( _FRM.ctc_type.value == 'INDIVIDUAL' ) {


				if( isBlank(_FRM.ctc_last_name.value) == true)
				{
					alert( msgTitle + "Please input a valid lastname!");
					_FRM.ctc_last_name.focus();
					return false;
				}


				if( isBlank(_FRM.ctc_first_name.value) == true)
				{
					alert( msgTitle + "Please input a valid firstname!");
					_FRM.ctc_first_name.focus();
					return false;
				}

				if( isBlank(_FRM.ctc_middle_name.value) == true)
				{
					alert( msgTitle + "Please input a valid middlename!");
					_FRM.ctc_middle_name.focus();
					return false;
				}

				if( isBlank(_FRM.ctc_address.value) == true)
				{
					alert( msgTitle + "Please input a valid address!");
					_FRM.ctc_address.focus();
					return false;
				}

				if( _FRM.ctc_gender.selectedIndex == 0 )
				{
					alert( msgTitle + "Please input a valid gender!");
					_FRM.ctc_gender.focus();
					return false;
				}

				if( _FRM.ctc_citizenship.selectedIndex == 0 )
				{
					alert( msgTitle + "Please input a valid citizenship!");
					_FRM.ctc_citizenship.focus();
					return false;
				}

				if( _FRM.ctc_citizenship.item(_FRM.ctc_citizenship.selectedIndex).value != 'FILIPINO' && _FRM.ctc_icr_no.value == '' )
				{
					alert( msgTitle + "Please input a valid ICR No.!");
					_FRM.ctc_icr_no.focus();
					return false;
				}

				if( isBlank(_FRM.ctc_place_of_birth.value) == true)
				{
					alert( msgTitle + "Please input a valid place of birth!");
					_FRM.ctc_place_of_birth.focus();
					return false;
				}

				if( _FRM.ctc_civil_status.selectedIndex == 0 )
				{
					alert( msgTitle + "Please input a valid Civil Status!");
					_FRM.ctc_civil_status.focus();
					return false;
				}

				if( _FRM.ctc_birth_date.value == '' )
				{
					alert( msgTitle + "Please input a valid birthdate!");
					_FRM.ctc_birth_date_month.focus();
					return false;
				}

				//alert(_FRM.ctc_birth_date.value);

				if(  isBlank(_FRM.ctc_additional_tax1.value) == true && isBlank(_FRM.ctc_additional_tax2.value) == true && isBlank(_FRM.ctc_additional_tax3.value) == true )
				{
					alert( msgTitle + "Please input a valid last gross!");
					_FRM.ctc_additional_tax1.focus();
					return false;
				}

				if(  !isDigit(_FRM.ctc_additional_tax1.value) || !isDigit(_FRM.ctc_additional_tax2.value) && !isDigit(_FRM.ctc_additional_tax3.value) )
				{
					alert( msgTitle + "Please input a valid last gross!");
					_FRM.ctc_additional_tax1.focus();
					return false;
				}

				/*
				if(  !parseInt(_FRM.ctc_additional_tax1.value) && !parseInt(_FRM.ctc_additional_tax2.value) && !parseInt(_FRM.ctc_additional_tax3.value) )
				{
					alert( msgTitle + "Please input a valid last gross!");
					_FRM.ctc_additional_tax1.focus();
					return false;
				}
				*/

				if ( isBlank(_FRM.ctc_additional_tax1.value) ) {
					_FRM.ctc_additional_tax1.value = 0.0;
				}

				if ( isBlank(_FRM.ctc_additional_tax2.value) ) {
					_FRM.ctc_additional_tax2.value = 0.0;
				}

				if ( isBlank(_FRM.ctc_additional_tax3.value) ) {
					_FRM.ctc_additional_tax3.value = 0.0;
				}


		} else if ( _FRM.ctc_type.value = 'BUSINESS' ) {

			if( isBlank(_FRM.ctc_company.value) == true)
			{
				alert( msgTitle + "Please input a valid Company name!");
				_FRM.ctc_company.focus();
				return false;
			}

			if( isBlank(_FRM.ctc_tin_no.value) == true)
			{
				alert( msgTitle + "Please input a valid Company Tin No.!");
				_FRM.ctc_tin_no.focus();
				return false;
			}

			if( isBlank(_FRM.ctc_company_address.value) == true)
			{
				alert( msgTitle + "Please input a valid Company Addres!");
				_FRM.ctc_company_address.focus();
				return false;
			}


			if( _FRM.ctc_organization_type.selectedIndex == 0 )
			{
				alert( msgTitle + "Please input a valid Oraganization Type!");
				_FRM.ctc_organization_type.focus();
				return false;
			}

			if( _FRM.ctc_place_of_incorporation.value == '' )
			{
				alert( msgTitle + "Please input a valid place Of incorporation!");
				_FRM.ctc_place_of_incorporation.focus();
				return false;
			}

			if( _FRM.ctc_incorporation_date.value == '' )
			{
				alert( msgTitle + "Please input a valid Incorporation Date!");
				_FRM.ctc_incorporation_date_month.focus();
				return false;
			}

			if( isBlank(_FRM.ctc_business_nature.value) == true)
			{
				alert( msgTitle + "Please input a valid Business nature!");
				_FRM.ctc_business_nature.focus();
				return false;
			}

			if(  isBlank(_FRM.ctc_additional_tax1.value) == true && isBlank(_FRM.ctc_additional_tax2.value) == true )
			{
				alert( msgTitle + "Please input a valid last gross!");
				_FRM.ctc_additional_tax1.focus();
				return false;
			}

			// check if nonzero
			/*
			if(  !parseInt(_FRM.ctc_additional_tax1.value) && !parseInt(_FRM.ctc_additional_tax2.value) )
			{
				alert( msgTitle + "Please input a valid last gross!");
				_FRM.ctc_additional_tax1.focus();
				return false;
			}
			*/

			// check if a digit
			if(  !isDigit(_FRM.ctc_additional_tax1.value) || !isDigit(_FRM.ctc_additional_tax2.value) )
			{
				alert( msgTitle + "Please input a valid last gross!");
				_FRM.ctc_additional_tax1.focus();
				return false;
			}

			if ( isBlank(_FRM.ctc_additional_tax1.value) ) {
				_FRM.ctc_additional_tax1.value = 0.0;
			}

			if ( isBlank(_FRM.ctc_additional_tax2.value) ) {
				_FRM.ctc_additional_tax2.value = 0.0;
			}

		} else {

			alert('System Error : Invalid CTC Type ' + _FRM.ctc_type.value );

		}

	return true;
}



</script>

<form name="_FRM" method="POST" action="index.php?part=4&itemID_=101&class_type=CTC&busItem=CTC"  onSubmit="return validate_ctc_form_application();">
<!--<form name="_FRM" method="POST" action="<?php 
    echo getURI(eBPLS_PAGE_CTC_CRITERIA);
    ?>
"  onSubmit="return validate_ctc_form_application();">-->
<input type=hidden name="ctc_type" value="<?php 
    echo $ctc_type;
    ?>
">
<input type=hidden name="ctc_place_issued" value="<?php 
    echo get_ctc_place_issued();
    ?>
">
<input type=hidden name="cmd" value="<?php 
    echo CTC_CMD_PROCESS;
    ?>
">
<input type=hidden name="current_month" value="<?php 
    echo date("m");
    ?>
">
<?php 
    if ($type == CTC_TYPE_INDIVIDUAL) {
        echo "<input type=hidden name=\"ctc_owner_id\" value=\"" . $form_elem_values["ctc_owner_id"] . "\">";
        process_form_template("templates/form_ctc_individual_application.html", $form_elem_values);
    } else {
        echo "<input type=hidden name=\"ctc_business_id\" value=\"" . $form_elem_values["ctc_business_id"] . "\">";
        process_form_template("templates/form_ctc_business_application.html", $form_elem_values);
    }
    ?>
<P align=center>
<?php 
    /*
    if ( $type == CTC_TYPE_INDIVIDUAL ) {
    	echo "<input type=button value=\"Search Owner\"  onClick=\"javascript:showSearchForm('OWNER');\">";
    }else{
    	echo "<input type=button value=\"Search Business\" onClick=\"javascript:showSearchForm('BUSINESS');\">";
    }
    */
    ?>
&nbsp;&nbsp;<input type=submit value="Process Payment">&nbsp;&nbsp;<input type=reset value="Clear">
</p>
</form>
<script language="Javascript">

function showSearchForm( val ) {

	if ( val == 'OWNER' ) {

		popwin('owner_search.php','_OWNER_SEARCH');

	} else if ( val == 'BUSINESS' ) {

		popwin('business_search.php','_BUSINESS_SEARCH');

	} else {

		alert('invalid ctc search param');

	}

}

</script>
<?php 
    $clsCTC->printIndividualCTCScript($type, $basic_tax_field, $tax_a1_fields, $tax_a2_fields, $tax_a3_fields, $out_total_amount_due, $out_total_interest_due, $out_total_paid_due);
}
예제 #5
0
 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;
     }
 }
예제 #6
0
파일: ebpls102.php 프로젝트: laiello/ebpls
<?php

//	@eBPLS_PAGE_CTC_INPUT : ctc input page
//	-  will process the ctc from the criteria passed
require_once "ebpls-php-lib/ebpls.ctc.class.php";
require_once "lib/ebpls.lib.php";
require_once "lib/ebpls.utils.php";
//--- get connection from DB
$dbLink = get_db_connection();
$ctcDebug = false;
$clsCTC = new EBPLSCTC($dbLink, $ctcDebug);
$ctcData = null;
$ctcRecords = null;
$code_found = 0;
$total_ctcRecords = 0;
//--- get the passed parameters from the prev pages
$search_by = trim($search_by);
$search_by_what = trim($search_by_what);
$status_of_application = trim($status_of_application);
$method_of_application = trim($method_of_application);
//--- check first the method method_of_application NEW/RENEW
$is_ctc_renew = !strcasecmp($method_of_application, 'renew') ? true : false;
$process_button = !strcasecmp($method_of_application, 'renew') ? 'R E N E W   C T C' : 'N E W   C T C';
//---- its a renew but first query the 10 records
//
//	based on the the search parameter passed
//	either filter it by
//
//		- application status(pending,approved,processed)
//		- search by info(code,firstname,middlename,lastname)
//