3801f63c by Kevin Burton

updates USerManager

1 parent 9cebfa08
......@@ -454,3 +454,21 @@ input.dp-applied {
.attendance-admin-table tbody td { border-bottom: 1px solid #e8e8e8; padding:4px 0; }
#invoice-table { width: 100%; border:0; padding: 0px; margin: 0px; border-collapse: collapse; border:1px solid #ccc; margin: 8px 0px 4px 0px; }
#invoice-table thead th { margin:0; padding:5px 2px 5px 10px; text-align: left; border-bottom:1px solid #ccc; border-right:1px solid #ccc; }
#invoice-table thead td { margin:0; padding:4px 2px 4px 10px; text-align: left; }
#invoice-table tbody th { margin:0; padding:4px 2px 4px 10px; text-align: left; }
#invoice-table tbody td { margin:0; padding:4px 2px 4px 10px; text-align: left; border-right:1px solid #ccc; }
#invoice-table tbody tr.odd td { background-color: #f5f5f5; }
#invoice-table tfoot td { margin:0; padding:4px 2px 4px 10px; text-align: left; border-top:1px solid #ccc;border-right:1px solid #ccc; }
#invoice-table caption { text-align:left; font-size:11px; color:#777; padding-left:11px; text-transform: uppercase; }
.status-paid {
width:97px;
height:87px;
position:absolute;
bottom:60px;
right:350px;
background: transparent url(../images/paid.png) top left no-repeat;
}
......
......@@ -568,7 +568,7 @@ class Vars {
, 'OH' => 'Ohio'
, 'OK' => 'Oklahoma'
, 'OR' => 'Oregon'
, 'PA' => 'Pennyslvania'
, 'PA' => 'Pennsylvania'
, 'PR' => 'Puerto Rico'
, 'RI' => 'Rhode Island'
, 'SC' => 'South Carolina'
......
......@@ -4,6 +4,7 @@ namespace Tz\WordPress\Tools\UserManager;
use Tz, Tz\Common;
use Tz\WordPress\CBV;
use Tz\WordPress\CBV\CEHours;
use Tz\WordPress\CBV\Invoice;
use Tz\WordPress\CBV\Events;
use Tz\WordPress\UAM;
......@@ -14,7 +15,130 @@ use Exception, StdClass;
use WP_User;
?>
<div style="padding:10px 10px 0px 10px; min-width:760px;">
<h2 style="margin-bottom:10px;padding-bottom:0px;">Users' Invoices and Receipts...</h2>
<em>Will be implemented when Beanstream Integration is complete.</em>
<h2 style="margin-bottom:10px;padding-bottom:0px;">Users' Invoices...</h2>
<?php
if ( isset($_GET['view']) ) {
$invoice = get_post($_GET['view']);
$invoice->items = get_post_meta($invoice->ID, 'items',true);
$invoice->payment = get_post_meta($invoice->ID, 'payment',true);
$date = strtotime($invoice->post_date);
$date = date("F j Y",$date);
if ( ($invoice->post_author !== Tools\getCurrentUser()->ID) AND !is_admin()) {
print "<div style='color:#DF1C24;font-weight:bold;'>YOU CAN ONLY VIEW YOUR OWN INVOICES.</div>";
} else {
$html = '<p><a href="/wp-admin/admin.php?page=cbv_users&action=edit&uid='.$_GET['uid'].'&section=payhistory">Show all invoices</a></p>';
$html .= '<div style="text-align:right;margin-bottom:5px;"><a href="/invoices/?view='.$invoice->ID.'&pagename=invoice-preview" class="label label-black-print print-invoice-handler" target="_blank"></a></div>';
$html .= '<div style="border:1px solid #777;padding:20px;position:relative;" id="viewable-port">';
$status = get_post_meta($invoice->ID,'trans_status',true);
if ($status=="paid") {
$html .= '<div class="status-paid"></div>';
}
$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>';
$html .= '<p>';
$html .= '<table cellpadding="0" cellspacing="0" border="0" id="invoice-table">';
$html .= '<thead>';
$html .= '<tr>';
$html .= '<th>Item / Description</th>';
$html .= '<th width="80">Cost</th>';
$html .= '<th width="80">Discounts</th>';
$html .= '<th width="120">Amount</th>';
$html .= '</tr>';
$html .= '</thead>';
$html .= '<tbody>';
$i = 9;
foreach($invoice->items as $item) {
$row_class = ($i%2) ? "odd" : "";
if ( $item['post_id'] > 0 ) {
$post = get_post($item['post_id']);
$description = $post->post_title;
} else {
$description = $item['description'];
}
$html .= '<tr class="'.$row_class.'">';
$html .= '<td>'.$description.'</td>';
$html .= '<td>$'.$item['cost'].'</td>';
if (empty($item['discount_amount'])) {
$html .= '<td>$0.00</td>';
} else {
$html .= '<td>-$'.$item['discount_amount'].'</td>';
}
$html .= '<td>$'.$item['subtotal'].'</td>';
$html .= '</tr>';
$i++;
}
$html .= '</tbody>';
$html .= '</table>';
$html .= '<table cellpadding="0" cellspacing="0" border="0" class="clean" id="invoice-table">';
$html .= '<tfoot>';
$html .= '<tr>';
$html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Total Cost</td>';
$html .= '<td width="120">$'.number_format($invoice->payment['total_cost'],2).'</td>';
$html .= '</tr>';
if ($invoice->payment['total_discounts'] > 0) {
$html .= '<tr>';
$html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Total Discounts</td>';
$html .= '<td>$'.number_format($invoice->payment['total_discounts'],2).'</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Sub Total</td>';
$html .= '<td>$'.number_format($invoice->payment['subtotal'],2).'</td>';
$html .= '</tr>';
}
$html .= '<tr>';
$html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Taxes</td>';
$html .= '<td>$'.number_format($invoice->payment['total_taxes'],2).'</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Total</td>';
$html .= '<td><strong>$'.number_format($invoice->payment['total'],2).'</strong></td>';
$html .= '</tr>';
$html .= '</tfoot>';
$html .= '</table>';
$html .= '</p>';
$html .= '<h3>BILLED TO:</h3>';
$html .= $invoice->payment['bt_card_holder']."<br />";
$html .= $invoice->payment['bt_address']." ".$invoice->payment['bt_address2'] . "<br />";
$html .= $invoice->payment['bt_city'].", " .$invoice->payment['bt_province']."<br />";
$html .= $invoice->payment['bt_country']."&nbsp;&nbsp;".$invoice->payment['bt_postal']."<br /><br />";
$html .= "<strong>".ucwords($invoice->payment['bt_card_type'])."</strong>&nbsp;&nbsp;" . $invoice->payment['bt_card_number'];
$html .= '</div>';
$html .= '<div style="text-align:right;margin-top:5px;"><a href="/invoices/?view='.$_GET['view'].'&pagename=invoice-preview" class="label label-black-print print-invoice-handler" target="_blank"></a></div>';
print $html;
}
} else {
Invoice\showMyInvoices($_GET['uid'], "/wp-admin/admin.php?page=cbv_users&action=edit&uid=".$_GET['uid']."&section=payhistory&view=");
}
?>
</div>
<script src="<?php echo Tools\url('../UserManager.js', __FILE__);?>" type="text/javascript"></script>
\ No newline at end of file
......