$invoice = $this->getInvoiceById( $invoice_id );
$balance = (float)$invoice['balance'];
if ( $payment == $invoice['balance'] ) {
+ $payment -= $invoice['balance'];
// Mark this as paid then
$this->updateInvoiceBalance( $invoice['id'], (float)0.00 );
// Record the payment to the invoice_payments table
} else if ( $payment > $invoice['balance'] ) {
$this->updateInvoiceBalance( $invoice['id'], (float)0.00 );
$payment -= $invoice['balance'];
+ // Record the payment to the invoice_payments table
+ $this->recordInvoicePayment( $invoice['id'], $payment_id, $invoice['balance'] );
} else if ( $invoice['balance'] > $payment ) {
// Update the balance of the invoice
$balance = (float)$balance - (float)$payment;
);
foreach ( $line_items as &$item ) {
$index = (int)$item['recurrence'];
- if ( $item.recurring && $this->config['recurrence'][$index] ) {
+ if ( $item['recurring'] && $this->config['recurrence'][$index] ) {
$item['recurrence_string'] = $this->config['recurrence'][$index];
}
}
);
// Merge any data passed into this method
$account_data['data'] = $data;
+
$notification_message = $this->parseSmartyTemplateString(
$account_data,
wpautop( $notification_type['message'] )
$smarty->templateAssign( 'title', $notification_type['subject'] );
$smarty->templateAssign( 'html_content', $notification_message );
+ // Setup the invoice html
+ $invoice_html = '';
+ if ( isset( $data['type'] ) && $data['type'] == $this->config['transaction_numb']['Invoice'] ) {
+ $invoice_html = $BillingSupport->viewInvoice( $data['type_id'] );
+ }
+
+ $smarty->templateAssign( 'invoice_html', $invoice_html );
+
// Generate output from model data and view
$htmlMessage = $smarty->template->fetch( $viewFile );
$overDueWhere = 'T.paid <> true AND T.due_date < now()';
$start = 1;
$overdue = $this->getList( $overDueWhere, 'transaction_time', true, 'id', $start, $limit );
- $numberOverdue = $overdue['returned'];
+ if ( isset( $overdue['returned'] ) ) {
+ $numberOverdue = $overdue['returned'];
+ }
break;
}
$haveAccount = false;
}
} else {
+ $account = $Accounts->editEntry( $accountID );
$haveAccount = true;
- // echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
}
- // echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
$view = 'editAccount';
break;
case 'view':
'filter' => FILTER_SANITIZE_NUMBER_FLOAT,
'flags' => FILTER_FLAG_ALLOW_FRACTION,
),
+ 'billing_fname' => FILTER_SANITIZE_STRING,
+ 'billing_lname' => FILTER_SANITIZE_STRING,
'billing_addr1' => FILTER_SANITIZE_STRING,
'billing_addr2' => FILTER_SANITIZE_STRING,
'billing_city' => FILTER_SANITIZE_STRING,
'billing_state' => FILTER_SANITIZE_STRING,
'billing_zip' => FILTER_SANITIZE_STRING,
'billing_phone' => FILTER_SANITIZE_STRING,
+ 'email' => FILTER_SANITIZE_STRING,
)
);
'city' => $paymentData['billing_city'],
'state' => $paymentData['billing_state'],
'zip' => $paymentData['billing_zip'],
- 'phone' => $paymentData['bill_phone'],
+ 'phone' => $paymentData['billing_phone'],
'email' => $paymentData['email']
);
$cardMatch = $this->config['credit_card_match'];
<body>
<h1 id="title"> {$title} </h1>
{$html_content}
+ {$invoice_html}
</body>
</html>