status ) ) {
return $this->status;
}
return 'O'; //Original
}
function setStatus( $value ) {
if ( strtoupper( $value ) == 'C' ) {
$value = 'A'; //Cancel isn't valid for this, only original and amendment.
}
$this->status = strtoupper( trim( $value ) );
return true;
}
function filterPhone( $value ) {
//Strip non-digits.
$value = $this->stripNonNumeric( $value );
if ( $value != '' ) {
return [ substr( $value, 0, 3 ), substr( $value, 3, 3 ), substr( $value, 6, 4 ) ];
}
return false;
}
function _outputXML( $type = null ) {
$xml = new SimpleXMLElement( '' ); //T4 and T4 Summary must be wrapped in
$this->setXMLObject( $xml );
$xml->addChild( 'T619' );
if ( $this->reference_id == '' ) {
$this->reference_id = date( 'Ymd' );
}
$xml->T619->addChild( 'sbmt_ref_id', $this->reference_id ); //Submission Reference Identification, unique 8 char alphanumeric.
//$xml->T619->addChild('rpt_tcd', 'O'); //Report Type, O = Original, A = Amended, C = Cancel. Entire batch must be the same I think.
$xml->T619->addChild( 'rpt_tcd', $this->getStatus() ); //Report Type, O = Original, A = Amended, C = Cancel. Entire batch must be the same I think.
if ( $this->transmitter_number == '' ) {
$this->transmitter_number = 'MM555555'; //Default transmitter number to use if they don't supply one.
}
$xml->T619->addChild( 'trnmtr_nbr', $this->transmitter_number ); //Transmitter number, provided by CRA if filing more then one return
$xml->T619->addChild( 'trnmtr_tcd', 4 ); //Transmitter type indicator. 1 = Submitting your returns, 2 = Submitting others returns (service providers), 3 = Submitting returns using a purchased software package, 4 = Software Vendor.
$xml->T619->addChild( 'summ_cnt', 0 ); //Total number of summary records.
$xml->T619->addChild( 'lang_cd', 'E' ); //Language
//Transmitter name
$xml->T619->addChild( 'TRNMTR_NM' ); //Employee name
$xml->T619->TRNMTR_NM->addChild( 'l1_nm', substr( Misc::stripHTMLSpecialChars( $this->company_name ), 0, 30 ) ); //Transmitter name, max length 30.
//Transmitter Address
$xml->T619->addChild( 'TRNMTR_ADDR' );
$xml->T619->TRNMTR_ADDR->addChild( 'addr_l1_txt', Misc::stripHTMLSpecialChars( $this->transmitter_address1 ) );
if ( $this->transmitter_address2 != '' ) {
$xml->T619->TRNMTR_ADDR->addChild( 'addr_l2_txt', Misc::stripHTMLSpecialChars( $this->transmitter_address2 ) );
}
$xml->T619->TRNMTR_ADDR->addChild( 'cty_nm', $this->transmitter_city );
$xml->T619->TRNMTR_ADDR->addChild( 'prov_cd', $this->transmitter_province );
$xml->T619->TRNMTR_ADDR->addChild( 'cntry_cd', 'CAN' );
$xml->T619->TRNMTR_ADDR->addChild( 'pstl_cd', $this->transmitter_postal_code );
//Contact
$xml->T619->addChild( 'CNTC' );
$xml->T619->CNTC->addChild( 'cntc_nm', $this->contact_name );
if ( $this->contact_phone != '' ) {
$phone_arr = $this->filterPhone( $this->contact_phone );
} else {
$phone_arr = $this->filterPhone( '000-000-0000' );
}
if ( is_array( $phone_arr ) ) {
$xml->T619->CNTC->addChild( 'cntc_area_cd', $phone_arr[0] );
$xml->T619->CNTC->addChild( 'cntc_phn_nbr', $phone_arr[1] . '-' . $phone_arr[2] );
$xml->T619->CNTC->addChild( 'cntc_extn_nbr', '000' ); //This is required in some cases, so just always specify it as 000 for now.
}
if ( $this->contact_email != '' ) {
$xml->T619->CNTC->addChild( 'cntc_email_area', $this->contact_email );
}
$xml->addChild( 'Return' );
return true;
}
function _outputPDF( $type ) {
return false;
}
}
?>