Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

unpaid invoice search suddenly gives weird results

Featured Replies

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?

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.

  • Author

Thank you so much, restarting the server did fix the issue.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.