-
-
Save jeff/6cb257edf299fb5b6810 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Find transactions that are closed but have a non-zero balance | |
-- makes the (usually safe) assumption that the mmbxs materialized view data is correct | |
-- change the org unit id as needed to narrow your focus | |
SELECT COUNT(*) | |
FROM money.materialized_billable_xact_summary mmbxs | |
JOIN actor.usr au ON (au.id = mmbxs.usr) | |
WHERE xact_finish IS NOT NULL | |
AND balance_owed <> 0 | |
AND au.home_ou IN (SELECT id FROM actor.org_unit_descendants(1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment