New fields for the billing member tab
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 27 Nov 2018 21:37:54 +0000 (16:37 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 27 Nov 2018 21:37:54 +0000 (16:37 -0500)
Adding invoice delivery methods.
Adding to the import to get these from uptra.
Starting work on the bulk invoice create.

15 files changed:
classes/data/dataAccounts.php
classes/data/dataSettings.php
config/plugin.ini
index.php
models/admin/billing/invoices.php
models/admin/management/importAccounts.php
models/admin/member/billing.php
setup/databaseScripts/create_database_V0.0.27.sql [deleted file]
setup/databaseScripts/create_database_V0.0.28.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V0.0.28.sql [new file with mode: 0644]
views/admin/billing/accounts.html
views/admin/billing/bulkAddInvoices.html
views/admin/billing/editAccount.html
views/admin/settings/billing.html

index 825125a..9603c47 100644 (file)
@@ -106,6 +106,8 @@ class GlmDataAccounts extends GlmDataAbstract
 
         }
 
+        $billingFieldsRequired = $this->config['settings']['billing_fields_required'];
+
         /*
          * Table Name
          */
@@ -150,6 +152,34 @@ class GlmDataAccounts extends GlmDataAbstract
                 'required' => true,
             ),
 
+            // Account Number
+            'account_number' => array(
+                'field'    => 'account_number',
+                'type'     => 'text',
+                'use'      => 'a',
+                'required' => false,
+            ),
+
+            // Invoice Delivery Methods
+            'email_invoice' => array(
+                'field'     => 'email_invoice',
+                'type'      => 'checkbox',
+                'use'       => 'a',
+            ),
+            'usmail_invoice' => array(
+                'field'     => 'usmail_invoice',
+                'type'      => 'checkbox',
+                'use'       => 'a',
+            ),
+
+            'fax_invoice' => array(
+                'field'     => 'fax_invoice',
+                'type'      => 'checkbox',
+                'use'       => 'a',
+            ),
+
+
+
             'invoice_type' => array(
                 'field'    => 'invoice_type',
                 'type'     => 'integer',
@@ -163,7 +193,7 @@ class GlmDataAccounts extends GlmDataAbstract
                 'type'     => 'date',
                 'use'      => 'a',
                 'default'  => '',
-                'required' => true,
+                'required' => false,
             ),
 
             // Renewal Date
@@ -188,7 +218,7 @@ class GlmDataAccounts extends GlmDataAbstract
                 'field'    => 'email',
                 'type'     => 'text',
                 'use'      => 'a',
-                'required' => true,
+                'required' => $billingFieldsRequired,
             ),
 
             // Billing Company
@@ -212,7 +242,7 @@ class GlmDataAccounts extends GlmDataAbstract
                 'field'    => 'billing_fname',
                 'type'     => 'text',
                 'use'      => 'a',
-                'required' => true,
+                'required' => $billingFieldsRequired,
             ),
 
             // Billing Last Name
@@ -220,7 +250,7 @@ class GlmDataAccounts extends GlmDataAbstract
                 'field'    => 'billing_lname',
                 'type'     => 'text',
                 'use'      => 'a',
-                'required' => true,
+                'required' => $billingFieldsRequired,
             ),
 
             // Billing Address 1
@@ -228,7 +258,7 @@ class GlmDataAccounts extends GlmDataAbstract
                 'field'    => 'billing_addr1',
                 'type'     => 'text',
                 'use'      => 'a',
-                'required' => true,
+                'required' => $billingFieldsRequired,
             ),
 
             // Billing Address 2
@@ -244,7 +274,7 @@ class GlmDataAccounts extends GlmDataAbstract
                 'field'    => 'billing_city',
                 'type'     => 'text',
                 'use'      => 'a',
-                'required' => true,
+                'required' => $billingFieldsRequired,
             ),
 
             // Billing State
@@ -254,7 +284,7 @@ class GlmDataAccounts extends GlmDataAbstract
                 'list'     => $this->config['states'],
                 'default'  => $this->config['settings']['default_state'],
                 'use'      => 'a',
-                'required' => true,
+                'required' => $billingFieldsRequired,
             ),
 
             // Billing Zip
@@ -262,7 +292,7 @@ class GlmDataAccounts extends GlmDataAbstract
                 'field'    => 'billing_zip',
                 'type'     => 'text',
                 'use'      => 'a',
-                'required' => true,
+                'required' => $billingFieldsRequired,
             ),
 
             // Billing Phone
index 3e6dd3c..024d052 100644 (file)
@@ -258,6 +258,20 @@ class GlmDataBillingSettings extends GlmDataAbstract
                 'use'   => 'a',
             ),
 
+            // Require Billing Fields
+            'billing_fields_required' => array(
+                'field' => 'billing_fields_required',
+                'type'  => 'checkbox',
+                'use'   => 'a',
+            ),
+
+            // Enable Invoice Methods
+            'invoice_methods_enabled' => array(
+                'field' => 'invoice_methods_enabled',
+                'type'  => 'checkbox',
+                'use'   => 'a',
+            ),
+
          );
 
     }
index 978db5e..ca91c40 100644 (file)
@@ -150,4 +150,3 @@ submission_status_numb['ADMIN_HOLD']            = 70
 submission_status_numb['FAILED']                = 80
 submission_status_numb['CANCELED']              = 99
 
-;
index 7d5a509..cf9bf47 100644 (file)
--- a/index.php
+++ b/index.php
@@ -38,7 +38,7 @@
  *  version from this plugin.
  */
 define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.16');
-define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.27');
+define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.28');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
 define('GLM_MEMBERS_BILLING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
index 5150865..f78f572 100644 (file)
@@ -154,6 +154,12 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             }
             $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
             $paymentTypes = $BillingSupport->getAllInvoiceTypes();
+
+            // Need to get the accounts
+            $Accounts    = new GlmDataAccounts( $this->wpdb, $this->config );
+            $accountList = $Accounts->getSimpleAccountList( '', '', true, 'id', 1, 20 );
+            $accounts    = $accountList['list'];
+
             break;
 
         case 'add':
