cab1aff6 by Marty Penner

Moved 'bill to' to just below CBV header

1 parent f8ac0f12
......@@ -102,6 +102,28 @@ use WP_User;
Toronto, ON, Canada M5V 3H2
</p>';
if ($status == 'unpaid') {
// Get the user's profile preference
$preference = strtolower($user->profile_preference);
// Build the 'Bill To:' info array
$user_fields = array('address', 'address2', 'city', 'province', 'country', 'postal');
$bill_to = array();
foreach ($user_fields as $field) {
// Use the preference to get the user's address info
$bill_to[$field] = get_user_meta($user->ID, "{$preference}_{$field}", TRUE);
}
// Finish it off with first and last name
$bill_to['first_name'] = get_user_meta($user->ID, 'first_name', TRUE);
$bill_to['last_name'] = get_user_meta($user->ID, 'last_name', TRUE);
// Now build the html
$html .= '<p><br /><h3>BILL TO:</h3>';
$html .= "{$bill_to['first_name']} {$bill_to['last_name']}<br />";
$html .= "{$bill_to['address']}, {$bill_to['address2']}<br />";
$html .= "{$bill_to['city']}, {$bill_to['province']}, {$bill_to['country']} {$bill_to['postal']}</p>";
}
$html .= '<h3 style="margin:0;padding:0;text-align:right;">Invoice No.: '.$invoice->ID.'</h3>';
$html .= '<p style="text-align:right;margin-top:0;padding-top:0;"><strong>Invoice Date:</strong> '.$date.'</p>';
$html .= '<h2>'.$invoice->post_title.'</h2>';
......@@ -247,35 +269,12 @@ use WP_User;
//}
$html .= '</p>';
if ($status == 'unpaid') {
// Get the user's profile preference
$preference = strtolower($user->profile_preference);
// Build the 'Bill To:' info array
$user_fields = array('address', 'address2', 'city', 'province', 'country', 'postal');
$bill_to = array();
foreach ($user_fields as $field) {
// Use the preference to get the user's address info
$bill_to[$field] = get_user_meta($user->ID, "{$preference}_{$field}", TRUE);
}
// Finish it off with first and last name
$bill_to['first_name'] = get_user_meta($user->ID, 'first_name', TRUE);
$bill_to['last_name'] = get_user_meta($user->ID, 'last_name', TRUE);
// Now build the html
$html .= '<h3>BILL TO:</h3>';
$html .= "{$bill_to['first_name']} {$bill_to['last_name']}<br />";
$html .= "{$bill_to['address']}<br />{$bill_to['address2']}<br />";
$html .= "{$bill_to['city']}, {$bill_to['province']}<br />";
$html .= "{$bill_to['country']} {$bill_to['postal']}";
} else {
$html .= (!empty($invoice->payment['bt_card_holder'])) ? '<h3>BILLED TO:</h3>' : "";
$html .= (!empty($invoice->payment['bt_card_holder'])) ? $invoice->payment['bt_card_holder']."<br />" : "";
$html .= (!empty($invoice->payment['bt_address'])) ? $invoice->payment['bt_address']." ".$invoice->payment['bt_address2'] . "<br />" : "";
$html .= (!empty($invoice->payment['bt_city'])) ? $invoice->payment['bt_city'].", " .$invoice->payment['bt_province']."<br />" : "";
$html .= (!empty($invoice->payment['bt_country'])) ? $invoice->payment['bt_country']."&nbsp;&nbsp;".$invoice->payment['bt_postal']."<br /><br />" : "";
$html .= (!empty($invoice->payment['bt_card_type'])) ? "Paid using: <strong>".CBV\get_payment_string($invoice->payment['bt_card_type'])."</strong>&nbsp;&nbsp;" . $invoice->payment['bt_card_number'] : "";
}
//if ($status != "credit") {
$html .= '<p>GST/HST# R108075334</p>';
......