Nota Fiscal Operation


What is Nota Fiscal
Sefaz and MasterSaf
Sample Flows
Example flow - no trans-shipment
Example flow - with trans shipment
Branches
Currency
Menu Options for Notas Fiscais
System configuration
Nfe system parameters

/Commodity Codes
/Weight Codes

/CFOP codes
/NCM Codes
/Nfe Transaction Types
/Freight Product Types
/Fiscal extra information (Z02)
/FETHAB and FACS Rates
/General Parameters
/Nota Fiscal Definition (Product)
/Nota Fiscal Definition (Freight)
/View next Nfe numbers
/Default CST Codes




What is a Nota Fiscal
The Brazilian government requires that companies submit an electronic invoice nota fiscal eletrônica (NFe) and a freight document conhecimento do transporte eletrônico (CTe) for every goods movement. The Nfe contains product, financial and tax information.
The NFe is referred to as an invoice, but should not be confused with the term in Itas. In fact it refers to a change of ownership or a change of possession whereas the term in Itas refers to a demand for cash, which occurs later in the contract life cycle. The counterpart in Itas of the NFe change of ownership is title transfer as once title transfer occurs the goods are treated as invoiced in the accounts.


Sefaz and MasterSaf
Sefaz (Secrataria de Estado de Fazenda) is the government department which controls the NFes and CTes. All NFe and CTe documents go through Sefaz. A sample flow would be:
Grower delivers 30Mts of soya beans to the customer.
i) Grower prepares the details of the sale and delivery as an XML to a strict format (hyperlink)
ii) Grower sends the XML to Sefaz.
iii) Sefaz validates the XML.
iv) If the XML is invalid Sefaz sends it back to the grower as a rejection.
v) If the XML is valid, Sefaz adds a unique key access to the XML and sends it back to the grower as a validation and also sends it on to the buyer. In both cases as well as XML Sefaz sends a printable version in PDF format known as the DANFE (Documento Auxiliar de Nota Fiscal Electronica)
Itas doesn’t interact with Sefaz directly but goes through an intermediate system such as MasterSaf. So step v) would be MasterSaf receives the XML and Pdf from Sefaz, and places the 2 files in a designated folder for Itas to process.
Similarly when an NFe is issued from Itas, Itas creates the XML and places it in a designated folder for MasterSaf to validate, add the digital signature and send on to Sefaz. Sefaz will validate the content and if OK will add the unique key access and send the XML and Pdf on to the counterparty and back to MasterSaf and Itas with the key access.


Sample Flows
Managing Nfes is a bit like an accounting system with debits and credits, ultimately netting to zero. NFes are either entrances (Entrada) or exits (Saida). Entrances are when goods come into ownership/possession of the operating company and Exits are when the goods leave the ownership/possession of the operating company.
Example Flow, no trans-shipment
Below an example of a flow of goods and Nfes in a life cycle whereby the goods are received at a port terminal with no transhipment then exported.
Step
Activity
1
Create Purchase contract from a grower
2
Create freight order
3
Create sale contract to an off shore company
4
Create charter with export registration details
5
The operating company receives the grower Nfe XML and Pdf electronically. Itas will store the grower NFe (i.e. sale) and generate the operating company’s entrance (purchase Nfe) with all the same details except a different CFOP
6
The user processes the entrance NFe received including adding a transaction code and linking to a purchase contract and freight order. The linked contract will be split and the delivered part will have its title transfer date (TTD) set as the NFe issue date. So in Itas this part of the contract is treated as executed.
7
The operating company creates and issues an NFe to shipment as an exit. The goods are still in the ownership of the operating company but are not in its possession. On the physical side an incomplete delivery into the terminal record is created from the NFe details.
8
The operating company receives the transport company CTe XML and Pdf electronically. It is automatically linked to the appropriate NFes(s) as the CTe contains the Nfe Key access strings
9
The user processes the CTe including adding a transaction code
10
The delivery in details (quantity and date) are either received from the terminal and imported electronically or entered manually by the user.
11
The delivery in is completed. Certain data (physical quantity, terminal and stock no.) flow back to the Nfe. The unload quantity flows back to the CTe. If the contract is set to final weight at discharge, the contract split quantity is updated to the unload quantity.
12
The operating company creates and issues a symbolic return NFe to return goods from the terminal’s possession to the operating company’s possession as an entrance. The process drives from entrance NFes which are now stored at the terminal via an Nfe to shipment.
13
The operating company creates and issues an export NFe as an exit. The process drives from entrance NFes which are stored at the terminal via an Nfe to shipment and have been symbolically returned. The process also drives from a charter to pick up the export registration no. and sale contract. On the Physical side, the sale contract is split and assigned to the charter. A completed delivery out of stock is created allocated to the sale contract split.

