Odyssey
hcuACHSingle.prg
1 <?php
2  /*
3  * File: hcuACHSingle.prg
4  *
5  * Purpose: To let the user do ACH operations - single payments and collections.
6  *
7  * Steps:
8  * 1) Show the ACH partner screen. Can create/edit a partner.
9  * 2) Fill in DFI account, amounts and addenda.
10  * 3) Specify the local account for the payment or collection.
11  * 4) Submit
12  *
13  */
14  require_once(dirname(__FILE__) . '/../library/permissions.i');
15  require_once(dirname(__FILE__) . '/../library/hcuACH.i');
16  require_once(dirname(__FILE__) . '/../library/hcuTransferScheduled.i');
17 
18 
19  // ** SET SCRIPT LEVEL VARIABLES
20  $serviceShowInfo = true;
21  $serviceLoadMenu = true;
22  $serviceShowMenu = true;
23 
24  // ** INCLUDE MAIN GLOBAL SCRIPT -- Handles security / global variable values
25  require_once(dirname(__FILE__) . '/../library/hcuService.i');
26 
27  /*
28  * ** CHECK USER FEATURE PERMISSIONS **
29  * NOTE: DOES NOT RETURN ON FAILURE
30  */
31  $allowScheduled = (($HB_ENV['flagset2'] & $GLOBALS['CU2_PROCRECUR']) && PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_SCHEDULED_TRANSFERS, '', false));
32 
33  // ** INSERT BUSINESS LOGIC FOR THIS FORM
34  try {
35  $Cu = $HB_ENV["Cu"];
36  $Cn = $HB_ENV["Cn"];
37  $chome = $HB_ENV["chome"];
38  $Flang = $HB_ENV["Flang"];
39 
40  // get initial variables
41  $inputVars = array();
42  $varOk = array(
43  "ach_feature" => array('filter' => FILTER_SANITIZE_STRING)
44  );
45 
46  HCU_ImportVars($inputVars, "", $varOk);
47 
48  $ach_feature = isset($inputVars['ach_feature']) && strlen( trim( $inputVars['ach_feature'] ) ) ? trim( $inputVars['ach_feature'] ) : "choose_single_payment";
49 
50  // redirect if the action is for something other than what this file can handle
51  if ( $ach_feature == "choose_batch_payment" ||
52  $ach_feature == "choose_batch_collection" ) {
53  header("Location: {$HB_ENV["homebankingpath"]}/hcuACHBatch.prg?{$HB_ENV["cuquery"]}&ach_feature=$ach_feature");
54  exit;
55  }
56 
57  // ** INCLUDE PRE CONTENT SCRIPT
58  require_once(dirname(__FILE__) . '/../includes/hcuPreContent.i');
59 
60  // ** Verify the feature is enabled for the Credit Union.
61  $achEnabled = Check_ACHEnabled( $dbh, $HB_ENV );
62  if ( $achEnabled === false ) {
63  // * Feature NOT set
64  throw new Exception( HCU_JsonEncode( $MC->msg('Option not set', HCU_DISPLAY_AS_HTML) ), 915 );
65  }
66 
67  // set the initial type based on what the activity is
68  if ( $ach_feature == "choose_single_payment" ) {
69  $initialPartnerType = "e";
70  $termActivity = $MC->msg("ACH Payment Info", HCU_DISPLAY_AS_HTML);
71  $achAction = "submit_payment";
72  $featureCode = FEATURE_ACH_PAYMENTS;
73  // get the accounts and subaccounts
74  $accountsAction = "payments_list";
75  // type of account
76  $accountTypeWords = $MC->msg("ACH From Account", HCU_DISPLAY_AS_HTML);
77  $dfiAccountWords = $MC->msg("ACH Deposit Account", HCU_DISPLAY_AS_HTML); // remote deposit account
78  $batchButton = "choose_batch_payment";
79  $pageTitle = $MC->msg("ACH Payment Title", HCU_DISPLAY_AS_HTML);
80  // progress bar
81  $progressStep1 = $MC->msg("ACH Payee", HCU_DISPLAY_AS_HTML);
82  $progressStep2 = $MC->msg("ACH Payment", HCU_DISPLAY_AS_HTML);
83  } else if ( $ach_feature == "choose_single_collection" ) {
84  $initialPartnerType = "r";
85  $termActivity = $MC->msg("ACH Collection Info", HCU_DISPLAY_AS_HTML);
86  $achAction = "submit_collection";
87  $featureCode = FEATURE_ACH_COLLECTIONS;
88  // get the accounts and subaccounts
89  $accountsAction = "collections_list";
90  // type of account
91  $accountTypeWords = $MC->msg("ACH To Account", HCU_DISPLAY_AS_HTML);
92  $dfiAccountWords = $MC->msg("ACH Withdrawl Account", HCU_DISPLAY_AS_HTML); // remote withdrawl account
93  $batchButton = "choose_batch_collection";
94  $pageTitle = $MC->msg("ACH Collection Title", HCU_DISPLAY_AS_HTML);
95  // progress bar
96  $progressStep1 = $MC->msg("ACH Payor", HCU_DISPLAY_AS_HTML);
97  $progressStep2 = $MC->msg("ACH Collection", HCU_DISPLAY_AS_HTML);
98  } else {
99  // unassigned
100  $initialPartnerType = "";
101  $termActivity = $MC->msg("Unknown", HCU_DISPLAY_AS_HTML);
102  $achAction = "unknown";
103  $featureCode = "unknown";
104  $accountsAction = "unknown";
105  $batchButton = "choose_batch_payment";
106  }
107 
108  // these are the same for either payments or collections
109  $progressStep3 = $MC->msg("ACH Account", HCU_DISPLAY_AS_HTML);
110 
111  // ** Verify the user can access this feature.
112  $permissionInputs = array( "feature" => $featureCode );
113  $accessRights = Perm_AccessRights( $dbh, $HB_ENV, $permissionInputs );
114 
115  if ( !$accessRights["create"] ) {
116  // * Rights NOT set
117  throw new Exception( HCU_JsonEncode( $MC->msg('Rights not set', HCU_DISPLAY_AS_HTML) ), 915 );
118  }
119 
120  // get some allowed amounts for client-side validation
121  $limits = Perm_GetValidationLimits( $dbh, $HB_ENV, $permissionInputs );
122 
123  if ( $limits === false || !isset( $limits["amount_per_transaction"] ) ) {
124  // error occurred - assume count of zero
125  $allowedAmount = 0;
126  } else {
127  $allowedAmount = intval( $limits["amount_per_transaction"] );
128  }
129 
130  $Fset = $HB_ENV["Fset"];
131 
132  // ** Retrieve the Terms of Use for ACH Transactions
133  $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC, "D", "achNotice", true);
134 
135  $hasNoticeACH = false;
136  $hasNoticePopupACH = false;
137  $noticeURLACH = "";
138  $noticeLinkDisplayACH = "";
139 
140  if ( $noticesAry["status"]["code"] == "000" && HCU_array_key_exists('0', $noticesAry['notice'])) {
141  if ( $noticesAry["notice"][0]["notice_id"] ) {
142  $hasNoticeACH = true;
143  $noticeOption = $noticesAry['notice'][0];
144 
145  $noticeOptions = Array (
146  'docsid' => $noticeOption['notice_id'],
147  'docstype' => $noticeOption['notice_type'],
148  'device' => 'D',
149  'noticeOnly' => '0',
150  'expireTime' => mktime() + 86400
151  );
152 
153  $encryptedDocDetails= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
154 
155  $noticeOptions['noticeOnly'] = 1;
156 
157  $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
158 
159  // build the url encoded string
160  // * For the popup terms
161  $noticeURLACH = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetails);
162 
163  // * For the regular Button
164  $noticeURLNoticeOnly = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetailsNoticeOnly);
165 
166  // see if there is a popup notice
167  $hasNoticePopupACH = $noticeOption["notice_popup"] ? true : false;
168 
169  $noticeButtonText = $noticeOption["notice_linkdisplay"];
170  }
171  }
172 
173  // ** Retrieve the Terms of Use for ACH Transcations
174  $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC, "D", "achTerms", true);
175 
176  $hasTermsACH = false;
177  $hasTermsPopupACH = false;
178  $termsURLACH = "";
179  $termsLinkDisplayACH = "";
180 
181  if ( $noticesAry["status"]["code"] == "000" && HCU_array_key_exists('0', $noticesAry['notice'])) {
182  if ( $noticesAry["notice"][0]["notice_id"] ) {
183  $hasTermsACH = true;
184  $noticeOption = $noticesAry['notice'][0];
185 
186  $noticeOptions = Array (
187  'docsid' => $noticeOption['notice_id'],
188  'docstype' => $noticeOption['notice_type'],
189  'device' => 'D',
190  'noticeOnly' => '0',
191  'expireTime' => mktime() + 86400
192  );
193 
194  $encryptedDocDetails= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
195 
196  $noticeOptions['noticeOnly'] = 1;
197 
198  $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
199 
200  // build the url encoded string
201  // * For the popup terms
202  $termsURLACH = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetails);
203 
204  // * For the regular Button
205  $termsURLNoticeOnly = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetailsNoticeOnly);
206 
207  // see if there is a popup notice
208  $hasTermsPopupACH = $noticeOption["notice_popup"] ? true : false;
209 
210  $termsButtonText = $noticeOption["notice_linkdisplay"];
211  }
212  }
213 
214  // ** Retrieve the Terms of Use for SCHEDULED TRANSACTIONS
215  // ** the user needs to accept these in order to make a
216  // ** scheduled transaction from this screen.
217  $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC, "D", "rptTransferTerms", true);
218 
219  $hasTermsRPT = false;
220  $hasTermsPopupRPT = false;
221  $termsURLRPT = "";
222  $termsLinkDisplayRPT = "";
223 
224  if ( $noticesAry["status"]["code"] == "000" && HCU_array_key_exists('0', $noticesAry['notice'])) {
225  if ( $noticesAry["notice"][0]["notice_id"] ) {
226  $hasTermsRPT = true;
227  $noticeOption = $noticesAry['notice'][0];
228 
229  $noticeOptions = Array (
230  'docsid' => $noticeOption['notice_id'],
231  'docstype' => $noticeOption['notice_type'],
232  'device' => 'D',
233  'noticeOnly' => '0',
234  'expireTime' => mktime() + 86400
235  );
236 
237  $encryptedDocDetails= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
238 
239  $noticeOptions['noticeOnly'] = 1;
240 
241  $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
242 
243  // build the url encoded string
244  // * For the popup terms
245  $termsURLRPT = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetails);
246 
247  // * For the regular Button
248  $termsURLNoticeOnly = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetailsNoticeOnly);
249 
250  // see if there is a popup notice
251  $hasTermsPopupRPT = $noticeOption["notice_popup"] ? true : false;
252 
253  $termsButtonText = $noticeOption["notice_linkdisplay"];
254  }
255  }
256 
257  // include common functions
258 
259  /********* functions ************/
260  /********* end functions ********/
261 
262  /*
263  * ** START ACH CONTENT
264  */
265 
266  // get the initial effective date, which may be in the future, based on the time
267  $initialEffDate = ACH_GetEffectiveDate( $HB_ENV );
268  $initialEffDateTimestamp = strtotime( $initialEffDate );
269 
270  // External transfers have a cutoff time, the user
271  // must be notified that the transaction will process
272  // the next business day if the current time is after
273  // the cutoff.
274  $achCutoffMessageString = ACH_GetCutoffTimeMessage($HB_ENV);
275 
276  // list the frequency intervals for scheduled transactions
277  $frequencyIntervals = TxIntervalList($HB_ENV["MC"]);
278 
279  // get company information, this includes the company/group nameand tax id
280  // check if tax id is set up, if no tax id issetup the user is not able to
281  // make ach commercial transactions.
282  $companyData = ACH_GetCompanyData($HB_ENV);
283  if (HCU_array_key_exists("tax_id", $companyData)) {
284  if ($companyData['tax_id'] == null || trim($companyData['tax_id']) == "") {
285  throw new Exception( HCU_JsonEncode( $MC->msg('ACH Tax ID Error', HCU_DISPLAY_AS_HTML) ), 915 );
286  }
287  }
288 
289  $frequencyContinueList = Array(
290  Array("value" => "continuous", "text" => $MC->msg('Transfer Continue Until', HCU_DISPLAY_AS_RAW) . ' ' .$MC->msg('Transfer Further Notice', HCU_DISPLAY_AS_RAW)),
291  Array("value" => "continueuntil", "text" => $MC->msg('Transfer Continue Until', HCU_DISPLAY_AS_RAW))
292  );
293 
294  // list the account types for remote account (for ach) - used in dropdown list
295  $accountTypes = array( array( "type" => ACCOUNT_TYPE_CHECKING, "display" => $MC->msg("ACH Checking", HCU_DISPLAY_AS_HTML) ),
296  array( "type" => ACCOUNT_TYPE_SAVINGS, "display" => $MC->msg("ACH Savings", HCU_DISPLAY_AS_HTML) )
297  );
298 
299  // list the partner types for different ACH partners
300  $partnerTypes = array( array( "type" => ACH_PARTNER_TYPE_PAYEE, "display" => $MC->msg("ACH Payee", HCU_DISPLAY_AS_HTML) ),
301  array( "type" => ACH_PARTNER_TYPE_PAYOR, "display" => $MC->msg("ACH Payor", HCU_DISPLAY_AS_HTML) ),
302  array( "type" => ACH_PARTNER_TYPE_PAYROLL, "display" => $MC->msg("ACH Payroll", HCU_DISPLAY_AS_HTML) ),
303  array( "type" => ACH_PARTNER_TYPE_UNASSIGNED, "display" => $MC->msg("ACH Unassigned", HCU_DISPLAY_AS_HTML) )
304  );
305  ?>
306  <div class="col-xs-12" style='font-size:12px;'>
307  <div id="hcuAchTables" class="k-content" style="max-width:700px;"></div>
308  </div>
309  <?php
310 
311  if ( $ach_feature === "choose_single_payment" ||
312  $ach_feature === "choose_single_collection" ) {
313  ?>
314  <script >
315  var windowStack = [];
316  var viewModel;
317  var achFrequencyIntervals = <?php echo HCU_JsonEncode( $frequencyIntervals ); ?>;
318  var achFrequencyContinue = <?php echo HCU_JsonEncode( $frequencyContinueList ); ?>;
319  var achAccountTypes = <?php echo HCU_JsonEncode( $accountTypes ); ?>;
320  var achCurrentList = [];
321  var achPartnerTypes = <?php echo HCU_JsonEncode( $partnerTypes ); ?>;
322  var achPartnerList = [];
323  var achAllAccounts = []; // hold all accounts (to get sub-accounts for accounts)
324  var achAcctsList = []; // unique list of accounts
325  var achSubAccounts = []; // build dynamically
326  var achStateList = <?php echo HCU_JsonEncode( GetStateList() ); ?>;
327  var progressStep = 0;
328  var progressSteps;
329  var dsACH = null;
330  var dsACHHelper = null;
331 
332  // check for notices
333  var terms = <?php echo HCU_JsonEncode($hasTermsACH && $hasTermsPopupACH); ?>;
334  var notice = <?php echo HCU_JsonEncode($hasNoticeACH && $hasNoticePopupACH); ?>;
335  var termsScheduled = <?php echo HCU_JsonEncode($hasTermsRPT && $hasTermsPopupRPT); ?>;
336  var allowScheduled = <?php echo HCU_JsonEncode( $allowScheduled ) ?>;
337  var achFeature = <?php echo HCU_JsonEncode($ach_feature); ?>;
338 
339 
340  var effDatePicker = null;
341  var endDatePicker = null;
342 
343  var companyData = <?php echo HCU_JsonEncode($companyData); ?>;
344 
345  // status will be shown in the default info location
346  function ShowStatus( statusMessage ) {
347  $.homecuValidator.settings.formStatusField = "formStatus";
348  $.homecuValidator.settings.formInfoTitle = "";
349  $.homecuValidator.displayMessage(statusMessage);
350  }
351 
352  function ClearPartnerInfo() {
353  viewModel.set( "achIndividualName", "" );
354  viewModel.set( "achDisplayName", "" );
355  viewModel.set( "achIndividualEmail", "" );
356  viewModel.set( "achEmailNotify", "" );
357  viewModel.set( "achAddress1", "" );
358  viewModel.set( "achAddress2", "" );
359  viewModel.set( "achCity", "" );
360  viewModel.set( "achState", "" );
361  viewModel.set( "achZip", "" );
362  viewModel.set( "achCountry", "" );
363 
364  viewModel.set( "achDFIRouting", "" );
365  viewModel.set( "achDFIAccount", "" );
366  viewModel.set( "achDFIConfirm", "" );
367  viewModel.set( "achDFISelectedType", "" );
368 
369  viewModel.set( "achUpdatePartner", true );
370  viewModel.set( "achPartnerId", 0 );
371  }
372 
373  function ClearPaymentInfo() {
374  viewModel.set( "achIndividualAddenda", "" );
375 
376  viewModel.set( "achType", "" );
377  viewModel.set( "achMemo", "" );
378 
379  // only reset if there is more than one
380  if ( achAcctsList.length > 1 ) {
381  viewModel.set( "achMyAcctSelected", "" );
382  }
383 
384  viewModel.set( "achSubAcctSelected", 0 );
385 
386  viewModel.set( "achEffDate", "<?php echo $initialEffDate; ?>" );
387  viewModel.set( "achAmount", "" );
388  viewModel.set( "achFrequency", "OneTime");
389  viewModel.set( "achContinue", "continuous");
390  viewModel.set( "achEndDate", "");
391  viewModel.set( "showContinue", false);
392  viewModel.set( "showEnd", false);
393  // set minimum date to today if resetting after save
394  if (effDatePicker) {
395  effDatePicker.data("kendoDatePicker").min("<?php echo $initialEffDate; ?>");
396  effDatePicker.data("kendoDatePicker").value("<?php echo $initialEffDate; ?>");
397  }
398  }
399 
400  // set up validation for this step
401  function StartValidator( thisStep ) {
402  if ( thisStep === 1 ) {
403  $.homecuValidator.setup( {formValidate: "achSingleRecipient"} );
404  } else if ( thisStep === 2 ) {
405  $.homecuValidator.setup( {formValidate: "achLocal"} );
406  } else if ( thisStep === 3 ) {
407  $.homecuValidator.setup( {formValidate: "achSingleRemote"} );
408  }
409  }
410 
411  // handle the validation
412  // NOTE: The homecuValidator and Kendo Validator has some kind of problem with complex html;
413  // text boxes seem to work but do the rest manually.
414  // NOTE: Use the validation message; need a validation message where it is used.
415  function ValidateThisStep( thisStep ) {
416  var otherErrors = Array();
417 
418  // see which form we are checking
419  if ( thisStep === 1 ) {
420  if ( viewModel.achType === "" ) {
421  otherErrors.push( "<?php echo $MC->msg("ACH Type needed", HCU_DISPLAY_AS_JS) ?>" );
422  }
423 
424  if (viewModel.achZip != "") {
425  // must validate zip code
426  var zip = viewModel.achZip;
427  var zipReplace = zip.replace(/_/g, "");
428  var zipSplit = zipReplace.split("-");
429  var zipConstruct = "";
430 
431  // validate section 1, must be 5 digits
432  if (zipSplit[0].length < 5) {
433  otherErrors.push("<?php echo $MC->msg("Zip Code Invalid", HCU_DISPLAY_AS_JS) ?>");
434  } else if (zipSplit[1]) {
435  if (zipSplit[1].length > 0 && zipSplit[1].length < 4) {
436  otherErrors.push("<?php echo $MC->msg("Zip Code Invalid", HCU_DISPLAY_AS_JS) ?>");
437  }
438  }
439 
440  // reconstruct zip code
441  if (zipSplit[1]) {
442  zipConstruct += zipSplit[0] + "-" + zipSplit[1];
443  } else {
444  zipConstruct += zipSplit[0];
445  }
446 
447  viewModel.set("achZip", zipConstruct);
448  }
449  } else if ( thisStep === 2 ) {
450 
451  if ( viewModel.achSubAcctSelected === "" ) {
452  otherErrors.push( $("#achSubAcctList").attr( "validationMessage" ) );
453  }
454 
455  var amount = viewModel.achAmount;
456  var available = viewModel.achAvailable;
457  var immdTransfer = viewModel.achFrequency == "OneTime";
458 
459  // only make the available balance check for non-scheduled.
460  if ( immdTransfer && achFeature == "choose_single_payment" ) {
461 
462  if (amount > available) {
463  otherErrors.push( "<?php echo $MC->msg("Transfer exceeds", HCU_DISPLAY_AS_JS); ?>" );
464  }
465  } else if ( amount > <?php echo $allowedAmount ?> ) {
466  otherErrors.push( "<?php echo $MC->msg("ACH Amount over allowed", HCU_DISPLAY_AS_JS); ?>" );
467  } else if ( amount <= 0 ) {
468  otherErrors.push( $("#achAmount").attr( "validationMessage" ) );
469  }
470 
471  if ( viewModel.achEffDate == null || viewModel.achEffDate == "" ) {
472  otherErrors.push( $("#achEffDate").attr( "validationMessage" ) );
473  }
474 
475  } else if ( thisStep === 3 ) {
476  if ( viewModel.achDFIRouting.length !== 9 || !(/^\d+$/.test(viewModel.achDFIRouting)) ) {
477  // get the validation message from the component
478  otherErrors.push( $("#singleRecipientRouting").attr( "validationMessage" ) );
479  }
480  if ( viewModel.achDFIAccount.length < 1 ) {
481  // get the validation message from the component
482  otherErrors.push( $("#singleRecipientAccount").attr( "validationMessage" ) );
483  }
484  if ( viewModel.achDFIAccount !== viewModel.achDFIConfirm ) {
485  // get the validation message from the component
486  otherErrors.push( $("#singleRecipientConfirm").attr( "data-homecuCustomEquals-msg" ) );
487  }
488  if ( viewModel.achDFISelectedType === "" ) {
489  // get the validation message from the component
490  otherErrors.push( $("#achAccountType").attr( "validationMessage" ) );
491  }
492 
493  }
494 
495  $.homecuValidator.validate();
496  var totalErrors = $.homecuValidator.homecuKendoValidator.errors();
497 
498  // cannot concat errors together because there may be duplicate errors
499  for (var i = 0; i < otherErrors.length; i++) {
500  if ($.inArray(otherErrors[i], totalErrors) == -1) {
501  totalErrors.push(otherErrors[i]);
502  }
503  }
504 
505  if (totalErrors.length > 0) {
506  $.homecuValidator.displayMessage(totalErrors, $.homecuValidator.settings.statusError);
507  $.homecuValidator.homecuValidate = false;
508  } else {
509  $.homecuValidator.homecuValidate = true;
510  }
511 
512  return ( $.homecuValidator.homecuValidate );
513  }
514 
515  function ShowThisStep( step ) {
516  if ( step === 0 ) {
517  // initialize components
518  viewModel.trigger( "reset" );
519 
520  $("#achEndDate").removeAttr("required");
521  } else if ( step === 1 ) {
522  // hide the back button
523  viewModel.set( "showBack", false );
524  // hide the 2nd, 3rd and 4th steps
525  $("#achLocal").hide();
526  $("#achSingleRemote").hide();
527  $("#achFrequency").hide();
528  // show the 1st step
529  $("#achSingleRecipient").show();
530  progressSteps.value( 1 );
531  $("#stepName").html( "<?php echo $progressStep1; ?>" );
532  // now the Next button is "Next"
533  $("#nextButton").html("<?php echo $MC->msg("Next", HCU_DISPLAY_AS_JS); ?>");
534  } else if ( step === 2 ) {
535  // hide the 1st, 3rd and 4th steps
536  $("#achSingleRecipient").hide();
537  $("#achSingleRemote").hide();
538  $("#achFrequency").hide();
539  // show the 2nd step
540  $("#achLocal").show();
541  progressSteps.value( 2 );
542  $("#stepName").html( "<?php echo $progressStep2; ?>" );
543  // make sure back button is visible
544  viewModel.set( "showBack", true );
545 
546  // see if going to have a partner id
547  if ( !allowScheduled || ( !viewModel.achUpdatePartner && (viewModel.achPartnerId == 0) ) ) {
548  viewModel.set( "showScheduleInputs", false );
549  viewModel.set( "showEffectiveLabel", true );
550  } else {
551  viewModel.set( "showScheduleInputs", allowScheduled );
552  viewModel.set( "showEffectiveLabel", !(allowScheduled) );
553  }
554 
555  $("#nextButton").html("<?php echo $MC->msg("Next", HCU_DISPLAY_AS_JS); ?>");
556  } else if ( step === 3 ) {
557  // hide the 1st, 2nd and 4th steps
558  $("#achSingleRecipient").hide();
559  $("#achLocal").hide();
560  $("#achFrequency").hide();
561  // show the 3rd step
562  $("#achSingleRemote").show();
563  progressSteps.value( 3 );
564  $("#stepName").html( "<?php echo $progressStep3; ?>" );
565  // make sure back button is visible
566  viewModel.set( "showBack", true );
567  // now the Next button is "Submit"
568  $("#nextButton").html("<?php echo $MC->msg("Submit", HCU_DISPLAY_AS_JS); ?>");
569  } else {
570  // do nothing
571  }
572 
573  StartValidator( step );
574  }
575 
576  function HandleNavClick( nextStep ) {
577  // let them go back without validation
578  $.homecuValidator.displayMessage( "", $.homecuValidator.settings.statusError );
579 
580  // don't let go forward using tabs
581  if ( nextStep >= progressStep ) {
582  return;
583  }
584 
585  if ( nextStep === progressStep ) {
586  return;
587  } else if ( nextStep > progressStep ) {
588  // validate all earlier steps
589  for ( var step = 1; step <= nextStep; step++ ) {
590  if ( !ValidateThisStep( step ) ) {
591  progressStep = step;
592  ShowThisStep( progressStep );
593  return;
594  }
595  }
596  }
597 
598  progressStep = nextStep;
599  ShowThisStep( progressStep );
600  }
601 
602  function GetACHPartners() {
603  var request = { action: "get_ach_partners" };
604 
605  // get the partners and then the accounts
606  dsACHHelper.read( request ).then( function() {
607  GetACHAccounts( "<?php echo $accountsAction ?>" );
608  });
609  }
610 
611  function GetACHAccounts( action ) {
612  var request = { action: action };
613 
614  dsACHHelper.read( request );
615  }
616 
617  function SubmitACHRequest() {
618  // set up the fields
619  // for the amount, send without decimals to make validation easier
620  var amount = Math.round( viewModel.achAmount * 100 );
621 
622  var request = { action: "<?php echo $achAction ?>",
623  display_name: viewModel.achDisplayName,
624  ach_name: viewModel.achIndividualName,
625  email: viewModel.achIndividualEmail,
626  email_notify: (viewModel.achEmailNotify == "checked" ? 1 : 0),
627  address1: viewModel.achAddress1,
628  address2: viewModel.achAddress2,
629  country: viewModel.achCountry,
630  city: viewModel.achCity,
631  state: viewModel.achState,
632  zip: viewModel.achZip,
633  addenda: viewModel.achIndividualAddenda,
634  dfi_routing: viewModel.achDFIRouting,
635  dfi_account: viewModel.achDFIAccount,
636  dfi_account_type: viewModel.achDFISelectedType,
637  update_partner: (viewModel.achUpdatePartner ? 1 : 0),
638  partner_id: viewModel.achPartnerId,
639  partner_type: viewModel.achPartnerType,
640  internal_acct: viewModel.achMyAcctSelected,
641  internal_sub_acct: viewModel.achSubAcctSelected,
642  eff_date: viewModel.achEffDate,
643  end_date: viewModel.achEndDate,
644  frequency: viewModel.achFrequency,
645  continue: viewModel.achContinue,
646  amount: amount,
647  ach_type: viewModel.achType,
648  memo: viewModel.achMemo
649  };
650 
651  dsACH.read( request );
652  }
653 
654  function HandleUpdatedAccountList() {
655  achSubAccounts = [];
656  // iterate through accounts, add to sub-account list
657  for (var i = 0; i < achAllAccounts.length; i++) {
658  achSubAccounts.push({
659  name: achAllAccounts[i].account_name,
660  id: achAllAccounts[i].acctid,
661  amount: achAllAccounts[i].amount,
662  account: achAllAccounts[i].account
663  });
664  }
665 
666  // add to dropdown list
667  var dataSource = new kendo.data.DataSource({
668  data: achSubAccounts
669  });
670  var dropdownlist = $("#achSubAcctList").data("kendoDropDownList");
671  dropdownlist.setDataSource(dataSource);
672 
673  if (achSubAccounts.length == 1) {
674  dropdownlist.select(1);
675  dropdownlist.trigger("change");
676  }
677  }
678 
679  function HandleUpdatedPartnerList() {
680  // get the partner type filter list
681  var filterTest = [];
682  if ( $("#achPartnerFilterPayee").prop( "checked" ) ) {
683  filterTest.push("e");
684  }
685  if ( $("#achPartnerFilterPayroll").prop( "checked" ) ) {
686  filterTest.push("$");
687  }
688  if ( $("#achPartnerFilterPayor").prop( "checked" ) ) {
689  filterTest.push("r");
690  }
691  if ( $("#achPartnerFilterUnassigned").prop( "checked" ) ) {
692  filterTest.push("");
693  }
694 
695  // get the unique accounts from the full list
696  achCurrentList = [];
697  for ( var i = 0; i < achPartnerList.length; i++ ) {
698  var item= achPartnerList[i];
699  var test = filterTest.indexOf( item.partner_type );
700  if ( test >= 0 ) {
701  achCurrentList.push( {name: (item.ach_name+"").trim() == "" ? item.display_name : item.ach_name, id: item.id} );
702  }
703  }
704 
705  var dataSource = new kendo.data.DataSource({
706  data: achCurrentList
707  });
708 
709  // reset the selected account
710  var dropdownlist = $("#achPartnerList").data("kendoDropDownList");
711  dropdownlist.setDataSource(dataSource);
712  dropdownlist.select(0);
713 
714  ClearPartnerInfo();
715  }
716 
717 
718 
719  function InitDataSources() {
720  dsACHHelper = new kendo.data.DataSource({
721  autoSync: false,
722  batch: false,
723  transport: {
724  read: {
725  url: 'hcuACH.data?cu=<?php echo $HB_ENV['cu']; ?>',
726  dataType: "json",
727  contentType: "application/x-www-form-urlencoded",
728  type: "POST",
729  cache: false
730  }
731  },
732  schema: {
733  parse: function(response) {
734  // not showing data, so return empty array
735  var display = [];
736  return display;
737  }
738  },
739  requestStart: function( e ) {
740  ShowWaitWindow();
741  },
742  requestEnd: function( e ) {
743  var error = null;
744  var results = null;
745 
746  CloseWaitWindow();
747 
748  if ( e.response && e.response.Results ) {
749  results = e.response.Results;
750 
751  // see if there is an error
752  if ( results && results.homecuErrors )
753  error = results.homecuErrors;
754 
755  if ( error && error.length > 0 ) {
756  e.preventDefault();
757  // make sure only old data
758  dsACHHelper.cancelChanges();
759  // show the error information
760  $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
761  } else {
762  if ( results && results.homecuInfo && (results.homecuInfo.length > 0) ) {
763  ShowStatus( results.homecuInfo );
764  }
765 
766  // handle any returned data
767  if ( results && results.homecuData ) {
768  // re-set partners in case ach partner list changed
769  if ( results.homecuData.partners ) {
770  achPartnerList = results.homecuData.partners;
771 
772  HandleUpdatedPartnerList();
773  }
774 
775  // set the account lists
776  if ( results.homecuData.accounts ) {
777  achAllAccounts = results.homecuData.accounts;
778 
779  HandleUpdatedAccountList();
780  }
781 
782  // set the account lists
783  if ( results.homecuData.one_partner ) {
784  var partnerInfo = results.homecuData.one_partner;
785 
786  viewModel.set( "achPartnerType", partnerInfo.partner_type );
787  viewModel.set( "achIndividualName", partnerInfo.ach_name );
788  viewModel.set( "achDisplayName", partnerInfo.display_name );
789  viewModel.set( "achIndividualEmail", partnerInfo.email );
790  viewModel.set( "achEmailNotify", partnerInfo.email_notify ? "checked" : "" );
791  viewModel.set( "achAddress1", partnerInfo.address1 );
792  viewModel.set( "achAddress2", partnerInfo.address2 );
793  viewModel.set( "achCity", partnerInfo.city );
794  viewModel.set( "achState", partnerInfo.state );
795  viewModel.set( "achZip", partnerInfo.zip);
796  viewModel.set( "achCountry", partnerInfo.country );
797 
798  viewModel.set( "achDFIRouting", partnerInfo.dfi_routing );
799  viewModel.set( "achDFIAccount", partnerInfo.dfi_account );
800  viewModel.set( "achDFIConfirm", partnerInfo.dfi_account );
801  viewModel.set( "achDFISelectedType", partnerInfo.dfi_account_type );
802 
803  }
804  }
805 
806  }
807  } else {
808  error = "Error occurred on server that halted this operation.";
809  $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
810  }
811  },
812 
813  // code to run if the request fails; the raw request and
814  // status codes are passed to the function
815  error: function( e ) {
816  }
817  });
818 
819  dsACH = new kendo.data.DataSource({
820  autoSync: false,
821  batch: false,
822  transport: {
823  read: {
824  url: 'hcuACH.data?cu=<?php echo $HB_ENV['cu']; ?>',
825  dataType: "json",
826  contentType: "application/x-www-form-urlencoded",
827  type: "POST",
828  cache: false
829  }
830  },
831  schema: {
832  parse: function(response) {
833  // not showing data, so return empty array
834  var display = [];
835  return display;
836  }
837  },
838  requestStart: function( e ) {
839  ShowWaitWindow();
840  },
841  requestEnd: function( e ) {
842  var error = null;
843  var results = null;
844 
845  CloseWaitWindow();
846 
847  if ( e.response && e.response.Results ) {
848  results = e.response.Results;
849 
850  // see if there is an error
851  if ( results && results.homecuErrors )
852  error = results.homecuErrors;
853 
854  if ( error && error.length > 0 ) {
855 
856  $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
857  } else {
858  // at this point the submission was successful
859  // handle any returned data
860  if ( results && results.homecuData ) {
861  // re-set partners in case ach partner list changed
862  if ( results.homecuData.partners ) {
863  achPartnerList = results.homecuData.partners;
864 
865  HandleUpdatedPartnerList();
866  }
867 
868  // set the account lists
869  if ( results.homecuData.accounts ) {
870  achAllAccounts = results.homecuData.accounts;
871 
872  HandleUpdatedAccountList();
873  }
874 
875  // Show confirmation information
876  if ( results.homecuData.txn ) {
877  ShowThisStep( 0 );
878  progressStep = 1;
879  ShowThisStep( progressStep );
880 
881  // Display confirmation dialog
882  ShowConfirmation(results.homecuData.txn);
883  }
884  }
885 
886  if ( results && results.homecuInfo && (results.homecuInfo.length > 0) ) {
887  $.homecuValidator.settings.formStatusField = "confirmationStatus";
888  $.homecuValidator.settings.formInfoTitle = "";
889  $.homecuValidator.displayMessage(results.homecuInfo, $.homecuValidator.settings.statusSuccess);
890  }
891  }
892  } else {
893  error = "Error occurred on server that halted this operation.";
894  $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
895  }
896  },
897 
898  // code to run if the request fails; the raw request and
899  // status codes are passed to the function
900  error: function( e ) {
901  }
902  });
903  }
904 
905  function InitDataViews() {
906  viewModel = kendo.observable({
907  // these help control visuals
908  showScheduleInputs: false,
909  showEffectiveLabel: false,
910  showSingle: true,
911  showBatch: false,
912  showRecipient: false,
913  showPayment: false,
914  showNext: true,
915  showBack: false,
916  showContinue: false,
917  showEnd: false,
918  disableSaveButton: false,
919  // these get sent to server
920  action: "",
921  achIndividualName: "",
922  achDisplayName: "",
923  achIndividualEmail: "",
924  achEmailNotify: "",
925  achAddress1: "",
926  achAddress2: "",
927  achCity: "",
928  achState: "",
929  achZip: "",
930  achCountry: "",
931  achIndividualAddenda: "",
932  achDFIRouting: "",
933  achDFIAccount: "",
934  achDFIConfirm: "",
935  achDFISelectedType: "",
936  achUpdatePartner: true,
937  achPartnerId: 0,
938  achPartnerType: "<?php echo $initialPartnerType ?>",
939  achMyAcctSelected: "",
940  achSubAcctSelected: 0,
941  achEffDate: "",
942  achEffMin: "",
943  achEndDate: "",
944  achAmount: "",
945  achAvailable: "",
946  achType: "",
947  achMemo: "",
948  achFrequency: "OneTime",
949  achContinue: "continuous",
950  nextClick: function(e) {
951  e.preventDefault();
952 
953  // clear out any current message
954  $.homecuValidator.displayMessage( "", $.homecuValidator.settings.statusError );
955 
956  // scroll to the top - in case of error, next page, or reply from server
957  $("#content-wrapper").animate({ scrollTop: 0 }, { duration: 500 } );
958  // validate the data for the current step
959  if ( ValidateThisStep( progressStep ) ) {
960  if ( progressStep >= 3 ) {
961  // submit the payment
962  SubmitACHRequest();
963  } else {
964  progressStep++;
965  ShowThisStep( progressStep );
966  }
967  }
968  },
969  backClick: function( e ) {
970  e.preventDefault();
971 
972  // let them go back without validation
973  $.homecuValidator.displayMessage( "", $.homecuValidator.settings.statusError );
974 
975  progressStep--;
976 
977  ShowThisStep( progressStep );
978 
979  // scroll to the top
980  $("#content-wrapper").animate({ scrollTop: 0 }, { duration: 500 } );
981  },
982  partnerClick: function( e ) {
983  HandleUpdatedPartnerList();
984  },
985  cancel: function( e ) {
986  e.preventDefault();
987  <?php // go to self so can set correct cookie ?>
988  document.formCancel.submit();
989  },
990  changeEmailNotify: function(e) {
991  $(e.target).prop("checked") ?
992  this.set("achEmailNotify", "checked") :
993  this.set("achEmailNotify", "");
994  }
995  });
996 
997  // set up an error validator in case of an error
998  $.homecuValidator.setup({formErrorTitle: "<?php echo $MC->msg("Error Occurred", HCU_DISPLAY_AS_JS) ?>"});
999 
1000  // set up an event to save the data
1001  viewModel.bind( "save", function(e) {
1002  viewModel.achServer.read();
1003  });
1004 
1005  // set up an event to reset the data
1006  viewModel.bind( "reset", function(e) {
1007  ClearPartnerInfo();
1008  ClearPaymentInfo();
1009  });
1010 
1011  // set up the progress bar
1012  $("#progressBar").kendoProgressBar({
1013  type: "value",
1014  min: 0,
1015  max: 3,
1016  value: 1,
1017  change: function( e ) {
1018  progressSteps = $("#progressBar").data("kendoProgressBar");
1019  progressSteps.progressStatus.text( "(" + progressSteps.value() + " / 3)" );
1020  }
1021  });
1022  progressSteps = $("#progressBar").data("kendoProgressBar");
1023  progressSteps.progressStatus.text( "(1 / 3)" );
1024 
1025  // start at first step
1026  progressSteps.value( 1 );
1027 
1028  // set up the initial look of the screen
1029  ShowThisStep( 0 );
1030 
1031  // bind the visual to the view model
1032  kendo.bind($("#ach-payment"), viewModel);
1033 
1034  $("#achPartnerList").kendoDropDownList({
1035  dataTextField: "name",
1036  dataValueField: "id",
1037  dataSource: achPartnerList,
1038  optionLabel: {id: "", name: "<?php echo $MC->msg("ACH New Partner Below", HCU_DISPLAY_AS_JS) ?>"},
1039  change: function(e) {
1040  // get the partner information from the server
1041  var whichId = this.value();
1042 
1043  ClearPartnerInfo();
1044 
1045 
1046  if ( whichId > 0 ) {
1047  var request = { action: "ach_partner", partner_id: whichId };
1048 
1049  dsACHHelper.read( request );
1050 
1051  $("#partnerLabel").html("<?php echo $MC->msg("ACH Edit Partner", HCU_DISPLAY_AS_JS) ?>");
1052  } else {
1053  $("#partnerLabel").html("<?php echo $MC->msg("ACH Enter Partner", HCU_DISPLAY_AS_JS) ?>");
1054  }
1055 
1056  // put the selected id in the achPartnerId field
1057  viewModel.set( "achPartnerId", whichId );
1058  }
1059  });
1060 
1061  $("#achFrequencySelect").kendoDropDownList({
1062  dataTextField: "text",
1063  dataValueField: "value",
1064  dataSource: achFrequencyIntervals,
1065  change: checkTermsScheduled
1066  });
1067 
1068  $("#achFrequencyContinue").kendoDropDownList({
1069  dataTextField: "text",
1070  dataValueField: "value",
1071  dataSource: achFrequencyContinue,
1072  change: function(e) {
1073  var dropdown = this;
1074  var dropdownValue = dropdown.value();
1075  var showEnd =
1076  dropdownValue != "continuous";
1077 
1078  if (showEnd) {
1079  $("#achEndDate").attr("required", true);
1080  } else {
1081  $("#achEndDate").removeAttr("required");
1082  $("#achEndDate").data("kendoDatePicker").value("");
1083  viewModel.set("achEndDate", "");
1084  }
1085 
1086  viewModel.set("showEnd", showEnd);
1087  }
1088  });
1089 
1090  $("#achAccountType").kendoDropDownList({
1091  dataTextField: "display",
1092  dataValueField: "type",
1093  dataSource: achAccountTypes,
1094  optionLabel: {type: "", display: "<?php echo $MC->msg("ACH Select Type", HCU_DISPLAY_AS_JS) ?>"},
1095  });
1096 
1097  $("#achPartnerFilter").kendoMultiSelect({
1098  dataTextField: "display",
1099  dataValueField: "type",
1100  placeholder: "<?php echo $MC->msg("Click Here", HCU_DISPLAY_AS_JS); ?>",
1101  dataSource: achPartnerTypes,
1102  dataBound: function( e ) {
1103  var multiselect = $("#achPartnerFilter").data("kendoMultiSelect");
1104 
1105  multiselect.value(["<?php echo $initialPartnerType ?>"]);
1106  },
1107  change: function( e ) {
1108  HandleUpdatedPartnerList();
1109  }
1110  });
1111 
1112  // set up the partner filter
1113  $(".partner-filter-chooser").click( function() {
1114  HandleUpdatedPartnerList();
1115  });
1116 
1117  $("#achPartnerType").kendoDropDownList({
1118  dataTextField: "display",
1119  dataValueField: "type",
1120  dataSource: achPartnerTypes,
1121  valueTemplate: "#= display #",
1122  template: "#= display #"
1123  });
1124 
1125  $("#achSubAcctList").kendoDropDownList({
1126  dataTextField: "name",
1127  dataValueField: "id",
1128  dataSource: achSubAccounts,
1129  valueTemplate: '<span class="local-subleft">#: name #</span><span class="local-subright">#: amount #</span>',
1130  template: '<span class="k-state-default"><span class="local-subleft local-subname">#: name #</span><span class="local-subright">#: amount #</span></span>',
1131  optionLabel: {name: "<?php echo $MC->msg("ACH Select Account", HCU_DISPLAY_AS_JS) ?>", id: "", amount: ""},
1132  change: function(e) {
1133  var dataIndex = this.selectedIndex > 0 ? this.selectedIndex-1 : 0;
1134  var dataSource = this.dataSource.data();
1135  var dataItem = dataSource[dataIndex];
1136 
1137  var selectedAccount = dataItem.account;
1138  var selectedAvailable = dataItem.amount.substring(1);
1139 
1140  viewModel.set("achMyAcctSelected", selectedAccount);
1141  viewModel.set("achAvailable", selectedAvailable);
1142  }
1143  });
1144 
1145  // set up initial state
1146  if ( "<?php echo $initialPartnerType ?>" === "e" ) {
1147  $("#achPartnerFilterPayee").prop( "checked", true );
1148  $("#achPartnerFilterPayroll").prop( "checked", true );
1149  $("#achPartnerFilterUnassigned").prop( "checked", true );
1150  } else if ( "<?php echo $initialPartnerType ?>" === "r" ) {
1151  $("#achPartnerFilterPayor").prop( "checked", true );
1152  $("#achPartnerFilterUnassigned").prop( "checked", true );
1153  } else {
1154  $("#achPartnerFilterUnassigned").prop( "checked", true );
1155  }
1156 
1157  // get the partner's list
1158  GetACHPartners();
1159 
1160  // set up the date picker to also be a masked text box
1161  effDatePicker = $("#achEffDate");
1162  endDatePicker = $("#achEndDate");
1163  endDatePicker.kendoMaskedTextBox({
1164  mask: "00/00/0000"
1165  });
1166 
1167  effDatePicker.kendoMaskedTextBox({
1168  mask: "00/00/0000"
1169  });
1170 
1171  endDatePicker.kendoDatePicker({
1172  min: new Date(<?php echo date('Y', $initialEffDateTimestamp) . ', ' . (date('n', $initialEffDateTimestamp) - 1) .', ' . (date('j', $initialEffDateTimestamp) + 1); ?>),
1173  format: "MM/dd/yyyy"
1174  });
1175 
1176  effDatePicker.kendoDatePicker({
1177  min: new Date(<?php echo date('Y', $initialEffDateTimestamp) . ', ' . (date('n', $initialEffDateTimestamp) - 1) .', ' . (date('j', $initialEffDateTimestamp)); ?>),
1178  format: "MM/dd/yyyy",
1179  change: checkTermsScheduled
1180  });
1181 
1182  endDatePicker.closest(".k-datepicker").add(endDatePicker).removeClass("k-textbox");
1183  effDatePicker.closest(".k-datepicker").add(effDatePicker).removeClass("k-textbox");
1184 
1185  $("#singleState").kendoDropDownList({
1186  dataTextField: "name",
1187  dataValueField: "value",
1188  dataSource: achStateList,
1189  optionLabel: {value: "", name: "<?php echo $MC->msg("ACH Select State", HCU_DISPLAY_AS_JS) ?>"},
1190  });
1191 
1192  // masked zip code (just US for now)
1193  $("#singleZip").kendoMaskedTextBox({
1194  mask: "00000-9999",
1195  clearPromptChar: true
1196  });
1197 
1198  // masked for routing number (always 9 digits)
1199  $("#singleRecipientRouting").kendoMaskedTextBox({
1200  mask: "000000000",
1201  clearPromptChar: true
1202  });
1203 
1204  $("#achAmount").kendoNumericTextBox({
1205  min: 0.01,
1206  max: <?php echo $allowedAmount ?>,
1207  format: "c",
1208  decimals: 2,
1209  restrictDecimals: true,
1210  spinners: false
1211  });
1212 
1213  // set focus on the contents after selecting
1214  $("#achAmount").focus(function() {
1215  var input = $(this);
1216 
1217  clearTimeout(input.data("selectTimeId")); //stop started time out if any
1218 
1219  var selectTimeId = setTimeout(function() {
1220  input.select();
1221  }, 10);
1222 
1223  input.data("selectTimeId", selectTimeId);
1224  }).blur(function(e) {
1225  clearTimeout($(this).data("selectTimeId")); //stop started timeout
1226  });
1227 
1228  // handle clicking on the tab strip
1229  $("#step1").click( function(e) {
1230  e.preventDefault();
1231  HandleNavClick(1);
1232  });
1233  $("#step2").click( function(e) {
1234  e.preventDefault();
1235  HandleNavClick(2);
1236  });
1237  $("#step3").click( function(e) {
1238  e.preventDefault();
1239  HandleNavClick(3);
1240  });
1241 
1242  $('#formChangeType').change(function(){
1243  $('#formChangeType').submit();
1244  });
1245 
1246  progressStep = 1;
1247  ShowThisStep( progressStep );
1248 
1249  // handle clicking on the ach type button group
1250  $("#achTypeBatch").click( function(e) {
1251  $("#achFeatureChoice").val( "<?php echo $batchButton ?>" );
1252  $("#formChangeType").submit();
1253  });
1254 
1255  homecuTooltip.bind({
1256  achNotifyTip:
1257  "<?php echo $MC->msg("ACH Notify Info Init", HCU_DISPLAY_AS_JS); ?> " +
1258  "<?php echo $MC->msg("ACH Notify Info Single", HCU_DISPLAY_AS_JS); ?>",
1259  companyNameTip: "<?php echo $MC->msg("ACH Company Name Help", HCU_DISPLAY_AS_JS) ?>"
1260  });
1261 
1262  // Confirmation dialog
1263  $("#confirmationWindow").kendoDialog({
1264  title: "<?php echo $MC->msg('ACH Transaction Confirmation'); ?>",
1265  width: "85%",
1266  maxWidth: "768px",
1267  minWidth: "300px",
1268  modal: true,
1269  visible: false,
1270  resizable: false,
1271  actions: [
1272  {
1273  text: "<?php echo $MC->msg('Close', HCU_DISPLAY_AS_JS); ?>",
1274  primary: true
1275  }
1276  ],
1277  show: function(e) {
1278  windowStack.push(this);
1279  },
1280  close: function(e) {
1281  windowStack.pop();
1282 
1283  // Reset validator to use page status field.
1284  $.homecuValidator.settings.formStatusField = "formStatus";
1285  $.homecuValidator.settings.formInfoTitle = "";
1286  }
1287  });
1288  }
1289 
1290  function InitScreen() {
1291  InitDataSources();
1292  InitDataViews();
1293 
1294  // initialize then display
1295  $("#ach-payment").show();
1296  }
1297 
1298  $(document).ready(function() {
1299  if (terms) {
1300  ShowNotice('<?php echo $termsURLACH; ?>', "<?php echo $termsLinkDisplayACH ?>", acceptACHTerms, declineACHTerms);
1301  } else if (notice) {
1302  InitScreen();
1303  ShowNotice('<?php echo $noticeURLACH; ?>', "<?php echo $noticeLinkDisplayACH ?>");
1304  } else {
1305  InitScreen();
1306  }
1307  }); // end ready function
1308 
1309  function acceptACHTerms() {
1310  InitScreen();
1311 
1312  if (notice) {
1313  ShowNotice('<?php echo $noticeURLACH; ?>', "<?php echo $noticeLinkDisplayACH ?>");
1314  }
1315  }
1316 
1317  function declineACHTerms() {
1318  // if they do not accept, send them to banking accounts screen
1319  ShowWaitWindow();
1320 
1321  var urlInit = window.location.href.substring(0, window.location.href.indexOf("hcu"));
1322  var urlCu = "<?php echo $Cu ?>";
1323  var urlPage = "hcuAccounts.prg";
1324  var urlRedirect = urlInit + urlPage + "?cu=" + urlCu;
1325 
1326  window.location.replace(urlRedirect);
1327  }
1328 
1329  // use this function to check if scheduled terms are necessary
1330  // otherwise we would need to double the code for selectRepeatFreq.
1331  function checkTermsScheduled(e) {
1332  if (termsScheduled) {
1333  ShowNotice("<?php echo $termsURLRPT; ?>", "<?php echo $termsLinkDisplayRPT; ?>",
1334  function() {
1335  // set termsRPT t false so terms dont show every time
1336  termsScheduled = false;
1337 
1338  // accept terms, continue as normal
1339  if (e.sender.element[0].id == "achFrequencySelect") {
1340  selectRepeatFreq(e);
1341  }
1342 
1343  },
1344  function() {
1345  // decline terms, prevent change
1346  e.preventDefault();
1347 
1348  // set frequency to One Time
1349  $("#achFrequencySelect").data("kendoDropDownList").value("OneTime");
1350 
1351  // set start date to todays date
1352  $("#achEffDate").data("kendoDatePicker").value("<?php echo $initialEffDate; ?>");
1353  }
1354  );
1355  } else {
1356  if (e.sender.element[0].id == "achFrequencySelect") {
1357  selectRepeatFreq(e);
1358  }
1359  }
1360  }
1361 
1362  function selectRepeatFreq(e) {
1363  var dropdown = e.sender;
1364  var dropdownValue = dropdown.value();
1365  var dropdownContinue = $("#achFrequencyContinue").data("kendoDropDownList");
1366  var dropdownContinueValue = dropdownContinue.value();
1367  var pickerEnd = endDatePicker.data("kendoDatePicker");
1368  var pickerEff = effDatePicker.data("kendoDatePicker");
1369 
1370  var showContinue =
1371  dropdownValue != "OneTime";
1372  var showEnd =
1373  dropdownValue != "OneTime" &&
1374  dropdownContinueValue != "continuous";
1375 
1376  if (showEnd) {
1377  $("#achEndDate").attr("required", true);
1378  } else {
1379  $("#achEndDate").removeAttr("required");
1380  $("#achEndDate").data("kendoDatePicker").value("");
1381  }
1382 
1383  viewModel.set("showContinue", showContinue);
1384  viewModel.set("showEnd", showEnd);
1385  }
1386 
1387  function ShowConfirmation(txn) {
1388  var confirmationTemplate = kendo.template($("#confirmationTemplate").html());
1389  var confirmationDisplay = confirmationTemplate(txn);
1390 
1391  $("#confirmationWindow").data("kendoDialog").content(confirmationDisplay);
1392  $("#confirmationWindow").data("kendoDialog").open();
1393  }
1394 
1395  // Handle clicking on the overlay
1396  $(document).on("click", ".k-overlay", function (e) {
1397  if(windowStack.length > 0) {
1398  // get the close function from the stack, without poping it (the close will pop it)
1399  if (windowStack.length > 0) {
1400  var win = windowStack[windowStack.length-1];
1401  win.close();
1402  }
1403  }
1404  });
1405 
1406 </script>
1407 
1408 <div id="disclosureWindow" name="disclosureWindow"></div>
1409 <style type="text/css">
1410 /**
1411  * Tab directives:
1412  */
1413  .local-subleft { float:left; }
1414  .local-subname { font-weight: 500; }
1415  .local-subright { float:right; }
1416 
1417  .tabFooter > div {
1418  border-top: 2px solid rgba(0,0,0,.37);
1419  }
1420 
1421  .tabSpacer {
1422  margin-top: 10px;
1423  }
1424  .tabHide {
1425  display:none;
1426  }
1427 
1428  .ach-title {
1429  font-size: 24px;
1430  font-weight: 500;
1431  margin-top: 5px;
1432  margin-bottom: 5px;
1433  }
1434  .ach-switch-button {
1435  margin-bottom: 15px;
1436  }
1437 
1438  #ach-payment {
1439  max-width: 700px;
1440  margin-left: 0px;
1441  }
1442 
1443  /* same as control-label but for regular text */
1444  .local-text-offset {
1445  padding-top: 7px;
1446  margin-bottom: 0;
1447  text-align: left;
1448  }
1449 
1450  .response-label {
1451  font-weight: bold;
1452  }
1453 
1454  .local-transfer-msg {
1455  padding: 1em;
1456  }
1457 
1458  /* Small devices @screen-sm-min (tablets, 768px and up) */
1459  @media (min-width: 768px) {
1460  }
1461 
1462  /* Medium devices @screen-md-min (desktops, 992px and up) */
1463  @media (min-width: 992px) {
1464  }
1465 </style>
1466 <div id="confirmationWindow"></div>
1467 <div class="k-content container-fluid" id="ach-payment" style="display: none;">
1468  <div class='ach-title'><?php echo $pageTitle ?></div>
1469  <form method="post" id="formChangeType" name="formChangeType" action='<?php echo $HB_ENV["loginpath"]."/{$HB_ENV['currentscript']}?".$HB_ENV["cuquery"] ?>'>
1470  <input type='hidden' id="achFeatureChoice" name='ach_feature' value='' />
1471  </form>
1472  <div class="col-xs-12">
1473  <div class="row">
1474  <div class="col-xs-4 ach-switch-button">
1475  <div class="btn-group" role="group" aria-label="...">
1476  <button type="button" id="achTypeSingle" class="btn btn-primary"><?php echo $MC->msg("ACH Single", HCU_DISPLAY_AS_HTML); ?></button>
1477  <button type="button" id="achTypeBatch" class="btn btn-default"><?php echo $MC->msg("ACH Batch", HCU_DISPLAY_AS_HTML); ?></button>
1478  </div>
1479  </div>
1480 
1481  <div class="col-xs-8 text-right">
1482  <label><?php echo $MC->msg("ACH Company Name Label", HCU_DISPLAY_AS_HTML); ?>: <span class="fa fa-question-circle-o" id="companyNameTip"></span></label><br>
1483  <span> <?php echo $companyData['group_name']; ?></span>
1484  </div>
1485  </div>
1486  </div>
1487  <div class="row">
1488  <div class="col-xs-12">
1489  <div id="stepName"><?php echo $progressStep1; ?></div>
1490  </div>
1491  </div>
1492  <div class="row">
1493  <div class="col-xs-12">
1494  <div id="progressBar" class="hcu-all-100"></div>
1495  </div>
1496  </div>
1497  <div class="row">
1498  <div class="col-xs-12">&nbsp;</div>
1499  </div>
1500  <?php // this tab is for choosing a recipient with a single payment
1501  ?>
1502  <div class="tabSingleRecipient tabHide" id="achSingleRecipient">
1503  <div class="tabContents">
1504  <div class="well well-sm">
1505  <div class="form-horizontal">
1506  <div class="form-group">
1507  <label class="col-sm-3 col-xs-12 control-label"><?php echo $MC->msg("ACH Type", HCU_DISPLAY_AS_HTML); ?><span class="hcu-required-field"><sup>*</sup></span></label>
1508  <div class="col-sm-9 col-xs-12">
1509  <label class="radio-inline">
1510  <input type='radio'
1511  name='ach_entry_type'
1512  value='ppd'
1513  data-bind="checked: achType"
1514  required>&nbsp;<?php echo $MC->msg("ACH PPD", HCU_DISPLAY_AS_HTML); ?>
1515  </label>
1516  <label class="radio-inline">
1517  <input type='radio'
1518  name='ach_entry_type'
1519  value='ccd'
1520  data-bind="checked: achType">&nbsp;<?php echo $MC->msg("ACH CCD", HCU_DISPLAY_AS_HTML); ?>
1521  </label>
1522  </div>
1523  </div>
1524  <div data-bind="visible: achType">
1525  <div class="hcu-filter-group">
1526  <div class="row">
1527  <div class="col-xs-12 col-sm-12 h4"><?php echo $MC->msg("ACH Choose Partner", HCU_DISPLAY_AS_HTML); ?></div>
1528  </div>
1529  <div class="form-group">
1530  <div class="col-sm-3 hidden-xs">&nbsp;</div>
1531  <div class="col-sm-6 col-xs-12"><div id="achPartnerList" class="hcu-all-100"></div></div>
1532  </div>
1533  <div class="form-group">
1534  <div class="col-sm-3 hidden-xs">&nbsp;</div>
1535  <div class="col-sm-2 col-sm-offset-0 col-xs-10 col-xs-offset-1">
1536  <label class="checkbox-inline">
1537  <input type="checkbox" id="achPartnerFilterPayee" class="partner-filter-chooser">&nbsp;<?php echo $MC->msg("ACH Payee", HCU_DISPLAY_AS_HTML); ?>
1538  </label>
1539  </div>
1540  <div class="col-sm-2 col-sm-offset-0 col-xs-10 col-xs-offset-1">
1541  <label class="checkbox-inline">
1542  <input type="checkbox" id="achPartnerFilterPayroll" class="partner-filter-chooser">&nbsp;<?php echo $MC->msg("ACH Payroll", HCU_DISPLAY_AS_HTML); ?>
1543  </label>
1544  </div>
1545  <div class="col-sm-2 col-sm-offset-0 col-xs-10 col-xs-offset-1">
1546  <label class="checkbox-inline">
1547  <input type="checkbox" id="achPartnerFilterPayor" class="partner-filter-chooser">&nbsp;<?php echo $MC->msg("ACH Payor", HCU_DISPLAY_AS_HTML); ?>
1548  </label>
1549  </div>
1550  <div class="col-sm-2 col-sm-offset-0 col-xs-10 col-xs-offset-1">
1551  <label class="checkbox-inline">
1552  <input type="checkbox" id="achPartnerFilterUnassigned" class="partner-filter-chooser">&nbsp;<?php echo $MC->msg("ACH Unassigned", HCU_DISPLAY_AS_HTML); ?>
1553  </label>
1554  </div>
1555  </div>
1556  </div>
1557  <div class="row">
1558  <div class="col-xs-12">&nbsp;</div>
1559  </div>
1560  <div class="form-group">
1561  <div class="col-xs-12 h4"><span id='partnerLabel'><?php echo $MC->msg("ACH Partner Information", HCU_DISPLAY_AS_HTML); ?></span></div>
1562  </div>
1563  <div class="form-group">
1564  <div class="col-sm-3 col-xs-12 control-label"><label for="achPartnerType"><?php echo $MC->msg("ACH Partner Type", HCU_DISPLAY_AS_HTML); ?></label></div>
1565  <div class="col-sm-6 col-xs-12"><div id="achPartnerType" class="hcu-all-100" data-bind="value: achPartnerType" ></div></div>
1566  </div>
1567  <div class="form-group">
1568  <label for="singleDisplayName" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("ACH Display Name", HCU_DISPLAY_AS_HTML); ?><span class="hcu-required-field"><sup>*</sup></span></label>
1569  <div class="col-xs-12 col-sm-6">
1570  <input type="text"
1571  id="singleDisplayName"
1572  name="singleDisplayName"
1573  class="k-textbox hcu-all-100"
1574  maxlength="100"
1575  data-bind="value: achDisplayName"
1576  validationMessage="<?php echo $MC->msg("ACH Unique display name required", HCU_DISPLAY_AS_HTML) ?>"
1577  required />
1578  </div>
1579  </div>
1580  <div class="form-group">
1581  <label for="singleRecipientName" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("Name", HCU_DISPLAY_AS_HTML); ?></label>
1582  <div class="col-xs-12 col-sm-6">
1583  <input type="text" id="singleRecipientName" class="k-textbox hcu-all-100" maxlength="100" data-bind="value: achIndividualName" />
1584  </div>
1585  </div>
1586  <div class="form-group">
1587  <label for="singleRecipientEmail" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("ACH E-Mail", HCU_DISPLAY_AS_HTML); ?></label>
1588  <div class="col-xs-12 col-sm-6">
1589  <input type="email" id="singleRecipientEmail" class="k-textbox hcu-all-100" maxlength="100" homecu-match="email" data-bind="value: achIndividualEmail" />
1590  </div>
1591  <div class="col-xs-12 col-sm-2">
1592  <div class="checkbox"><label><input type="checkbox" data-bind="checked: achEmailNotify, events: {change: changeEmailNotify}" >&nbsp;<?php echo $MC->msg("Notify", HCU_DISPLAY_AS_HTML); ?>&nbsp;</label><span class="fa fa-question-circle-o" id="achNotifyTip"></span></div>
1593  </div>
1594  </div>
1595  <div class="form-group">
1596  <div class="col-xs-12 h4"><?php echo $MC->msg("ACH Partner Address", HCU_DISPLAY_AS_HTML); ?></div>
1597  </div>
1598  <div class="form-group">
1599  <label for="singleAddress1" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("ACH Address", HCU_DISPLAY_AS_HTML) . " 1"; ?></label>
1600  <div class="col-xs-12 col-sm-6">
1601  <input type="text" id="singleAddress1" class="k-textbox hcu-all-100" maxlength="100" data-bind="value: achAddress1" />
1602  </div>
1603  </div>
1604  <div class="form-group">
1605  <label for="singleAddress2" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("ACH Address", HCU_DISPLAY_AS_HTML) . " 2"; ?></label>
1606  <div class="col-xs-12 col-sm-6">
1607  <input type="text" id="singleAddress2" class="k-textbox hcu-all-100" maxlength="100" data-bind="value: achAddress2" />
1608  </div>
1609  </div>
1610  <div class="form-group">
1611  <label class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("ACH CityStateZip", HCU_DISPLAY_AS_HTML); ?></label>
1612  <div class="col-xs-12 col-sm-3">
1613  <input type="text" id="singleCity" class="k-textbox hcu-all-100" maxlength="30" data-bind="value: achCity" />
1614  </div>
1615  <div class="col-xs-12 col-sm-3">
1616  <input type="text" id="singleState" class="hcu-all-100" maxlength="20" data-bind="value: achState" />
1617  </div>
1618  <div class="col-xs-12 col-sm-3">
1619  <input type="text" id="singleZip" class="hcu-all-100" data-bind="value: achZip" />
1620  </div>
1621  </div>
1622  <div class="form-group">
1623  <label for="singleCountry" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("ACH Country", HCU_DISPLAY_AS_HTML); ?></label>
1624  <div class="col-xs-12 col-sm-6">
1625  <input type="text" id="singleCountry" class="k-textbox hcu-all-100" maxlength="100" data-bind="value: achCountry" />
1626  </div>
1627  </div>
1628  <div class="form-group">
1629  <div class="hidden-xs col-sm-3">&nbsp;</div>
1630  <div class="col-xs-12 col-sm-6"><div class="checkbox"><label><input type="checkbox" data-bind="checked: achUpdatePartner">&nbsp;<?php echo $MC->msg("ACH Update Partner List", HCU_DISPLAY_AS_HTML); ?></label></div></div>
1631  </div>
1632  </div>
1633  <div class="form-group">
1634  <div class="hidden-xs col-sm-3">&nbsp;</div>
1635  <div class="col-xs-12 col-sm-6"><span class="hcu-required-field"><sup>*</sup></span><?php echo $MC->msg("ACH Required", HCU_DISPLAY_AS_HTML); ?></div>
1636  </div>
1637  </div>
1638  </div>
1639  </div>
1640  </div>
1641  <?php // this tab is for setting withdrawl/deposit account information (for payments or collections)
1642  ?>
1643  <div class="tabPayment tabHide" id="achLocal">
1644  <div class="tabContents">
1645  <div class="form-horizontal">
1646  <div class="well well-sm">
1647  <div class="form-group">
1648  <div class="col-xs-12 h4"><?php echo $termActivity ?></div>
1649  </div>
1650  <div class="form-group">
1651  <label class="col-xs-12 col-sm-3 control-label"><?php echo $accountTypeWords ?><span class="hcu-required-field"><sup>*</sup></span></label>
1652  <div class="col-xs-12 col-sm-9 col-md-6"><input id="achSubAcctList"
1653  name="achSubAcctList"
1654  class="hcu-all-100"
1655  data-bind="value: achSubAcctSelected"
1656  validationMessage="<?php echo $MC->msg("Please select an account", HCU_DISPLAY_AS_HTML) ?>"
1657  required="required" /></div>
1658  </div>
1659  <div class="form-group">
1660  <label for="achAmount" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("Amount", HCU_DISPLAY_AS_HTML); ?><span class="hcu-required-field"><sup>*</sup></span></label>
1661  <div class="col-xs-12 col-sm-4"><input id="achAmount"
1662  name="achAmount"
1663  class="hcu-all-100"
1664  required="required"
1665  data-bind="value: achAmount"
1666  validationMessage="<?php echo $MC->msg("ACH Amount needed", HCU_DISPLAY_AS_HTML) ?>"
1667  /><span class="k-invalid-msg" data-for="achAmount"></span></div>
1668  </div>
1669  <div class="form-group">
1670  <label class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("ACH Memo", HCU_DISPLAY_AS_HTML); ?></label>
1671  <div class="col-xs-12 col-sm-9 col-md-6"><input type="text"
1672  class="k-textbox hcu-all-100"
1673  maxlength="100"
1674  placeholder="<?php echo $MC->msg("ACH memo reminder", HCU_DISPLAY_AS_HTML); ?>"
1675  data-bind="value: achMemo" /></div>
1676  </div>
1677  <div class="form-group" data-bind="visible: showEffectiveLabel">
1678  <label class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg('ACH Effective Date', HCU_DISPLAY_AS_HTML) ?></label>
1679  <div class="col-xs-12 col-sm-2 local-text-offset">
1680  <span data-bind="text: achEffDate"></span>
1681  </div>
1682  <div class="col-xs-12 col-sm-7 hcu-secondary">
1683  <span class="hcu-secondary-alt-text"><?php echo $achCutoffMessageString; ?></span>
1684  </div>
1685  </div>
1686  <div class="form-group" data-bind="visible: showScheduleInputs">
1687  <label class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg('ACH Effective Date', HCU_DISPLAY_AS_HTML) ?><span class="hcu-required-field"><sup>*</sup></span></label>
1688  <div class="col-xs-12 col-sm-4"><input id="achEffDate"
1689  name="achEffDate"
1690  class="hcu-all-100"
1691  data-bind="value: achEffDate"
1692  data-min="achEffMin"
1693  homecu-match='date'
1694  homecu-dategtvalue="<?php echo $initialEffDate; ?>"
1695  homecu-dategttype="string"
1696  validationMessage="<?php echo $MC->msg("ACH Date in past", HCU_DISPLAY_AS_HTML) ?>"
1697  data-required-msg="<?php echo $MC->msg("ACH Enter Effective Date", HCU_DISPLAY_AS_HTML) ?>"
1698  required /></div>
1699  <div class="col-xs-12 col-sm-5 hcu-secondary">
1700  <span class="hcu-secondary-alt-text"><?php echo $achCutoffMessageString; ?></span>
1701  </div>
1702  </div>
1703  <div class="form-group" data-bind="visible: showScheduleInputs">
1704  <label for="singleFrequencySelect" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg('Repeat', HCU_DISPLAY_AS_HTML); ?></label>
1705  <div class="col-xs-12 col-sm-5"><input id="achFrequencySelect"
1706  class="hcu-all-100"
1707  maxlength="10"
1708  data-bind="value: achFrequency" /></div>
1709  </div>
1710  <div class="form-group" data-bind="visible: showContinue">
1711  <label for="singleFrequencyContinue" class="col-xs-12 col-sm-3 control-label"></label>
1712  <div class="col-xs-12 col-sm-5"><input id="achFrequencyContinue"
1713  class="hcu-all-100"
1714  maxlength="10"
1715  data-bind="value: achContinue" /></div>
1716  </div>
1717  <div class="form-group" data-bind="visible: showEnd">
1718  <label class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("End Date", HCU_DISPLAY_AS_HTML); ?><span class="hcu-required-field"><sup>*</sup></span></label>
1719  <div class="col-xs-12 col-sm-5"><input id="achEndDate"
1720  name="achEndDate"
1721  class="hcu-xs-100-only"
1722  placeholder="e.g. MM/DD/YYYY"
1723  data-bind="value: achEndDate"
1724  homecu-match='date'
1725  homecu-dategtvalue="achEffDate"
1726  homecu-dategttype="field"
1727  validationMessage="<?php echo $MC->msg('Continue Until must be entered', HCU_DISPLAY_AS_HTML); ?>"
1728  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); ?>"
1729  data-homecuCustomDateGTValue-msg="<?php echo $MC->msg('Stop date after transfer', HCU_DISPLAY_AS_HTML); ?>"/></div>
1730  </div>
1731  <div class="form-group">
1732  <div class="hidden-xs col-sm-3">&nbsp;</div>
1733  <div class="col-xs-12 col-sm-6"><span class="hcu-required-field"><sup>*</sup></span><?php echo $MC->msg("ACH Required", HCU_DISPLAY_AS_HTML); ?></div>
1734  </div>
1735  </div>
1736  </div>
1737  </div>
1738  </div>
1739  <?php // this tab is for setting remote account information (for single)
1740  ?>
1741  <div class="tabPayment tabHide" id="achSingleRemote">
1742  <div class="tabContents">
1743  <div class="well well-sm form-horizontal">
1744  <div class="form-group">
1745  <div class="col-xs-12 h4">&nbsp;<?php echo $MC->msg("ACH Remote Account", HCU_DISPLAY_AS_HTML); ?></div>
1746  </div>
1747  <div class="form-group">
1748  <label for="singleRecipientRouting" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg("ACH Routing Number", HCU_DISPLAY_AS_HTML); ?><span class="hcu-required-field"><sup>*</sup></span></label>
1749  <div class="col-xs-12 col-sm-6"><input id="singleRecipientRouting"
1750  class="hcu-all-100"
1751  data-bind="value: achDFIRouting"
1752  homecu-minlen="9"
1753  homecu-maxlen="9"
1754  validationMessage="<?php echo $MC->msg("ACH Routing number 9 digits", HCU_DISPLAY_AS_HTML); ?>"
1755  required /></div>
1756  </div>
1757  <div class="form-group">
1758  <label for="singleRecipientAccount" class="col-xs-12 col-sm-3 control-label"><?php echo $dfiAccountWords ?><span class="hcu-required-field"><sup>*</sup></span></label>
1759  <div class="col-xs-12 col-sm-6"><input type="text"
1760  id="singleRecipientAccount"
1761  class="k-textbox hcu-all-100 account-match"
1762  maxlength="20"
1763  data-bind="value: achDFIAccount"
1764  validationMessage="<?php echo $MC->msg('ACH Need remote account', HCU_DISPLAY_AS_HTML); ?>"
1765  required /></div>
1766  </div>
1767  <div class="form-group">
1768  <label for="singleRecipientAccountConfirm" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg('ACH Confirm Account', HCU_DISPLAY_AS_HTML); ?><span class="hcu-required-field"><sup>*</sup></span></label>
1769  <div class="col-xs-12 col-sm-6"><input type="text"
1770  id="singleRecipientConfirm"
1771  class="k-textbox hcu-all-100 account-match"
1772  maxlength="20"
1773  homecu-equals="account-match"
1774  data-homecuCustomEquals-msg="<?php echo $MC->msg('ACH Accounts no match', HCU_DISPLAY_AS_HTML); ?>"
1775  data-bind="value: achDFIConfirm"
1776  required /></div>
1777  </div>
1778  <div class="form-group">
1779  <label for="singleRecipientAccountType" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg('Account Type', HCU_DISPLAY_AS_HTML); ?><span class="hcu-required-field"><sup>*</sup></span></label>
1780  <div class="col-xs-12 col-sm-5"><input id="achAccountType"
1781  class="hcu-all-100"
1782  maxlength="10"
1783  data-bind="value: achDFISelectedType"
1784  validationMessage="<?php echo $MC->msg('ACH Need remote account type', HCU_DISPLAY_AS_HTML) ?>"
1785  required /></div>
1786  </div>
1787  <div class="form-group">
1788  <div class="col-xs-12">&nbsp;</div>
1789  </div>
1790  <div class="form-group">
1791  <label for="singleRecipientAddenda" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg('ACH Addenda', HCU_DISPLAY_AS_HTML) ?></label>
1792  <div class="col-xs-12 col-sm-6">
1793  <input type="text" id="singleRecipientAddenda" class="k-textbox hcu-all-100" maxlength="100" placeholder="<?php echo $MC->msg('ACH Optional pmt msg', HCU_DISPLAY_AS_HTML) ?>" data-bind="value: achIndividualAddenda" />
1794  </div>
1795  </div>
1796  <div class="form-group">
1797  <div class="hidden-xs col-sm-3">&nbsp;</div>
1798  <div class="col-xs-12 col-sm-6"><span class="hcu-required-field"><sup>*</sup></span><?php echo $MC->msg('ACH Required', HCU_DISPLAY_AS_HTML) ?></div>
1799  </div>
1800  </div>
1801  </div>
1802  </div>
1803  <?php // this tab is for setting frequency for scheduled transactions (single only)
1804  ?>
1805  <div class="tabPayment tabHide" id="achFrequency">
1806  <div class="tabContents">
1807  <div class="well well-sm form-horizontal">
1808  <div class="form-group">
1809  <div class="col-xs-12 h4">&nbsp;<?php echo $MC->msg("ACH Frequency", HCU_DISPLAY_AS_HTML); ?></div>
1810  </div>
1811  <div class="form-group">
1812  <label class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg('ACH Effective Date', HCU_DISPLAY_AS_HTML) ?><span class="hcu-required-field"><sup>*</sup></span></label>
1813  <div class="col-xs-12 col-sm-5"><input id="achEffDate"
1814  name="achEffDate"
1815  class="hcu-xs-100-only"
1816  data-bind="value: achEffDate"
1817  homecu-match='date'
1818  homecu-dategtvalue="<?php echo date("m/d/y") ?>"
1819  homecu-dategttype="string"
1820  validationMessage="<?php echo $MC->msg("ACH Date in past", HCU_DISPLAY_AS_HTML) ?>"
1821  required="required" /></div>
1822  </div>
1823  <div class="form-group">
1824  <label for="singleFrequencySelect" class="col-xs-12 col-sm-3 control-label"><?php echo $MC->msg('Repeat', HCU_DISPLAY_AS_HTML); ?></label>
1825  <div class="col-xs-12 col-sm-5"><input id="achFrequencySelect"
1826  class="hcu-all-100"
1827  maxlength="10"
1828  data-bind="value: achFrequency" /></div>
1829  </div>
1830  <div class="form-group" data-bind="visible: showContinue">
1831  <label for="singleFrequencyContinue" class="col-xs-12 col-sm-3 control-label"></label>
1832  <div class="col-xs-12 col-sm-5"><input id="achFrequencyContinue"
1833  class="hcu-all-100"
1834  maxlength="10"
1835  data-bind="value: achContinue" /></div>
1836  </div>
1837  <div class="form-group" data-bind="visible: showEnd">
1838  <label class="col-xs-12 col-sm-3 control-label">End Date<span class="hcu-required-field"><sup>*</sup></span></label>
1839  <div class="col-xs-12 col-sm-5"><input id="achEndDate"
1840  name="achEndDate"
1841  class="hcu-xs-100-only"
1842  placeholder="e.g. MM/DD/YYYY"
1843  data-bind="value: achEndDate"
1844  homecu-match='date'
1845  homecu-dategtvalue="achEffDate"
1846  homecu-dategttype="field"
1847  data-required-msg="<?php echo $MC->msg('Continue Until must be entered', HCU_DISPLAY_AS_HTML); ?>"
1848  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); ?>"
1849  data-homecuCustomDateGTValue-msg="<?php echo $MC->msg('Stop date after transfer', HCU_DISPLAY_AS_HTML); ?>"/></div>
1850  </div>
1851  </div>
1852  </div>
1853  </div>
1854  <?php // this footer is for all pages
1855  ?>
1856  <div class=" tabFooter hcu-template">
1857  <div class="hcu-edit-buttons k-state-default">
1858  <span class="hcu-icon-delete">
1859  <a id="backButton" class="k-link" data-bind="visible: showBack, events:{ click: backClick }"><?php echo $MC->msg('Back', HCU_DISPLAY_AS_HTML) ?></a>
1860  </span>
1861  <a class="k-button k-primary" id="nextButton" data-bind="disabled: disableSaveButton, events:{ click: nextClick }"><?php echo $MC->msg('Next', HCU_DISPLAY_AS_HTML) ?></a>
1862  </div>
1863  </div>
1864 </div>
1865 
1866 <script id="confirmationTemplate" type="text/x-kendo-tmpl">
1867  <div id="confirmationStatus"></div>
1868  <div id="responseDiv">
1869  <div class="local-transfer-msg">
1870  <?php echo $MC->msg('ACH Single Posted', HCU_DISPLAY_AS_JS); ?>
1871  </div>
1872 
1873  <div>&emsp;</div>
1874  # if (data) { #
1875  # for (i=0; i < data.length; i++ ) { #
1876  <div class="row">
1877  <div class="col-xs-6 text-right">
1878  <span class="response-label">#= data[i]['label'] #:</span>
1879  </div>
1880  <div class="col-xs-6">
1881  <span class="response-field">#= data[i]['caption'] #</span>
1882  </div>
1883  </div>
1884  # } #
1885  # } #
1886  <div>&emsp;</div>
1887  </div>
1888 </script>
1889 
1890  <?php
1891  } else {
1892  // wasn't an allowed operation
1893  throw new Exception( HCU_JsonEncode( $MC->msg('Feature Unavailable', HCU_DISPLAY_AS_HTML) ), 915 );
1894  }
1895  } catch (Exception $ex) {
1896  // * Include the Error page and then end the content
1897  // NOTE: this is for when the page is first loading
1898  $serviceErrorMsg = HCU_JsonDecode($ex->getMessage());
1899 
1900  $serviceErrorCode = $ex->getCode(); // this chooses which error page to show
1901 
1902  require_once(dirname(__FILE__) . '/../includes/hcuErrorPage.i');
1903  }
1904  /*
1905  * ** END CONTENT
1906  */
1907 
1908 
1909  // ** INCLUDE POST CONTENT SCRIPT
1910  require_once(dirname(__FILE__) . '/../includes/hcuPostContent.i');
1911