<?php
class CompanyOptions {
	const C_CONTACT 	= "contact";
	const C_CONT_NAME2 	= "name2";
	const C_CONT_ADDR1 	= "address1";
	const C_CONT_ADDR2 	= "address2";
	const C_CONT_ADDR3 	= "address3";
	const C_CONT_ADDR4 	= "address4" ;
	const C_CONT_ADDR5 	= "address5" ;
	const C_CONT_TEL 	= "telno" ;
	const C_CONT_FAX 	= "faxno" ;
	const C_CONT_EMAIL 	= "email";
	const C_CONT_WEB 	= "website";
	
	const C_SETTING 	= "setting" ;
	const C_SET_CPF_NO 	= "cpfno";
	const C_SET_CPF_REF = "cpfref";
	const C_SET_REF_NO 	= "refno";
	const C_SET_BANK 	= "bank";
	const C_SET_BANK_ACCT 	= "bankacctno" ;
    const C_SET_FINANCIAL_MONTH = "financialmonth";
    const C_SET_FINANCIAL_YEAR = "financialyear";
	const C_SET_CODE 		= "code";    
	const C_BASE_CURRENCY = "basecurrency";
	
	const C_IRAS 			= "iras";
	const C_IRAS_NAME 		= "name" ;
	const C_IRAS_DEST 		= "designation" ;
	const C_IRAS_CONTACT 	= "contactno" ;
	const C_IRAS_EGM 		= "egmdate" ;
	const C_IRAS_BONUS 		= "bonusdate" ;
	const C_IRAS_TAX_ID 	= "taxid" ;
	const C_IRAS_ID_TYPE 	= "taxidtype" ;
	
	const C_WORKFLOW	= "workflow";
	const C_STEP 		= "step";
	const C_CLAIM_REJECT_REASON	= "claimrejectreason";
	const C_PRORATION_CLAIM = "prorationclaim";
	const C_PRORATION_MONTH = "prorationmonth";
	const C_CLEARING_ACCOUNT = "clearingaccount";
	const C_ACTIVITY_CODE_PREFIX = "activitycodeprefix";
	const C_ACTIVITY_CODE_LENGTH = "activitycodelength";
	const C_ACTIVITY_CODE_RN = "activitycodern";
	const C_GR_CODE_PREFIX = "grcodeprefix";
	const C_GR_CODE_LENGTH = "grcodelength";
	const C_GR_CODE_RN = "grcodern";
	const C_QUOTATION_CODE_PREFIX = "quotationcodeprefix";
	const C_QUOTATION_CODE_LENGTH = "quotationcodelength";
	const C_QUOTATION_CODE_RN = "quotationcodern";
	const C_SALES_QUOTATION_CODE_PREFIX = "salesquotationcodeprefix";
	const C_SALES_QUOTATION_CODE_LENGTH = "salesquotationcodelength";
	const C_SALES_QUOTATION_CODE_RN = "salesquotationcodern";
	const C_SALES_QUOTATION_INTERNAL_PREFIX = "salesquotationinternalprefix";
	const C_PROFORMA_INVOICE_CODE_PREFIX = "proformainvoicecodeprefix";
	const C_PROFORMA_INVOICE_CODE_LENGTH = "proformainvoicecodelength";
	const C_PROFORMA_INVOICE_CODE_RN = "proformainvoicecodern";
    
	const C_EMAIL_SETTING   		= "emailsetting" ;
	const C_EMAIL_SETTING_SERVER    = "emailsettingserver" ;
	const C_EMAIL_SETTING_PORT      = "emailsettingport" ;
	const C_EMAIL_SETTING_SENDER    = "emailsettingsender" ;
	const C_EMAIL_SETTING_PASSWORD  = "emailsettingpassword" ;
	const C_EMAIL_SETTING_AUTH      = "emailsettingauth" ;
	const C_EMAIL_SETTING_SSL       = "emailsettingssl" ;
    
	const C_BANK_DETAIL   					= "bankdetail" ;
	const C_BANK_DETAIL_CODE  				= "bankdetailcode" ;
	const C_BANK_DETAIL_NAME    			= "bankdetailname" ;
	const C_BANK_DETAIL_ACCOUNT_NAME      	= "bankdetailaccountname" ;
	const C_BANK_DETAIL_ACCOUNT_NUMBER    	= "bankdetailaccountnumber" ;
	const C_BANK_DETAIL_BRANCH_CODE      	= "bankdetailbranchcode" ;
	const C_BANK_DETAIL_SWIFT_CODE       	= "bankdetailswiftcode" ;
	
