*
* Printing for Avery 5161 labels.
*
- * @param $invoices array Invoices is an array of billing invoices.
+ * @param $accounts array Accounts is an array of billing accounts.
*
* @return mixed
*/
- public function createPdf( $invoices, $noContactNames = false )
+ public function createPdf( $accounts, $noContactNames = false )
{
$addresses = array();
- if ( $invoices ) {
+ if ( $accounts && is_array( $accounts ) && !empty( $accounts ) ) {
$columnCount = 0;
$rowCount = 0;
- foreach ( $invoices as $invData ) {
- $account = $invData['account'];
+ foreach ( $accounts as $account ) {
+ // $account = $invData['account'];
$columnCount++;
$colName = ( $columnCount % 2 == 0 ) ? 'col2' : 'col1';
$addressLine = '';
FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices
WHERE paid <> true ) ";
} else {
- $wParts[] = " T.id IN (
- SELECT account
- FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices) ";
+ // $wParts[] = " T.id IN (
+ // SELECT account
+ // FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices) ";
}
- $wParts[] = " ( T.usmail_invoice OR T.fax_invoice ) ";
+ $wParts[] = " ( T.usmail_invoice = true OR T.fax_invoice = true ) ";
// $where used in all places.
$where = implode( ' AND ', $wParts );
+ // echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
// Get all invoices
- $invoiceData = $this->wpdb->get_results(
- "SELECT I.id
- FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices I
- LEFT OUTER JOIN " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts T ON (T.id = I.account)
- WHERE $where
- ORDER BY T.ref_name",
- ARRAY_A
- );
+ // $invoiceData = $this->wpdb->get_results(
+ // "SELECT I.id
+ // FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices I
+ // LEFT OUTER JOIN " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts T ON (T.id = I.account)
+ // WHERE $where
+ // ORDER BY T.ref_name",
+ // ARRAY_A
+ // );
// echo '<pre>$invoiceData: ' . print_r( $invoiceData, true ) . '</pre>';
- foreach ( $invoiceData as $inv ) {
- $fullInvoice = $BillingSupport->getFullInvoiceData( $inv['id'] );
- if ( $fullInvoice ) {
- $invoices[] = $fullInvoice;
- }
- }
+
+ // Need to get accounts not invoices
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+ $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
+
+ $orderBy = 'ref_name';
+ $Accounts->paymentTypes = true;
+ $Accounts->balanceDue = true;
+ $accounts = $Accounts->getList( $where, $orderBy );
+ $Accounts->paymentTypes = false;
+ $Accounts->balanceDue = false;
+
+ // echo '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
+ // exit;
+ // foreach ( $invoiceData as $inv ) {
+ // $fullInvoice = $BillingSupport->getFullInvoiceData( $inv['id'] );
+ // if ( $fullInvoice ) {
+ // $invoices[] = $fullInvoice;
+ // }
+ // }
$pdf = new GlmPDFLabel( $this->config, 'LETTER', 'portrait' );
- $pdf->createPdf( $invoices, $noContactNames );
+ $pdf->createPdf( $accounts, $noContactNames );
wp_die();
}
$Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
// Not paid query
- $notPaid = "( paid <> true OR paid IS NULL )";
+ $notPaid = "( paid <> true ) AND balance != 0.00";
if ( isset( $_REQUEST['invoice_types'] ) ) {
$invoiceTypes = $_REQUEST['invoice_types'];
$paymentTypes = $BillingSupport->getAllInvoiceTypes();
-
if (isset($_REQUEST['pageSelect'])) {
// If request is for Next
if ($_REQUEST['pageSelect'][0] == 'N') {
$start = $newStart;
}
}
- $orderBy = 'member_name';
+ $orderBy = 'ref_name';
$Accounts->paymentTypes = true;
$Accounts->balanceDue = true;
$accountsResult = $Accounts->getList( $where, $orderBy, true, 'id', $start, $limit );
$totalAccounts = $Accounts->getStats( $where );
$Accounts->paymentTypes = false;
$Accounts->balanceDue = false;
+
// Get paging results
$numbDisplayed = $accountsResult['returned'];
$lastDisplayed = $accountsResult['last'];
$haveAccounts = true;
}
-
-
$templateData = array(
'option' => $option,
'paymentTypes' => $paymentTypes,
$BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
$limit = 10;
-$dbConn = 'pgsql: host=ds5 dbname=uptravel user=postgres';
+$dbConn = 'pgsql: host=ds5.gaslightmedia.com dbname=uptravel user=postgres';
// $dbConn = 'pgsql: dbname=uptravel user=postgres';
// Connect to their live database.
$dbh = new PDO(
require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/billingSupport.php';
$BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
// Connect to their live database.
-$dbConn = 'pgsql: host=ds5 dbname=uptravel user=postgres';
+$dbConn = 'pgsql: host=ds5.gaslightmedia.com dbname=uptravel user=postgres';
// $dbConn = 'pgsql: dbname=uptravel user=postgres';
$dbh = new PDO(
$dbConn,
Billing Dashboard
</h2>
<div class="glm-widget-content">
- Membership Status: {$account_status}
- <a href="{$thisUrl}?page={$thisPage}&{$billing_link}">{$billing_label}</a>
+ {if $settings.member_types_enabled}
+ Membership Status: {$account_status}
+ <a href="{$thisUrl}?page={$thisPage}&{$billing_link}">{$billing_label}</a>
+ {else}
+ <ul>
+ <li>
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}&option=account" class="">Billing Info</a>
+ </li>
+ <li>
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}" class="">All Statements</a>
+ </li>
+ <li>
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}&option=makepayment" class="">Pay Invoices</a>
+ </li>
+ </ul>
+ {/if}
</div>
</div>