English EN
WhatsApp

Cases

Systems in production and LVFN’s own products

Deliveries in critical operations, described by industry and connected to the TOTVS Protheus ERP (clients are not identified), plus the products LVFN builds for itself. Select a case to see the problem, what was built and the result.

Clients · ERP10

Mobile sales platform Agribusiness

01 [Agribusiness] In production

Mobile sales platform integrated with Protheus

From the sales rep in the field to the invoiced order

  • 37sales reps and supervisors on the app
  • 3levels of discount approval
  • 22data sources synced with the cloud
Context

Sales reps, supervisors and managers at the agricultural unit needed to handle pre-sales, negotiation and approvals on their phones, with the same data as the ERP. The B2B channel also needed products, prices and credit coming from Protheus.

What was built
  • Event queue triggered from about 20 points in the ERP, with central routing of 22 data sources and cloud synchronization (full and incremental load)
  • Pre-sales and negotiation in the app, with 3-level discount approval: supervisor, coordinator and manager
  • Pre-sales engine in the ERP: price, credit, approval limits, plus automatic release to logistics and invoicing with bank collection batch (borderô)
  • CRM with its own master data and automated routines for customer deactivation and reactivation
  • B2B e-commerce: products, price lists, credit and orders received via webhook
  • Git rollout and training for the client's IT team
Result

Sales force, pre-sales and the B2B channel run on the same Protheus data: 37 sales reps and supervisors use the app, and orders enter the ERP without re-keying.

Benefits for the client
  • The order starts on the phone and enters the ERP without re-keying or parallel spreadsheets
  • Discounts approved by the supervisor, coordinator or manager wherever they are, without stalling the negotiation
  • Reps negotiate with up-to-date price, credit and customer data from the ERP, avoiding sales that would later be blocked
  • App, B2B channel and ERP working from a single data source
Technologies
TLPPEvent queueRESTWebhookFirebaseMVCJobsGit

02 [Agribusiness] Delivered and validated

A 4,900-line legacy routine converted to MVC with AI, in 3 days

From a single legacy file to 6 MVC source files

  • 3 daysto convert and validate
  • 15 dayswas the estimate with the traditional method
  • 4,900lines in the legacy file
Context

The load-routing routine, a legacy source file of about 4,900 lines built on an old browse screen, had to move to the MVC standard of the ERP (TOTVS Protheus) without changing its behavior. With the traditional method, the estimate was about 15 working days.

What was built
  • AI-assisted reading of the legacy source to map rules, validations and writes before rewriting.
  • New MVC screen, with a master-detail form and the same menu as the original routine.
  • Business rules, validations and integrations split into TLPP classes instead of a single source file.
  • Human review of the generated code and full validation of the routine.
Result

Conversion delivered and validated in 3 days: 6 TLPP source files in place of a single legacy file. The estimate with the traditional method was about 15 days.

Benefits for the client
  • Routine on the ERP’s current standard, easier to maintain and evolve
  • Rules separated by responsibility instead of a single 4,900-line file
  • Shorter lead time, with the same human review
Technologies
MVCTLPPAI-assistedReverse engineering

03 [Software consultancy] Evolving since 2021

A REST API that opens the ERP to apps and other systems

From a closed ERP to an API organized by business area

  • 130versioned deliveries while building it, in 2021 and 2022
  • 140+source files created, in ADVPL and TLPP
  • 98REST endpoints in files from that phase, still in the API
Context

Project done in partnership with a consultancy: its own REST layer over the ERP (TOTVS Protheus), organized by business area, to be consumed by apps, portals and other systems. Lucas started the repository in June 2021 and led its creation until 2022.

What was built
  • Project structure and service pattern, from the first commit until the handover to the consultancy team
  • Read and write endpoints by area: purchasing, billing, finance, fixed assets, distribution and logistics, and transport management
  • Shared helper services and specific endpoints, beyond the standard ones of each area
  • Indicator (KPI) endpoints
  • Versions in ADVPL (.prw) and in TLPP, with annotation-based routes
Result

The consultancy team has maintained and expanded the API since 2023, with the latest update in November 2026. Of the current endpoints, 98 are in source files created in the first phase, in 2021 and 2022.

Benefits for the client
  • New integrations start from ready-made endpoints by area instead of starting from scratch
  • API organized by ERP area, easy to navigate and to extend
  • Code under version control from the first commit, which made the handover to another team possible