index 56673ec..d260f02 100644 (file)
@@ -142,7 +142,8 @@ $importResults .= 'Total Members: ' . $totalMembers . "<br>";
 
 $sql = "
 SELECT M.member_id,M.billing_contact,M.account_number,
-       PT.name as payment_type,M.process_email as email, M.member_name
+       PT.name as payment_type,M.process_email as email, M.member_name,
+       MA.email_invoice, MA.usmail_invoice, MA.fax_invoice
   FROM members.member M
 LEFT OUTER JOIN members.member_account MA ON ( MA.member_id = M.member_id )
 LEFT OUTER JOIN members.payment_types PT ON ( MA.payment_type = PT.id )
@@ -196,6 +197,9 @@ foreach ( $members as $member ) {
             'email'          => $member['email'],
             'account_number' => $member['account_number'],
             'renewal_date'   => '2018-07-01',
+            'email_invoice'  => $member['email_invoice'],
+            'usmail_invoice' => $member['usmail_invoice'],
+            'fax_invoice'    => $member['fax_invoice'],
         );
         $accountDataFormat = array(
             '%d', // ref_dest
@@ -204,6 +208,9 @@ foreach ( $members as $member ) {
             '%s', // email
             '%s', // account_number
             '%s', // renewal_date
+            '%d', // email_invoice
+            '%d', // usmail_invoice
+            '%d', // fax_invoice
         );
 
         $importResults .= '<pre>$accountData: ' . print_r( $accountData, true ) . '</pre>';
index c205823..b87e6f7 100644 (file)
@@ -577,6 +577,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
                 $haveAccount = true;
             }
 
+            // echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
             $view = 'editAccount';
             break;
 
