Updating reports generator
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 26 Aug 2019 20:25:12 +0000 (16:25 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 26 Aug 2019 20:25:12 +0000 (16:25 -0400)
Adding billing account field to report generator.

classes/data/dataTransactions.php
models/admin/ajax/reportsListExport.php
views/admin/ajax/reportsListExportCsv.html
views/admin/billing/exportReportModal.html

index 865282c..3a2cb92 100644 (file)
@@ -195,7 +195,7 @@ class GlmDataTransactions extends GlmDataAbstract
         if ( $this->member_data ) {
             $member_data = $this->wpdb->get_row(
                 $this->wpdb->prepare(
-                    "SELECT A.ref_name,A.ref_dest
+                    "SELECT A.*
                        FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "transactions I
                        LEFT OUTER JOIN " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts A ON ( I.account = A.id )
                       WHERE I.id = %d",
@@ -209,6 +209,13 @@ class GlmDataTransactions extends GlmDataAbstract
             if ( isset( $member_data ) && $member_data['ref_dest'] ) {
                 $r['member_id'] = $member_data['ref_dest'];
             }
+            $r['email']         = $member_data['email'];
+            $r['billing_addr1'] = $member_data['billing_addr1'];
+            $r['billing_addr2'] = $member_data['billing_addr2'];
+            $r['billing_city']  = $member_data['billing_city'];
+            $r['billing_state'] = $member_data['billing_state'];
+            $r['billing_zip']   = $member_data['billing_zip'];
+            $r['billing_phone'] = $member_data['billing_phone'];
         }
         if ( $this->notes ) {
             if ( $r['type'] == $this->config['transaction_numb']['Invoice'] ) {
index 1e8c615..dcd3e0e 100644 (file)
@@ -106,6 +106,13 @@ class GlmMembersAdmin_ajax_reportsListExport extends GlmDataTransactions
             'exportInvoiceAmount'   => $this->checkFlag('exportInvoiceAmount'),
             'exportPaymentAmount'   => $this->checkFlag('exportPaymentAmount'),
             'exportNotes'           => $this->checkFlag('exportNotes'),
+            'exportEmail'           => $this->checkFlag('exportEmail'),
+            'exportAddr1'           => $this->checkFlag('exportAddr1'),
+            'exportAddr2'           => $this->checkFlag('exportAddr2'),
+            'exportCity'            => $this->checkFlag('exportCity'),
+            'exportState'           => $this->checkFlag('exportState'),
+            'exportZip'             => $this->checkFlag('exportZip'),
+            'exportPhone'           => $this->checkFlag('exportPhone'),
         );
 
         // When searching
index c4dff4e..a177bc6 100644 (file)
@@ -2,17 +2,31 @@
 {if $select.exportId}"ID",{/if}
 {if $select.exportTransactionTime}"Transaction Time",{/if}
 {if $select.exportMember}"{$terms.term_member_cap} Name",{/if}
+{if $select.exportEmail}"Email",{/if}
+{if $select.exportAddr1}"Address 1",{/if}
+{if $select.exportAddr2}"Address 2",{/if}
+{if $select.exportCity}"City",{/if}
+{if $select.exportState}"State",{/if}
+{if $select.exportZip}"Zip",{/if}
+{if $select.exportPhone}"Phone",{/if}
+{if $select.exportNotes}"Notes",{/if}
 {if $select.exportInvoiceAmount}"Invoice Amount",{/if}
 {if $select.exportPaymentAmount}"Payment Amount",{/if}
-{if $select.exportNotes}"Notes"{/if}
 
 {foreach $accounts as $account}
 {if $select.exportId}"{$account.id}",{/if}
 {if $select.exportTransactionTime}"{$account.transaction_time.datetime}",{/if}
 {if $select.exportMember}"{$account.member_name}",{/if}
+{if $select.exportEmail}"{$account.email}",{/if}
+{if $select.exportAddr1}"{$account.billing_addr1}",{/if}
+{if $select.exportAddr2}"{$account.billing_addr2}",{/if}
+{if $select.exportCity}"{$account.billing_city}",{/if}
+{if $select.exportState}"{if $account.billing_state}{$account.billing_state}{/if}",{/if}
+{if $select.exportZip}"{$account.billing_zip}",{/if}
+{if $select.exportPhone}"{$account.billing_phone}",{/if}
+{if $select.exportNotes}"{$account.notes}",{/if}
 {if $select.exportInvoiceAmount}"{$account.current_invoice_total|string_format:"%.2f"}",{/if}
 {if $select.exportPaymentAmount}"{$account.current_payment_total|string_format:"%.2f"}",{/if}
-{if $select.exportNotes}"{$account.notes}"{/if}
 
 {/foreach}
 {else}No Accounts Selected{/if}
index 7e0a7a1..1025c65 100644 (file)
                                 <input type="checkbox" name="exportInvoiceAmount" checked> Invoice Amount <br>
                                 <input type="checkbox" name="exportPaymentAmount" checked> Payment Amount <br>
                                 <input type="checkbox" name="exportNotes" checked> Notes<br>
+
+                                <input type="checkbox" name="exportEmail" checked> Billing Email<br>
+                                <input type="checkbox" name="exportAddr1" checked> Billing Address 1<br>
+                                <input type="checkbox" name="exportAddr2" checked> Billing Address 2<br>
+                                <input type="checkbox" name="exportCity" checked> Billing City<br>
+                                <input type="checkbox" name="exportState" checked> Billing State<br>
+                                <input type="checkbox" name="exportZip" checked> Billing Zip<br>
+                                <input type="checkbox" name="exportPhone" checked> Billing Phone<br>
                             </td>
                         </tr>
                     </table>