Example Flow, with trans-shipment
In the sample flow the goods are transported straight to the port. Often they are stored up country, then trans-shipped to the port, often in a different quantity and mode of transport for example stage 1 is in trucks of about 30Mts and stage 2 in wagons of about 100 mts.
In this situation, steps 1 to 6 are executed as above. Then instead of step 7 we have:
Step
Activity
   
7a
The operating company creates and issues an NFe to storage as an exit. The goods are still in the ownership of the operating company but are not in its possession. On the physical side an incomplete delivery into the terminal record is created from the NFe details
7b
The operating company receives the transport company CTe XML and Pdf electronically. It is automatically linked to the appropriate NFes(s) as the CTe contains the Nfe Key access strings
7c
The user processes the CTe including adding a transaction code
7d
The delivery in details (quantity and date) are either received from the terminal and imported electronically or entered manually by the user
7e
The delivery in is completed. Certain data (physical quantity, terminal and stock no.) flow back to the Nfe. The unload quantity flows back to the CTe. If the contract is set to final weight at discharge, the contract split quantity is updated to the unload quantity
7f
The operating company receives an inventory return from the terminal which makes that quantity of goods available to be transferred out of the terminal.
7g
The operating company creates and issues an NFe to shipment as an exit. The goods are still in the ownership of the operating company but are not in its possession. Only the quantity which has been inventory returned may be selected. On the physical side a complete internal transfer out is created and stock assigned to it. An incomplete internal transfer in at the destination terminal is created.

Then steps 8, 9, 10 and 11 are executed at the destination terminal as above except the CTEs are flagged as trans-shipments

Types of Nota Fiscais
Type
Description
Purchase

This NFe is a purchase of goods. Usually received from the seller as an XML but may also be issued by the operating company in ‘Create NFe from a contract’. Purchase Nfes must have an NFe Tx code flagged as Purchase.
Purchase Nfes may be linked to a freight order
Contra Note
Sometimes when the grower is a private person, they issue a Nota fiscal that does not communicate to Sefaz. In this situation the operating company have to issue the entrance NFe to Sefaz using the number generated by the grower.
Contra notes are created in ‘Issue Note Fiscal’ and are recognised as such by having an NFe Tx code flagged as Contra Note
It’s also used to ascertain BA group (see model 4) and uses the destination instead of issuer of the entrance Nfes as grower. (add hyperlink)
Complementary
A complementary is where more goods are received from the grower than are in the entrance NFe so the grower sends a complementary for the difference. It’s processed in ‘review received’, the system recognises the NFe as a complementary by the selection of an Nfe Tx code flagged as ‘Complementary’.
In Review or ‘Issue an NFe’ after saving the entries the user is prompted for a contract (tranche header with the NFe branch, main cmy code and in the client family) to link to the NFe and appear in invoicing.
Deferral
(Grains)
The operating company is obligated to issue an image of the grower NFe but generating a new internal NFe No. and series. The purpose of this type is to postpone the tax (ICMS) retention to a later stage. This is a rule based on the CFOP and the intention to export the goods later on.

The NFe is received from the grower as an Xml and when a deferral Nfe TX code is entered in the review process the following occurs:
· Send to Sefaz set to Yes
· PIS and COINS CST set to blank
· Issuer information set to the branch
· Recipient information set to the client
· Series (B07) set to the default for the Commodity Code
· Nfe Number (B08) is retained but a new NFe Number will be generated and stored as a local NFe no. (nfe01_locnfeno). When the XML is sent to Sefaz and received back it will use the local Nfe No but for all other processes (nfe to ship, export etc) it will use the grower NFe no. (B08)
Model 4
(Grains)
In this scenario the operating company must issue the NFe to Sefaz with its own number and series because from the grower it’s not required to issue the NF electronically (Matto Grosso and Port Alegri still have this rule). They send a “paper Nota Fiscal” with a control number. Once the operating company receive it, they generate the NFe inserting the grower’s number in the BA group (BA18) and send to Sefaz so they are aware of the transaction and the possible tax implication. In this scenario there are two situations:
· Entrance NF with legal enforcement: The operating company in its NF to ship informs the social security number, NF number and serie (it shows in the XML only)
· Entrance NF without legal enforcement: The operating company issues an entrance nota fiscal relating the grower Number and series and the NF to ship will link the operating company’s NF number.

The biggest impact in Itas of model 4 as that it’s used to ascertain how to send the BA group on the XMLs when entrance Nfes are referenced (NFe to inventory, NFe to ship and Export Nfes).
It goes either as the model 4 group (<refNFP>, <cUF> (BA10, BA11) etc) or the referenced entrance Nfes in the <NFref>, <refNFe> (BA01, BA02) cycle.
It goes as model 4 group on export Nfes which are flagged as model4 and are not flagged as deferrals or contra notes.
It goes as model 4 group on NFe to inventory and NFe to ship which are flagged as model 4 and are not flagged as deferrals or contra notes and the client is a private person and it’s not a fertilizer contract