Technologies
TLPPADVPLRESTGit

04 [Professional association] In production

Annual fee billing system for a professional association

From fee calculation to the registered bank slip and installments

  • 2banks with registered bank slips
  • Gatewayfor installment payments
  • Since 2022in production and evolving
Context

The annual billing of members had to be issued from the ERP, with a boleto registered with the bank, an installment payment option and tracking within Protheus.

What was built
  • Generation and registration of boletos with two banks, with control of the bank reference number (nosso número) and collection batch (borderô)
  • Payment gateway integration for installments, with automatic generation of the installment receivables
  • Receivables recorded through the standard automatic routine of the finance module, within the transaction
  • Scheduled jobs and REST endpoints for calculating and querying billing fees
Result

Annual billing runs inside Protheus, from the annual fee calculation to the registered boleto and the installments, with continuous evolution since 2022.

Benefits for the client
  • Annual billing generated in batch by the ERP, with no manual assembly receivable by receivable
  • Installments through the gateway, with the receivables created automatically in finance
  • More payment options for members, without controls outside the system
  • All billing traceable within Protheus, from calculation to boleto
Technologies
TLPPRESTRegistered boletoPayment gatewayJobsMsExecAuto

05 [Waste management] In production

Waste manifest integrated with the environmental agency and the scale

Manifest and weighing checked by the ERP itself

  • 3integrated systems: ERP, environmental agency and scale
  • 2scales read directly, with no manual notes
  • MTRwaste manifest issued, received and cancelled through the state API
Context

Every waste load needs a manifest in the environmental agency's system, and the declared weight must match what enters the landfill. Doing this outside the ERP opens the door to double data entry and discrepancies.

What was built
  • Client for the state MTR API: generate, receive and cancel manifests and retrieve the PDF
  • Weight read directly from the scale over a TCP connection
  • Automatic cross-check between the scale weight and the manifest weight, blocking cancelled manifests
  • Monitoring screens and email error alerts to IT
  • Expansion to a second scale
Result

Manifests and weighing are now cross-checked by the ERP itself, reducing the risk of inconsistencies with the environmental agency.

