Module Deep Dive

Purchases and Supplier Documents

Curated OfficeGest purchase-module notes from authenticated route crawl evidence plus verified supplier document creation and settlement workflows.

Scope

The purchases module contains supplier-facing document routes such as Purchases / Expenses, Supplier Invoice, Invoice / Receipt Supplier, supplier credit/debit/return notes, supplier orders, request for quotation, transport/waybill documents, Hub4Data, Saphety integration, and lot printing. The generated route manual remains the broad index; this page records verified behavior for core purchase work.

Verified Supplier Cash Sale Workflow

Verified end to end. Run supplier-cash-sale-vdf-20260519T073648Z created supplier cash-sale document 999900001 / VDF 9999/1 for supplier 100. The document required a payment row during creation, saved with status LIQ / Finished, ValorPago=1.51, validation N/D, and warehouse 1 stock increased from 4 to 5.

VDF areaVerified detail
Route/compras/vdf/create, page title OG - Cash Sale forn. [VDF].
Document typeHidden TipoOp=VDF and MovimentaStock=1.
Paymentpayment&option=add used compras=T, supplier 100, modopagamento=NUM, and total 1.51.
Save actionsaveDocument with TipoOp=VDF, CodTipoLanc=AccVDinFMerc, NumNoForn=AI-VDF-20260519T073648Z, and id=47824.
List verificationDT_List_DocumentosF with table VDinF, actualizacc=T, tipoop=VDF, and tipoterc=F.
Stock quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock 4 -> 5 after save.

Detailed how-to: How to Create a Supplier Cash Sale VDF.

Verified Supplier Simplified Invoice Workflow

Verified end to end. Run supplier-simplified-invoice-fsf-20260519T073106Z created supplier document 999900002 / FSF 9999/2 for supplier 100. The document required a payment row during creation, saved with status LIQ / Finished, ValorPago=1.51, validation N/D, and warehouse 1 stock increased from 3 to 4.

FSF areaVerified detail
Route/compras/fsf/create, page title OG - Making facilitator. Forn. [FSF].
Document typeHidden TipoOp=FSF and MovimentaStock=1.
Paymentpayment&option=add used compras=T, supplier 100, modopagamento=NUM, and total 1.51.
Save actionsaveDocument with TipoOp=FSF, CodTipoLanc=AccVDinFMerc, NumNoForn=AI-FSF-20260519T073106Z, and id=47781.
List verificationDT_List_DocumentosF with table FactSimF, actualizacc=T, tipoop=FSF, and tipoterc=F.
Stock quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock 3 -> 4 after save.

Detailed how-to: How to Create a Supplier Simplified Invoice FSF.

Verified Supplier Invoice / Receipt Workflow

Verified end to end. Run supplier-invoice-receipt-frf-20260519T072511Z created supplier invoice/receipt 999900023 / FRF 9999/23 for supplier 100. The document required a payment row during creation, saved with status LIQ / Finished, ValorPago=1.51, validation N/D, and warehouse 1 stock increased from 2 to 3.

Invoice/receipt areaVerified detail
Route/compras/frf/create, page title OG - Invoice / Receipt forn. [FRF].
Document typeHidden TipoOp=FRF and MovimentaStock=1.
Paymentpayment&option=add used compras=T, supplier 100, modopagamento=NUM, and total 1.51.
Save actionsaveDocument with TipoOp=FRF, CodTipoLanc=AccVDinFMerc, NumNoForn=AI-FRF-20260519T072511Z, and id=47729.
List verificationDT_List_DocumentosF with table FactRecF, actualizacc=T, tipoop=FRF, and tipoterc=F.
Stock quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock 2 -> 3 after save.

Detailed how-to: How to Create a Supplier Invoice / Receipt FRF.

Verified Supplier Payment Note Workflow

Verified end to end. Run supplier-payment-rf-20260519T071455Z created supplier payment note 999900074 / RF 9999/74 for supplier 100. It selected source invoice 999900342 / FAF 9999/342, paid 1.51 with NUM, saved the RF as F / Closed, and changed the source FAF from ABR / Open with ValorPago=0 to LIQ / Finished with ValorPago=1.51.

