Hazel Rule for Hurley Travel Receipts
Posted onThis article is a specific implementation of the concepts discussed in Hazel for Expense Receipts.
This rule is specifically so I can report the cost of an airline ticket. My employer pays for the tickets directly, but we're still required to add them as a non-reimbursable item on the appropriate report. All other items in the itinerary get their own receipt from the vendor (hotel or car rental company, et cetera).
My employer has had more than one travel agent, but all of their documents have a very similar format. I suspect that all agents booking for American Express Travel (Concur) will have formats that are similar enough to adapt this rule.
I like to use the last leg of a flight as the date for reporting, in case the trip goes over the end of a month.
The document contains a table that has a row for each "travel event". So for each fight, hotel stay, or car rental there is a row. I've never had an itinerary where the last row wasn't the final flight, so I use that date -- your mileage may vary.
These are the details:
Notice that this rule matches two separate strings within the document. When we book with this travel agent, we get a confirmation of the request first, and once everythign is ticketed we get a second message with a real itinerary attached.
We have to look for a date (in the pattern below) that follows a word, comma, and space. The last occurrance in the file is picked because the search is configured to start at the end.
The for this match, I named the pattern to reflect what it matches. So two-digit month (zero padded), one digit day (no padding), four digit year -- all separated by slashes.
This just shows that you can reference the matched text from the "match" area in the "action" area.
Here we can see that the date pattern has been altered for use -- it's been re-ordered, and the day has been removed.