Skip to content
Ronaldo edited this page Aug 1, 2020 · 16 revisions

Factura Electronica Guatemala

1. Purpose

This application is designed to allow the creation of signed electronic invoices as per Guatemalan requirements through an Electronic Invoice Generation Service Provider (EIGSP). Many local companies offer Electronic Invoice Generation services through their own web portals, which despite the advantages of using signed electronic invoices (little or no paper usage), make it cumbersome to keep records centralized and unified. Any company operating their accounting, stock and price lists on their own enterprise management software will have to manually duplicate data entry on the EIGSP web portal if they already have an accounting system. This makes it cumbersome and time consuming to keep records centralized and unified. This application aims to resolve this, building upon ERPNext's existing Sales Invoice DocType, greatly automating the process of generating a Signed Electronic Invoice.

2. Original Features

  • Easily generate an electronic invoice with the click of a button. Adds only one step to the workflow for managing Sales Invoices.
  • Minimal dialog generation: Only serious errors will generate dialogs.
  • Simple error management: You either generate the electronic invoice or you don't. Errors in dialogs will point you in the right direction for fast resolution.
  • Separate Application Icon on the Desk (can hide it if desired)
  • Stores several configurations, only one configuration allowed to be active.
  • Keeps individual transaction data for each invoice generated (for auditing and verification purposes)
  • Allows you to match EIGSP DocTypes with your ERPNext DocTypes based on the Naming Series prefix through a dropdown menu. The application will rename the Invoice upon obtaining the officially generated number, and it will update all transactions referring to it: (Stock Entry, GL Entry, etc.)
  • Allows you to enter the required three digit alphanumeric UOM codes required by the EIGSP and tax authority, directly on the Unit of Measure DocType. It loads it automatically when creating an Item.
  • Given the problem of ERP software of providing a precise rounding amount, a field was added to Purchas eand Sales Invoice Items where the user enters the Invoice amount resulting from quantity x rate. This triggers the goalSeek js library that has been incorporated, to iterate through 10,000 options of decimals for the quantity, without altering the rate, so that the amount is properly estimated to the amount printed on the physical invoice being entered (This is useful when entering pre-existing invoice copies for accounting purposes only). Please see the Wiki “Item amount back calculation” for details.

Extra features

These features were added because they are a requirement for each electronic invoice to notify if any excise taxes are present.

  • Configure excise taxes on a per item basis (Tax per Unit of Measure).
  • Specify the account on which the excise tax for a Sales Invoice or a Purchase Invoice will be tallied.
  • Automatically estimate and account for the correct taxes when items with excise taxes are present on the Sales or Purchase Invoices
  • Automatically sets the pre-configured account for recording excise taxes for Sales and Purchase invoices.
  • Given the compliance needed for excise taxes such as fuel, tobacco, alcohol, cement, and others, each Item now has three checkboxes to specify if item is fuel, a good or a service. This division allows local accountants to generate a purchase book (Libro de Compras) in the format specified by the local tax authority (SAT), by using these selectors to categorize individual items in the Sales Invoice, adding each category properly, estimating their sales tax, net of excise tax properly, and then simply showing these totals in a Sales Invoice report with the proper fields (columns) chosen. Please see our Wiki page on configuring this report.
  • You can now generate elctronic invoices in other currencies allowed by Guatemala's SAT: USD
  • Massive electronic invoice generation: Some users have a monthly process that requires them to generate more than 100 invoices per ocurrence. To automate this task, we added a massive generation feature, allowing you to load required invoices using a pre-formatted spreadsheet file, initiate the generation or electornic signing process, and keep a log. More info on that page. TK

July 2020 Extended release features (Tax Reporting)

