Divide by zero crash with tax report and cash basis

I am receiving a divide by zero error when trying to view a tax report. This appears to be isolated to “cash basis” reports for one particular Business file I have setup. It does not occur in another Business file. I am seeking ideas as to what may be wrong or unusual with my Business file.

I have Edited a Tax Transactions report to cover 01-07-2017 to 30-09-2017 with Accounting method = Cash basis. I have confirmed that there are taxable transactions that occur during this period.

When I click to View this report I receive the following message and have to close Manager:

Internal Error

17.10.26 (Desktop)

/tax-transactions-view?Key=3636e767-885a-4783-b653-c5be44f12a05&FileID=dfff04dd-b9aa-438f-8e48-e2e8690899da

System.DivideByZeroException: Attempted to divide by zero.

   at System.Decimal.FCallDivide(Decimal& d1, Decimal& d2)

   at System.Decimal.op_Division(Decimal d1, Decimal d2)

   at Manager.Query.GeneralLedgerTransactions.GetAllGeneralLedgerTransactions(ApplicationData objects, Guid entityId, AccountingBasis accountingBasis)

   at Manager.Query.GeneralLedgerAccounts2.GetAccountsWithTransactions(ApplicationData objects, Guid fileId, AccountingBasis accountingBasis)

   at ManagerServer.Extensions.TaxAudit.GetTaxAudit(HttpHandler httpHandler, DateTime from, DateTime to, AccountingBasis accountingBasis)

   at ManagerServer.Extensions.TaxSummary.GetTaxSummary(HttpHandler httpHandler, DateTime from, DateTime to, AccountingBasis accountingBasis)

   at ManagerServer.HttpHandlers.Businesses.Business.Reports.TaxTransactions.TaxTransactionsView.GetViewModel(TaxTransactions report)

   at ManagerServer.HttpHandlers.Businesses.Business.Reports.Report`1.GetViewModel()

   at ManagerServer.HttpHandlers.Businesses.Business.Reports.Report.Get()

   at HttpFramework.HttpApplication.ProcessRequest(HttpRequest request, HttpResponse response)

   at ManagerServer.HttpApplication.ProcessRequest(HttpRequest request, HttpResponse response)

If I try to raise a GST report covering the same period and using Cash basis I get “HTTP 500 Internal Server Error” but I have the option to “Go back to the previous page”.

I still get the crash when I change the reporting date to go From today’s date Until today’s date with no transactions entered for this date.

The crash also occurs when I use the Backup (*.manager) file of this Business.

Importantly, if I change the accounting method to Accrual then none of these errors occur.

Also this does not occur with a different test Business file that I created to play around with.

System Details

Manager version 17.10.26 on Windows 10 but I ran into the same problem with Ubuntu Linux.

Which “tax report” exactly? (There is no report named “tax report.”)

Hi Tut, thanks for seeking clarification. I really appreciate your input.

The specific tax reports that I have tried are “Tax transactions” and “GST Calculations worksheet for BAS”. I get errors with both of these reports, which is why I generalised with the phrase “tax reports” and then tried to detail the issue later in my post.

Well, I’m not going to be able to resolve your problem. I think @lubos will have to look at this. Meanwhile, it would help if you captured and posted an actual screen shot of the error message rather than just reproducing the text. That will help avoid misinterpretation.

Do you have any transactions that started before 01-07-2017 but ended after that date? For example, invoice sent in June but payment received in July?

I would start by having a look at those transactions and seeing if there’s anything strange showing up on the invoice or payment screens. Numbers that don’t add up correctly, the number zero where it shouldn’t be, etc.

Thanks @ShaneAU, your suggestion was spot on. The problem seems to be caused by setting the Invoice Date of some invoices to be earlier than the Start Date of the business.

I thought this would be ok because the invoices were paid after the start date of the business and I was using cash accounting. Obviously, I was wrong.

I think the easy solution to this problem is to make the business start date earlier.

@tut suggested I post screen shots of the errors (see below). Perhaps these will help lubos update the software to more gracefully handle this date conflict. However, I am having trouble reproducing the problem by creating a new invoice issued before, but paid after, the Start Date of the business. The problem only occurs with invoices I have previously created. So there must be more complexities I am not aware of.

Sometimes when I try to view one of the tax reports I see this error.

Other times, with the same report I have seen “HTTP 500 Internal Server Error”.

Thanks very much for the help and thanks to lubos for the great software.

Aha! Glad you found the cause.

Cash Accounting = money earned when you are paid.
Accrual Accounting = money earned when invoice is generated.

It sounds like Manager gets a bit confused when you switch it to Accrual Accounting, because suddenly you’re earning money before the start date. But it’s interesting that it doesn’t happen to new ones you create with the same criteria.


Anything that causes the application to crash with an error should probably be fixed, or replaced with a more helpful error message. I would like to suggest that this be listed as a bug.

Perhaps @lubos could look into this, and potentially fix the issue?

This should definitely not cause a problem, because that is the method for establishing starting balances for customers and suppliers. See https://www.manager.io/guides/5494 and https://www.manager.io/guides/7227. For most accounts, Manager ignores transactions prior to the Start Date. But for Accounts receivable and Accounts payable, such transactions are the source of starting balances. This behavior is specifically designed to accommodate both cash and accrual basis accounting; you should be able to switch between them seamlessly. (Financial report numbers will change, as they should, but the program won’t crash.)

So while your problem may be related to those early invoices, I am not yet convinced there is a repeatable bug. The fact that you’ve narrowed down the problem suggests some more detective work on your part is required before putting this into the Bugs category, especially since no one else has reported this.

I would also strongly recommend against moving your Start Date, as that may just cover up a problem that will pop up elsewhere in the future.

Agreed on this.

I was going to try reproducing this issue on my end, but realised that since I don’t actually charge tax to my customers at the moment (I’m under the threshold), I’m not in a position to easily reproduce the problem. Best for someone else to try - like mobius.

Thanks for all the advice. I agree with your sentiment. I have tried but failed to reproduce the problem on a freshly created business. I will post back if I get any more information that can pinpoint the issue.

1 Like

@mobius, could you send me your accounting file to lubos@manager.io? Error like this is always a bug. Especially if you get it presented like you did (red frame, yellow background)

@lubos told me that he found and fixed the cause of the crash. I have tested the latest version of Manager (V17.10.65) and confirmed that the crash no longer occurs with my data file.
Thank you!

Thanks for coming back to post an update @mobius - glad to hear that.