13 $monLibrary = dirname(__FILE__) .
"/../library";
14 $sharedLibrary = dirname(__FILE__) .
"/../../shared/library";
15 $bankingLibrary = dirname(__FILE__) .
"/../../banking/library";
16 require_once(
"$monLibrary/cu_top.i");
17 require_once(
"$monLibrary/monitorView.i");
18 require_once(
"$sharedLibrary/reporting.i");
19 require_once(
"$sharedLibrary/commonJsFunctions.i");
20 require_once(
"$sharedLibrary/commonPhpFunctions.i");
30 $parameters = array(
"a" => array(
"operation" =>
"",
"cu" =>
""));
31 $string = array(
"filter" => FILTER_SANITIZE_STRING);
32 HCU_ImportVars($parameters,
"a", array(
"operation" => $string,
"cu" => $string));
34 $operation = HCU_array_key_exists(
"operation", $parameters[
"a"]) ? trim($parameters[
"a"][
"operation"]) :
"";
35 $cu = HCU_array_key_exists(
"cu", $parameters[
"a"]) ? strtoupper(trim($parameters[
"a"][
"cu"])) :
"";
37 $report =
"rdcstatus";
44 $reportList = array(
"rdcstatus" => array(
45 "title" =>
"Mobile RDC Inquiry",
46 "sql" =>
"select depositid, status, cu, accountnumber, amount, acctid, rdcvendor, starttime, lastupdate, frontaccept, 47 backaccept, vendorinfo, frontpath, backpath from curdcstatus where (current_timestamp - lastupdate) < interval '20 days'",
48 "cols" => array(
"Deposit ID" =>
"number",
"Status" =>
"list",
"Cu" =>
"string",
"Member" =>
"number",
"Amount" =>
"currency",
49 "Account" =>
"string",
"Vendor" =>
"string",
"Start" =>
"date",
"Update" =>
"date",
"Front" =>
"string",
"Back" =>
"string",
50 "info" =>
"ignore",
"frontpath" =>
"ignore",
"backpath" =>
"ignore"),
51 "ddl" => array(
"Status" => array(
"O" =>
"Open",
"S" =>
"Session Started",
"T" =>
"Terms Pending",
"R" =>
"Rejected",
"C" =>
"Completed",
52 "B" =>
"Blocked",
"F" =>
"Failed")),
53 "defaultSort" => array(
54 array(
"field" =>
"update",
"dir" =>
"desc"),
55 array(
"field" =>
"start",
"dir" =>
"desc")
60 $self = $_SERVER[
"PHP_SELF"];
61 $defaultDateFormat =
"MM/dd/yyyy HH:mm:ss";
64 if ($operation !=
"") {
67 ReadReport($cu, $dbh, $reportList, $defaultDateFormat);
73 header(
'Content-type: application/json');
74 $returnArray = array(
"error" => array(
"Operation not specified: '$operation'"),
"record" =>
"",
"operation" =>
"");
75 print HCU_JsonEncode($returnArray);
81 $reportRecord = $reportList[$report];
82 $title = !isset($reportRecord) ?
"Unrecognized Report" : (isset($reportRecord[
"title"]) ? $reportRecord[
"title"] : $report);
83 printMonitorPageTop($title, $homecuKendoVersion, $cloudfrontDomainName, $bootstrapVersion, $fontawesomeVersion,
true);
85 $filter = $cu ==
"" ?
"" : HCU_JsonEncode(array(
"field" =>
"cu",
"operator" =>
"eq",
"value" => $cu));
89 .k-notification-wrap {
98 white-space: pre-wrap;
110 <script type=
"text/javascript">
114 getShowWaitFunctions();
115 GetIsFilterChanged();
116 InitReport($self, $report, $reportList, $defaultDateFormat,
true, $pageSize,
false,
"", $filter);
119 var inNotification =
true;
120 var inShowClick =
true;
121 var activeWindows = [];
131 function OpenPopup(dataItem) {
132 var
template = kendo.template($(
"#popupTemplate").html());
134 var popup = $(
"#detailPopup").data(
"kendoWindow");
136 popup = $(
"<div id='detailPopup'></div>").appendTo(
"body").kendoWindow({
138 title:
"Deposit Details",
145 if (window.activeWindows !=
null) {
146 window.activeWindows.push(
this);
150 if (window.activeWindows !=
null) {
151 window.activeWindows.pop();
154 }).data(
"kendoWindow");
156 $(
"#detailPopup").on(
"click",
".imageLink",
function() {
157 var depositId =
"depositId=" + Number($(
"#detailPopup").data(
"depositid"));
158 var imageType =
"imageType=" + ($(
this).hasClass(
"front") ?
"front" :
"back");
159 var content =
"<img src='<?php echo $self; ?>?operation=getImage&" + depositId +
"&" + imageType +
"' width='100%'>";
160 var imagePopup = $(
"#imagePopup").data(
"kendoWindow");
161 if (imagePopup ==
null) {
162 imagePopup = $(
"<div id='detailPopup'></div>").appendTo(
"body").kendoWindow({
170 if (window.activeWindows !=
null) {
171 window.activeWindows.push(
this);
175 if (window.activeWindows !=
null) {
176 window.activeWindows.pop();
179 }).data(
"kendoWindow");
181 imagePopup.content(content).open().center();
185 $(
"#detailPopup").data(
"depositid", dataItem.depositId);
186 popup.content(
template(dataItem)).open().center();
192 var inRefresh =
false;
193 function ForceRefresh(data, parameters, filterChanged) {
195 parameters.includeCount =
"Y";
198 <?php
if ($cu ==
"") { ?>
199 parameters.saveFilter =
"Y";
203 $(document).ready(
function () {
204 InitReport({parameterMapFunc: ForceRefresh, preInitFunc:
function(gridDefinition) {
205 gridDefinition.columns[0] = {command: [{name:
"details", text:
"Details"}], width:
"30px"};
206 <?php
if ($cu !=
"") {
207 gridDefinition.columns[2].filterable =
false;
208 gridDefinition.columns[2].sortable =
false;
212 $(
"#refreshBtn").click(
function() {
213 var grid = $(
"#reportGrid").data(
"kendoGrid");
215 grid.dataSource.read();
219 $(
"#clearAllBtn").click(
function() {
220 var grid = $(
"#reportGrid").data(
"kendoGrid");
223 grid.dataSource.query({
224 sort: {field:
"depositId", dir:
"asc"},
225 <?php
if ($cu ==
"") { ?>
228 filter: {field:
"cu",
operator:
"eq", value:
"<?php echo $cu; ?>"},
230 pageSize: <?php echo $pageSize; ?>,
236 $(
"#reportGrid").on(
"click",
".k-grid-details",
function() {
237 var grid = $(
"#reportGrid").data(
"kendoGrid");
238 OpenPopup(grid.dataItem($(
this).closest(
"tr")));
241 <?php printClickOverlayEvent(); ?>
245 <script type=
"text/x-kendo-template" id=
"popupTemplate">
246 # var frontHTML = frontpath == "" ? "No Image" : "(<a href='\\#' class='imageLink front'>Image</a>)"; # 247 # var backHTML = backpath == "" ? "No Image" : "(<a href='\\#' class='imageLink back'>Image</a>)"; # 248 <div
class=
"overflowDiv">
249 <div
class=
"container-fluid">
250 <div
class=
"row hcuSpacer">
251 <div
class=
"col-xs-6"><label>Deposit ID</label></div>
252 <div
class=
"col-xs-6">#: depositId #</div>
254 <div
class=
"row hcuSpacer">
255 <div
class=
"col-xs-6"><label>Vendor</label></div>
256 <div
class=
"col-xs-6">#: vendor #</div>
258 <div
class=
"row hcuSpacer">
259 <div
class=
"col-xs-6"><label>Front Accepted</label></div>
260 <div
class=
"col-xs-6">#
if (front ==
"") { # # }
else if (front ==
"Y") { # Yes # }
else { # No # } # #= frontHTML #</div>
262 <div
class=
"row hcuSpacer">
263 <div
class=
"col-xs-6"><label>Back Accepted</label></div>
264 <div
class=
"col-xs-6">#
if (back ==
"") { # # }
else if (back ==
"Y") { # Yes # }
else { # No # } # #= backHTML #</div>
266 # if (info && info.trim() != "") { # 267 <div
class=
"row hcuSpacer">
268 <div
class=
"col-xs-12">#= info #</div>
274 <?php printMonitorPageMiddle($title, array(
"Refresh" => array(
"id" =>
"refreshBtn"),
"Clear All" => array(
"id" =>
"clearAllBtn"))); ?>
276 <div
class=
"loggingReportDiv container hcu-all-100 vsgPrimary" id=
"loggingReportDiv">
278 <div
id=
"notification"></div>
280 <div
class=
"row hcuSpacer">
281 <div
class=
"col-xs-12">
282 <div
id=
"formValidateMainDiv" class=
"k-block k-error-colored formValidateDiv" style=
"display:none;"></div>
286 <div
class=
"row hcuSpacer">
287 <div
class=
"col-xs-12">
288 <div
class=
"reportGridOverflow">
289 <div
id=
"reportGrid"></div>
294 <?php printMonitorPageBottom();
317 function ReadReport($Cu, $dbh, $reportList, $defaultDateFormat) {
318 $parameters = array(
"a" => array(
"report" =>
"",
"initial" =>
"",
"limit" =>
"",
"offset" =>
"",
"newFilter" =>
"",
"sort" =>
"",
"filter" =>
"",
"printerFriendly" =>
""));
319 $string = array(
"filter" => HCUFILTER_INPUT_STRING);
320 HCU_ImportVars($parameters,
"a", array(
"report" => $string,
"initial" => $string,
"limit" => $string,
"offset" => $string,
"newFilter" => $string,
"sort" => $string,
321 "filter" => $string,
"printerFriendly" => $string));
323 $report = HCU_array_key_exists(
"report", $parameters[
"a"]) ? trim($parameters[
"a"][
"report"]) :
"";
324 $initial = HCU_array_key_exists(
"initial", $parameters[
"a"]) ? trim($parameters[
"a"][
"initial"]) ==
"true" :
false;
325 $limit = HCU_array_key_exists(
"limit", $parameters[
"a"]) ? intval($parameters[
"a"][
"limit"]) : -1;
326 $offset = HCU_array_key_exists(
"offset", $parameters[
"a"]) ? intval($parameters[
"a"][
"offset"]) : 0;
327 $newFilter = HCU_array_key_exists(
"newFilter", $parameters[
"a"]) ? trim($parameters[
"a"][
"newFilter"]) ==
"true" :
false;
328 $sort = HCU_array_key_exists(
"sort", $parameters[
"a"]) ? trim($parameters[
"a"][
"sort"]) :
"";
329 $filter = HCU_array_key_exists(
"filter", $parameters[
"a"]) ? trim($parameters[
"a"][
"filter"]) :
"";
330 $printerFriendly = HCU_array_key_exists(
"printerFriendly", $parameters[
"a"]) ? trim($parameters[
"a"][
"printerFriendly"]) ==
"true" :
false;
332 $includeCount = !$printerFriendly && $newFilter;
333 $limit = $printerFriendly ? -1 : $limit;
334 $offset = $printerFriendly || $newFilter ? 0 : $offset;
336 $returnArray = ReadReportData($Cu, $reportList[$report], $dbh, $limit, $offset, $includeCount,
false, $initial,
false, $sort, $filter, $report,
"loggingReport");
338 header(
'Content-type: application/json');
339 print HCU_JsonEncode($returnArray);
347 function GetImage($dbh) {
348 $parameters = array(
"a" => array(
"depositId" =>
"",
"imageType" =>
""));
349 $string = array(
"filter" => HCUFILTER_INPUT_STRING);
350 HCU_ImportVars($parameters,
"a", array(
"depositId" => $string,
"imageType" => $string));
352 $depositId = HCU_array_key_exists(
"depositId", $parameters[
"a"]) ? intval($parameters[
"a"][
"depositId"]) : 0;
353 $imageType = HCU_array_key_exists(
"imageType", $parameters[
"a"]) ? trim($parameters[
"a"][
"imageType"]) :
"";
356 if (!in_array($imageType, array(
"front",
"back"))) {
357 throw new exception (
"Image type is invalid", 3);
359 $sql =
"select " . ($imageType ==
"front" ?
"frontpath" :
"backpath") .
" from curdcstatus where depositid = $depositId";
360 $sth = db_query($sql, $dbh);
362 throw new exception(
"Query invalid", 4);
364 $filepath = trim(db_fetch_row($sth,0)[0]);
365 if (!file_exists($filepath)) {
366 throw new exception (
"Image is not found", 1);
368 if (!is_readable($filepath)) {
369 throw new exception (
"Image is readable", 2);
371 header(
'Content-Type: image/jpeg');
373 }
catch(exception $e) {
375 $image = imagecreatetruecolor(120, 20);
377 $textColor = imagecolorallocate($image, 46, 46, 46);
378 $backgroundColor = imagecolorallocate($image, 255, 255, 255);
380 imagefill($image, 0, 0, $backgroundColor);
381 imagestring($image, 1, 5, 5, $e->getMessage(), $textColor);
383 header(
'Content-Type: image/png');
385 imagedestroy($image);