Uruguay Electronic Invoicing


Onshore / Offshore/ Contingency    
CFE Types    
Process    
DOCENT    
PINV_UE    
Daily Report    
ASP Page
Logging    
S01
MTM set up
SINV_UE  Next Numbers screen
Digital Certificates
IGI
EFAC Codes
Client Data
IGI
Electronic Signatures
XSD
DocmanServer
eInvoiceTest
J03.exe.config    
Webservice and ASP Page

 
Overview
The Uruguayan Government require that large taxpayers send their on-shore invoices electronically . They must also be able to receive invoices electronically.
Electronic invoices (CFEs) are xml files in a format specified by the Uruguayan tax authority (DGI)
They are sent to a DGI web service and also via email to the counterparty.
Onshore / Offshore/ Contingency
Onshore invoices are those sent to Uruguayan companies.
Offshore invoices are those sent to foreign companies.
Contingency invoices are those produced when the DGI web service is not available.
CFE Types
These are the types of CFE available for the electronic documentation of operations:
o     e-Invoice
o     e-Invoice Credit note.          } For operations among taxpayers (B2B)
o     e-Invoice Debit note.

o     e-Ticket.
o     e-Ticket Credit note.          } Only for Final Consumption (B2C)
o     e-Ticket Debit note.

o     e-Receipt.
o     e-Voucher.

Each CFE type has its own set of sequence numbers.

Process
 
Outgoing eInvoice
1.     User creates sales invoice in AGSINV_UE

