authen
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_get_batch_reports_js
Parameters
Name
Type
Mode
prop_id
integer
IN
only_active
boolean
IN (DEFAULT false)
batch_type
text
IN (DEFAULT NULL)
Definition
WITH batch AS ( SELECT b.id, b.batch_name, b.batch_type, b.output_type, b.output_target, b.enabled, (select count(*) from batch_report_items i where i.batch_id = b.id and i.enabled) AS report_count FROM batch_report b --LEFT JOIN batch_report_items i ON i.batch_id = b.id WHERE (b.prop_id = $1) AND (b.enabled OR NOT only_active) AND ($3 is null or lower(b.batch_type) = lower($3)) GROUP BY 1,2,3,4,5 ORDER BY 2 ) SELECT json_agg(batch) FROM batch