We opted to combine planned tax functionality from our dedicated tax app into this one for faster development so we have added the following improvements to the existing functionality:

  • Purchase Ledger: A customized purchase ledger report and print format have been added. This purchase ledger is configured to satisfy the requirements of tax authorities in Guatemala.
  • Sales Ledger: A customized sales ledger report and print format have been added. This sales ledger is configured to satisfy the requirements of tax authorities in Guatemala.
  • Purchase and Sales Tax Declaration ("Asiste Libros"): A report combining both purchases and sales with the required categorization by tax authorities has been added. You can generate a monthly VAT tax declaration directly from this report, delivered as an .asl file (a kind of CSV using Pipes as column separators), and keep a log of which invoices have been declared. This allows you to add invoices extemporaneously as permitted by law and include them in future declarations up two months before the month of the declaration. More details here.
  • VAT Tax Conciliation: A report combining the VAT tax payable and VAT tax receivable to clarify whether you need to pay VAT tax or not for the requested period.
  • VAT and Income Tax Retention Report: Tax rules in Guatemala require withholding tax payments depending on tax category matching between company and supplier. This report allows you to keep track of which retentions exist for both purchase and sales invoices. Functionality in the actions button for both sales and purchase invoices allows for creation of these new doctypes, and journal entries with automated calculations of how much is retention and the liquid payment (Cash, Check, etc).
  • Consumable Acquisition Document Report: Similar to the tax retention report, export companies are allowed to claim tax credit on production items. The Consumable Acquisition Record and its report, allow the user to keep track of the invoices that have this document linked. Functionality in the actions button for purchase invoices allows for creation of these new doctypes, and journal entries with automated calculations of the consumable acquisition record portion and the liquid payment (Cash, Check, etc).
  • As a support feature for all the previously mentioned reports, a special section was added that allows the specification of accounts, rates and lower and uppper limits for VAT retentions and income tax retentions.

3. Requirements for Electronic Invoice Generation

An account with monthly service with any of the supported EIGSP companies is required for this application to work. Such a service costs approximately $40 a month as of 2020. Only one company supported currently.

4. Installation

To install this application, you must have ERPNext up and running. Please note: This will only work in self-deployed instances of ERPNext installations as of February 2018. Work is underway to bring the excise tax portion to the ERPNext software core.

4.1 Login to your ERPNext server via SSH

ssh [user]@[server-address]

4.2 Go to the frappe-bench directory

cd /home/frappe/frappe-bench/

4.3 Change to the frappe user, (or the user different from root that you installed erpnext with)

su frappe

4.4 Use the bench get-app command

bench get-app https://github.com/sihaysistema/factura_electronica_gt.git

4.5 Install the application - Part 1

bench install-app factura_electronica

Make sure the fields are properly imported into the site with:

bench migrate

4.6 Install the application - Part 2

4.6.1 On the web browser, start a session on erpnext (login to erpnext)

4.6.2 Go to Setup > Applications > Application Installer

4.6.3 Click on Select Category...

4.6.4 Select Not set

4.6.5 You will see the icon for our app and Factura Electronica, with a purple Install button. Click on it.

4.6.6 Done!

5. Configuration

5.1 Prerequisites - After installing, but before using our application!

You must at the very least have configured the following items in your instance of ERPNext, for every company that will be using the application: Desk > Accounts > Company > [Your company]

5.1.0 NIT (Tax ID)

We have configured our own tax id field, so it is imperative that you enter it there also. This will be used for the generation of the electronic invoice.

5.1.1 Address

Enter the complete address in the Company Info section. At the very least, line 1 of the address must have something entered. Also, fill out all the field for territory, such as:

  • City/Town
  • County
  • State
  • Country
  • Postal code

In Guatemala, it is customary to enter Ciudad if no address will be given on Address Line 1

5.1.2 Sales Taxes and Charges Template

Desk > Accounts > Sales Taxes and Charges Template > [Your default sales tax and charge template]

Make sure that it is the Default table by checking the Default checkbox. Click on the arrow at the right of the row where you have the tax set up or where you will set it up, to verify or modify this item.

  • Type: On Net Total
  • Account Head: [Fiscal Liability Account] (Has to be a Liability root type account)
  • Cost Center: Not required, but you may choose your own for budgeting and tracking purposes.
  • Description: Whatever you choose, we like to use: IVA ventas 12% (por pagar) or IVA Por pagar

THE FOLLOWING IS VERY IMPORTANT FOR USERS IN GUATEMALA!

  • Is this Tax Included in Basic Rate?: Check (YES) (This ensures Sales tax is calculated from the total, not added)
  • Rate: 12% (As of this writing, sales tax in Guatemala is 12%, please check recent regulations to ensure adequate accounting)

5.1.3 Units of Measure

You must modify all frequently units of measure to have three digit codes, as per INFILE's Units of Measure Catalog: "Catalogo Unidades de Medida". Please see the Wiki Page listing the accepted Units of Measure code. We suggest you do this before configuring Items! To do this: Desk > Stock > Tools > Unit of Measure (UOM)

