LP#1811132: add Debit Card payment type
authorJeff Davis <jeff.davis@bc.libraries.coop>
Fri, 8 Mar 2019 22:12:04 +0000 (14:12 -0800)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 26 Feb 2020 21:22:21 +0000 (16:22 -0500)
Signed-off-by: Jeff Davis <jeff.davis@bc.libraries.coop>
Signed-off-by: Ruth Frasur <rfrasur@gmail.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>

15 files changed:
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/extras/ils_events.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm
Open-ILS/src/sql/Pg/080.schema.money.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql [new file with mode: 0644]
Open-ILS/src/templates/staff/base_js.tt2
Open-ILS/src/templates/staff/circ/patron/t_bills.tt2
Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
Open-ILS/web/opac/common/js/fm_table_conf.js

index aefd66e..7622efd 100644 (file)
@@ -94,6 +94,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field name="cash_payment" oils_persist:virtual="true" />
                        <field name="check_payment" oils_persist:virtual="true" />
                        <field name="credit_card_payment" oils_persist:virtual="true" />
+                       <field name="debit_card_payment" oils_persist:virtual="true" />
                </fields>
                <links>
                        <link field="workstation" reltype="has_a" key="id" map="" class="aws"/>
@@ -7462,6 +7463,33 @@ SELECT  usr,
                        </actions>
                </permacrud>
        </class>
+       <class id="mdcp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::debit_card_payment" oils_persist:tablename="money.debit_card_payment" reporter:label="Debit Card Payment">
+               <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
+                       <field reporter:label="Accepting Staff Member" name="accepting_usr" reporter:datatype="link"/>
+                       <field reporter:label="Amount" name="amount" reporter:datatype="money" />
+                       <field reporter:label="Amount Collected" name="amount_collected" reporter:datatype="money" />
+                       <field reporter:label="Workstation link" name="cash_drawer" reporter:datatype="link"/>
+                       <field reporter:label="Payment ID" name="id" reporter:datatype="id" />
+                       <field reporter:label="Note" name="note" reporter:datatype="text"/>
+                       <field reporter:label="Payment Timestamp" name="payment_ts" reporter:datatype="timestamp"/>
+                       <field reporter:label="Transaction link" name="xact" reporter:datatype="link"/>
+                       <field reporter:label="Payment link" name="payment" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Payment Type" name="payment_type" oils_persist:virtual="true" reporter:datatype="text"/>
+               </fields>
+               <links>
+                       <link field="payment" reltype="might_have" key="id" map="" class="mp"/>
+                       <link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="cash_drawer" reltype="has_a" key="id" map="" class="aws"/>
+                       <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
+               </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
+       </class>
        <class id="acp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::copy" oils_persist:tablename="asset.copy" reporter:core="true" reporter:label="Item">
                <fields oils_persist:primary="id" oils_persist:sequence="asset.copy_id_seq">
                        <field reporter:label="Age Hold Protection" name="age_protect" reporter:datatype="link"/>
@@ -8054,6 +8082,7 @@ SELECT  usr,
                        <field reporter:label="Forgive Payment Detail" name="forgive_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Goods Payment Detail" name="goods_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Account Adjustment Detail" name="account_adjustment" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Debit Card Payment Detail" name="debit_card_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
@@ -8065,6 +8094,7 @@ SELECT  usr,
                        <link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
                        <link field="account_adjustment" reltype="might_have" key="id" map="" class="maa"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
+                       <link field="debit_card_payment" reltype="might_have" key="id" map="" class="mdcp"/>
                </links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
@@ -8136,6 +8166,7 @@ SELECT  usr,
                        <field reporter:label="Forgive Payment Detail" name="forgive_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Goods Payment Detail" name="goods_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Account Adjustment Detail" name="account_adjustment" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Debit Card Payment Detail" name="debit_card_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
