From 71be5bc207545ac677197831b262ca5dde3d653e Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Wed, 19 Jul 2017 08:55:45 -0400 Subject: [PATCH] LP#1630271 - Correct encumbrance subquery. Signed-off-by: Chris Sharp --- Open-ILS/examples/fm_IDL.xml | 3 +++ Open-ILS/src/sql/Pg/example.reporter-extension.sql | 4 +++- Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq_invoice_reporter_view.sql | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 93cf385f46..8fa30f70ef 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -10443,11 +10443,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 -- 2.11.0