Workflow

How to Apply a Gift Card to a Sales Invoice

Verified up to the save boundary. Demo run sales-invoice-gift-card-20260520T024756Z created a disposable active gift certificate, applied it through the FT Vale oferta modal, received a 1.00 discount value, deleted the disposable voucher, and submitted no final invoice save.

Step-by-Step

  1. Open /vendas/ft/create and select an active billing customer.
  2. Add at least one invoice line. OfficeGest returns Não há linhas if the voucher is applied before document lines exist.
  3. In Linhas Doc., click Vale oferta / #btnValeDesconto.
  4. Select an active gift certificate in Número / #numero_valeoferta. The selector filters estado=ACT.
  5. Click Guardar / #save_valeoferta.
  6. Review the returned discount value and totals before finalizing the invoice.

Verified Behavior

CheckObserved result
Route/vendas/ft/create
Temporary voucherIG024756000001, value 1.00, status ACT.
Apply requestaction=retalho, option=save_valeoferta, selected voucher id 127, and document table id from the FT form.
Response{"success":true,"add_desconto":false,"valor_desconto":1,"percentagem":0}.
Voucher state before cleanupThe voucher still listed as ACT because the FT was not finalized in this boundary run.
Safety boundaryNo saveDocument, saveRascunho, print, payment, or delete-document request was submitted.

This run verifies applying the voucher to the temporary invoice form. It intentionally does not prove final voucher consumption on an issued invoice because the test stopped before fiscal save.

Backend Calls Observed

Action or endpointPurpose
Sel2_Select_CRM_vales_ofertaLoads active gift certificates for the modal selector.
retalho&option=save_valeofertaApplies the selected voucher against the temporary document table and returns the discount value.
DT_Select with table=vales_ofertaVerifies voucher state before and after the temporary apply boundary.

Raw evidence: raw/playwright/workflows/sales-invoice-gift-card-20260520T024756Z.json. Screenshots: assets/screenshots/sales-invoice-gift-card-20260520T024756Z-01-create-page.png through assets/screenshots/sales-invoice-gift-card-20260520T024756Z-03-gift-card-applied.png.