Work on receipt for payment form
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 16 Apr 2019 16:04:26 +0000 (12:04 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 16 Apr 2019 16:04:26 +0000 (12:04 -0400)
Jodie wants payment form to show more of a receipt instead of invoice.

classes/billingSupport.php
views/admin/billing/invoices.html
views/admin/billing/paymentReceipt.html [new file with mode: 0644]

index 75f3bf6..6089987 100644 (file)
@@ -734,6 +734,22 @@ class GlmBillingSupport
         $invoiceHtml = $this->generateInvoiceHtml( $templateData, 'admin/billing/invoiceStore.html' );
         return $invoiceHtml;
     }
+
+    public function viewReceipt( $invoice_id )
+    {
+        $fullInvoice = $this->getFullInvoiceData( $invoice_id );
+
+        $templateData = array(
+            'settings'   => $this->config['settings'],
+            'invoice'    => $fullInvoice['invoice'],
+            'line_items' => $fullInvoice['line_items'],
+            'account'    => $fullInvoice['account'],
+            'payments'   => $fullInvoice['payments'],
+        );
+
+        $invoiceHtml = $this->generateInvoiceHtml( $templateData, 'admin/billing/paymentReceipt.html' );
+        return $invoiceHtml;
+    }
     /**
      * getFullInvoiceData
      *
index e124a3f..d706699 100644 (file)
@@ -53,6 +53,7 @@
         <table class="wp-list-table widefat fixed posts glm-admin-table">
             <thead>
                 <tr>
+                    <th>ID</th>
                     <th>Member Name</th>
                     <th>Invoice For</th>
                     <th style="width: 150px;">Time</th>
@@ -65,6 +66,7 @@
                 {if $haveInvoices}
                     {foreach $invoices as $t}
                         <tr class="glm-invoice-row{if $t@iteration is div by 2} alternate{/if}" data-id="{$t.id}">
+                            <td> {$t.id} </td>
                             <td> <a href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.member_id}"><b>{$t.member_name}</b></a> </td>
                             <td>
                             {foreach $t.line_items as $item}
diff --git a/views/admin/billing/paymentReceipt.html b/views/admin/billing/paymentReceipt.html
new file mode 100644 (file)
index 0000000..2cdcf0e
--- /dev/null
@@ -0,0 +1,117 @@
+<style>
+#container-table {
+    font-size: 16px;
+    margin: 20px; 50px;
+}
+#container-table .line-items {
+    border-collapse: collapse;
+}
+body {
+    width: auto !important;
+}
+</style>
+<table id="container-table" width="600" cellspacing="0" cellpadding="0">
+    <tr>
+        <td>{if $settings.company_logo}<img src="{$glmPluginMediaUrl}/images/medium/{$settings.company_logo}">{/if}</td>
+        <td width="160" align="right">
+            <h1>RECEIPT</h1>
+        </td>
+    </tr>
+    <tr>
+        <td>
+            {* Billing Invoice Settings *}
+            <b>{$settings.company_name}</b></b><br>
+        {if $settings.company_name2}{$settings.company_name2}<br>{/if}
+        {if $settings.company_addr1}{$settings.company_addr1}<br>{/if}
+        {if $settings.company_addr2}{$settings.company_addr2}<br>{/if}
+        {if $settings.company_city}{$settings.company_city} {$settings.company_state}, {$settings.company_zip}<br>{/if}
+        {if $settings.company_phone}{$settings.company_phone}<br>{/if}
+        {if $settings.company_email}{$settings.company_email}<br>{/if}
+        </td>
+        <td width="220" valign="top">
+            <table width="100%">
+                <tr>
+                    <th align="right"> Invoice Date: </th>
+                    <td align="right"> {$invoice.transaction_time|date_format:"%D"} </td>
+                </tr>
+                <tr>
+                    <th align="right"> Due Date: </th>
+                    <td align="right"> {$invoice.due_date|date_format:"%D"} </td>
+                </tr>
+                <tr>
+                    <th align="right"> Account #: </th>
+                    <td align="right"> {$account.id} </td>
+                </tr>
+                <tr>
+                    <th align="right"> Invoice #: </th>
+                    <td align="right"> {$invoice.id} </td>
+                </tr>
+            </table>
+        </td>
+    </tr>
+    <tr><td colspan="2"></td></tr>
+    <tr>
+        <td colspan="2">
+            <h4>Bill To:</h4>
+            {if $account.ref_name}{$account.ref_name}<br>{/if}
+            {if $account.billing_addr1}{$account.billing_addr1}<br>{/if}
+            {if $account.billing_addr2}{$account.billing_addr2}<br>{/if}
+            {if $account.billing_city}{$account.billing_city} {$account.billing_state}, {$account.billing_zip}<br>{/if}
+            {if $account.billing_phone}{$account.billing_phone}<br>{/if}
+
+            {* Billing Settings *}
+        </td>
+    </tr>
+    <tr><td colspan="2">&nbsp;</td></tr>
+    <tr>
+        <td colspan="2">
+            <table class="line-items" width="100%">
+                <thead>
+                    <tr>
+                        <th align="left">Member Name</th>
+                        <th align="left">Anniversary</th>
+                        <th>&nbsp;</th>
+                        <th align="left">Description</th>
+                        <th align="right">Rate</th>
+                    </tr>
+                    <tr>
+                        <td colspan="5"><hr></td>
+                    </tr>
+                </thead>
+                <tbody>
+                    {foreach $line_items as $item}
+                    <tr>
+                        {if isset($item.account) && $item.account == "0"}
+                            <td align="left" width="150">N/A</td>
+                            <td align="left" width="40">N/A</td>
+                        {else}
+                            <td align="left" width="150">{$item.account.ref_name}</td>
+                            <td align="left" width="40">{$item.account.anniversary_date|date_format:"%m/%d/%y"}</td>
+                        {/if}
+                        <td align="right" width="10">&nbsp;</td>
+                        <td align="left" width="300">{$item.name}</td>
+                        <td align="right" width="60">${$item.amount|string_format:"%.2f"}</td>
+                    </tr>
+                    {/foreach}
+                    {foreach $payments as $payment}
+                    <tr>
+                        <td align="left" width="150">&nbsp;</td>
+                        <td align="left" width="20">{$payment.transaction_time|date_format:"%m/%d/%y"}</td>
+                        <td align="right" width="10">&nbsp;</td>
+                        <td align="left"> {$payment.payment_method} </td>
+                        <td align="right" width="60">{if $payment.amount >= 0}-{/if} ${abs($payment.amount)|string_format:"%.2f"}</td>
+                    </tr>
+                    {/foreach}
+                    <tr><td colspan="5"><hr></td></tr>
+                    <tr>
+                        <td colspan="4" align="right">Total Amount Due</td>
+                        <td width="70" align="right">${$invoice.balance|string_format:"%.2f"}</td>
+                    </tr>
+                </tbody>
+            </table>
+        </td>
+    </tr>
+    <tr><td colspan="2">&nbsp;</td></tr>
+    <tr><td colspan="2">&nbsp;</td></tr>
+    {* Footer of invoice *}
+</table>