@@ -8148,6 +8179,7 @@ SELECT  usr,
                        <link field="account_adjustment" reltype="might_have" key="id" map="" class="maa"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                        <link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="debit_card_payment" reltype="might_have" key="id" map="" class="mdcp"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
                        <actions>
@@ -8195,6 +8227,7 @@ SELECT  usr,
                        <field reporter:label="Cash Payment" name="cash_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Credit Card Payment" name="credit_card_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Check Payment" name="check_payment" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Debit Card Payment" name="debit_card_payment" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
@@ -8203,6 +8236,7 @@ SELECT  usr,
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                        <link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
                        <link field="cash_drawer" reltype="has_a" key="id" map="" class="aws"/>
+                       <link field="debit_card_payment" reltype="might_have" key="id" map="" class="mdcp"/>
                </links>
        </class>
        <class id="cbrebi" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="container::biblio_record_entry_bucket_item" oils_persist:tablename="container.biblio_record_entry_bucket_item" reporter:label="Biblio Record Entry Bucket Item">
index 7caebc7..cc0d3f8 100644 (file)
        <event code='1715' textcode='HOLD_SUSPEND_AFTER_CAPTURE'>
                <desc xml:lang="en-US">Attempt to suspend a hold after it has been captured.</desc>
        </event>
+       <event code='1716' textcode='MONEY_DEBIT_CARD_PAYMENT_NOT_FOUND'>
+               <desc xml:lang='en-US'>The requested money_debit_card_payment was not found</desc>
+       </event>
 
        <event code='1900' textcode='URL_VERIFY_NOT_SESSION_CREATOR'>
                <desc xml:lang="en-US">You did not create this URL Verify session, so you cannot change it.  You may be able to clone it.</desc>