Also:
i) Defaults ‘Send to Sefaz’ to No
ii) Fills BA11, BA13, BA14, BA15 on entry of the client and property
iii) Is allowed when linking a purchase contract to Nfes when it doesn’t have a key access (A03)
NFe to a 3rd person
(Fertilizer)
This Nota Fiscal is issued when the product is sent straight to the final customer. I.e. the operating company buys fertilizer from the factory and the factory sends the product straight to a grower producer in Matto Grosso. This Nota Fiscal is normally received from the buyer or the transportation company.

Nfe to a 3rd person work in a similar way to a complementary, except the linking contract’s client family does not need to match the NFe client
Sale
Sale of goods. Always issued by the operating company in either ‘Export Nfe’, ‘Issue NFe’ or ‘NFe to Inventory/Shipment or Domestic Sale’
Refund
A refund Nfe is when goods are received but are rejected due to quality. Refund Nfes are created in the ’Refund’ option.
The users selects a branch and contract, then picks the NFe being refunded. The refund NFe is linked to the contract, issued and sent to Sefaz. Both Nfes are marked as refund and have zero available to move on.
The contract quantity is added back onto the header, its quantity is set to zero and its shipping status set to refund.
Break
May be used on a Break Nfe (add hyperlink)
A break is when a delivery is aborted because the truck ‘catches fire’ or similar. It is entered under ‘Issue NFe’ and is recognised as a break by selecting an Nfe Tx code flagged as ‘Break’.
On save the user must select an incomplete delivery in, the process completes the delivery into the terminal and at the same time writes off the stock. The Nfe is linked to the delivery no. and stock no.
Freight
A Freight NFe is also known as a CTe and has a different structure to the product Nfes
Freight Cancellation
Used to cancel a freight NFe.
The process is started from the freight NFe. On Save the CTe is flagged as cancelled
NFe to Inventory
The exit Nfe to place into up country storage
Inventory Return
The entrance to take out of up country storage
NFe to Ship
The exit Nfe to place into up port side storage for export
Symbolic Return
The entrance to take out of up port side storage
Export NFe
Sale for export. Is entered in the Export NFe option

Branches
The set up in Brazil is there is a head office and several branches. The branches correspond to the different states in which the company operates. Each branch is responsible for their own trades, position etc. and the all the Nota Fiscais will be the responsibility of a specific branch. See Company Settings (S01)/Branches.

Language
As most users of the Nota Fiscais system do not speak English, the screens may be presented in English or Portuguese. The presentation is determined by the language parameter of the user (maintained in Itas Navigator/User Preferences/Menu Settings tab). The translation to Portuguese is controlled by the operating company, mainly in menu option TRANSLATE in the gf company but also in the NFe and CTe definitions in BRCODES.

Currency
All Nfes and accounting transactions are in BRL, but contracts are often priced on CBOT in USD so currency conversion must take place. The conversion rates (curves) are given by the Brazilian Central Bank and are known as PTAX. The Fx curves vary by product and different curves may apply for NFe conversion and settlement, and a %age of the rate may be used for NFe, specially for fertilizers.
The curves are set up as currency codes in CDM, the rates entered in FXR and linked to products in PHYSCODES/Commodity Codes. The linked curves in PHYSCODES/Commodity Codes are the default but may be overridden per contract on the settlement tab (for settlements) and the Brazil domestic tab (for Nfes)

Menu options for Notas Fiscais
Menu option
Description
PROMAN
The main menu option used for managing the Nota Fiscais and physical stocks
BRCODES
Support codes for Nota Fiscais operation
PHYSCODES
Some extra columns in commodity codes and weigh t codes for Brazil domestic operation
BRREP
Specific reports for Brazil domestic operation
TRADE
New tab ‘Brazil Domestic’ for Brazil domestic specific items
CHARTERS
New tab ‘Brazil Domestic’ for Brazil domestic specific items