Benefits for the client
  • Manifest issued from the ERP, without entering the same load twice (in the ERP and in the agency's system)
  • Weight read directly from the scale, with no manual notes
  • Weight discrepancies blocked on the spot, before they become a problem with inspectors
  • History of manifests and weighings in the ERP itself, ready for audit
Technologies
TLPPRESTGovernment integrationTCP/SocketMVC

06 [Manufacturing] In production

Digital signature of the DANFE receipt stub

From the issued invoice to the signed receipt, with no manual steps

  • APIof the signature platform: invoice upload and signed PDF back
  • Webhookcallback with the status of each signature
  • 3jobs: sending, checking and cancellation
Context

The company needed to collect the recipient's signature on the DANFE receipt stub digitally, tracking each step and archiving the signed document within Protheus.

What was built
  • Automatic upload of the DANFE to the signature platform and download of the signed PDF to the Protheus Knowledge Base
  • QR Code printed on the receipt stub with the signature link
  • REST callback webhook with body and field validation
  • 3 jobs with a single dispatcher: sending, signature check and cancellation when the NF-e (electronic invoice) is cancelled
  • MVC monitor with status and actions to reprocess, check and cancel
  • Entry point to display the signed PDF from the invoice
Result

The signature cycle runs without manual intervention, with history per invoice, status visible in the monitor and the signed document available in the ERP itself.

Benefits for the client
  • Digital proof of delivery, without depending on the paper stub coming back with the driver
  • Status of each signature visible in the monitor, without chasing it by phone
  • A cancelled invoice cancels the signature automatically
  • Signed proof available right away for collections or disputes
Technologies
TLPPRESTWebhookQR CodeJobsMVCEntry point

07 [Private health insurance] In production

ANS regulatory accounting records generated by the ERP

Regulatory obligations generated from the same accounting data

  • 9reports and annexes in the regulator’s format
  • 9REST services for the operator’s workflow
  • PESLprovision for outstanding claims, with segregation
Context

As a health plan operator, the company must keep auxiliary accounting records in the format defined by ANS (Brazil's private health insurance regulator) — premiums, claims events and provisions — reconcilable with the accounting books.

What was built
  • Auxiliary records of premiums issued, received and cancelled
  • Records of events and claims and of the provision for events to be settled (PESL)
  • Annexes for balance aging, PESL segregation and indemnifiable events
  • 9 REST services for the operator's BPM: contract adjustment, financial entries and approvals
Result

Regulatory accounting obligations are produced by the ERP from the same data as the accounting books.

Benefits for the client
  • Regulatory records generated from the same data as the accounting books, reducing reliance on parallel spreadsheets
  • Less risk of discrepancies between the accounting books and what is reported to ANS
  • Approvals and adjustments from the operator's workflow integrated with the ERP through REST services
Technologies
ADVPL/TLPPRegulatory reportsRESTBPM

08 [Finance] In production

Bank and financial integrations via API

Bank slips registered directly with the bank and advances posted without typing

  • 2APIs: bank collection and advance payments
  • 5bank-slip operations: register, query, change, settle and protest
  • OAuth2 + mTLSauthentication required by the bank
Context

Two finance processes needed to move away from files and manual entry: registering boletos through the bank's API channel and posting advance payments (PA) coming from a partner system.

What was built
  • Collection API client with OAuth2 and SSL/mTLS, in layers (application, infrastructure and mapping), with token caching
  • Registration, query, due date change, write-off and protest, with a smoke test script for connection and authentication
  • Advance payment REST API with native REST Server authentication, validation of the PIX code (BR Code) with CRC16, and standardized errors
  • Protection against duplicate posting, with recording through the standard Accounts Payable routine
Result

The boleto is registered directly with the bank from Protheus, and advance payments enter Accounts Payable without manual entry, with the finance validations preserved.

Benefits for the client
  • Boleto registered instantly through the bank's API, without remittance and return files in this flow
  • Advance payment posted without manual entry, already validated at the source
  • Protection against a payment being posted twice
  • Strong authentication (OAuth2 and digital certificate), meeting the bank's requirements
Technologies
TLPPRESTOAuth2SSL/mTLSPIXMsExecAuto

09 [Agribusiness] In production

Yard and gatehouse control integrated with Protheus

Gate, display and loading driven by the ERP

  • 6MVC registers
  • SOAP + RESToutbound and return with the access system
  • Timeof each vehicle in the yard tracked by a scheduled job
Context

The gatehouse and loading points were controlled by a dedicated access system. Opening the barrier, display messages and the loading flow needed to be driven by what was already in Protheus.

What was built
  • SOAP/WSDL communication layer with a base class and dedicated operations: barrier opening, message display, vehicle and driver registration, tickets and flow switching
  • Inbound REST API for asynchronous callbacks from the access system
  • 6 MVC master-data screens: flow, message, control point, loading point, tags and ticket
  • Schedule to control ticket time in the yard
Result

The gatehouse and loading points now operate from Protheus data, with their own master data and automated time control.

Benefits for the client
  • Barrier, display and loading flow driven by ERP data, without a parallel operation
  • Time each vehicle spends in the yard controlled automatically
  • A single registry of vehicles and drivers
Technologies
TLPPSOAP/WSDLRESTMVCSchedule

10 [Logistics / retail] In production

Cycle counting and shipping verification with RFID

Inventory and shipping by RFID reading, tracked in the ERP

  • 2MVC monitors: inventory and shipping
  • RESTinbound endpoint for RFID readings
  • Jobsthat consume the RFID system API
Context

Cycle counting and shipping verification started being done with RFID reads, and those reads needed to reach Protheus and be tracked within the ERP.

What was built
  • Inbound REST API to receive data from the RFID system
  • Jobs that consume the RFID system's API
  • 2 MVC monitors to track cycle counting and shipping verification
Result

Inventory and shipping verification use RFID reads integrated with Protheus, tracked in dedicated monitors.

Benefits for the client
  • RFID-based inventory, faster than counting item by item
  • Shipping verification with less chance of picking errors
  • Reads tracked within the ERP, without checking another system
Technologies
RESTJobsMVC

Own products4 These are not client projects. Each one shows its real status.

11 [Apps] In final development

Cross-platform app: macOS, Windows, Linux, phone and tablet

A single codebase for all three systems, with phone and tablet connected

  • 3systems: macOS, Windows and Linux
  • 3languages on every screen
  • PWAfor phone and tablet
Context

One of LVFN’s own products had to work the same way on macOS, Windows and Linux, and also be followed from a phone. Rebuilding the app for each system would multiply cost and defects.

What was built
  • Desktop app with a single codebase for macOS, Windows and Linux: native Rust core (Tauri 2) and a React and TypeScript interface.
  • Phone and tablet app, installable from the browser, that follows the computer remotely and alerts you when something needs attention.
  • Local database (SQLite): the data stays on the user’s computer.
  • Voice dictation, transcribed on the computer itself or through a cloud API.
  • Every screen in English, Portuguese and Spanish.
  • An automated test for every fix and automated checks before any change goes into the product.
Result

In final development. It is here as engineering proof, not as a client result.

Technologies
RustTauri 2ReactTypeScriptSQLitePWA

12 [SaaS] Built · in staging

Subscription SaaS platform: accounts, licensing and recurring billing

From account creation to recurring billing

  • 5modules: accounts, licensing, billing, dashboard and downloads
  • Card + Pixwith automatic reconciliation
  • 2FAand sign-in with Google, Microsoft or GitHub
Context

Selling software by subscription takes more than the software: customer accounts, billing that renews itself, control over who can use it and a dashboard where customers solve everything without support.

What was built
  • Accounts with sign-in through Google, Microsoft, GitHub or email, with two-factor authentication.
  • Recurring billing by card and Pix: monthly, semiannual and annual plans, refunds within the legal period and automatic payment reconciliation.
  • Per-computer licensing: install on several, with one active at a time, and instant disconnection from the dashboard.
  • Customer dashboard and admin console for accounts, billing and messages, with automatic AI triage of incoming messages.
  • Installer downloads for subscribers only, through a temporary link.
  • Privacy by design: versioned acceptance of terms and self-service account deletion (Brazil’s LGPD data protection law).
Result

Built and tested in a staging environment, with the product website already live. Billing goes into production at launch.

Technologies
AstroSupabasePostgreSQLEdge FunctionsAsaasPix

13 [AI] In final development

AI agents working as a team, with review before delivery

Several AIs in parallel, with cross-review and tests before delivery

  • 7AI tools from different providers
  • Reviewof one AI by another before moving on
  • Testsas the delivery criterion
Context

A single AI makes mistakes and does not notice. To trust the result you need to split the work, have one AI review another and prove with tests that the delivery is right, without depending on a single provider.

What was built
  • Several AI agents working in parallel on the same request, each with its own task.
  • Cross-review: one agent’s delivery is checked by another before it moves on.
  • Automated verification: the result only counts when the test passes.
  • Integration with the official tools of 7 AI providers (Claude Code, Codex, Cursor, Gemini, Copilot and others), each with the user’s own account.
  • Each agent works on an isolated copy of the project, and risky decisions wait for a person’s approval.
Result

In final development. It follows the same principle as LVFN’s deliveries: AI for speed, review and tests to guarantee the result.

Technologies
AI agentsMCPClaudeOpenAIGeminiRust

14 [AI · ERP] In use at LVFN

AI kit for ERP development (TOTVS Protheus)

The AI writes ERP code following the project rules

  • 43ERP development guides
  • 3tools: Claude Code, Codex and Cursor
  • Linton every source file created or changed
Context

Generic AI gets ERP code wrong: it invents functions, ignores the project’s standards and breaks the encoding of source files. To use AI safely on ADVPL/TLPP (the TOTVS Protheus languages), it needs the language and project rules before it writes.

What was built
  • 43 specialized guides (MVC, REST, automated routines, entry points, embedded SQL, jobs and others), loaded by the AI according to the task.
  • ADVPL/TLPP linting run on every source file created or changed.
  • Example search in the client’s own source code before writing anything new.
  • Source-file encoding handling (CP1252), so accented characters do not break.
  • Installed in Claude Code, Codex and Cursor from a single source.
Result

In use in LVFN projects since August 2026. The AI writes following the project rules, and human review remains mandatory.

Technologies
ADVPL/TLPPClaude CodeCodexCursorLint
35+external systems integrated
150+automated routines (jobs)
150+API endpoints built
2,000+source files created or evolved

Numbers cover ERP (TOTVS Protheus) work only: minimum count from Git history since 2018 and from the author signature in the source files, rounded down. AI and SaaS work is not included.

Have a similar integration or module in your backlog?

Describe the scenario on WhatsApp. Lucas will assess the scope and point out the technical path.

Chat on WhatsApp