Adding notes to the invoice creation page.
Also I updated the data type for the due_date in the abstract class and
now the due_date is being saved.
// Due date
'due_date' => array(
'field' => 'due_date',
- 'type' => 'text',
+ 'type' => 'date',
'use' => 'a',
),
, ARRAY_A
);
foreach( $line_items as $line_item ) {
- $amount_total += $line_item['amount'];
+ $amount_total += $line_item['amount'] * $line_item['quantity'];
}
$balance = $amount_total;
$this->wpdb->update(
$numbPending = 0;
$namesList = false;
$haveCategories = false;
+ $numberPending = 0;
// For lockedToMember
$lockedToMember = false;
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>';
$_REQUEST['due_date'] = date('Y-m-d', strtotime($_REQUEST['due_date']));
+ echo '<pre>' . print_r( $_REQUEST, true ) . '</pre>';
$invoices = $this->insertEntry();
$this->invoice_id = $invoices['fieldData']['id'];
// After the Invoice is created need to add each line item
$templateData = array(
'option' => $option,
+ 'invoice_id' => $this->invoice_id,
'invoices' => $invoices,
'haveInvoices' => $haveInvoices,
'invoiceUpdated' => $invoiceUpdated,
'invoiceUpdateError' => $invoiceUpdateError,
'invoiceAdded' => $invoiceAdded,
'invoiceAddError' => $invoiceAddError,
+ 'invoiceInsertError' => $invoiceInsertError,
// 'numbTransactions' => $numbTransactions,
'invoiceDeleted' => $invoiceDeleted,
'invoiceDeleteError' => $invoiceDeleteError,
<input type="text" name="due_date" required>
</div>
</div>
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-large-3">
+ Notes
+ </div>
+ <div class="glm-columns glm-small-12 glm-large-9">
+ <textarea name="notes"></textarea>
+ </div>
+ </div>
</div>
</div>
<script>
jQuery(document).ready(function($){
// Initialize variables for this page.
- var invoiceTypeJSON = $.parseJSON( '{$invoiceTypeJSON}' );
- var dialog, form,
- line_item_type = $( 'select[name="line_item_type"]' ),
- line_items = [],
- allFields = $( [] ).add( line_item_type );
+ var dialog, // Dialog for the add line_item form
+ form, // The add line_item form
+ line_item_type = $( 'select[name="line_item_type"]' ), // Line item type in the add line_item form
+ line_items = [], // Array holding line_items json objects
+ allFields = $( [] ).add( line_item_type ), // Array holding the form fields - add line_item form
+ invoiceTypeJSON = $.parseJSON( '{$invoiceTypeJSON}' ); // Json object with all of the invoices types
/**
* totalInvoice
<td>{$t.id}</td>
<td> {$t.member_name} </td>
<td> {$t.transaction_time.datetime} </td>
- <td> {$t.due_date} </td>
+ <td> {$t.due_date.date} </td>
<td> {$t.balance} </td>
</tr>
{/foreach}
<h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
<a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices"
- class="nav-tab{if $thisAction==invoices && !$option} nav-tab-active{/if}">Search Invoices</a>
+ class="nav-tab{if $option == 'list'} nav-tab-active{/if}">Search Invoices</a>
<a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices&option=add"
- class="nav-tab{if $option} nav-tab-active{/if}">Create Invoice</a>
+ class="nav-tab{if $option == 'add' || $option == 'edit'} nav-tab-active{/if}">Create Invoice</a>
</h2>