Adding Send Emails screen to Invoicing.
Adding link of member dashboard to payments screen.
Adding Delete payments link in payments screen.
Adding correct link in invoices screen if uptra payment form is set.
* @param int $invoice_id Id of invoice to delete.
*
* @access public
- * @return int|false The number of invoices updated or false on error.
+ * @return int|false The number of invoices deleted or false on error.
*/
public function removeInvoiceById( $invoice_id )
{
return $result;
}
+ /**
+ * removePaymentById
+ *
+ * @param int $payment_id Id of the payment to delete.
+ *
+ * @access public
+ * @return int|false The number of payments deleted or false on error.
+ */
+ public function removePaymentById( $payment_id )
+ {
+ // Get the invoice number from invoice_payments first
+ $paymentInvoiceData = $this->wpdb->get_row(
+ $this->wpdb->prepare(
+ "SELECT IP.id, IP.amount, I.amount_total, I.balance, IP.invoice
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoice_payments IP
+ LEFT OUTER JOIN " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices I ON (I.id = IP.invoice)
+ WHERE payment = %d",
+ $payment_id
+ ),
+ ARRAY_A
+ );
+ if ( !empty( $paymentInvoiceData ) ) {
+ // Update the invoice with new balance.
+ $amount = (float)$paymentInvoiceData['amount'];
+ $amountTotal = (float)$paymentInvoiceData['amount_total'];
+ $balance = (float)$paymentInvoiceData['balance'];
+ $newBalance = ( ( $balance + $amount ) >= $amountTotal ) ? $amountTotal : $balance + $amount;
+ $paid = ( $newBalance == 0.00 ) ? 1 : 0;
+
+ $this->wpdb->update(
+ GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'invoices',
+ array( 'balance' => $newBalance, 'paid' => $paid ),
+ array( 'id' => $paymentInvoiceData['invoice'] ),
+ array( '%f' ),
+ array( '%d' )
+ );
+ $this->wpdb->delete(
+ GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'invoice_payments',
+ array( 'payment' => $payment_id ),
+ array( '%d' )
+ );
+ $result = $this->wpdb->delete(
+ GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'payments',
+ array( 'id' => $payment_id ),
+ array( '%d' )
+ );
+ $this->wpdb->delete(
+ GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'transactions',
+ array( 'type' => $this->config['transaction_numb']['Payment'], 'type_id' => $payment_id ),
+ array( '%d', '%d' )
+ );
+ return $result;
+ } else {
+ return false;
+ }
+ }
+
/**
* updateAccountRenewalDate
*
*/
public function entryPostProcessing($r, $a)
{
- $r['member_name'] = $this->wpdb->get_var(
+ $member_data = $this->wpdb->get_row(
$this->wpdb->prepare(
- "SELECT A.ref_name
+ "SELECT A.ref_name,A.ref_dest
FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "payments P
LEFT OUTER JOIN " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts A ON ( P.account = A.id )
WHERE P.id = %d",
$r['id']
- )
+ ),
+ ARRAY_A
);
+ if ( isset( $member_data ) && $member_data['ref_name'] ) {
+ $r['member_name'] = $member_data['ref_name'];
+ }
+ if ( isset( $member_data ) && $member_data['ref_dest'] ) {
+ $r['member_id'] = $member_data['ref_dest'];
+ }
return $r;
}
* Send out the email notification based on type and the account.
*
* @param mixed $notification_type Id for notification type.
- * @param mixed $account Id for the account.
+ * @param mixed $account_id Id for the account.
+ * @param mixed $data Additional Account Data for the email template
*
* @access public
* @return void
// Setup the invoice html
$invoice_html = '';
- if ( isset( $data['type'] ) && $data['type'] == $this->config['transaction_numb']['Invoice'] ) {
+ // echo '<pre>$billing_settings: ' . print_r( $this->config['settings'], true ) . '</pre>';
+ if ( isset( $data['type'] ) && $data['type'] == $this->config['transaction_numb']['Invoice'] && !$this->config['settings']['invoice_pdf_enabled'] ) {
$invoice_html = $BillingSupport->viewInvoice( $data['type_id'] );
}
+ $fileName = false;
+ $attachments = false;
+ if ( isset( $data['type'] ) && $data['type'] == $this->config['transaction_numb']['Invoice'] && $this->config['settings']['invoice_pdf_enabled'] ) {
+ // Need to get the invoice and output to a file.
+ require_once GLM_MEMBERS_BILLING_PLUGIN_PATH . '/lib/GlmPDFInvoice.php';
+ $fullInvoice = $BillingSupport->getFullInvoiceData( $data['type_id'] );
+ $pdf = new GlmPDFInvoice( $this->config, 'LETTER', 'portrait' );
+ $fileData = $pdf->createPdf( array( $fullInvoice ), 'file' );
+ $origName = tempnam( '/tmp', 'PDF' );
+ $fp = fopen( $origName, 'w' );
+ fwrite( $fp, $fileData );
+ fclose( $fp );
+ $fileName = $origName.'.pdf';
+ rename( $origName, $fileName );
+
+ $attachments = array( $fileName );
+ }
$smarty->templateAssign( 'invoice_html', $invoice_html );
$header[] = 'Reply-To:' . $replyto;
}
- wp_mail( $to_email, $subject, $message, $header );
+ if ( !$attachments ) {
+ wp_mail( $to_email, $subject, $message, $header );
+ } else {
+ //wp_mail( $to_email, $subject, $message, $header, $attachments );
+ wp_mail( 'steve@localhost', $subject, $message, $header, $attachments );
+ // Remove the temp file now
+ // unlink( $fileName );
+ }
// remove the filter to avoid conflicts
remove_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) );
send_action[20] = "Received Payment"
send_action[30] = "New Member"
send_action[40] = "New Member Admin Notice"
+send_action[50] = "Send Emails"
send_action_numb['Create Invoice'] = 10;
send_action_numb['Received Payment'] = 20;
send_action_numb['New Member'] = 30;
send_action_numb['New Member Admin Notice'] = 40;
+send_action_numb['Send Emails'] = 50;
; Send Date When
send_date_when[10] = "Before"
*
* @return mixed
*/
- public function createPdf( $invoices )
+ public function createPdf( $invoices, $outputStyle = 'stream' )
{
$this->setupPages();
}
// Output PDF
- $this->ezStream();
+ if ( $outputStyle == 'stream' ) {
+ $this->ezStream();
+ } else {
+ return $this->ezOutput();
+ }
}
}
break;
- // case 'edit':
- // $invoices = $this->editEntry($this->invoice_id);
- //
- // // If we have a good invoices
- // if ($invoices['status']) {
- // $haveTransactions = true;
- // }
- //
- // // If we're locked to a member as a contact user and the invoices member doesn't equal the contact member
- // if ($lockedToMember && $invoices['fieldData']['ref_dest_id'] != $lockedToMember) {
- // $haveTransactions = false;
- // $invoices = false;
- // }
- //
- // // Set the view file to editInvoice
- // $view = 'editInvoice';
- // break;
-
case 'update':
$BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
$InvoiceTypesObj = new GlmDataInvoiceTypes( $this->wpdb, $this->config );
$invoices = $this->editEntry($this->invoice_id);
- echo '<pre>' . print_r( $invoices, true) . '</pre>';
+ // echo '<pre>' . print_r( $invoices, true) . '</pre>';
// Remove the old line items.
$this->wpdb->delete(
GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'line_items',
array(
'invoice' => $this->invoice_id,
+ 'account' => $invoices['fieldData']['account']['value'],
'line_item_type' => $line_item,
'name' => $_REQUEST['line_item_name'][$line_item],
'amount' => $_REQUEST['line_item_amount'][$line_item],
'quantity' => $_REQUEST['line_item_qty'][$line_item],
'total' => (float)$_REQUEST['line_item_qty'][$line_item] * (float)$_REQUEST['line_item_amount'][$line_item],
'created' => date('Y-m-d'),
- 'first_due_date' => $_REQUEST['due_date'],
- 'next_due_date' => $_REQUEST['due_date'],
+ 'first_due_date' => date('Y-m-d', $invoices['fieldData']['due_date']['timestamp'] ),
+ 'next_due_date' => date('Y-m-d', $invoices['fieldData']['due_date']['timestamp'] ),
'recurring' => $invoiceType['recurring']['value'],
'recurrence' => $invoiceType['recurrence']
),
array(
'%d', // invoice
+ '%d', // account
'%d', // line_item_type
'%s', // name
'%s', // amount
// Now we have a total for the invoice we can record the transaction
$BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
// Calling the support class to save the invoice to transaction table.
- $BillingSupport->recordInvoice( $this->invoice_id, $_REQUEST['account'], $totals['amount_total'] );
+ // $BillingSupport->recordInvoice( $this->invoice_id, $_REQUEST['account'], $totals['amount_total'] );
} else {
$invoiceUpdateError = true;
}
$view = 'editInvoice';
break;
+
case 'view':
// Call in the support class
$BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
$where_params = array( 'true' );
- // Check for paging
- // if ( isset( $_REQUEST['pageSelect'] ) ) {
- // $_SESSION['search']['pageSelect'] = $_REQUEST['pageSelect'];
- // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['pageSelect'] ) ) {
- // unset( $_SESSION['search']['pageSelect'] );
- // }
- // if ( isset( $_REQUEST['nextStart'] ) ) {
- // $_SESSION['search']['nextStart'] = $_REQUEST['nextStart'];
- // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['nextStart'] ) ) {
- // unset( $_SESSION['search']['nextStart'] );
- // }
- // if ( isset( $_REQUEST['prevStart'] ) ) {
- // $_SESSION['search']['prevStart'] = $_REQUEST['prevStart'];
- // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['prevStart'] ) ) {
- // unset( $_SESSION['search']['prevStart'] );
- // }
-
// Check if we're doing paging
if (isset($_REQUEST['pageSelect'])) {
// If request is for Next
}
}
- // if( isset($_SESSION['search']['pageSelect']) ){
- // // If request is for Next
- // if ($_SESSION['search']['pageSelect'][0] == 'N') {
- // $newStart = $_SESSION['search']['nextStart'] - 0;
- //
- // // Otherwise it must be Previous
- // } else {
- // $newStart = $_SESSION['search']['prevStart'] - 0;
- // }
- // if ($newStart > 0) {
- // $start = $newStart;
- // }
- // }
-
// Get any search parameters.
$reg_options = array(
'options' => array(
$lastDisplayed = false;
$totalAccounts = false;
$option2 = false;
+ $successMsg = false;
// Get any provided option
if ( isset( $_REQUEST['option'] ) ) {
$BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
$Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
- // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
-
if ( isset( $_REQUEST['invoice_types'] ) ) {
$invoiceTypes = $_REQUEST['invoice_types'];
$view = 'invoicing';
if ( $option2 ) {
+
+ // $where used in all places.
+ $where = implode( ' AND ', $wParts );
$accounts = $Accounts->getSimpleAccountList( $where );
- // echo '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
+
foreach ( $accounts as $account ) {
// Get the invoice type
$invoiceType = $BillingSupport->getInvoiceTypeById( $account['invoice_type'] );
)
);
}
+ $successMsg = 'Invoices Created';
+ }
+
+ break;
+
+ case 'sendEmails':
+ // Create Notification Object
+ $Notifications = new GlmNotifications( $this->wpdb, $this->config );
+ $view = 'invoicing';
+
+ $wParts[] = " T.id IN (
+ SELECT account
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices
+ WHERE paid <> true ) ";
+ $wParts[] = " ( T.email_invoice ) ";
+
+ $type = $this->config['transaction_numb']['Invoice'];
+
+ if ( $option2 ) {
+ $where = implode( ' AND ', $wParts );
+ $accounts = $Accounts->getSimpleAccountList( $where );
+ // echo '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
+ foreach ( $accounts as $account ) {
+ $invoices = $BillingSupport->getUnPaidInvoicesByAccount( $account['id'] );
+ // echo '<pre>$invoices: ' . print_r( $invoices, true ) . '</pre>';
+ if ( isset( $invoices ) && is_array( $invoices ) && !empty( $invoices ) ) {
+ foreach ( $invoices as $invoice ) {
+ $data = array(
+ 'type' => $type,
+ 'type_id' => $invoice['id']
+ );
+ $notices = $Notifications->getNotificationsWithSendByAction( $this->config['send_action_numb']['Send Emails'] );
+ // echo '<pre>$notices: ' . print_r( $notices, true ) . '</pre>';
+ if ( isset( $notices ) && is_array( $notices ) && !empty( $notices ) ) {
+ foreach ( $notices as $notice ) {
+ $Notifications->sendEmailNotification( $notice['id'], $account['id'], $data );
+ echo '<p>Sending emails</p>';
+ }
+ }
+ }
+ }
+ }
+ $successMsg = 'Invoices Sent';
}
break;
'numbDisplayed' => $numbDisplayed,
'lastDisplayed' => $lastDisplayed,
'totalAccounts' => $totalAccounts,
+ 'successMsg' => $successMsg,
);
// Return status, any suggested view, and any data to controller
break;
+ case 'view':
+ $view = 'viewPayment';
+ // Get the payment
+ $payment_id = filter_var( $_REQUEST['payment'], FILTER_VALIDATE_INT );
+ $payments = $this->getEntry( $payment_id );
+ // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ break;
+
case 'delete':
+ $payment_id = filter_var( $_REQUEST['payment_id'], FILTER_VALIDATE_INT );
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
// Need to remove any line items for the payments alse
- // $payments = $this->deleteTransactions($this->payment_id);
+ // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ $payments = $BillingSupport->removePaymentById( $payment_id );
if ($payments) {
$paymentsDeleted = true;
$paymentsDeleteError = true;
}
- case 'view':
- $view = 'viewPayment';
- // Get the payment
- $payment_id = filter_var( $_REQUEST['payment'], FILTER_VALIDATE_INT );
- $payments = $this->getEntry( $payment_id );
- // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
- break;
case 'list':
default:
$payment_method = filter_var( $_REQUEST['payment_method'], FILTER_VALIDATE_INT );
$payment_data = filter_var( $_REQUEST['payment_data'], FILTER_SANITIZE_STRING );
$invoices = filter_var( $_REQUEST['invoices'], FILTER_VALIDATE_INT, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
- echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
if ( $account_id && $amount && $payment_method && $payment_data && !empty( $invoices ) ) {
// Create new payment.
[x]-Create labels
[ ] -Send Email (invoices)
[ ] Ability to add adjustment
-[ ] Ability to edit an invoice
+[x] Ability to edit an invoice
+ [x] Edit is resetting some fields
[x] Ability to delete an invoice
-[ ] Ability to delete a payment
+[x] Ability to delete a payment
+ [x] Update the original invoice balance due amount
[x] Redo payment form for Uptravel.com
[x] Find all places where there's a link to make payment to check for option.
<input type="hidden" name="id" value="{$invoice_id}">
<input type="hidden" name="account" value="{$invoices.fieldData.account.value}">
<input type="hidden" name="transaction_time" value="{$invoices.fieldData.transaction_time.mysql_datetime}">
+ <input type="hidden" name="balance" value="{$invoices.fieldData.balance}">
+ <input type="hidden" name="paid" value="{$invoices.fieldData.paid.value}">
+ <input type="hidden" name="recurring" value="{$invoices.fieldData.recurring.value}">
+ <input type="hidden" name="recurrence" value="{$invoices.fieldData.recurrence}">
{else}
<input type="hidden" name="option" value="insert">
{/if}
Notes
</div>
<div class="glm-columns glm-small-12 glm-large-8">
- <textarea name="notes"></textarea>
+ <textarea name="notes">{if $invoices.fieldData.notes}{$invoices.fieldData.notes}{/if}</textarea>
</div>
</div>
{/if}
<br clear="all">
-<pre>
-</pre>
-<div class="glm-admin-table-inner">
- <table class="wp-list-table widefat fixed posts glm-admin-table">
- <thead>
- <tr>
- <th style="width: 150px;">Member Name</th>
- <th>Invoice For</th>
- <th style="width: 150px;">Time</th>
- <th style="width: 70px;">Due Date</th>
- <th style="width: 100px;">Amount Total</th>
- <th style="width: 70px;">Balance</th>
- </tr>
- </thead>
- {*
-
- *}
- <tbody>
- {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> <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}
- {$item.name} {if $item.recurring && $item.recurrence_string}( {$item.recurrence_string} ){/if}
- {/foreach}
- </td>
- <td> {$t.transaction_time.datetime} </td>
- <td> {$t.due_date.date} </td>
- <td> {$t.amount_total} </td>
- <td> {$t.balance} </td>
- </tr>
- <tr id="invoice-container-{$t.id}"
- class="glm-invoice-links glm-hidden{if $t@iteration is div by 2} alternate{/if}">
- <td colspan="6">
- <span class="account-dashboard-link">
- <a href="{$adminUrl}?page=glm-members-admin-menu-billing&glm_action=invoices&option=edit&id={$t.id}">Edit</a> |
- </span>
- <span class="account-dashboard-link">
- <a href="{$thisUrl}?page={$thisPage}&glm_action=invoices&option=view&id={$t.id}">View</a> |
- <a href="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=createPDFInvoice&id={$t.id}">Print</a> |
- </span>
- <span class="account-dashboard-link">
- {if $t.paid.value}
-
- {else}
- {if isset( $billing_settings.uptravel_payment_form ) && $billing_settings.uptravel_payment_form}
- <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=makepaymentadjustment&member={$t.member_id}">Make A Payment</a> |
+ <div class="glm-admin-table-inner">
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th style="width: 150px;">Member Name</th>
+ <th>Invoice For</th>
+ <th style="width: 150px;">Time</th>
+ <th style="width: 70px;">Due Date</th>
+ <th style="width: 100px;">Amount Total</th>
+ <th style="width: 70px;">Balance</th>
+ </tr>
+ </thead>
+ <tbody>
+ {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> <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}
+ {$item.name} {if $item.recurring && $item.recurrence_string}( {$item.recurrence_string} ){/if}
+ {/foreach}
+ </td>
+ <td> {$t.transaction_time.datetime} </td>
+ <td> {$t.due_date.date} </td>
+ <td> {$t.amount_total} </td>
+ <td> {$t.balance} </td>
+ </tr>
+ <tr id="invoice-container-{$t.id}" class="glm-invoice-links glm-hidden{if $t@iteration is div by 2} alternate{/if}">
+ <td colspan="6">
+ <span class="account-dashboard-link">
+ <a href="{$adminUrl}?page=glm-members-admin-menu-billing&glm_action=invoices&option=edit&id={$t.id}">Edit</a> |
+ </span>
+ <span class="account-dashboard-link">
+ <a href="{$thisUrl}?page={$thisPage}&glm_action=invoices&option=view&id={$t.id}">View</a> |
+ <a href="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=createPDFInvoice&id={$t.id}">Print</a> |
+ </span>
+ <span class="account-dashboard-link">
+ {if $t.paid.value}
+
{else}
- <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=makepayment&member={$t.member_id}">Pay Invoice</a> |
+ {if isset( $billing_settings.uptravel_payment_form ) && $billing_settings.uptravel_payment_form}
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=makepaymentadjustment&member={$t.member_id}">Make A Payment</a> |
+ {else}
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=makepayment&member={$t.member_id}">Pay Invoice</a> |
+ {/if}
{/if}
- {/if}
- </span>
- <span class="account-dashboard-link">
- <a onClick="return confirm('This will delete the invoice. This cannot be undone. Are you Sure?');" href="{$thisUrl}?page={$thisPage}&glm_action=invoices&option=delete&invoice_id={$t.id}">Delete</a>
- </span>
- </td>
- </tr>
- {/foreach}
- {else}
- <tr class="alternate"><td colspan="2">(no Invoice Types listed)</td></tr>
- {/if}
- </tbody>
- </table>
-</div>
+ </span>
+ <span class="account-dashboard-link">
+ <a onClick="return confirm('This will delete the invoice. This cannot be undone. Are you Sure?');" href="{$thisUrl}?page={$thisPage}&glm_action=invoices&option=delete&invoice_id={$t.id}">Delete</a>
+ </span>
+ </td>
+ </tr>
+ {/foreach}
+ {else}
+ <tr class="alternate"><td colspan="2">(no Invoices listed)</td></tr>
+ {/if}
+ </tbody>
+ </table>
+ </div>
{if $paging}
<input type="Submit" name="pageSelect" value="Previous {$limit} Invoices" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
{include file='admin/billing/header.html'}
<h2>Invoicing</h2>
{include file='admin/billing/invoicingSubHeader.html'}
+
<form id="invoicing-form" action="{$thisUrl}?page={$thisPage}" method="get">
<input type="hidden" name="page" value="{$thisPage}">
<input type="hidden" name="glm_action" value="invoicing">
<input id="print-invoices" type="submit" name="submitType" value="Print Invoices">
{elseif $option == 'createLabels'}
<input id="create-labels" type="submit" name="submitType" value="Create Labels">
+ {elseif $option == 'sendEmails'}
+ <input type="submit" name="submitType" value="Send Emails">
{/if}
</div>
</div>
<br clear="all">
<br clear="all">
<p>Total found: {$totalAccounts}</p>
+ {if $successMsg}<p><span class="glm-notice glm-flash-updated">{$successMsg}</span></p>{/if}
{* Paging *}
{if $paging}
<input type="Submit" name="pageSelect" value="Previous {$limit} Accounts" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
<a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=createInvoices" class="nav-tab{if $option==createInvoices} nav-tab-active{/if}">Create Invoices</a>
<a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=printInvoices" class="nav-tab{if $option==printInvoices} nav-tab-active{/if}">Print Invoices</a>
<a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=createLabels" class="nav-tab{if $option==createLabels} nav-tab-active{/if}">Create Labels</a>
+ <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=sendEmails" class="nav-tab{if $option==sendEmails} nav-tab-active{/if}">Send Emails</a>
</h2>
{/if}
<br clear="all">
- <table class="wp-list-table widefat fixed posts glm-admin-table">
- <thead>
- <tr>
- <th style="width: 50px;">ID</th>
- <th>Member Name</th>
- <th>Time</th>
- <th>Amount</th>
- <th>Payment Method</td>
- <th>Payment Notes</th>
- </tr>
- </thead>
- <tbody>
- {if $havePayments}
- {assign var="i" value="0"}
- {foreach $payments as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td> {$t.id} </td>
- <td> {$t.member_name} </td>
- <td> {$t.transaction_time.datetime} </td>
- <td> {$t.amount|string_format:"%.2f"} </td>
- <td> {$t.payment_method} </td>
- <td> {$t.payment_data} </td>
- </tr>
- {/foreach}
- {else}
- <tr class="alternate"><td colspan="2">(no Invoice Types listed)</td></tr>
- {/if}
- </tbody>
- </table>
+ <div class="glm-admin-table-inner">
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th style="width: 150px;">Member Name</th>
+ <th>Time</th>
+ <th>Amount</th>
+ <th>Payment Method</td>
+ <th>Payment Notes</th>
+ </tr>
+ </thead>
+ <tbody>
+ {if $havePayments}
+ {assign var="i" value="0"}
+ {foreach $payments as $t}
+ <tr class="glm-payment-row{if $t@iteration is div by 2} alternate{/if}" data-id="{$t.id}">
+ <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> {$t.transaction_time.datetime} </td>
+ <td> {$t.amount|string_format:"%.2f"} </td>
+ <td> {$t.payment_method} </td>
+ <td> {$t.payment_data} </td>
+ </tr>
+ <tr id="payment-container-{$t.id}" class="glm-payment-links glm-hidden{if $t@iteration is div by 2} alternate{/if}">
+ <td colspan="5">
+ <span class="account-dashboard-link">
+ <a onClick="return confirm('This will delete the payment. This cannot be undone. Are you Sure?');" href="{$thisUrl}?page={$thisPage}&glm_action=payments&option=delete&payment_id={$t.id}">Delete</a>
+ </span>
+ </td>
+ </tr>
+ {/foreach}
+ {else}
+ <tr class="alternate"><td colspan="2">(no Payments listed)</td></tr>
+ {/if}
+ </tbody>
+ </table>
+ </div>
{if $paging}
<input type="Submit" name="pageSelect" value="Previous {$limit} Accounts" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
</form>
<script type="text/javascript">
-jQuery(document).ready(function($) {
-
- // Date Input
- $('.glm-date-input').datepicker({
- dateFormat: 'mm/dd/yy'
- });
-
- var availableAccounts = [
- {foreach $allAccounts as $m}
- { label: "{$m.ref_name|unescape:'html'|replace:'"':''}", value: "{$m.ref_name|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
- {/foreach}
- ]
-
- // Setup autocomplete for both inputs
- $('#account_name').autocomplete({
- source: availableAccounts,
- select: function( event, ui ){
- $('#member-account').val( ui.item.id );
- $('#searchForm').submit();
- },
- change: function( event, ui) {
- if( ui.item == null ) {
- $('#member-account').val( '' );
+ jQuery(document).ready(function($) {
+
+ var paymentHoverId = false;
+
+ $('.glm-payment-row').mouseenter( function(){
+ // Hide all
+ $( '.glm-payment-links' ).addClass( 'glm-hidden' );
+
+ paymentHoverId = $(this).data('id');
+ $( '#payment-container-' + paymentHoverId ).removeClass( 'glm-hidden' );
+ });
+ $('.glm-admin-table-inner').mouseleave( function() {
+ $( '#payment-container-' + paymentHoverId ).addClass( 'glm-hidden' );
+ });
+
+ // Date Input
+ $('.glm-date-input').datepicker({
+ dateFormat: 'mm/dd/yy'
+ });
+
+ var availableAccounts = [
+ {foreach $allAccounts as $m}
+ { label: "{$m.ref_name|unescape:'html'|replace:'"':''}", value: "{$m.ref_name|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
+ {/foreach}
+ ]
+
+ // Setup autocomplete for both inputs
+ $('#account_name').autocomplete({
+ source: availableAccounts,
+ select: function( event, ui ){
+ $('#member-account').val( ui.item.id );
$('#searchForm').submit();
- }
- },
+ },
+ change: function( event, ui) {
+ if( ui.item == null ) {
+ $('#member-account').val( '' );
+ $('#searchForm').submit();
+ }
+ },
+ });
});
-});
</script>
{include file='admin/billing/exportPaymentModal.html'}