System Configuration for Notas Fiscais.
S01 -
The principle setting for Brazil Domestic operation is ‘S01…Company setup tab…Operations frame…’Brazil Domestic Operation’. This triggers the Nota Fiscal functions in PROMAN plus some variation to the screens as indicated in the rest of this section
{ctrl02_brazildom}
Other S01 settings of special note to Brazil domestic operation:
Setting
S01 Path
Usage
Brazil Operation
Company setup tab
/Operations frame
/No commas on numeric entry {ctrl02_nocommas}
In specific applications, entry of commas on numeric entry is blocked. In Brazil commas and dots are transposed to how they are in England so this helps to prevent erroneous data entry. For example if entering 12,25 instead of 12.25 the system will take that as 1225.
Currently only applied for Price, P/D and ROEs in TRADE, Fixations grid in TRADE, Costs and commissions grid in TRADE, Deliveries grid in PROMAN, NFe form in PROMAN, FX Rate in CHARTERS.
Branches
View button
/Physical Details
/Trade
/Parameters tab
/Operating Branches set to
‘as Branch’
{ctrl30_opstate=B}
The company (legal entity) operates several independent branches which are responsible for their own trades, position etc.
Branches are maintained as their own CLI records whose ‘Head of Family’ is ‘Client code for family’ from S01, known as MyCli.
When creating a contract in TRADE the buyer/seller is not defaulted but must be selected from the list of branches.
The branch is stored on the contract, stock and accounting transactions as well as the Nfes.
Settle Currency
View button
/Physical Details
/Main
/Tab 3
/Column 2
/Operate Currency settlement in TRADE
{ctrl30_settlement}
Contracts may be in USD or BRL, but all accounting transactions must be in BRL, so all USD contracts must have a settlement currency of BRL
     



NFe system parameters (PROMAN)
PROMAN specific system parameters may be viewed and edited in PROMAN, NFe button…NFe System Parameters

Field
Description
Tags or Text Ids on XMLs
This will normally be tags, however it can be set to text ids to help debug XMLs.
Weight code for freight orders
UOM for entering quantity in freight orders, usually KGs
Ccy for freight orders
Currency for Price per UOM entered in freight orders, usually BRL
XML Reception
Just on scheduler
Normally the XML are processed when any user goes into the Review process. However the Xml process can be single threaded through a scheduler by ticking here.

Itas weight code for KG
Used where UOM is always KGs such as NFe to ship
Folders locations
Folders for interfacing with Sefaz/MasterSaf and processing the XMLs and PDFs.
If the folder starts with a single \, the system will add the Itas drive to the front. E.g. if the itas path is C:\Itas and the entered path is \Nfe\RecToDo, it will use C:\Itas\Nfe\RecToDo
If it starts with a double \\, the system assumes a full UNC and uses it as entered

PHYSCODES/ Commodity codes
Extra columns which appear when ‘Brazil Domestic Operation’ is ticked are:
Column
Heading
Definition
NCM Code
i) When creating an NFe, the NCM code is filled from the entered Itas commodity code
ii) When receiving NFes from Sefaz, the NCM code on the XML is used to locate the Itas commodity code
Internal Code
When creating an Nfe, this entry populates the internal commodity code I02 tag <cProd>
PTAX Codes

NFe: BRL/USD rate applied to sale Nfes. Valid currency codes flagged as PTAX {cmy03_ptaxnfe}
PTAX Code NFe %age: The %age of the BRL/USD rate to apply to sale Nfes. {cmy03_ptaxnfeperc}

PTAX Code Sett: BRL/USD rate applied to settlements (PINVGL/SINVGL). Valid currency codes flagged as PTAX {cmy03_ptaxsett}
Fertilizer Style
Fertilizer trades are identified by this column. They act differently in some situations to grains trades:
i) For fertilizers the tranche headers are allocated without splitting whereas for grains allocating tranche headers will split the contract leaving the tranche headers open
ii) When reviewing the Nota Fiscals received, for fertilizer we just link the NFe to a contract and don’t go on to create the Nfe to ship.
iii) In BRREP/Trade Report this flag is used to differentiate grains and fertilizer contracts for inclusion/exclusion on the Grains /Fertilizer report styles




Weight codes
Extra columns which are requiredr when ‘Brazil Domestic Operation’ is ticked are:
Column
Heading
Definition
UOM for NFEs
When receiving NFes from Sefaz, the Uom (I09) is entered by the issuer. This column is used to locate the Itas commodity code.
N.B. different issuers use different UOM codes, for example metric tons may be received as t, ton, 02 or mt.


BRCODES


/ CFOP Codes
One of the key data fields on the NFe is the CFOP code (Código Fiscal de Operações e Prestações). It describes the type of business transaction containing information on the goods’ origin as well as the type of operation, such as sales, returns, stock transfers, or services. The list of CFOP codes in Itas is imported from the standard list published by the Brazilian authorities.