2.     On the working page the user selects Invoice Style ( Cash / Credit ) , Invoice Type ( On shore , off shore or contingency and CFE type ( eInvoice / eTicket)

3.     SINV will generate an aud02 record and take the next sequence number for the selected CFE  type.



4.     The CFE xml file will be generated. This will be sent to the government web service which performs a preliminary validation.
If it is accepted the response will contain a token to identify the CFE and a time to check the final status.
At this stage a QR code is generated which is added to the invoice document. The invoice is then saved as a pdf and both it and the CFE xml file are emailed to the counterparty.

5.     An ITAS batch job ( ctrl11) is submitted to run at the time specified by the DGI. This calls a second web service which reports if the CFE has been accepted or not.
The ITAS program calling the web service (J60) will email the creator of the invoice with the result. If the CFE has been accepted the accounting document will be posted. If not the aud02 will be marked as void.

6.     Upon receiving the CFE  the counterparty should send an acknowledgement. They can either accept or reject the CFE.  The acknowledgement will be sent to the CFE email address which is monitored by Docman Server.  When docman server receives an acknowledgement it emails the creator of the invoice. If the CFE has been accepted it updates the aud02 as acknowledged.

 
Incoming eInvoices

DOCENT
1.     Incoming CFEs are received by DocmanServer and moved to the CFE folder to be processed.

2.     The DOCENT menu option Process Electronic Invoice prompts for the CFE xml file to process


3.     The user is shown the details from the CFE

They can accept or reject the CFE.

4.     The response xml is generated using the ACKPARTES IGI style and  is sent to the counterparty .

5.     The DOCENT form is shown with the details from the CFE  populated.

6.     When the invoice is saved the CFE is moved to the invoices folder.


PINV_UE

1.     Incomming CFEs can also be processed in PINV_UE.
2.     The process is similar to DOCENT but user is prompted to select a purchase contract for the counterparty based on the RUT in the incoming CFE.

 
Resending eInvoices

A CFE will need to be resent in the following cases.
a.     The CFE was invalid because of missing / incorrect client static  e.g. incorrect RUT number.
b.     Network error or DGI web service unavailable
c.     Wrong CFE type ( eTicket / eInvoice ) selected.
The SINV_UE option Resend CFE will show CFEs available for resend :
This will show all unposted invoices not accepted by the DGI or marked as void.
Resending will regenerate the CFE xml from the IGI style so new client static will be picked up. The invoice rtf/pdf document may need to be updated manually.
If the CFE was rejected by J60 and marked as void a new sequence number will be generated.
There are also options to resubmit the status check if the J60 web service call failed and to recreate the QR code.

Daily Report

Each day the company must produce a report of all CFEs sent. This is created in AGSINV_UE > eFactura Daily report.
The program prompts for the date of the report and a Sequence number.
If a correction needs to be made to a previously sent report the sequence number should be increased. e.g. if Seq 1 was sent on 1st July  but subsequently that day more CFEs were generated then the  Seq 2 should be sent as a replacement of Seq 1.
It is generated using the IGI style EFACRECEPECIONREPORTE and sent to the DGI via web service.

 
ASP Page
EDFMAN have a webserver where clients can download there CFEs in XML or PDF format.
When the eInvoice is created a webservice is called  which copies the xml and pdf files an stores the type, series, receipt no, amount and security code.
An ASP page allows clients to look up their invoice using these details

Logging
The log file for eInvoicing is itas\log\xx_einvoice.log where xx is the company code.

Flow


 
Uruguay eInvoicing Set Up
S01
S01 eInvoicing style should be set to Uruguay
MTM set up
2 new menu options are required


SINV_UE  Next Numbers screen
In SINV_UE there is a right click option for next numbers which need to be set up. These are the numbers that are assigned to each CFE. A different sequence is required for each type of CFE.
The settings also need to be completed:
1.     Report days before expiry : a report is generated each night by J09 ( URUGU_UE ) this will report CAE numbers ( Assigned numbers tab) that are due to expire
2.     QR Code URL . A QR code is printed on the eInvoice document which points to this URL plus some parameters so that the CFE can be retrieved from the DGI site.
3.     Webservice URL – DGI webservice
4.     Certificate Thumbprint : Thumbprint of the digital signature used to sign the CFEs
5.     UI rate – Used in calculation of threshold to see if eTicket should be sent to DGI
6.     Next envelope ID – identified used in CFE envelope
7.     eTicket UI Threshold: Used in calculation of threshold to see if eTicket should be sent to DGI
8.     eInvoice email initials : CMP email address used as sender on CFE emails

Digital Certificates
Certificates need to be installed on all machines used to send / receive CFEs. The user must have read access to the private keys.


IGI
The following IGI Styles should be imported:


EFAC Codes
The following static data must be set up






Client Data
In CLI each counterparty that will be sending or receiving eInvoices should be set up as an eSender / eReceiver - Document type, number and address should also be set. The other details are required for Mexico eInvoicing but are not required for Uruguay.
The CFE email address for the counterparty is set up in contacts . The contact should have a job role of “CFE”
Interface codes should be set on VAT

 
Technical
Most of the code is in ITASeInvoice.dll
The format for the CFE XML files is stored as IGI styles and IGI is used to generate the CFE from the dhl and aud02 details .

IGI
The following IGI styles are used :
CFE
Export – J03
CFE for Invoices
CFEDNDN
Export – J03
CFE for Credit and Debit notes
SOBRE
Export – J03
“Envelope” each submission to the DGI is sent in an envelope of sobre which may contain 1 or multiple CFEs
ACKCFE
Import – J60
Parses the response to the CFE from the DGI
ACKPARTES
Export – J03/D02
Response sent to the counterparty
ACKREPORT
Import – J03
Parses response to the SOBRE from the DGI
PARSECFE
Import – J03 / D02
Parses the incoming CFE from the counterparty
EFACCONSLTARESTADOENVIO
Export – J60
Check the status of the CFE
RUCEMISORES
Import – L01
Process the emisores file – List of electronic senders in XML format
ACKSOBRE
Import – J03
Parses the response to the CFE from the DGI
PARSECAE
Import – J03
Import the CAE – Next numbers file sent by the DGI

ACKPARTESCFE
Export – J03/D02
Response sent to the counterparty
EFACRECEPECIONREPORTE
Export – J03
Daily Report

Electronic Signatures
Each CFE has to be signed with an electronic signature based on a certificate issued by the DGI . The certificate has to be installed on the machine sending the CFEs.

XSD
The  XSDs used to validate the CFE xml are stored in i:\exec\xsd

DocmanServer
Emails to the designated eInvoice email address will be picked up by docman server
They are split into acknowledgements and CFEs
Acknowledgements from the counterparty which are parsed and the document creator is notified by email
Incoming CFEs are put into the incoming CFE folder for processing by AGPINV_UE / DOCENT

eInvoiceTest
there is a test application which can be used to test most of the functions
QR Code
The QR Code is based on the following data:
Einvoice  url
Inancor RUT (vatreg)
CFE Type
CFE Series
CFE No.
Amount
CFE Date
CFE Digest ( signature )
Eg:
 https://www.efactura.dgi.gub.uy/consultaQR/cfe?212693310010,102,BC,9,1210,22/08/2013,Kq54MAEan7g9HD/TMLzRand3dI4=

J03.exe.config
Config files are used to config the WCF connection to the DGI webservice
They are stored in the itas\exec  folder for J03 J60 and D02

Webservice and ASP Page
The webservice to copy files to the webserver with the ASP page and the ASP Page itself are in the following projects
I:\source\WebServices\EINVOICEWEBSERVERUPDATE
And
I:\source\WebServices\eInvoiceWeb\