Odyssey
hcuLoginsReport.prg
1 <?php
2  /*
3  * File: hcuRDCStatus (RDC Status Table Inquiry)
4  *
5  * Purpose: Shows content of CURDCSTATUS table records to assist in customer support for
6  * RDC from apps
7  *
8  * NOTES:
9  * 1. No Updates allowed -- just read, filter, expand the json array
10  * 2. SPB 10/30/2015-- now uses monitorView.i
11  */
12 
13  $monLibrary = dirname(__FILE__) . "/../library";
14  $sharedLibrary = dirname(__FILE__) . "/../../shared/library";
15  $bankingLibrary = dirname(__FILE__) . "/../../banking/library";
16 
17 
18 
19 
20  require_once("$monLibrary/ck_hticket.i");
21  require_once("$monLibrary/cu_top.i");
22  require_once( "$sharedLibrary/cu_func.i" );
23  require_once("$monLibrary/monitorView.i");
24 
25  if (!CheckPerm($link, $Hu, 'stmnt_reports', $_SERVER['REMOTE_ADDR'])) { // ** Permissions failed
26  // ** redirect to new page
27  header("Location: /hcuadm/hcu_noperm.prg");
28  exit;
29  }
30 
31  $errorTitle= "Credit Union Reporting";
32  $title= "Member Login Summary";
33  $Cu = strtoupper($_REQUEST["cu"]);
34  /*
35  * Local Variables
36  *
37  */
38 
39  // ** Get the record set
40  // ** rendor json array as print_r() string
41 
42  $sql = "select substr(yearmo,1,4) || '-' || substr(yearmo,5,2) as month,
43  case when hcucode = 'CMB' then 'OldMBL' when hcucode = 'ADA' then 'Android'
44  when hcucode = 'APP' then 'iPhone' when hcucode = 'MBL' then 'MBLweb'
45  when hcucode = 'DSK' then 'Desktop' else 'Classic' end as product,
46  sum(logins) as logins, count(*) as members,
47  to_char(avg(logins),'999.9') as avgmem
48  from culogtrack where cu='$Cu' group by 1,2 order by 1 desc, 2";
49 
50  $sth = db_query($sql, $dbh);
51 
52  $return=array();
53  if (db_num_rows($sth) > 0) {
54  $drow=db_fetch_assoc($sth,0);
55  $fieldlist = array_keys($drow);
56  $return['keys']=$fieldlist;
57  for ($row=0;$drow=db_fetch_assoc($sth,$row);$row++) {
58  $return['data'][] = $drow;
59  }
60  }
61  $data_ary=json_encode($return['data']);
62  try {
63  // ** Import the necessary fields
64 
65  $dms_ok=array("action"=>"string", "key"=>"string", "screen" => "string",
66  "delimiter"=>"string" );
67  dms_import_v2( $HB_ENV, "MY_POST", $dms_ok);
68 
69  $self = $_SERVER['SCRIPT_NAME'];
70  $baseURL = $_SERVER["SCRIPT_NAME"];
71 
72 
73  /*
74  * ** START CONTENT
75  */
76  // change the header for certain actions
77 
78  // set the content type appropriately
79  header('content-type: text/html; charset: utf-8');
80  printMonitorPageTop($title, $homecuKendoVersion, $cloudfrontDomainName);
81  ?>
82 
83  <style>
84  body {
85  font-family: Arial, Helvetica, sans-serif;
86  background-color: #EFEFEF;
87  }
88 
89  .configuration {
90  margin: 0 0 0 15px;
91  padding: 0 10px 10px 10px;
92  -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.5);
93  -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.5);
94  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
95  border: 1px solid rgba(255,255,255,0.2);
96  -moz-border-radius: 3px;
97  -webkit-border-radius: 3px;
98  border-radius: 3px;
99  background: -moz-linear-gradient(top, rgba(0,0,0,0.01) 0%, rgba(0,0,0,0.07) 100%);
100  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.01)), color-stop(100%,rgba(0,0,0,0.07)));
101  background: -webkit-linear-gradient(top, rgba(0,0,0,0.01) 0%,rgba(0,0,0,0.07) 100%);
102  background: -o-linear-gradient(top, rgba(0,0,0,0.01) 0%,rgba(0,0,0,0.07) 100%);
103  background: -ms-linear-gradient(top, rgba(0,0,0,0.01) 0%,rgba(0,0,0,0.07) 100%);
104  background: linear-gradient(to bottom, rgba(0,0,0,0.01) 0%,rgba(0,0,0,0.07) 100%);
105  min-width: 170px;
106  max-width: 500px;
107  }
108  .configuration .options {
109  list-style:none;
110  margin: 0;
111  padding: 0;
112 }
113 .configuration .options li {
114  display: block;
115  margin: 0;
116  padding: 0.2em 0;
117  zoom: 1;
118 }
119 
120 .configuration .options li:after {
121  content: "";
122  display: block;
123  clear: both;
124  height: 0;
125 }
126 .configuration .configHead {
127  display: block;
128  font-size: 1.5em;
129  font-weight: bold;
130  text-indent: 0;
131  margin-top: 10px;
132  margin-bottom: 15px;
133  border-bottom: 1px solid #999;
134 }
135 .configuration .configHead label{
136  display:block;
137 }
138 
139 #detailConfiguration fieldset legend {
140  font-weight: bold;
141  font-size: 1.4em;
142  margin-bottom: 5px;
143  margin-left: 0px;
144 }
145 #detailConfiguration label {
146  display:block;
147  font-size: 1.2em;
148  margin: 3px 0 3px 0;
149 }
150 
151 #detailConfiguration fieldset.language div {
152  margin-left: 10px;
153 }
154 
155  .configuration-language {
156  width: 120px;
157  }
158  .configuration-language .lang-select {
159  display: table-cell;
160  vertical-align: middle;
161  border-right: 1px solid #AAA;
162  padding: 10px 10px 10px 0px;
163  }
164 
165  .configuration-language .lang-title {
166  display: table-cell;
167  vertical-align: middle;
168  padding-left: 10px;
169 
170  }
171  #editMenu {
172  font-size: 12px;
173  }
174  #editMenu .menuTree {
175  display: table-cell;
176  min-width: 400px;
177  }
178  #btnAddNode {
179  margin-bottom: 10px;
180  }
181  #editMenu .menuDetails {
182  display: table-cell;
183  }
184  .configuration-language ul {
185  list-style: none;
186  }
187  .configuration-language li {
188 
189  }
190  #sectionLine {
191  border-top:1px solid #DFDFDF;
192  padding-top:5px;
193 
194  }
195 .sectionTitle {
196  font-family: Arial, Helvetica, sans-serif;
197  font-weight: normal;
198 }
199 
200 .sectionTitle {
201  left:0;
202  font-size:23px;
203  line-height:1.6;
204  color:#4e4e4e;
205 }
206 
207 .sectionTitle strong {
208  color:#e26b1d;
209  font-weight:normal;
210 }
211 section {
212  margin: 5px 0 5px 0;
213  padding: 20px 0 20px 20px;
214  background-color: #fcfcfc;
215  background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#efefef));
216 
217  background: -webkit-linear-gradient(top, #ffffff, #efefef);
218  background: -moz-linear-gradient(top, #ffffff, #efefef);
219  background: -o-linear-gradient(top, #ffffff, #efefef);
220  background: -ms-linear-gradient(top, #ffffff, #efefef);
221  background: linear-gradient(top, #ffffff, #efefef);
222  -webkit-box-shadow: 0px 1px 2px #8e8e8e;
223  -moz-box-shadow: 0px 1px 2px #8e8e8e;
224  -o-box-shadow: 0px 1px 2px #8e8e8e;
225  box-shadow: 0px 1px 2px #8e8e8e;
226 }
227 
228 
229 #themeWrap
230 {
231  float: right;
232  margin-top: -35px;
233  font-size: .9em;
234  line-height: 26px;
235 }
236 
237 #themeWrap .get-kendoui
238 {
239  padding: 0 10px;
240  line-height: 24px;
241  -moz-border-radius:3px;
242  -webkit-border-radius:3px;
243  border-radius:3px;
244 }
245 
246 .k-theme-chooser,
247 .tc-theme,
248 .tc-color,
249 .tc-link,
250 .tc-theme-name
251 {
252  text-decoration: none;
253  display: inline-block;
254  *display: inline;
255  *zoom: 1;
256 }
257 
258 .tc-theme-name
259 {
260  vertical-align: middle;
261  padding-right: 4px;
262  width: 80px;
263 }
264 
265 .k-theme-chooser .tc-link
266 {
267  vertical-align: middle;
268  line-height: 23px;
269  padding: 0 4px 0 8px;
270  -moz-border-radius: 3px;
271  -webkit-border-radius: 3px;
272  border-radius: 3px;
273 }
274 
275 .tc-choose-theme
276 {
277  vertical-align: middle;
278  color: #939393;
279  margin: 0 10px 0 0;
280 }
281 
282 .tc-theme-container
283 {
284  display: none;
285  list-style-type: none;
286  margin: 0 0 18px;
287  padding: 0 0 18px 10px;
288  border-bottom: 1px solid #dfdfdf;
289  font:75% Arial,Helvetica,sans-serif;
290 }
291 
292 .tc-color
293 {
294  width: 23px;
295  height: 23px;
296  border-width: 1px;
297  border-style: solid;
298  border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(255,255,255,.1);
299  display: inline-block;
300  *display: inline;
301  *zoom: 1;
302 }
303 
304 .tc-theme
305 {
306  margin: 0 5px;
307 }
308 
309 .tc-theme .tc-link
310 {
311  color: #4f4f4f;
312  padding: 10px;
313  border: 1px solid #fff;
314 }
315 
316 .tc-theme .tc-link:hover
317 {
318  border-color: #d6d6d6;
319  -moz-box-shadow: 0 0 7px rgba(0,0,0,.15);
320  -webkit-box-shadow: 0 0 7px rgba(0,0,0,.15);
321  box-shadow: 0 0 7px rgba(0,0,0,.15);
322 }
323 
324 .tc-theme .tc-link.active
325 {
326  border-color: #d6d6d6;
327  -moz-box-shadow: inset 0 0 7px rgba(0,0,0,.15);
328  -webkit-box-shadow: inset 0 0 7px rgba(0,0,0,.15);
329  box-shadow: inset 0 0 7px rgba(0,0,0,.15);
330 }
331 
332 .tc-theme .tc-theme-name
333 {
334  padding: 0;
335  width: auto;
336  display: block;
337 }
338 
339 #themeChooser .skin-black .k-state-selected{background-color:#0070e4;color:#fff;}
340 #themeChooser .skin-blueopal .k-state-selected{background-color:#005c83;color:#fff;}
341 #themeChooser .skin-bootstrap .k-state-selected{background-color:#0044cc;color:#fff;}
342 #themeChooser .skin-default .k-state-selected{background-color:#f0713a;color:#fff;}
343 #themeChooser .skin-highcontrast .k-state-selected{background-color:#a7008f;color:#fff;}
344 #themeChooser .skin-metro .k-state-selected{background-color:#8ebc00;color:#fff;}
345 #themeChooser .skin-metroblack .k-state-selected{background-color:#00aba9;color:#fff;}
346 #themeChooser .skin-silver .k-state-selected{background-color:#0879C0;color:#fff;}
347 #themeChooser .skin-uniform .k-state-selected{background-color:#ccc;color:#666;}
348 
349  #gridProxy {
350  font-size: 12px;
351  width: 500px;
352  }
353  .k-tooltip-content { text-align: left;
354  font-size: 12px;
355  max-width: 300px;
356  }
357  </style>
358 
359 <?php printMonitorPageMiddle($title, $additionalMenuOptions= array("Refresh" => array("id" => "grid_toolbar_freshBtn"))); ?>
360 
361  <div id="inqList"></div>
362  <div id="showInfo"></div>
363 
364  <div id="progressShow" style="z-index:20000;"></div>
365  <script id="popup-editor" type="text/x-kendo-template">
366  <h3 style='text-align:center; width:100%;'><?php echo $title; ?></h3>
367 <?php
368 
369  for ( $i = 0; $i < count( $return['keys'] ); $i++ ) {
370  $keyval = $return['keys'][$i];
371 ?>
372  <span>
373  <label for="<?php echo $keyval ?>" style='font-weight:bold;'><?php echo $keyval ?>:</label>
374  <input type="text" name="<?php echo $keyval ?>"
375  id="<?php echo $keyval ?>"
376  data-bind="value:<?php echo $keyval ?>"
377  data-value-field="<?php echo $keyval ?>"
378  data-text-field="<?php echo $keyval ?>"
379  </input>
380  <div style="clear:both"></div>
381  </span>
382 <?php
383  }
384 ?>
385  </script>
386  <style>
387  .k-edit-form-container { width: auto; }
388  .edit_label { text-align: left; font-weight: bold; font-size: larger; }
389  .edit_entry { text-align: left; }
390  .odd-row { background-color:lightcyan; }
391  .header-row { background-color: lightsteelblue; font-weight: bold; }
392  .td-detail { text-align: center; width: 33%; }
393  .td-info { text-align: left; font-family: monospace; white-space: pre; }
394  </style>
395  <script type="text/javascript">
396  $(document).ready(function() {
397  $("#tabstrip").kendoTabStrip({
398  animation: { open: { effects: "fadeIn"} }
399  });
400 
401  var containsFilter =
402  {
403  extra : false,
404  operators : { string : { contains : "Contains"}},
405  ui : function( element )
406  {
407  var parent = element.parent();
408  while( parent.children().length > 1 )
409  $(parent.children()[0]).remove( );
410 
411  parent.prepend( "<input data-bind=\"value:filters[0].value\" class=\"k-textbox\" type=\"text\">" );
412  }
413  }
414 
415  var dataList = <?php echo $data_ary; ?> ;
416  $('#inqList').kendoGrid({
417  dataSource: {
418  data: dataList,
419  schema: {
420  model: {
421  fields: {
422  month : {type: "string"},
423  product: {type: "string"},
424  logins : {type: "number"},
425  members : {type: "number"},
426  avgmem : {type: "number"}
427  }
428  }
429  }
430  },
431  pageable: {
432  pageSize: 30,
433  pageSizes: [10, 20, 50],
434  buttonCount: 5,
435  input: true,
436  refresh: true
437  },
438  sortable: {
439  mode: "single",
440  allowUnsort: false
441  },
442  filterable: { contains: true },
443  columns: [
444  { field: "month", title: "Month", type: "string", filterable: true, width: "30px" , encoded: false },
445  { field: "product", title: "Product", type: "string", filterable: true, width: "60px", encoded: false },
446  { field: "logins", title: "Logins", type: "number", filterable: false,
447  attributes:{style:"text-align:right; padding-right:25px"}, width: "30px", encoded: false },
448  { field: "members", title: "Members", type: "number", filterable: false,
449  attributes:{style:"text-align:right; padding-right:25px"}, width: "30px", encoded: false },
450  { field: "avgmem", title: "Average / Active Member", type: "number", filterable: false, format: "{0:n2}",
451  attributes:{style:"text-align:right; padding-right:25px"}, width: "40px", encoded: false }
452  ]
453  });
454 
455  $("#grid_toolbar_freshBtn").click(function(e) {
456  window.location.reload();
457  });
458  $("#grid_toolbar_exitBtn").click(function(e) {
459  window.location.assign('<?php echo $produrl; ?>/monitor/mindex.html');
460  });
461 
462  });
463 
464  </script>
465 <?php
466  } catch (Exception $e) {
467  // ERROR CAUGHT
468  /*
469  *
470  */
471 
472 printMonitorPageTop($errorTitle, $homecuKendoVersion, $cloudfrontDomainName);
473 printMonitorPageMiddle($errorTitle);
474 
475 print "<h3>{$e->getMessage()}</h3>";
476 printMonitorPageBottom();
477  }
478