adding "last_billing_note" to transaction summary view
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 21 Jul 2005 15:48:50 +0000 (15:48 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 21 Jul 2005 15:48:50 +0000 (15:48 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1335 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm
Open-ILS/src/sql/Postgres/080.schema.money.sql

index 2fc3eaa..32c2568 100644 (file)
@@ -34,7 +34,7 @@ __PACKAGE__->table('money_billable_transaction_summary');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/xact_start usr xact_finish total_paid
                                     last_payment_ts total_owed last_billing_ts
-                                    balance_owed xact_type/);
+                                    balance_owed xact_type last_billing_note/);
 #-------------------------------------------------------------------------------
 
 package money::billing;
index bff25d4..2328c33 100644 (file)
@@ -41,6 +41,7 @@ CREATE OR REPLACE VIEW money.billable_xact_summary AS
                MAX(credit.payment_ts) AS last_payment_ts,
                SUM(COALESCE(debit.amount,0)) AS total_owed,
                MAX(debit.billing_ts) AS last_billing_ts,
+               COALESCE(debit.note,'') AS last_billing_note,
                SUM(COALESCE(debit.amount,0) - COALESCE(credit.amount,0)) AS balance_owed,
                p.relname AS xact_type
          FROM  money.billable_xact xact
@@ -48,7 +49,7 @@ CREATE OR REPLACE VIEW money.billable_xact_summary AS
                LEFT JOIN money.billing debit ON (xact.id = debit.xact AND debit.voided IS FALSE)
                LEFT JOIN money.payment credit ON (xact.id = credit.xact AND credit.voided IS FALSE)
          WHERE xact.xact_finish IS NULL
-       GROUP BY 1,2,3,4,10;
+       GROUP BY 1,2,3,4,9,11;
 
 CREATE OR REPLACE VIEW money.usr_summary AS
        SELECT  usr,