public function CreateVoucher($data, $return_response = FALSE)
	{
		$req = array(
			'FeCAEReq' => array(
				'FeCabReq' => array(
					'CantReg' 	=> $data['CbteHasta']-$data['CbteDesde']+1,
					'PtoVta' 	=> $data['PtoVta'],
					'CbteTipo' 	=> $data['CbteTipo']
					),
				'FeDetReq' => array( 
					'FECAEDetRequest' => &$data
				)
			)
		);

		unset($data['CantReg']);
		unset($data['PtoVta']);
		unset($data['CbteTipo']);

		if (isset($data['Tributos'])) 
			$data['Tributos'] = array('Tributo' => $data['Tributos']);

		if (isset($data['Iva'])) 
			$data['Iva'] = array('AlicIva' => $data['Iva']);

		if (isset($data['Opcionales'])) 
			$data['Opcionales'] = array('Opcional' => $data['Opcionales']);

		$results = $this->ExecuteRequest('FECAESolicitar', $req);

		if ($return_response === TRUE) {
			return $results;
		}
		else{
			return array(
				'CAE' 		=> $results->FeDetResp->FECAEDetResponse->CAE,
				'CAEFchVto' => $this->FormatDate($results->FeDetResp->FECAEDetResponse->CAEFchVto),
			);
		}
	}
public function CreateVoucher($data, $return_response = FALSE)
	{
		$req = array(
			'FeCAEReq' => array(
				'FeCabReq' => array(
					'CantReg' 	=> $data['CbteHasta']-$data['CbteDesde']+1,
					'PtoVta' 	=> $data['PtoVta'],
					'CbteTipo' 	=> $data['CbteTipo']
					),
				'FeDetReq' => array( 
					'FECAEDetRequest' => &$data
				)
			)
		);

		unset($data['CantReg']);
		unset($data['PtoVta']);
		unset($data['CbteTipo']);

		if (isset($data['Tributos'])) 
			$data['Tributos'] = array('Tributo' => $data['Tributos']);

		if (isset($data['Iva'])) 
			$data['Iva'] = array('AlicIva' => $data['Iva']);

		if (isset($data['Opcionales'])) 
			$data['Opcionales'] = array('Opcional' => $data['Opcionales']);

		$results = $this->ExecuteRequest('FECAESolicitar', $req);

		if ($return_response === TRUE) {
			return $results;
		}
		else{
			return array(
				'CAE' 		=> $results->FeDetResp->FECAEDetResponse->CAE,
				'CAEFchVto' => $this->FormatDate($results->FeDetResp->FECAEDetResponse->CAEFchVto),
			);
		}
	}
public function CreateVoucher ( $ data , $ return_response = FALSE ) { $ req = array ( 'FeCAEReq' => array ( 'FeCabReq' => array ( 'CantReg' => $ data [ 'CbteHasta' ] - $ data [ 'CbteDesde' ] + 1 , 'PtoVta' => $ data [ 'PtoVta' ] , 'CbteTipo' => $ data [ 'CbteTipo' ] ) , 'FeDetReq' => array ( 'FECAEDetRequest' => & $ data ) ) ) ; unset ( $ data [ 'CantReg' ] ) ; unset ( $ data [ 'PtoVta' ] ) ; unset ( $ data [ 'CbteTipo' ] ) ; if ( isset ( $ data [ 'Tributos' ] ) ) $ data [ 'Tributos' ] = array ( 'Tributo' => $ data [ 'Tributos' ] ) ; if ( isset ( $ data [ 'Iva' ] ) ) $ data [ 'Iva' ] = array ( 'AlicIva' => $ data [ 'Iva' ] ) ; if ( isset ( $ data [ 'Opcionales' ] ) ) $ data [ 'Opcionales' ] = array ( 'Opcional' => $ data [ 'Opcionales' ] ) ; $ results = $ this -> ExecuteRequest ( 'FECAESolicitar' , $ req ) ; if ( $ return_response === TRUE ) { return $ results ; } else { return array ( 'CAE' => $ results -> FeDetResp -> FECAEDetResponse -> CAE , 'CAEFchVto' => $ this -> FormatDate ( $ results -> FeDetResp -> FECAEDetResponse -> CAEFchVto ) , ) ; } }
Create a voucher from AFIP

Send to AFIP servers request for create a voucher and assign
CAE to them {@see WS Specification item 4.1}

@since 0.7

@param array $data Voucher parameters {@see WS Specification
item 4.1.3}, some arrays were simplified for easy use {@example
examples/CreateVoucher.php Example with all allowed
attributes}
@param bool $return_response if is TRUE returns complete response
from AFIP

@return array if $return_response is set to FALSE returns
[CAE => CAE assigned to voucher, CAEFchVto => Expiration date
for CAE (yyyy-mm-dd)] else returns complete response from
AFIP {@see WS Specification item 4.1.3}
Create a voucher from AFIP