Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

unpaid invoice search suddenly gives weird results


This topic is 5140 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Today I discovered that a find script that I've been using for years is suddenly not returning expected results. Our database tracks our company's orders, payments, etc. Occasionally I run a script that searches for invoices whose total due is greater than 0.

resultsoffindscript.jpg

This is result I got when running the script today. I knew it was messed up because a) the first line with a zero total was returned and : other invoices that I knew were unpaid did not appear.

resultsofsearchfor0.jpg

And when I do a manual search for either 0 or >0 or 0 and omit, in every case I don't get what I expect. Why would a search for "0" include "396" and "1971" and "2895.75" for example?

The database is set up with a table for line items, each line item has an "Item Total" field that is a calculation of "Quantity" times the "Actual Cost Each" (which is the unit price less any discounts).

Line Item records are connected to an Invoice table, and in the invoice table is a "Sum Total" field, a Sum of the Line Items' "Item Total" fields. Then a "Grand Total" calculation adds the sum total to a shipping and a tax field.

Invoices are connected to a Payments table, and each invoice record also has a "Total Payments Received" field which is a sum of the PaymentAmount field from the Payments table. Finally, the "Total Due" field subtracts the "Total Payments Received" from the "Grand Total". I search this "Total Due" field for numbers greater than 0.

But I'm getting these wacky results to my searches now. Any advice for how to track this down?

Posted

I've experienced a similar issue with a similar structure, and found that restarting the server resolved the issue. I'm not sure this counts as a "fix", but it seems to work.

This topic is 5140 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.