Payment areaVerified detail
Route/compras/rf/create, page title OG - Payment Note [RF].
Pending document loadloadTabDocumentoReciboF and listaTabDocumentoRecibo loaded open supplier invoice FAF 9999/342.
Move to paychangeEstadoRecibo returned {"success":true} and moved the FAF row to selected state T.
Paymentpayment&option=add used compras=T, supplier 100, modopagamento=NUM, and total 1.51.
Save actionsaveDocumentRecibo with TipoOp=RF, CodTipoLanc=AccReciboF, and totAPagar=1.51.
Source resultDT_List_DocumentosF for FactF showed the FAF changed to LIQ / Finished with ValorPago=1.51.

Detailed how-to: How to Create a Supplier Payment Note RF.

Verified Supplier Receipt Chargeback Workflow

Verified end to end. Run supplier-receipt-chargeback-ref-20260519T081501Z created supplier receipt chargeback 999900005 / REF 9999/5 for supplier 100. It selected source credit note 999900025 / NCF 9999/25, paid 1.51 with NUM, saved the REF as F / Closed, and changed the source NCF from open/unpaid to LIQ / Finished with ValorPago=1.51.

Chargeback areaVerified detail
Route/compras/ref/create, page title OG - Receipt chargeback sup. [REF].
Pending document loadloadTabDocumentoReciboF and listaTabDocumentoRecibo loaded open supplier credit note NCF 9999/25.
Move to chargebackchangeEstadoRecibo returned {"success":true} and moved the NCF row to selected state T.
Paymentpayment&option=add used compras=T, supplier 100, modopagamento=NUM, and total 1.51.
Save actionsaveDocumentRecibo with TipoOp=REF, CodTipoLanc=AccReciboEstF, id=48104, and totAPagar=1.51.
Source resultDT_List_DocumentosF for NCredF showed the NCF changed to LIQ / Finished with ValorPago=1.51.

Detailed how-to: How to Create a Supplier Receipt Chargeback REF.

Verified Supplier Invoice Workflow

Verified end to end. Run supplier-invoice-faf-20260519T070810Z created supplier invoice 999900342 / FAF 9999/342 for supplier 100. The invoice saved with status ABR / Open, unpaid total 1.51, validation N/D, and warehouse 1 stock increased from 1 to 2.

Invoice areaVerified detail
Route/compras/faf/create, page title OG - Supplier Invoice [FAF].
Save actionsaveDocument with TipoOp=FAF, MovimentaStock=1, isedit=F, and israsc=0.
List verificationDT_List_DocumentosF with table FactF, actualizacc=T, tipoop=FAF, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, validation N/D.
Stock quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock 1 -> 2 after save.

Detailed how-to: How to Create a Supplier Invoice FAF.

Verified Supplier Credit Note Workflow

Verified end to end. Run supplier-credit-note-ncf-20260519T075930Z created supplier credit note 999900025 / NCF 9999/25 for supplier 100. The note saved with status ABR / Open, no payment, total 1.51, validation N/D, and warehouse 1 stock decreased from 5 to 4.

Credit-note areaVerified detail
Route/compras/ncf/create, form type TipoOp=NCF.
Save actionsaveDocument with TipoOp=NCF, CodTipoLanc=AccNCredFMerc, NumNoForn=AI-NCF-20260519T075930Z, MovimentaStock=on, and id=48047.
List verificationDT_List_DocumentosF with table NCredF, actualizacc=T, tipoop=NCF, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, validation N/D.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock changed 5 -> 4, customer-order quantity stayed 4, and supplier-order quantity stayed 2.

Detailed how-to: How to Create a Supplier Credit Note NCF.

Verified Supplier Debit Note Workflow

Verified end to end. Run supplier-debit-note-ndf-20260519T075402Z created supplier debit note 999900005 / 9999/5 for supplier 100. The note saved with status ABR / Open, no payment, total 1.51, validation N/D, and no stock/order quantity change for the tested article.

Debit-note areaVerified detail
Route/compras/ndf/create, form type TipoOp=NDF.
Save actionsaveDocument with TipoOp=NDF, CodTipoLanc=AccNDebFMerc, NumNoForn=AI-NDF-20260519T075402Z, MovimentaStock=1, and id=47957.
List verificationDT_List_DocumentosF with table NDebF, actualizacc=T, tipoop=NDF, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, validation N/D.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock stayed 5, customer-order quantity stayed 4, and supplier-order quantity stayed 2.

