# Invoice sync - ops handover Version 0.9.1 · Written 2026-10-23 · Escalation: RPA dev team, Teams channel #rpa-support ## 1. What the bot does Every hour it takes the approved invoices in the finance export file (`data/input/invoices.csv`) and creates them in the billing system through billing's web API. It checks each invoice first: required fields filled in and a valid, positive amount. It then sends the invoice to billing. If billing is busy or slow, it retries. For each run it writes one report file in `data/output/`, listing every invoice with a Status and a Message, and adds a few lines to `logs/sync.log`. It has no window or screen of its own and does not drive any desktop app or browser. It talks to billing directly over the network. ## 2. How it works ``` Windows Task Scheduler (every hour) └─ starts → Invoice sync script ──sends invoices──> Billing system (web API) │ ├─ reads → data/input/invoices.csv ├─ writes → data/output/sync_report_.csv └─ writes → logs/sync.log ``` - **Task Scheduler** starts the bot every hour on the bot machine. Nobody needs to click anything. - **The Invoice sync script** is the bot. It runs with no window, works through the input file from top to bottom, then stops. - **The billing system** is where invoices are created. The bot only creates invoices and checks whether they exist. It never edits or deletes them. - **The input file** is the finance export. The bot reads it and never changes it. If the file is not replaced, the next run sends every row again (see Duplicate in section 6). - **The report file** is one new file per run with columns `invoice_no`, `customer`, `Status` and `Message`. This is the main place to look. - **The log file** gets one line per invoice (invoice number and status) and a closing `run done` line when the run finishes. **One run, step by step:** 1. Open the input file and create a new report file for this run. 2. For each row, check that invoice number, customer ID, amount and currency are filled in, and that the amount is a positive number. If not, the row is marked **Invalid** and nothing is sent to billing. 3. Send the invoice to billing. 4. If billing is busy, slow or unreachable, check whether the invoice was created anyway, wait, and try again (up to 5 tries; section 8). 5. Write the outcome to the report and the log, then move to the next row. 6. Write `run done -> sync_report_