	private $opt = array() ;
	
	function __construct() {
 		$this->initOptions() ;
	}
	function __destruct() {
	}
	function getOption() {
		return $this->opt ;
	}
	function setOption($value) {
		$this->opt = $value ;
	}
	function loadXml($xml) {

		$xr = simplexml_load_string($xml);
		if ($xr) {
			//contact
			$op = array() ;
			$op[self::C_CONT_NAME2] = (string) $xr->contact->{self::C_CONT_NAME2} ;
			$op[self::C_CONT_ADDR1] = (string) $xr->contact->{self::C_CONT_ADDR1} ;
			$op[self::C_CONT_ADDR2] = (string) $xr->contact->{self::C_CONT_ADDR2} ;
			$op[self::C_CONT_ADDR3] = (string) $xr->contact->{self::C_CONT_ADDR3} ;
			$op[self::C_CONT_ADDR4] = (string) $xr->contact->{self::C_CONT_ADDR4} ;
			$op[self::C_CONT_ADDR5] = (string) $xr->contact->{self::C_CONT_ADDR5} ;
			$op[self::C_CONT_TEL] = (string) $xr->contact->{self::C_CONT_TEL} ;
			$op[self::C_CONT_FAX] = (string) $xr->contact->{self::C_CONT_FAX} ;
			$op[self::C_CONT_EMAIL] = (string) $xr->contact->{self::C_CONT_EMAIL} ;
			$op[self::C_CONT_WEB] = (string) $xr->contact->{self::C_CONT_WEB} ;
			$this->opt[self::C_CONTACT] = $op;
			
			//setting
			$op = array();
			$op[self::C_SET_CPF_NO] = (string) $xr->setting->{self::C_SET_CPF_NO} ;
			$op[self::C_SET_REF_NO] = (string) $xr->setting->{self::C_SET_REF_NO} ;
			$op[self::C_SET_CPF_REF] = (string) $xr->setting->{self::C_SET_CPF_REF} ;
			$op[self::C_SET_BANK] = (string) $xr->setting->{self::C_SET_BANK} ;
			$op[self::C_SET_BANK_ACCT] = (string) $xr->setting->{self::C_SET_BANK_ACCT} ;
			$op[self::C_SET_FINANCIAL_MONTH] = (string) $xr->setting->{self::C_SET_FINANCIAL_MONTH} ;
			$op[self::C_SET_FINANCIAL_YEAR] = (string) $xr->setting->{self::C_SET_FINANCIAL_YEAR} ;
			$op[self::C_SET_CODE] = (string) $xr->setting->{self::C_SET_CODE} ;
			$op[self::C_BASE_CURRENCY] = (string) $xr->setting->{self::C_BASE_CURRENCY} ;
			$this->opt[self::C_SETTING] = $op ;
			
			//iras
			$op = array();
			$op[self::C_IRAS_NAME] = (string) $xr->iras->{self::C_IRAS_NAME} ;
			$op[self::C_IRAS_DEST] = (string) $xr->iras->{self::C_IRAS_DEST} ;
			$op[self::C_IRAS_EGM] = (string) $xr->iras->{self::C_IRAS_EGM} ;
			$op[self::C_IRAS_CONTACT] = (string) $xr->iras->{self::C_IRAS_CONTACT} ;
			$op[self::C_IRAS_BONUS] = (string) $xr->iras->{self::C_IRAS_BONUS} ;
			$op[self::C_IRAS_TAX_ID] = (string) $xr->iras->{self::C_IRAS_TAX_ID} ;
			$op[self::C_IRAS_ID_TYPE] = (string) $xr->iras->{self::C_IRAS_ID_TYPE} ;
			$this->opt[self::C_IRAS] = $op ;
			
			//workflow
			$op = array();
			$op[self::C_STEP] = (string) $xr->workflow->{self::C_STEP} ;
			$op[self::C_CLAIM_REJECT_REASON] = (string) $xr->workflow->{self::C_CLAIM_REJECT_REASON} ;
			$op[self::C_PRORATION_CLAIM] = (string) $xr->workflow->{self::C_PRORATION_CLAIM} ;
			$op[self::C_PRORATION_MONTH] = (string) $xr->workflow->{self::C_PRORATION_MONTH} ;
			$op[self::C_CLEARING_ACCOUNT] = (string) $xr->workflow->{self::C_CLEARING_ACCOUNT} ;
			$op[self::C_ACTIVITY_CODE_PREFIX] = (string) $xr->workflow->{self::C_ACTIVITY_CODE_PREFIX} ;
			$op[self::C_ACTIVITY_CODE_LENGTH] = (string) $xr->workflow->{self::C_ACTIVITY_CODE_LENGTH} ;
			$op[self::C_ACTIVITY_CODE_RN] = (string) $xr->workflow->{self::C_ACTIVITY_CODE_RN} ;
			$op[self::C_GR_CODE_PREFIX] = (string) $xr->workflow->{self::C_GR_CODE_PREFIX} ;
			$op[self::C_GR_CODE_LENGTH] = (string) $xr->workflow->{self::C_GR_CODE_LENGTH} ;
			$op[self::C_GR_CODE_RN] = (string) $xr->workflow->{self::C_GR_CODE_RN} ;
			$op[self::C_QUOTATION_CODE_PREFIX] = (string) $xr->workflow->{self::C_QUOTATION_CODE_PREFIX} ;
			$op[self::C_QUOTATION_CODE_LENGTH] = (string) $xr->workflow->{self::C_QUOTATION_CODE_LENGTH} ;
			$op[self::C_QUOTATION_CODE_RN] = (string) $xr->workflow->{self::C_QUOTATION_CODE_RN} ;
			$op[self::C_SALES_QUOTATION_CODE_PREFIX] = (string) $xr->workflow->{self::C_SALES_QUOTATION_CODE_PREFIX} ;
			$op[self::C_SALES_QUOTATION_CODE_LENGTH] = (string) $xr->workflow->{self::C_SALES_QUOTATION_CODE_LENGTH} ;
			$op[self::C_SALES_QUOTATION_CODE_RN] = (string) $xr->workflow->{self::C_SALES_QUOTATION_CODE_RN} ;
			$op[self::C_SALES_QUOTATION_INTERNAL_PREFIX] = (string) $xr->workflow->{self::C_SALES_QUOTATION_INTERNAL_PREFIX} ;
			$op[self::C_PROFORMA_INVOICE_CODE_PREFIX] = (string) $xr->workflow->{self::C_PROFORMA_INVOICE_CODE_PREFIX} ;
			$op[self::C_PROFORMA_INVOICE_CODE_LENGTH] = (string) $xr->workflow->{self::C_PROFORMA_INVOICE_CODE_LENGTH} ;
			$op[self::C_PROFORMA_INVOICE_CODE_RN] = (string) $xr->workflow->{self::C_PROFORMA_INVOICE_CODE_RN} ;
			$this->opt[self::C_WORKFLOW] = $op ;            
            
			//email setting
			$op = array();
			$op[self::C_EMAIL_SETTING_SERVER] = (string) $xr->emailsetting->{self::C_EMAIL_SETTING_SERVER} ;
			$op[self::C_EMAIL_SETTING_PORT] = (string) $xr->emailsetting->{self::C_EMAIL_SETTING_PORT} ;
			$op[self::C_EMAIL_SETTING_SENDER] = (string) $xr->emailsetting->{self::C_EMAIL_SETTING_SENDER} ;
			$op[self::C_EMAIL_SETTING_PASSWORD] = (string) $xr->emailsetting->{self::C_EMAIL_SETTING_PASSWORD} ;
			$op[self::C_EMAIL_SETTING_AUTH] = (string) $xr->emailsetting->{self::C_EMAIL_SETTING_AUTH} ;
			$op[self::C_EMAIL_SETTING_SSL] = (string) $xr->emailsetting->{self::C_EMAIL_SETTING_SSL} ;
			$this->opt[self::C_EMAIL_SETTING] = $op ;

			//bank detail
			$op = array();
			$op[self::C_BANK_DETAIL_CODE] = (string) $xr->bankdetail->{self::C_BANK_DETAIL_CODE} ;
			$op[self::C_BANK_DETAIL_NAME] = (string) $xr->bankdetail->{self::C_BANK_DETAIL_NAME} ;
			$op[self::C_BANK_DETAIL_ACCOUNT_NAME] = (string) $xr->bankdetail->{self::C_BANK_DETAIL_ACCOUNT_NAME} ;
			$op[self::C_BANK_DETAIL_ACCOUNT_NUMBER] = (string) $xr->bankdetail->{self::C_BANK_DETAIL_ACCOUNT_NUMBER} ;
			$op[self::C_BANK_DETAIL_BRANCH_CODE] = (string) $xr->bankdetail->{self::C_BANK_DETAIL_BRANCH_CODE} ;
			$op[self::C_BANK_DETAIL_SWIFT_CODE] = (string) $xr->bankdetail->{self::C_BANK_DETAIL_SWIFT_CODE} ;
			$this->opt[self::C_BANK_DETAIL] = $op ;
		}
		unset($xr) ;
	}
	function getXml() {
		$xml = '<?xml version="1.0" encoding="utf-8"?>';
		$xml .= '<configuration>' ;
		
		//contact
		$xml .= '<' . self::C_CONTACT . '>';
		$xml .= $this->createXmlElement(self::C_CONT_NAME2,$this->opt[self::C_CONTACT][self::C_CONT_NAME2]) ;
		$xml .= $this->createXmlElement(self::C_CONT_ADDR1,$this->opt[self::C_CONTACT][self::C_CONT_ADDR1]) ;
		$xml .= $this->createXmlElement(self::C_CONT_ADDR2,$this->opt[self::C_CONTACT][self::C_CONT_ADDR2]) ;
		$xml .= $this->createXmlElement(self::C_CONT_ADDR3,$this->opt[self::C_CONTACT][self::C_CONT_ADDR3]) ;
		$xml .= $this->createXmlElement(self::C_CONT_ADDR4,$this->opt[self::C_CONTACT][self::C_CONT_ADDR4]) ;
		$xml .= $this->createXmlElement(self::C_CONT_ADDR5,$this->opt[self::C_CONTACT][self::C_CONT_ADDR5]) ;
		$xml .= $this->createXmlElement(self::C_CONT_TEL,$this->opt[self::C_CONTACT][self::C_CONT_TEL]);
		$xml .= $this->createXmlElement(self::C_CONT_FAX,$this->opt[self::C_CONTACT][self::C_CONT_FAX]);
		$xml .= $this->createXmlElement(self::C_CONT_EMAIL,$this->opt[self::C_CONTACT][self::C_CONT_EMAIL]);
		$xml .= $this->createXmlElement(self::C_CONT_WEB,$this->opt[self::C_CONTACT][self::C_CONT_WEB]);
		$xml .= '</' . self::C_CONTACT . '>';
		
		//setting
		$xml .= '<' . self::C_SETTING . '>';
		$xml .= $this->createXmlElement(self::C_SET_CPF_NO,$this->opt[self::C_SETTING][self::C_SET_CPF_NO]) ;
		$xml .= $this->createXmlElement(self::C_SET_REF_NO,$this->opt[self::C_SETTING][self::C_SET_REF_NO]) ;
		$xml .= $this->createXmlElement(self::C_SET_CPF_REF,$this->opt[self::C_SETTING][self::C_SET_CPF_REF]) ;
		$xml .= $this->createXmlElement(self::C_SET_BANK,$this->opt[self::C_SETTING][self::C_SET_BANK]) ;
		$xml .= $this->createXmlElement(self::C_SET_BANK_ACCT,$this->opt[self::C_SETTING][self::C_SET_BANK_ACCT]) ;
		$xml .= $this->createXmlElement(self::C_SET_FINANCIAL_MONTH,$this->opt[self::C_SETTING][self::C_SET_FINANCIAL_MONTH]) ;
		$xml .= $this->createXmlElement(self::C_SET_FINANCIAL_YEAR,$this->opt[self::C_SETTING][self::C_SET_FINANCIAL_YEAR]) ;
		$xml .= $this->createXmlElement(self::C_SET_CODE,$this->opt[self::C_SETTING][self::C_SET_CODE]) ;
		$xml .= $this->createXmlElement(self::C_BASE_CURRENCY,$this->opt[self::C_SETTING][self::C_BASE_CURRENCY]) ;
		$xml .= '</' . self::C_SETTING . '>';
		
		//iras
		$xml .= '<' . self::C_IRAS . '>';
		$xml .= $this->createXmlElement(self::C_IRAS_NAME,$this->opt[self::C_IRAS][self::C_IRAS_NAME]) ;
		$xml .= $this->createXmlElement(self::C_IRAS_DEST,$this->opt[self::C_IRAS][self::C_IRAS_DEST]) ;
		$xml .= $this->createXmlElement(self::C_IRAS_CONTACT,$this->opt[self::C_IRAS][self::C_IRAS_CONTACT]) ;
		$xml .= $this->createXmlElement(self::C_IRAS_EGM,$this->opt[self::C_IRAS][self::C_IRAS_EGM]) ;
		$xml .= $this->createXmlElement(self::C_IRAS_BONUS,$this->opt[self::C_IRAS][self::C_IRAS_BONUS]) ;
		$xml .= $this->createXmlElement(self::C_IRAS_TAX_ID,$this->opt[self::C_IRAS][self::C_IRAS_TAX_ID]) ;
		$xml .= $this->createXmlElement(self::C_IRAS_ID_TYPE,$this->opt[self::C_IRAS][self::C_IRAS_ID_TYPE]) ;
		$xml .= '</' . self::C_IRAS . '>';
		
		//workflow
		$xml .= '<' . self::C_WORKFLOW . '>';
		$xml .= $this->createXmlElement(self::C_STEP,$this->opt[self::C_WORKFLOW][self::C_STEP]) ;
		$xml .= $this->createXmlElement(self::C_CLAIM_REJECT_REASON,$this->opt[self::C_WORKFLOW][self::C_CLAIM_REJECT_REASON]) ;
		$xml .= $this->createXmlElement(self::C_PRORATION_CLAIM,$this->opt[self::C_WORKFLOW][self::C_PRORATION_CLAIM]) ;
		$xml .= $this->createXmlElement(self::C_PRORATION_MONTH,$this->opt[self::C_WORKFLOW][self::C_PRORATION_MONTH]) ;
		$xml .= $this->createXmlElement(self::C_CLEARING_ACCOUNT,$this->opt[self::C_WORKFLOW][self::C_CLEARING_ACCOUNT]) ;
		$xml .= $this->createXmlElement(self::C_ACTIVITY_CODE_PREFIX,$this->opt[self::C_WORKFLOW][self::C_ACTIVITY_CODE_PREFIX]) ;
		$xml .= $this->createXmlElement(self::C_ACTIVITY_CODE_LENGTH,$this->opt[self::C_WORKFLOW][self::C_ACTIVITY_CODE_LENGTH]) ;
		$xml .= $this->createXmlElement(self::C_ACTIVITY_CODE_RN,$this->opt[self::C_WORKFLOW][self::C_ACTIVITY_CODE_RN]) ;
		$xml .= $this->createXmlElement(self::C_GR_CODE_PREFIX,$this->opt[self::C_WORKFLOW][self::C_GR_CODE_PREFIX]) ;
		$xml .= $this->createXmlElement(self::C_GR_CODE_LENGTH,$this->opt[self::C_WORKFLOW][self::C_GR_CODE_LENGTH]) ;
		$xml .= $this->createXmlElement(self::C_GR_CODE_RN,$this->opt[self::C_WORKFLOW][self::C_GR_CODE_RN]) ;
		$xml .= $this->createXmlElement(self::C_QUOTATION_CODE_PREFIX,$this->opt[self::C_WORKFLOW][self::C_QUOTATION_CODE_PREFIX]) ;
		$xml .= $this->createXmlElement(self::C_QUOTATION_CODE_LENGTH,$this->opt[self::C_WORKFLOW][self::C_QUOTATION_CODE_LENGTH]) ;
		$xml .= $this->createXmlElement(self::C_QUOTATION_CODE_RN,$this->opt[self::C_WORKFLOW][self::C_QUOTATION_CODE_RN]) ;
		$xml .= $this->createXmlElement(self::C_SALES_QUOTATION_CODE_PREFIX,$this->opt[self::C_WORKFLOW][self::C_SALES_QUOTATION_CODE_PREFIX]) ;
		$xml .= $this->createXmlElement(self::C_SALES_QUOTATION_CODE_LENGTH,$this->opt[self::C_WORKFLOW][self::C_SALES_QUOTATION_CODE_LENGTH]) ;
		$xml .= $this->createXmlElement(self::C_SALES_QUOTATION_CODE_RN,$this->opt[self::C_WORKFLOW][self::C_SALES_QUOTATION_CODE_RN]) ;
		$xml .= $this->createXmlElement(self::C_SALES_QUOTATION_INTERNAL_PREFIX,$this->opt[self::C_WORKFLOW][self::C_SALES_QUOTATION_INTERNAL_PREFIX]) ;
		$xml .= $this->createXmlElement(self::C_PROFORMA_INVOICE_CODE_PREFIX,$this->opt[self::C_WORKFLOW][self::C_PROFORMA_INVOICE_CODE_PREFIX]) ;
		$xml .= $this->createXmlElement(self::C_PROFORMA_INVOICE_CODE_LENGTH,$this->opt[self::C_WORKFLOW][self::C_PROFORMA_INVOICE_CODE_LENGTH]) ;
		$xml .= $this->createXmlElement(self::C_PROFORMA_INVOICE_CODE_RN,$this->opt[self::C_WORKFLOW][self::C_PROFORMA_INVOICE_CODE_RN]) ;
		$xml .= '</' . self::C_WORKFLOW . '>';
        
		//email setting
		$xml .= '<' . self::C_EMAIL_SETTING . '>';
		$xml .= $this->createXmlElement(self::C_EMAIL_SETTING_SERVER,$this->opt[self::C_EMAIL_SETTING][self::C_EMAIL_SETTING_SERVER]) ;
		$xml .= $this->createXmlElement(self::C_EMAIL_SETTING_PORT,$this->opt[self::C_EMAIL_SETTING][self::C_EMAIL_SETTING_PORT]) ;
		$xml .= $this->createXmlElement(self::C_EMAIL_SETTING_SENDER,$this->opt[self::C_EMAIL_SETTING][self::C_EMAIL_SETTING_SENDER]) ;
		$xml .= $this->createXmlElement(self::C_EMAIL_SETTING_PASSWORD,$this->opt[self::C_EMAIL_SETTING][self::C_EMAIL_SETTING_PASSWORD]) ;
		$xml .= $this->createXmlElement(self::C_EMAIL_SETTING_AUTH,$this->opt[self::C_EMAIL_SETTING][self::C_EMAIL_SETTING_AUTH]) ;
		$xml .= $this->createXmlElement(self::C_EMAIL_SETTING_SSL,$this->opt[self::C_EMAIL_SETTING][self::C_EMAIL_SETTING_SSL]) ;
		$xml .= '</' . self::C_EMAIL_SETTING . '>';
        
		//bank detail
		$xml .= '<' . self::C_BANK_DETAIL . '>';
		$xml .= $this->createXmlElement(self::C_BANK_DETAIL_CODE,$this->opt[self::C_BANK_DETAIL][self::C_BANK_DETAIL_CODE]) ;
		$xml .= $this->createXmlElement(self::C_BANK_DETAIL_NAME,$this->opt[self::C_BANK_DETAIL][self::C_BANK_DETAIL_NAME]) ;
		$xml .= $this->createXmlElement(self::C_BANK_DETAIL_ACCOUNT_NAME,$this->opt[self::C_BANK_DETAIL][self::C_BANK_DETAIL_ACCOUNT_NAME]) ;
		$xml .= $this->createXmlElement(self::C_BANK_DETAIL_ACCOUNT_NUMBER,$this->opt[self::C_BANK_DETAIL][self::C_BANK_DETAIL_ACCOUNT_NUMBER]) ;
		$xml .= $this->createXmlElement(self::C_BANK_DETAIL_BRANCH_CODE,$this->opt[self::C_BANK_DETAIL][self::C_BANK_DETAIL_BRANCH_CODE]) ;
		$xml .= $this->createXmlElement(self::C_BANK_DETAIL_SWIFT_CODE,$this->opt[self::C_BANK_DETAIL][self::C_BANK_DETAIL_SWIFT_CODE]) ;
		$xml .= '</' . self::C_BANK_DETAIL . '>';
		
		$xml .= '</configuration>';
		return $xml ;
	}
	private function createXmlElement($tag,$value) {
		return '<' . $tag . '>' . $value . '</' . $tag . '>' ;
	}
	function initOptions() {
		//contact
		$op = array() ;
		$op[self::C_CONT_NAME2] = "" ;
		$op[self::C_CONT_ADDR1] = "" ;
		$op[self::C_CONT_ADDR2] = "" ;
		$op[self::C_CONT_ADDR3] = "" ;
		$op[self::C_CONT_ADDR4] = "" ;
		$op[self::C_CONT_ADDR5] = "" ;
		$op[self::C_CONT_TEL] = "" ;
		$op[self::C_CONT_FAX] = "" ;
		$op[self::C_CONT_EMAIL] = "" ;
		$op[self::C_CONT_WEB] = "" ;
		$this->opt[self::C_CONTACT] = $op ; 
		
		//setting
		$op = array();
		$op[self::C_SET_CPF_NO] = "" ;
		$op[self::C_SET_REF_NO] = "" ;
		$op[self::C_SET_CPF_REF] = "" ;
		$op[self::C_SET_BANK] = "" ;
		$op[self::C_SET_BANK_ACCT] = "" ;
		$op[self::C_SET_FINANCIAL_MONTH] = "1" ;
		$op[self::C_SET_FINANCIAL_YEAR] = "0" ;
		$op[self::C_SET_CODE] = "" ;
		$op[self::C_BASE_CURRENCY] = "0" ;
		$this->opt[self::C_SETTING] = $op ;
		
		//iras
		$op = array();
		$op[self::C_IRAS_NAME] = "" ;
		$op[self::C_IRAS_DEST] = "" ;
		$op[self::C_IRAS_CONTACT] = "" ;
		$op[self::C_IRAS_EGM] = "" ;
		$op[self::C_IRAS_BONUS] = "" ;
		$op[self::C_IRAS_TAX_ID] = "" ;
		$op[self::C_IRAS_ID_TYPE] = "" ;
		$this->opt[self::C_IRAS] = $op ;
		
		//workflow
		$op = array();
		$op[self::C_STEP] = "" ;
		$op[self::C_CLAIM_REJECT_REASON] = "" ;
		$op[self::C_PRORATION_CLAIM] = "0" ;
		$op[self::C_PRORATION_MONTH] = "0" ;
		$op[self::C_CLEARING_ACCOUNT] = "" ;
		$op[self::C_ACTIVITY_CODE_PREFIX] = "" ;
		$op[self::C_ACTIVITY_CODE_LENGTH] = "10" ;
		$op[self::C_ACTIVITY_CODE_RN] 	  = "1" ;
		$op[self::C_GR_CODE_PREFIX] = "" ;
		$op[self::C_GR_CODE_LENGTH] = "10" ;
		$op[self::C_GR_CODE_RN] 	= "1" ;
		$op[self::C_QUOTATION_CODE_PREFIX] = "" ;
		$op[self::C_QUOTATION_CODE_LENGTH] = "10" ;
		$op[self::C_QUOTATION_CODE_RN] 	= "1" ;
		$op[self::C_SALES_QUOTATION_CODE_PREFIX] = "" ;
		$op[self::C_SALES_QUOTATION_CODE_LENGTH] = "2" ;
		$op[self::C_SALES_QUOTATION_CODE_RN] 	= "10" ;
		$op[self::C_SALES_QUOTATION_INTERNAL_PREFIX] = "" ;
		$op[self::C_PROFORMA_INVOICE_CODE_PREFIX] = "" ;
		$op[self::C_PROFORMA_INVOICE_CODE_LENGTH] = "2" ;
		$op[self::C_PROFORMA_INVOICE_CODE_RN] 	= "10" ;
		$this->opt[self::C_WORKFLOW] = $op ;
        
		//email setting
		$op = array();
		$op[self::C_EMAIL_SETTING_SERVER] = "" ;
		$op[self::C_EMAIL_SETTING_PORT] = "25" ;
		$op[self::C_EMAIL_SETTING_SENDER] = "" ;
		$op[self::C_EMAIL_SETTING_PASSWORD] = "" ;
		$op[self::C_EMAIL_SETTING_AUTH] = "1" ;
		$op[self::C_EMAIL_SETTING_SSL] = "1" ;
		$this->opt[self::C_EMAIL_SETTING] = $op ;
        
		//bank detail
		$op = array();
		$op[self::C_BANK_DETAIL_CODE] = "" ;
		$op[self::C_BANK_DETAIL_NAME] = "" ;
		$op[self::C_BANK_DETAIL_ACCOUNT_NAME] = "" ;
		$op[self::C_BANK_DETAIL_ACCOUNT_NUMBER] = "" ;
		$op[self::C_BANK_DETAIL_BRANCH_CODE] = "" ;
		$op[self::C_BANK_DETAIL_SWIFT_CODE] = "" ;
		$this->opt[self::C_BANK_DETAIL] = $op ;		
	}
}
?>