From: Steve Sutton Date: Wed, 20 Feb 2019 14:39:05 +0000 (-0500) Subject: Update query for accounts needing invoices. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=70116ce9e0de741885828865c36e705586c03667;p=WP-Plugins%2Fglm-member-db-billing.git Update query for accounts needing invoices. This is the list that comes up for invoicing when you choose create invoices. This list will only be for accounts that do not have an invoice created yet. --- diff --git a/models/admin/billing/invoicing.php b/models/admin/billing/invoicing.php index 4ea6c2d..e52c622 100644 --- a/models/admin/billing/invoicing.php +++ b/models/admin/billing/invoicing.php @@ -156,6 +156,17 @@ class GlmMembersAdmin_billing_invoicing //extends GlmDataAccounts case 'createInvoices': $view = 'invoicing'; + $currentInvoiceDateTS = $BillingSupport->getCurrentInvoiceDate(); + $currentInvoiceDate = date( 'Y-m-d', $currentInvoiceDateTS ); + $nextInvoiceDateTS = $BillingSupport->getNextInvoiceDate(); + $nextInvoiceDate = date( 'Y-m-d', $nextInvoiceDateTS ); + + $wParts[] = " T.id NOT IN ( + SELECT account + FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices + WHERE due_date BETWEEN '$currentInvoiceDate' AND '$nextInvoiceDate' + ) "; + if ( $option2 ) { // $where used in all places. $where = implode( ' AND ', $wParts ); @@ -234,6 +245,7 @@ class GlmMembersAdmin_billing_invoicing //extends GlmDataAccounts // $where used in all places. $where = implode( ' AND ', $wParts ); + // echo '
$where: ' . print_r( $where, true ) . '
'; // Check if Counties is enabled and fetch counties if ( isset( $this->config['settings']['enable_counties'] ) && $this->config['settings']['enable_counties'] ) {