Last minute edits from work.
authorSteve Sutton <steve@gaslightmedia.com>
Sat, 10 Mar 2018 14:05:11 +0000 (09:05 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Sat, 10 Mar 2018 14:05:11 +0000 (09:05 -0500)
invoices
Adding amount to invoice

models/admin/billing/index.php
models/admin/billing/invoices.php
views/admin/billing/editInvoice.html
views/admin/billing/invoices.html

index 0ed8bce..2a54d8f 100644 (file)
@@ -217,7 +217,7 @@ class GlmMembersAdmin_billing_index extends GlmDataInvoices
             break;
         case 'list':
             // Get list of pending invoices ( not overdue )
-            $pendingWhere = 'T.paid <> true AND due_date > NOW()';
+            $pendingWhere = 'T.paid <> true AND T.due_date > now()';
             $start        = 1;
             $pending      = $this->getList( $pendingWhere, 'transaction_time', true, 'id', $start, $limit );
             /**
@@ -226,10 +226,10 @@ class GlmMembersAdmin_billing_index extends GlmDataInvoices
             $numberPending = ( isset( $pending['returned'] ) ? $pending['returned'] : 0 );
 
             // Get the number of over due invoices
-            $overDueWhere  = 'T.paid <> true AND due_date > NOW()';
+            $overDueWhere  = 'T.paid <> true AND T.due_date < now()';
             $start         = 1;
             $overdue       = $this->getList( $overDueWhere, 'transaction_time', true, 'id', $start, $limit );
-            $numberOverDue = $overdue['returned'];
+            $numberOverdue = $overdue['returned'];
 
             break;
         }
index 220adac..b8d42e1 100644 (file)
@@ -181,6 +181,9 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             $_REQUEST['due_date'] = date('Y-m-d', strtotime($_REQUEST['due_date']));
             // echo '<pre>' . print_r( $_REQUEST, true ) . '</pre>';
             $invoices = $this->insertEntry();
+
+            // TODO: Need to check to see if we received a good response
+            // For adding the new Invoice.
             $this->invoice_id = $invoices['fieldData']['id'];
             // After the Invoice is created need to add each line item
             if ( isset( $_REQUEST['line_items'] ) ) {
index 6aea838..bc47a27 100644 (file)
@@ -387,6 +387,9 @@ jQuery(document).ready(function($){
         return valid;
     }
 
+    /**
+     * Add a single line item to the invoice page
+     */
     function addLineItemToInvoice( lineItem )
     {
         lineItem.qty = parseInt(1);
@@ -584,6 +587,7 @@ jQuery(document).ready(function($){
             invoiceTypeJSON = data;
             // console.log( 'invoiceTypeJSON', invoiceTypeJSON );
             addLineItemToInvoice( invoiceTypeJSON[lineItemId] );
+            totalInvoice();
         });
     }
 
index 25aed15..30cc89b 100644 (file)
@@ -45,6 +45,7 @@
             <th>Member Name</th>
             <th>Time</th>
             <th>Due Date</th>
+            <th>Amount Total</th>
             <th>Balance</th>
             <th>View</th>
         </tr>
@@ -62,6 +63,7 @@
                     <td> {$t.member_name} </td>
                     <td> {$t.transaction_time.datetime} </td>
                     <td> {$t.due_date.date} </td>
+                    <td> {$t.amount_total} </td>
                     <td> {$t.balance} </td>
                     <td> <a href="{$thisUrl}?page={$thisPage}&glm_action=invoices&option=view&id={$t.id}">View</a> </td>
                 </tr>