From: Chris Sharp Date: Wed, 19 Jul 2017 12:55:45 +0000 (-0400) Subject: LP#1630271 - Correct encumbrance subquery. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=342eff61ea86ce56170e3c2d5b5478366681bc71;p=evergreen%2Fpines.git LP#1630271 - Correct encumbrance subquery. Signed-off-by: Chris Sharp --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index d9ba6b2e8f..87129c15e1 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -10392,11 +10392,14 @@ SELECT usr, + + + diff --git a/Open-ILS/src/sql/Pg/example.reporter-extension.sql b/Open-ILS/src/sql/Pg/example.reporter-extension.sql index 1eb38c7b03..cac69f0996 100644 --- a/Open-ILS/src/sql/Pg/example.reporter-extension.sql +++ b/Open-ILS/src/sql/Pg/example.reporter-extension.sql @@ -377,7 +377,9 @@ CREATE OR REPLACE VIEW reporter.acq_invoice_summary_view AS invoice.payment_method, raitcb.total_cost_billed AS total_cost_billed, raitac.total_actual_cost AS total_actual_cost, - raitap.total_amount_paid AS total_amount_paid + raitap.total_amount_paid AS total_amount_paid, + invoice.close_date, + invoice.closed_by FROM acq.invoice invoice JOIN reporter.acq_invoice_total_cost_billed raitcb ON (raitcb.invoice = invoice.id) JOIN reporter.acq_invoice_total_actual_cost raitac ON (raitac.invoice = invoice.id) diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq_invoice_reporter_view.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq_invoice_reporter_view.sql index 57e2d6a3d0..37b8223ba2 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq_invoice_reporter_view.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq_invoice_reporter_view.sql @@ -93,7 +93,7 @@ SELECT po.id, (SELECT COALESCE(SUM(amount), '0.00') FROM acq.fund_debit afd WHERE afd.encumbrance = TRUE - AND afd.id IN ( + AND (afd.id IN ( SELECT fund_debit FROM acq.lineitem_detail lid WHERE lineitem IN ( @@ -108,7 +108,7 @@ SELECT po.id, SELECT fund_debit FROM acq.invoice_item WHERE purchase_order = po.id - )) AS amount_encumbered, + ))) AS amount_encumbered, -- amount_spent (SELECT COALESCE(SUM(amount), '0.00') FROM acq.fund_debit afd