Updating invoice and statement list
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 15 Mar 2018 19:01:55 +0000 (15:01 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 15 Mar 2018 19:01:55 +0000 (15:01 -0400)
Adding in the line items.

classes/billingSupport.php
classes/data/dataAccounts.php
models/admin/billing/index.php
models/admin/billing/invoices.php
models/admin/member/billing.php
views/admin/billing/invoices.html
views/admin/billing/statements.html
views/admin/settings/editNotificationType.html
views/admin/settings/invoiceTypes.html

index bd84301..80a55c2 100644 (file)
@@ -381,10 +381,12 @@ class GlmBillingSupport
             $type = $transaction['type'];
             switch ( $type ){
             case $this->config['transaction_numb']['Invoice']:
-                $invoice = $this->getInvoiceById( $transaction['type_id'] );
+                $invoice     = $this->getInvoiceById( $transaction['type_id'] );
+                $line_items  = $this->getLineItemsForInvoice( $transaction['type_id'] );
                 $balance_due = $balance_due + $invoice['amount_total'];
                 // add to the $transaction array
                 $transaction['transaction_data'] = $invoice;
+                $transaction['line_items']       = $line_items;
                 break;
             case $this->config['transaction_numb']['Payment']:
                 $payment = $this->getPaymentById( $transaction['type_id'] );
index 007c79e..220bb7a 100644 (file)
@@ -296,8 +296,9 @@ class GlmDataAccounts extends GlmDataAbstract
 
         // Remove what we don't want from the copy and get the list
         $this->fields = array(
-            'id'   => $fSave['id'],
-            'name' => $fSave['ref_name'],
+            'id'               => $fSave['id'],
+            'name'             => $fSave['ref_name'],
+            'anniversary_date' => $fSave['anniversary_date'],
         );
 
         $memberList = $this->getList($where, $order, $fieldVals, $idField, $start, $limit);
index 6f45be1..d25cbc0 100644 (file)
@@ -339,7 +339,7 @@ class GlmMembersAdmin_billing_index extends GlmDataInvoices
             $orderBy = 'transaction_time desc';
             $this->line_items_post = true;
             $invoicesResult = $this->getList($where, $orderBy, true, 'id', $start, $limit);
-            echo '<pre>$invoicesResult: ' . print_r( $invoicesResult, true ) . '</pre>';
+            // echo '<pre>$invoicesResult: ' . print_r( $invoicesResult, true ) . '</pre>';
             $this->line_items_post = false;
 
             // Get paging results
index 684b094..5926369 100644 (file)
@@ -146,7 +146,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             // Need to get the accounts
             $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
             $billingAccount = $Accounts->newEntry();
-            $accounts = $Accounts->getList( '', 'ref_name' );
+            $accounts = $Accounts->getSimpleAccountList( '', 'ref_name' );
 
             // Need a list of members that don't have an account.
             $nonAccountMembers = $this->wpdb->get_results(
@@ -245,7 +245,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             // Need to get the accounts
             $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
             $billingAccount = $Accounts->newEntry();
-            $accounts = $Accounts->getList( '', 'ref_name' );
+            $accounts = $Accounts->getSimpleAccountList( '', 'ref_name' );
 
             // Need a list of members that don't have an account.
             $nonAccountMembers = $this->wpdb->get_results(
@@ -331,7 +331,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
 
             // Need to get the accounts
             $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
-            $accounts = $Accounts->getList();
+            $accounts = $Accounts->getSimpleAccountList();
 
             $where_params = array( 'true' );
 
@@ -417,7 +417,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             $orderBy = 'transaction_time desc';
             $this->line_items_post = true;
             $invoicesResult = $this->getList($where, $orderBy, true, 'id', $start, $limit);
-            echo '<pre>$invoicesResult: ' . print_r( $invoicesResult, true ) . '</pre>';
+            // echo '<pre>$invoicesResult: ' . print_r( $invoicesResult, true ) . '</pre>';
             $this->line_items_post = false;
 
             // Get paging results
index 3839cee..d0dae7b 100644 (file)
@@ -472,6 +472,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
             $view = 'statements';
             // Get the list of invoices for this member.
             $statements = $BillingSupport->getStatementsByRefDest( $this->memberID );
+            // echo '<pre>$statements: ' . print_r( $statements, true ) . '</pre>';
             if ( $statements ) {
                 $transactions = $statements['transactions'];
                 $account_data = $statements['account_data'];
index 30cc89b..162dd2c 100644 (file)
         <tr>
             <th style="width: 50px;">ID</th>
             <th>Member Name</th>
-            <th>Time</th>
-            <th>Due Date</th>
-            <th>Amount Total</th>
-            <th>Balance</th>
-            <th>View</th>
+            <th>Invoice For</th>
+            <th style="width: 150px;">Time</th>
+            <th style="width: 70px;">Due Date</th>
+            <th style="width: 100px;">Amount Total</th>
+            <th style="width: 70px;">Balance</th>
+            <th style="width: 50px;">View</th>
         </tr>
     </thead>
     <tbody>
                 {/if}
                     <td> {$t.id} </td>
                     <td> {$t.member_name} </td>
+                    <td>
+                    {foreach $t.line_items as $item}
+                        {$item.name} {if $item.recurring && $item.recurrence_string}( {$item.recurrence_string} ){/if}
+                    {/foreach}
+                    </td>
                     <td> {$t.transaction_time.datetime} </td>
                     <td> {$t.due_date.date} </td>
                     <td> {$t.amount_total} </td>
index 2dee7da..795c495 100644 (file)
@@ -8,10 +8,11 @@
     <table class="glm-admin-table wp-list-table widefat">
         <thead>
             <tr>
-                <th>ID</th>
+                <th style="width:50px;">ID</th>
                 <th>Date</th>
                 <th>Due Date</th>
                 <th>Type</th>
+                <th>Line Items (invoices only)</th>
                 <th>Amount</th>
                 <th>Balance</th>
                 <th>&nbsp;</th>
         <tbody>
         {$alt = 0}
         {foreach $transactions as $transaction}
-            <tr{if $alt % 2 == 0} class="alternate"{/if}>
+                {* Invoices *}
                 {if $transaction.type == '10'}
-                    <td>{$transaction.transaction_data.id}</td>
-                    <td>{$transaction.transaction_data.transaction_time|date_format:"%D"}</td>
-                    <td>{$transaction.transaction_data.due_date|date_format:"%D"}</td>
-                    <td>{$transaction_types[$transaction.type]}</td>
-                    <td>${$transaction.transaction_data.amount_total}</td>
-                    <td>${$transaction.transaction_data.balance}</td>
-                    <td> <a href="{$thisUrl}?page={$thisPage}&glm_action=billing&option=view&member={$memberID}&id={$transaction.type_id}">View</a> </td>
+                    <tr{if $alt % 2 == 0} class="alternate"{/if}>
+                        <td>{$transaction.transaction_data.id}</td>
+                        <td>{$transaction.transaction_data.transaction_time|date_format:"%D"}</td>
+                        <td>{$transaction.transaction_data.due_date|date_format:"%D"}</td>
+                        <td>{$transaction_types[$transaction.type]}</td>
+                        <td>
+                            {foreach $transaction.line_items as $item}
+                                {$item.name} {if $item.recurring && $item.recurrence_string}( {$item.recurrence_string} ){/if}<br>
+                            {/foreach}
+                        </td>
+                        <td>${$transaction.transaction_data.amount_total}</td>
+                        <td>${$transaction.transaction_data.balance}</td>
+                        <td> <a href="{$thisUrl}?page={$thisPage}&glm_action=billing&option=view&member={$memberID}&id={$transaction.type_id}">View</a> </td>
+                    </tr>
+                {* Payments *}
                 {elseif $transaction.type == '20'}
-                    <td>{$transaction.transaction_data.id}</td>
-                    <td>{$transaction.transaction_data.transaction_time|date_format:"%D"}</td>
-                    <td>&nbsp;</td>
-                    <td>{$transaction_types[$transaction.type]}</td>
-                    <td>${$transaction.transaction_data.amount}</td>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
+                    <tr{if $alt % 2 == 0} class="alternate"{/if}>
+                        <td>{$transaction.transaction_data.id}</td>
+                        <td>{$transaction.transaction_data.transaction_time|date_format:"%D"}</td>
+                        <td>&nbsp;</td>
+                        <td>{$transaction_types[$transaction.type]}</td>
+                        <td>&nbsp;</td>
+                        <td>${$transaction.transaction_data.amount}</td>
+                        <td>&nbsp;</td>
+                        <td>&nbsp;</td>
+                    </tr>
                 {/if}
-            </tr>
             {$alt = $alt + 1}
         {/foreach}
 
index 49f8667..afc6994 100644 (file)
@@ -30,7 +30,7 @@
         </tr>
 
         <tr>
-            <th style="text-align: right;" colspan="2">Due Date</th>
+            <th colspan="2">Due Date</th>
         </tr>
 
         <tr>
index 9c38b1b..e3e6f38 100644 (file)
@@ -31,7 +31,7 @@
                 </td>
             </tr>
             <tr>
-                <th class="glm-required">Amount:Numbers only (999.99)</th>
+                <th class="glm-required">Amount:Numbers only<br> (999.99)</th>
                 <td>
                     <input type="text" name="amount" class="glm-form-text-input" required>
                 </td>
@@ -99,7 +99,7 @@
                 </td>
             </tr>
             <tr>
-                <th style="text-align: right;" class="glm-required">Amount:Numbers only (999.99)</th>
+                <th style="text-align: right;" class="glm-required">Amount:Numbers only<br> (999.99)</th>
                 <td>
                     <input id="edit-amount" type="text" name="amount" class="glm-form-text-input" required>
                 </td>
 <table class="wp-list-table widefat fixed posts glm-admin-table">
     <thead>
         <tr>
-            <th>ID</th>
-            <th>InvoiceType</th>
+            <th style="width: 50px;">ID</th>
+            <th style="width: 850px;">InvoiceType</th>
             <th>Amount</th>
             <th>Recurring</th>
             <th>Recurrence</th>