diff --git a/setup/databaseScripts/create_database_V0.0.27.sql b/setup/databaseScripts/create_database_V0.0.27.sql
deleted file mode 100644 (file)
index b1f5522..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
--- Gaslight Media Billing Module
--- File Created: 11/19/2018
--- Database Version: 0.0.27
--- Database Creation Script
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
---
-
--- Billing Accounts
-CREATE TABLE {prefix}accounts (
-    id INT NOT NULL AUTO_INCREMENT,
-    archived BOOLEAN DEFAULT '0',                          -- Marks account as archived
-    ref_dest INT NOT NULL,                                 -- reference to member id
-    ref_name TINYTEXT NOT NULL,                            -- Name of reference member
-    invoice_type INT NOT NULL DEFAULT '0',                 -- Ref to Invoice Type id
-    billing_fname TINYTEXT NULL,                           -- Billing First Name
-    billing_lname TINYTEXT NULL,                           -- Billing Last Name
-    billing_company TINYTEXT NULL,                         -- Billing Company Name
-    billing_position TINYTEXT NULL,                        -- Billing Title/Position
-    billing_addr1 TINYTEXT NULL,                           -- Billing Address 1
-    billing_addr2 TINYTEXT NULL,                           -- Billing Address 2
-    billing_city TINYTEXT NULL,                            -- Billing City
-    billing_state TINYTEXT NULL,                           -- Billing State
-    billing_zip TINYTEXT NULL,                             -- Billing Zip
-    billing_country TINYTEXT NULL,                         -- Billing Country
-    billing_phone TINYTEXT NULL,                           -- Billing Phone
-    billing_fax TINYTEXT NULL,                             -- Billing Fax
-    anniversary_date DATE NOT NULL,                        -- anniversary date - used for main invoice generation
-    renewal_date DATE NULL,                                -- renewal date of account
-    payment_data TEXT NULL,                                -- stored payment data
-    customer_profile_id TINYTEXT NULL,                     -- Customer Profile Id (Authorize.net)
-    payment_profile_id TINYTEXT NULL,                      -- Payment Profile Id (Authorize.net)
-    payment_profile_card TINYTEXT NULL,                    -- Payment Profile Card (Authorize.net)
-    email TINYTEXT NULL,                                   -- billing email
-    boss BOOLEAN DEFAULT '0',                              -- Boss flag
-    account_number TINYTEXT NULL,                          -- Account Number
-    PRIMARY KEY (id),
-    INDEX(ref_dest),
-    INDEX(ref_name(20)),
-    INDEX(email(20)),
-    INDEX(invoice_type),
-    INDEX(renewal_date)
-);
-
-----
-
--- transactions
-CREATE TABLE {prefix}transactions (
-    id INT NOT NULL AUTO_INCREMENT,
-    type INT NOT NULL,                                     -- type of transaction (payment,invoice,etc)
-    type_id INT NOT NULL,                                  -- reference to type id
-    account INT NOT NULL,                                  -- reference to account id
-    transaction_time DATETIME NOT NULL,                    -- datetime for the transaction
-    current_invoice_total DECIMAL(8, 2) NOT NULL,          -- invoice total
-    current_payment_total DECIMAL(8, 2) NOT NULL,          -- payment total
-    PRIMARY KEY (id),
-    INDEX(account),
-    INDEX(type_id),
-    INDEX(transaction_time)
-);
-
-----
-
--- Invoices
-CREATE TABLE {prefix}invoices (
-    id INT NOT NULL AUTO_INCREMENT,
-    transaction_time DATETIME NOT NULL,                    -- datetime for the invoice
-    account INT NOT NULL,                                  -- ref to account id
-    amount_total DECIMAL(8, 2) NOT NULL,                   -- total amount for invoice
-    balance DECIMAL(8, 2) NOT NULL,                        -- balance for this invoice
-    due_date DATE NOT NULL,                                -- Due date for this invoice
-    paid BOOLEAN DEFAULT '0',                              -- true/false if invoice is paid
-    notes TINYTEXT,                                        -- notes for this invoice
-    renewal BOOLEAN DEFAULT '0',                           -- true/false if a renewal
-    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
-    recurrence INT NULL DEFAULT 0,                         -- recurrence type
-    PRIMARY KEY (id),
-    INDEX(account),
-    INDEX(transaction_time),
-    INDEX(due_date)
-);
-
-----
-
--- Line Item Types
-CREATE TABLE {prefix}invoice_types (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TINYTEXT NOT NULL,                                -- name
-    parent INT NOT NULL DEFAULT 0,                         -- 0 if top level otherwise ref to another line_item_type as it's parent
-    member_type INT NOT NULL DEFAULT 0,                    -- Member Type assigned Default 0
-    amount DECIMAL(8,2) NOT NULL DEFAULT '0.00',           -- amount
-    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
-    recurrence INT NULL DEFAULT 0,                         -- recurrence type
-    dynamic_amount BOOLEAN DEFAULT '0',                    -- true/false if amount is dynamic
-    qcode TINYTEXT NULL,                                   -- qcode for quickbooks
-    category TINYTEXT NULL,                                -- quickbooks category
-    PRIMARY KEY (id)
-);
-
-----
-
--- Line Items
-CREATE TABLE {prefix}line_items (
-    id INT NOT NULL AUTO_INCREMENT,
-    invoice INT NOT NULL,                                  -- reference to invoice
-    line_item_type INT NOT NULL,                           -- reference to line item type
-    account INT NULL DEFAULT 0,                            -- ref to account id (renewal or employee)
-    name TEXT NOT NULL,                                    -- line item name
-    amount DECIMAL(8,2) DEFAULT '0.00',                    -- line item amount per item
-    quantity INT DEFAULT 1,                                -- quantity
-    total DECIMAL(8,2) DEFAULT '0.00',                     -- line item total
-    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
-    recurrence INT NULL DEFAULT 0,                         -- recurrence type
-    created DATE NULL,                                     -- Date this line item was first created
-    first_due_date DATE NULL,                              -- The first due date for this item
-    next_due_date DATE NULL,                               -- Next Due Date for this item
-    PRIMARY KEY (id),
-    INDEX(account),
-    INDEX(created),
-    INDEX(first_due_date),
-    INDEX(next_due_date)
-);
-
-----
-
--- payments
-CREATE TABLE {prefix}payments (
-    id INT NOT NULL AUTO_INCREMENT,
-    transaction_time DATETIME NOT NULL,                    -- datetime of payment
-    account INT NOT NULL,                                  -- ref to account table
-    amount DECIMAL(8, 2) NOT NULL,                         -- payment amount
-    payment_method TINYTEXT NOT NULL,                      -- payment method
-    payment_data TINYTEXT NULL,                            -- additional payment info
-    PRIMARY KEY (id)
-);
-
-----
-
--- pdfs
-CREATE TABLE {prefix}pdfs (
-    id INT NOT NULL AUTO_INCREMENT,
-    ref_type INT NOT NULL,                                 -- reference type
-    ref_dest INT NOT NULL,                                 -- reference types id
-    pdf MEDIUMTEXT NOT NULL,                               -- saved pdf
-    PRIMARY KEY (id)
-);
-
-----
-
--- Notification Types
-CREATE TABLE {prefix}notification_types (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TINYTEXT NOT NULL,                                -- name
-    to_email TINYTEXT NULL,                                -- To email
-    from_header TINYTEXT NOT NULL,                         -- from headers
-    replyto TINYTEXT NULL,                                 -- reply-to headers
-    subject TINYTEXT NOT NULL,                             -- Subject
-    message TEXT NOT NULL,                                 -- Message
-    send_by_date BOOLEAN NULL DEFAULT '0',                 -- true/false send by date based on due date
-    send_by_action BOOLEAN NULL DEFAULT '0',               -- send notice based on an action
-    send_action INT NULL DEFAULT 0,                        -- (create invoice or receive payment)
-    send_date_number INT NULL DEFAULT 0,                   -- number to apply to send by date
-    send_date_period INT NULL DEFAULT 0,                   -- (days,weeks,months,years)
-    send_date_when INT NULL DEFAULT 0,                     -- (before or after)
-    PRIMARY KEY (id)
-);
-
-----
-
--- Notifications
-CREATE TABLE {prefix}notifications (
-    id INT NOT NULL AUTO_INCREMENT,
-    notification_type INT NOT NULL,                        -- ref to notification type
-    account INT NOT NULL,                                  -- ref to account
-    from_replyto TINYTEXT NOT NULL,                        -- from reply-to header
-    subject TEXT NOT NULL,                                 -- subject
-    message TEXT NOT NULL,                                 -- message
-    date_sent DATETIME NOT NULL,                           -- Date the notice was sent
-    email_sent TINYTEXT NOT NULL,                          -- email used
-    PRIMARY KEY (id)
-);
-
-----
-
--- Notification Queue
-CREATE TABLE {prefix}notification_queue (
-    id INT NOT NULL AUTO_INCREMENT,
-    notification_type INT NOT NULL,                        -- ref to notification type
-    account INT NOT NULL,                                  -- ref to account
-    queued_time DATETIME NOT NULL,                         -- Creation time
-    processed_time DATETIME NULL,                          -- The time this queue was processed. (sent out)
-    PRIMARY KEY (id),
-    INDEX (notification_type),
-    INDEX (account),
-    INDEX (queued_time),
-    INDEX (processed_time)
-);
-
-----
-
--- Gateway Settings
-CREATE TABLE {prefix}gateway_settings (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TEXT NOT NULL,
-    login_id TINYTEXT NOT NULL,
-    transaction_key TINYTEXT NOT NULL,
-    PRIMARY KEY (id)
-);
-
-----
-
--- Invoice Payments
-CREATE TABLE {prefix}invoice_payments (
-    id INT NOT NULL AUTO_INCREMENT,
-    invoice INT NOT NULL,                                  -- reference to invoice id
-    payment INT NOT NULL,                                  -- reference to payment id
-    amount DECIMAL(8, 2) NOT NULL,                         -- payment amount
-    PRIMARY KEY (id),
-    INDEX(invoice)
-);
-
-----
-
--- Settings
-CREATE TABLE {prefix}settings (
-    id INT NOT NULL AUTO_INCREMENT,
-    company_logo TINYTEXT NULL,                            -- Image logo
-    company_logo_height INT NULL,                          -- Logo Height (only used if creating pdf)
-    company_name TINYTEXT NULL,                            -- Company Name
-    company_name2 TINYTEXT NULL,                           -- Company Name 2
-    company_addr1 TINYTEXT NULL,                           -- Company Address 1
-    company_addr2 TINYTEXT NULL,                           -- Company Address 2
-    company_city TINYTEXT NULL,                            -- Company City
-    company_state TINYTEXT NULL,                           -- Company State
-    company_zip TINYTEXT NULL,                             -- Company Zip
-    company_phone TINYTEXT NULL,                           -- Company Phone
-    company_email TINYTEXT NULL,                           -- Company Email
-    company_url TINYTEXT NULL,                             -- Company URL
-    payment_terms TEXT NULL,                               -- Payment Terms
-    days_before_renewal INT NULL,                          -- Number of days before renewal date to allow renewals
-    days_after_expired INT NULL,                           -- Number of days after renewal date expired
-    allow_membership_choice BOOLEAN DEFAULT '0',           -- If memberships can choose their membership levels when they renew
-    allow_employees BOOLEAN DEFAULT '0',                   -- If memberships have employees
-    member_types_enabled BOOLEAN DEFAULT '1',              -- member types determine invoice types
-    quickbooks_enabled BOOLEAN DEFAULT '0',                -- QuickBooks enabled
-    member_billing_enabled BOOLEAN DEFAULT '1',            -- Member have access to billing info tab
-    PRIMARY KEY (id)
-);
-
-----
-
--- Set default billing Settings entry
-INSERT INTO {prefix}settings
-    ( id, days_before_renewal ,days_after_expired, member_types_enabled, quickbooks_enabled, member_billing_enabled )
-    VALUES
-    ( 1, 90, 30, true, false, true );
-
-----
-
--- Management
-CREATE TABLE {prefix}management (
-    id INT NOT NULL AUTO_INCREMENT,
-    payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
-    proc_methods SMALLINT NULL,                                 -- Credit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
-    cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
-    -- Authorize.net Credentials
-    authorize_net_login TINYTEXT NULL,
-    authorize_net_key TINYTEXT NULL,
-    authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
-    authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
-    authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
-    -- Merchant Solutions Credentials
-    merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
-    merchant_solutions_merchantpin TINYTEXT NULL,
-    merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
-    merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
-    merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
-    PRIMARY KEY (id)
-);
-
-----
-
--- Set default billing Management entry
-INSERT INTO {prefix}management
-    ( id )
-    VALUES
-    ( 1 );
-
-----
-
--- Employees table
-CREATE TABLE {prefix}employees (
-    id INT NOT NULL AUTO_INCREMENT,
-    account INT NOT NULL,                                     -- Account Id
-    employee INT NOT NULL,                                     -- Employee Account Id
-    PRIMARY KEY (id)
-);
diff --git a/setup/databaseScripts/create_database_V0.0.28.sql b/setup/databaseScripts/create_database_V0.0.28.sql
new file mode 100644 (file)
index 0000000..b46f1af
--- /dev/null
@@ -0,0 +1,305 @@
+-- Gaslight Media Billing Module
+-- File Created: 11/19/2018
+-- Database Version: 0.0.27
+-- Database Creation Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+-- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
+--
+
+-- Billing Accounts
+CREATE TABLE {prefix}accounts (
+    id INT NOT NULL AUTO_INCREMENT,
+    archived BOOLEAN DEFAULT '0',                          -- Marks account as archived
+    ref_dest INT NOT NULL,                                 -- reference to member id
+    ref_name TINYTEXT NOT NULL,                            -- Name of reference member
+    invoice_type INT NOT NULL DEFAULT '0',                 -- Ref to Invoice Type id
+    billing_fname TINYTEXT NULL,                           -- Billing First Name
+    billing_lname TINYTEXT NULL,                           -- Billing Last Name
+    billing_company TINYTEXT NULL,                         -- Billing Company Name
+    billing_position TINYTEXT NULL,                        -- Billing Title/Position
+    billing_addr1 TINYTEXT NULL,                           -- Billing Address 1
+    billing_addr2 TINYTEXT NULL,                           -- Billing Address 2
+    billing_city TINYTEXT NULL,                            -- Billing City
+    billing_state TINYTEXT NULL,                           -- Billing State
+    billing_zip TINYTEXT NULL,                             -- Billing Zip
+    billing_country TINYTEXT NULL,                         -- Billing Country
+    billing_phone TINYTEXT NULL,                           -- Billing Phone
+    billing_fax TINYTEXT NULL,                             -- Billing Fax
+    anniversary_date DATE NULL,                            -- anniversary date
+    renewal_date DATE NULL,                                -- renewal date of account
+    payment_data TEXT NULL,                                -- stored payment data
+    customer_profile_id TINYTEXT NULL,                     -- Customer Profile Id (Authorize.net)
+    payment_profile_id TINYTEXT NULL,                      -- Payment Profile Id (Authorize.net)
+    payment_profile_card TINYTEXT NULL,                    -- Payment Profile Card (Authorize.net)
+    email TINYTEXT NULL,                                   -- billing email
+    boss BOOLEAN DEFAULT '0',                              -- Boss flag
+    account_number TINYTEXT NULL,                          -- Account Number
+    email_invoice BOOLEAN DEFAULT '0',                     -- Invoice by email
+    usmail_invoice BOOLEAN DEFAULT '0',                    -- Invoice by US Mail
+    fax_invoice BOOLEAN DEFAULT '0',                       -- Invoice by Fax
+    PRIMARY KEY (id),
+    INDEX(ref_dest),
+    INDEX(ref_name(20)),
+    INDEX(email(20)),
+    INDEX(invoice_type),
+    INDEX(renewal_date)
+);
+
+----
+
+-- transactions
+CREATE TABLE {prefix}transactions (
+    id INT NOT NULL AUTO_INCREMENT,
+    type INT NOT NULL,                                     -- type of transaction (payment,invoice,etc)
+    type_id INT NOT NULL,                                  -- reference to type id
+    account INT NOT NULL,                                  -- reference to account id
+    transaction_time DATETIME NOT NULL,                    -- datetime for the transaction
+    current_invoice_total DECIMAL(8, 2) NOT NULL,          -- invoice total
+    current_payment_total DECIMAL(8, 2) NOT NULL,          -- payment total
+    PRIMARY KEY (id),
+    INDEX(account),
+    INDEX(type_id),
+    INDEX(transaction_time)
+);
+
+----
+
+-- Invoices
+CREATE TABLE {prefix}invoices (
+    id INT NOT NULL AUTO_INCREMENT,
+    transaction_time DATETIME NOT NULL,                    -- datetime for the invoice
+    account INT NOT NULL,                                  -- ref to account id
+    amount_total DECIMAL(8, 2) NOT NULL,                   -- total amount for invoice
+    balance DECIMAL(8, 2) NOT NULL,                        -- balance for this invoice
+    due_date DATE NOT NULL,                                -- Due date for this invoice
+    paid BOOLEAN DEFAULT '0',                              -- true/false if invoice is paid
+    notes TINYTEXT,                                        -- notes for this invoice
+    renewal BOOLEAN DEFAULT '0',                           -- true/false if a renewal
+    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
+    recurrence INT NULL DEFAULT 0,                         -- recurrence type
+    PRIMARY KEY (id),
+    INDEX(account),
+    INDEX(transaction_time),
+    INDEX(due_date)
+);
+
+----
+
+-- Line Item Types
+CREATE TABLE {prefix}invoice_types (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TINYTEXT NOT NULL,                                -- name
+    parent INT NOT NULL DEFAULT 0,                         -- 0 if top level otherwise ref to another line_item_type as it's parent
+    member_type INT NOT NULL DEFAULT 0,                    -- Member Type assigned Default 0
+    amount DECIMAL(8,2) NOT NULL DEFAULT '0.00',           -- amount
+    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
+    recurrence INT NULL DEFAULT 0,                         -- recurrence type
+    dynamic_amount BOOLEAN DEFAULT '0',                    -- true/false if amount is dynamic
+    qcode TINYTEXT NULL,                                   -- qcode for quickbooks
+    category TINYTEXT NULL,                                -- quickbooks category
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Line Items
+CREATE TABLE {prefix}line_items (
+    id INT NOT NULL AUTO_INCREMENT,
+    invoice INT NOT NULL,                                  -- reference to invoice
+    line_item_type INT NOT NULL,                           -- reference to line item type
+    account INT NULL DEFAULT 0,                            -- ref to account id (renewal or employee)
+    name TEXT NOT NULL,                                    -- line item name
+    amount DECIMAL(8,2) DEFAULT '0.00',                    -- line item amount per item
+    quantity INT DEFAULT 1,                                -- quantity
+    total DECIMAL(8,2) DEFAULT '0.00',                     -- line item total
+    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
+    recurrence INT NULL DEFAULT 0,                         -- recurrence type
+    created DATE NULL,                                     -- Date this line item was first created
+    first_due_date DATE NULL,                              -- The first due date for this item
+    next_due_date DATE NULL,                               -- Next Due Date for this item
+    PRIMARY KEY (id),
+    INDEX(account),
+    INDEX(created),
+    INDEX(first_due_date),
+    INDEX(next_due_date)
+);
+
+----
+
+-- payments
+CREATE TABLE {prefix}payments (
+    id INT NOT NULL AUTO_INCREMENT,
+    transaction_time DATETIME NOT NULL,                    -- datetime of payment
+    account INT NOT NULL,                                  -- ref to account table
+    amount DECIMAL(8, 2) NOT NULL,                         -- payment amount
+    payment_method TINYTEXT NOT NULL,                      -- payment method
+    payment_data TINYTEXT NULL,                            -- additional payment info
+    PRIMARY KEY (id)
+);
+
+----
+
+-- pdfs
+CREATE TABLE {prefix}pdfs (
+    id INT NOT NULL AUTO_INCREMENT,
+    ref_type INT NOT NULL,                                 -- reference type
+    ref_dest INT NOT NULL,                                 -- reference types id
+    pdf MEDIUMTEXT NOT NULL,                               -- saved pdf
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Notification Types
+CREATE TABLE {prefix}notification_types (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TINYTEXT NOT NULL,                                -- name
+    to_email TINYTEXT NULL,                                -- To email
+    from_header TINYTEXT NOT NULL,                         -- from headers
+    replyto TINYTEXT NULL,                                 -- reply-to headers
+    subject TINYTEXT NOT NULL,                             -- Subject
+    message TEXT NOT NULL,                                 -- Message
+    send_by_date BOOLEAN NULL DEFAULT '0',                 -- true/false send by date based on due date
+    send_by_action BOOLEAN NULL DEFAULT '0',               -- send notice based on an action
+    send_action INT NULL DEFAULT 0,                        -- (create invoice or receive payment)
+    send_date_number INT NULL DEFAULT 0,                   -- number to apply to send by date
+    send_date_period INT NULL DEFAULT 0,                   -- (days,weeks,months,years)
+    send_date_when INT NULL DEFAULT 0,                     -- (before or after)
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Notifications
+CREATE TABLE {prefix}notifications (
+    id INT NOT NULL AUTO_INCREMENT,
+    notification_type INT NOT NULL,                        -- ref to notification type
+    account INT NOT NULL,                                  -- ref to account
+    from_replyto TINYTEXT NOT NULL,                        -- from reply-to header
+    subject TEXT NOT NULL,                                 -- subject
+    message TEXT NOT NULL,                                 -- message
+    date_sent DATETIME NOT NULL,                           -- Date the notice was sent
+    email_sent TINYTEXT NOT NULL,                          -- email used
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Notification Queue
+CREATE TABLE {prefix}notification_queue (
+    id INT NOT NULL AUTO_INCREMENT,
+    notification_type INT NOT NULL,                        -- ref to notification type
+    account INT NOT NULL,                                  -- ref to account
+    queued_time DATETIME NOT NULL,                         -- Creation time
+    processed_time DATETIME NULL,                          -- The time this queue was processed. (sent out)
+    PRIMARY KEY (id),
+    INDEX (notification_type),
+    INDEX (account),
+    INDEX (queued_time),
+    INDEX (processed_time)
+);
+
+----
+
+-- Gateway Settings
+CREATE TABLE {prefix}gateway_settings (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TEXT NOT NULL,
+    login_id TINYTEXT NOT NULL,
+    transaction_key TINYTEXT NOT NULL,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Invoice Payments
+CREATE TABLE {prefix}invoice_payments (
+    id INT NOT NULL AUTO_INCREMENT,
+    invoice INT NOT NULL,                                  -- reference to invoice id
+    payment INT NOT NULL,                                  -- reference to payment id
+    amount DECIMAL(8, 2) NOT NULL,                         -- payment amount
+    PRIMARY KEY (id),
+    INDEX(invoice)
+);
+
+----
+
+-- Settings
+CREATE TABLE {prefix}settings (
+    id INT NOT NULL AUTO_INCREMENT,
+    company_logo TINYTEXT NULL,                            -- Image logo
+    company_logo_height INT NULL,                          -- Logo Height (only used if creating pdf)
+    company_name TINYTEXT NULL,                            -- Company Name
+    company_name2 TINYTEXT NULL,                           -- Company Name 2
+    company_addr1 TINYTEXT NULL,                           -- Company Address 1
+    company_addr2 TINYTEXT NULL,                           -- Company Address 2
+    company_city TINYTEXT NULL,                            -- Company City
+    company_state TINYTEXT NULL,                           -- Company State
+    company_zip TINYTEXT NULL,                             -- Company Zip
+    company_phone TINYTEXT NULL,                           -- Company Phone
+    company_email TINYTEXT NULL,                           -- Company Email
+    company_url TINYTEXT NULL,                             -- Company URL
+    payment_terms TEXT NULL,                               -- Payment Terms
+    days_before_renewal INT NULL,                          -- Number of days before renewal date to allow renewals
+    days_after_expired INT NULL,                           -- Number of days after renewal date expired
+    allow_membership_choice BOOLEAN DEFAULT '0',           -- If memberships can choose their membership levels when they renew
+    allow_employees BOOLEAN DEFAULT '0',                   -- If memberships have employees
+    member_types_enabled BOOLEAN DEFAULT '1',              -- member types determine invoice types
+    quickbooks_enabled BOOLEAN DEFAULT '0',                -- QuickBooks enabled
+    member_billing_enabled BOOLEAN DEFAULT '1',            -- Member have access to billing info tab
+    billing_fields_required BOOLEAN DEFAULT '1',           -- Require Billing Fields
+    invoice_methods_enabled BOOLEAN DEFAULT '1',           -- Enable Uptra invoice methods
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Set default billing Settings entry
+INSERT INTO {prefix}settings
+    ( id, days_before_renewal ,days_after_expired, member_types_enabled, quickbooks_enabled, member_billing_enabled )
+    VALUES
+    ( 1, 90, 30, true, false, true );
+
+----
+
+-- Management
+CREATE TABLE {prefix}management (
+    id INT NOT NULL AUTO_INCREMENT,
+    payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
+    proc_methods SMALLINT NULL,                                 -- Credit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
+    cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
+    -- Authorize.net Credentials
+    authorize_net_login TINYTEXT NULL,
+    authorize_net_key TINYTEXT NULL,
+    authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
+    authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
+    authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
+    -- Merchant Solutions Credentials
+    merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
+    merchant_solutions_merchantpin TINYTEXT NULL,
+    merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
+    merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
+    merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Set default billing Management entry
+INSERT INTO {prefix}management
+    ( id )
+    VALUES
+    ( 1 );
+
+----
+
+-- Employees table
+CREATE TABLE {prefix}employees (
+    id INT NOT NULL AUTO_INCREMENT,
+    account INT NOT NULL,                                      -- Account Id
+    employee INT NOT NULL,                                     -- Employee Account Id
+    PRIMARY KEY (id)
+);
index 0ca4626..97ffdf1 100644 (file)
@@ -41,5 +41,6 @@ $glmMembersBillingDbVersions = array(
     '0.0.25' => array('version' => '0.0.25', 'tables' => 15),
     '0.0.26' => array('version' => '0.0.26', 'tables' => 15),
     '0.0.27' => array('version' => '0.0.27', 'tables' => 15, 'date' => '11/19/2018'),
+    '0.0.28' => array('version' => '0.0.28', 'tables' => 15, 'date' => '11/27/2018'),
 );
 
diff --git a/setup/databaseScripts/update_database_V0.0.28.sql b/setup/databaseScripts/update_database_V0.0.28.sql
new file mode 100644 (file)
index 0000000..8a8575a
--- /dev/null
@@ -0,0 +1,29 @@
+-- Gaslight Media Billing Database
+-- File Created: 11/19/2018
+-- Database Version: 0.0.27
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Unset not null on anniversary_date field in accounts table
+ALTER TABLE {prefix}accounts MODIFY anniversary_date date NULL;
+
+----
+
+ALTER TABLE {prefix}accounts ADD email_invoice BOOLEAN DEFAULT '0';
+
+----
+
+ALTER TABLE {prefix}accounts ADD usmail_invoice BOOLEAN DEFAULT '0';
+
+----
+
+ALTER TABLE {prefix}accounts ADD fax_invoice BOOLEAN DEFAULT '0';
+
+----
+
+ALTER TABLE {prefix}settings ADD billing_fields_required BOOLEAN DEFAULT '1';
+
+----
+
+ALTER TABLE {prefix}settings ADD invoice_methods_enabled BOOLEAN DEFAULT '1';
index 13442e3..f6619d3 100644 (file)
@@ -21,7 +21,9 @@
             <tr>
                 <th style="width:50px;">ID</th>
                 <th>Member Name</th>
-                <th>Boss/Employees</th>
+                {if $settings.allow_employees}
+                    <th>Boss/Employees</th>
+                {/if}
                 <th>Billing Email</th>
                 <th>Anniversary Date</th>
                 <th>Renewal Date</th>
                     <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> {if $t.boss.value}Yes{/if} </td>
+                        {if $settings.allow_employees}
+                            <td> {if $t.boss.value}Yes{/if} </td>
+                        {/if}
                         <td> {$t.email} </td>
                         <td> {$t.anniversary_date.date} </td>
                         <td> {$t.renewal_date.date} </td>
                     </tr>
                     <tr id="account-container-{$t.id}" class="glm-account-links glm-hidden{if $t@iteration is div by 2} alternate{/if}">
-                        <td colspan="6">
+                        <td colspan="{if $settings.allow_employees}6{else}5{/if}">
                             <span class="account-dashboard-link">
                                 <a class="account-member-dashboard" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&member={$t.ref_dest}">Member Dashboard</a> |
                             </span>
index 1e87a59..ba159b4 100644 (file)
@@ -5,27 +5,37 @@
 <h2>Bulk Create Invoices</h2>
 
 {if $paymentTypes}
-<label>Payment Types:</label>
 
-<select multiple size="10">
-    {foreach $paymentTypes as $paymentType}
-    <option value="{$paymentType.id}">{$paymentType.name}</option>
-    {/foreach}
-</select>
+    <label>Payment Types:</label>
+
+    <select multiple size="10">
+        {foreach $paymentTypes as $paymentType}
+        <option value="{$paymentType.id}">{$paymentType.name}</option>
+        {/foreach}
+    </select>
 
 {/if}
 
 {if $counties}
 
-<label>Counties:</label>
+    <label>Counties:</label>
+
+    <select multiple size="10">
+        {foreach $counties as $county}
+        <option value="{$county.id}">{$county.name}</option>
+        {/foreach}
+    </select>
 
-<select multiple size="10">
-    {foreach $counties as $county}
-    <option value="{$county.id}">{$county.name}</option>
-    {/foreach}
-</select>
 {/if}
 
 <button>Filter</button>
 
+<div id="account-list">
+
+    {foreach $accounts as $t}
+    <div>{$t.ref_name}</div>
+    {/foreach}
+
+</div>
+
 {include file='admin/footer.html'}
index a8a3032..4b106fb 100644 (file)
             </div>
         </div>
 
+        <div class="glm-billing-field">
+            <div class="glm-billing-label{if $account.fieldRequired.account_number} glm-required{/if}">Account Number</div>
+            <div class="glm-billing-input{if $account.fieldFail.account_number} glm-form-bad-input{/if}" data-tabid="glm-account_number">
+                <input type="text" name="account_number" value="{$account.fieldData.account_number}" class="glm-form-text-input-medium"{if $account.fieldRequired.account_number} required{/if}>
+            {if $account.fieldFail.account_number}<p>{$account.fieldFail.account_number}</p>{/if}<br>
+            </div>
+        </div>
+
     {if !$lockedToMember}
 
 
 
         {/if}
 
+        {if !$settings.member_types_enabled}
+
+            <div class="">
+                <div class="glm-billing-label">Invoice Delivery Methods</div>
+                <div class="glm-billing-input" data-tabid="glm-invoice-method">
+                    <label for="email_invoice"><input id="email_invoice" type="checkbox" name="email_invoice" {if $account.fieldData.email_invoice.value}checked{/if} /> By Email</label>
+                    <label for="usmail_invoice"><input id="usmail_invoice" type="checkbox" name="usmail_invoice" {if $account.fieldData.usmail_invoice.value}checked{/if} /> By US mail</label>
+                    <label for="fax_invoice"><input id="fax_invoice" type="checkbox" name="fax_invoice" {if $account.fieldData.fax_invoice.value}checked{/if} /> By Fax</label>
+                </div>
+            </div>
+
+        {/if}
+
 
         <div class="glm-billing-field glm-billing-left-half">
             <div class="glm-billing-label{if $account.fieldRequired.anniversary_date} glm-required{/if}">Anniversary Date</div>
index d0deba1..f64d0f9 100644 (file)
@@ -9,7 +9,7 @@
             <td colspan="2">
                 {if $settingsUpdated}<h2 class="glm-notice glm-flash-updated glm-right">Settings Updated</h2>{/if}
                 {if $settingsUpdateError}<span class="glm-error glm-flash-updated glm-right">Settings Update Error</span>{/if}
-                <h2>Billing Invoice Settings</h2>
+                <h2>Billing Settings</h2>
             </td>
         </tr>
         <tr>
                     <input type="hidden" name="option2" value="submit">
                     <table class="glm-admin-table">
 
-                        <tr>
-                            <th style="text-align: right;" {if $billingSettings.fieldRequired.allow_membership_choice} class="glm-required"}{/if}>
-                                Allow Membership Choice When renewing
-                            </th>
-                            <td>
-                                <input type="checkbox" name="allow_membership_choice"{if $billingSettings.fieldData.allow_membership_choice.value} checked="checked"{/if}>
-                            </td>
-                        </tr>
-
-                        <tr>
-                            <th style="text-align: right;" {if $billingSettings.fieldRequired.allow_employees} class="glm-required"}{/if}>
-                                Allow Employees
-                            </th>
-                            <td>
-                                <input type="checkbox" name="allow_employees"{if $billingSettings.fieldData.allow_employees.value} checked="checked"{/if}>
-                            </td>
-                        </tr>
-
-                        <tr>
-                            <th style="text-align: right;" {if $billingSettings.fieldRequired.member_types_enabled} class="glm-required"}{/if}>
-                                Use member types in Invoice Types
-                            </th>
-                            <td>
-                                <input type="checkbox" name="member_types_enabled"{if $billingSettings.fieldData.member_types_enabled.value} checked="checked"{/if}>
-                            </td>
-                        </tr>
-
-                        <tr>
-                            <th style="text-align: right;" {if $billingSettings.fieldRequired.quickbooks_enabled} class="glm-required"}{/if}>
-                                Enable Quickbooks
-                            </th>
-                            <td>
-                                <input type="checkbox" name="quickbooks_enabled"{if $billingSettings.fieldData.quickbooks_enabled.value} checked="checked"{/if}>
-                            </td>
-                        </tr>
 
                         <tr>
-                            <th style="text-align: right;" {if $billingSettings.fieldRequired.member_billing_enabled} class="glm-required"}{/if}>
-                                Enable Members billing tab (for members)
-                            </th>
-                            <td>
-                                <input type="checkbox" name="member_billing_enabled"{if $billingSettings.fieldData.member_billing_enabled.value} checked="checked"{/if}>
-                            </td>
-                        </tr>
-
-                        <tr>
-                            <th style="text-align: right;" {if $billingSettings.fieldRequired.days_before_renewal} class="glm-required"}{/if}>
-                                Days Before Renewal Date<br>
-                                to Allow Membership Renewal<br>
-                                Must be a number
-                            </th>
-                            <td {if $billingSettings.fieldFail.days_before_renewal}class="glm-form-bad-input" data-tabid="glm-company-name2"{/if}>
-                                <input
-                                    type="text"
-                                    name="days_before_renewal"
-                                    value="{$billingSettings.fieldData.days_before_renewal}"
-                                    class="glm-form-text-input-short"
-                                    pattern="([0-9])*"
-                                    />
-                            {if $billingSettings.fieldFail.days_before_renewal}<p>{$billingSettings.fieldFail.days_before_renewal}</p>{/if}<br>
-                            </td>
-                        </tr>
-
-                        <tr>
-                            <th style="text-align: right;" {if $billingSettings.fieldRequired.days_after_expired} class="glm-required"}{/if}>
-                                Days After Renewal Date<br>
-                                Membership Expires<br>
-                                Must be a number
-                            </th>
-                            <td {if $billingSettings.fieldFail.days_after_expired}class="glm-form-bad-input" data-tabid="glm-company-name2"{/if}>
-                                <input
-                                    type="text"
-                                    name="days_after_expired"
-                                    value="{$billingSettings.fieldData.days_after_expired}"
-                                    class="glm-form-text-input-short"
-                                    pattern="([0-9])*"
-                                    />
-                            {if $billingSettings.fieldFail.days_after_expired}<p>{$billingSettings.fieldFail.days_after_expired}</p>{/if}<br>
-                            </td>
+                            <th colspan="2">Invoice Settings</th>
                         </tr>
 
                         <tr>
                             </td>
                         </tr>
 
