Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
It's possible to modifiy invoice creation workflow to add a webservice calling?
11-17-2018, 02:31 AM,
#1
It's possible to modifiy invoice creation workflow to add a webservice calling?
Hi everyone,
I’m looking into weberp but in my country (Argentina) we can’t make invoices without a government confirmation via API webservice so I’m looking if it’s possible to add that function during an invoice creation.

I need to add this code (it’s an example) so when I push the “creation invoice button”, the weberp prepares all the invoice data and before printing it to the invoice executes this code to get the confirmation code (cae) and then add that info to the invoice template.

I’ve been looking some of the code, but I couldn’t find which files creates the invoices, and how they work to see is it’s even possible to modify that workflow to add those intermediate steps.

This is the code. I need to fill the array with the data (which the weberp should give me) and then include the $res data to the weberp for the invoice

PHP Code:
include 'afip_src/Afip.php'

$cuitEmisor 20111111112;
$tipoComprobante 6;
$puntoVenta 1;
$last_voucher $afip->ElectronicBilling->GetLastVoucher(1,6//Devuelve el número del último comprobante creado para el punto de venta 1 y el tipo de comprobante 6 (Factura B)

$data = array(
    
'CantReg'     => 1,  // Amount of invoices
    
'PtoVta'     => 1,  // Sales point
    
'CbteTipo'     => $tipoComprobante,  // invoice type
    
'Concepto'     => $puntoVenta,  // Type of invoice
    
'DocTipo'     => 99// client ID number
    
'DocNro'     => 0,  // Client ID type
    
'CbteDesde'     => ($last_voucher+1),  // 
    
'CbteHasta'     => ($last_voucher+1),  // 
    
'CbteFch'     => intval(date('Ymd')), // 
    
'ImpTotal'     => 121// Total amount
    
'ImpTotConc'     => 0,   // Total amount which taxes don't apply
    
'ImpNeto'     => 100// Total amount without taxes
    
'ImpOpEx'     => 0,   // total amount which don't pay taxes
    
'ImpIVA'     => 21,  //Total IVA taxes amount (always 21%)
    
'ImpTrib'     => 0,   //Total amount from othes taxes
    
'MonId'     => 'PES'//Currency type (ars, usd, etc)
    
'MonCotiz'     => 1,     // Always 1
    
'Iva'         => array( // (Opcional) Alícuotas asociadas al comprobante
        
array(
            
'Id'         => 5// IVA Tax type (5 for 21%)
            
'BaseImp'     => 100// Total amount which pays IVA tax
            
'Importe'     => 21 // Total IVA tax amount
        
)
    ), 
);

$afip = new Afip(array('CUIT' => $cuitEmisor));

$res $afip->ElectronicBilling->CreateVoucher($data);

$res['CAE']; //Confirmation ID number from goverment
$res['CAEFchVto']; //Confirmation ID number expiricity date (yyyy-mm-dd)
$res['barcode']=generadorCodigoBarrasCAE($cuitEmisor,$tipoComprobante,$puntoVenta,$res['CAE'],$res['CAEFchVto']); 

Could you please help me to know which files I should look or edit to add the code, and how can I get the data to fill the array.

Or at least know if its possible to do this?
Or I can’t modify weberp this way and it would be better to just create normal invoices and then, manually (or by other software), edit the pdfs to add the goverment codes?
Reply


Messages In This Thread
It's possible to modifiy invoice creation workflow to add a webservice calling? - by soportemesi - 11-17-2018, 02:31 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)