Skip to main content
Skip table of contents

SQL - Owner Amounts Not Caught in DOJ

Description

Owner Amounts not caught in DOJ process

Usage

Provides a list of all OA that do not have an associated DOJ result.

This script excludes OA that have 0 values as they do not create DOJ results.

SQL

CODE
DECLARE
	@acctdate AS date = '04-01-2021'
DECLARE
	@pmtdate AS date = '04-30-2021'
	SELECT
		oa.*
	FROM
		owner_amounts oa
	LEFT JOIN journal_results jr ON jr.owner_amount_id = oa.id
		AND jr.accounting_date = oa.accounting_date
		AND jr.payment_due_date = oa.payment_due_date
WHERE
	oa.accounting_date = @acctdate
	AND oa.payment_due_date = @pmtdate
	AND oa.active = 1
	AND oa.status = 'Ready to Pay'
	AND jr.id IS NULL
	AND not(oa.value = 0
		AND oa.tax = 0
		AND oa.fee = 0
		AND oa.net = 0)
ORDER BY
	oa.id
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.