Detailed how-to: How to Create a Supplier Debit Note NDF.

Verified Supplier Return Note Workflow

Verified end to end. Run supplier-return-note-nvf-20260519T080457Z created supplier return note 999900001 / NVF 9999/1 for supplier 100. The note saved with status ABR / Open, no payment, total 1.51, blank validation fields, and warehouse 1 stock decreased from 4 to 3.

Return-note areaVerified detail
Route/compras/nvf/create, form type TipoOp=NVF.
Save actionsaveDocument with TipoOp=NVF, NumNoForn=AI-NVF-20260519T080457Z, MovimentaStock=1, and id=48087. No CodTipoLanc was present in the captured payload.
List verificationDT_List_DocumentosF with table NDevolF, actualizacc=F, tipoop=NVF, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, with blank validation fields.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock changed 4 -> 3, customer-order quantity stayed 4, and supplier-order quantity stayed 2.

Detailed how-to: How to Create a Supplier Return Note NVF.

Verified Supplier Transportation Note Workflow

Verified end to end. Run supplier-transport-note-gtf-20260519T082158Z created supplier transportation note 999900005 / GTF 9999/5 for supplier 100. The note saved with status ABR / Open, no payment, total 1.51, validation N/D, and warehouse 1 stock increased from 3 to 4.

Transport-note areaVerified detail
Route/compras/gtf/create, form type TipoOp=GTF.
Delivery methodLoad Leiria, postal code 2400, country PRT; discharge Rua Fornecedor Demo 19, Leiria, 2400-002, PT.
Save actionsaveDocument with TipoOp=GTF, NumNoForn=AI-GTF-20260519T082158Z, MovimentaStock=1, stockneg=NAO USAR, and id=48185.
List verificationDT_List_DocumentosF with table GTransF, actualizacc=F, tipoop=GTF, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, validation N/D.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock changed 3 -> 4, customer-order quantity stayed 4, and supplier-order quantity stayed 2.

Detailed how-to: How to Create a Supplier Transportation Note GTF.

Verified Supplier Waybill Workflow

Verified end to end. Run supplier-waybill-grf-20260519T082819Z created supplier waybill 999900035 / GRF 9999/35 for supplier 100. The waybill saved with status ABR / Open, no payment, total 1.51, validation N/D, and warehouse 1 stock increased from 4 to 5.

Waybill areaVerified detail
Route/compras/grf/create, form type TipoOp=GRF.
Save actionsaveDocument with TipoOp=GRF, NumNoForn=AI-GRF-20260519T082819Z, MovimentaStock=1, stockneg=NAO USAR, and id=48302.
List verificationDT_List_DocumentosF with table GRemF, actualizacc=F, tipoop=GRF, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, validation N/D.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock changed 4 -> 5, customer-order quantity stayed 4, and supplier-order quantity stayed 2.

Detailed how-to: How to Create a Supplier Waybill GRF.

Verified Supplier Consignment Guide Workflow

Verified end to end. Run supplier-consignment-guide-gcf-20260519T083536Z created supplier consignment guide 999900001 / GCF 9999/1 for supplier 100. The guide saved with status ABR / Open, no payment, total 1.51, validation N/D, and warehouse 1 stock increased from 5 to 6.

Consignment-guide areaVerified detail
Route/compras/gcf/create, form type TipoOp=GCF.
Transport fieldsLoad Leiria, postal code 2400, country PRT; discharge Rua Fornecedor Demo 19, Leiria, 2400-002, PT.
Save actionsaveDocument with TipoOp=GCF, NumNoForn=AI-GCF-20260519T083536Z, MovimentaStock=1, stockneg=NAO USAR, and id=48353.
List verificationDT_List_DocumentosF with table GConsigF, actualizacc=F, tipoop=GCF, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, validation N/D.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock changed 5 -> 6, customer-order quantity stayed 4, and supplier-order quantity stayed 2.

Detailed how-to: How to Create a Supplier Consignment Guide GCF.

Verified Supplier Request for Quotation Workflow

Verified end to end. Run supplier-request-quotation-pec-20260519T074730Z created request for quotation 999900017 / PEC 9999/17 for supplier 100. The request saved with status ABR / Open, no payment, total 1.51, validation N/D, and supplier-order quantity increased from 1 to 2 while physical stock stayed 5.