Click on the desired Unit of Measure Example: Nos. or Unit

You will now see a new field: "Codigo Unidad de Medida"

Select one of any of these acceptable three digit codes, without leading or trailing spaces from the Units of Measure Catalog:

  • UN
  • UND
  • UNI

Save AB[Add functionality to update all items 3 digit UOM automatically

5.1.4 Items

5.1.4.0 Sales Items

You must modify all Sales Items, to validate the three-digit code for their UOM, even though you might have already configured it. This is because the electronic invoice service provider requires a three digit code, which you edited above, but ERPNext must update each sales item to comply with this.

To do this: Desk > Stock > Items

  • Click Add Filter
  • Select the Is Sales Item field
  • Select Equals in the condition field
  • Select Yes

Click Apply Open Each Item (We suggest you right click on the item and select Open Link in New Tab) Once the item is open:

VERY IMPORTANT! If there is an excise tax (aka item or special tax) which applies on a per unit basis The stock unit defined in the Item master is the stock unit for which the item tax will be applied. If you have an item tax of $4.60 per gallon of fuel, then your default stock UOM must be Gallon and the Tax rate per UOM must be $4.60

Fetch the Three Digit UOM code

  1. Click on the Default Unit of Measure field.
  2. Erase the last character of the defined unit, and retype it or re-select it.
  3. This will trigger an automatic script that will pull the new three-digit code you entered above.
  4. Click Save

Modify the Item Tax Accordingly:

  1. Tax Rate per UOM: [Enter the amount of tax in company currency per stock unit of this item]
  2. tax_rate_per_UOM_purchase_account: Enter the account to which you will expense this tax for a purchase of this item This must be an expense account in Guatemala's case
  3. tax_rate_per_UOM_selling_account: Enter the account to which you will credit this tax for a sale of this item This must be a Liability account in Guatemala's case
  4. Select only one tax category: Fuel, Good or Service
  5. Click Save

5.1.4.1 Purchase Items

Similar to Sales Items, although you might not be using these for electronic invoicing, it is still imperative that you configure the Item Tax, because it also applies for fiscal accounting. Fetch the Three digit UOM code (see above) Modify the Item Tax Accordingly (see above)

5.1.5 Suppliers

Desk > Buying > Supplier > [Your supplier]

Make sure the Tax ID field from our application (different than Tax ID default field for ERPNext) is filled with a correct Tax ID.

Our software will verify it is a valid Guatemalan Tax Id when modifying a Supplier manually! If an incorrect Tax ID is entered, a message will pop up declaring: "NIT ingresado no es correcto, si no tiene disponible el NIT escriba C/F" Please enter the correct Tax ID/NIT or C/F

AB [] Actualizar campo existente de Tax ID, a campo de facelec. Realizarlo constantemente. A script will be added in the future to run a simple column copy from the Tax ID field named in ERPNext, to the Tax ID field used by our application. This script For now the script will be automatically modifying items without validating tax ID. Otherwise, the script will automatically validate the Tax ID, and any errors will be flagged, shown in a log, or assigned a task to be corrected.

5.1.5 Customers

Desk > Selling > Customer > [Your customer]

Make sure the Tax ID field from our application (different than Tax ID default field for ERPNext) is filled with a correct Tax ID.

Our software will verify it is a valid Guatemalan Tax Id when modifying a Customer manually! If an incorrect Tax ID is entered, a message will pop up declaring: "NIT ingresado no es correcto, si no tiene disponible el NIT escriba C/F" Please enter the correct Tax ID/NIT or C/F

The billing address set as Prefered Billing Address for the customer, will be used for generating the electronic sales invoice. If no preferred address is set, it will pick the first one. If no address is specified, it will issue the invoice with default values: NIT: C/F Address: N/A

5.2 ERPNext Series configuration

You need to add the series to ERPNext given to you by your Electronic Invoice Service provider to the Sales Invoice DocType

Desk > Setup > Data > Naming Series

Where it says Select Transaction, select Sales Invoice

Follow the rules to enter the series on each separate line, using data furnished by your Electronic Invoice Service Provider, for example: Where the "." indicates the numbering series portion that ERPNext will create, followed by the amount of digits to be utilized or zeroes to the left - number. So, if you require a 6 digit number, an invoice with the number 109 will be shown as 000109 with "######". The same invoice with 4 digits will be shown as 0109 using "####"

IMPORTANT! Do not leave a period at the end of any series for our application, make sure it finish ####

FACE63XY.#########

NDE65XYZ.######

NCE64XYZ.#####

Mark the check that says "User must always select".

Click Update

5.4 Configure your access credentials, parameters and invoice series for the EIGSP

Go to Desk > Factura Electronica > Setup > Configuracion Factura Electronica

Click on "New"

5.4.1 Configuration Section (Configuración)

  • Servicio Factura Electronica: ACTIVAR (Activated)
  • Generacion Factura: MANUAL or AUTOMATIC
    • MANUAL: User presses a button in a valid Sales Invoice to generate it.
    • AUTOMATICO: Electronic invoice is immediately generated upon validating a Sales Invoice in ERPNext. This is useful for POS sales where time is of the essence. We estimate it takes 2 seconds to generate it.

5.4.2 Datos Proveedor Factura Electronica (Access Credentials Supplied by Company providing service):

Some of these items can be found in the EIGSP web portal, using the access credentials for that site.

  • Clave: A 64 character Hexadecimal value, furnished by EIGSP
    • Example: BCA8C5C85D0FE9BC781AE1E2D7502BF62474B131C3D5AC2A237D23E82A2AAC33
  • URL Web Service: A webservice address
  • Usuario: Username furnished by EIGSP
  • Validador: false (Enter it manually for now, must be false)

5.4.3 Datos Establecimiento (Business or Venue Details)

  • Codigo Establecimiento: 1 (Option to change will be added in the future), verify the pre-agreed number with your EIGSP
  • Descripcion Otro Impuesto: N/A (Remnants of development, will be removed in future releases)
  • Importe Exento: 0 (Remnants of development, will be removed in future releases)
  • Importe Otros Impuestos: 0 (Remnants of development, will be removed in future releases)
  • ID Dispositivo: 001 Verify with service provider, will have options for more devices according to POS profiles to enable multiple devices generating invoices.
  • NIT GFACE: 12521337 (Fixed number, the Tax ID of service provider.)
  • Importe Total Exento: 0 (Remnants of development, will be removed in future releases)
  • Afecto al regimen 29-89: YES or NO (Unchecked). Default: NO
  • Regimen ISR: RET_DEFINITIVA Consult with your accountant to chose the proper value.

5.4.3 EIGSP Series configuration

In this section you must correlate the series furnished by your EIGSP with the series created previously. You must also define a type of document to be sent in the electronic transaction. Improper configuration here, will result in the program not working at all or severe errors being generated.

Click on Add Row to add a row.

The first item will be a drop down where you can select the series configured previously in Setup (Step 5.2)

Select the Document Type according to EIGSP. For an electronic Sales Invoice, select FACE

Enter the Series name furnished by your EIGSP, usually a pair or trio of UPPERCASE letters, such as XY as seen on the last digits before the period dividing numbering in the naming series specified previously. Example: For FACE63XY. the data in this field would be: DB

Enter the resolution number furnished by your EIGSP. Example: 2018567801913406

If no more fields are visible, click on the down ▼ arrow to see the remaining fields in a pop up dialog. Enter the resolution date furnished by your EIGSP. Example: 01-10-2017

Enter the Fiscal Authority's two digit code for this document type: 63 (Codigo SAT)

Finally, select the Document status: ACTIVO. Status can also be INACTIVO or inactive.

Repeat for each series you will be generating. Usually, it is 1 Electronic Invoice series 1 credit note series 1 debit note series 1 document copy (for registering your manually generated invoices) series

6. Usage

New Sales Invoices

From the Desk, go to Accounts> Sales Invoice

Click on New

Enter the Customer, Items, Quantity, price, taxes, etc.

Save

Verify data is correct

Submit for validation in ERPNext

Click on "Generate Electronic Invoice"

The data will be automatically sent to the server and a signed public key returned (CAE)

This confirms that the Tax Authority has received notice of the Sales Invoice and has it on record. If no public key has been returned, the Electronic Invoice has not been created.

Existing Sales Invoices (prior to installation)

For pre-submitted or Validated invoices existing in ERPNext when you begin using the service: Open each invoice and click on "Generate Electronic Invoice".

7. Configure Print Format for ERPNext

Please see the wiki page for Creating Sales Invoice Print Formats with Jinja for a tutorial and a couple of sample Jinja formats that you can try on for size.

8. Upcoming Features

  • POS Support: Generate the electronic invoice automatically upon registering a sale form the POS module, and print it immediately. Requires a working internet connection service for proper functioning.
  • Automated selection of three digit codes based on existing UOMs (Bayesian or AI derived selection?)
  • Porting this application other doctypes such as the purchase invoice so that data is properly calculated from a quotation all the way to the final invoice (Purchase and Sales sides), to provide complete data even before an invoice is created in ERPNext.
  • Print format for Purchase Book (Libro de Compras) amd (Libro de Ventas) for tax declaration purposes
  • Data format for submitting the Sales and Purchase Book using web based services, manually
  • Data format for submitting these tax declarations directly to the tax authority with proper credentials.

9. Supported Electronic Invoice Generation Services

Note: Currently we support only this service provider, but it is not meant as an endorsement of their services. It is simply because it is the first and most readily available service at hand. In the future, we expect to add more Electronic Invoice Generation Service Providers.

10. Legal notes

About the Taxpayer ID number or NIT of the customer who is issued a Sales Invoice, Credit Note or Debit Note. Guatemalan taxpayer ID numbers follow the format of alphanumeric digits followed by a check digit, also alphanumeric, which is conventionally represented by separating the check digit with a dash character: "-" Recently we had a case of a customer of our client requiring the dash to accept the invoice as valid.

Upon consultation with a representative of the Guatemalan Tax Authority, on May 16, 2018, the representative categorically confirmed that the dash does not form part of the Taxpayer ID number, and recognizes it only as a convention.

This means that legally or commercially, these two forms of rendering the Tax ID (NIT) are the one and the same:

1234567-8 12345678

Users who issue electronic invoices can rest assured, that the manner in with the Tax ID is rendered within ERPNext is legally correct despite not having the "-" dash character.

The PDF generated by the third-party electronic invoice generator service provider, to which our software links from a Valid and Electronic Generated Invoice within ERPNext, is assured to be legally correct, because the third-party service provider is obligated to furnish this data in compliance with the law. An electronic invoice will not be generated by the third-party service provider if any data furnished by our app form within ERPNext is not correct.

10 es-GT Notas legales

Sobre el Número de identificación Tributaria (NIT) del cliente al que se le emite Factura Electrónica, Nota de Credito o Nota de Débito. Los Números de identificación Tributaria del cliente en Guatemala siguen el formato de digitos alfanuméricos seguidos de un dígito de chequeo, también alfanumérico, el cual se representa convencionalmente con separar el dígito de chequeo al final del Número de identificación Tributaria con un guión o "-". Recientemente hemos tenido un caso de un cliente de uno de nuestros clientes, que requirió el guión para aceptar como válida la factura electrónica.

Después de varias consultas de verificación y en una llamada telefónica con un agente de la Superintendencia de Administración Tributaria el 16 de Mayo de 2018, el representante confirmó enfáticamente que el guión no forma parte oficial de Número de identificación Tributaria, y lo reconoce solamente como una convención.

Esto implica, que legalmente y comercialmente, estas dos formas de mostrar o imprimir el Número de identificación Tributaria son iguales:

1234567-8 12345678

Los usuarios que emiten facturas electrónicas o cualquier Documento Tributario Electrónico, pueden estar tranquilos, que la manera en que se muestra el Número de identificación Tributaria de las partes, esta legalmente correcto aunque no muestre el guión "-".

El PDF generado por el proveedor de servicios de Generación de Factura Electrónica. The PDF generated by the third-party electronic invoice generator service provider, to which our software links from a Valid and Electronic Generated Invoice within ERPNext, is assured to be legally correct, because the third-party service provider is obligated to furnish this data in compliance with the law. An electronic invoice will not be generated by the third-party service provider if any data furnished by our app form within ERPNext is not correct.

##11 SAT considers valid the furnishing of the "Libro de Ventas" sales book, at the end of each month for calculating the sales tax owed, and not the monthly closing data of Electronic Invoices and Document Copy invoices.

Clone this wiki locally