3801f63c by Kevin Burton

updates USerManager

1 parent 9cebfa08
...@@ -454,3 +454,21 @@ input.dp-applied { ...@@ -454,3 +454,21 @@ input.dp-applied {
454 .attendance-admin-table tbody td { border-bottom: 1px solid #e8e8e8; padding:4px 0; } 454 .attendance-admin-table tbody td { border-bottom: 1px solid #e8e8e8; padding:4px 0; }
455 455
456 456
457
458 #invoice-table { width: 100%; border:0; padding: 0px; margin: 0px; border-collapse: collapse; border:1px solid #ccc; margin: 8px 0px 4px 0px; }
459 #invoice-table thead th { margin:0; padding:5px 2px 5px 10px; text-align: left; border-bottom:1px solid #ccc; border-right:1px solid #ccc; }
460 #invoice-table thead td { margin:0; padding:4px 2px 4px 10px; text-align: left; }
461 #invoice-table tbody th { margin:0; padding:4px 2px 4px 10px; text-align: left; }
462 #invoice-table tbody td { margin:0; padding:4px 2px 4px 10px; text-align: left; border-right:1px solid #ccc; }
463 #invoice-table tbody tr.odd td { background-color: #f5f5f5; }
464 #invoice-table tfoot td { margin:0; padding:4px 2px 4px 10px; text-align: left; border-top:1px solid #ccc;border-right:1px solid #ccc; }
465 #invoice-table caption { text-align:left; font-size:11px; color:#777; padding-left:11px; text-transform: uppercase; }
466
467 .status-paid {
468 width:97px;
469 height:87px;
470 position:absolute;
471 bottom:60px;
472 right:350px;
473 background: transparent url(../images/paid.png) top left no-repeat;
474 }
......
...@@ -568,7 +568,7 @@ class Vars { ...@@ -568,7 +568,7 @@ class Vars {
568 , 'OH' => 'Ohio' 568 , 'OH' => 'Ohio'
569 , 'OK' => 'Oklahoma' 569 , 'OK' => 'Oklahoma'
570 , 'OR' => 'Oregon' 570 , 'OR' => 'Oregon'
571 , 'PA' => 'Pennyslvania' 571 , 'PA' => 'Pennsylvania'
572 , 'PR' => 'Puerto Rico' 572 , 'PR' => 'Puerto Rico'
573 , 'RI' => 'Rhode Island' 573 , 'RI' => 'Rhode Island'
574 , 'SC' => 'South Carolina' 574 , 'SC' => 'South Carolina'
......
...@@ -4,6 +4,7 @@ namespace Tz\WordPress\Tools\UserManager; ...@@ -4,6 +4,7 @@ namespace Tz\WordPress\Tools\UserManager;
4 use Tz, Tz\Common; 4 use Tz, Tz\Common;
5 use Tz\WordPress\CBV; 5 use Tz\WordPress\CBV;
6 use Tz\WordPress\CBV\CEHours; 6 use Tz\WordPress\CBV\CEHours;
7 use Tz\WordPress\CBV\Invoice;
7 use Tz\WordPress\CBV\Events; 8 use Tz\WordPress\CBV\Events;
8 use Tz\WordPress\UAM; 9 use Tz\WordPress\UAM;
9 10
...@@ -14,7 +15,130 @@ use Exception, StdClass; ...@@ -14,7 +15,130 @@ use Exception, StdClass;
14 use WP_User; 15 use WP_User;
15 ?> 16 ?>
16 <div style="padding:10px 10px 0px 10px; min-width:760px;"> 17 <div style="padding:10px 10px 0px 10px; min-width:760px;">
17 <h2 style="margin-bottom:10px;padding-bottom:0px;">Users' Invoices and Receipts...</h2> 18 <h2 style="margin-bottom:10px;padding-bottom:0px;">Users' Invoices...</h2>
18 <em>Will be implemented when Beanstream Integration is complete.</em> 19
20
21
22 <?php
23 if ( isset($_GET['view']) ) {
24 $invoice = get_post($_GET['view']);
25
26 $invoice->items = get_post_meta($invoice->ID, 'items',true);
27 $invoice->payment = get_post_meta($invoice->ID, 'payment',true);
28
29 $date = strtotime($invoice->post_date);
30 $date = date("F j Y",$date);
31
32 if ( ($invoice->post_author !== Tools\getCurrentUser()->ID) AND !is_admin()) {
33 print "<div style='color:#DF1C24;font-weight:bold;'>YOU CAN ONLY VIEW YOUR OWN INVOICES.</div>";
34
35 } else {
36
37 $html = '<p><a href="/wp-admin/admin.php?page=cbv_users&action=edit&uid='.$_GET['uid'].'&section=payhistory">Show all invoices</a></p>';
38
39
40 $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>';
41
42 $html .= '<div style="border:1px solid #777;padding:20px;position:relative;" id="viewable-port">';
43
44 $status = get_post_meta($invoice->ID,'trans_status',true);
45 if ($status=="paid") {
46 $html .= '<div class="status-paid"></div>';
47 }
48
49 $html .= '<h3 style="margin:0;padding:0;text-align:right;">Invoice No.: '.$invoice->ID.'</h3>';
50 $html .= '<p style="text-align:right;margin-top:0;padding-top:0;"><strong>Invoice Date:</strong> '.$date.'</p>';
51 $html .= '<h2>'.$invoice->post_title.'</h2>';
52
53 $html .= '<p>';
54 $html .= '<table cellpadding="0" cellspacing="0" border="0" id="invoice-table">';
55 $html .= '<thead>';
56 $html .= '<tr>';
57 $html .= '<th>Item / Description</th>';
58 $html .= '<th width="80">Cost</th>';
59 $html .= '<th width="80">Discounts</th>';
60 $html .= '<th width="120">Amount</th>';
61 $html .= '</tr>';
62 $html .= '</thead>';
63 $html .= '<tbody>';
64 $i = 9;
65 foreach($invoice->items as $item) {
66 $row_class = ($i%2) ? "odd" : "";
67
68 if ( $item['post_id'] > 0 ) {
69 $post = get_post($item['post_id']);
70 $description = $post->post_title;
71 } else {
72 $description = $item['description'];
73 }
74
75
76 $html .= '<tr class="'.$row_class.'">';
77 $html .= '<td>'.$description.'</td>';
78 $html .= '<td>$'.$item['cost'].'</td>';
79 if (empty($item['discount_amount'])) {
80 $html .= '<td>$0.00</td>';
81 } else {
82 $html .= '<td>-$'.$item['discount_amount'].'</td>';
83 }
84
85 $html .= '<td>$'.$item['subtotal'].'</td>';
86 $html .= '</tr>';
87 $i++;
88 }
89 $html .= '</tbody>';
90 $html .= '</table>';
91 $html .= '<table cellpadding="0" cellspacing="0" border="0" class="clean" id="invoice-table">';
92 $html .= '<tfoot>';
93 $html .= '<tr>';
94 $html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Total Cost</td>';
95 $html .= '<td width="120">$'.number_format($invoice->payment['total_cost'],2).'</td>';
96 $html .= '</tr>';
97
98
99 if ($invoice->payment['total_discounts'] > 0) {
100 $html .= '<tr>';
101 $html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Total Discounts</td>';
102 $html .= '<td>$'.number_format($invoice->payment['total_discounts'],2).'</td>';
103 $html .= '</tr>';
104 $html .= '<tr>';
105 $html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Sub Total</td>';
106 $html .= '<td>$'.number_format($invoice->payment['subtotal'],2).'</td>';
107 $html .= '</tr>';
108 }
109
110 $html .= '<tr>';
111 $html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Taxes</td>';
112 $html .= '<td>$'.number_format($invoice->payment['total_taxes'],2).'</td>';
113 $html .= '</tr>';
114 $html .= '<tr>';
115 $html .= '<td style="text-align:right;padding-right:10px;font-weight:bold;">Total</td>';
116 $html .= '<td><strong>$'.number_format($invoice->payment['total'],2).'</strong></td>';
117 $html .= '</tr>';
118 $html .= '</tfoot>';
119 $html .= '</table>';
120 $html .= '</p>';
121
122 $html .= '<h3>BILLED TO:</h3>';
123 $html .= $invoice->payment['bt_card_holder']."<br />";
124 $html .= $invoice->payment['bt_address']." ".$invoice->payment['bt_address2'] . "<br />";
125 $html .= $invoice->payment['bt_city'].", " .$invoice->payment['bt_province']."<br />";
126 $html .= $invoice->payment['bt_country']."&nbsp;&nbsp;".$invoice->payment['bt_postal']."<br /><br />";
127 $html .= "<strong>".ucwords($invoice->payment['bt_card_type'])."</strong>&nbsp;&nbsp;" . $invoice->payment['bt_card_number'];
128
129 $html .= '</div>';
130
131 $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>';
132
133
134 print $html;
135 }
136
137 } else {
138 Invoice\showMyInvoices($_GET['uid'], "/wp-admin/admin.php?page=cbv_users&action=edit&uid=".$_GET['uid']."&section=payhistory&view=");
139 }
140 ?>
141
142
19 </div> 143 </div>
20 <script src="<?php echo Tools\url('../UserManager.js', __FILE__);?>" type="text/javascript"></script> 144 <script src="<?php echo Tools\url('../UserManager.js', __FILE__);?>" type="text/javascript"></script>
...\ No newline at end of file ...\ No newline at end of file
......