Updating the text on the renewal form for Membership Renewal.
adding payment option for pay by check.
showing the invoice after the submit is done.
change name of submit button to Submit Membership Renewal.
adding table layout for the renewal form sections for choosing
the member type and employees so prices line up.
Fix the issue with incorrect class was being pulled for employees.
Also updated the employee list so if they don't have a payable member
type then they won't show up in the renewal form.
),
ARRAY_A
);
- foreach ( $line_items as &$item ) {
+ foreach ( $line_items as $key => &$item ) {
$index = (int)$item['recurrence'];
if ( $item['recurring'] && $this->config['recurrence'][$index] ) {
$item['recurrence_string'] = $this->config['recurrence'][$index];
}
+ if ( $account_id = filter_var( $item['account'], FILTER_VALIDATE_INT ) ) {
+ $line_items[$key]['account'] = $this->getAccountById( $account_id );
+ }
}
return $line_items;
}
}
if ( $billing_account ) {
// Need also to get the members type to look up which invoice_type to use
- $invoice_type_id = $this->getMembersInvoiceTypeByRefDest( $member_id );
+ $invoice_type_id = $this->getMembersInvoiceTypeByRefDest( $ref_dest );
if ( $invoice_type_id ) {
$invoice = $this->getInvoiceTypeById( $invoice_type_id );
+ $accounts[$billing_account['id']] = array(
+ 'id' => $billing_account['id'],
+ 'ref_dest' => $billing_account['ref_dest'],
+ 'ref_name' => $billing_account['ref_name'],
+ 'invoice' => $invoice,
+ 'email' => $billing_account['email']
+ );
}
- $accounts[$billing_account['id']] = array(
- 'id' => $billing_account['id'],
- 'ref_dest' => $billing_account['ref_dest'],
- 'ref_name' => $billing_account['ref_name'],
- 'invoice' => $invoice,
- 'email' => $billing_account['email']
- );
}
}
}
array(
'invoice_id' => $invoice_id,
'line_item_type' => $new_member_invoice_type['id'],
+ 'account' => $account_id,
'name' => $new_member_invoice_type['name'],
'amount' => $new_member_invoice_type['amount'],
'due_date' => $due_date,
array(
'invoice_id' => $invoice_id,
'line_item_type' => $employee_data[(int)$acc_id]['invoice']['id'],
+ 'account' => $acc_id,
'name' => $employee_data[(int)$acc_id]['invoice']['name'],
'amount' => $employee_data[(int)$acc_id]['invoice']['amount'],
'due_date' => $due_date,
// Make sure the required parts of $data exists.
if ( !isset( $data['invoice_id'] )
|| !isset( $data['line_item_type'] )
+ || !isset( $data['account'] )
|| !isset( $data['name'] )
|| !isset( $data['amount'] )
|| !isset( $data['due_date'] )
array(
'invoice' => $invoice_id,
'line_item_type' => $line_item_type,
+ 'account' => $account,
'name' => $name,
'amount' => $amount,
'quantity' => 1,
array(
'%d', // invoice
'%d', // line_item_type (invoiceType id)
+ '%d', // account
'%s', // name
'%s', // amount
'%d', // quantity
width: 100%;
font-weight; bold;
padding: 0;
- margin: 3px 0 0 0;
+ margin: 7px 0 0 0;
}
.glm-billing-left-half {
width: 49%;
box-shadow: 0 0 8px #88D5E9;
border: 1px solid #88D5E9;
}
+.glm-billing-input table {
+ width: 100%;
+}
+.glm-billing-input .price {
+ width: 50px;
+ text-align: right;
+}
+.glm-billing-form fieldset legend {
+ font-size: 1rem;
+ font-weight: bold;
+ margin-top: 2rem;
+}
+
+.glm-billing-form input[type=submit] {
+ margin-top: 20px;
+}
// Need to see if there's an account for this member.
$account = $Accounts->editEntry( $accountID );
} else {
- // Do the Payment Processing.
- $errors = $BillingSupport->processMemberRenewal( $accountID, $invoice_id, $invoice_data['amount'], $invoice_data['employees'] );
- // echo '<pre>$errors: ' . print_r( $errors, true ) . '</pre>';
- if ( $errors ) {
- // $messages[] = '<pre>$errors: ' . print_r( $errors, true ) . '</pre>';
- if ( count( $errors ) > 0 ) {
- $BillingSupport->removeInvoiceById( $invoice_id );
- foreach ( $errors as $error ) {
- $messages[] = '<span style="color: red;">'.$error.'</span>';
+ // Look at the payment option given
+ $payment_option = filter_var( $_REQUEST['payment_option'], FILTER_SANITIZE_STRING );
+
+ switch ( $payment_option ) {
+ case 'pay_by_credit_card':
+ // Do the Payment Processing.
+ $errors = $BillingSupport->processMemberRenewal( $accountID, $invoice_id, $invoice_data['amount'], $invoice_data['employees'] );
+ // echo '<pre>$errors: ' . print_r( $errors, true ) . '</pre>';
+ if ( $errors ) {
+ // $messages[] = '<pre>$errors: ' . print_r( $errors, true ) . '</pre>';
+ if ( count( $errors ) > 0 ) {
+ $BillingSupport->removeInvoiceById( $invoice_id );
+ foreach ( $errors as $error ) {
+ $messages[] = '<span style="color: red;">'.$error.'</span>';
+ }
}
- }
- $view = 'renew';
+ $view = 'renew';
- // Get list of payable invoice_types
- $payable_types = $BillingSupport->getAllPayableInvoiceTypes();
+ // Get list of payable invoice_types
+ $payable_types = $BillingSupport->getAllPayableInvoiceTypes();
- $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberID );
- if ( $member_invoice_id ) {
- $member_invoice = $BillingSupport->getInvoiceTypeById( $member_invoice_id );
- }
+ $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberID );
+ if ( $member_invoice_id ) {
+ $member_invoice = $BillingSupport->getInvoiceTypeById( $member_invoice_id );
+ }
- // Get a list of this accounts employees. If they have any.
- $employees = $BillingSupport->getListOfAccountEmployees( $this->memberID );
+ // Get a list of this accounts employees. If they have any.
+ $employees = $BillingSupport->getListOfAccountEmployees( $this->memberID );
- // Load DataClass for Management.
- require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataManagement.php';
- $Management = new GlmDataBillingManagement( $this->wpdb, $this->config );
- $management = $Management->getEntry( 1 );
+ // Load DataClass for Management.
+ require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataManagement.php';
+ $Management = new GlmDataBillingManagement( $this->wpdb, $this->config );
+ $management = $Management->getEntry( 1 );
- // Need to see if there's an account for this member.
- $account = $Accounts->editEntry( $accountID );
+ // Need to see if there's an account for this member.
+ $account = $Accounts->editEntry( $accountID );
+ }
+ break;
+ case 'pay_by_check':
+ break;
}
+
+ // Now need to show the invoice.
+ $view = 'viewInvoice';
+
+ // Get the invoice.
+ $invoiceHtml = $BillingSupport->viewInvoice( $invoice_id );
}
<table class="line-items" width="100%">
<thead>
<tr>
- <th align="left">Date</th>
- <th align="left">Qty</th>
+ <th align="left">Member Name</th>
+ <th align="left">Anniversary</th>
<th> </th>
<th align="left">Description</th>
<th align="right">Rate</th>
- <th align="right">Amount</th>
+ <!-- <th align="right">Amount</th> -->
</tr>
<tr>
- <td colspan="6"><hr></td>
+ <td colspan="5"><hr></td>
</tr>
</thead>
<tbody>
{foreach $line_items as $item}
<tr>
- <td align="left" width="70">{$invoice.transaction_time|date_format:"%D"}</td>
- <td align="right" width="20">{$item.quantity}</td>
+ <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>
<td align="right" width="10"> </td>
- <td align="left">{$item.name}{if $item.recurring && $item.recurrence_string} ( {$item.recurrence_string} ){/if}</td>
+ <td align="left" width="300">{$item.name}</td>
<td align="right" width="60">${$item.amount|string_format:"%.2f"}</td>
- <td align="right" width="60">${$item.total|string_format:"%.2f"}</td>
+ <!-- <td align="right" width="60">${$item.total|string_format:"%.2f"}</td> -->
</tr>
{/foreach}
{foreach $payments as $payment}
<tr>
- <td align="left" width="70">{$payment.transaction_time|date_format:"%D"}</td>
+ <td align="left" width="150"> </td>
<td align="right" width="20"> </td>
<td align="right" width="10"> </td>
<td align="left">Payment</td>
- <td align="right" width="60"> </td>
+ <!-- <td align="right" width="60"> </td> -->
<td align="right" width="60">- ${$payment.amount|string_format:"%.2f"}</td>
</tr>
{/foreach}
- <tr><td colspan="6"><hr></td></tr>
+ <tr><td colspan="5"><hr></td></tr>
<tr>
- <td colspan="5" align="right">Total Amount Due</td>
+ <td colspan="4" align="right">Total Amount Due</td>
<td width="70" align="right">${$invoice.balance|string_format:"%.2f"}</td>
</tr>
</tbody>
{/if}
<tr><td colspan="2"> </td></tr>
{* Footer of invoice *}
+ {if !$invoice.paid}
<tr>
<td colspan="2" align="center" style="font-size: 12px;">Please return Coupon Below with Payment</td>
</tr>
</table>
</td>
</tr>
+ {/if}
</table>
<li>
<a
href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}&option=renew"
- class="">Renew</a>
+ class="">Membership Renewal</a>
</li>
{/if}
<li>
Membership Class
</div>
<div class="glm-billing-input">
- {if $settings.allow_membership_choice}
- {foreach $payable_types as $type}
- <label>
- <input type="radio" name="member_renewing" data-amount="{$type.amount}" value="{$type.id}"
- {if $type.id == $member_invoice.id}checked{/if}
- />
- {$type.name} {$type.amount}
- </label>
- {/foreach}
- {else}
- <input type="hidden" name="member_renewing" data-amount="{$member_invoice.amount}" value="{$member_invoice.id}" />
- {$member_invoice.name} {$member_invoice.amount}
- {/if}
+ <table>
+ {if $settings.allow_membership_choice}
+ {foreach $payable_types as $type}
+ <tr>
+ <td>
+ <input id="member_renewing-{$type.id}" type="radio" name="member_renewing" data-amount="{$type.amount}" value="{$type.id}"
+ {if $type.id == $member_invoice.id}checked{/if}
+ />
+ </td>
+ <td>
+ <label for="member_renewing-{$type.id}"> {$type.name} </label>
+ </td>
+ <td class="price">
+ ${$type.amount}
+ </td>
+ </tr>
+ {/foreach}
+ {else}
+ <tr>
+ <td colspan="2">
+ <input type="hidden" name="member_renewing" data-amount="{$member_invoice.amount}" value="{$member_invoice.id}" />
+ {$member_invoice.name}
+ </td>
+ <td class="price">
+ ${$member_invoice.amount}
+ </td>
+ </tr>
+ {/if}
+ </table>
</div>
</div>
{/if}
{if $employees}
<div class="glm-billing-field">
<div class="glm-billing-label">
- Employees to Renew
+ <strong>Associated Members/Employees</strong>
</div>
<div class="glm-billing-input">
- {foreach $employees as $employee}
- <label>
- <input type="checkbox" name="employees[]" data-amount="{$employee.invoice.amount}" value="{$employee.id}" checked='checked' />
- {$employee.ref_name} {$employee.invoice.name} {$employee.invoice.amount}
- </label>
- {/foreach}
+ <table>
+ {foreach $employees as $employee}
+ <tr>
+ <td>
+ <input id="employee-{$employee.id}" type="checkbox" name="employees[]" data-amount="{$employee.invoice.amount}" value="{$employee.id}" checked='checked' />
+ </td>
+ <td>
+ <label for="employee-{$employee.id}">
+ {$employee.ref_name}
+ </label>
+ </td>
+ <td>
+ {$employee.invoice.name}
+ </td>
+ <td class="price">
+ ${$employee.invoice.amount}
+ </td>
+ </tr>
+ {/foreach}
+ </table>
</div>
</div>
{/if}
<div class="glm-billing-field">
<div class="glm-billing-label">
- Total Due
+ <strong>Total Due</strong>
</div>
<div class="glm-billing-input">
- <div id="renew_total"></div>
+ <table>
+ <tr>
+ <td> </td>
+ <td class="price">
+ <div id="renew_total"></div>
+ </td>
+ </tr>
+ </table>
</div>
</div>
+ <fieldset>
+ <legend>Billing Information</legend>
+
<div class="glm-billing-field glm-billing-left-half">
<div class="glm-billing-label glm-required">
First Name
</div>
</div>
+ </fieldset>
+
+ <fieldset>
+ <legend>Payment Options</legend>
+
<div class="glm-billing-field">
+ <div class="glm-billing-label">
+ Select Payment Option
+ </div>
+ <div class="glm-billing-input">
+ <label> <input class="payment_option" type="radio" name="payment_option" value="pay_by_credit_card" checked> Pay by Credit Card </label>
+ <label> <input class="payment_option" type="radio" name="payment_option" value="pay_by_check"> Pay by Check </label>
+ </div>
+ </div>
+
+ <div class="glm-billing-field glm-billing-credit">
<div class="glm-billing-label glm-required">
Name on Card
</div>
<div class="glm-billing-input">
<input
+ class="ccard"
type="text"
name="cc_name"
required
{if isset($smarty.request.cc_name) && $smarty.request.cc_name}value="{$smarty.request.cc_name}"{/if} />
</div>
</div>
- <div class="glm-billing-field glm-billing-left-half">
+
+ <div class="glm-billing-field glm-billing-left-half glm-billing-credit">
<div class="glm-billing-label glm-required">
Card Type
</div>
<div class="glm-billing-input">
- <select name="cc_type" required>
+ <select name="cc_type" class="ccard" required>
<option value=""></option>
{foreach $management.cc_accepts.names as $cardId => $cardName}
<option value="{$cardId}"
</select>
</div>
</div>
- <div class="glm-billing-field glm-billing-right-half">
+ <div class="glm-billing-field glm-billing-right-half glm-billing-credit">
<div class="glm-billing-label glm-required">
Card Number
</div>
<div class="glm-billing-input">
<input
+ class="ccard"
type="text"
placeholder="Numbers Only"
name="cc_numb"
{if isset($smarty.request.cc_numb) && $smarty.request.cc_numb}value="{$smarty.request.cc_numb}"{/if} />
</div>
</div>
- <div class="glm-billing-field glm-billing-left-half">
+ <div class="glm-billing-field glm-billing-left-half glm-billing-credit">
<div class="glm-billing-label glm-required">
Card Expiration
</div>
<div class="glm-billing-input">
<input
+ class="ccard"
type="text"
placeholder="MM/YY"
name="cc_exp"
{if isset($smarty.request.cc_exp) && $smarty.request.cc_exp}value="{$smarty.request.cc_exp}"{/if} />
</div>
</div>
- <div class="glm-billing-field glm-billing-right-half">
+ <div class="glm-billing-field glm-billing-right-half glm-billing-credit">
<div class="glm-billing-label glm-required">
C V V
</div>
<div class="glm-billing-input">
<input
+ class="ccard"
type="text"
placeholder="3 or 4 digit security code on back of card"
name="cc_cvv"
</div>
</div>
- <input class="button button-primary" type="submit" value="Renew">
+ </fieldset>
+
+
+ <input class="button button-primary" type="submit" value="Submit Membership Renewal">
</form>
</div>
$('#billing-amount').val( $(this).find('option:selected').data( 'amount') );
});
+ $('.payment_option').change(function(){
+ var payment_option = $('.payment_option:checked').val();
+ console.log( 'payment_option: ', payment_option );
+ if ( payment_option == 'pay_by_check' ) {
+ $('.glm-billing-credit').hide();
+ $('.ccard').prop('disabled', true);
+ } else {
+ $('.glm-billing-credit').show();
+ $('.ccard').prop('disabled', false);
+ }
+ });
+
function getPageTotal(){
// Calculate the total for this page.