Odyssey
info_reports.prg
1 <?php
2 /**
3  * Change History:
4  * 05/01/13 mbl - Added fname, lname, decider to monitor_contact table.
5  * 11/16/15 SPB - updated to Kendo look
6  */
7 
8 $monLibrary = dirname(__FILE__) . "/../library";
9 $sharedLibrary = dirname(__FILE__) . "/../../shared/library";
10 require_once("$monLibrary/cu_top.i");
11 require_once("$monLibrary/ck_hticket.i");
12 require_once("$monLibrary/monitorView.i");
13 require_once("$sharedLibrary/reporting.i");
14 require_once("$sharedLibrary/commonJsFunctions.i");
15 
16 if (!CheckPerm($dbh, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
17  // ** Permissions failed
18  // ** redirect to new page
19  header("Location: /hcuadm/hcu_noperm.prg");
20  exit;
21 }
22 
23 $string = array("filter" => FILTER_SANITIZE_STRING);
24 $array = array("filter" => FILTER_DEFAULT); // For inputs that require {[]}
25 $parameters = array();
26 HCU_ImportVars($parameters, "", array("operation" => $string, "csv" => $string, "report" => $string, "sort" => $array, "filter" => $array));
27 
28 $operation = HCU_array_key_value("operation", $parameters);
29 $operation = $operation === false ? "" : trim($operation);
30 $report = HCU_array_key_value("report", $parameters);
31 $report = $report === false ? "" : trim($report);
32 $self = "info_reports.prg";
33 
34 if ($operation != "") {
35  switch ($operation) {
36  case "readReport":
37  ReadReport($dbh, GetReportList(), GetDefaultDateFormat());
38  break;
39  case "generateCSV":
40  GenerateCSV($dbh, GetReportList(), GetDefaultDateFormat());
41  break;
42  default: // Won't get here
43  header('Content-type: application/json');
44  $returnArray = array("error" => array("Operation not specified: '$operation'"), "record" => "", "operation" => "");
45  print HCU_JsonEncode($returnArray);
46  }
47 } else if ($report == "") {
48  PrintReportList($self);
49 } else {
50  $reportList = GetReportList();
51  $reportRecord = $reportList[$report];
52  $reportRecord["reportTitle"] = isset($reportRecord["reportTitle"]) ? $reportRecord["reportTitle"] : trim($reportRecord["title"]);
53  $title = isset($reportRecord["reportTitle"]) ? trim($reportRecord["reportTitle"]) : (isset($reportRecord["title"]) ? trim($reportRecord["title"]) : trim($report));
54  PrintReportPage($reportList, $report, $title, $self);
55 }
56 exit;
57 
58 /**
59  * function GetDefaultDateFormat()
60  * @return the default date format.
61  */
62 function GetDefaultDateFormat() {
63  return "MM/dd/yyyy";
64 }
65 
66 /**
67  * function GetReportList()
68  * @return the configuration for each of the reports.
69  */
70 function GetReportList() {
71  global $SYS_TYPE_CLOSED, $SYS_TYPE_LIVE, $SYS_TYPE_BATCH, $SYS_TYPE_WEBONLY, $SYS_TYPE_UPGRADE, $SYS_TYPE_ASP, $SYS_TYPE_IVR, $SYS_TYPE_VOIP;
72  return array(
73  "address" => array(
74  "title" => "Address List",
75  "sql" => "select user_name, ceo_mgr, name, addr1, addr2, city, state, zip from cuinfo
76  where ((system_options & $SYS_TYPE_CLOSED) = 0) ",
77  "cols" => array("CU" => "string", "CEO" => "string", "Name" => "string", "Address" => "string", "Address2" => "string",
78  "City" => "string","State" => "string", "Zip" => "string")),
79  "assets" => array(
80  "title" => "Assets and Members",
81  "sql" => "select user_name, name, state, dec_31_assets, dec_31_mem, charter_number, ceo_mgr from cuinfo
82  where ((system_options & ($SYS_TYPE_LIVE | $SYS_TYPE_BATCH | $SYS_TYPE_WEBONLY)) <> 0) and ((system_options & $SYS_TYPE_CLOSED) = 0) ",
83  "cols" => array("CU" => "string", "Name" => "string", "State" => "string", "Assets" => "number", "Members" => "number",
84  "NCUA" => "number", "CEO Manager" => "string")
85  ),
86  "ceo" => array(
87  "title" => "CEO Contact Info",
88  "sql" => "select user_name, ceo_mgr, main_phone, main_email from cuinfo where ((system_options & $SYS_TYPE_CLOSED) = 0) ",
89  "cols" => array("CU" => "string", "CEO Manager" => "string", "Main Phone" => "string", "Main Email" => "string")
90  ),
91  "other" => array(
92  "title" => "Other Contact Info",
93  "sql" => "select m.user_name, case when m.role = '05_CEO' then 'Ceo/Mgr' when m.role = '10_WEB' then 'Web Contact'
94  when m.role = '15_IT' then 'IT Person' when m.role = '20_MKT' then 'Marketing' when m.role = '25_CU' then 'Credit Union'
95  when m.role = '30_FAX' then 'Fax Line' when m.role = '35_EVE' then 'Evening/Night' when m.role = '40_REF' then 'HB Reference'
96  else '' end, case when m.decider = 'Y' then 'Y'
97  else '' end, m.fname || ' ' || m.lname, m.phone, m.email, m.comment
98  from monitor_contact m join cuinfo i on i.user_name = m.user_name where ((system_options & $SYS_TYPE_CLOSED) = 0) ",
99  "cols" => array("CU" => "string", "Role" => "string", "Decider" => "boolean", "Name" => "string", "Phone" => "string",
100  "Email" => "string", "Comment" => "string")
101  ),
102  "client1" => array(
103  "title" => "Client List",
104  "sql" => "select name, city, state, ceo_mgr, main_phone, vendor, dec_31_assets, dec_31_mem from cuinfo
105  where ((system_options & ($SYS_TYPE_LIVE | $SYS_TYPE_BATCH)) <> 0) and ((system_options & $SYS_TYPE_CLOSED) = 0) ",
106  "cols" => array("CU Name" => "string", "City" => "string", "State" => "string", "CEO Manager" => "string", "Telephone" => "string",
107  "DP Vendor" => "string", "Assets" => "number", "Members" => "number")
108  ),
109  "alpha" => array(
110  "title" => "Alpha Check List",
111  "sql" => "select user_name, name, vendor, www_server from cuinfo where ((system_options & $SYS_TYPE_CLOSED) = 0) ",
112  "cols" => array("CU" => "string", "Org Name" => "string", "Vendor" => "string", "Server" => "string")
113  ),
114  "training" => array(
115  "title" => "Training and Billing",
116  "sql" => "select user_name, date_trained, date_hb_billed, date_ws_billed, stmnt_date,
117  ivrbill_date, txtbill_date, mobbill_date, iphone_billed, android_billed
118  from cuinfo where ((system_options & $SYS_TYPE_CLOSED) = 0) ",
119  "cols" => array("CU" => "string", "Date Trained" => "date", "HCU Billed" => "date", "WEB Billed" => "date",
120  "E-ST Billed" => "date", "IVR Billed" => "date", "TXT Billed" => "date", "MBL Billed" => "date", "APP Billed" => "date",
121  "ADA Billed" => "date")
122  ),
123  "client2" => array(
124  "title" => "Client Reference List", "dateFormat" => "yyyy - MM",
125  "sql" => "select user_name, name, vendor, dec_31_assets, city || ', ' || state, date_live,
126  case when (system_options & $SYS_TYPE_BATCH) <> 0 then 'Batch / ' ELSE '' END ||
127  case when (system_options & $SYS_TYPE_LIVE) <> 0 then 'Live / ' ELSE '' END ||
128  case when (system_options & $SYS_TYPE_ASP) <> 0 then 'ASP / ' ELSE '' END ||
129  case when (system_options & $SYS_TYPE_IVR) <> 0 then 'IVR / ' ELSE '' END ||
130  case when (system_options & $SYS_TYPE_VOIP) <> 0 then 'IVR / ' ELSE '' END ||
131  case when (system_options & $SYS_TYPE_WEBONLY) <> 0 then 'Web only / ' ELSE '' END ||
132  case when (system_options & $SYS_TYPE_UPGRADE) <> 0 then 'Upgrade / ' ELSE '' END ||
133  case when (system_options & $SYS_TYPE_CLOSED) <> 0 then 'Closed / ' ELSE ''
134  END from cuinfo
135  where date_live is not null and ((system_options & ($SYS_TYPE_LIVE | $SYS_TYPE_BATCH)) <> 0)
136  and ((system_options & $SYS_TYPE_CLOSED) = 0) ",
137  "cols" => array("CU Code" => "string", "Credit Union" => "string", "Core Processor" => "string", "Assets" => "number",
138  "Location" => "string", "Client Since" => "date", "Type" => "string")
139  ),
140  "refs" => array(
141  "title" => "HomeCU References", "dateFormat" => "yyyy - MM",
142  "sql" => "select name, main_phone, ceo_mgr, home_page_url, vendor, date_live,
143  case when (system_options & $SYS_TYPE_BATCH) <> 0 then 'Batch / ' ELSE '' END ||
144  case when (system_options & $SYS_TYPE_LIVE) <> 0 then 'Live / ' ELSE '' END ||
145  case when (system_options & $SYS_TYPE_ASP) <> 0 then 'ASP / ' ELSE '' END ||
146  case when (system_options & $SYS_TYPE_IVR) <> 0 then 'IVR / ' ELSE '' END ||
147  case when (system_options & $SYS_TYPE_VOIP) <> 0 then 'VOIP / ' ELSE '' END ||
148  case when (system_options & $SYS_TYPE_WEBONLY) <> 0 then 'Web only/ ' ELSE '' END ||
149  case when (system_options & $SYS_TYPE_UPGRADE) <> 0 then 'Upgrade / ' ELSE '' END ||
150  case when (system_options & $SYS_TYPE_CLOSED) <> 0 then 'Closed / ' ELSE '' END from cuinfo
151  where date_live is not null and ((system_options & $SYS_TYPE_CLOSED) = 0) ",
152  "cols" => array("Credit Union" => "string", "Telephone" => "string", "CEO" => "string", "Domain" => "string",
153  "Core Processor" => "string", "Client Since" => "date", "Type" => "string")),
154  "estatement" => array(
155  "title" => "E-Statement Clients",
156  "sql" => "select user_name, name, stmnt_date from cuinfo where stmnt_date is not null and ((system_options & $SYS_TYPE_CLOSED) = 0) ",
157  "cols" => array("CU" => "string", "Name" => "string", "Date" => "date")
158  ),
159  "prods" => array(
160  "title" => "HomeCU Products",
161  "sql" => "select i.user_name, i.name, (select 'B'::char from cuproducts where user_name = i.user_name and home_cu_code = 'HCU'),
162  (select 'L'::char from cuproducts where user_name = i.user_name and home_cu_code = 'HCUL'),
163  (select 'W'::char from cuproducts where user_name = i.user_name and home_cu_code = 'WEBS'),
164  (select 'S'::char from cuproducts where user_name = i.user_name and home_cu_code = 'ESP'),
165  (select 'C'::char from cuproducts where user_name = i.user_name and home_cu_code = 'IMG'),
166  (select 'Q'::char from cuproducts where user_name = i.user_name and home_cu_code = 'WC'),
167  (select 'P'::char from cuproducts where user_name = i.user_name and home_cu_code = 'BP')
168  from cuinfo i where ((system_options & $SYS_TYPE_CLOSED) = 0) ",
169  "cols" => array("CU" => "string", "Name" => "string", "Batch" => "string", "Live" => "string", "Website" => "string",
170  "Stmnt" => "string", "Checks" => "string", "WebCon" => "string", "BillPay" => "string")
171  ),
172  "converted" => array(
173  "title" => "Converted From",
174  "sql" => "select user_name, name, conv_from from cuinfo where trim(conv_from) > '' and ((system_options & $SYS_TYPE_CLOSED) = 0) ",
175  "cols" => array("CU" => "string", "Name" => "string", "Converted" => "string")
176  ),
177  "corporate" => array(
178  "title" => "Corporate Check Processors",
179  "sql" => "select img, imgdesc, datespec from cuimagevendors ",
180  "cols" => array("Image" => "string", "Corporate" => "string", "Date Required" => "string")
181  ),
182  "sharetec" => array(
183  "title" => "ShareTec VAR List", "dateFormat" => "yyyy - MM", "dateEmpty" => "Pending",
184  "sql" => "select user_name, name, vendvar, date_live from cuinfo i
185  join cuvendors v on i.vendor = v.vendor
186  where v.venddesc = 'SHARETEC' and ((system_options & ($SYS_TYPE_LIVE | $SYS_TYPE_BATCH)) <> 0)
187  and ((system_options & $SYS_TYPE_CLOSED) = 0) ",
188  "cols" => array("CU" => "string", "Name" => "string", "ShareTec VAR" => "string", "Date Live" => "date")
189  ),
190  /**
191  * @todo: This report is not functioning in Mammoth or Odyssey.
192  * If this is needed, there is some work to move report to new reporting.i (vs old reports.i):
193  * Change #replaceString# functionality with "nonSqlDataFunc." @see GetRepeatingTransReport in cuReporting.prg.
194  * This report uses mmenu.html to check Spanish usage which was only true in Classic.
195  * Therefore, it won't work on Upgrade Mammoth or in Odyssey.
196  * A better solution to work on both Mammoth and Odyssey: language property in hcuSettings.i.
197  * Futhermore, only Miki has used this report and her last usage was 5 years ago.
198  */
199 
200  // "client3" => array(
201  // "title" => "Clients using Spanish",
202  // "sql" => "select name, city, state, ceo_mgr, main_phone, vendor, dec_31_assets, dec_31_mem,
203  // case when (system_options & $SYS_TYPE_BATCH) <> 0 then 'B' when (system_options & $SYS_TYPE_LIVE) <> 0 then 'L' ELSE '' END
204  // from cuinfo where user_name in ('#replace#')",
205  // "replaceString" => "#replace#",
206  // "replaceCode" => 'return implode("\',\'", array_map(\'trim\',array_merge (sehablaCount("www3"), sehablaCount("www5"), sehablaCount("www6"))));',
207  // "cols" => array("CU Name" => "string", "City" => "string", "State" => "string", "CEO Manager" => "string", "Telephone" => "string",
208  // "DP Vendor" => "string", "Assets" => "number", "Members" => "number", "Interface" => "string")
209  // ),
210  "callahan" => array(
211  "title" => "Callahan Report",
212  "sql" => "select upper(user_name), state, name, dec_31_assets, dec_31_mem, charter_number,
213  case when exists (select * from cuproducts where user_name = cuinfo.user_name and home_cu_code = 'ESP') then 'ES' else '' end,
214  case when exists (select * from cuproducts where user_name = cuinfo.user_name
215  and home_cu_code in ('MBLLITE','MBLCLS','MBLWEB')) then 'MBL' else '' end,
216  case when exists (select * from cuproducts where user_name = cuinfo.user_name and home_cu_code ='MBLAPP') then 'iPh' else '' end,
217  case when exists (select * from cuproducts where user_name = cuinfo.user_name and home_cu_code ='MBLADA') then 'Andr' else '' end,
218  case when exists (select * from cuproducts where user_name = cuinfo.user_name and home_cu_code ='MDesk') then 'PFM' else '' end,
219  case when exists (select * from cuproducts where user_name = cuinfo.user_name and home_cu_code ='RDC') then 'RDC' else '' end,
220  case when exists (select * from cuproducts where user_name = cuinfo.user_name and home_cu_code ='BP') then 'BillPay' else '' end,
221  case when exists (select * from cuproducts where user_name = cuinfo.user_name and home_cu_code ='MBLTXT') then 'TXT' else '' end
222  from cuinfo
223  where vendor <> 'WEBONLY' and ((system_options & ($SYS_TYPE_LIVE | $SYS_TYPE_BATCH)) <> 0)
224  and ((system_options & $SYS_TYPE_CLOSED) = 0) and date_live is not null ",
225  "cols" => array("CU Code" => "string", "STATE" => "string", "Name" => "string", "Assets" => "number", "Members" => "number",
226  "Charter" => "number", "ES" => "string", "MBL" => "string", "iPh" => "string", "Andr" => "string", "PFM" => "string",
227  "RDC" => "string", "BillPay" => "string", "TXT" => "string")
228  ),
229  "notes" => array(
230  "title" => "Client Notes",
231  "sql" => "select user_name, comments, contract_notes, misc_notes from cuinfo where ((system_options & $SYS_TYPE_CLOSED) = 0) ",
232  "cols" => array("CU" => "string", "Comments" => "string", "Contract Notes" => "string", "Implementation Notes" => "string")
233  ),
234  "contract" => array(
235  "title" => "Contract Expiration",
236  "sql" => "select user_name, name, dec_31_assets, dec_31_mem, contract_expires, renewal_term,
237  (case when renewal_term < 2 or renewal_term is null then 1
238  when renewal_term > 1 and contract_expires > (date_trunc('month', current_date) - '1day'::interval)::date
239  then extract(years from age(date_trunc('month', contract_expires),date_trunc('month', current_date) - '1day'::interval))::int * 12
240  + extract(month from age(date_trunc('month', contract_expires),date_trunc('month', current_date) - '1day'::interval))::int
241  when renewal_term > 1 and contract_expires <= (date_trunc('month', current_date)-'1day'::interval)::date
242  then renewal_term - (abs(extract(years from age(date_trunc('month', contract_expires),
243  date_trunc('month', current_date) - '1day'::interval))::int * 12
244  + extract(month from age(date_trunc('month', contract_expires),
245  date_trunc('month', current_date)-'1day'::interval))::int) % renewal_term) end),
246  case when renewal_term >1 and contract_expires <= (date_trunc('month', current_date)-'1day'::interval)::date
247  then '**' else '' end, web_contract_expires, web_renewal_term, (case when web_renewal_term < 2 or web_renewal_term is null then 1
248  when web_renewal_term > 1 and web_contract_expires > (date_trunc('month', current_date)-'1day'::interval)::date
249  then extract(years from age(date_trunc('month', web_contract_expires),date_trunc('month', current_date) - '1day'::interval))::int * 12
250  + extract(month from age(date_trunc('month', web_contract_expires),date_trunc('month', current_date) - '1day'::interval))::int
251  when web_renewal_term > 1 and web_contract_expires <= (date_trunc('month', current_date) - '1day'::interval)::date
252  then web_renewal_term - (abs(extract(years from age(date_trunc('month', web_contract_expires),
253  date_trunc('month', current_date)-'1day'::interval))::int * 12
254  + extract(month from age(date_trunc('month', web_contract_expires),
255  date_trunc('month', current_date) - '1day'::interval))::int) % web_renewal_term) end),
256  case when web_renewal_term > 1 and web_contract_expires <= (date_trunc('month', current_date) - '1day'::interval)::date
257  then '**' else '' end from cuinfo
258  where ((system_options & $SYS_TYPE_CLOSED) = 0) ",
259  "cols" => array("CU" => "string", "Name" => "string", "Assets" => "number", "Members" => "number", "Banking Contract" => "date",
260  "Banking Renewal" => "number", "Banking Remaining" => "number", "Banking Renewed" => "string", "Web Contract" => "date",
261  "Web Renewal" => "number", "Web Remaining" => "number", "Web Renewed" => "string")
262  )
263  );
264 }
265 
266 // Data layer
267 // **************************************
268 
269 
270 /**
271  * function ReadReport($Cu, $dbh, $reportList, $defaultDateFormat)
272  * Returns the data needed from the parameters for the report:
273  *
274  * "report" -- the report to read. Refers to the $reportKey in the function getReportList(). The frontend sends the variable down as a javascript literal.
275  * "initial" -- {true/false} If initial, then also figure out the boolean DDLs and send those to the frontend to recreate the grid with those parameters.
276  * (There is no re-read.)
277  * "limit" -- How many records to return.
278  * "offset" -- Where to start in the resultset.
279  * "newFilter" -- {true/false} If newFilter, then also find out the count of the resultset. Also, ignore the offset. It will get the first page.
280  * "sort" -- This is a json encoded string of the current sort in the grid.
281  * "filter" -- This is a json encoded string of the current filter in the grid.
282  * "printerFriendly" -- printer friendly doesn't have paging.
283  *
284  * @param $Cu -- the credit union
285  * @param $dbh -- the database connection
286  * @param $reportList -- the reportList from the getReportList() above.
287  * @param $defaultDateFormat -- This is what the date will be formatted as.
288  */
289 function ReadReport($dbh, $reportList, $defaultDateFormat) {
290  $parameters = array("a" => array("report" => "", "initial" => "", "limit" => "", "offset" => "", "newFilter" => "", "sort" => "", "filter" => "",
291  "printerFriendly" => ""));
292  $string = array("filter" => HCUFILTER_INPUT_STRING);
293  HCU_ImportVars($parameters, "a", array("report" => $string, "initial" => $string, "limit" => $string, "offset" => $string, "newFilter" => $string,
294  "sort" => $string, "filter" => $string, "printerFriendly" => $string));
295 
296  $report = HCU_array_key_exists("report", $parameters["a"]) ? trim($parameters["a"]["report"]) : "";
297  $initial = HCU_array_key_exists("initial", $parameters["a"]) ? trim($parameters["a"]["initial"]) == "true" : false;
298  $limit = HCU_array_key_exists("limit", $parameters["a"]) ? intval($parameters["a"]["limit"]) : -1;
299  $offset = HCU_array_key_exists("offset", $parameters["a"]) ? intval($parameters["a"]["offset"]) : 0;
300  $newFilter = HCU_array_key_exists("newFilter", $parameters["a"]) ? trim($parameters["a"]["newFilter"]) == "true" : false;
301  $sort = HCU_array_key_exists("sort", $parameters["a"]) ? trim($parameters["a"]["sort"]) : "";
302  $filter = HCU_array_key_exists("filter", $parameters["a"]) ? trim($parameters["a"]["filter"]) : "";
303  $printerFriendly = HCU_array_key_exists("printerFriendly", $parameters["a"]) ? trim($parameters["a"]["printerFriendly"]) == "true" : false;
304 
305  $includeCount = !$printerFriendly && $newFilter;
306  $limit = $printerFriendly ? -1 : $limit;
307  $offset = $printerFriendly || $newFilter ? 0 : $offset;
308 
309  $returnArray = ReadReportData("", $reportList[$report], $dbh, $limit, $offset, $includeCount, false, $initial, false, $sort, $filter, $report, "info_reports");
310 
311  header('Content-type: application/json');
312  print HCU_JsonEncode($returnArray);
313 }
314 
315 /**
316  * function GenerateCSV($dbh, $reportList, $defaultDateFormat)
317  * Returns the CSV needed from the parameters for the report:
318  *
319  * "report" -- the report to read. Refers to the $reportKey in the function getReportList(). The frontend sends the variable down as a javascript literal.
320  * "sort" -- This is a json encoded string of the current sort in the grid.
321  * "filter" -- This is a json encoded string of the current filter in the grid.
322  * "title" -- This is an overwrite for the filename returned. Otherwise, it is the $title attribute in the getReportList() function.
323  *
324  * @param $Cu -- the credit union
325  * @param $dbh -- the database connection
326  * @param $reportList -- the reportList from the getReportList() above.
327  * @param $defaultDateFormat -- This is what the date will be formatted as.
328  */
329 function GenerateCSV($dbh, $reportList, $defaultDateFormat) {
330  $parameters = array("a" => array("report" => "", "sort" => "", "filter" => "", "title" => ""));
331  $string = array("filter" => HCUFILTER_INPUT_STRING);
332  HCU_ImportVars($parameters, "a", array("report" => $string, "sort" => $string, "filter" => $string, "title" => $string));
333 
334  $report = HCU_array_key_exists("report", $parameters["a"]) ? trim($parameters["a"]["report"]) : "";
335  $sort = HCU_array_key_exists("sort", $parameters["a"]) ? trim($parameters["a"]["sort"]) : "";
336  $filter = HCU_array_key_exists("filter", $parameters["a"]) ? trim($parameters["a"]["filter"]) : "";
337  $title = HCU_array_key_exists("title", $parameters["a"]) ? trim($parameters["a"]["title"]) : "";
338 
339  $reportValues = ReadReportData("", $reportList[$report], $dbh, -1, 0, true, true, false, false, $sort, $filter, $report, "info_reports");
340  $reportData = $reportValues["reportData"]["data"];
341 
342  PrintCSVData($reportData, $report, $title, $reportList, $defaultDateFormat);
343 }
344 
345 /**
346  * @todo: This report is not functioning in Mammoth or Odyssey.
347  * If this is needed, there is some work to move report to new reporting.i (vs old reports.i):
348  * Change #replaceString# functionality with "nonSqlDataFunc." @see GetRepeatingTransReport in cuReporting.prg.
349  * This report uses mmenu.html to check Spanish usage which was only true in Classic.
350  * Therefore, it won't work on Upgrade Mammoth or in Odyssey.
351  * A better solution to work on both Mammoth and Odyssey: language property in hcuSettings.i.
352  * Futhermore, only Miki has used this report and her last usage was 5 years ago.
353  */
354 
355 // function SehablaCount($pServer) {
356 
357 // $response = Array(); // Reset the array
358 
359 // $cmd = "https://nobody:no1home@{$pServer}.homecu.net/hcuadm/sehabla.pl";
360 // $cmd = "/usr/bin/curl " . escapeshellarg("-b HCUTicket=" . urlencode($_COOKIE['HCUTicket'])) . " " . escapeshellarg("$cmd");
361 // // ** Now pass the command to the command line
362 // // ** Take the command -- open a pipe -- then retrieve the information -- stuff into an array
363 
364 // if ($handle = popen($cmd, 'r')) {
365 // while (!feof ($handle)) {
366 // $getLine = fgets($handle, 4096);
367 // if (trim($getLine) != "") {
368 // $response[] = $getLine;
369 // }
370 // }
371 
372 // // ** Be sure to close the handle
373 // pclose($handle);
374 // }
375 
376 // return $response;
377 // }
378 
379 /**
380  * function MakeReportDDL()
381  * @return a list of reports with links for the top bar.
382  */
383 function MakeReportDDL() {
384  $reports = GetReportTitles();
385 
386  $reportDDL = array();
387  $reportMenuDDL = array();
388  foreach($reports as $value => $text) {
389  $reportDDL[] = array("value" => $value, "text" => $text);
390 
391  $reportMenuDDL[$text] = array("url" => "info_reports.prg?report=" . $value);
392  }
393  $reportMenuDDL = array("REDIRECT" => array("list" => array("Report List" => array("url" => "info_reports.prg"))),
394  "Other Reports" => array("list" => $reportMenuDDL), "Download CSV" => array("id" => "downloadCSVBtn"),
395  "Help &nbsp;<img src=\"/monitor/images/q1.gif\" border=\"0\" alt=\"View Help\" align=\"top\">" => array("id" => "helpBtn"));
396  return $reportMenuDDL;
397 }
398 
399 /**
400  * function PrintReportList($self)
401  * This prints out the main page with the report lists.
402  *
403  * @param $self -- reference to the URL of this script.
404  */
405 function PrintReportList($self) {
406  $title = "Select Info Report";
407  printMonitorPageTop($title, "", "", "", "", true);
408  printMonitorPageMiddle($title); ?>
409 
410  <div class="list-group">
411  <?php foreach(GetReportTitles() as $key => $value) { ?>
412  <a class="list-group-item list-group-item-action" href="<?php echo $self; ?>?report=<?php echo $key; ?>"><?php echo $value; ?></a>
413  <?php } ?>
414  </div>
415 <?php }
416 
417 /**
418  * function PrintReportPage($reportList, $report, $title, $self)
419  * Prints out the page for a report that is found.
420  *
421  * @param $reportList -- the reportList in getReportList().
422  * @param $csv -- If it is print, then do a printerFriendly version.
423  * @param $report -- the $reportKey in the function getReportList().
424  * @param $title -- the title of the report.
425  * @param $self -- the URL of this script. (&report=$report is appended for all calls.)
426  */
427 function PrintReportPage($reportList, $report, $title, $self) {
428  $reportSelf = "$self?report=$report";
429  printMonitorPageTop($title, "", "", "", "", true);
430  printMonitorPageMiddle($title, MakeReportDDL());
431  ?>
432 
433  <script type="text/javascript">
434 
435  <?php
436  getShowWaitFunctions();
437  GetIsFilterChanged();
438 
439  $pageSize = 30;
440  $pagesToShow = 10;
441 
442  InitReport($reportSelf, $report, $reportList, getDefaultDateFormat(), "true", $pageSize, false, "", "", "info_reports"); ?>
443 
444  var pageVariables = { <?php echo "skip: 0, page: 1, count: -1, numPages: -1, pageSize: " . $pageSize . ", pagesToShow: " . $pagesToShow ?> };
445 
446  <?php
447  /**
448  * function ShowNote()
449  * This shows the note for help
450  */
451  ?>
452  function ShowNote() {
453  var notification = $("#notification").kendoNotification({
454  position: {
455  pinned: true,
456  top: 118,
457  left: 128
458  },
459  show: function () {
460  notificationIsShown = true;
461  },
462  hide: function () {
463  notificationIsShown = false;
464  }
465  }).data("kendoNotification");
466 
467  var notifificationIsShown = false;
468  notification.info($("#noteTemplate").html());
469  }
470 
471  $(document).ready(function () {
472  $.homecuValidator.setup({formValidate: 'infoReportingDiv', formStatusField: 'formValidateMainDiv'});
473  InitReport();
474 
475  $("#helpBtn").click(function () {
476  ShowNote();
477  return false;
478  });
479  });
480  </script>
481 
482  <?php
483  /**
484  * @var noteTemplate
485  * This is the template for the help note.
486  */
487  ?>
488  <script id="noteTemplate" type="x/kendo-template">
489  <span class="k-icon k-i-filter"></span>
490  <b>To Filter: </b>Click on the (<span class="k-icon k-i-filter"></span>) icon in a column that you want to filter.
491  A dialog will pop up with filter value and options.<br>
492  <span class="k-icon k-i-arrow-n"></span>
493  <b>To Sort:</b> Click on a column (not on the (<span class="k-icon k-i-filter"></span>) icon).
494  That column will sort ascending.<br>
495  Column will show with the (<span class="k-icon k-i-arrow-n"></span>) icon. Click again and it will sort descending.<br>
496  Column will show with the (<span class="k-icon k-i-arrow-s"></span>) icon. A third click will clear the sort.
497  </script>
498 
499  <div class="container hcu-all-100 vsgPrimary" id="infoReportingDiv">
500 
501  <div id="notification"></div>
502 
503  <div class="row hcuSpacer">
504  <div class="col-xs-12">
505  <div id="formValidateMainDiv" style="display:none;"></div>
506  </div>
507  </div>
508 
509  <div class="row hcuSpacer">
510  <div class="col-xs-12">
511  <div class="reportGridOverflow">
512  <div id="reportGrid" class="hcu-no-td-border"></div>
513  </div>
514  </div>
515  </div>
516 
517  <iframe name="hiddenFrame" class="hide"></iframe>
518  <form id="downloadCSVForm" action="<?php echo $reportSelf; ?>&operation=generateCSV" method="post" target="hiddenFrame" style="display:none;">
519  <input name="title" value="<?php echo $title; ?>">
520  </form>
521  <form id="printForm" target="_blank" action="<?php echo $reportSelf; ?>&csv=print&title=<?php echo $title; ?>" method="post" style="display:none;">
522  <input name="report" value="<?php echo $report; ?>">
523  </form>
524  </div>
525 
526 <?php printMonitorPageBottom();
527 }
528 
529