Page 1 of 1

receipt amount

PostPosted: Thu Dec 08, 2016 4:11 pm
by kites30
Hello,
i have on last issue i am dealing with.
I managed to rename my receipts with hazel to the date of purchase and the name of the company.
Now i also like to add the amount of the receipt. The only really easy way to identify the total amount is to take the highest amount in the receipt. Is hazel able to do that? e.g. with match patterns ? digit digit digit , digit digit.
i am happy about any help.
Thank
alex

Re: receipt amount

PostPosted: Sun Dec 11, 2016 4:01 pm
by jbrwilkinson
So this is a little bit tricky due to the variation in receipt formats that you encounter.

I made some progress with the following rule:

Contents : Contain Match : NUMERICAL AMOUNT (match 1st occurrence from the End)

Where NUMERICAL AMOUNT is a Custom Matcher defined as 'Number.Number'.

I tried this for multiple scanned receipts, but the results really varied - only if the highest amount (the total) was the very last number on the receipt would this work, otherwise I got the taxable amount, change required, etc.

Using the command line to write a script isn't much easier as searching for a specific pattern is hard. There's a Regular Expression for decimal numbers at http://www.regular-expressions.info/floatingpoint.html which may give you some leads.

Ultimately, I think you're looking for a feature in Hazel along the lines of 'Match the LARGEST occurrence'

Re: receipt amount

PostPosted: Mon Dec 12, 2016 12:38 pm
by Mr_Noodle
Even matching the largest instance may not be the best as there may be other things looking like a dollar amount (like a date with dots as separators).

You can try searching for any surrounding text. Like if the number if preceded by "Total". If you use Hazel's preview feature, you can click on the badge for the condition you are editing and it will show you the text of the document as Hazel sees it. That might reveal some sort of context which you can leverage.