index 3c40e2d..af9c9af 100644 (file)
@@ -1938,6 +1938,7 @@ sub user_payments_list {
                         'xact',
                         'cash_payment',
                         'credit_card_payment',
+                        'debit_card_payment',
                         'credit_payment',
                         'check_payment',
                         'work_payment',
index ac57794..599764f 100644 (file)
@@ -716,6 +716,7 @@ sub modify_from_fieldmapper {
     #money::payment->might_have( cash_payment => 'money::cash_payment' );
     #money::payment->might_have( check_payment => 'money::check_payment' );
     #money::payment->might_have( credit_card_payment => 'money::credit_card_payment' );
+    #money::payment->might_have( debit_card_payment => 'money::debit_card_payment' );
     #money::payment->might_have( forgive_payment => 'money::forgive_payment' );
     #money::payment->might_have( work_payment => 'money::work_payment' );
     #money::payment->might_have( credit_payment => 'money::credit_payment' );
@@ -732,6 +733,10 @@ sub modify_from_fieldmapper {
     money::credit_card_payment->has_a( accepting_usr => 'actor::user' );
     #money::credit_card_payment->might_have( payment => 'money::payment' );
 
+    money::debit_card_payment->has_a( xact => 'money::billable_transaction' );
+    money::debit_card_payment->has_a( accepting_usr => 'actor::user' );
+    #money::debit_card_payment->might_have( payment => 'money::payment' );
+
     money::forgive_payment->has_a( xact => 'money::billable_transaction' );
     money::forgive_payment->has_a( accepting_usr => 'actor::user' );
     #money::forgive_payment->might_have( payment => 'money::payment' );
index c9d7247..931b1b8 100644 (file)
@@ -120,6 +120,13 @@ __PACKAGE__->columns(Essential => qw/xact amount payment_ts cash_drawer
                      approval_code note voided cc_number/);
 #-------------------------------------------------------------------------------
 
+package money::debit_card_payment;
+use base qw/money/;
+__PACKAGE__->table('money_debit_card_payment');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/xact amount payment_ts cash_drawer accepting_usr amount_collected note/);
+#-------------------------------------------------------------------------------
+
 package money::forgive_payment;
 use base qw/money/;
 __PACKAGE__->table('money_forgive_payment');
index f680b1c..196c46c 100644 (file)
     money::credit_card_payment->sequence( 'money.payment_id_seq' );
 
     #---------------------------------------------------------------------
+    package money::debit_card_payment;
+    
+    money::debit_card_payment->table( 'money.debit_card_payment' );
+    money::debit_card_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
     package money::work_payment;
     
     money::work_payment->table( 'money.work_payment' );
index d2db7ae..e2ffb49 100644 (file)
@@ -422,7 +422,8 @@ sub ou_desk_payments {
     SELECT  ws.id as workstation,
         SUM( CASE WHEN p.payment_type = 'cash_payment' THEN p.amount ELSE 0.0 END ) as cash_payment,
         SUM( CASE WHEN p.payment_type = 'check_payment' THEN p.amount ELSE 0.0 END ) as check_payment,
-        SUM( CASE WHEN p.payment_type = 'credit_card_payment' THEN p.amount ELSE 0.0 END ) as credit_card_payment
+        SUM( CASE WHEN p.payment_type = 'credit_card_payment' THEN p.amount ELSE 0.0 END ) as credit_card_payment,
+        SUM( CASE WHEN p.payment_type = 'debit_card_payment' THEN p.amount ELSE 0.0 END ) as debit_card_payment
       FROM  money.desk_payment_view p
         JOIN actor.workstation ws ON (ws.id = p.cash_drawer)
       WHERE p.payment_ts >= '$startdate'
@@ -442,6 +443,7 @@ sub ou_desk_payments {
         $x->cash_payment($$r[1]);
         $x->check_payment($$r[2]);
         $x->credit_card_payment($$r[3]);
+        $x->debit_card_payment($$r[4]);
 
         $client->respond($x);
     }
index 7d30797..88a724b 100644 (file)
@@ -668,11 +668,24 @@ CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.credit_card_payment FOR
 CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.credit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('credit_card_payment');
 
 
+CREATE TABLE money.debit_card_payment () INHERITS (money.bnm_desk_payment);
+ALTER TABLE money.debit_card_payment ADD PRIMARY KEY (id);
+CREATE INDEX money_debit_card_payment_xact_idx ON money.debit_card_payment (xact);
+CREATE INDEX money_debit_card_id_idx ON money.debit_card_payment (id);
+CREATE INDEX money_debit_card_payment_ts_idx ON money.debit_card_payment (payment_ts);
+CREATE INDEX money_debit_card_payment_accepting_usr_idx ON money.debit_card_payment (accepting_usr);
+CREATE INDEX money_debit_card_payment_cash_drawer_idx ON money.debit_card_payment (cash_drawer);
+
+CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('debit_card_payment');
+CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('debit_card_payment');
+CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('debit_card_payment');
+
+
 CREATE OR REPLACE VIEW money.non_drawer_payment_view AS
        SELECT  p.*, c.relname AS payment_type
          FROM  money.bnm_payment p         
                        JOIN pg_class c ON p.tableoid = c.oid
-         WHERE c.relname NOT IN ('cash_payment','check_payment','credit_card_payment');
+         WHERE c.relname NOT IN ('cash_payment','check_payment','credit_card_payment','debit_card_payment');
 
 CREATE OR REPLACE VIEW money.cashdrawer_payment_view AS
        SELECT  ou.id AS org_unit,
index ee5b465..e7e1a37 100644 (file)
@@ -11788,6 +11788,7 @@ Transaction ID: [% xact_id %]
                     [% CASE "check_payment" %]check
                     [% CASE "credit_card_payment" %]credit card
                     [%- IF mp.credit_card_payment.cc_number %] ([% mp.credit_card_payment.cc_number %])[% END %]
+                    [% CASE "debit_card_payment" %]debit card
                     [% CASE "credit_payment" %]credit
                     [% CASE "forgive_payment" %]forgiveness
                     [% CASE "goods_payment" %]goods
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql
new file mode 100644 (file)
index 0000000..01a3d3f
--- /dev/null
@@ -0,0 +1,147 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE TABLE money.debit_card_payment () INHERITS (money.bnm_desk_payment);
+ALTER TABLE money.debit_card_payment ADD PRIMARY KEY (id);
+CREATE INDEX money_debit_card_payment_xact_idx ON money.debit_card_payment (xact);
+CREATE INDEX money_debit_card_id_idx ON money.debit_card_payment (id);
+CREATE INDEX money_debit_card_payment_ts_idx ON money.debit_card_payment (payment_ts);
+CREATE INDEX money_debit_card_payment_accepting_usr_idx ON money.debit_card_payment (accepting_usr);
+CREATE INDEX money_debit_card_payment_cash_drawer_idx ON money.debit_card_payment (cash_drawer);
+
+CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('debit_card_payment');
+CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('debit_card_payment');
+CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('debit_card_payment');
+CREATE OR REPLACE VIEW money.non_drawer_payment_view AS
+       SELECT  p.*, c.relname AS payment_type
+         FROM  money.bnm_payment p         
+                       JOIN pg_class c ON p.tableoid = c.oid
+         WHERE c.relname NOT IN ('cash_payment','check_payment','credit_card_payment');
+         WHERE c.relname NOT IN ('cash_payment','check_payment','credit_card_payment','debit_card_payment');
+
+UPDATE action_trigger.event_definition 
+    SET template = $$
+[%- USE date -%]
+[%- SET user = target.0.xact.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
+Subject: Payment Receipt
+Auto-Submitted: auto-generated
+
+[% date.format -%]
+[%- SET xact_mp_hash = {} -%]
+[%- FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions -%]
+    [%- SET xact_id = mp.xact.id -%]
+    [%- IF ! xact_mp_hash.defined( xact_id ) -%][%- xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } -%][%- END -%]
+    [%- xact_mp_hash.$xact_id.payments.push(mp) -%]
+[%- END -%]
+[%- FOR xact_id IN xact_mp_hash.keys.sort -%]
+    [%- SET xact = xact_mp_hash.$xact_id.xact %]
+Transaction ID: [% xact_id %]
+    [% IF xact.circulation %][% helpers.get_copy_bib_basics(xact.circulation.target_copy).title %]
+    [% ELSE %]Miscellaneous
+    [% END %]
+    Line item billings:
+        [%- SET mb_type_hash = {} -%]
+        [%- FOR mb IN xact.billings %][%# Group billings by their btype -%]
+            [%- IF mb.voided == 'f' -%]
+                [%- SET mb_type = mb.btype.id -%]
+                [%- IF ! mb_type_hash.defined( mb_type ) -%][%- mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } -%][%- END -%]
+                [%- IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) -%][%- mb_type_hash.$mb_type.first_ts = mb.billing_ts -%][%- END -%]
+                [%- mb_type_hash.$mb_type.last_ts = mb.billing_ts -%]
+                [%- mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount -%]
+                [%- mb_type_hash.$mb_type.billings.push( mb ) -%]
+            [%- END -%]
+        [%- END -%]
+        [%- FOR mb_type IN mb_type_hash.keys.sort -%]
+            [%- IF mb_type == 1 %][%-# Consolidated view of overdue billings -%]
+                $[% mb_type_hash.$mb_type.sum %] for [% mb_type_hash.$mb_type.billings.0.btype.name %] 
+                    on [% mb_type_hash.$mb_type.first_ts %] through [% mb_type_hash.$mb_type.last_ts %]
+            [%- ELSE -%][%# all other billings show individually %]
+                [% FOR mb IN mb_type_hash.$mb_type.billings %]
+                    $[% mb.amount %] for [% mb.btype.name %] on [% mb.billing_ts %] [% mb.note %]
+                [% END %]
+            [% END %]
+        [% END %]
+    Line item payments:
+        [% FOR mp IN xact_mp_hash.$xact_id.payments %]
+            Payment ID: [% mp.id %]
+                Paid [% mp.amount %] via [% SWITCH mp.payment_type -%]
+                    [% CASE "cash_payment" %]cash
+                    [% CASE "check_payment" %]check
+                    [% CASE "credit_card_payment" %]credit card
+                    [%- IF mp.credit_card_payment.cc_number %] ([% mp.credit_card_payment.cc_number %])[% END %]
+                    [% CASE "debit_card_payment" %]debit card
+                    [% CASE "credit_payment" %]credit
+                    [% CASE "forgive_payment" %]forgiveness
+                    [% CASE "goods_payment" %]goods
+                    [% CASE "work_payment" %]work
+                [%- END %] on [% mp.payment_ts %] [% mp.note %]
+        [% END %]
+[% END %]
+$$
+WHERE id = 29 AND template = $$
+[%- USE date -%]
+[%- SET user = target.0.xact.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
+Subject: Payment Receipt
+Auto-Submitted: auto-generated
+
+[% date.format -%]
+[%- SET xact_mp_hash = {} -%]
+[%- FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions -%]
+    [%- SET xact_id = mp.xact.id -%]
+    [%- IF ! xact_mp_hash.defined( xact_id ) -%][%- xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } -%][%- END -%]
+    [%- xact_mp_hash.$xact_id.payments.push(mp) -%]
+[%- END -%]
+[%- FOR xact_id IN xact_mp_hash.keys.sort -%]
+    [%- SET xact = xact_mp_hash.$xact_id.xact %]
+Transaction ID: [% xact_id %]
+    [% IF xact.circulation %][% helpers.get_copy_bib_basics(xact.circulation.target_copy).title %]
+    [% ELSE %]Miscellaneous
+    [% END %]
+    Line item billings:
+        [%- SET mb_type_hash = {} -%]
+        [%- FOR mb IN xact.billings %][%# Group billings by their btype -%]
+            [%- IF mb.voided == 'f' -%]
+                [%- SET mb_type = mb.btype.id -%]
+                [%- IF ! mb_type_hash.defined( mb_type ) -%][%- mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } -%][%- END -%]
+                [%- IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) -%][%- mb_type_hash.$mb_type.first_ts = mb.billing_ts -%][%- END -%]
+                [%- mb_type_hash.$mb_type.last_ts = mb.billing_ts -%]
+                [%- mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount -%]
+                [%- mb_type_hash.$mb_type.billings.push( mb ) -%]
+            [%- END -%]
+        [%- END -%]
+        [%- FOR mb_type IN mb_type_hash.keys.sort -%]
+            [%- IF mb_type == 1 %][%-# Consolidated view of overdue billings -%]
+                $[% mb_type_hash.$mb_type.sum %] for [% mb_type_hash.$mb_type.billings.0.btype.name %] 
+                    on [% mb_type_hash.$mb_type.first_ts %] through [% mb_type_hash.$mb_type.last_ts %]
+            [%- ELSE -%][%# all other billings show individually %]
+                [% FOR mb IN mb_type_hash.$mb_type.billings %]
+                    $[% mb.amount %] for [% mb.btype.name %] on [% mb.billing_ts %] [% mb.note %]
+                [% END %]
+            [% END %]
+        [% END %]
+    Line item payments:
+        [% FOR mp IN xact_mp_hash.$xact_id.payments %]
+            Payment ID: [% mp.id %]
+                Paid [% mp.amount %] via [% SWITCH mp.payment_type -%]
+                    [% CASE "cash_payment" %]cash
+                    [% CASE "check_payment" %]check
+                    [% CASE "credit_card_payment" %]credit card
+                    [%- IF mp.credit_card_payment.cc_number %] ([% mp.credit_card_payment.cc_number %])[% END %]
+                    [% CASE "credit_payment" %]credit
+                    [% CASE "forgive_payment" %]forgiveness
+                    [% CASE "goods_payment" %]goods
+                    [% CASE "work_payment" %]work
+                [%- END %] on [% mp.payment_ts %] [% mp.note %]
+        [% END %]
+[% END %]
+$$;
+COMMIT;
+
index 14d570a..53e6f5f 100644 (file)
@@ -122,6 +122,7 @@ UpUp.start({
     s.EG_WORK_LOG_CASH_PAYMENT = '[% l('Cash Payment') %]';
     s.EG_WORK_LOG_CHECK_PAYMENT = '[% l('Check Payment') %]';
     s.EG_WORK_LOG_CREDIT_CARD_PAYMENT = '[% l('Credit Card Payment') %]';
+    s.EG_WORK_LOG_DEBIT_CARD_PAYMENT = '[% l('Debit Card Payment') %]';
     s.EG_WORK_LOG_CREDIT_PAYMENT = '[% l('Credit Payment') %]';
     s.EG_WORK_LOG_WORK_PAYMENT = '[% l('Work Payment') %]';
     s.EG_WORK_LOG_FORGIVE_PAYMENT = '[% l('Forgive Payment') %]';
index b2d41cc..7ceab6c 100644 (file)
@@ -51,6 +51,7 @@
               <option value="cash_payment" selected="selected">[% l('Cash') %]</option>
               <option value="check_payment">[% l('Check') %]</option>
               <option value="credit_card_payment">[% l('Credit Card') %]</option>
+              <option value="debit_card_payment">[% l('Debit Card') %]</option>
               <option value="credit_payment">[% l('Patron Credit') %]</option>
               <option value="work_payment">[% l('Work') %]</option>
               <option value="forgive_payment">[% l('Forgive') %]</option>
index 029fa5b..de88c70 100644 (file)
@@ -40,6 +40,7 @@ A receipt of your  transaction:<hr/>
         <div ng-switch-when="cash_payment">[% l('Cash') %]</div>
         <div ng-switch-when="check_payment">[% l('Check') %]</div>
         <div ng-switch-when="credit_card_payment">[% l('Credit Card') %]</div>
+        <div ng-switch-when="debit_card_payment">[% l('Debit Card') %]</div>
         <div ng-switch-when="credit_payment">[% l('Patron Credit') %]</div>
         <div ng-switch-when="work_payment">[% l('Work') %]</div>
         <div ng-switch-when="forgive_payment">[% l('Forgive') %]</div>
index cb10593..a0dd979 100644 (file)
@@ -60,6 +60,7 @@ function($q , egCore , egWorkLog , patronSvc) {
                 case 'cash_payment' : msg = egCore.strings.EG_WORK_LOG_CASH_PAYMENT; break;
                 case 'check_payment' : msg = egCore.strings.EG_WORK_LOG_CHECK_PAYMENT; break;
                 case 'credit_card_payment' : msg = egCore.strings.EG_WORK_LOG_CREDIT_CARD_PAYMENT; break;
+                case 'debit_card_payment' : msg = egCore.strings.EG_WORK_LOG_DEBIT_CARD_PAYMENT; break;
                 case 'credit_payment' : msg = egCore.strings.EG_WORK_LOG_CREDIT_PAYMENT; break;
                 case 'work_payment' : msg = egCore.strings.EG_WORK_LOG_WORK_PAYMENT; break;
                 case 'forgive_payment' : msg = egCore.strings.EG_WORK_LOG_FORGIVE_PAYMENT; break;
index c1c4c53..8bb7b10 100644 (file)
@@ -64,12 +64,14 @@ var FM_TABLE_DISPLAY = {
                        'workstation',
                        'cash_payment',
                        'check_payment',        
-                       'credit_card_payment'
+                       'credit_card_payment',
+                       'debit_card_payment'
                ],
                money : [
                        'cash_payment',
                        'check_payment',        
-                       'credit_card_payment'
+                       'credit_card_payment',
+                       'debit_card_payment'
                ]
        },