Request areaVerified detail
Route/compras/pec/create, page title OG - Request for quotation [PEC].
Save actionsaveDocument with TipoOp=PEC, NumNoForn=AI-PEC-20260519T074730Z, MovimentaStock=1, and id=47912.
List verificationDT_List_DocumentosF with table DocumPEC, actualizacc=F, tipoop=PEC, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, validation N/D.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed physical stock stayed 5 and qtd_enc_forn changed from 1 to 2.

Detailed how-to: How to Create a Supplier Request for Quotation PEC.

Verified Supplier Order Workflow

Verified end to end. Run supplier-order-ef-20260519T040050Z created order 999900111 / EF 9999/111 for supplier 100. The order saved with status ABR / Open, no payment, total 1.51, and supplier-order quantity increased from 0 to 1 while physical stock stayed 2.

Order areaVerified detail
Route/compras/ef/create, page title OG - Order to Supplier [EF].
Save actionsaveDocument with TipoOp=EF, isedit=F, and israsc=0.
List verificationDT_List_DocumentosF with table EncF, actualizacc=F, and tipoop=EF.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed qtd_enc_forn=1 after save.

Verified CD Finalization Workflow

Verified end to end. Run purchase-expense-finalize-20260519T035328Z converted draft 456 into finished document 999900053 / CD 9999/53, paid it with NUM, removed the draft from the draft list, and increased warehouse 1 stock for article AI-DEMO-20260519-021105 from 1 to 2.

Finalization areaVerified detail
Payment validationpayment&option=validate required payment equal to the total before final save.
Payment addpayment&option=add used supplier 100, method NUM, purchase flag compras=T, and total 1.51.
Final savesaveDocument returned 999900053%&=&OKDOC&=& and redirected to the CD view.
Document listDT_List_DocumentosF search for 999900053 returned one row with state LIQ and ValorPago=1.51.
Stockdt_list_recalc_stock_articles_lojas returned warehouse 1 stock 2 after finalization.

Verified Supplier Self-Billing Workflow

Verified end to end. Run supplier-self-billing-aft-20260519T084109Z created self-billing supplier invoice 999900001 / AFT 9999/1 for supplier 100. The invoice saved with status ABR / Open, no payment, total 1.51, validation N/D, and warehouse 1 stock increased from 6 to 7.

Self-billing areaVerified detail
Route/compras/aft/create, form type TipoOp=AFT.
Accounting launchdata_lanc_contabilidade=19/05/2026, CodTipoLanc=AccFactFMerc.
Save actionsaveDocument with TipoOp=AFT, NumNoForn=AI-AFT-20260519T084109Z, MovimentaStock=1, stockneg=NAO USAR, and id=48414.
List verificationDT_List_DocumentosF with table documaft, actualizacc=T, tipoop=AFT, and tipoterc=F.
StatusCodEstado=ABR, desig_estado=Open, ValorPago=0, validation N/D.
Stock/order quantitydt_list_recalc_stock_articles_lojas showed warehouse 1 stock changed 6 -> 7, customer-order quantity stayed 4, and supplier-order quantity stayed 2.

Detailed how-to: How to Create a Supplier Self-Billing Invoice AFT.

Verified CD Draft Workflow

Verified draft save. Run purchase-expense-draft-20260519T034251Z opened /compras/cd/create, selected supplier 100, added article AI-DEMO-20260519-021105, saved a draft, and verified draft 456 in the CD draft list.

Document areaVerified detail
Supplier[100] AI Demo Supplier 20260519T030323Z, VAT 590303236, active supplier loaded from NameEntidades&tabla=Forn.
Required supplier referenceNumNoForn=AI-CD-DRAFT-20260519T034251Z, checked through findNumNoForn against documcd.
LineArticle AI-DEMO-20260519-021105, quantity 1, warehouse 1, unit cost 1.23, VAT 23%.
TotalNet 1.23, VAT 0.2829, rounded total 1.51.
Save resultsaveRascunho returned OK:456; dt_list_drafts returned row 456.

Observed Purchase Document Routes

