Statements
Generate and manage time billing statements stored in Google Drive.
The Statements feature lets you generate PDF invoices from billable activities and manage them in Google Drive.
Overview
Time Billing Statements are PDF documents generated from billable activities. This feature provides:
- Generate statements - Create PDF invoices from the Activities page
- Browse statements - Navigate by year and month folders
- View PDFs - Open statements directly in Google Drive
- Delete statements - Remove PDFs and reset activity billing status
Generating Statements
Statements are generated from the Activities page:
- Navigate to Activities
- Filter to show unbilled activities (use the Billing Status filter)
- Select activities to include (checkbox)
- Click "Generate Statement"
- System groups activities by client and creates a PDF for each
- PDFs are uploaded to Google Drive and activities are marked as "billed"
What's Included in a Statement
Each PDF includes:
- Company header and contact info
- Client name and billing address
- Date range of activities
- Table of activities (date, designer, description, hours, amount)
- Total hours and total amount
Invoice Numbering
Invoice numbers are sequential per organization:
- Production invoices start at 1000
- Each statement gets the next available number
- Numbers are never reused
Accessing Statements
Navigate to Statements in the team sidebar. This feature requires the activity_tracker program to be enabled for your organization.
Interface
Year/Month Selection
- Select Year - Choose from available years (folders in Google Drive)
- Select Month - Choose from available months within that year
- View Statements - See all statement PDFs for the selected period
Statement Table
| Column | Description |
|---|---|
| Checkbox | Select for bulk operations (if permitted) |
| Name | Statement filename |
| View | Link to open PDF in Google Drive |
| Created | When the statement was generated |
Permissions
| Permission | Requirement |
|---|---|
| View Statements | Team member access |
| Delete Statements | activities.manage permission |
Only users with the activities.manage permission can see and use the delete functionality.
Deleting Statements
When you delete a statement:
- Select - Check one or more statements
- Click Delete - First click shows confirmation
- Confirm - Second click executes deletion
What Happens on Delete
- Database Update - Invoice URLs are cleared from associated activities in
organization_activities - Google Drive - The PDF file is deleted from Google Drive
- Refresh - The statement list refreshes to show updated state
Google Drive Structure
Statements are organized in Google Drive as:
Statements Root Folder/
├── 2025/
│ ├── January/
│ │ ├── Client Name - January 2025.pdf
│ │ └── Another Client - January 2025.pdf
│ ├── February/
│ │ └── ...
│ └── ...
└── 2024/
└── ...
The root folder ID is configured in the environment variables.
API Endpoints
The Statements feature uses these API routes:
| Endpoint | Method | Purpose |
|---|---|---|
/api/statements/pull-from-drive | GET | List folders or files from Google Drive |
/api/statements/delete-statement | POST | Clear invoice URLs in database |
/api/statements/delete-drive-files | POST | Delete files from Google Drive |
Environment Variables
| Variable | Purpose |
|---|---|
GOOGLE_SERVICE_ACCOUNT_KEY | Service account for Drive API access |
STATEMENTS_ROOT_FOLDER_ID | Google Drive folder ID for statements |
Error Handling
| Error | Cause | Solution |
|---|---|---|
| "Failed to fetch years" | Drive API error or missing folder | Check folder ID and service account |
| "Failed to fetch months" | Year folder doesn't exist | Verify Drive structure |
| "Database update failed" | Supabase connection issue | Check database connectivity |
| "Drive deletion failed" | File permissions or already deleted | File may have been manually removed |
Related Features
- Activity Tracker - Source of billable activities
- Time Insights - View billable time before generating statements
- Client Accounts - Clients for statement generation
Future Enhancements
- Email statements directly to clients
- Statement templates customization
- Payment instructions on statements
