Work on select for invoice line items and saving transaction time.
authorSteve Sutton <ssutton@gmail.com>
Wed, 6 Dec 2017 10:55:19 +0000 (05:55 -0500)
committerSteve Sutton <ssutton@gmail.com>
Wed, 6 Dec 2017 10:55:19 +0000 (05:55 -0500)
Put in transaction time and group the parent child line items in select

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

index a800a0a..dc6ae5a 100644 (file)
@@ -130,7 +130,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             $InvoiceTypesObj = new GlmDataInvoiceTypes( $this->wpdb, $this->config );
             $invoiceTypes    = $InvoiceTypesObj->getList();
             $invoiceTypes    = $InvoiceTypesObj->sortParentChild($invoiceTypes);
-            echo '<pre>$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '</pre>';
+            // echo '<pre>$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '</pre>';
             if ( isset( $invoiceTypes ) ) {
                 foreach ( $invoiceTypes as $invoiceType ) {
                     $invTypes[$invoiceType['id']] = array(
@@ -144,6 +144,9 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             break;
 
         case 'insert':
+            // Set transaction_time to current time.
+            $_REQUEST['transaction_time'] = date('Y-m-d H:i:s');
+            echo '<pre>' . print_r( $_REQUEST, true ) . '</pre>';
             $invoices = $this->insertEntry();
             $this->transactionID = $invoices['fieldData']['id'];
             $view = 'editInvoice';
index 4ebb7ee..a6f328b 100644 (file)
                 <td>
                     <select name="line_item_type">
                         <option value="">Select Invoice Type</option>
+                        {$parent = 0}
                         {foreach $invoiceTypes as $inv}
-                            {if $inv.parent.value == 0 && $inv.amount != '0.00'}
+                            {if $inv.parent.value == 0}
                                 <optgroup label="{$inv.name}">
                             {/if}
-                            {if $inv.amount}
+                            {if $inv.amount != '0.00'}
                                 <option value="{$inv.id}">{$inv.name}</option>
                             {/if}
-                            {if $inv.parent.value == 0 && $inv.amount != '0.00'}
+                            {if $inv.parent.value == 0}
                                 </optgroup>
                             {/if}
                         {/foreach}
@@ -123,6 +124,8 @@ jQuery(document).ready(function($){
                     '<div class="glm-columns glm-small-1">1</div>' +
                     '<div class="glm-columns glm-small-4">$' + selectedLineItem.amount + '</div>' +
                 '</div>');
+            } else {
+                // Code here to add to quantity.
             }
             dialog.dialog( 'close' );
         }