RouteObserved title or purposeVerification status
/compras/cdPurchases / Expenses [CD]Draft creation verified.
/compras/fafSupplier Invoice [FAF]Verified end-to-end creation, list validation, and stock increase.
/compras/frfInvoice / Receipt forn. [FRF]Verified end-to-end creation, immediate payment, and stock increase.
/compras/fsfMaking facilitator. Forn. [FSF]Verified end-to-end creation, immediate payment, and stock increase.
/compras/vdfCash Sale forn. [VDF]Verified end-to-end creation, immediate payment, and stock increase.
/compras/efOrder to Supplier [EF]Verified end-to-end supplier order creation and supplier-order quantity reservation.
/compras/pecRequest for quotation [PEC]Verified end-to-end request creation and supplier-order quantity reservation.
/compras/refReceipt chargeback sup. [REF]Verified end-to-end supplier credit-note chargeback and NCF settlement.
/compras/rfPayment Note [RF]Verified end-to-end supplier invoice settlement.
/compras/ncfNote forn credit. [NCF]Verified end-to-end credit note creation, list validation, and stock decrease.
/compras/nvfNote Return Supplier [NVF]Verified end-to-end return note creation, list validation, and stock decrease.
/compras/ndfNote debit forn. [NDF]Verified end-to-end debit note creation and list validation.
/compras/gtfSupp. Transportation Note [GTF]Verified end-to-end supplier transportation note creation, list validation, and stock increase.
/compras/grfWaybill Sup. [GRF]Verified end-to-end supplier waybill creation, list validation, and stock increase.
/compras/gcfGuides Consignao Supplier [GCF]Verified end-to-end supplier consignment guide creation, list validation, and stock increase.
/compras/aftInvoice autof. [AFT]Verified end-to-end self-billing invoice creation, list validation, accounting launch payload, and stock increase.
/compras/hub4dataIntegration Hub4DataSafe list/search probe verified controls and captured demo endpoint HTTP 500.
/compras/integrationsaphetyIntegration SaphetySafe filter/list probe verified endpoint and empty DataTables result; import action not clicked.
/compras/impreslotePurchase Lot Printing utility.Filter behavior verified; final print not clicked.

Purchase Lot Printing Utility

Filter behavior verified: /compras/impreslote was probed with Playwright. The final Print action was intentionally not clicked.

AreaObserved detail
Default document typetipoDoc=AFT, backend table documaft.
Supplier contextSupplier field codterc; filter request sends tipoterc=F and compras=T.
Filter resultlistaImpresLote returned {"data":[]}; table showed No data available in table; button stayed Print(0).
How-toHow to Use Purchase Lot Printing

Verified Purchase Integration Screens

Safe probe verified. Run purchase-integrations-safe-probe-20260519T084624Z opened Hub4Data and Saphety, captured list/filter controls, and avoided external import/transmit actions.

Integration areaVerified detail
Hub4Data route/compras/hub4data, page title OG - Hub4Data.
Hub4Data search formFields include document_id, entity, documentnumber, datedue, tipoop, nserie, and codloja. Observed defaults were tipoop=AFT, series 9999, and warehouse 1.
Hub4Data endpointhub4data&option=documents with from_date=19/04/2026, to_date=19/05/2026, and integrated=0 returned HTTP 500 and message Ocorreu um erro interno no servidor. in the demo.
Saphety route/compras/integrationsaphety, page title OG - Integration Saphety.
Saphety filter endpointsaphetyinbound&option=dt with dataini=01/04/2026, datafim=19/05/2026, and listar=1 returned HTTP 200 and {"data":[]}.
Saphety controlsObserved Filters, Filter, Import Data Saphety, With selected (0), Reject, PDF preview controls, and document mapping selectors for purchase document types.

Detailed how-to: How to Check Purchase Integrations Hub4Data and Saphety.

Backend Patterns

Purchase document screens use the same central /ajaxserver endpoint as sales documents, but supplier context flips key parameters such as compras=T, isforn=T, supplier table forn, supplier address table moradasf, and supplier master lookup tabla=Forn.

Action familyObserved purpose
dt_list_draftsLists purchase drafts when called with compras=T and search[TipoOp]=CD.
DT_List_DocumentosFLists finalized supplier documents using supplier-specific columns such as supplier document number and validation state.
insertLinhaTabDocInserts supplier document lines with isforn=T and document type CD.
saveRascunhoSaves draft supplier documents and returns OK:<draft number>.

Known Gaps