Overview
Bar Galileo’s invoicing system converts completed orders into formal invoices with automatic numbering, total calculation, and comprehensive record-keeping.Automatic Numbering
Sequential invoice numbers generated automatically
Order Integration
One-to-one relationship with orders ensures accuracy
Price Capture
Invoice totals locked at time of creation
Search & Filter
Find invoices by number, date, or table
Invoice Structure
Each invoice contains:- numero: Unique invoice number (auto-generated, 8 digits zero-padded)
- pedido: One-to-one link to the source order
- fecha: Invoice date and time
- total: Total amount (calculated from order items)
Each order can only have one invoice, and each invoice is linked to exactly one order. This prevents duplicate billing.
Creating Invoices
Standard Invoice Generation
Generate Invoice
Create an invoice from the order. The system automatically:
- Assigns the next sequential invoice number
- Captures the current date and time
- Calculates the total from all order items
- Links the invoice to the order
Update Order Status
The related order status changes to “Facturado” (Invoiced), preventing further modifications.
Automatic Invoice Numbering
Invoice numbers are generated automatically:- Sequential: Each new invoice increments from the last
- 8 Digits: Numbers are zero-padded (e.g., 00000001, 00000002)
- Unique: System ensures no duplicate numbers
- Automatic: No manual number entry required
How invoice numbering works
How invoice numbering works
When creating an invoice:
- System queries for the highest existing invoice number
- Increments the number by 1
- Zero-pads to 8 digits (e.g., 00000042)
- Assigns this number to the new invoice
- If no invoices exist, starts at 00000001
- No gaps in numbering
- No duplicate numbers
- Compliance with accounting standards
- Easy invoice tracking
Invoice Totals
Automatic Calculation
Invoice totals are calculated from the order:Managing Invoices
Viewing Invoices
The invoicing module provides several ways to find and view invoices:Search by Invoice Number
Search by Invoice Number
Search for specific invoices using their unique invoice number. This is the fastest way to locate a particular transaction.
Filter by Date Range
Filter by Date Range
View invoices created during a specific period:
- Today’s invoices
- This week’s invoices
- This month’s invoices
- Custom date range
- Daily revenue reports
- Period-end reconciliation
- Audit trails
- Performance analysis
Filter by Table
Filter by Table
Find all invoices for a specific table, helpful for:
- Investigating customer complaints
- Analyzing table performance
- Server performance tracking
View All Invoices
View All Invoices
Browse the complete invoice history ordered by date (newest first).
Invoice Details
When viewing an invoice, you can see:- Invoice number: Unique identifier
- Date and time: When invoice was created
- Total amount: Final bill amount
- Associated table: Which table the order was for
- Order details: All items that were ordered
- Staff members: Who handled the order
Safe Invoice Handling
Data Integrity
Bar Galileo includes advanced protection against data corruption:- Decimal validation: Ensures money amounts are valid
- Safe retrieval: Uses direct SQL queries to bypass corrupted data
- Error handling: Gracefully handles issues without crashing
- Corruption detection: Can identify and report problematic invoices
The system includes a
FacturaSegura wrapper class that safely handles invoice data even if database values become corrupted.Invoice Statistics
The system automatically tracks:- Total invoices: Count of all invoices ever created
- Total revenue: Sum of all invoice amounts
- Today’s invoices: Count of invoices created today
- Today’s revenue: Total income from today’s invoices
How statistics are calculated
How statistics are calculated
Statistics use optimized SQL queries:These queries are fast even with thousands of invoices.
Invoice Workflows
Standard Dine-In Workflow
Review Order
Verify all items on the order are correct. Make any necessary adjustments while order status is still “En Proceso”.
Generate Invoice
Create the invoice from the order. System assigns invoice number and calculates total.
Quick Service Workflow
Troubleshooting
Invoice shows incorrect total
Invoice shows incorrect total
If an invoice total seems wrong:
- Check the source order and all its items
- Verify quantities and unit prices
- Remember: invoice captures total at creation time
- If order was modified after invoicing, invoice total won’t change
- Create a new order/invoice if correction is needed
Cannot create invoice for order
Cannot create invoice for order
If invoice creation fails:
- Verify order is in “En Proceso” status (not already invoiced)
- Check that order has at least one item
- Ensure order items have valid prices
- Confirm no existing invoice for this order
Invoice number sequence looks wrong
Invoice number sequence looks wrong
Invoice numbers are sequential based on database records:
- Numbers increment regardless of deletion
- Gaps may appear if invoices were deleted
- This is normal and maintains audit trail
- Never manually edit invoice numbers
Corrupted invoice data
Corrupted invoice data
If you encounter invoice data issues:
- The system can detect corrupted invoices
- Use the safe retrieval methods to access data
- Review the corruption detection report
- Contact technical support for data repair
- System continues working with unaffected invoices
Financial Reports
Daily Sales Report
Use invoice data to generate daily reports:- Total number of invoices today
- Total revenue today
- Average invoice amount
- Peak service times
- Table utilization
Period Reports
Analyze performance over time:- Weekly revenue trends
- Monthly comparisons
- Seasonal patterns
- Growth metrics
Audit Trail
Invoices provide complete financial audit trail:- Every sale has an invoice
- Every invoice links to an order
- Every order shows items and prices
- All timestamps are automatic and accurate
- Historical data never changes
The one-to-one relationship between orders and invoices ensures that every sale is properly documented and no order is invoiced twice.
Best Practices
Review Before Invoicing
Review Before Invoicing
Always verify the order is complete and correct before generating the invoice. Once invoiced, the order cannot be modified.
Daily Reconciliation
Daily Reconciliation
Reconcile daily invoices with actual payments:
- Count invoice totals
- Match with cash register
- Investigate discrepancies
- Document exceptions
Backup Invoice Data
Backup Invoice Data
Invoices are legal financial documents:
- Maintain regular database backups
- Store backups securely
- Keep backups for required retention period
- Test backup restoration periodically
Invoice Retention
Invoice Retention
Maintain invoices according to:
- Local tax regulations
- Accounting standards
- Business requirements
- Typically 5-7 years minimum
