Odyssey
hcuTransferSchedule.prg
1 <?php
2 /*
3  * File: hcuTransferSchedule.prg
4  *
5  * Purpose: To set up and edit scheduled transfers.
6  *
7  *
8  * Form Validation:
9  *
10  * From Account - Required, FROM LIST PROVIDED
11  * may not match TO Account
12  * The Accounts may NOT have an acctclass of 'O'
13  * this will prevent special processing types to be scheduled
14  *
15  * TO Account - Required, FROM List Provided
16  * The Accounts may NOT have an acctclass of 'O'
17  * this will prevent special processing types to be scheduled
18  *
19  * Amount - Required, Less than the available balance of the From Account
20  * Comment - Optional, must be trimmed to specific length
21  */
22 // ** SET SCRIPT LEVEL VARIABLES
23 $serviceShowInfo = true;
24 $serviceLoadMenu = true;
25 $serviceShowMenu = true;
26 $serviceLiveCheck = true;
27 
28 // ** INCLUDE MAIN GLOBAL SCRIPT -- Handles security / global variable values
29 require_once(dirname(__FILE__) . '/../library/hcuService.i');
30 
31 // ** INCLUDE to access scheduled transfer functions
32 require_once(dirname(__FILE__) . '/../library/hcuTransferScheduled.i');
33 
34 /*
35  * ** CHECK USER FEATURE PERMISSIONS **
36  * NOTE: DOES NOT RETURN ON FAILURE
37  */
38 PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_SCHEDULED_TRANSFERS);
39 
40 
41 // ** INSERT BUSINESS LOGIC FOR THIS FORM
42 // * ONE OF THE FIRST THINGS -- GET THE ACCOUNT LIST
43 $Transfer_List_ary = TX_list($dbh, $HB_ENV, "", true);
44 setFmsgTxCookie($HB_ENV, $Transfer_List_ary);
45 
46 // ** Verify the feature is enabled for the Credit Union.
47  // * this is done by check the role 'transfernotify'
48 $sql = "SELECT email
49  FROM cuadmnotify
50  WHERE cu = '{$HB_ENV['Cu']}' AND role = 'transfernotify'";
51 $em_rs = db_query($sql, $dbh);
52 list($notifyemail) = db_fetch_array($em_rs, 0);
53 db_free_result($em_rs);
54 
55 /*
56  * Put the retrieval of the Available Trans Types higher in the code, this way
57  * I can check the CU has Cross-accounts enabled.
58  * They Fmsg_tx will never get set to a successful 32 , if Cross Accoutns
59  * are not enabled
60  */
61 $cuTransTypesAllowed = Get_HaveTrans($dbh, $HB_ENV);
62 
63 $disallowTransfersToDiffAccount = ($HB_ENV["flagset3"] & GetFlagsetValue("CU3_DISALLOW_MULT_ACCOUNTS_TRANSFER")) !== 0; // Careful how I phrase this because this doesn't prevent cross accounts.
64 
65 if (trim($notifyemail) == '' || (($HB_ENV['flagset2'] & GetFlagsetValue("CU2_PROCRECUR")) !== GetFlagsetValue("CU2_PROCRECUR"))) {
66  // * Feature NOT set
67  // * Include the Error page and exit
68  $serviceErrorMsg = $MC->msg('Option not set', HCU_DISPLAY_AS_HTML);
69  $serviceErrorCode = '915';
70 
71  require_once(dirname(__FILE__) . '/../includes/hcuErrorPage.i');
72  // ** DO NOT CONTINUE
73  exit;
74 } elseif ($HB_ENV['live'] && (($HB_ENV['Fset3'] & GetFlagsetValue('CU3_API_XAC')) && ($HB_ENV['Fmsg_tx'] & GetMsgTxValue('MSGTX_TMP_XAX_LD')) == 0)) {
75  // ** -- Evaluate the flag for retrieving XAC Packets
76  // ** Current Cross Account Data Not Retrieved
77  //$serviceErrorMsg = $MC->msg('Option not set', HCU_DISPLAY_AS_HTML);
78  $serviceErrorCode = '911';
79 
80  require_once(dirname(__FILE__) . '/../includes/hcuErrorPage.i');
81  // ** DO NOT CONTINUE
82  exit;
83 }
84 // ** SET VARIABLES FOR WEBSITE FLAGS
85 // ** Create an empty row
86 $acctFromListAry[] = Array("acctText" => '', "acctValue" => '', "acctAvail" => '', 'acctClass' => '');
87 $acctToListAry[] = Array("acctText" => '', "acctValue" => '', "acctAvail" => '', 'acctClass' => '');
88 $fromAccountCount = 0;
89 $toAccountCount = 0;
90 if (count($Transfer_List_ary['acctlist']) > 0) {
91  foreach ($Transfer_List_ary['acctlist'] as $acct_key => $acct_values) {
92 
93  /* BUILD FROM ACCOUNT */
94  $acctInfo = Array();
95  if ($acct_values['from'] == 'Y') {
96  switch ($acct_values['acctclass']) {
97  case 'O':
98  case 'M':
99  case 'X':
100  break;
101  default:
102  $acctInfo = Array(
103  Array("desc" => $MC->msg('Available', HCU_DISPLAY_AS_RAW), "value" => $acct_values['available']),
104  Array("desc" => $MC->msg('Balance', HCU_DISPLAY_AS_RAW), "value" => $acct_values['balance'])
105  );
106  break;
107  }
108 
109  // ** Decode the values so kendo can properly display any encoded characters. This seems to work for at least single quote
110  $acctFromListAry[] = Array(
111  "acctText" => htmlspecialchars_decode(mobile_displayhtml($acct_values['description']),ENT_QUOTES),
112  "acctValue" => mobile_displayhtml($acct_key),
113  "acctAvail" => $acct_values['available'],
114  "acctInfo" => $acctInfo,
115  "acctClass" => $acct_values['acctclass'],
116  "permissionAcct" => $acct_values["member"] // For cross and joint accounts, I need the account that it is under for determining if the transfer is allowed.
117  );
118  }
119 
120  /* BUILD TO ACCOUNT */
121 
122  if ($acct_values['to'] == 'Y' && $acct_values['acctclass'] != 'O') {
123  $acctInfo = Array();
124  $historyAcct = explode('|', $acct_key);
125 
126  /**
127  * When 'trust' is transfer, this is a Cross-Account, there is no information to specify, the values would be empty
128  */
129  if ($acct_values['trust'] != 'transfer'){
130  switch ($historyAcct[0]) {
131  case "D":
132  $acctInfo = Array(
133  Array("desc" => $MC->msg('Balance', HCU_DISPLAY_AS_RAW), "value" => $acct_values['balance'])
134  );
135  break;
136  case "L":
137  $acctInfo = Array(
138  Array("desc" => $MC->msg('Payoff', HCU_DISPLAY_AS_RAW), "value" => $acct_values['payoff']),
139  Array("desc" => $MC->msg('Balance', HCU_DISPLAY_AS_RAW), "value" => $acct_values['balance']),
140  Array("desc" => $MC->msg('Payment', HCU_DISPLAY_AS_RAW), "value" => $acct_values['paymentdue'])
141  );
142  break;
143  case "C":
144  $acctInfo = Array(
145  Array("desc" => $MC->msg('Payoff', HCU_DISPLAY_AS_RAW), "value" => $acct_values['payoff']),
146  Array("desc" => $MC->msg('Balance', HCU_DISPLAY_AS_RAW), "value" => $acct_values['balance']),
147  Array("desc" => $MC->msg('Payment', HCU_DISPLAY_AS_RAW), "value" => $acct_values['paymentdue'])
148  );
149  break;
150  }
151  }
152  $acctToListAry[] = Array(
153  "acctText" => htmlspecialchars_decode($acct_values['description'], ENT_QUOTES),
154  "acctValue" => mobile_displayhtml($acct_key),
155  "acctInfo" => $acctInfo,
156  'acctClass' => $acct_values['acctclass'],
157  "permissionAcct" => $acct_values["member"] // For cross and joint accounts, I need the account that it is under for determining if the transfer is allowed.
158  );
159  }
160  }
161 }
162 $transferFrequencyList = TxIntervalList($MC);
163 $transferContinueList = Array(
164  Array("value" => "continuous", "text" => $MC->msg('Transfer Continue Until', HCU_DISPLAY_AS_RAW) . ' ' .$MC->msg('Transfer Further Notice', HCU_DISPLAY_AS_RAW)),
165  Array("value" => "continueuntil", "text" => $MC->msg('Transfer Continue Until', HCU_DISPLAY_AS_RAW))
166 );
167 $transferScheduleStatus = Array(
168  Array('value' => 'A', 'text' => $MC->msg('Active', HCU_DISPLAY_AS_RAW)),
169  Array('value' => 'I', 'text' => $MC->msg('Inactive', HCU_DISPLAY_AS_RAW))
170 );
171 
172 // ** Retrieve the Terms of Use for SCHEDULED TRANSACTIONS
173 // ** the user needs to accept these in order to make a
174 // ** scheduled transaction from this screen.
175 $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC, "D", "rptTransferTerms", true);
176 
177 $hasTermsRPT = false;
178 $hasTermsPopupRPT = false;
179 $termsURLRPT = "";
180 $termsLinkDisplayRPT = "";
181 
182 if ( $noticesAry["status"]["code"] == "000" && HCU_array_key_exists('0', $noticesAry['notice'])) {
183  if ( $noticesAry["notice"][0]["notice_id"] ) {
184  $hasTermsRPT = true;
185  $noticeOption = $noticesAry['notice'][0];
186 
187  $noticeOptions = Array (
188  'docsid' => $noticeOption['notice_id'],
189  'docstype' => $noticeOption['notice_type'],
190  'device' => 'D',
191  'noticeOnly' => '0',
192  'expireTime' => mktime() + 86400
193  );
194 
195  $encryptedDocDetails= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
196 
197  $noticeOptions['noticeOnly'] = 1;
198 
199  $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
200 
201  // build the url encoded string
202  // * For the popup terms
203  $termsURLRPT = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetails);
204 
205  // * For the regular Button
206  $termsURLNoticeOnly = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetailsNoticeOnly);
207 
208  // see if there is a popup notice
209  $hasTermsPopupRPT = $noticeOption["notice_popup"] ? true : false;
210 
211  $termsButtonText = $noticeOption["notice_linkdisplay"];
212  }
213 }
214 
215 
216 // ** INCLUDE PRE CONTENT SCRIPT
217 require_once(dirname(__FILE__) . '/../includes/hcuPreContent.i');
218 
219 /*
220  * ** START CONTENT
221  */
222 $monthsToSchedule = 12;
223 
224 /**
225  * Start the schedule Tomorrow
226  */
227 $startScheduleDate = mktime(0, 0, 0, date('n'), date('d') + 1);
228 /**
229  * End the schedule using the setting above as a value for future months
230  */
231 $endScheduleDate = mktime(0, 0, 0, date('n') + $monthsToSchedule);
232 
233 // get some allowed amounts for client-side validation
234 // for internal funds transfer, external, member to member
235 // and ach commercial.
236 $perTransactionLimits = array(
237  FEATURE_TRANSFERS,
238  FEATURE_EXTERNAL_TRANSFERS,
239  FEATURE_M2M_TRANSFERS,
240  FEATURE_ACH_PAYMENTS,
241  FEATURE_ACH_COLLECTIONS
242 );
243 $perTransactionAmounts = array();
244 
245 foreach ($perTransactionLimits as $key => $value) {
246  $permissionInputs = array("feature" => $value);
247  $limits = Perm_GetValidationLimits( $dbh, $HB_ENV, $permissionInputs );
248 
249  if ($limits === false) {
250  $perTransactionAmounts[$value] = 0;
251  } else {
252  $perTransactionAmounts[$value] = floatval( $limits["amount_per_transaction"] );
253  }
254 }
255 ?>
256 
257 <style type="text/css">
258 .hcu-cursor-pointer {
259  cursor: pointer;
260 }
261 
262 .account_active {
263  color: green;
264 }
265 
266 .account_inactive {
267  color: red;
268 }
269 
270 .account_cell_desc {
271  width: 50%;
272  float: left;
273 
274  text-align: left;
275 }
276 
277 .account_cell_value {
278  width: 50%;
279  float: left;
280 
281  text-align: right;
282 }
283 
284 @media only screen and (max-width: 500px) {
285 .account_cell_desc {
286  width: 100%;
287  text-align: left;
288 }
289 
290 .account_cell_value {
291  width: 100%;
292  text-align: left;
293  }
294 }
295 @media (max-width: 767px) {
296  .hcu-calendar-wrap {
297  text-align: center;
298  }
299 }
300 @media (min-width: 767px) {
301  .local-sm-auto-width {
302  width: auto;
303  }
304 }
305 #formSchedule .field-label-wrapper { padding: 5px 5px 5px 20px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
306 #formSchedule .field-label-wrapper label { display: block; padding: 10px 0 6px 4px; color: #333333; font-size:1.2em; margin-left: -10px; width: 100%;}
307 #formSchedule .field-label-wrapper label hr { z-index: 0; display:inline-block; width: 100%; position:relative; top:-24px;background-color:#000000;}
308 
309 
310 #hcuCalendarSchedule {
311  width: 270px;
312  text-align: center;
313  margin: 10px 0 0 0px;
314  font-size:14px;
315 }
316 #hcuCalendarSchedule .k-content {
317  height: 240px;
318 }
319 #hcuCalendarSchedule,
320 #hcuCalendarSchedule .k-content,
321 #hcuCalendarSchedule .k-header,
322 #hcuCalendarSchedule th,
323 #hcuCalendarSchedule .k-link,
324 #hcuCalendarSchedule .k-state-focused {
325  box-shadow: none;
326 }
327 #hcuCalendarSchedule td.k-state-selected {
328  background: transparent;
329 }
330 #hcuCalendarSchedule .k-state-selected .k-link,
331 #hcuCalendarSchedule .k-state-selected .k-link .k-state-selected {
332  font-weight: bold;
333  color: black;
334 }
335 #hcuCalendarSchedule .k-state-hover {
336  background: transparent;
337  border-color: transparent;
338  box-shadow: none;
339 }
340 #hcuCalendarSchedule .k-content .k-state-hover,
341 #hcuCalendarSchedule .k-content .k-state-focused {
342  font-size: 14px;
343  font-weight: bold;
344 }
345 #hcuCalendarSchedule .k-state-selected, #hcuCalendarSchedule .k-state-selected.k-state-focused
346 {
347  font-size: 24px;
348  font-weight: bold;
349 }
350 
351 #hcuCalendarSchedule .k-content .k-link {
352  padding: 0;
353  min-height: 40px;
354  line-height: .8em;
355 }
356 
357 #hcuCalendarSchedule th {
358  padding-top: 20px;
359  color: #8cbabf;
360 }
361 #hcuCalendarSchedule td.k-other-month .k-link {
362  color: #8cbabf;
363 }
364 #hcuCalendarSchedule th,
365 #hcuCalendarSchedule td {
366  text-align: center;
367 }
368 
369 #hcuTableScheduled tbody tr:hover {
370  cursor: pointer;
371 }
372 
373 #hcuTableScheduled {
374  margin: 10px 0 0 0px;
375 }
376 
377 #hcuCalendarSchedule .calDateBox {
378  height: 40px;
379  background: #e1e1e1;
380 }
381 #hcuCalendarSchedule .calDateBox .calDate {
382  border-top: 2px solid red;
383 }
384 #hcuCalendarSchedule .k-state-selected .calDateBox .calDate {
385  border-top: 2px solid #70c114;
386 }
387 
388 #hcuCalendarSchedule .calDate {
389  font-size: 12px;
390  margin-top: 2px;
391  line-height: 1.5em;
392 }
393 #hcuCalendarSchedule .calDateCnt {
394  font-size: 10px;
395  text-align: right;
396  padding-right: 5px;
397  line-height: 1.5em;
398 }
399 .scheduleUpdate {
400  display: none;
401 }
402 .scheduleNew {
403  display: block;
404 }
405 
406 .k-grid-toolbar {
407  text-align: right;
408 }
409 
410 </style>
411 
412 <div class="container-fluid" id="scheduledTransferScreen" style="display: none;">
413 
414  <div class="well well-sm col-xs-12">
415  <h3><?php echo $MC->msg("Scheduled Transactions", HCU_DISPLAY_AS_HTML); ?></h3>
416 
417  <div class="row">
418  <div class="col-sm-3">
419  <a href role="button" href="#" class="k-button hcu-all-100" id="btnNewSchedule"
420  style="margin-top: 7.5px; margin-bottom: 7.5px;">
421  <span class="fa fa-plus"></span>
422  <span>&nbsp;<?php echo $MC->msg('Add Schedule', HCU_DISPLAY_AS_HTML); ?></span>
423  </a>
424  </div>
425 
426  <div class="col-sm-3">
427  <a href role="button" href="#" class="k-button hcu-all-100" id="btnGroupCalendar"
428  style="display: none; margin-top: 7.5px; margin-bottom: 7.5px;">
429  <span class="fa fa-calendar"></span>
430  <span>&nbsp;<?php echo $MC->msg("Calendar View", HCU_DISPLAY_AS_HTML); ?></span>
431  </a>
432 
433  <a href role="button" href="#" class="k-button hcu-all-100" id="btnGroupList"
434  style="margin-top: 7.5px; margin-bottom: 7.5px;">
435  <span class="fa fa-list-alt"></span>
436  <span>&nbsp;<?php echo $MC->msg("List View", HCU_DISPLAY_AS_HTML); ?></span>
437  </a>
438  </div>
439  </div>
440 
441  <div class="row" style="margin-top: 15px;">
442  <div class="col-xs-12">
443  <div class="" id="hcuCalendarSchedule"></div>
444  </div>
445  </div>
446 
447  <div class="row" style="margin-top: 15px;">
448  <div class="col-xs-12">
449  <div class="" id="hcuTableScheduled"></div>
450  </div>
451  </div>
452  </div>
453 </div>
454 
455 
456 
457 <div id="editWindow" name="editWindow" style="display: none;" class="container-fluid"><!-- DISPLAY NONE -->
458  <div id='editErrors'></div>
459  <div class="well well-sm col-sm-12">
460 
461  <form id="formSchedule" name="formSchedule">
462  <input type='hidden' name='txFromMember'> <?php // Needed for preventing transfers between accounts (#1568). ?>
463  <input type='hidden' name='txToMember'>
464  <!-- FROM ACCOUNT -->
465  <fieldset style="margin-top: 7.5px; margin-bottom: 7.5px;">
466  <div class="col-xs-12">
467  <label for="transferFrom"><?php echo $MC->msg('From', HCU_DISPLAY_AS_HTML); ?></label>
468  <input id="transferFrom" class="distinctAcct hcu-all-100" name="transferFrom"
469  required
470  data-required-msg="<?php echo $MC->msg('Select From', HCU_DISPLAY_AS_HTML);?>"
471  data-role="dropdownlist"
472  data-value-field="acctValue"
473  data-text-field="acctText"
474  data-bind="
475  source: localSourceAcctListAry,
476  value: selectedSchedule.txFromSuffix,
477  enabled: isNew,
478  visible: isNew,
479  events: {change: changeAccount}" />
480  <div data-bind="visible: isUpdate">
481  <div class="col-sm-12" >
482  <div class="static-control-label" data-bind="text:selectedSchedule.txFromDesc"></div>
483  </div>
484  </div>
485  <span class="k-invalid-msg" data-for="transferFrom" title="">
486  <span class="k-icon k-warning"></span>
487  </span>
488  </div>
489  </fieldset>
490 
491  <!-- TO ACCOUNT -->
492  <fieldset style="margin-top: 7.5px; margin-bottom: 7.5px;">
493  <div class="col-xs-12">
494  <label for="transferTo"><?php echo $MC->msg('To', HCU_DISPLAY_AS_HTML); ?></label>
495  <input id="transferTo" class="distinctAcct hcu-all-100" name="transferTo"
496  required
497  homecu-distinct="distinctAcct"
498  data-required-msg="<?php echo $MC->msg('Select To', HCU_DISPLAY_AS_HTML);?>"
499  data-homecuCustomDistinct-msg="
500  <?php echo $MC->msg('Selected the Same Accounts', HCU_DISPLAY_AS_HTML); ?>"
501  data-role="dropdownlist"
502  data-value-field="acctValue"
503  data-text-field="acctText"
504  data-auto-bind="false"
505  data-bind="
506  source: toAcctDataSource,
507  value: selectedSchedule.txToSuffix,
508  enabled: hasToRecords,
509  visible: isNew,
510  events: {change: changeAccount}" />
511  <div data-bind="visible: isUpdate">
512  <div class="col-sm-12" >
513  <div class="static-control-label" data-bind="text:selectedSchedule.txToDesc"></div>
514  </div>
515  </div>
516  <span class="k-invalid-msg" data-for="transferTo" title="">
517  <span class="k-icon k-warning"></span>
518  </span>
519  </div>
520  </fieldset>
521 
522  <fieldset style="margin-top: 7.5px; margin-bottom: 7.5px;">
523  <!-- AMOUNT -->
524  <div class="col-xs-12">
525  <label for="transferAmount"><?php echo $MC->msg('Amount', HCU_DISPLAY_AS_HTML); ?></label>
526  <input id="transferAmount" class="hcu-all-100" name="transferAmount" type="number"
527  required
528  data-required-msg="<?php echo $MC->msg('Enter Amount', HCU_DISPLAY_AS_HTML);?>"
529  data-role="numerictextbox"
530  data-max="9999999"
531  data-min="0.01"
532  data-spinners="false"
533  data-format="c"
534  data-step="1"
535  data-bind="
536  value: selectedSchedule.txAmount,
537  events: {change: change}" />
538  <span class="k-invalid-msg" data-for="transferAmount" title="">
539  <span class="k-icon k-warning"></span>
540  </span>
541  </div>
542  </fieldset>
543 
544  <fieldset style="margin-top: 7.5px; margin-bottom: 7.5px;">
545  <!-- FREQUENCY -->
546  <div class="col-xs-12">
547  <label for="transferFrequency"><?php echo $MC->msg('Repeat', HCU_DISPLAY_AS_HTML); ?></label>
548  <input class="hcu-all-100" id="transferFrequency" name="transferFrequency" required
549  data-role="dropdownlist"
550  data-value-field="value"
551  data-text-field="text"
552  data-bind="
553  source: localSourceFreqListAry,
554  value: selectedSchedule.txFrequency,
555  events: {change: changeFrequency}" />
556  <span class="k-invalid-msg" data-for="transferFrequency" title="">
557  <span class="k-icon k-warning"></span>
558  </span>
559  </div>
560  </fieldset>
561 
562  <fieldset style="margin-top: 7.5px; margin-bottom: 7.5px;">
563  <!-- TRANSFER ON -->
564  <div class="col-xs-12 col-sm-6">
565  <label for="transferOnDate"><?php echo $MC->msg('Transfer On', HCU_DISPLAY_AS_HTML); ?></label>
566  <input class="hcu-all-100" id="transferOnDate" name="transferOnDate" type="text"
567  placeholder="eg. MM/DD/YYYY"
568  required
569  homecu-match="date"
570  homecu-dategtvalue="<?php echo date('m/d/Y'); ?>"
571  data-required-msg="
572  <?php echo $MC->msg('Transfer On', HCU_DISPLAY_AS_HTML) ?>:
573  <?php echo $MC->msg('is a Required Field', HCU_DISPLAY_AS_HTML); ?>"
574  data-homecuCustomMatch-msg="
575  <?php echo $MC->msg('Transfer On', HCU_DISPLAY_AS_HTML) ?>:
576  <?php echo $MC->msg('is not a valid date', HCU_DISPLAY_AS_HTML); ?>"
577  data-homecuCustomDateGTValue-msg="
578  <?php echo $MC->msg('Transfer On', HCU_DISPLAY_AS_HTML) ?>:
579  <?php echo $MC->msg('must be future date', HCU_DISPLAY_AS_HTML); ?>"
580  data-role="datepicker"
581  data-format="MM/dd/yyyy"
582  data-bind="
583  value: selectedSchedule.txDateStart,
584  events: {change: change}" />
585  <span class="k-invalid-msg" data-for="transferOnDate" title="">
586  <span class="k-icon k-warning"></span>
587  </span>
588  </div>
589 
590  <div class="col-xs-12 col-sm-6">
591  <label>&nbsp;</label>
592  <button class="hcu-all-100 k-button" id="transferSkip"
593  data-bind="
594  disabled: disableSkip,
595  events: { click: scheduleSkip }
596  ">
597  <?php echo $MC->msg('Skip Transaction', HCU_DISPLAY_AS_HTML); ?>
598  </button>
599  </div>
600  </fieldset>
601 
602  <fieldset style="margin-top: 7.5px; margin-bottom: 7.5px;">
603  <!-- CONTINUE UNTIL -->
604  <div class="col-xs-12"
605  data-bind="visible: isRepeat">
606  <input class="hcu-all-100" id="transferContUntil" name="transferContUntil"
607  data-role="dropdownlist"
608  data-value-field="value"
609  data-text-field="text"
610  data-bind="
611  source: localSourceContListAry,
612  value: selectedSchedule.txContinue,
613  events: {change: changeContUntil}" />
614  </div>
615  </fieldset>
616 
617  <fieldset style="margin-top: 7.5px; margin-bottom: 7.5px;">
618  <!-- END DATE -->
619  <div class="col-xs-12"
620  data-bind="visible: showContDate">
621  <input class=" hcu-all-100" type="text" id="transferRptUntilDate" name="transferRptUntilDate"
622  placeholder="eg. MM/DD/YYYY"
623  homecu-match="date"
624  homecu-dategtvalue="transferOnDate"
625  homecu-dategttype="field"
626  data-required-msg="<?php echo $MC->msg('Continue Until must be entered', HCU_DISPLAY_AS_HTML); ?>"
627  data-homecuCustomMatch-msg="<?php echo $MC->msg('Transfer Continue Until', HCU_DISPLAY_AS_HTML) . ' ' . $MC->msg('is not a valid date', HCU_DISPLAY_AS_HTML); ?>"
628  data-homecuCustomDateGTValue-msg="<?php echo $MC->msg('Stop date after transfer', HCU_DISPLAY_AS_HTML); ?>"
629  data-role="datepicker"
630  data-format="MM/dd/yyyy"
631  data-bind="
632  value: selectedSchedule.txDateEnd,
633  events: { change: change }" />
634  <span class="k-invalid-msg" data-for="transferRptUntilDate" title="">
635  <span class="k-icon k-warning"></span>
636  </span>
637  </div>
638  </fieldset>
639 
640  <fieldset style="margin-top: 7.5px; margin-bottom: 7.5px;">
641  <!-- ACTIVE STATUS-->
642  <div class="col-xs-12" data-bind="visible: isUpdate">
643  <label for="transferActive">Status</label>
644  <input class="hcu-all-100" id='transferActive' name='transferActive'
645  data-role="dropdownlist"
646  data-value-field="value"
647  data-text-field="text"
648  data-bind="
649  source: localScheduleStatusAry,
650  value: selectedSchedule.txStatus,
651  events: { change: changeStatus }" />
652  <span class="k-invalid-msg" data-for="transferActive" title="">
653  <span class="k-icon k-warning"></span>
654  </span>
655  </div>
656  </fieldset>
657  </form>
658  </div>
659  <div class="hcu-template">
660  <div class="hcu-edit-buttons k-state-default">
661  <span class="hcu-icon-delete">
662  <a href="##" id="lnkDelete"
663  data-bind="
664  visible: isUpdate,
665  events:{ click: scheduleDelete, enabled: selectedSchedule.txId }">
666  <i class="fa fa-trash fa-lg"></i>
667  </a>
668  </span>
669  <a href="##" id="lnkCancel" style=""
670  data-bind="events:{ click: scheduleCancel }"><?php echo $MC->msg("Cancel", HCU_DISPLAY_AS_HTML); ?></a>
671  &emsp;
672  <a href="##" id="btnUpdate" class="k-button k-primary"
673  data-bind="
674  events:{ click: scheduleSave }">
675  <i class="fa fa-check fa-lg"></i><?php echo $MC->msg("Update", HCU_DISPLAY_AS_HTML); ?>
676  </a>
677  </div>
678  </div>
679 
680  <div id="hcuDiscard">
681  <p><?php echo $MC->msg("Scheduled Transaction Changed", HCU_DISPLAY_AS_HTML); ?></p>
682  <p><?php echo $MC->msg("ACH Discard Changes?", HCU_DISPLAY_AS_HTML); ?></p>
683  </div>
684  <div class="" id="hcuDelete">
685  <p><?php echo $MC->msg("Scheduled Transaction Deleted", HCU_DISPLAY_AS_HTML); ?> </p>
686  <p><?php echo $MC->msg("ACH Continue", HCU_DISPLAY_AS_HTML); ?></p>
687  </div>
688  <div class="" id="hcuSkip">
689  <p><?php echo $MC->msg("Skip Transaction Msg", HCU_DISPLAY_AS_HTML); ?> </p>
690  <p><?php echo $MC->msg("Skip Transaction Confirm", HCU_DISPLAY_AS_HTML); ?></p>
691  </div>
692  <div id='gridToolbar' style="display: none;">
693  <label class="filter-label" for="filter">Filter Transactions:</label><input type="search" id="filter" style="width: 100px; margin-left: 5px;"/>
694 </div>
695 </div>
696 
697 <script>
698  var dsAction = null;
699  var dsScheduled = null;
700  var toAcctDataSource = null;
701  var viewScheduled = null;
702  var wnd = null;
703  var wndDiscard = null;
704  var wndDelete = null;
705  var wndSkip = null;
706  var txSkip = false;
707 
708  var dateSelected = null;
709  var currentView = null;
710  var scheduleTip = null;
711 
712  var window_stack = [];
713  var scheduleDates = [];
714  var scheduledRecords = [];
715  var scheduledDatesRecords = [];
716 
717  var sourceFreqListAry = <?php echo HCU_JsonEncode($transferFrequencyList);?>;
718  var sourceContListAry = <?php echo HCU_JsonEncode($transferContinueList);?>;
719  var scheduleStatusAry = <?php echo HCU_JsonEncode($transferScheduleStatus); ?>;
720  var sourceAcctListAry = <?php echo HCU_JsonEncode($acctFromListAry); ?>;
721  var targetAcctListAry = <?php echo HCU_JsonEncode($acctToListAry); ?>;
722  var perTransactionAmounts = <?php echo HCU_JsonEncode($perTransactionAmounts); ?>;
723 
724  // check for notices
725  var terms = <?php echo HCU_JsonEncode($hasTermsRPT && $hasTermsPopupRPT); ?>;
726 
727  var today = new Date();
728 
729  //KENDO GRID FOR MOBILE TABLE
730  var mbl_col_template = "";
731 
732  function getAcctSeg(pField, pSeg) {
733  var field_name = pField === 'from' ? 'transferFrom' : 'transferTo';
734  var value = '';
735 
736  var list_field = $("#" + field_name).data("kendoDropDownList");
737  var data_item = list_field.dataItem(list_field.select());
738  var data_value = data_item.acctValue;
739  var data_segments = data_value.split("|");
740 
741  if (data_value !== undefined) {
742  switch (pSeg) {
743  case "type":
744  value = data_segments[0];
745  break;
746  case "acct":
747  value = data_segments[1];
748  break;
749  case "sfx":
750  value = data_segments[2];
751  break;
752  case "permissionAcct":
753  value = data_item["permissionAcct"]; <?php // Could not exist in the case of adhoc M2M or any new features. Using the dot syntax will give an error. ?>
754  break;
755  }
756  }
757 
758  return value;
759  }
760 
761  function callMe(pValue) {
762 
763  var lookupDate = kendo.toString(pValue.date, 'MM/dd/yyyy');
764  if (scheduledDatesRecords[lookupDate]) {
765  var scheduledItems = scheduledDatesRecords[lookupDate];
766  return scheduledItems.length;
767  } else {
768  return '';
769  }
770  }
771 
772  function ShowToolTip(e) {
773  return $(e.target).text().trim();
774  }
775 
776  function setDataAttributes(showContinue, showEnd) {
777  if (showContinue) {
778  $("label[for='transferOnDate']").text("<?php echo $MC->msg('Transfer Start On', HCU_DISPLAY_AS_JS); ?>");
779  $("#transferOnDate").attr("data-required-msg",
780  "<?php echo $MC->msg('Transfer Start On', HCU_DISPLAY_AS_HTML) ?>: " +
781  "<?php echo $MC->msg('is a Required Field', HCU_DISPLAY_AS_HTML); ?>");
782  $("#transferOnDate").attr("data-homecuCustomMatch-msg",
783  "<?php echo $MC->msg('Transfer Start On', HCU_DISPLAY_AS_HTML) ?>: " +
784  "<?php echo $MC->msg('is not a valid date', HCU_DISPLAY_AS_HTML); ?>");
785  $("#transferOnDate").attr("data-homecuCustomDateGTValue-msg",
786  "<?php echo $MC->msg('Transfer Start On', HCU_DISPLAY_AS_HTML) ?>: " +
787  "<?php echo $MC->msg('must be future date', HCU_DISPLAY_AS_HTML); ?>");
788  } else {
789  $("label[for='transferOnDate']").text("<?php echo $MC->msg('Transfer On', HCU_DISPLAY_AS_JS); ?>");
790  $("#transferOnDate").attr("data-required-msg",
791  "<?php echo $MC->msg('Transfer On', HCU_DISPLAY_AS_HTML) ?>: " +
792  "<?php echo $MC->msg('is a Required Field', HCU_DISPLAY_AS_HTML); ?>");
793  $("#transferOnDate").attr("data-homecuCustomMatch-msg",
794  "<?php echo $MC->msg('Transfer On', HCU_DISPLAY_AS_HTML) ?>: " +
795  "<?php echo $MC->msg('is not a valid date', HCU_DISPLAY_AS_HTML); ?>");
796  $("#transferOnDate").attr("data-homecuCustomDateGTValue-msg",
797  "<?php echo $MC->msg('Transfer On', HCU_DISPLAY_AS_HTML) ?>: " +
798  "<?php echo $MC->msg('must be future date', HCU_DISPLAY_AS_HTML); ?>");
799  }
800 
801  if (showEnd) {
802  $("#transferRptUntilDate").attr("required", true);
803  } else {
804  $("#transferRptUntilDate").removeAttr("required");
805  $("#transferRptUntilDate").data("kendoDatePicker").value("");
806  }
807 
808  var today = new Date();
809  var tomorrow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
810  var dayafter = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 2);
811 
812  $("#transferOnDate").data("kendoDatePicker").min(tomorrow);
813  $("#transferRptUntilDate").data("kendoDatePicker").min(dayafter);
814  }
815 
816  // ** used to set any values that get wiped
817  // ** for example, some schedules may have a start date prior to
818  // ** tomorrow so the field will have nothing in it.
819  // ** for these cases set the values here.
820  function setDataValues() {
821  // * set start date
822  var dateStart = viewScheduled.selectedSchedule.txDateStart;
823  var dateFormat = kendo.toString(new Date(dateStart), "MM/dd/yyyy");
824  $("#transferOnDate").val(dateFormat);
825  }
826 
827  function openEditSchedule() {
828  $.homecuValidator.settings.formStatusField = "editErrors";
829  $.homecuValidator.hideMessage();
830  $.homecuValidator.setup({
831  formValidate: "formSchedule",
832  validateOnClick: 'btnUpdate',
833  formErrorTitle: "<?php echo $MC->msg("Error Occurred", HCU_DISPLAY_AS_JS) ?>",
834  formStatusField: "editErrors"});
835  kendo.bind('#editWindow', viewScheduled);
836 
837  // set min/max values for datepickers
838  setDataAttributes(viewScheduled.isRepeat, viewScheduled.showContDate);
839  setDataValues();
840 
841  wnd.title(viewScheduled.isNew ? '<?php echo $MC->msg("New Scheduled Transaction"); ?>' : '<?php echo $MC->msg("Edit Scheduled Transaction"); ?>');
842  wnd.center();
843  wnd.open();
844  }
845 
846  function changeScheduledView() {
847  dateSelected = kendo.toString(this.value(), 'MM/dd/yyyy');
848  var dateFormat = kendo.toString(this.value(), 'D');
849  var dateItems =
850  scheduledDatesRecords[dateSelected] ?
851  scheduledDatesRecords[dateSelected] :
852  [];
853  var dateFilters = [];
854  for (var i = 0; i < dateItems.length; i++) {
855  dateFilters.push({
856  field: "txId",
857  operator: "eq",
858  value: dateItems[i]
859  });
860  }
861 
862  if (dateFilters.length > 0) {
863  $("#hcuTableScheduled").data("kendoGrid").dataSource.filter({
864  logic: "or",
865  filters: dateFilters
866  });
867  } else {
868  $("#hcuTableScheduled").data("kendoGrid").dataSource.filter({
869  field: "txId",
870  operator: "eq",
871  value: -1
872  });
873  }
874 
875  }
876 
877  function SwitchView(showView) {
878  if (showView == "list") {
879  $("#hcuCalendarSchedule").hide();
880 
881  $("#filter").data("kendoDropDownList").select(0);
882 
883  } else if (showView == "calendar") {
884  $("#hcuCalendarSchedule").show();
885  $("#hcuCalendarSchedule").data("kendoCalendar").trigger("change");
886  }
887 
888  // default to showing current active scheduled transfers
889  var allFilters = [];
890  allFilters.push({ field: "txStatus", operator: "eq", value: 'A' });
891  allFilters.push({ field: "txApproved", operator: "eq", value: '10' });
892 
893  var currentDate = kendo.toString(new Date(), "MM/dd/yyyy");
894  allFilters.push({ field: "txDateNext", operator: "gte", value: currentDate });
895 
896  $("#hcuTableScheduled").data("kendoGrid").dataSource.filter({ logic: "and", filters: allFilters});
897  }
898 
899  function returnUTCDate(localDate) {
900  return Date.UTC(localDate.getFullYear(), localDate.getMonth(), localDate.getDate());
901  }
902 
903  function BuildCalendar() {
904  // should I destroy first
905  var curDate;
906  if ($('#hcuCalendarSchedule').html() !== '') {
907  var calendar = $("#hcuCalendarSchedule").data("kendoCalendar");
908  curDate = calendar.current();
909  calendar.destroy();
910  $("#hcuCalendarSchedule").html('');
911  }
912 
913  $('#hcuCalendarSchedule').kendoCalendar({
914  dates: scheduledDates,
915  value: dateSelected,
916  min: new Date(<?php echo date('Y', $startScheduleDate) . ', ' . (date('m', $startScheduleDate) - 1) . ', ' . date('d', $startScheduleDate); ?>),
917  max: new Date(<?php echo date('Y', $endScheduleDate) . ', ' . (date('m', $endScheduleDate) - 1) . ', ' . date('d', $endScheduleDate); ?>),
918  month: {
919  // template for dates in month view
920  content:
921  '# if ($.inArray(returnUTCDate(data.date), data.dates) != -1) { #' +
922  '<div class="calDateBox">' +
923  '<div class="calDate">#= data.value #</div>' +
924  '<div class="calDateCnt">#= callMe(data) #</div>' +
925  '</div>' +
926  '# } else { #' +
927  '<div class="">' +
928  '<div class="calDate">#= data.value #</div>' +
929  '<div class="calDateCnt"></div>' +
930  '</div>' +
931  '# } #'
932  },
933  change: changeScheduledView,
934  footer: false
935 
936  });
937 
938  if ($('#btnGroupCalendar').parent().hasClass('k-state-selected')) {
939  var calendar = $("#hcuCalendarSchedule").data("kendoCalendar");
940 
941  curDate = calendar.navigateDown(curDate);
942 
943  }
944 
945  $('#hcuCalendarSchedule').data('kendoCalendar').trigger('change');
946  }
947 
948  function InitDataSources() {
949 
950  dsScheduled = new kendo.data.DataSource ({
951  autoSync: false,
952  batch: false,
953  pageSize: 10,
954  serverFiltering: false,
955  serverPaging: false,
956  cache: false,
957  transport: {
958  read: {
959  type: "GET",
960  url: 'hcuTransfer.data',
961  dataType: "json",
962  contentType: 'application/json',
963  data: {
964  form: 'schedule',
965  action: 'readSchedule',
966  cu: '<?php echo $HB_ENV['cu']; ?>'
967  },
968  cache: false
969  },
970  update: {
971  type: "POST",
972  url: 'hcuTransfer.data?cu=<?php echo $HB_ENV['cu']; ?>',
973  contentType: "application/x-www-form-urlencoded",
974  cache: false,
975  data: {
976  form: 'schedule',
977  action: 'updateSchedule'
978  }
979  },
980  create: {
981  type: "POST",
982  url: 'hcuTransfer.data?cu=<?php echo $HB_ENV['cu']; ?>',
983  contentType: "application/x-www-form-urlencoded",
984  cache: false,
985  data: {
986  form: 'schedule',
987  action: 'createSchedule'
988  }
989  },
990  destroy: {
991  type: "POST",
992  url: 'hcuTransfer.data?cu=<?php echo $HB_ENV['cu']; ?>',
993  contentType: "application/x-www-form-urlencoded",
994  cache: false,
995  data: {
996  form: 'schedule',
997  action: 'deleteSchedule'
998  }
999  },
1000  parameterMap: function(data, operation) {
1001  ShowWaitWindow('Loading Data');
1002 
1003  if (operation === 'read') {
1004  return {form: 'schedule', action: 'readSchedule', cu: '<?php echo $HB_ENV['cu']; ?>'};
1005  } else if (operation === 'create' || operation === 'update') {
1006  if (data.txDateStart !== null) {
1007  data.txDateStart = kendo.toString(data.txDateStart, "MM/dd/yyyy");
1008  }
1009  if (data.txDateEnd !== null) {
1010  data.txDateEnd = kendo.toString(data.txDateEnd, "MM/dd/yyyy");
1011  }
1012  data['txContinue'] = $('#transferContUntil').val();
1013 
1014  if (operation == 'update' && txSkip) {
1015  data.action = "skipSchedule";
1016  }
1017 
1018  <?php // Needed for validation checks from #1568. Now, the call has to be direct to get the validation fail because the invalid record is filtered out before this. ?>
1019  data.txFromMember = $("#transferFrom").data("kendoDropDownList").dataItem().permissionAcct;
1020 
1021  if (operation == 'create') {
1022  data.txToMember = $("#transferTo").data("kendoDropDownList").dataItem().permissionAcct;
1023  }
1024 
1025  return data;
1026 
1027  } else if (operation === 'destroy') {
1028  return data;
1029  }
1030  }
1031  },
1032  requestStart: function(request) {
1033  dsAction = request.type;
1034  },
1035  requestEnd: function(response) {
1036  CloseWaitWindow();
1037  try {
1038  if (response.hasOwnProperty("response")) {
1039  if (response.response.hasOwnProperty("Results")) {
1040 
1041  var results = response.response.Results[0];
1042  if (results.homecuErrors.length > 0) {
1043  throw results.homecuErrors;
1044  } else {
1045  if (response.type != "read") {
1046  $.homecuValidator.settings.formStatusField = "formStatus";
1047  $.homecuValidator.displayMessage(results.homecuInfo);
1048  this.read();
1049  }
1050  }
1051  } else {
1052  throw "Error Parsing Server";
1053  }
1054  } else {
1055  throw "Error Parsing Server";
1056  }
1057  } catch (errors) {
1058  if (!response.hasOwnProperty("type") || response.type == "read") {
1059  $.homecuValidator.settings.formStatusField = "formStatus";
1060  $.homecuValidator.displayMessage(errors, $.homecuValidator.settings.statusError);
1061  } else {
1062  $.homecuValidator.settings.formStatusField = "editErrors";
1063  $.homecuValidator.displayMessage(errors, $.homecuValidator.settings.statusError);
1064  }
1065  }
1066  },
1067  schema: {
1068  parse: function(response) {
1069  var results = null;
1070  var resultData = null;
1071 
1072  if (response.hasOwnProperty("Results")) {
1073  results = response.Results[0];
1074  resultData = results.homecuData;
1075  }
1076 
1077  if (results.homecuErrors.length > 0) {
1078  if (dsAction == "create") {
1079  return viewScheduled.selectedSchedule;
1080  }
1081  return null;
1082  }
1083 
1084  if (resultData == undefined || resultData == null) {
1085  return null;
1086  }
1087 
1088  scheduledDates = resultData.scheduleDates ?
1089  resultData.scheduleDates :
1090  [];
1091 
1092  scheduledDatesRecords = resultData.scheduleOccur ?
1093  resultData.scheduleOccur :
1094  {};
1095 
1096  scheduledRecords = resultData.scheduleItems ?
1097  resultData.scheduleItems :
1098  [];
1099 
1100  $("#hcuTableScheduled").data('kendoGrid').dataSource.data(scheduledRecords);
1101  $("#hcuTableScheduled").data('kendoGrid').dataSource.sort({
1102  field: "txDateNext",
1103  dir: "asc"
1104  });
1105 
1106  if (window_stack.length > 0) {
1107  // reset the observable object
1108  viewScheduled.selectedSchedule.dirty = false;
1109  viewScheduled.set("selectedSchedule",null);
1110  viewScheduled.set("hasChanges", false);
1111 
1112  wnd.close();
1113  }
1114 
1115  BuildCalendar();
1116  SwitchView(currentView);
1117 
1118  return scheduledRecords;
1119  },
1120  model: {
1121  id: 'txId',
1122  fields: {
1123  txId: {type: 'number'},
1124  txFromSuffix: {type: 'string'},
1125  txFromDesc: {type: 'string'},
1126  txFromMember: {type: 'string'},
1127  txToSuffix: {type: 'string'},
1128  txToDesc: {type: 'string'},
1129  txToMember: {type: 'string'},
1130  txAmount: {type: 'number', defaultValue: null},
1131  txFrequency: {type: 'string', defaultValue: 'OneTime'},
1132  txDateStart: {type: 'date', defaultValue: new Date(<?php echo date('Y') . ', ' . (date('n') - 1) .', ' . (date('j') + 1); ?>)},
1133  txDateNext: {type: 'date', defaultValue: new Date(<?php echo date('Y') . ', ' . (date('n') - 1) .', ' . (date('j') + 1); ?>)},
1134  txDateEnd: {type: 'date', defaultValue: new Date(<?php echo date('Y') . ', ' . (date('n') - 1) .', ' . (date('j') + 2); ?>)},
1135  txStatus: {type: 'string', defaultValue: 'A'},
1136  txContinue: {type: 'string', defaultValue: 'continuous' }
1137  }
1138  }
1139  }
1140  });
1141 
1142  toAcctDataSource = new kendo.data.DataSource({
1143  cache: false,
1144  transport: {
1145  read: {
1146  url: 'hcuTransfer.data?cu=<?php echo $HB_ENV['cu']; ?>&action=GetTransferToOptions',
1147  type: "POST",
1148  dataType: "json",
1149  cache: false,
1150  beforeSend: function() {
1151  ShowWaitWindow('<?php echo $MC->msg("Please Wait", HCU_DISPLAY_AS_JS); ?>...');
1152  }
1153  },
1154  success: function(result) {
1155  },
1156  error: function(result) {
1157  // notify the data source that the request failed
1158  },
1159  parameterMap: function(data, operation) {
1160  var returnString = $('#formSchedule').serialize();
1161  return returnString;
1162  }
1163  },
1164  schema: {
1165  errors: function(response) {
1166 
1167  // ** SETUP ERRORS
1168  // * Check for the Results Array being sent from data server
1169  try {
1170  if (response['Results']) {
1171  // ** Should be a single array of pieces
1172  if (response['Results'][0]) {
1173  // ** Look for the errors being returned from the server
1174  if (response['Results'][0]['homecuErrors']) {
1175  if (response['Results'][0]['homecuErrors'].length > 0) {
1176  return {error: response['Results'][0]['homecuErrors']};
1177  }
1178  }
1179  } else {
1180  throw "<?php echo $MC->msg('Error parsing server', HCU_DISPLAY_AS_JS) ?>";
1181  }
1182  } else {
1183  throw "<?php echo $MC->msg('Error parsing server', HCU_DISPLAY_AS_JS) ?>";
1184  }
1185  } catch (err) {
1186  return {error: err};
1187  }
1188  },
1189 
1190  parse: function(response) {
1191 
1192  return response;
1193 
1194  },
1195  data: function (response) {
1196  var returnVal = response == null || response.Results == null || response.Results[0] == null ? [] : response.Results[0].homecuData;
1197 
1198  viewScheduled.set("hasToRecords", returnVal != null && returnVal.length > 0);
1199  return returnVal;
1200  },
1201  type: "json"
1202  },
1203  error: function(e) {
1204  // Ability to parse the returned errors.
1205 
1206  // **
1207  if (e.errors) {
1208  if (e.errors.error.length > 0) {
1209  $.homecuValidator.displayMessage(e.errors.error, $.homecuValidator.settings.statusError);
1210  }
1211  } else {
1212  // ** UNKNOWN ERROR
1213  $.homecuValidator.displayMessage('<?php echo $MC->msg('Transfer Error', HCU_DISPLAY_AS_JS); ?>', $.homecuValidator.settings.statusError);
1214  }
1215 
1216  },
1217  requestEnd: function (e) {
1218  CloseWaitWindow();
1219  }
1220 
1221  });
1222  }
1223 
1224  function InitDataViews() {
1225  mbl_col_template +=
1226  "<div class=\"col-xs-4\"><strong><?php echo $MC->msg('Type', HCU_DISPLAY_AS_JS); ?>:</strong></div>" +
1227  "<div class=\"col-xs-8\">#= txFeature#</div>";
1228 
1229  mbl_col_template +=
1230  "<div class=\"col-xs-4\"><strong><?php echo $MC->msg('From', HCU_DISPLAY_AS_JS); ?>:</strong></div>" +
1231  "<div class=\"col-xs-8 showEllipsis\">#= txFromDesc #</div>";
1232 
1233  mbl_col_template +=
1234  "<div class=\"col-xs-4\"><strong><?php echo $MC->msg('To', HCU_DISPLAY_AS_JS); ?>:</strong></div>" +
1235  "<div class=\"col-xs-8 showEllipsis\">#= txToDesc #</div>";
1236 
1237  mbl_col_template +=
1238  "<div class=\"col-xs-4\"><strong><?php echo $MC->msg('Amount', HCU_DISPLAY_AS_JS); ?>:</strong></div>" +
1239  "<div class=\"col-xs-8 showEllipsis\">#= kendo.toString(txAmount, 'c') #</div>";
1240 
1241  mbl_col_template +=
1242  "<div class=\"col-xs-4\"><strong><?php echo $MC->msg('Next Date', HCU_DISPLAY_AS_JS); ?>:</strong></div>" +
1243  "<div class=\"col-xs-8 showEllipsis\">#= (txDateNext == null || txDateNext == \"\") ? \"\" : kendo.toString(kendo.parseDate(txDateNext, \"yyyy-MM-dd\"), \"MM/dd/yyyy\") #</div>";
1244 
1245  mbl_col_template +=
1246  "<div class=\"col-xs-4\"><strong><?php echo $MC->msg('Status', HCU_DISPLAY_AS_JS); ?></strong></div>" +
1247  "<div class=\"col-xs-8 showEllipsis\">#if(txApproved == 99){#<span class=\"hcu-activity-fg-cancelled\"><?php echo $MC->msg("Cancelled") ?></span>#}else if(txApproved == 90){#<span class=\"hcu-activity-fg-declined\"><?php echo $MC->msg("Declined") ?></span>#}else if(txApproved == 10 && txStatus == \"A\" && txFrequency == \"OneTime\" && txFrequencyCount == 1){#<span class=\"hcu-activity-fg-approved\"><?php echo $MC->msg("Completed") ?></span>#}else if(txApproved == 10 && txStatus == \"A\"){#<span class=\"hcu-activity-fg-approved\"><?php echo $MC->msg("Active") ?></span>#}else if(txApproved == 10 && txStatus == \"I\"){#<span class=\"hcu-activity-fg-declined\"><?php echo $MC->msg("Inactive") ?></span>#}else{#<span class=\"hcu-activity-fg-awaiting\"><?php echo $MC->msg("Pending") ?></span>#}#</div>";
1248 
1249  //KENDO GRID FOR DESKTOP TABLE
1250  $('#hcuTableScheduled').kendoGrid({
1251  batch: false,
1252  selectable: "row",
1253  dataSource: [],
1254  autoBind: false,
1255  toolbar: kendo.template($('#gridToolbar').html()),
1256  columns: [
1257  {field: 'txFeature',
1258  title: '<?php echo $MC->msg('Type', HCU_DISPLAY_AS_JS); ?>',
1259  attributes: { "class": "showEllipsis" },
1260  template: '#= txFeature#',
1261  minScreenWidth: 768
1262  },
1263  {field: 'txFromDesc',
1264  title: '<?php echo $MC->msg('From', HCU_DISPLAY_AS_JS); ?>',
1265  attributes: { "class": "showEllipsis" },
1266  minScreenWidth: 768
1267  },
1268  {field: 'txToDesc',
1269  title: '<?php echo $MC->msg('To', HCU_DISPLAY_AS_JS); ?>',
1270  attributes: { "class": "showEllipsis" },
1271  minScreenWidth: 768
1272  },
1273  {field: 'txAmount',
1274  format: '{0:c}',
1275  title: '<?php echo $MC->msg('Amount', HCU_DISPLAY_AS_JS); ?>',
1276  width: '100px',
1277  minScreenWidth: 768
1278  },
1279  {field: 'txDateNext',
1280  title: '<?php echo $MC->msg('Next Date', HCU_DISPLAY_AS_JS); ?>',
1281  template: '#= (txDateNext == null || txDateNext == "") ? "" : kendo.toString(kendo.parseDate(txDateNext, "yyyy-MM-dd"), "MM/dd/yyyy") #',
1282  width: "100px",
1283  minScreenWidth: 768
1284  },
1285  {width: "32.5px",
1286  template: "#if(txFrequency == \"OneTime\"){#<span class=\"fa fa-calendar-o\"></span>#}else if(txContinue == \"continuous\"){#<span class=\"fa fa-retweet\"></span>#}else{#<span class=\"fa fa-calendar-times-o\"></span>#}#",
1287  minScreenWidth: 1200
1288  },
1289  {field: 'txStatus',
1290  values: scheduleStatusAry,
1291  title: '<?php echo $MC->msg('Status', HCU_DISPLAY_AS_JS); ?>',
1292  width: '85px',
1293  template: "#if(txApproved == 99){#<span class=\"hcu-activity-fg-cancelled\"><?php echo $MC->msg("Cancelled") ?></span>#}else if(txApproved == 90){#<span class=\"hcu-activity-fg-declined\"><?php echo $MC->msg("Declined") ?></span>#}else if(txApproved == 10 && txStatus == \"A\" && txFrequency == \"OneTime\" && txFrequencyCount == 1){#<span class=\"hcu-activity-fg-approved\"><?php echo $MC->msg("Completed") ?></span>#}else if(txApproved == 10 && txStatus == \"A\"){#<span class=\"hcu-activity-fg-approved\"><?php echo $MC->msg("Active") ?></span>#}else if(txApproved == 10 && txStatus == \"I\"){#<span class=\"hcu-activity-fg-declined\"><?php echo $MC->msg("Inactive") ?></span>#}else{#<span class=\"hcu-activity-fg-awaiting\"><?php echo $MC->msg("Pending") ?></span>#}#",
1294  minScreenWidth: 1200
1295  },
1296  {
1297  attributes: { "class": "hcu-bs-no-padding" },
1298  template: mbl_col_template
1299  }
1300  ],
1301  change: function(e) {
1302  e.preventDefault();
1303  var rowSelected = this.select();
1304  var rowItem = this.dataItem(rowSelected);
1305  var rowId = rowItem.txId;
1306 
1307  var rowIndex = 0;
1308  for (var i = 0; i < dsScheduled.data().length; i++) {
1309  var item = dsScheduled.data()[i];
1310  if (item.txId == rowId) {
1311  rowIndex = i;
1312  break;
1313  }
1314  }
1315 
1316  var rowSchedule = dsScheduled.data()[rowIndex];
1317  viewScheduled.setSelectedSchedule(rowSchedule);
1318  viewScheduled.showEditForm();
1319 
1320  this.select().removeClass("k-state-selected");
1321  }
1322  });
1323 
1324  //filter options
1325  var filterdata = [
1326  { text: "Active", value: "Active" },
1327  { text: "All", value: "All" }
1328  ];
1329 
1330  var dropdown = $("#filter").kendoDropDownList({
1331  dataTextField: "text",
1332  dataValueField: "value",
1333  dataSource: filterdata,
1334  index: 0,
1335  change: function() {
1336  //clear filters first
1337  $("#hcuTableScheduled").data("kendoGrid").dataSource.filter([]);
1338  var value = this.value();
1339  var allFilters = [];
1340 
1341  if (value == 'Active') {
1342  // default to showing current active scheduled transfers
1343  allFilters.push({ field: "txStatus", operator: "eq", value: 'A' });
1344  allFilters.push({ field: "txApproved", operator: "eq", value: '10' });
1345 
1346  var currentDate = kendo.toString(new Date(), "MM/dd/yyyy");
1347  allFilters.push({ field: "txDateNext", operator: "gte", value: currentDate });
1348 
1349  $("#hcuTableScheduled").data("kendoGrid").dataSource.filter({ logic: "and", filters: allFilters});
1350 
1351  } else if (value == 'All') {
1352  $("#hcuTableScheduled").data("kendoGrid").dataSource.filter([]);
1353  }
1354  }
1355  });
1356 
1357  viewScheduled = kendo.observable({
1358  localSourceAcctListAry: sourceAcctListAry,
1359  localSourceFreqListAry: sourceFreqListAry,
1360  localSourceContListAry: sourceContListAry,
1361  localScheduleStatusAry: scheduleStatusAry,
1362  sourceSchedule: dsScheduled,
1363  selectedSchedule: null,
1364  hasChanges: false,
1365  showContDate: false,
1366  isUpdate: false,
1367  isRepeat: false,
1368  isNew: false,
1369  disableSkip: false,
1370  hasToRecords: false,
1371  previousStatus: '',
1372  previousApproved: '',
1373  onetimeComplete: false,
1374  toAcctDataSource: toAcctDataSource,
1375  setSelectedSchedule: function(newSelectedItem) {
1376 
1377  this.set('selectedSchedule', newSelectedItem);
1378  // * *Set attributes based on the selected Record
1379  this.set('isUpdate', (newSelectedItem.txId > 0));
1380  this.set("isNew", (newSelectedItem.txId == 0));
1381  this.set('hasChanges', false);
1382  this.set('previousStatus', newSelectedItem.txStatus);
1383  this.set('previousApproved', newSelectedItem.txApproved);
1384 
1385  var completed =
1386  newSelectedItem.txFrequency == "OneTime" &&
1387  newSelectedItem.txFrequencyCount == 1;
1388  this.set("onetimeComplete", completed);
1389 
1390  var disableSkip =
1391  this.selectedSchedule.txId == 0 ||
1392  this.selectedSchedule.txStatus == 'I';
1393  this.set("disableSkip", disableSkip);
1394 
1395  var showContinue =
1396  this.selectedSchedule.txFrequency !== "OneTime";
1397  var showEnd =
1398  this.selectedSchedule.txFrequency !== "OneTime" &&
1399  this.selectedSchedule.txContinue !== "continuous";
1400 
1401  this.set('isRepeat', showContinue);
1402  this.set('showContDate', showEnd);
1403  },
1404  resetSelectedSchedule: function() {
1405  this.set("selectedSchedule", null);
1406  this.set("isNew", false);
1407  this.set("isUpdate", false);
1408  this.set("isRepeat", false);
1409  this.set("hasChanges", false);
1410  this.set("showContinue", false);
1411  this.set("previousStatus", '');
1412  this.set("previousApproved", '');
1413  this.set("onetimeComplete", false);
1414  },
1415  changeFrequency: function(e) {
1416  var showContinue =
1417  this.selectedSchedule.txFrequency !== "OneTime";
1418  var showEnd =
1419  this.selectedSchedule.txFrequency !== "OneTime" &&
1420  this.selectedSchedule.txContinue !== "continuous";
1421 
1422  this.set('isRepeat', showContinue);
1423  this.set('showContDate', showEnd);
1424 
1425  // set end date null
1426  this.change();
1427 
1428  setDataAttributes(showContinue, showEnd);
1429  },
1430  change: function() {
1431  this.set('hasChanges', true);
1432  },
1433  changeAccount: function(e) {
1434  this.set('hasChanges', true);
1435  var dropdownID = e.sender.element[0].id;
1436  var dropdownVal = e.sender.value();
1437  var dataItem = e.sender.dataItem();
1438  if (dropdownID == "transferFrom") {
1439  $("[name='txFromMember']").val(dataItem.permissionAcct);
1440  this.selectedSchedule.txFromSuffix = dropdownVal;
1441 
1442  <?php // Prevent data call if setting value to initial value.
1443  // However, set to dropdownlist to initial value and disable.
1444  // SPB: Issue #2752 ?>
1445  if (dropdownVal != "") {
1446  this.toAcctDataSource.read();
1447  } else {
1448  this.set("hasToRecords", false);
1449  $("[name='txToMember']").val("");
1450  this.selectedSchedule.set("txToSuffix", "");
1451  }
1452  } else {
1453  $("[name='txToMember']").val(dataItem.permissionAcct);
1454  this.selectedSchedule.txToSuffix = dropdownVal;
1455  }
1456  },
1457  changeStatus: function(e) {
1458  this.change();
1459  },
1460  changeContUntil: function(e) {
1461  e.preventDefault();
1462  var showEnd =
1463  this.selectedSchedule.txContinue !== "continuous";
1464 
1465  this.set('showContDate', showEnd);
1466  this.selectedSchedule.txContinue = e.sender.value();
1467  this.change();
1468 
1469  setDataAttributes(this.isRepeat, this.showContDate);
1470  },
1471  scheduleSave: function(e) {
1472  if (this.hasChanges) {
1473  e.preventDefault();
1474 
1475  var from_acct_type = "";
1476  var to_acct_type = "";
1477 
1478  var errors = [];
1479  if (this.isNew) {
1480  // VALIDATE FROM/TO ACCOUNTS
1481  from_acct_type = getAcctSeg("from", "type");
1482  to_acct_type = getAcctSeg("to", "type");
1483  var to_acct_sfx = getAcctSeg("to", "sfx");
1484 
1485  // LOOK FOR ANY BAD TRANSACTIONS
1486  if (from_acct_type === 'L' && to_acct_type === 'L') {
1487  errors[errors.length] = '<?php echo $MC->msg('Loan Add-on cannot payment', HCU_DISPLAY_AS_JS); ?>';
1488  }
1489 
1490  <?php if (!array_key_exists('LC', $cuTransTypesAllowed)): ?>
1491  if (from_acct_type === 'L' && to_acct_sfx === 'CW') {
1492  errors[errors.length] = '<?php echo $MC->msg('Loan Add-on cannot check withdrawal', HCU_DISPLAY_AS_JS); ?>';
1493  }
1494  <?php endif; ?>
1495 
1496  var tf_list = $("#transferFrequency").data("kendoDropDownList");
1497  var tf_select = tf_list.select();
1498 
1499  if (tf_select > 0) {
1500 
1501  if (from_acct_type === 'L' || to_acct_sfx === 'CW') {
1502  errors[errors.length] = "<?php echo $MC->msg('Repeating transfer not available', HCU_DISPLAY_AS_JS); ?>";
1503  }
1504  }
1505 
1506  <?php // Check to see if transfer uses multiple accounts. This excludes M2M accounts and external account transfers.
1507  if ($disallowTransfersToDiffAccount) { ?>
1508  var fromAcct = getAcctSeg ('from', 'permissionAcct');
1509  var toAcct = getAcctSeg ('to', 'permissionAcct');
1510  var typesRelevant = ["D", "L"];
1511 
1512  if (typesRelevant.indexOf(from_acct_type) != -1 && typesRelevant.indexOf(to_acct_type) != -1 && fromAcct != toAcct) {
1513  errors.push('<?php echo $MC->msg('Transfers between accounts are prohibited', HCU_DISPLAY_AS_JS); ?>');
1514  }
1515  <?php } ?>
1516  } else {
1517  // need to set type for scheduled because of amount limit validation
1518  // The checks for ACHPMT / ACHCOL are required because these transfers
1519  // may be viewed and altered on this screen.
1520  if (this.selectedSchedule.txFeature == "External Transfer") {
1521  from_acct_type = "X";
1522  } else if (this.selectedSchedule.txFeature == "Member-To-Member Transfer") {
1523  from_acct_type = "M";
1524  } else if (this.selectedSchedule.txFeature == "Collection") {
1525  from_acct_type = "AC";
1526  } else if (this.selectedSchedule.txFeature == "Payment") {
1527  from_acct_type = "AP";
1528  } else {
1529  from_acct_type = "";
1530  }
1531 
1532  // do not allow if record is already inactive, cancelled, or declined -- or if it was already completed
1533  if (this.previousStatus == 'I' || this.previousApproved != '10' || this.onetimeComplete) {
1534  errors[errors.length] = '<?php echo $MC->msg('Cannot Update Transfer', HCU_DISPLAY_AS_JS); ?>';
1535  }
1536  }
1537 
1538  // validate the amount of the transaction
1539  var txAmount = $("#transferAmount").data("kendoNumericTextBox").value();
1540  var txLimit = 0;
1541  // must check per transaction limit amount for TRN, TRNEXT and TRNM2M
1542  if (from_acct_type == "X" || to_acct_type == "X") {
1543  txLimit = perTransactionAmounts.TRNEXT;
1544  } else if (from_acct_type == "M" || to_acct_type == "M") {
1545  txLimit = perTransactionAmounts.TRNM2M;
1546  } else if (from_acct_type == "AC") {
1547  txLimit = perTransactionAmounts.ACHCOL;
1548  } else if (from_acct_type == "AP") {
1549  txLimit = perTransactionAmounts.ACHPMT;
1550  } else {
1551  txLimit = perTransactionAmounts.TRN;
1552  }
1553 
1554  if ( txAmount > txLimit ) {
1555  errors[errors.length] = '<?php echo $MC->msg('Transfer Amount over allowed', HCU_DISPLAY_AS_JS); ?>';
1556  }
1557 
1558  if ($.homecuValidator.homecuValidate) {
1559 
1560  if (errors.length > 0) {
1561  // ERROR FOUND FOR BAD TRANSACTIONS
1562  $.homecuValidator.homecuResetMessage = $.homecuValidator.homecuValidate;
1563  $.homecuValidator.displayMessage(errors, $.homecuValidator.settings.statusError);
1564  $.homecuValidator.homecuResetMessage = true;
1565  $.homecuValidator.homecuValidate = false;
1566  } else {
1567 
1568  // NO ERRORS, SEND TO DB
1569  this.selectedSchedule.dirty = true;
1570  this.sourceSchedule.sync();
1571  }
1572  }
1573  }
1574  },
1575  scheduleCancel: function(e) {
1576  if (this.hasChanges) {
1577  e.preventDefault();
1578  wndDiscard.open();
1579  } else {
1580  window_stack[window_stack.length-1].close();
1581  }
1582  },
1583  scheduleDelete: function(e) {
1584  wndDelete.open();
1585  },
1586  scheduleSkip: function(e) {
1587  e.preventDefault();
1588  wndSkip.open();
1589  },
1590  showEditForm: function() {
1591  // ** Set the 'show continue date'
1592  openEditSchedule();
1593  }
1594  });
1595 
1596  wnd = $('#editWindow').kendoWindow({
1597  minWidth: "300px",
1598  maxWidth: "485px",
1599  width: "75%",
1600  modal: true,
1601  title: '<?php echo $MC->msg("Scheduled Transaction", HCU_DISPLAY_AS_JS); ?>',
1602  visible: false,
1603  resizable: false,
1604  activate: function() {
1605  var ow = $('#editWindow').data('kendoWindow');
1606  window_stack.push(ow);
1607  $(window).scrollTop(0);
1608  },
1609  close: function(e) {
1610  if (viewScheduled.hasChanges) {
1611  e.preventDefault();
1612  wndDiscard.open();
1613  } else {
1614  window_stack.pop();
1615  kendo.unbind($("#editWindow"));
1616  }
1617  }
1618  }).data('kendoWindow');
1619 
1620  wndDiscard = $("#hcuDiscard").kendoDialog({
1621  title: '<?php echo $MC->msg("Discard Changes", HCU_DISPLAY_AS_JS); ?>',
1622  model: true,
1623  visible: false,
1624  resizable: false,
1625  show: function() {
1626  window_stack.push(this);
1627  },
1628  close: function() {
1629  window_stack.pop();
1630  },
1631  actions: [
1632  { text: '<?php echo $MC->msg("No", HCU_DISPLAY_AS_JS); ?>',
1633  action: function() {}
1634  },
1635  {
1636  text: '<?php echo $MC->msg("Yes", HCU_DISPLAY_AS_JS); ?>', primary: true,
1637  action: function() {
1638  dsScheduled.cancelChanges();
1639  viewScheduled.resetSelectedSchedule();
1640  wnd.close();
1641  }
1642  }
1643  ]
1644  }).data("kendoDialog");
1645 
1646  wndDelete = $("#hcuDelete").kendoDialog({
1647  title: '<?php echo $MC->msg("Delete Scheduled Transaction", HCU_DISPLAY_AS_JS); ?>',
1648  model: true,
1649  visible: false,
1650  resizable: false,
1651  show: function() {
1652  window_stack.push(this);
1653  },
1654  close: function() {
1655  window_stack.pop();
1656  },
1657  actions: [
1658  { text: '<?php echo $MC->msg("No", HCU_DISPLAY_AS_JS); ?>',
1659  action: function() {}
1660  },
1661  {
1662  text: '<?php echo $MC->msg("Yes", HCU_DISPLAY_AS_JS); ?>', primary: true,
1663  action: function() {
1664  dsScheduled.remove(viewScheduled.selectedSchedule);
1665  dsScheduled.sync();
1666  }
1667  }
1668  ]
1669  }).data("kendoDialog");
1670 
1671  wndSkip = $("#hcuSkip").kendoDialog({
1672  title: '<?php echo $MC->msg("Skip Transaction", HCU_DISPLAY_AS_JS); ?>',
1673  model: true,
1674  visible: false,
1675  resizable: false,
1676  show: function() {
1677  window_stack.push(this);
1678  },
1679  close: function() {
1680  window_stack.pop();
1681  },
1682  actions: [
1683  { text: '<?php echo $MC->msg("No", HCU_DISPLAY_AS_JS); ?>',
1684  action: function() {}
1685  },
1686  {
1687  text: '<?php echo $MC->msg("Yes", HCU_DISPLAY_AS_JS); ?>', primary: true,
1688  action: function() {
1689  txSkip = true;
1690  viewScheduled.selectedSchedule.dirty = true;
1691  viewScheduled.sourceSchedule.sync();
1692  }
1693  }
1694  ]
1695  }).data("kendoDialog");
1696 
1697  // USE THIS TO SELECT OVERFLOW IN JQUERY SELECTORS FOR TOOLTIP BELOW
1698  jQuery.extend(jQuery.expr[':'], {
1699  overflown: function (el) {
1700  return el.offsetHeight < el.scrollHeight || el.offsetWidth < el.scrollWidth;
1701  }
1702  });
1703  scheduleTip = homecuTooltip.defaults;
1704  scheduleTip.filter = ".showEllipsis:overflown";
1705  scheduleTip.content = ShowToolTip;
1706  $("#hcuTableScheduled").kendoTooltip(scheduleTip);
1707 
1708  $('#btnGroupCalendar').click(function(e) {
1709  e.preventDefault();
1710 
1711  $('#btnGroupList').show();
1712  $(this).hide();
1713  currentView = "calendar";
1714  SwitchView(currentView);
1715  });
1716 
1717  $('#btnGroupList').click(function(e) {
1718  e.preventDefault();
1719 
1720  $('#btnGroupCalendar').show();
1721  $(this).hide();
1722  currentView = "list";
1723  SwitchView(currentView);
1724  });
1725 
1726  $('#btnNewSchedule').click(function(e) {
1727  e.preventDefault();
1728  dsScheduled.add();
1729  var data = dsScheduled.data();
1730  var newItem = data[0];
1731  var calendar = $('#hcuCalendarSchedule').data('kendoCalendar');
1732  if (calendar.value()) {
1733  newItem.txDateStart = calendar.value();
1734  }
1735 
1736  viewScheduled.resetSelectedSchedule();
1737  viewScheduled.setSelectedSchedule(newItem);
1738  openEditSchedule();
1739  });
1740 
1741  // CHECK SIZE TO HIDE LAST COLUMN, LAST COLUMN ONLY VISIBLE IN MOBILE
1742  var width = $(window).width();
1743  var grid = $("#hcuTableScheduled").data("kendoGrid");
1744 
1745  // INITIAL CHECK IN PAGE OPEN
1746  if ($(window).width() >= 768) {
1747  grid.hideColumn(7);
1748  } else {
1749  grid.showColumn(7);
1750  }
1751 
1752  // CHECK ON PAGE RESIZE
1753  $(window).resize(function() {
1754  width = $(window).width();
1755 
1756  if (width >= 768) {
1757  grid.hideColumn(7);
1758  } else {
1759  grid.showColumn(7);
1760  }
1761  });
1762  }
1763 
1764  function InitScreen() {
1765  InitDataSources();
1766  InitDataViews();
1767 
1768  // initialize then display
1769  $("#scheduledTransferScreen").show();
1770 
1771  // read when everything is loaded
1772  dsScheduled.read();
1773  }
1774 
1775  $(document).ready(function() {
1776  if (terms) {
1777  ShowNotice('<?php echo $termsURLRPT; ?>', "<?php echo $termsLinkDisplayRPT ?>",
1778  function() {
1779  InitScreen();
1780  },
1781  function() {
1782  // if they do not accept, send them to banking accounts screen
1783  ShowWaitWindow();
1784 
1785  var urlPage = "hcuAccounts.prg";
1786  var urlRedirect = "<?php echo $HB_ENV["homebankingpath"] ?>/" + urlPage + "?" + "<?php echo $HB_ENV["cuquery"] ?>";
1787 
1788  window.location.replace(urlRedirect);
1789  }
1790  );
1791  } else {
1792  InitScreen();
1793  }
1794  });
1795 
1796  $(document).on("click", ".k-overlay", function () {
1797  if(window_stack.length > 0) {
1798  window_stack[window_stack.length-1].close();
1799  }
1800  });
1801 </script>
1802 
1803 <?php
1804 // ** INCLUDE POST CONTENT SCRIPT
1805 require_once(dirname(__FILE__) . '/../includes/hcuPostContent.i');
1806 ?>