I have tried this https://stackoverflow.com/questions/3318695/how-to-implement-logging-and-error-reporting-in-sql-stored-procedures/45410654#45410654 to catch the wrong date on the purchase invoice, however it did not help. Maybe I can enable some more detailed logging to catch the wrong invoice?