|
|
||
|---|---|---|
| public | ||
| templates | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| CHANGELOG.md | ||
| Dockerfile | ||
| IMPLEMENTATION_SUMMARY.md | ||
| INSTALLATION.md | ||
| README.md | ||
| add_invoices.sql | ||
| docker-compose.yml | ||
| import_customers_qbo.js | ||
| init.sql | ||
| package-lock.json | ||
| package.json | ||
| qbo_helper.js | ||
| server.js | ||
| setup.sh | ||
README.md
Quote & Invoice Management System
Professional quote and invoice management system for Bay Area Affiliates, Inc.
Features
Quotes
- Create and manage professional quotes
- Support for TBD (To Be Determined) items
- Rich text descriptions with Quill editor
- Automatic tax calculations (8.25% Texas sales tax)
- Tax-exempt option
- PDF generation
- Convert quotes to invoices with one click
Invoices
- Create and manage invoices
- Terms field (default: Net 30)
- Authorization/P.O. field
- Rich text descriptions
- Automatic tax calculations
- Tax-exempt option
- PDF generation with accounting@bayarea-cc.com email
- "Bill To:" instead of "Quote For:"
- No TBD items allowed - quotes with TBD items cannot be converted until updated
Customers
- Full customer management
- Address and account number tracking
- Customer selection in quotes/invoices
Settings
- Company logo upload for PDFs
- Logo appears on both quotes and invoices
Installation
Prerequisites
- Node.js 18+
- PostgreSQL 12+
- npm or yarn
Setup
-
Clone or copy the files to your server
-
Install dependencies:
npm install
- Set up PostgreSQL database:
# Create database and user
createdb quotes_db
createuser -P quoteuser # Enter password when prompted
- Run database migrations:
First, run the initial setup:
-- In psql or your PostgreSQL client, run init.sql
psql -U quoteuser -d quotes_db -f init.sql
Then add invoice tables:
-- Run add_invoices.sql
psql -U quoteuser -d quotes_db -f add_invoices.sql
- Configure environment (optional):
Create a .env file or set environment variables:
DB_USER=quoteuser
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=quotes_db
PORT=3000
- Start the server:
npm start
For development with auto-reload:
npm run dev
- Access the application:
Open your browser to:
http://localhost:3000
Database Schema
Customers Table
- id, name, street, city, state, zip_code, account_number
Quotes Table
- id, quote_number, customer_id, quote_date, tax_exempt, tax_rate
- subtotal, tax_amount, total, has_tbd, created_at, updated_at
Quote Items Table
- id, quote_id, quantity, description, rate, amount, item_order
Invoices Table
- id, invoice_number, customer_id, invoice_date, terms, authorization
- tax_exempt, tax_rate, subtotal, tax_amount, total
- created_from_quote_id, created_at, updated_at
Invoice Items Table
- id, invoice_id, quantity, description, rate, amount, item_order
Usage
Creating a Quote
- Click "Quotes" tab
- Click "+ New Quote"
- Select customer
- Add items (can use TBD for rates/amounts)
- Items support rich text formatting
- Check "Tax Exempt" if applicable
- Save
Converting Quote to Invoice
- Find quote in list
- Click "→ Invoice" button
- Note: Quotes with TBD items cannot be converted
- Invoice is automatically created with:
- Same customer and items
- Current date
- Default terms: "Net 30"
- Empty authorization field
Creating an Invoice
- Click "Invoices" tab
- Click "+ New Invoice"
- Select customer
- Enter terms (e.g., "Net 30", "Due on Receipt")
- Add authorization if needed (P.O. number, etc.)
- Add items (TBD not allowed in invoices)
- Check "Tax Exempt" if applicable
- Save
PDF Generation
- Quotes: Display "Quote For:" and support@bayarea-cc.com
- Invoices: Display "Bill To:" and accounting@bayarea-cc.com
- Both include company logo if uploaded
- Professional formatting with Bay Area Affiliates branding
Managing Customers
- Click "Customers" tab
- Add/Edit/Delete customers
- Customers appear in dropdown for quotes/invoices
Settings
- Click "Settings" tab
- Upload company logo (PNG/JPG recommended)
- Logo appears on all PDFs
File Structure
quote-invoice-system/
├── server.js # Express server with all routes
├── public/
│ ├── index.html # Main UI with tabs for quotes/invoices
│ ├── app.js # Frontend JavaScript
│ └── uploads/ # Logo storage
├── package.json # Dependencies
├── init.sql # Initial database schema
└── add_invoices.sql # Invoice tables migration
Key Differences: Quotes vs Invoices
| Feature | Quotes | Invoices |
|---|---|---|
| TBD Items | ✅ Allowed | ❌ Not allowed |
| support@bayarea-cc.com | accounting@bayarea-cc.com | |
| Label | "Quote For:" | "Bill To:" |
| Terms Field | No | Yes (e.g., Net 30) |
| Authorization | No | Yes (optional) |
| Info Header | Quote #, Account #, Date | Invoice #, Account #, Date, Terms |
API Endpoints
Quotes
GET /api/quotes- List all quotesGET /api/quotes/:id- Get quote detailsPOST /api/quotes- Create new quotePUT /api/quotes/:id- Update quoteDELETE /api/quotes/:id- Delete quoteGET /api/quotes/:id/pdf- Generate quote PDFPOST /api/quotes/:id/convert-to-invoice- Convert to invoice
Invoices
GET /api/invoices- List all invoicesGET /api/invoices/:id- Get invoice detailsPOST /api/invoices- Create new invoicePUT /api/invoices/:id- Update invoiceDELETE /api/invoices/:id- Delete invoiceGET /api/invoices/:id/pdf- Generate invoice PDF
Customers
GET /api/customers- List all customersPOST /api/customers- Create customerPUT /api/customers/:id- Update customerDELETE /api/customers/:id- Delete customer
Settings
GET /api/logo-info- Check if logo existsPOST /api/upload-logo- Upload company logo
Technical Details
- Frontend: Vanilla JavaScript, Tailwind CSS
- Backend: Node.js, Express
- Database: PostgreSQL
- PDF Generation: Puppeteer
- Rich Text: Quill.js editor
Automatic Features
- Quote numbers: Format YYYY-NNN (e.g., 2026-001)
- Invoice numbers: Format YYYY-NNN (e.g., 2026-001)
- Auto-increment within year
- Automatic tax calculation (8.25%)
- Item quantity × rate = amount calculation
Support
For issues or questions, contact Bay Area Affiliates, Inc.