Members without accounts working.
Worked on qif export.
}
- $billingFieldsRequired = $this->config['settings']['billing_fields_required'];
+ $billingNameFieldsRequired = false;
+ $billingFieldsRequired = $this->config['settings']['billing_fields_required'];
+ $billingContactNameEnabled = $this->config['settings']['billing_contact_name_enabled'];
+ if ( $billingFieldsRequired && $billingContactNameEnabled ) {
+ $billingNameFieldsRequired = false;
+ } else if ( $billingFieldsRequired ) {
+ $billingNameFieldsRequired = true;
+ }
/*
* Table Name
'field' => 'billing_fname',
'type' => 'text',
'use' => 'a',
- 'required' => $billingFieldsRequired,
+ 'required' => $billingNameFieldsRequired,
),
// Billing Last Name
'field' => 'billing_lname',
'type' => 'text',
'use' => 'a',
- 'required' => $billingFieldsRequired,
+ 'required' => $billingNameFieldsRequired,
),
// Billing Address 1
text-decoration: underline;
font-size: 12px;
}
+/* billing search form styles */
+.billing-search-form-select {
+ width: 200px;
+ float: left;
+}
+.billing-search-form-select label {
+ font-weight: bold;
+}
+.billing-search-form-container {
+ width: 200px;
+ float: left;
+ margin-right: 5px;
+}
+.billing-search-form-container label {
+ font-weight: bold;
+}
+.billing-search-form-submit {
+ width: 400px;
+ height: 30px;
+ clear: left;
+ float: left;
+}
+.billing-search-form-checkbox {
+ width: 100%;
+ float:left;
+ font-weight: normal;
+}
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * PDF Output by admin-ajax
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/billingSupport.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataTransactions.php';
+
+/**
+ * Steve Note
+ *
+ * You can get to this using the following URL.
+ *
+ *
+ {host}/wp-admin/admin-ajax.php?action=glm_members_admin_ajax&glm_action=runQueue
+ *
+ * You should be able to do this as POST or GET and should be able to add and read additional parameters.
+ * I added a "mystuff" parameter to the URL above and it does output from the code in the
+ * modelAction() function below.
+ *
+ * To add another model under models/admin/ajax all you need to do is create it and add it to the
+ * setup/validActions.php file.
+ *
+ */
+
+/**
+ * This class handles the work of creating new invoices based on.
+ * 1) Member Type of member matching a paid invoiceType
+ * 2) Member renewal date past
+ * 3) Member has Billing Account
+ * 4) Member has no active Invoice
+ * 5) Renewal date is within the next 30 Days
+ *
+ */
+class GlmMembersAdmin_ajax_exportQIF extends GlmDataTransactions
+{
+
+ const HEADERFORMAT = "!Type:Bank\nD%s\nT%s\nP%s\nL[%s]\n^\n";
+ const INVOICEFORMAT = "!D%s\nT%s\nP%s\nL%s\n^\n";
+ const PAYMENTFORMAT = "D%s\nT%s\nP%s\nN%s\nM%s\nL%s\n^\n";
+ const MAINCATEGORY = 'Member Services:';
+ const INVCATEGORY = 'Other Inc';
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ parent::__construct( false, false, true );
+
+ }
+
+ public function modelAction( $actionData = false )
+ {
+ $fileData = array();
+
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+
+ // Query Params
+ if ( isset( $_REQUEST['invoice_types'] ) && $invoiceTypes = filter_var( $_REQUEST['invoice_types'], FILTER_VALIDATE_INT,array( 'flags' => FILTER_FORCE_ARRAY ) ) ) {
+ // $invoiceTypes = $_REQUEST['invoice_types'];
+ $wParts[] = " T.invoice_type IN (" . implode(',', $invoiceTypes) . ") ";
+ $reportParts[] = " T.account IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE invoice_type IN (" . implode(',', $invoiceTypes) . ")
+ ) ";
+ }
+
+ if ( isset( $_REQUEST['counties'] ) && $countiesSelected = filter_var( $_REQUEST['counties'], FILTER_VALIDATE_INT,array( 'flags' => FILTER_FORCE_ARRAY ) ) ) {
+ // $countiesSelected = $_REQUEST['counties'];
+ $wParts[] = "T.billing_county IN (" . implode(',', $countiesSelected ) . ")";
+ $reportParts[] = " T.account IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE billing_county IN (" . implode(',', $countiesSelected) . ")
+ ) ";
+ }
+
+ if ( isset( $_REQUEST['member_name'] ) && $member_name = filter_var( $_REQUEST['member_name'], FILTER_SANITIZE_STRING ) ) {
+ $reportParts[] = "T.account IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE ref_name like '%" . esc_sql( $member_name ) . "%'
+ )";
+ }
+ if ( isset( $_REQUEST['account_number'] ) && $account_number = filter_var( $_REQUEST['account_number'], FILTER_SANITIZE_STRING ) ) {
+ $reportParts[] = "T.account IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE account_number = '" . esc_sql( $account_number ) . "'
+ )";
+ }
+
+ $reportParts[] = "T.type = " . $this->config['transaction_numb']['Payment'];
+
+ $dateRegExp = '%[0-9]{2}/[0-9]{2}/[0-9]{4}%';
+ if ( isset( $_REQUEST['from_date'] ) && $fromDate = filter_var( $_REQUEST['from_date'], FILTER_VALIDATE_REGEXP, array( 'options' => array( 'regexp' => $dateRegExp ) ) ) ) {
+ $reportParts[] = "T.transaction_time >= '" . date( 'Y-m-d', strtotime( $fromDate ) ) . "'";
+ }
+ if ( isset( $_REQUEST['to_date'] ) && $toDate = filter_var( $_REQUEST['to_date'], FILTER_VALIDATE_REGEXP, array( 'options' => array( 'regexp' => $dateRegExp ) ) ) ) {
+ $reportParts[] = "T.transaction_time <= '" . date( 'Y-m-d', strtotime( $toDate . '+1 day' ) ) . "'";
+ }
+
+
+ // $where used in all places.
+ $reportWhere = implode( ' AND ', $reportParts );
+ $orderBy = 'account,transaction_time,type';
+ $this->member_data = true;
+ $this->notes = true;
+ $transactions = $this->getList( $reportWhere, $orderBy );
+ $this->member_data = false;
+ $this->notes = false;
+
+ // Open file pointer to php://output (Direct to browser)
+ $fp = fopen( 'php://output', 'w' );
+
+ $paymentTypes = $BillingSupport->getAllInvoiceTypes();
+
+ // Generate the QIF format data
+ $fileData[] = "!Type:Bank\n";
+ foreach ( $transactions as $record ) {
+ switch ( $record['type'] ) {
+ case $this->config['transaction_numb']['Payment']:
+ $paymentType = $paymentTypes[$record['type_id']];
+ if ( $paymentType ) {
+ $fileData[] = sprintf(
+ self::PAYMENTFORMAT,
+ date( 'm/d/Y', strtotime( $record['transaction_time']['datetime'] ) ), // D
+ '-' . $record['current_payment_total'], // T
+ $record['member_name'], // P
+ preg_replace(
+ '[0-9]',
+ '',
+ $record['notes']
+ ), // N
+ $paymentType['category'], // M
+ $paymentType['qcode'] // L
+ );
+ }
+ break;
+ }
+ }
+ $buf = implode( '', $fileData );
+ $len = strlen( $buf );
+
+ // Setup headers for forcing a file download.
+ if (ini_get('zlib.output_compression')) {
+ ini_set('zlib.output_compression', 'Off');
+ }
+ header("Content-Type: application/force-download\n");
+ /* Correction for the stupid MSIE thing */
+ $fileName = 'uptraImport-'.date('m-d-Y').'.qif';
+ if (strstr(getenv('HTTP_USER_AGENT'), 'MSIE')) {
+ header("Content-Disposition: inline; filename=\"$fileName\"");
+ } else {
+ header("Content-Disposition: attachment; filename=\"$fileName\"");
+ }
+
+ echo $buf;
+
+ // Close the file pointer
+ fclose( $fp );
+
+ wp_die();
+ }
+
+}
$option = 'openAccounts';
$view = 'reports';
$wParts = array( 'true' );
+ $where = false;
+ $reportParts = array( 'true' );
+ $reportWhere = false;
$paymentTypes = false;
$counties = false;
$accounts = false;
// echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
- if ( isset( $_REQUEST['invoice_types'] ) ) {
-
- $invoiceTypes = $_REQUEST['invoice_types'];
- $wParts[] = " T.invoice_type IN (" . implode(',', $invoiceTypes) . ") ";
-
+ if ( isset( $_REQUEST['invoice_types'] ) && $invoiceTypes = filter_var( $_REQUEST['invoice_types'], FILTER_VALIDATE_INT,array( 'flags' => FILTER_FORCE_ARRAY ) ) ) {
+ // $invoiceTypes = $_REQUEST['invoice_types'];
+ $wParts[] = " T.invoice_type IN (" . implode(',', $invoiceTypes) . ") ";
+ $reportParts[] = " T.account IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE invoice_type IN (" . implode(',', $invoiceTypes) . ")
+ ) ";
}
- if ( isset( $_REQUEST['counties'] ) ) {
-
- $countiesSelected = $_REQUEST['counties'];
- $wParts[] = "T.billing_county IN (" . implode(',', $countiesSelected ) . ")";
+ if ( isset( $_REQUEST['counties'] ) && $countiesSelected = filter_var( $_REQUEST['counties'], FILTER_VALIDATE_INT,array( 'flags' => FILTER_FORCE_ARRAY ) ) ) {
+ // $countiesSelected = $_REQUEST['counties'];
+ $wParts[] = "T.billing_county IN (" . implode(',', $countiesSelected ) . ")";
+ $reportParts[] = " T.account IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE billing_county IN (" . implode(',', $countiesSelected) . ")
+ ) ";
+ }
+ if ( isset( $_REQUEST['member_name'] ) && $member_name = filter_var( $_REQUEST['member_name'], FILTER_SANITIZE_STRING ) ) {
+ $reportParts[] = "T.account IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE ref_name like '%" . esc_sql( $member_name ) . "%'
+ )";
+ }
+ if ( isset( $_REQUEST['account_number'] ) && $account_number = filter_var( $_REQUEST['account_number'], FILTER_SANITIZE_STRING ) ) {
+ $reportParts[] = "T.account IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE account_number = '" . esc_sql( $account_number ) . "'
+ )";
+ }
+ if ( isset( $_REQUEST['transactionTypes'] ) && $transactionTypes = filter_var( $_REQUEST['transactionTypes'], FILTER_VALIDATE_INT,array( 'flags' => FILTER_FORCE_ARRAY ) ) ) {
+ $reportParts[] = "T.type IN (" . implode(',', $transactionTypes) . ")";
+ }
+ $dateRegExp = '%[0-9]{2}/[0-9]{2}/[0-9]{4}%';
+ if ( isset( $_REQUEST['from_date'] ) && $fromDate = filter_var( $_REQUEST['from_date'], FILTER_VALIDATE_REGEXP, array( 'options' => array( 'regexp' => $dateRegExp ) ) ) ) {
+ $reportParts[] = "T.transaction_time >= '" . date( 'Y-m-d', strtotime( $fromDate ) ) . "'";
+ }
+ if ( isset( $_REQUEST['to_date'] ) && $toDate = filter_var( $_REQUEST['to_date'], FILTER_VALIDATE_REGEXP, array( 'options' => array( 'regexp' => $dateRegExp ) ) ) ) {
+ $reportParts[] = "T.transaction_time <= '" . date( 'Y-m-d', strtotime( $toDate . '+1 day' ) ) . "'";
}
if ( isset( $_REQUEST['submitType'] ) ) {
-
$option2 = filter_var( $_REQUEST['submitType'], FILTER_SANITIZE_STRING );
-
}
// Do selected option
break;
case 'noAccounts':
+ // Get a list of members that are in full and basic member types.
+
break;
case 'reportGenerator':
}
// $where used in all places.
- $where = implode( ' AND ', $wParts );
+ $where = implode( ' AND ', $wParts );
+ $reportWhere = implode( ' AND ', $reportParts );
if (isset($_REQUEST['pageSelect'])) {
$orderBy = 'transaction_time';
$this->member_data = true;
$this->notes = true;
- $accountsResult = $this->getList( $where, $orderBy, true, 'id', $start, $limit );
- $totalAccounts = $this->getStats( $where );
+ $accountsResult = $this->getList( $reportWhere, $orderBy, true, 'id', $start, $limit );
+ $totalAccounts = $this->getStats( $reportWhere );
$this->member_data = false;
$this->notes = false;
break;
case 'noAccounts':
+ $sql = "
+ SELECT id as ref_dest, name as member_name,'' as account_number,'' as payment_type, 'N/A' as balance_due
+ FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
+ WHERE id NOT IN (
+ SELECT DISTINCT ref_dest
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts)
+ AND member_type IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_type
+ WHERE name IN ('full', 'enhanced')
+ )
+ ORDER BY name";
+ // echo '<pre>$sql: ' . print_r( $sql, true ) . '</pre>';
+ $accounts = $this->wpdb->get_results( $sql, ARRAY_A );
+ $paging = false;
break;
default:
break;
$templateData = array(
'tActionTypes' => $this->config['transaction_numb'],
+ 'actionTypeSel' => $this->config['transaction_type'],
'option' => $option,
'paymentTypes' => $paymentTypes,
'counties' => $counties,
*/
if (isset($this->config['loggedInUser']) && isset($this->config['loggedInUser']['contactUser']) && $this->config['loggedInUser']['contactUser']) {
- add_submenu_page(
- $mainMenuSlug,
- 'Billing',
- 'Billing',
- 'glm_members_edit_my_entity',
- 'glm-members-admin-menu-billing-index',
- function() { $this->controller('member', 'billing'); }
- );
+ $memberBillingEnabled = $this->config['settings']['member_billing_enabled'];
+ if ( $memberBillingEnabled ) {
+ add_submenu_page(
+ $mainMenuSlug,
+ 'Billing',
+ 'Billing',
+ 'glm_members_edit_my_entity',
+ 'glm-members-admin-menu-billing-index',
+ function() { $this->controller('member', 'billing'); }
+ );
+ }
} else {
add_submenu_page(
'glm-members-admin-menu-members',
'createNewInvoices' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
'createPDFInvoice' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
'printInvoices' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
+ 'exportQIF' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
'createPDFLabels' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
'createCSVLabels' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
'accountsListExport' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
<input type="hidden" name="nextStart" value="{$nextStart}">
<input type="hidden" name="limit" value="{$limit}">
- <div class="">
- <span class="glm-nowrap">
- <b>From Date: </b><input type="text" name="fromDate" value="{$fromDate}" class="glm-form-text-input-short glm-date-input">
- <b>To Date: </b><input type="text" name="toDate" value="{$toDate}" class="glm-form-text-input-short glm-date-input">
- </span>
- <span class="glm-nowrap">
+ <div class="glm-admin-table-inner">
+ <div class="billing-search-form-container">
+ <label>From Date: </label>
+ <input type="text" name="fromDate" value="{$fromDate}" class="glm-form-text-input-short glm-date-input">
+ <label>To Date: </label>
+ <input type="text" name="toDate" value="{$toDate}" class="glm-form-text-input-short glm-date-input">
+ </div>
+ <div class="billing-search-form-container">
<b>Member Account: </b>
<input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts}">
<input id="account_name" name="searchName" value="{if $searchName}{$searchName}{/if}" />
- </span>
- <br>
- <span class="glm-nowrap">
+ </div>
+ <div class="billing-search-form-container">
+ <label class="billing-search-form-checkbox">
<input class="glm-filter" id="filterActive" name="filterActive" value="1" {if $filterActive}checked{/if} type="checkbox" /> Show Active
+ </label>
+ <label class="billing-search-form-checkbox">
<input class="glm-filter" id="filterPending" name="filterPending" value="1" {if $filterPending}checked{/if} type="checkbox" /> Show Pending
+ </label>
+ <label class="billing-search-form-checkbox">
<input class="glm-filter" id="filterOverdue" name="filterOverdue" value="1" {if $filterOverdue}checked{/if} type="checkbox" /> Show Overdue
+ </label>
+ <label class="billing-search-form-checkbox">
<input class="glm-filter" id="filterExpired" name="filterExpired" value="1" {if $filterExpired}checked{/if} type="checkbox" /> Show Expired
- </span>
- <br>
- <span class="glm-nowrap">
- <input type="submit" value="Submit">
- </span>
+ </label>
+ </div>
+ <div class="billing-search-form-submit">
+ <input type="submit" value="Submit">
</div>
+ </div>
{foreach $accounts as $t}
<tr class="glm-account-row{if $t@iteration is div by 2} alternate{/if}" data-id="{$t.id}">
<td> {$t.id} </td>
- <td> <a class="account-link" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}">{$t.ref_name}</a> </td>
+ <td> <a class="account-link" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}"><b>{$t.ref_name}</b></a> </td>
{if $settings.allow_employees}
<td> {if $t.boss.value}Yes{/if} </td>
{/if}
<input type="hidden" name="nextStart" value="{$nextStart}">
<input type="hidden" name="limit" value="{$limit}">
- <div class="">
- <p>
- <span class="glm-nowrap">
- <b>From Date: </b><input type="text" name="fromDate" value="{$fromDate}" class="glm-form-text-input-short glm-date-input">
- <b>To Date: </b><input type="text" name="toDate" value="{$toDate}" class="glm-form-text-input-short glm-date-input">
- </span>
- <span class="glm-nowrap">
- <b>Member Account: </b>
- <input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts}">
- <input id="account_name" name="searchName" value="" />
- </span>
- <br>
- <span class="glm-nowrap">
+ <div class="glm-admin-table-inner">
+ <div class="billing-search-form-container">
+ <label>From Date: </label>
+ <input type="text" name="fromDate" value="{$fromDate}" class="glm-form-text-input-short glm-date-input">
+ <label>To Date: </label>
+ <input type="text" name="toDate" value="{$toDate}" class="glm-form-text-input-short glm-date-input">
+ </div>
+ <div class="billing-search-form-container">
+ <label>Member Account: </label>
+ <input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts}">
+ <input id="account_name" name="searchName" value="" />
+ </div>
+ <div class="billing-search-form-container">
+ <label>
<input type="checkbox" name="filterUnpaid"{if isset($smarty.request.filterUnpaid) && $smarty.request.filterUnpaid} checked{/if}>
- <b>Show only Unpaid Invoices</b>
- </span>
- <br>
- <span class="glm-nowrap">
- <input type="submit" value="Submit">
- </span>
-
- <p>
+ Show only Unpaid Invoices
+ </label>
+ </div>
+ <div class="billing-search-form-submit">
+ <input type="submit" value="Submit">
+ </div>
+
</div>
<br clear="all">
<input type="hidden" name="prevStart" value="{$prevStart}">
<input type="hidden" name="nextStart" value="{$nextStart}">
<input type="hidden" name="limit" value="{$limit}">
- <div class="">
- <span class="glm-nowrap">
+ <div class="glm-admin-table-inner">
+ <div class="billing-search-form-container">
<b>From Date: </b><input type="text" name="fromDate" value="{$fromDate}" class="glm-form-text-input-short glm-date-input">
<b>To Date: </b><input type="text" name="toDate" value="{$toDate}" class="glm-form-text-input-short glm-date-input">
- </span>
- <span class="glm-nowrap">
+ </div>
+ <div class="billing-search-form-container">
<b>Member Account: </b>
<input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts}">
<input id="account_name" name="searchName" value="{if $searchName}{$searchName}{/if}" />
- </span>
- <br>
- <span class="glm-nowrap">
+ </div>
+ <div class="billing-search-form-submit">
<input type="submit" value="Submit">
- </span>
+ </div>
</div>
+ <br clear="all">
+
{if $paging}
<input type="Submit" name="pageSelect" value="Previous {$limit} Accounts" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
<input type="Submit" name="pageSelect" value="Next {$limit} Accounts" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
{if $option == 'reportGenerator'}
<div class="glm-admin-table-inner">
{if $paymentTypes}
- <div style="width:200px;float:left;">
- <label>Payment Types:</label><br>
- <select multiple size="10" name="invoice_types[]">
+ <div class="billing-search-form-select">
+ <label for="invoice_types">Payment Types:</label><br>
+ <select multiple size="10" id="invoice_types" name="invoice_types[]">
{foreach $paymentTypes as $paymentType}
<option value="{$paymentType.id}"{if isset($smarty.request.invoice_types) && in_array( $paymentType.id, $smarty.request.invoice_types )} selected{/if}>{$paymentType.name}</option>
{/foreach}
</div>
{/if}
{if $counties}
- <div style="width:200px;float:left;">
- <label>Counties:</label><br>
- <select multiple size="10" name="counties[]">
+ <div class="billing-search-form-select">
+ <label for="counties">Counties:</label><br>
+ <select multiple size="10" id="counties" name="counties[]">
{foreach $counties as $county}
<option value="{$county.id}"{if isset($smarty.request.counties) && in_array( $county.id, $smarty.request.counties )} selected{/if}>{$county.name}</option>
{/foreach}
</select>
</div>
{/if}
- <div style="width:400px; height: 30px;">
- <input type="submit" value="Search">
+ <div class="billing-search-form-container">
+ <label for="member_name">Member Name:</label>
+ <input class="reportForm" id="member_name" name="member_name" value="{if isset($smarty.request.member_name)}{$smarty.request.member_name}{/if}" />
+ <label for="account_number">Account Number:</label>
+ <input class="reportForm" id="account_number" name="account_number" value="{if isset($smarty.request.account_number)}{$smarty.request.account_number}{/if}" />
+ <label>From:</label>
+ <input id="from_date" class="reportForm glm-date-input" name="from_date" value="{if isset($smarty.request.from_date)}{$smarty.request.from_date}{/if}" />
+ <label>To:</label>
+ <input id="to_date" class="reportForm glm-date-input" name="to_date" value="{if isset($smarty.request.to_date)}{$smarty.request.to_date}{/if}" />
+ </div>
+ <div class="billing-search-form-container">
+ <label for="transactionTypes">Transaction Types:</label>
+ <select multiple size="4" id="transactionTypes" name="transactionTypes[]">
+ {foreach $actionTypeSel as $typeId => $typeLabel}
+ <option value="{$typeId}"{if isset($smarty.request.transactionTypes) && in_array( $typeId, $smarty.request.transactionTypes )} selected{/if}>{$typeLabel}</option>
+ {/foreach}
+ </select>
+ <br />
+ <label>
+ <input type="checkbox" id="qif" name="qif" /> Export QIF File
+ </label>
+ </div>
+ <div class="billing-search-form-submit">
+ <input id="report_search" type="submit" value="Search">
</div>
</div>
{/if}
</td>
<td> {$t.account_number} </td>
<td> {$t.payment_type} </td>
- <td> {$t.balance_due|string_format:"%.2f"} </td>
+ <td>
+ {if $t.balance_due == 'N/A'}
+ {$t.balance_due}
+ {else}
+ {$t.balance_due|string_format:"%.2f"}
+ {/if}
+ </td>
</tr>
{/foreach}
</table>
</div>
{/if}
- {debug}
{if isset( $transactions ) && !empty( $transactions )}
<div id="invoice-list">
<table class="wp-list-table widefat fixed posts glm-admin-table">
</form>
<script>
jQuery(document).ready(function($) {
- $('#print-invoices').on( 'click', function(e){
- e.preventDefault();
- var formData = $('#reports-form select').serialize();
- console.log( 'Form Data:', formData );
- window.location = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=printInvoices&' + formData;
- } );
- $('#create-labels').on( 'click', function(e){
- e.preventDefault();
- var formData = $('#reports-form select, input.labelOption').serialize();
+ // Date Input
+ $('.glm-date-input').datepicker({
+ dateFormat: 'mm/dd/yy'
+ });
+
+ $('#report_search').on( 'click', function(e){
+ // e.preventDefault();
+ var formData = $('#reports-form select, input.reportForm').serialize();
console.log( 'Form Data:', formData );
// Check if the Export as CSV file was checked.
- if ( $('#exportCSV:checked').length ) {
+ if ( $('#qif:checked').length ) {
console.log( 'exportCSV: ON' );
- window.location = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=createCSVLabels&' + formData;
+ window.location = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=exportQIF&' + formData;
+ return false;
} else {
- console.log( 'exportCSV: OFF' );
- window.location = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=createPDFLabels&' + formData;
+ // return true;
+ $('#reportsForm').submit();
}
} );
});