How dalbaengenharia/lan-amento-notas-medi-o works
This repository automates accounts-payable invoice processing in Protheus: it selects branches and pending invoices, checks each document against its server-hosted PDF, then enters invoice, tax, and related details and reports outcomes. The main control path is visible in the sampled entry point and loop; the invoice routines and CTE handling are only partially sampled, so their internal steps are not expanded. The graph also includes the documented database lookup and AI-assisted tax/document checks as distinct capabilities.
Main entry points: lancamentoBase.py Base invoice posting · LOOP.py Branch processing · lancar_imposto.py Tax entry · main.py Application entry
Components 23
Automation runtime
- Application entry
main.py - Protheus browser tools
Protheus_Biblioteca.py - Branch processing
LOOP.py - Invoice cleanup
limpeza.py
Document validation
- Document verification
verificar_notas/texto_notas.py - PDF retrieval
verificar_notas/consultar_notas/consultar_notas_pdf.py - LLM requests
verificar_notas/consulta_llm/consulta_llm.py
Invoice posting
- Invoice workflow
LancarNotas.py - Base invoice posting
Lancamentos/lancamentoBase.py - CTE handling
Lancamentos/lancamento_cte.py - Tax entry
Lancamentos/lancar_imposto.py - Tax mapping
Lancamentos/mapeamento_impostos.py - ERP table helpers
tabelas/tabelas_protheus.py - Posting reports
Lancamentos/relatorio.py - Cent adjustment
Lancamentos/ajuste_centavo.py
Data lookups
- Branch and tax lists
Listas/lista.py - Pending invoice query
ConsultaBanco/consultaGeral.py - Municipality lookup
ConsultaBanco/consulta_municipios.py
Other components
- Operator
- Protheus ERP
- Document file share
- Gemini API
- Protheus database
Connections 27
- Operator → Application entry: starts
- Application entry → Protheus browser tools: uses browser tools
- Application entry → Protheus ERP: opens and logs in
- Application entry → Branch processing: starts processing
- Branch processing → Branch and tax lists: reads branches
- Branch processing → Pending invoice query: requests pending invoices
- Pending invoice query → Protheus database: queries
- Branch processing → Protheus ERP: selects and reviews invoices
- Branch processing → Invoice workflow: dispatches invoice
- Branch processing → Invoice cleanup: runs cleanup
- Invoice cleanup → Protheus ERP: cleans invoice state
- Invoice workflow → Base invoice posting: runs posting
- Base invoice posting → Document verification: validates document
- Document verification → PDF retrieval: requests PDF text
- PDF retrieval → Document file share: lists and downloads PDFs
- Document verification → LLM requests: sends document text
- LLM requests → Gemini API: requests analysis
- Base invoice posting → CTE handling: handles CTE
- Base invoice posting → Tax entry: enters taxes
- Base invoice posting → Cent adjustment: adjusts cents
- Base invoice posting → Posting reports: records outcomes
- Tax entry → Document verification: requests tax extraction
- Tax entry → Branch and tax lists: uses tax codes
- Tax entry → Tax mapping: maps tax fields
- Tax entry → ERP table helpers: reads and edits grids
- Base invoice posting → Protheus ERP: enters invoice details
- Municipality lookup → Protheus database: queries municipality