+                        <tr>
+                            <th colspan="2">Billing Options</th>
+                        </tr>
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.allow_membership_choice} class="glm-required"}{/if}>
+                                Allow Membership Choice When renewing
+                            </th>
+                            <td>
+                                <input type="checkbox" name="allow_membership_choice"{if $billingSettings.fieldData.allow_membership_choice.value} checked="checked"{/if}>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.allow_employees} class="glm-required"}{/if}>
+                                Allow Employees
+                            </th>
+                            <td>
+                                <input type="checkbox" name="allow_employees"{if $billingSettings.fieldData.allow_employees.value} checked="checked"{/if}>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.member_types_enabled} class="glm-required"}{/if}>
+                                Use member types in Invoice Types
+                            </th>
+                            <td>
+                                <input type="checkbox" name="member_types_enabled"{if $billingSettings.fieldData.member_types_enabled.value} checked="checked"{/if}>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.quickbooks_enabled} class="glm-required"}{/if}>
+                                Enable Quickbooks
+                            </th>
+                            <td>
+                                <input type="checkbox" name="quickbooks_enabled"{if $billingSettings.fieldData.quickbooks_enabled.value} checked="checked"{/if}>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.member_billing_enabled} class="glm-required"}{/if}>
+                                Enable Members billing tab (for members)
+                            </th>
+                            <td>
+                                <input type="checkbox" name="member_billing_enabled"{if $billingSettings.fieldData.member_billing_enabled.value} checked="checked"{/if}>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.billing_fields_required} class="glm-required"}{/if}>
+                                Require Billing Fields
+                            </th>
+                            <td>
+                                <input type="checkbox" name="billing_fields_required"{if $billingSettings.fieldData.billing_fields_required.value} checked="checked"{/if}>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.invoice_methods_enabled} class="glm-required"}{/if}>
+                                Enable Invoice Methods
+                            </th>
+                            <td>
+                                <input type="checkbox" name="invoice_methods_enabled"{if $billingSettings.fieldData.invoice_methods_enabled.value} checked="checked"{/if}>
+                            </td>
+                        </tr>
+
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.days_before_renewal} class="glm-required"}{/if}>
+                                Days Before Renewal Date<br>
+                                to Allow Membership Renewal<br>
+                                Must be a number
+                            </th>
+                            <td {if $billingSettings.fieldFail.days_before_renewal}class="glm-form-bad-input" data-tabid="glm-company-name2"{/if}>
+                                <input
+                                    type="text"
+                                    name="days_before_renewal"
+                                    value="{$billingSettings.fieldData.days_before_renewal}"
+                                    class="glm-form-text-input-short"
+                                    pattern="([0-9])*"
+                                    />
+                            {if $billingSettings.fieldFail.days_before_renewal}<p>{$billingSettings.fieldFail.days_before_renewal}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th style="text-align: right;" {if $billingSettings.fieldRequired.days_after_expired} class="glm-required"}{/if}>
+                                Days After Renewal Date<br>
+                                Membership Expires<br>
+                                Must be a number
+                            </th>
+                            <td {if $billingSettings.fieldFail.days_after_expired}class="glm-form-bad-input" data-tabid="glm-company-name2"{/if}>
+                                <input
+                                    type="text"
+                                    name="days_after_expired"
+                                    value="{$billingSettings.fieldData.days_after_expired}"
+                                    class="glm-form-text-input-short"
+                                    pattern="([0-9])*"
+                                    />
+                            {if $billingSettings.fieldFail.days_after_expired}<p>{$billingSettings.fieldFail.days_after_expired}</p>{/if}<br>
+                            </td>
+                        </tr>
 
                     </table>
                     <input type="submit" value="Update Settings" class="button-primary">