Additional columns added for Itas control are:
Column
Heading
Definition
Linkage of CFOPs
An NFe received will be from the issuer’s point of view (for example a sale of goods will have a sale CFOP). So to use that as an entrance NFe, the operating company has to retain the NFe as received, and then generate an NFe from the company’s point of view (for example a purchase of goods will have a purchase CFOP)
This is done automatically in the reception process by using linkage of CFOPs column. Using above CFOPS:
i) If we receive an NFe with CFOP 1101, Itas will automatically generate an entrance NFe with CFOP 5101 and flag the received NFe as moved on and will not be used in any subsequent processes.
ii) If we receive an NFe with CFOP 1102, Itas will automatically generate an entrance NFe with a blank CFOP (so the CFOP must be entered in the review process) and flag the received NFe as moved on and will not be used in any subsequent processes.
iii) If we receive an NFe with CFOP 1118, Itas will use that Nfe as the entrance NFe.
Priority
These are Nfes which have been received with export intention so will not attract taxes such as ICMS if the goods are exported. When issuing symbolic return or export Nfes, entrance NFes flagged as priority will be presented first on the selection grids.
Freight
Freight NFes (CTes) may only have a CFOP flagged as freight, a non-freight CFOP may not be entered on a CTe.
Freight Cancellation
Freight NFes (CTes) are cancelled by a freight cancellation NFe, The CFOP entered on a freight cancellation NFe must be flagged as freight cancellation
Cfop Active
Only CFOP codes flagged as active may be used in the system. At the time of writing there are 107 CFOP codes of which only 86 are active.


/NCM Codes
NCM are the product codes and description. The list of codes in Itas is imported from the standard list published by the Brazilian authorities.
Additional columns added for Itas control are:
Column
Heading
Definition
Ncm Active
Only NCM codes flagged as active may be used in the system. At the time of writing there are 9,142 NCM codes of which only 47 are active
Uom
When creating an NFe from a contract, the Uom column content fills the Uom field in the NFe (I09)
IPI Applies
IPI is a federal tax which applies to industrial products only. So the product code (NCM) tells us whether to include the IPI section on the NFe form and XML.

/NFe Transaction Types
The NFe transaction type (NFe Tx Code) basically performs the same role as the CFOP, however CFOP may not be used as the NFe control as the CFOP codes are set by the Brazilian authorities and they may have the same code for 2 operations which the company may which to control in different ways.
The NFe transaction type is mandatory and must be entered on all NFes issued and received.

Those items with a blank entry in the control column are for information only
Column
Heading
Definition
Control
Transaction Code
Unique code, up to 6 characters
 
Description
Description
 
Active
Ticked if may be used in the system
 
Cmy (Part 1) List
If filled, only NFes with one of entered Cmy part 1 codes may have this transaction code. Typically some codes may only be used for fertilizers and some for grains (corn and soy beans)
Y
In/Out
States whether the NFe is an entrance (entrada) or exit (saida). Defaults value of B11.
Y
Accounting
Not used, information only
 
Fiscal
Not used, information only
 
Inventory
(Physical)
Not used, information only
 
Cash
Not used, information only
 
Purchase
Indicates a purchase NFe
Y
Contra Note
Indicates a Contra Note
Y
Purchase
Devolution
Not used, information only
 
Sale
States that the NFe is a sale of goods. See Sale Nfe
i) When creating an NFe from a sale contract, only NFe Tx Codes flagged as sale may be selected.
ii) Only NFes flagged as sales are included in ‘Link Nfes to Contracts/Sales’
iii) Nfes flagged as purchase prompt for the freight order
Y
Sale
Devolution
Not used, information only
 
Refund
May be used on a refund Nfe
Y
Complementary
May be used on a complementary NFe
Y
Break
May be used on a Break Nfe
Y
Break Inv
As per break NFe but additionally writes of stock
Y
Freight
May be used on a freight Nfe (CTe)
Y
Complementary
CTe
Is in addition to existing CTes, so may link to an NFe already linked to a CTe
 
Freight Cancellation
May be used on a freight cancellation NFe
Y
NFe to Inventory
May be used on an NFe to Inventory
Nfes flagged as Nfe to Inventory prompt for the freight order
On transhipment Nfe to Shipments, the process drives from Nfes to inventory which have arrived at the terminal
Y
NFe to Ship
May be used on an NFe to Shipment
Nfes flagged as Nfe to Shipment prompt for the freight order
On symbolic returns and export Nfes, the process drives from Nfes to shipments which have arrived at the terminal
Y
Symbolic Return
May be used on a symbolic return NFe
Y
Inventory Return
May be used on an Inventory return NFe
 
Priority
Not used, information only
 
Export
May be used on an Export NFe
Y
Model 4
May be used for model 4 Nfes
Used to ascertain how to send the BA group on the XMLs when entrance Nfes are referenced (NFe to inventory, NFe to ship and Export Nfes).
It goes either as the model 4 group (<refNFP>, <cUF> (BA10, BA11) etc) or the referenced entrance Nfes in the <NFref>, <refNFe> (BA01, BA02) cycle. (add hyperlink)
It goes as model 4 group on export Nfes which are flagged as model4 and are not flagged as deferrals or contra notes.
It goes as model 4 group on NFe to inventory, NFe to ship which are flagged as model 4 and are not flagged as deferrals or contra notes and the client is a private person and it’s not a fertilizer contract

