Invoice Generation - Migz93/3dq GitHub Wiki
3DQ provides a powerful invoicing system that generates HTML invoices directly from your quotes. This guide explains how to use the invoice generation features.
3DQ offers two types of invoices:
-
Client Invoice: A customer-facing invoice showing the summary and final price. This invoice hides internal cost details and focuses on the final price the customer will pay.
-
Internal Invoice: A detailed invoice showing all cost breakdowns and a full financial summary. This is useful for your internal records and financial analysis.
To generate an invoice from a saved quote:
- Navigate to the Quotes section in the sidebar
- Find and click on the quote you want to invoice
- In the quote view page, you'll find two invoice buttons:
- Generate Client Invoice
- Generate Internal Invoice
- Click the appropriate button based on your needs
- The invoice will open in a new browser tab as an HTML document
The client invoice includes:
- Your company name and branding
- Quote number and date
- Customer name
- Project title
- Quantity of items
- Summary of items (filament, hardware, etc.)
- Per-unit costs (when quantity > 1)
- Subtotal
- Markup (not labeled as such, incorporated into the prices)
- Discount (if applicable)
- Tax (if configured and greater than zero)
- Final total
- Print/Save as PDF button (hidden when printing)
The internal invoice includes everything in the client invoice, plus:
- Detailed cost breakdowns for each component
- Raw material costs before markup
- Printer depreciation costs
- Power usage costs
- Labor costs with time breakdowns
- Per-unit costs and quantity multiplier effects
- Markup percentage and amount
- Full financial summary
Both invoice types include a "Print/Save as PDF" button that is hidden when actually printing. To save an invoice as a PDF:
- Generate the invoice (client or internal)
- Click the "Print/Save as PDF" button
- In the print dialog:
- Select "Save as PDF" as the destination (or your browser's equivalent)
- Click "Save"
The invoice is designed with print-specific CSS that ensures:
- Proper table borders
- Appropriate header background colors
- No "Print/Save as PDF" button when printing
- Proper page breaks
The invoices automatically use your company name from the settings. To customize your invoices:
- Navigate to the Settings page
- Update your company name
- Set your preferred currency symbol
- Configure your tax rate (if applicable)
- Set your accent color (used in invoice headers)
If you have configured a tax rate greater than zero in the settings, the invoices will:
- Calculate tax based on the amount after markup and discount
- Display the tax amount as a separate line item
- Include tax in the final total
The tax calculation follows this formula:
tax_amount = (total_after_discount) * (tax_rate / 100)
The invoices are generated on the backend:
- Route:
GET /api/quotes/:id/invoice/:type
- The backend fetches all quote data and constructs a complete HTML string with embedded CSS
- The frontend opens this HTML in a new browser tab