Odyssey
cuview.prg
1 <?php
2 /**
3  * Change History:
4  * 05/01/13 mbl - Added fname, lname, decider to monitor_contact table.
5  */
6 ?>
7 <!DOCTYPE html>
8 <html>
9  <head>
10  <LINK REL=stylesheet HREF="/monitor/css/monitor.css" TYPE="text/css">
11  <link rel="stylesheet" type="text/css" media="all" href="/monitor/css/jquery-ui-1.8.18.custom.css"/>
12  <script type="text/javascript" src="/monitor/js/jquery-1.7.1.min.js"></script>
13  <script type="text/javascript" src="/monitor/js/jquery-ui-1.8.18.custom.min.js"></script>
14  <link rel="stylesheet" type="text/css" media="all" href="/monitor/css/monitor_notes.css"/>
15  </head>
16  <body>
17 <br>
18  <form>
19 <?php
20 $monLibrary= dirname(__FILE__) . "/../library";
21 require_once("$monLibrary/cu_top.i");
22 require_once("$monLibrary/ck_hticket.i");
23 
24  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
25  // ** Permissions failed
26  // ** redirect to new page
27  header("Location: /hcuadm/hcu_noperm.prg");
28  exit;
29  }
30 
31 $dms_ok=array('user_name'=>'string','wc'=>'string');
32 dms_import($dms_ok);
33 
34  $sql = "SELECT name, main_email, main_phone, ceo_mgr,
35  trim(addr1) as addr1, trim(addr2) as addr2, trim(city) as city,
36  trim(state) as state, trim(zip) as zip,
37  home_page_url, transfer_method, comments, vendor,
38  to_char(date_live, 'MM/DD/YYYY') as date_live,
39  case when renewal_term >1 and contract_expires <= (date_trunc('month', current_date)-'1day'::interval)::date
40  then to_char((contract_expires +
41  (interval '1 month' *
42  (renewal_term - (abs(extract(years from age(date_trunc('month',contract_expires),date_trunc('month', current_date)-'1day'::interval))::int * 12 + extract(month from age(date_trunc('month',contract_expires),date_trunc('month', current_date)-'1day'::interval))::int) % renewal_term)))
43  +(interval '1 month' * (abs(extract(years from age(date_trunc('month',contract_expires),date_trunc('month', current_date)-'1day'::interval))::int * 12 + extract(month from age(date_trunc('month',contract_expires),date_trunc('month', current_date)-'1day'::interval))::int))))::date,'MM/DD/YYYY') || ' **'
44  else to_char(contract_expires,'MM/DD/YYYY') end as contract_expires,
45  renewal_term,
46  case when contract_expires is null or contract_expires < CURRENT_DATE then 1 else 0 end as expired,
47  dec_31_assets, dec_31_mem, charter_number
48  FROM cuinfo
49  WHERE upper(user_name) = upper('" . $user_name . "')";
50 
51  $sql_rs = db_query($sql, $link);
52 
53  if (db_num_rows($sql_rs) > 0)
54  $sql_row = db_fetch_array($sql_rs);
55  else {
56  // user does not exist stop here
57  printError("Problem displaying page, no cuinfo entry.");
58  exit;
59  }
60 
61  // get the product information for the given credit union
62  $sql = "SELECT home_cu_desc, cuproducts.user_name
63  FROM cuprodlist
64  LEFT OUTER JOIN cuproducts on cuproducts.home_cu_code = cuprodlist.home_cu_code
65  AND cuproducts.user_name = '" . $user_name . "'
66  ORDER BY home_cu_desc ";
67 
68  $product_rs = db_query($sql, $link);
69  $productShow = array();
70  for ($row=0;list($desc, $flag) = db_fetch_array($product_rs,$row); $row++) {
71  $productShow[$row]["product"]=$desc;
72  $productShow[$row]["uses"]=(strlen($flag) > 0 ? true : false);
73  }
74 
75  // Create the Vendor link for the menu item
76  $vendor_url = "<a href=\"javascript:view_vendor('" . trim($sql_row['vendor']) . "')\" onMouseOver=\"status='View " .
77  trim($sql_row['vendor']) . " Information'; return true;\" onMouseOut=\"status='';\">" . trim($sql_row['vendor']) . "</a>";
78  $vend_link = (trim($sql_row['vendor']) == '' ? "" : $vendor_url);
79 
80  // post office-friendly address
81 $address=$sql_row['addr1'] . "<br>" .
82  ($sql_row['addr2'] == '' ? '' : "{$sql_row['addr2']}<br>") .
83  $sql_row['city'] . " " . $sql_row['state'] . " " . $sql_row['zip'];
84  // retrieve the contact info
85 $mc=array();
86  $mcsql= "select role, decider, trim(fname), trim(lname),
87  trim(phone), trim(email), trim(comment)
88  from monitor_contact
89  where user_name='$user_name'
90  order by role, id;";
91  $mclist = db_query($mcsql, $link);
92  for ($row=0;list($mcrole, $mcdecider, $mcfname, $mclname, $mcphone, $mcemail, $mccomment) = db_fetch_array($mclist,$row); $row++) {
93  $mc[$row][0]=$mcrole;
94  $mc[$row][1]=$mcdecider;
95  $mc[$row][2]=trim($mcfname . " " . $mclname);
96  $mc[$row][3]=$mcphone;
97  $mc[$row][4]=$mcemail;
98  $mc[$row][5]=$mccomment;
99  }
100  $showrows=$row;
101 
102 
103 
104  /*
105  * Create link to winders server for viewing of any documents this credit union may have
106  *
107  * http://{IP OF WINDERS}/clientdocs/{LETTER OF DIRECTORY}/{cucode}
108  *
109  * Open a new window with a content list of the directory
110  *
111  */
112  /* Determine Letter */
113  $documentServerIP = 'homefries.boi.homecu.int';
114  switch (strtoupper(substr($user_name, 0, 1))) {
115  case "X":
116  case "Y":
117  case "Z":
118  $directoryLetter = 'XYZ';
119  break;
120  default:
121  $directoryLetter = strtoupper(substr($user_name, 0, 1));
122  }
123 
124  /* Create link *
125  *
126  */
127  $cuDocumentLocation = "http://{$documentServerIP}/clientdocs/{$directoryLetter}/{$user_name}";
128 
129  // Odyssey link modification
130  if (strpos($wc, "localhost") !== false) {
131  $baseURL = $infourl; // Use the value created in cu_top.
132  $prg = ".prg";
133  } else if (isMammothServer($wc)) { // Mammoth
134  $baseURL = "https://$wc.homecu.net";
135  $prg = "";
136  } else { // Odyssey
137  $baseURL = "https://$wc";
138  $prg =".prg";
139  }
140 
141 ?>
142  <script language="javascript">
143  <!-- Start Hiding Javascript from older browser
144  function goto_url(url) {
145  var newwin = null
146  newwin = window.open("http://" + url);
147  }
148  function view_vendor(vend_code) {
149  var newwin = null;
150  // This function will open a new window and view the vendor information
151  url = "view_vend.prg?vc=" + vend_code;
152  newwin = window.open(url, "VendorInfo", "width=400, height=600, resizeable=yes, scrollbars=yes, status=no, menubar=no, location=no, top=0, left=0");
153  }
154  function post_ncua() {
155  var char_num = document.forms[0].charter_number.value;
156  if (char_num.length == 0) {
157  alert ("You forgot to enter a charter number, please enter a number and try again.");
158  } else {
159  document.ncua.Charter.value = char_num;
160  document.ncua.submit();
161  }
162  }
163  // Stop Hiding -->
164  </script>
165 
166  <table width="100%" border=0 cellpadding=3 cellspacing=0 class="dmsbg"><tr><td>
167  <table width="100%" border=0 cellpadding=2 cellspacing=0 class='dtl'>
168  <tr>
169  <td colspan=3 class="bar" align="center">
170  <font size="5">View Credit Union Information</font>
171  </td>
172  </tr>
173  <tr><td class="dtl" colspan="3" align="right">
174 <!--
175  <tr><td class="dtl" align="right">
176  <iframe class='dtl' frameBorder='0' width='100%' scrolling='no' height='35' src="/hcuadm/upgrade_svs?act=hiding&user_name=<?php echo $user_name; ?>"></iframe>
177  </td>
178  <td class="dtl" align="center">
179 -->
180 
181  <iframe frameBorder='0' width='140' scrolling='no' height='35'
182  src="<?php echo $baseURL; ?>/hcuadm/cuclock<?php echo $prg; ?>?cu=<?php echo $user_name; ?>"></iframe>
183  </td>
184  </tr>
185  <tr>
186  <td width=50% class='dtl' valign='top'>
187  <table width="100%" border=0 cellpadding=2 cellspacing=0 bgcolor=white>
188  <tr>
189  <td width='30%' class="hdr" align="right" valign="top">
190  Name:
191  </td>
192  <td width='70%' class='dtl'>
193  <?php echo trim($sql_row['name']); ?>
194  <?php echo "<br>$address"; ?>
195  </td>
196  </tr>
197  <tr>
198  <td class="hdr" align="right">
199  CEO / MGR:
200  </td>
201  <td class='dtl'>
202  <?php echo trim($sql_row['ceo_mgr']); ?>
203  &nbsp;
204  </td>
205  </tr>
206  <?php if(trim($sql_row['main_email']) != ""): ?>
207  <tr>
208  <td class="hdr" align="right">
209  Main e-mail:
210  </td>
211  <td class='dtl'>
212  <?php
213  printf("<a href=\"mailto:%s\">%s</a>", trim($sql_row['main_email']), trim($sql_row['main_email']));
214  ?>
215  </td>
216  </tr>
217  <?php endif; ?>
218  <tr>
219  <td class="hdr" align="right">
220  Main Phone:
221  </td>
222  <td class='dtl'>
223  <?php echo trim($sql_row['main_phone']); ?>
224  &nbsp;
225  </td>
226  </tr>
227  <?php if(trim($sql_row['home_page_url']) != ""): ?>
228  <tr>
229  <td class="hdr" align="right">
230  Home Page URL:
231  </td>
232  <td class='dtl'>
233  <?php
234  printf("<a href=\"javascript:goto_url('%s');\">http://%s</a>", trim($sql_row['home_page_url']), trim($sql_row['home_page_url']));
235  ?>
236  </td>
237  </tr>
238  <?php endif; ?>
239  <tr>
240  <td class="hdr" align="right">
241  &nbsp;
242  </td>
243  <td class='dtl'>
244  <a href='<?php echo $cuDocumentLocation; ?>' target="_blank"><img src="https://www.homecu.net/images/folder.png" style="border:0px;" />
245  &nbsp;View Contracts</a>
246  </td>
247  </tr>
248  </table>
249  </td>
250  <td valign='top' class='dtl'>
251  <table border=0 cellpadding=2 cellspacing=0 bgcolor=white>
252  <tr>
253  <td class="hdr" align="right">
254  Vendor:
255  </td>
256  <td class='dtl'>
257  <?php echo trim($vend_link); ?>
258  &nbsp;
259  </td>
260  </tr>
261  <tr>
262  <td class="hdr" align="right">
263  Went Live:
264  </td>
265  <td class='dtl'>
266  <?php echo $sql_row['date_live']; ?>
267  &nbsp;
268  </td>
269  </tr>
270  <tr>
271  <td class="hdr" align="right">
272  Contract Expires:
273  </td>
274  <td class='dtl'>
275  <?php if ($sql_row['expired'] > 0): ?>
276  <DIV class='msg'>
277  <?php endif; ?>
278  <?php echo $sql_row['contract_expires']; ?>
279  &nbsp;
280  <?php if ($sql_row['expired'] > 0): ?>
281  </DIV>
282  <?php endif; ?>
283  </td>
284  </tr>
285  <tr>
286  <td class="hdr" align="right">
287  Renewal Months:
288  </td>
289  <td class='dtl'>
290  <?php echo $sql_row['renewal_term']; ?>
291  &nbsp;
292  </td>
293  </tr>
294  <tr>
295  <td class="hdr" align="right">
296  Charter Number:
297  </td>
298  <td class='dtl'>
299  <?php echo trim($sql_row['charter_number']); ?>
300  </td>
301  </tr>
302  <tr>
303  <td class="hdr" align="right">
304  Dec 31 Assets:
305  </td>
306  <td class='dtl'>
307  <?php echo $sql_row['dec_31_assets']; ?>
308  &nbsp;
309  </td>
310  </tr>
311  <tr>
312  <td class="hdr" align="right">
313  Dec 31 Membership:
314  </td>
315  <td class='dtl'>
316  <?php echo $sql_row['dec_31_mem']; ?>
317  &nbsp;
318  </td>
319  </tr>
320  </table>
321  </td>
322  <td valign='top' class='dtl' style="width:15%">
323  <table border=0 cellpadding=2 cellspacing=0 style="background-color: white;">
324  <tr>
325  <td colspan="2" class="hdr" align="center">
326  Products
327  <div style="height:120px; width:200px; overflow:auto;">
328  <?php
329  print "<table style='border:2px solid white; border-spacing:0; width:100%; border-collapse:collapse;'>";
330  for ( $i = 0; $i < count($productShow); $i++ ) {
331  print "<tr>
332  <td class='dtl' style='text-align:left; padding:4px; white-space:nowrap;'>" . $productShow[$i]["product"] . "</td>
333  <td class='dtl' style='text-align:left; padding:4px; white-space:nowrap;'>" . ($productShow[$i]["uses"] ? "X" : "&nbsp;") . "</td>
334  </tr>";
335  }
336  print "</table>";
337  ?>
338  </div>
339  </td>
340  </tr>
341  </table>
342  </td>
343  </tr>
344 
345  <?php
346  print "<tr><td colspan='3' ><div class='bar'>Credit Union Contacts </div>
347  <table align='center' cellspacing='0' cellpadding='2' border='0' width='100%' bgcolor=white>";
348  print "<tr class='hdr'>
349  <td>Role</td>
350  <td>Decider</td>
351  <td>Name</td>
352  <td>Phone</td>
353  <td>Email</td>
354  <td>Contact Info</td></tr>";
355 
356  for ($prow=0; $prow < $showrows; $prow++) {
357  $RGB = ($RGB == "odd" ? "even" : "odd");
358 
359  $role=$mc[$prow][0];
360  $role=$cu_contact_role[$role];
361  print "<tr class='$RGB'>
362  <td class='usu' valign='top'>$role</td>";
363 
364  #Decider
365  print "<td class='usu' valign='top'>" . ($mc[$prow][1] == "Y" ? "Y" : "") .
366  "</td>";
367  #Name
368  print "<td class='usu' valign='top'>" . dms_disphtml($mc[$prow][2]) .
369  "</td>";
370  #Phone
371  print "<td class='usu' valign='top'>" . dms_disphtml($mc[$prow][3]) .
372  "</td>";
373  #Email
374  $pval = (trim(stripslashes($mc[$prow][4])) == '' ? '' :
375  "<a href='mailto:{$mc[$prow][4]}'>{$mc[$prow][4]}</a>");
376  print "<td class='usu' valign='top'>$pval</td>";
377 
378  #Comment
379  print "<td class='usu' valign='top'>" . dms_disphtml($mc[$prow][5]) . "</td>";
380 
381 
382  print "</tr>";
383 
384  }
385  print "</table></td></tr>";
386  ?>
387  <tr><td colspan='3' ><div class='bar'>After Hours Contacts </div>
388  <iframe class='dtl' frameBorder='0' width='100%' scrolling='yes' height='100'
389  src="<?php echo $baseURL; ?>/hcuadm/cucontactafter<?php echo $prg; ?>?cu=<?php echo $user_name; ?>"></iframe>
390  </td></tr>
391  <tr><td colspan='3' ><div class='bar'>CU Admin Users <span id='cuContactClick' onclick='javascript:toggleCUContacts();' style='cursor:pointer;'>[&nbsp;+&nbsp;]</span></div>
392  <iframe id='cuContactFrame' style='visibility:hidden;' class='dtl' frameBorder='0' width='100%' scrolling='yes' height='0'
393  src="<?php echo $baseURL; ?>/hcuadm/cuAdmUsers<?php echo $prg; ?>?cu=<?php echo $user_name; ?>"></iframe>
394  </td></tr>
395  </table>
396  </td></tr>
397  </table>
398 </form>
399 <?php
400 print <<< js_code
401  <script language="javascript">
402  <!--
403  var toggleStateHidden = true;
404  function toggleCUContacts() {
405  var elemFrame = document.getElementById('cuContactFrame');
406  var elemSign = document.getElementById('cuContactClick');
407 
408  if ( toggleStateHidden ) {
409  elemFrame.height = 100;
410  elemFrame.style.visibility = "visible";
411  elemSign.innerHTML = "[&nbsp;-&nbsp;]";
412  toggleStateHidden = false;
413  } else {
414  elemFrame.height = 0;
415  elemFrame.style.visibility = "collapse";
416  elemSign.innerHTML = "[&nbsp;+&nbsp;]";
417  toggleStateHidden = true;
418  }
419  }
420  // -->
421  </script>
422 js_code;
423 ?>
424 <div style='clear:both;'></div>
425 
426 <div class="dtl">
427 <?php
428  // ** I am going to include the monitor_notes.data here -- This will do any data updates and load any data
429  //require('monitor_notes.data');
430 
431  // ** SHOW THE CURRENT NOTES
432  require('monitor_notes.desktop');
433 ?>
434 </div>
435 
436 <form action="https://webapps.ncua.gov/cgi-bin/cudataexpanded.exe" method="post" name="ncua" target="ncua_result">
437  <input type="hidden" name="Status" value="A">
438  <input type="hidden" name="cfserver" value="reports.ncua.gov">
439  <input type="hidden" name="Charter" value="">
440  </form>
441  </body>
442 </html>