Sales Document Flow
The sales process follows a natural workflow:Quotations
Create professional quotes with expiration dates
Orders
Convert quotes to customer orders
Delivery Notes
Track deliveries and stock movements
Invoices
Generate final invoices with payment receipts
Quotations (Presupuestos)
Quotations represent offers to customers with validity periods.Key Features
- Expiration Management: Set validity periods for quotes
- Status Tracking: Monitor quote acceptance or rejection
- Conversion: Transform quotes into orders or invoices
- Line Items: Add products with prices, taxes, and discounts
Data Structure
Customer Orders (Pedidos)
Orders represent confirmed purchases from customers.Features
- Stock Reservation: Reserve products for confirmed orders
- Partial Fulfillment: Track which items have been delivered
- Order Status: Monitor pending, processing, and completed orders
- Expiration Dates: Optional validity periods
Implementation
Orders are stored in theCore/Model/PedidoCliente.php model:
Delivery Notes (Albaranes)
Delivery notes document the physical delivery of goods to customers.Key Capabilities
- Stock Management: Automatically update stock levels on delivery
- Partial Deliveries: Support multiple deliveries per order
- Invoice Generation: Convert delivery notes to invoices
- Warehouse Tracking: Track which warehouse items were shipped from
Model Structure
SeeCore/Model/AlbaranCliente.php:
Invoices (Facturas)
Invoices are the final billing documents that generate payment obligations.Core Features
Payment Receipts
Automatically generate payment receipts (recibos)
Tax Calculation
Automatic VAT, IRPF, and surcharge calculation
Accounting Integration
Create accounting entries automatically
Payment Tracking
Monitor paid and overdue invoices
Invoice Model
Located atCore/Model/FacturaCliente.php:
Payment Receipts
Invoices automatically generate payment receipts (recibos) that track:- Payment due dates
- Payment methods
- Payment status (pending, paid, returned)
- Bank account information
Document Lines
All sales documents share a common line structure:Document Status
Each document has a status that controls:- Whether the document is editable
- Whether it affects stock levels
- Whether it generates accounting entries
- Whether it can be deleted
Tax Calculation
The system uses the Calculator library for automatic calculation of:- Net amounts: Subtotals before taxes
- VAT (IVA): Value-added tax
- IRPF: Personal income tax withholding
- Recargo de Equivalencia: Surcharge for special tax regimes
- Discounts: Line-level and document-level discounts
Date Validation
Invoices include strict date validation:Series and Numbering
Documents are organized by:- Series (Serie): Document type categorization
- Exercise (Ejercicio): Fiscal year
- Number (Numero): Sequential numbering within series and exercise
Best Practices
Document Workflow
Document Workflow
Follow the natural progression: Quote → Order → Delivery Note → Invoice. Each step can be skipped if needed, but the workflow helps maintain proper records.
Stock Management
Stock Management
Configure document statuses to control when stock is affected. Typically, delivery notes reduce stock, while quotes and orders reserve it.
Payment Terms
Payment Terms
Set appropriate payment methods and due dates for each customer. The system will automatically calculate receipt due dates.
Tax Configuration
Tax Configuration
Ensure products have correct tax codes assigned. The system will use customer tax regime to apply appropriate rates.
Related Models
Core/Model/FacturaCliente.php- Customer invoicesCore/Model/AlbaranCliente.php- Delivery notesCore/Model/PedidoCliente.php- Customer ordersCore/Model/PresupuestoCliente.php- QuotationsCore/Model/ReciboCliente.php- Payment receiptsCore/Model/Base/SalesDocument.php- Base class for all sales documentsCore/Lib/Calculator.php- Tax and total calculation engine
Next Steps
Accounting Integration
Learn how invoices generate accounting entries
Inventory Management
Understand stock control and warehouse management