Also:
i) Defaults ‘Send to Sefaz’ to No
ii) Fills BA11, BA13, BA14, BA15 on entry of the client and property
iii) Is allowed when linking a purchase contract to Nfes when it doesn’t have a key access (A03)
Y
Deferred
May be used on a deferral NFe
Y
Nfe for a 3rd Person
May be used on an NFe for a 3rd person
Y
CFOP Codes
Only one of the entered CFOPs may be used on this NFe TX code. if only one CFOP is entered , then it’s defaulted when creating NFes
Y

/Freight Product Types
Validation list for product being transported (X28)


/Fiscal additional information (Z02)
The addition information rows of the NFe (Z02 and Z03) are often filled with standard clauses in various combinations. To avoid the user having to enter the same text multiple times they may select the standard clauses as set up here.
They are selected in the NFe form on the Z02 and Z03 rows and in the freight order on the destination tab, memo button.


/FETHAB and FACS Rates
FETHAB and FACS are withholding taxes on payments to individual producers as opposed to companies and applies to specific states (e.g. Mato Grosso). The tax is charged on the Nota Fiscal quantity.
Column
Heading
Usage
Cmy code
Principle cmy codes which the rates apply to
Start Date/
End date
Date range when the rate is active. Compares to the Nfe issue date and invoice date
UPF price
Commodity price. This changes quite frequently.
Fethab
%age of UPF
%age applied for Fethab
Facs
%age of UPF
%age applied for Fethab

For example, UPF of 115.43, FETHAB % of 9.6, NFe quantity of 50 t;
FETHAB value = 50 X 115.43 X 9.6 / 100 = 554.06 BRL.


/General Parameters
Most entry types in BRCODES are a list of items presented in a grid. However some items are individual parameters, those are prompted in General Parameters.
Field
Usage
FUNRURAL Standard %age
FUNRURAL rate for those without a court order i.e. INSS plus SENAR e.g. 2.30% as of May 2015
FUNRURAL %age for those with a court order
FUNRURAL rate for those with a court order i.e. just SENAR e.g. 0.20% as of May 2015
FUNRURAL G/L
Account
G/L Account for FUNRURAL withholding tax. Used in PINVGL
FETHAB/FACS G/L
Account
G/L Account for FETHAB/FACS withholding tax. Used in PINVGL


/Nota Fiscal Definition (Product)
As explained in the overview, Nfes are communicated between the operating company and Sefaz by XML files. The structure of the XML is strictly controlled by Sefaz and must be adhered to by all members. The XML structure does change from time to time.
The structure of the XML is defined here. The definition is used:
· To create the XML files to send to Sefaz
· To read the XML files received from Sefaz
· To display the NFe details on the NFe form in PROMAN


Column
Heading
Usage
Text Id
This column is the main control for the NFe in Itas.
· If it’s non blank and does not start with ‘loc’ it’s a Sefaz field and may go onto the XML. The format is usually a capital letter followed by one or more numbers such as A01, B09
· If it starts with ‘loc’ it’s a local Itas field and is not sent to Sefaz on the XML.
· If it’s blank, it’s just for showing blank lines on the NFe form.

The Sefaz fields are unique in the list and so may be used as the control.
the text id is also the database column name, for example text id A01 is stored in database column nfe01_a01, text id locCli is stored in database column nfe01_loccli.
The row number in the grid will be the row number of the row on the NFe form.
Text 2 Id
Text2 Id is used for sequencing the XMLs. Usually it follows the Text Id sequence but on occasion the tags must be sent in a different order
XML Tag
The tag to go on the XML.
The tags are not unique in the list, for example there are 4 ‘CST’ tags, one for each of 4 tax types (ICMS, IPI, PIS and COFINS) with corresponding text Ids of (N12, O09, Q06 and S06 respectively) . In the XML we know which one it is by the hierarchy. For example
N12 is NFe\infNFe\det\prod\imposto\ICMS\CST and
O09 is NFe\infNFe\det\prod\imposto\IPI\IPINT\CST
English Description
Describes the row in English. The description shown on the NFe form when the user is not set up as Portuguese
Portuguese Description
Describes the row in Portuguese. The description shown on the NFe form when the user is set up as Portuguese
Show on Form
Tick if this row will appear on the NFe form. Some items are required for the XML but are not of interest to the users
On Xml
Tick if this item is on the XML, generally text IDs of the format A01
St of Group
Tick if this item is a group header i.e. does not contain any data. For example all the items in the hierarchy are ticked as start of group NFe, infNFe, det, prod, imposto and ICMS whereas the data items itself CST is not.
This column gives the structure of the XML.
End of groups
List of text ids where the group is closed after this entry.
Note, the same row is not ticked as start of group and has an entry for the end of a group. See Hierarchy of XML
Header
If ticked this row shows on the NFe form as a header i.e. double height in blue.
Prompt Type
States how an entry is made on the row when editing the NFe. Options are:

