# Xero Supplier Bill Processing

## Task
Extract data from supplier bill PDFs and create the supplier contact and bill in Xero.

## Steps

1. Extract the following from the PDF:
   - Supplier name (required)
   - Supplier email and phone (optional)
   - Bill/invoice number
   - Bill date
   - Line items: description, quantity, unit amount
   - Tax information

2. Get Xero account codes and tax rates:
   - Run xero:list-accounts to get valid account codes
   - Run xero:list-tax-rates to get valid tax types
   - Common expense accounts are in 400-499 range

3. Create the supplier contact:
   - Use xero:create-contact with supplier name
   - Include email/phone if available
   - Save the contactId from response

4. Create the bill:
   - Use xero:create-invoice with type "ACCPAY"
   - Set contactId from step 3
   - Set date in YYYY-MM-DD format
   - Set reference to bill/invoice number
   - Add lineItems array with:
     * description
     * quantity
     * unitAmount (positive number)
     * accountCode (from step 2)
     * taxType (from step 2)

5. Display the deep link from response so user can verify in Xero

6. Generate a markdown summary report containing:
   - Supplier name and contact details
   - Invoice number and date
   - Table of line items with: description, quantity, unit price, account code, tax type, total
   - Grand total
   - Xero deep link
   - List the PDF filename that was processed

## Notes
- ACCPAY = Accounts Payable = Supplier Bill
- All amounts must be positive
- Account codes and tax types must exist in Xero
- The markdown report will be used by the Review Bill Entry Agent for verification