--- name: invoice-generator description: Generate and send time tracking invoice Excel files from FreeScout data. Use when the user asks for an invoice, time report, or hours summary for a customer and time period. --- # Invoice Generator Generate Excel invoices from FreeScout time tracking data and send them via WhatsApp. ## Workflow 1. Identify customer name and date range from the user's request 2. Run: `bin/freescout excel --from YYYY-MM-DD --to YYYY-MM-DD --customer "NAME" --output /tmp/invoice-CUSTOMER-PERIOD.xlsx` 3. Send the file to the user via the `message` tool 4. Reply with NO_REPLY (the file message is the reply) ## Available customers If unsure which customer, run `bin/freescout report --from 2024-01-01 --to 2099-12-31` to see all, or pass a wrong name — the script prints available customers. ## Other commands ``` bin/freescout mailboxes # List mailboxes bin/freescout users # List users bin/freescout report --from --to # Terminal report (add --customer, --mailbox, --user) bin/freescout excel --from --to # Excel generation (add --customer, --mailbox, --user, --output) ``` ## Notes - `time_spent` in DB is seconds, displayed as decimal hours - Excel groups by conversation: subject, customer, website, total hours - Customer and Website come from FreeScout custom fields (dropdowns) - Only timelogs within the date range are counted, not conversation creation dates