· Drop down: Prompted as a dropdown. List of valid items is maintained as a button in the ‘Drop Down’ column when not in Edit mode on the main grid.
· Fixed: Not prompted, value is always entry in the ‘Fixed Value’ column
· No: May not be edited
· Other: Is edited under program control with validation given by the ‘Text Id’ column. For example Text Id ‘locCli’ allows entry and Ctrl+F and validates against a valid client code.

Page 31 of 32
Mand.
Tick if item is mandatory. I.e. Save will be blocked if the item is blank.
NB only enforced in Nfes created by the operating company.
Mask
Validation mask for entry. Options are:
· ? – free format
· F – Floating point number, decimal places is not validated
· D – Decimal, a number with decimal places validated
· I – Integer
· 3 – a date
Dec. Places
Maximum number of decimal places allowed if mask is set to D.
Displays number to this decimal places when mask set to D
Max Length
Maximum size for character values (non-numeric) on the XML
Fixed Value
Fixed value for this row when prompt type is ‘Fixed’
Other Info
If a number, the height of the row on the form. For example additional information (Z02 and Z03) are set to 1500.
If non numeric, just free format information
NFe Transaction
Types
If non blank, the row will only be shown on the NFe form if it has one of the entered NFe Tx Codes.
Drop
Down
The list of valid entries for rows whose ‘Prompt type’ is set as ‘Drop down’. This is a button column, click in the cell when not in edit mode.
   


/Nota Fiscal Definition (Freight)
Same approach as for Nota Fiscal Definition (Product) and with the same grid columns, but used of freight NFes (CTes)

/View next Nfe Numbers
NFe numbers (B08) are generated by the issuer and have to be sequential. The issuer will be the branch and the number sequences are by series. The series is given by the branch/commodity.
The option shows the series and next NFe number which will be issued. The user may change the next number and add new lines for example when Itas takes over from an existing system and next number must be in sequence.
An NFe may not be created If no entry exists in this table


/Default CST Codes
The CST codes define how tax is applied and each of the 4 state taxes (ICMS, IPI, PIS, COFINS) have their own CST code. When editing an NFe the CST codes will be defaulted from this table. The Z03 text swill also be appended to Z03 as the CST is defaulted.
N.B. If there’s a linked freight order with CSTs defaulted from that, these CSTs will not be defaulted and a warning displayed

CLI
2 fields on the main CLI form are of specific application in Brazil:

Private Person
The Private person tick-box tells us this is a private person as opposed to a company with the following implications:
· Their tax code will be a CPF instead of a CNPJ (E03 instead of E02)
· FUNRURAL tax will apply
· Property must be entered in the NFe form
Head of Family
Many counterparties in Brazil have multiple branches as they operate in multiple states and often the contract and NFe will belong to different clients but in the same family. The head of family allows the different clients to be grouped.
The same system applies to branches of the operating company. The head of family if the ‘Client Code for Company’ set up in S01:
And branches are those clients with that as their head of family:



When operating Brazil Domestic some addition fields are prompted in CLI on the miscellaneous tab and on the contacts form:

Client has court Order and Court order start and end date:
Used to apply FUNRURAL tax. If the client has an active court order as at the NFe issue date they do not have to pay INSS, just SENAR.
House No.
Fills house number rows (C07, E07, F04) when issuing an NFe.
City
Fills city code rows (B12, C10, E10, F07, X17) when issuing an NFe

The contacts screen actually represents properties where the delivery will take place from. The property must be entered on Nfes whose client is a private person



Province
Fills addresses state acronym row (E12) when issuing an NFe.
City
Fills addressee city code row (E10) when issuing an NFe.
State Tax code
Fills addressee state tax code rows (E17, B15) when issuing an NFe.
FETHAB/FACS applies to this client
States whether Fethab/Facs applies to Nfes with the contact (property)

TRADE
When operating Brazil domestic, the tab ‘Brazil Domestic’ is shown on the main TRADE screen and extra columns are shown on the price fixing screen. Also required is the settlement tab. See Settle Currency.
Export intention
Indicates the product is intended to be exported
Barter agreement
Indicates the trade will be settled as part of a barter agreement typically a sale of fertilizer to and a purchase of grain from the grower
Tr Marg ROE
Rate of Exchange to the contract currency for Trader Margin calculations
Expressed as Multiplier i.e. always USD/BRL e.g. 3.75 (1 $ = 3.75 Real)
PTAX rates
BRL/USD rate used on NFes, for example in the export NFe when the sale contract is in USD.
Defaults from the commodity, or may be overridden for this contract
Bank
Bank and account to pay. Used as the default bank a/c invoicing
Fertilizer
Items important for the management of fertilizer trades
Create freight order
Available on tranche headers not linked to a freight order already. Clicking will launch the Freight order creation process in PROMAN pre-filling the contract details
Traders’ margin
Calculated from trade data, currency conversion uses the FX rates entered on the tab

