Setting up support class.
Created methods to record invoice and payment transactions.
--- /dev/null
+<?php
+/**
+ * Gaslight Media Associate
+ * Billings Plugin support class
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release registratiosnSupport.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+
+// Load required data classes for billing
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataInvoices.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataInvoiceTypes.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataNotificationTypes.php';
+
+class GlmBillingSupport
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Billing Request Cart
+ *
+ * $var $cart
+ * @access public
+ */
+ public $cart = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ }
+
+ public function recordInvoice( $invoice_id, $total )
+ {
+ $this->recordTransaction( $this->config['transaction_numb']['Invoice'], $invoice_id, $total, null );
+ }
+
+ public function recordPayment( $invoice_id, $payment ) {
+ $this->recordTransaction( $this->config['transaction_numb']['Payment'], $invoice_id, null, $payment );
+ }
+
+ public function recordTransaction( $type, $type_id, $current_invoice_total = null, $current_payment_total = null )
+ {
+ $current_invoice_total = ( $current_invoice_total == null ) ? '0.00': $current_invoice_total;
+ $current_payment_total = ( $current_payment_total == null ) ? '0.00': $current_payment_total;
+ $this->wpdb->insert(
+ GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'transactions',
+ array(
+ 'type' => $type,
+ 'type_id' => $type_id,
+ 'transaction_time' => date('Y-m-d H:i;s'),
+ 'current_invoice_total' => $current_invoice_total,
+ 'current_payment_total' => $current_payment_total,
+ ),
+ array()
+ );
+ }
+
+}
transaction_type[30] = "Adjustment"
transaction_type[40] = "Comment"
+transaction_numb['Invoice'] = 10;
+transaction_numb['Payment'] = 20;
+transaction_numb['Adjustment'] = 30;
+transaction_numb['Comment'] = 40;
+
; Payment Methods
payment_method[10] = "Check"
payment_method[20] = "Credit Card"
*/
// Load Contacts data class
-require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataInvoices.php';
-require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataInvoiceTypes.php';
-require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataAccounts.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataInvoices.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataInvoiceTypes.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/billingSupport.php';
class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
{
}
}
}
- $this->generateInvoiceTotal( $this->invoice_id );
+ $totals = $this->generateInvoiceTotal( $this->invoice_id );
+ // Now we have a total for the invoice we can record the transaction
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+ $BillingSupport->recordInvoice( $this->invoice_id, $totals['amount_total'] );
+
$view = 'editInvoice';
$InvoiceTypesObj = new GlmDataInvoiceTypes( $this->wpdb, $this->config );
$invoiceTypes = $InvoiceTypesObj->getList();
* @link http://dev.gaslightmedia.com/
*/
define('GLM_MEMBERS_BILLING_MEMBER_MENU', true);
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataInvoices.php';
// Load Billing data abstract
// require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataBilling.php';
$view = 'editAccount';
break;
case 'list':
+ // Get the list of invoices for this member
+ echo '<pre>$this->memberID: ' . print_r( $this->memberID, true) . '</pre>';
+ // echo '<pre>$memberData: ' . print_r( $memberData, true) . '</pre>';
+ $Invoices = new GlmDataInvoices( $this->wpdb, $this->config );
+ // $where = "T."
+ // $invoices = $Invoices->getList($where);
+
break;
}
),
'member' => array(
'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
- 'index' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
+ // 'index' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
),
),
'frontActions' => array(
--- /dev/null
+{if $fromMemberMenu}
+ {include file='admin/member/header.html'}
+ {include file='admin/billing/memberBillingSubHeader.html'}
+{else}
+ {include file='admin/billing/header.html'}
+{/if}
+
+ <table class="glm-admin-table">
+ <tr>
+ <td colspan="2" align="">
+ </td>
+ </tr>
+ </table>
+
+ <table class="glm-admin-table">
+ <tr><th>Number of Pending Invoices Listed: </th><td> replace me </td></tr>
+ </table>
+
+{include file='admin/footer.html'}