The price fix screen has 2 extra columns

Flat price
The flat price is expressed in the contract currency and UOM, this is the price paid. On entry the fixation price is calculated as Flat price - Premium - Outport premium – Costs, converted to the market currency and UOM using extrapolated forward ROEs as at the trade maturity.
On price fix complete, the average flat price becomes the contract price.
Fixation price
Calculated from the flat price, expressed in the market currency and UOM
Market price
Market price at date of fixation, used in the trader’s margin

CHARTERS
When operating Brazil domestic, the tab ‘Brazil Domestic’ is shown on the main CHARTERS screen
FX Rate
Is used for showing the USD value of the cargo in the export NFe
Export Registration grid
Is used in the export Nfe. Selection of a charter and export registration is mandatory for export. When the export Nfe is completed the sale contract is split and assigned to the charter. The Linked export NFe Id(s) and used quantity are filled by the export NFe

Processing the XML
The system knows the structure of the XML from the entries in BRCODES/Nota Fiscal Definitions
The hierarchy of the Xml is given by the 2 columns ‘Start of group’ and ‘End of Groups’
From the extract of the issuer information below we can see emit (C01) and enderEmit (C05) are start of groups. Then it’s all data until the enderEmit (C05) group is closed after sending xPais (C15) and the emit group (C01) is closed


Receiving XML
The XMLs received from Sefaz are processed when a user goes into the ‘Review Notas Fiscais Received’ option. It reads files in the ‘Received from SEFAZ’ folder nominated in NFe System parameters. If an XML is found it’s moved from the ‘Received from SEFAZ’ folder to the ‘Being processed by Itas folder’ and that thread is the only one which will process that file. This prevents any deadlock issues if multiple users go into the review process at the same time.
XMLs may also be processed on a scheduler. There is an NFE system parameter to just process them on the scheduler so the Review process will not process the XMLs.
The content of the XML is stored in the database in the nfe01 table. The approach used to extract the XML data is to load the file into the Microsoft Xml object and then drive from the NFe definition in the sequence of Text2 Id, building the full XML key for each data item.
A data item is defined as a row in the NFe definition which is flagged as ‘On Xml’ but is not flagged as ‘Start of Group’. The key is built up from the rows of the NFe definition which are flagged as ‘Start of Group’. In the above extract xLgr (C06) is in the groups infNFe (A01), emit(C01) and enderEmit (C05), so the full Xml key is //infNFe//emit//enderEmit//xLgr. The value of the key is extracted using the ‘selectSingleNode’ method of the Xml object.
The value is then stored in the database whose column matches the text id, so using the same example, xLgr has a text id of C06 so is stored in database column nfe01_c06.
Therefore the NFe definition set up in BRCODES must match the database columns available on the nfe01 table.


There are a few exceptions to this approach:
1) Text Ids in the NFe definition starting with BR, PR and MS are ignored as they are to do with the XML layout and SEFAZ response, though they could be secured if required.
2) The start of the ICMS tax group. This can have 5 values: ICMS00, ICMS20, ICMS40, ICMS51 or ICMS90 depending on the ICMS CST code. But in the NFe definition we have one generic row ICMSxx, so on import ICMSxx is replaced with ICMS20 (for example) when building up the full Xml key of the items below it.
There is a similar mechanism for the other 3 tax types IPI, PIS and COFINS:
· IPITribxx is replaced with IPITrib or IPINT
· PISAliqxx is replaced with PISAliq, PISQtde, PISNT or PISOutr
· COFINSAliqxx is replaced withCOFINSAliq, COFINSQtde, COFINSNT, COFINSOutr

3) Usually the groups and data are on different lines in the XML, however at the start the file the group <infNFe> and 2 data items <Id) and <versao> are all on one line e.g.
<infNFe Id="Key897" versao="3.10">
So these 3 are processed explicitly by using .SelectSingleNode object for the group (//infNFe) to set the node and then then using the .Attributes.getNamedItem method to get the values for Id and Versao.
4) Similar to the <infNFe> tag, <Det> as the group and <nItem> as the data appear on the same line so they are also processed explicitly. This is because an XML can contain more than one product section. This is very rare and only occurs for fertilizers. Itas does not handle multiple product sections at the time of writing.

Was this helpful?
Thanks for your feedback

Recently viewed