28 require_once(dirname(__FILE__) .
'/../library/permissions.i');
29 require_once(dirname(__FILE__) .
'/../library/hcuACH.i');
33 $serviceShowInfo =
true;
34 $serviceLoadMenu =
true;
35 $serviceShowMenu =
true;
38 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
44 $chome = $HB_ENV[
"chome"];
45 $Flang = $HB_ENV[
"Flang"];
50 "ach_feature" => array(
'filter' => FILTER_SANITIZE_STRING)
53 HCU_ImportVars($inputVars,
"", $varOk);
55 $ach_feature = isset($inputVars[
'ach_feature']) && strlen( trim( $inputVars[
'ach_feature'] ) ) ? trim( $inputVars[
'ach_feature'] ) :
"choose_single_payment";
58 if ( $ach_feature ==
"choose_single_collection" ||
59 $ach_feature ==
"choose_single_payment" ) {
60 header(
"Location: {$HB_ENV["homebankingpath
"]}/hcuACHSingle.prg?{$HB_ENV["cuquery
"]}&ach_feature=$ach_feature");
65 require_once(dirname(__FILE__) .
'/../includes/hcuPreContent.i');
68 $achEnabled = Check_ACHEnabled( $dbh, $HB_ENV );
69 if ( $achEnabled ===
false ) {
71 throw new Exception( HCU_JsonEncode( $MC->msg(
'Option not set', HCU_DISPLAY_AS_HTML) ), 915 );
75 if ( $ach_feature ==
"choose_batch_payment" ) {
76 $initialPartnerType =
"e";
77 $batchActivity = $MC->msg(
"ACH Payment Template Info", HCU_DISPLAY_AS_HTML);
78 $achAction =
"submit_batch_payment";
79 $featureCode = FEATURE_ACH_PAYMENTS;
81 $templateAction =
"read_templates";
83 $accountTypeWords = $MC->msg(
"ACH From Account", HCU_DISPLAY_AS_HTML);
84 $dfiAccountWords = $MC->msg(
"ACH Deposit Account", HCU_DISPLAY_AS_HTML);
85 $batchButton =
"choose_single_payment";
86 $pageTitle = $MC->msg(
"ACH Payment Title", HCU_DISPLAY_AS_HTML);
87 $progressStep3 = $MC->msg(
"ACH Payment", HCU_DISPLAY_AS_HTML);
88 }
else if ( $ach_feature ==
"choose_batch_collection" ) {
89 $initialPartnerType =
"r";
90 $batchActivity = $MC->msg(
"ACH Collection Template Info", HCU_DISPLAY_AS_HTML);
91 $achAction =
"submit_batch_collection";
92 $featureCode = FEATURE_ACH_COLLECTIONS;
94 $templateAction =
"read_templates";
96 $accountTypeWords = $MC->msg(
"ACH To Account", HCU_DISPLAY_AS_HTML);
97 $dfiAccountWords = $MC->msg(
"ACH Withdrawl Account", HCU_DISPLAY_AS_HTML);
98 $batchButton =
"choose_single_collection";
99 $pageTitle = $MC->msg(
"ACH Collection Title", HCU_DISPLAY_AS_HTML);
100 $progressStep3 = $MC->msg(
"ACH Collection", HCU_DISPLAY_AS_HTML);
103 $initialPartnerType =
"";
104 $batchActivity = $MC->msg(
"Unknown", HCU_DISPLAY_AS_HTML);
105 $achAction =
"unknown";
106 $featureCode =
"unknown";
107 $templateAction =
"unknown";
108 $batchButton =
"choose_single_payment";
112 $progressStep1 = $MC->msg(
"ACH Template", HCU_DISPLAY_AS_HTML);
113 $progressStep2 = $MC->msg(
"Edit", HCU_DISPLAY_AS_HTML);
114 $progressStep4 = $MC->msg(
"ACH Account", HCU_DISPLAY_AS_HTML);
117 $permissionInputs = array(
"feature" => $featureCode );
118 $accessRights = Perm_AccessRights( $dbh, $HB_ENV, $permissionInputs );
120 if ( !$accessRights[
"create"] ) {
122 throw new Exception( HCU_JsonEncode( $MC->msg(
'Rights not set', HCU_DISPLAY_AS_HTML) ), 915 );
126 $limits = Perm_GetValidationLimits( $dbh, $HB_ENV, $permissionInputs );
128 if ( $limits ===
false || !isset( $limits[
"amount_per_transaction"] ) ) {
132 $allowedAmount = intval( $limits[
"amount_per_transaction"] );
135 $Fset = $HB_ENV[
"Fset"];
138 $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"achNotice",
true);
140 $hasNoticeACH =
false;
141 $hasNoticePopupACH =
false;
143 $noticeLinkDisplayACH =
"";
145 if ( $noticesAry[
"status"][
"code"] ==
"000" && HCU_array_key_exists(
'0', $noticesAry[
'notice'])) {
146 if ( $noticesAry[
"notice"][0][
"notice_id"] ) {
147 $hasNoticeACH =
true;
148 $noticeOption = $noticesAry[
'notice'][0];
150 $noticeOptions = Array (
151 'docsid' => $noticeOption[
'notice_id'],
152 'docstype' => $noticeOption[
'notice_type'],
155 'expireTime' => mktime() + 86400
158 $encryptedDocDetails= HCU_PayloadEncode($HB_ENV[
'Cu'], $noticeOptions);
160 $noticeOptions[
'noticeOnly'] = 1;
162 $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV[
'Cu'], $noticeOptions);
166 $noticeURLACH = $HB_ENV[
'homebankingpath'] .
'/hcuViewNotice.prg?cu=' . $HB_ENV[
'cu'] .
'&x=' . urlencode($encryptedDocDetails);
169 $noticeURLNoticeOnly = $HB_ENV[
'homebankingpath'] .
'/hcuViewNotice.prg?cu=' . $HB_ENV[
'cu'] .
'&x=' . urlencode($encryptedDocDetailsNoticeOnly);
172 $hasNoticePopupACH = $noticeOption[
"notice_popup"] ? true :
false;
174 $noticeButtonText = $noticeOption[
"notice_linkdisplay"];
179 $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"achTerms",
true);
181 $hasTermsACH =
false;
182 $hasTermsPopupACH =
false;
184 $termsLinkDisplayACH =
"";
186 if ( $noticesAry[
"status"][
"code"] ==
"000" && HCU_array_key_exists(
'0', $noticesAry[
'notice'])) {
187 if ( $noticesAry[
"notice"][0][
"notice_id"] ) {
189 $noticeOption = $noticesAry[
'notice'][0];
191 $noticeOptions = Array (
192 'docsid' => $noticeOption[
'notice_id'],
193 'docstype' => $noticeOption[
'notice_type'],
196 'expireTime' => mktime() + 86400
199 $encryptedDocDetails= HCU_PayloadEncode($HB_ENV[
'Cu'], $noticeOptions);
201 $noticeOptions[
'noticeOnly'] = 1;
203 $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV[
'Cu'], $noticeOptions);
207 $termsURLACH = $HB_ENV[
'homebankingpath'] .
'/hcuViewNotice.prg?cu=' . $HB_ENV[
'cu'] .
'&x=' . urlencode($encryptedDocDetails);
210 $termsURLNoticeOnly = $HB_ENV[
'homebankingpath'] .
'/hcuViewNotice.prg?cu=' . $HB_ENV[
'cu'] .
'&x=' . urlencode($encryptedDocDetailsNoticeOnly);
213 $hasTermsPopupACH = $noticeOption[
"notice_popup"] ? true :
false;
215 $termsButtonText = $noticeOption[
"notice_linkdisplay"];
220 $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"achUploadCSV",
true);
222 $hasNoticeCSV =
false;
223 $hasNoticePopupCSV =
false;
225 $noticeLinkDisplayCSV =
"";
226 $noticeURLNoticeOnlyCSV =
"";
228 if ( $noticesAry[
"status"][
"code"] ==
"000" && HCU_array_key_exists(
'0', $noticesAry[
'notice'])) {
229 if ($noticesAry[
"notice"][0][
"notice_id"] ) {
230 $hasNoticeCSV =
true;
231 $noticeLinkDisplayCSV = $noticesAry[
"notice"][0][
"notice_linkdisplay"];
233 $noticeOption = $noticesAry[
'notice'][0];
235 $noticeOptions = Array (
236 'docsid' => $noticeOption[
'notice_id'],
237 'docstype' => $noticeOption[
'notice_type'],
240 'expireTime' => mktime() + 86400
243 $encryptedDocDetails= HCU_PayloadEncode($HB_ENV[
'Cu'], $noticeOptions);
245 $noticeOptions[
'noticeOnly'] = 1;
247 $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV[
'Cu'], $noticeOptions);
251 $noticeURLCSV = $HB_ENV[
'homebankingpath'] .
'/hcuViewNotice.prg?cu=' . $HB_ENV[
'cu'] .
'&x=' . urlencode($encryptedDocDetails);
254 $noticeURLNoticeOnlyCSV = $HB_ENV[
'homebankingpath'] .
'/hcuViewNotice.prg?cu=' . $HB_ENV[
'cu'] .
'&x=' . urlencode($encryptedDocDetailsNoticeOnly);
257 $hasNoticePopupCSV = $noticeOption[
"notice_popup"] ? true :
false;
271 $initialEffDate = ACH_GetEffectiveDate( $HB_ENV );
277 $achCutoffMessageString = ACH_GetCutoffTimeMessage($HB_ENV);
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 );
290 $accountTypes = array(
291 array(
"type" => ACCOUNT_TYPE_CHECKING,
"display" => $MC->msg(
"ACH Checking", HCU_DISPLAY_AS_HTML) ),
292 array(
"type" => ACCOUNT_TYPE_SAVINGS,
"display" => $MC->msg(
"ACH Savings", HCU_DISPLAY_AS_HTML) )
296 $partnerTypes = array( array(
"type" => ACH_PARTNER_TYPE_PAYEE,
"display" => $MC->msg(
"ACH Payee", HCU_DISPLAY_AS_HTML) ),
297 array(
"type" => ACH_PARTNER_TYPE_PAYOR,
"display" => $MC->msg(
"ACH Payor", HCU_DISPLAY_AS_HTML) ),
298 array(
"type" => ACH_PARTNER_TYPE_PAYROLL,
"display" => $MC->msg(
"ACH Payroll", HCU_DISPLAY_AS_HTML) ),
299 array(
"type" => ACH_PARTNER_TYPE_UNASSIGNED,
"display" => $MC->msg(
"ACH Unassigned", HCU_DISPLAY_AS_HTML) )
301 PrintPartnerEditor($HB_ENV);
303 <div
class=
"col-xs-12" style=
'font-size:12px;'>
304 <div
id=
"hcuAchTables" class=
"k-content" style=
"max-width:700px;"></div>
308 if ( $ach_feature ==
"choose_batch_payment" ||
309 $ach_feature ==
"choose_batch_collection" ) {
312 var windowStack = [];
315 var achAccountTypes = <?php echo HCU_JsonEncode( $accountTypes ); ?>;
316 var achCurrentList = [];
317 var achPartnerTypes = <?php echo HCU_JsonEncode( $partnerTypes ); ?>;
318 var achTemplateList = [];
319 var achPartnerList = [];
320 var achAllAccounts = [];
321 var achAcctsList = [];
322 var achSubAccounts = [];
323 var achStateList = <?php echo HCU_JsonEncode( GetStateList() ); ?>;
324 var editTemplateModel;
326 var editTemplateDialog;
328 var editPartnerDialog;
329 var selectedTemplate = 0;
330 var progressStep = 0;
331 var achTemplatePartnerList = [];
332 var achBatchList = [];
333 var partnerDataSource;
336 var removePartnerDialog;
340 var editPartnerModel;
341 var window_stack = [];
342 var templateChanged =
true;
343 var saveStatus =
false;
348 var csvNotSelected =
null;
349 var csvNotMatched =
null;
350 var uploadWidget =
null;
352 var effDatePicker =
null;
353 var achFeature = <?php echo HCU_JsonEncode($ach_feature); ?>;
356 var terms = <?php echo HCU_JsonEncode($hasTermsACH && $hasTermsPopupACH); ?>;
357 var notice = <?php echo HCU_JsonEncode($hasNoticeACH && $hasNoticePopupACH); ?>;
359 var noticeCsv = <?php echo HCU_JsonEncode($hasNoticeCSV && $hasNoticePopupCSV); ?>;
361 var companyData = <?php echo HCU_JsonEncode($companyData); ?>;
363 function ClearPaymentInfo() {
364 viewModel.set(
"achType",
"" );
366 viewModel.set(
"achBatchTotal", 0 );
367 viewModel.set(
"achMemo",
"" );
369 viewModel.set(
"achMyAcctSelected",
"" );
370 viewModel.set(
"achSubAcctSelected", 0 );
372 viewModel.set(
"achEffDate",
"<?php echo $initialEffDate; ?>" );
376 function ShowStatus( statusMessage ) {
377 $.homecuValidator.settings.formStatusField =
"formStatus";
378 $.homecuValidator.settings.formInfoTitle =
"";
379 $.homecuValidator.displayMessage(statusMessage);
384 function StartValidator( thisStep ) {
385 if ( thisStep === 1 ) {
387 }
else if ( thisStep === 2 ) {
388 $.homecuValidator.setup( {formValidate:
"achEditTemplate"} );
389 }
else if ( thisStep === 3 ) {
390 $.homecuValidator.setup( {formValidate:
"achBatchRemote"} );
391 }
else if ( thisStep === 4 ) {
392 $.homecuValidator.setup( {formValidate:
"achLocal"} );
401 function ValidateThisStep( thisStep ) {
402 var otherErrors = Array();
405 var needValidation =
true;
406 if ( thisStep === 1 ) {
408 needValidation =
false;
409 }
else if ( thisStep === 2 ) {
412 var test = viewModel.achType.toLowerCase();
413 if ( !(test ===
"ppd" || test ===
"ccd") ) {
414 otherErrors.push(
"<?php echo $MC->msg("ACH Type needed
", HCU_DISPLAY_AS_JS) ?>" );
418 var atLeastOne =
false;
419 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
420 if ( achTemplatePartnerList[i].inBatch ) {
427 otherErrors.push(
"<?php echo $MC->msg("ACH Need one partner
", HCU_DISPLAY_AS_JS) ?>" );
429 }
else if ( thisStep === 3 ) {
431 needValidation =
false;
434 var totalAmount = GetTotalBatchAmount();
435 if ( totalAmount == 0 ) {
436 otherErrors.push(
"<?php echo $MC->msg("ACH Batch need amount
", HCU_DISPLAY_AS_JS) ?>" );
437 }
else if ( totalAmount > <?php echo $allowedAmount ?> ) {
438 otherErrors.push(
'<?php echo $MC->msg('ACH Amount over allowed
', HCU_DISPLAY_AS_JS); ?>' );
441 }
else if ( thisStep === 4 ) {
442 var available = viewModel.achAvailable;
443 var totalAmount = GetTotalBatchAmount();
444 if ( achFeature ==
"choose_batch_payment" ) {
446 if ( totalAmount > available ) {
447 otherErrors.push(
"<?php echo $MC->msg("Transfer exceeds
", HCU_DISPLAY_AS_JS); ?>" );
452 if (otherErrors.length > 0) {
453 $.homecuValidator.homecuResetMessage =
true;
454 $.homecuValidator.displayMessage(otherErrors, $.homecuValidator.settings.statusError);
455 $.homecuValidator.homecuValidate =
false;
458 if ( needValidation ) {
459 $.homecuValidator.homecuValidate = $.homecuValidator.validate();
462 $.homecuValidator.homecuValidate =
true;
466 return ( $.homecuValidator.homecuValidate );
469 function GetTotalBatchAmount() {
471 for ( var i = 0; i < achBatchList.length; i++ ) {
472 var numerictextbox = $(
"#amount" + achBatchList[i].id).data(
"kendoNumericTextBox");
474 if ( numerictextbox ) {
475 var value = numerictextbox.value();
476 if ( value ===
null || value === undefined || value ===
"" ) {
485 totalAmount += value;
492 function ShowThisStep( step ) {
493 if ( step === 0 || step === 1 ) {
495 viewModel.trigger(
"reset" );
496 $(
'#checkAllForBatch').removeAttr(
'checked');
499 viewModel.set(
"showBack",
false );
501 $(
"#achEditTemplate").hide();
502 $(
"#achBatchRemote").hide();
503 $(
"#achLocal").hide();
505 $(
"#achTemplate").show();
506 progressSteps.value( 1 );
507 $(
"#stepName").html(
"<?php echo $progressStep1; ?>" );
509 $(
"#nextButton").hide();
512 GetACHTemplates(
"<?php echo $templateAction ?>" );
515 viewModel.set(
"achUpdateTemplate",
false );
517 }
else if ( step === 2 ) {
519 $(
"#achTemplate").hide();
520 $(
"#achBatchRemote").hide();
521 $(
"#achLocal").hide();
523 $(
"#achEditTemplate").show();
524 progressSteps.value( 2 );
525 $(
"#stepName").html(
"<?php echo $progressStep2; ?>" );
527 viewModel.set(
"showBack",
true );
528 $(
"#nextButton").show();
529 $(
"#nextButton").html(
"<?php echo $MC->msg("Next
", HCU_DISPLAY_AS_JS) ?>");
532 PopulatePartnerGrid();
535 csvNotMatched =
null;
536 $(
"#csvNotMatched").hide();
537 csvNotSelected =
null;
538 $(
"#csvNotSelected").hide();
539 }
else if ( step === 3 ) {
541 $(
"#achTemplate").hide();
542 $(
"#achEditTemplate").hide();
543 $(
"#achLocal").hide();
545 $(
"#achBatchRemote").show();
546 progressSteps.value( 3 );
547 $(
"#stepName").html(
"<?php echo $progressStep3; ?>" );
549 viewModel.set(
"showBack",
true );
551 $(
"#nextButton").html(
"<?php echo $MC->msg("Next
", HCU_DISPLAY_AS_JS) ?>");
554 }
else if ( step === 4 ) {
556 $(
"#achTemplate").hide();
557 $(
"#achEditTemplate").hide();
558 $(
"#achBatchRemote").hide();
560 $(
"#achLocal").show();
561 progressSteps.value( 4 );
562 $(
"#stepName").html(
"<?php echo $progressStep4; ?>" );
564 viewModel.set(
"showBack",
true );
566 $(
"#nextButton").html(
"<?php echo $MC->msg("Submit
", HCU_DISPLAY_AS_JS) ?>");
571 StartValidator( step );
574 function HandleNavClick( nextStep ) {
576 $.homecuValidator.hideMessage();
579 if ( nextStep >= progressStep ) {
583 progressStep = nextStep;
584 ShowThisStep( progressStep );
588 function PopulatePartnerGrid() {
589 if ( selectedTemplate > 0 ) {
590 var templateInfo = GetTemplateInfo( selectedTemplate );
591 viewModel.set(
"achTemplateName", templateInfo.templateName );
593 var partnerList = templateInfo.templatePartner;
597 function SortBatchList(a, b){
598 var aName = a.name.toLowerCase();
599 var bName = b.name.toLowerCase();
600 return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0));
610 function PopulateBatchGrid() {
614 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
615 if ( achTemplatePartnerList[i].inBatch ) {
618 for ( var b = 0; b < achBatchList.length; b++ ) {
619 if ( achBatchList[b].
id == achTemplatePartnerList[i].partnerId ) {
628 id: achTemplatePartnerList[i].partnerId,
629 name: achTemplatePartnerList[i].partnerDisplayName,
630 amount: achTemplatePartnerList[i].lastAmount,
631 addenda: achTemplatePartnerList[i].lastAddenda,
633 achTemplatePartnerList[i].partnerEmail !=
"" &&
634 achTemplatePartnerList[i].partnerNotify
637 achTemplatePartnerList[i].partnerEmail ==
"" 640 achBatchList.push( newObject );
645 for ( var b = 0; b < achBatchList.length; b++ ) {
646 if ( achBatchList[b].
id == achTemplatePartnerList[i].partnerId ) {
647 achBatchList.splice(b, 1);
655 achBatchList.sort( SortBatchList );
658 var javascriptTemplate = kendo.template($(
"#batchTemplate").html());
659 $(
"#batchGrid").html(javascriptTemplate(achBatchList));
662 $(
".batch-amount").each(
function() {
663 $(
"#" + this.id).kendoNumericTextBox({
665 max: <?php echo $allowedAmount ?>,
668 restrictDecimals:
true,
670 change:
function(e) {
671 var elementId = this.element[0].id;
672 var value = this.value();
674 if ( value ===
null || value === undefined || value ===
"" ) {
680 if ( $.isNumeric( value ) ) {
681 var partnerId = elementId.slice(
"amount".length );
682 SetBatchAmount( partnerId, value );
691 $(
"#" + this.id).focus(
function() {
694 clearTimeout(input.data(
"selectTimeId"));
696 var selectTimeId = setTimeout(
function() {
700 input.data(
"selectTimeId", selectTimeId);
701 }).blur(
function(e) {
702 clearTimeout($(
this).data(
"selectTimeId"));
711 function PopulateBatchGridUsingCSV( partnerSelectedList ) {
716 for ( var i = 0; i < partnerSelectedList.length; i++ ) {
718 displayName =
"Unknown";
719 for ( var p = 0; p < achPartnerList.length; p++ ) {
720 if ( achPartnerList[p].
id == partnerSelectedList[i].
id ) {
721 displayName = achPartnerList[p].display_name;
727 id: partnerSelectedList[i].id,
729 amount: partnerSelectedList[i].amount,
730 addenda: partnerSelectedList[i].addenda,
732 achTemplatePartnerList[i].partnerEmail !=
"" &&
733 achTemplatePartnerList[i].partnerNotify
736 achTemplatePartnerList[i].partnerEmail ==
"" 739 achBatchList.push( newObject );
743 achBatchList.sort( SortBatchList );
746 var javascriptTemplate = kendo.template($(
"#batchTemplate").html());
747 $(
"#batchGrid").html(javascriptTemplate(achBatchList));
750 $(
".batch-amount").each(
function() {
751 $(
"#" + this.id).kendoNumericTextBox({
753 max: <?php echo $allowedAmount ?>,
756 restrictDecimals:
true,
758 change:
function(e) {
759 var elementId = this.element[0].id;
760 var value = this.value();
762 if ( value ===
null || value === undefined || value ===
"" ) {
768 if ( $.isNumeric( value ) ) {
769 var partnerId = elementId.slice(
"amount".length );
770 SetBatchAmount( partnerId, value );
779 $(
"#" + this.id).focus(
function() {
782 clearTimeout(input.data(
"selectTimeId"));
784 var selectTimeId = setTimeout(
function() {
788 input.data(
"selectTimeId", selectTimeId);
789 }).blur(
function(e) {
790 clearTimeout($(
this).data(
"selectTimeId"));
798 function GetACHAccounts( action ) {
799 var request = { action: action };
801 dsACHHelper.read( request );
804 function GetACHPartners() {
805 var request = { action:
"get_ach_partners" };
807 dsACHHelper.read( request ).then(
function() {
809 GetACHAccounts(
"payments_list" );
813 function GetACHTemplates( action ) {
815 if ( templateChanged ) {
816 var request = { action: action };
818 dsACHHelper.read( request );
822 function GetACHTemplatePartners( templateId ) {
823 var request = { action:
"read_template_partners", template_id: templateId };
825 dsACHHelper.read( request ).then(
function() {
831 function DeleteACHTemplate( templateId ) {
832 var request = { action:
"delete_template", template_id: selectedTemplate };
834 dsACHHelper.read( request );
837 function UpdateACHTemplate( ) {
839 var
id = selectedTemplate;
840 var newName = editTemplateModel.templateName;
842 var request = { action:
"update_template", template_id: id, template_name: newName };
844 dsACHHelper.read( request );
848 function RemovePartner(
id ) {
850 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
851 if ( achTemplatePartnerList[i].partnerId ==
id ) {
853 achTemplatePartnerList[i].remove =
true;
855 var request = { action:
"remove_template_partner", partner_id: id, template_id: selectedTemplate };
857 dsACHHelper.read( request );
864 function SubmitACHRequest() {
867 var batchData = JSON.stringify( achBatchList );
870 action:
"<?php echo $achAction ?>",
871 batch_data: batchData,
872 internal_acct: viewModel.achMyAcctSelected,
873 internal_sub_acct: viewModel.achSubAcctSelected,
874 eff_date: viewModel.achEffDate,
875 memo: viewModel.achMemo,
876 ach_type: viewModel.achType,
877 template_id: selectedTemplate,
878 update_template: viewModel.achUpdateTemplate ? 1 : 0
881 dsACHHelper.read( request );
885 function HandleUpdatedAccountList() {
888 for (var i = 0; i < achAllAccounts.length; i++) {
889 achSubAccounts.push({
890 name: achAllAccounts[i].account_name,
891 id: achAllAccounts[i].acctid,
892 amount: achAllAccounts[i].amount,
893 account: achAllAccounts[i].account
898 var dataSource =
new kendo.data.DataSource({
901 var dropdownlist = $(
"#achSubAcctList").data(
"kendoDropDownList");
902 dropdownlist.setDataSource(dataSource);
904 if (achSubAccounts.length == 1) {
905 dropdownlist.select(1);
906 dropdownlist.trigger(
"change");
911 function HandleUpdatedPartnerList() {
913 if ( $(
"#achPartnerFilterPayee").prop(
"checked" ) ) {
914 filterTest.push(
"e");
916 if ( $(
"#achPartnerFilterPayroll").prop(
"checked" ) ) {
917 filterTest.push(
"$");
919 if ( $(
"#achPartnerFilterPayor").prop(
"checked" ) ) {
920 filterTest.push(
"r");
922 if ( $(
"#achPartnerFilterUnassigned").prop(
"checked" ) ) {
928 for ( var i = 0; i < achPartnerList.length; i++ ) {
932 for ( var t = 0; t < achTemplatePartnerList.length; t++ ) {
933 if ( achPartnerList[i].
id == achTemplatePartnerList[t].partnerId ) {
940 var test = filterTest.indexOf( achPartnerList[i].partner_type );
942 achCurrentList.push( {name: achPartnerList[i].display_name, id: achPartnerList[i].id} );
948 var dropdownlist = $(
"#achPartnerDD").data(
"kendoDropDownList");
949 dropdownlist.dataSource.data(achCurrentList);
950 dropdownlist.select(0);
953 var grid = $(
'#achPartnerChooser').data(
"kendoGrid");
954 grid.dataSource.data(achCurrentList);
960 function CreateAddressString( partnerListEntry ) {
962 if ( partnerListEntry.partnerCity.length > 0 ||
963 partnerListEntry.partnerState.length > 0 ||
964 partnerListEntry.partnerZip.length > 0 ) {
965 showString = partnerListEntry.partnerCity.trim();
966 if ( showString.length > 0 &&
967 (partnerListEntry.partnerState.length > 0 ||
968 partnerListEntry.partnerZip.length > 0) ) {
969 showString = showString +
", " + partnerListEntry.partnerState +
" " + partnerListEntry.partnerZip;
970 showString = showString.trim();
974 if ( partnerListEntry.partnerAddress1.length > 0 ) {
975 if ( showString.length > 0 ) {
976 showString = partnerListEntry.partnerAddress1 +
" / " + showString;
978 showString = partnerListEntry.partnerAddress1;
982 return showString.trim();
987 function HandlePartnerUpdate( partnerInfo ) {
990 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
991 if ( achTemplatePartnerList[i].partnerId == partnerInfo.id ) {
992 achTemplatePartnerList[i].partnerDisplayName = partnerInfo.display_name;
993 achTemplatePartnerList[i].partnerACHName = partnerInfo.ach_name;
994 achTemplatePartnerList[i].partnerNotify = partnerInfo.email_notify;
995 achTemplatePartnerList[i].partnerType = partnerInfo.partner_type;
996 achTemplatePartnerList[i].partnerAddress1 = partnerInfo.address1;
997 achTemplatePartnerList[i].partnerAddress2 = partnerInfo.address2;
998 achTemplatePartnerList[i].partnerCity = partnerInfo.city,
999 achTemplatePartnerList[i].partnerState = partnerInfo.state;
1000 achTemplatePartnerList[i].partnerZip = partnerInfo.zip;
1001 achTemplatePartnerList[i].partnerCountry = partnerInfo.country;
1002 achTemplatePartnerList[i].partnerEmail = partnerInfo.email;
1003 achTemplatePartnerList[i].partnerDfiAccount = partnerInfo.dfi_account;
1004 achTemplatePartnerList[i].partnerDfiType = partnerInfo.dfi_account_type;
1005 achTemplatePartnerList[i].partnerDfiRouting = partnerInfo.dfi_routing;
1007 achTemplatePartnerList[i].showPartnerAddress = CreateAddressString( achTemplatePartnerList[i] );
1009 achTemplatePartnerList[i].changed =
false;
1019 partnerId: partnerInfo.id,
1020 partnerDisplayName: partnerInfo.display_name,
1021 partnerACHName: partnerInfo.ach_name,
1022 partnerNotify: partnerInfo.email_notify,
1023 partnerType: partnerInfo.partner_type,
1024 partnerAddress1: partnerInfo.address1,
1025 partnerAddress2: partnerInfo.address2,
1026 partnerCity: partnerInfo.city,
1027 partnerState: partnerInfo.state,
1028 partnerZip: partnerInfo.zip,
1029 partnerCountry: partnerInfo.country,
1030 partnerEmail: partnerInfo.email,
1031 partnerDfiAccount: partnerInfo.dfi_account,
1032 partnerDfiType: partnerInfo.dfi_account_type,
1033 partnerDfiRouting: partnerInfo.dfi_routing,
1035 showPartnerAddress:
"",
1044 newObject.showPartnerAddress = CreateAddressString( newObject );
1046 achTemplatePartnerList.push( newObject );
1050 var grid = $(
"#partnerGrid").data(
"kendoGrid");
1051 grid.dataSource.data(achTemplatePartnerList);
1055 for ( var i = 0; i < achPartnerList.length; i++ ) {
1056 if ( achPartnerList[i].
id == partnerInfo.id ) {
1058 achPartnerList[i].name = partnerInfo.display_name;
1059 achPartnerList[i].partner_type = partnerInfo.partner_type;
1067 achPartnerList.push( {id: partnerInfo.id,
1068 name: partnerInfo.display_name,
1069 partner_type: partnerInfo.partner_type} );
1075 function SortTemplateList(a, b){
1076 var aName = a.partnerDisplayName.toLowerCase();
1077 var bName = b.partnerDisplayName.toLowerCase();
1078 return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0));
1086 function HandlePartnerForTemplate( partnerInfo ) {
1089 partnerId: partnerInfo.id,
1090 partnerDisplayName: partnerInfo.display_name,
1091 partnerACHName: partnerInfo.ach_name,
1092 partnerNotify: partnerInfo.email_notify,
1093 partnerType: partnerInfo.partner_type,
1094 partnerAddress1: partnerInfo.address1,
1095 partnerAddress2: partnerInfo.address2,
1096 partnerCity: partnerInfo.city,
1097 partnerState: partnerInfo.state,
1098 partnerZip: partnerInfo.zip,
1099 partnerCountry: partnerInfo.country,
1100 partnerEmail: partnerInfo.email,
1101 partnerDfiAccount: partnerInfo.dfi_account,
1102 partnerDfiType: partnerInfo.dfi_account_type,
1103 partnerDfiRouting: partnerInfo.dfi_routing,
1105 showPartnerAddress:
"",
1114 newObject.showPartnerAddress = CreateAddressString( newObject );
1116 achTemplatePartnerList.push( newObject );
1119 partnerDataSource =
new kendo.data.DataSource({
1120 data: achTemplatePartnerList,
1121 filter: { field:
"remove",
operator:
"neq", value:
true },
1122 sort: { field:
"partnerDisplayName", dir:
"asc" }
1126 var grid = $(
"#partnerGrid").data(
"kendoGrid");
1127 grid.setDataSource(partnerDataSource);
1136 function HandleRemovePartnerFromTemplate( partnerId ) {
1138 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
1139 if ( achTemplatePartnerList[i].partnerId == partnerId ) {
1140 achTemplatePartnerList.splice(i, 1);
1146 var grid = $(
"#partnerGrid").data(
"kendoGrid");
1147 grid.dataSource.data(achTemplatePartnerList);
1150 HandleUpdatedPartnerList();
1155 function HandleUpdatedTemplateList( oTemplateInfo ) {
1158 achTemplateList = [];
1159 for ( var i = 0; i < oTemplateInfo.length; i++ ) {
1160 var templateMeta = JSON.parse( oTemplateInfo[i].tmpl_meta );
1161 var templatePartner = JSON.parse( oTemplateInfo[i].tmpl_partner );
1164 templateId: oTemplateInfo[i].tmpl_id,
1165 templateName: oTemplateInfo[i].tmpl_name,
1166 templateType: oTemplateInfo[i].tmpl_type,
1167 templateACHType: oTemplateInfo[i].ach_type,
1168 templateMeta: templateMeta,
1169 templatePartner: templatePartner
1172 achTemplateList.push( newObject );
1178 templateName:
"<?php echo $MC->msg("ACH Add New Template
", HCU_DISPLAY_AS_JS) ?>",
1184 achTemplateList.push( newObject );
1185 var listview = $(
"#templateList").data(
"kendoListView");
1186 listview.dataSource.data(achTemplateList);
1190 function HandleTemplatePartnerList( oTemplatePartnerInfo ) {
1192 achTemplatePartnerList = [];
1193 for ( var i = 0; i < oTemplatePartnerInfo.length; i++ ) {
1194 var partnerAddress = JSON.parse( oTemplatePartnerInfo[i].address );
1195 var partnerDFI = JSON.parse( oTemplatePartnerInfo[i].dfi_data );
1197 partnerId: oTemplatePartnerInfo[i].id,
1198 partnerDisplayName: oTemplatePartnerInfo[i].display_name,
1199 partnerACHName: oTemplatePartnerInfo[i].ach_name,
1200 partnerNotify: oTemplatePartnerInfo[i].email_notify ==
"t",
1201 partnerType: oTemplatePartnerInfo[i].partner_type,
1202 partnerAddress1: partnerAddress.address1,
1203 partnerAddress2: partnerAddress.address2,
1204 partnerCity: partnerAddress.city,
1205 partnerState: partnerAddress.state,
1206 partnerZip: partnerAddress.zip,
1207 partnerCountry: partnerAddress.country,
1208 partnerEmail: partnerAddress.email,
1209 partnerDfiAccount: partnerDFI.dfi_account,
1210 partnerDfiType: partnerDFI.dfi_account_type,
1211 partnerDfiRouting: partnerDFI.dfi_routing,
1213 showPartnerAddress:
"",
1214 lastAmount: oTemplatePartnerInfo[i].last_amount,
1215 lastAddenda: oTemplatePartnerInfo[i].last_addenda,
1222 newObject.showPartnerAddress = CreateAddressString( newObject );
1224 achTemplatePartnerList.push( newObject );
1226 var grid = $(
"#partnerGrid").data(
"kendoGrid");
1227 grid.dataSource.data(achTemplatePartnerList);
1233 function ShowDeleteTemplate(templateId) {
1234 selectedTemplate = templateId;
1235 deleteDialog.open();
1239 function ShowEditTemplate(templateId) {
1240 selectedTemplate = templateId;
1243 var templateInfo = GetTemplateInfo( templateId );
1244 var currentName = templateInfo.templateName;
1245 editTemplateModel.SetTemplate( currentName );
1247 editTemplateDialog.title(
"<?php echo $MC->msg("ACH Edit Template Name
", HCU_DISPLAY_AS_JS) ?>").open();
1250 function GetTemplateInfo( templateId ) {
1252 var returnObject =
null;
1254 for ( var i = 0; i < achTemplateList.length; i++ ) {
1255 if ( achTemplateList[i].templateId == templateId ) {
1262 returnObject = achTemplateList[i];
1265 return returnObject;
1268 function SelectTemplate( templateId ) {
1269 selectedTemplate = templateId;
1271 if ( templateId == -1 ) {
1275 GetACHTemplatePartners( selectedTemplate );
1281 for ( var i = 0; i < achTemplateList.length; i++ ) {
1282 if ( achTemplateList[i].templateId == templateId ) {
1283 if ( achTemplateList[i].templateACHType !==
"" ) {
1284 viewModel.set(
"achType", achTemplateList[i].templateACHType );
1297 function GoToNextTab() {
1299 $.homecuValidator.hideMessage();
1302 $(
"#content-wrapper").animate({ scrollTop: 0 }, { duration: 500 } );
1305 if ( ValidateThisStep( progressStep ) ) {
1306 if ( progressStep >= 4 ) {
1311 ShowThisStep( progressStep );
1317 function NextClickedByCSVSuccess() {
1319 $.homecuValidator.displayMessage(
"", $.homecuValidator.settings.statusError );
1322 $(
"#content-wrapper").animate({ scrollTop: 0 }, { duration: 500 } );
1327 $(
"#achTemplate").hide();
1328 $(
"#achEditTemplate").hide();
1329 $(
"#achLocal").hide();
1331 $(
"#achBatchRemote").show();
1332 progressSteps.value( 3 );
1333 $(
"#stepName").html(
"<?php echo $progressStep3; ?>" );
1335 viewModel.set(
"showBack",
true );
1337 $(
"#nextButton").html(
"<?php echo $MC->msg("Next
", HCU_DISPLAY_AS_JS) ?>");
1340 $(
"#batchGrid").html(
"" );
1342 viewModel.set(
"achBatchTotal", 0.00 );
1346 function ShowRemovePartner(partnerId) {
1348 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
1349 if ( achTemplatePartnerList[i].partnerId == partnerId ) {
1352 partnerName = achTemplatePartnerList[i].partnerDisplayName;
1360 partnerName =
"<?php echo $MC->msg("Unknown
", HCU_DISPLAY_AS_JS) ?>";
1363 var content =
"<p><?php echo $MC->msg("ACH Continue
remove template partner
", HCU_DISPLAY_AS_JS) ?>" + partnerName +
"</p><p>" +
1364 "<?php echo $MC->msg("ACH Continue
", HCU_DISPLAY_AS_JS) ?></p>" +
1365 "<input type='hidden' id='removePartnerId' value='" + partnerId +
"'>";
1366 removePartnerDialog.content(content).open();
1370 function ShowAddTemplate() {
1371 selectedTemplate = -1;
1372 editTemplateModel.SetTemplate(
"" );
1374 editTemplateDialog.title(
"<?php echo $MC->msg("ACH Enter Template Name
", HCU_DISPLAY_AS_JS) ?>").open();
1378 function ShowEditPartner(partnerId) {
1381 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
1382 if ( achTemplatePartnerList[i].partnerId == partnerId ) {
1384 editPartnerModel.init({
1385 partner_id: achTemplatePartnerList[i].partnerId,
1386 partner_type: achTemplatePartnerList[i].partnerType,
1387 display_name: achTemplatePartnerList[i].partnerDisplayName,
1388 ach_name: achTemplatePartnerList[i].partnerACHName,
1389 email: achTemplatePartnerList[i].partnerEmail,
1390 email_notify: achTemplatePartnerList[i].partnerNotify,
1391 address1: achTemplatePartnerList[i].partnerAddress1,
1392 address2: achTemplatePartnerList[i].partnerAddress2,
1393 city: achTemplatePartnerList[i].partnerCity,
1394 state: achTemplatePartnerList[i].partnerState,
1395 zip: achTemplatePartnerList[i].partnerZip,
1396 country: achTemplatePartnerList[i].partnerCountry,
1397 dfi_routing: achTemplatePartnerList[i].partnerDfiRouting,
1398 dfi_account: achTemplatePartnerList[i].partnerDfiAccount,
1399 dfi_account_confirm: achTemplatePartnerList[i].partnerDfiAccount,
1400 dfi_account_type: achTemplatePartnerList[i].partnerDfiType
1403 partnerName = achTemplatePartnerList[i].partnerDisplayName;
1412 var editDialog = $(
"#deleteDialog").kendoDialog({
1414 title:
"<?php echo $MC->msg("ACH Edit Partner
", HCU_DISPLAY_AS_JS) ?>",
1415 content:
"<p>" +
"<?php echo $MC->msg("ACH Partner not found
", HCU_DISPLAY_AS_JS) ?>" +
"</p><p>" +
"<?php echo $MC->msg("problem encountered
", HCU_DISPLAY_AS_JS) ?>" +
"</p>",
1418 window_stack.push(
function(e) {
1419 deleteDialog.close(e);
1422 close:
function(e) {
1428 text:
"<?php echo $MC->msg("Close
", HCU_DISPLAY_AS_JS) ?>",
1431 }).data(
"kendoDialog");
1434 if ($(window).width() > 768) {
1435 $(
".achAccordionContent").show();
1436 $(
"span[data-accordion-plus]").hide();
1437 $(
"span[data-accordion-minus]").show();
1440 $(
".achAccordionContent").hide();
1441 $(
".achAccordionContent[data-accordion-index=0]").show();
1443 $(
"span[data-accordion-plus]").show();
1444 $(
"span[data-accordion-minus]").hide();
1446 $(
"span[data-accordion-plus=0]").hide();
1447 $(
"span[data-accordion-minus=0]").show();
1450 var title =
"<?php echo $MC->msg("ACH Edit Partner
", HCU_DISPLAY_AS_JS) ?>" +
": " + partnerName;
1451 editPartnerDialog.title(title);
1452 editPartnerDialog.center();
1453 editPartnerDialog.open();
1458 function ShowBatchTotal() {
1461 for ( var i = 0; i < achBatchList.length; i++ ) {
1462 var amount = isNaN( achBatchList[i].amount ) ? 0 : achBatchList[i].amount;
1463 total += amount * 1;
1466 viewModel.set(
"achBatchTotal", total );
1469 function SetPartnerInBatch( partnerId, state ) {
1470 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
1471 if ( achTemplatePartnerList[i].partnerId == partnerId ) {
1472 achTemplatePartnerList[i].inBatch = state;
1477 function SetBatchAmount( partnerId, value ) {
1478 for ( var i = 0; i < achBatchList.length; i++ ) {
1479 if ( achBatchList[i].
id == partnerId ) {
1480 achBatchList[i].amount = value * 1;
1492 for ( var i = 0; i < achTemplatePartnerList.length; i++) {
1493 if (achTemplatePartnerList[i].partnerId == partnerId) {
1494 achTemplatePartnerList[i].lastAmount = value * 1;
1498 function SetBatchAddenda( partnerId, value ) {
1499 for ( var i = 0; i < achBatchList.length; i++ ) {
1500 if ( achBatchList[i].
id == partnerId ) {
1501 achBatchList[i].addenda = value;
1513 for ( var i = 0; i < achTemplatePartnerList.length; i++) {
1514 if (achTemplatePartnerList[i].partnerId == partnerId) {
1515 achTemplatePartnerList[i].lastAddenda = value;
1519 function SetBatchNotify( partnerId, value ) {
1520 for ( var i = 0; i < achBatchList.length; i++ ) {
1521 if ( achBatchList[i].
id == partnerId ) {
1522 achBatchList[i].notify = value;
1534 for ( var i = 0; i < achTemplatePartnerList.length; i++) {
1535 if (achTemplatePartnerList[i].partnerId == partnerId) {
1536 achTemplatePartnerList[i].partnerNotify = value;
1543 var StripZip =
function(zip) {
1544 var splitZip = zip.split(
"-");
1545 var halfOne = splitZip[0].replace(/_/g,
"");
1549 halfTwo = splitZip[1].replace(/_/g,
"");
1554 if (halfTwo.length == 0) {
1557 return halfOne +
"-" + halfTwo;
1561 function InitDataSources() {
1562 dsACHHelper =
new kendo.data.DataSource({
1567 url:
'hcuACH.data?cu=<?php echo $HB_ENV['cu
']; ?>',
1569 contentType:
"application/x-www-form-urlencoded",
1575 parse:
function(response) {
1581 requestStart:
function( e ) {
1582 if ( !saveStatus ) {
1583 $.homecuValidator.hideMessage();
1588 requestEnd:
function( e ) {
1594 if ( e.response && e.response.Results ) {
1595 results = e.response.Results;
1598 if ( results && results.homecuErrors )
1599 error = results.homecuErrors;
1601 if ( error && error.length > 0 ) {
1604 dsACHHelper.cancelChanges();
1606 $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
1609 if ( results && results.homecuData ) {
1611 if ( results.homecuData.partners ) {
1612 achPartnerList = results.homecuData.partners;
1613 HandleUpdatedPartnerList();
1617 if ( results.homecuData.accounts ) {
1618 achAllAccounts = results.homecuData.accounts;
1620 HandleUpdatedAccountList();
1624 if ( results.homecuData.templates ) {
1625 HandleUpdatedTemplateList( results.homecuData.templates );
1627 templateChanged =
false;
1634 if ( results.homecuData.read_template_partners ) {
1635 HandleTemplatePartnerList( results.homecuData.read_template_partners );
1639 if ( results.homecuData.update_partner ) {
1642 HandlePartnerUpdate( results.homecuData.partner_data );
1643 editPartnerModel.reset();
1644 editPartnerDialog.close();
1648 if ( results.homecuData.one_partner ) {
1650 HandlePartnerForTemplate( results.homecuData.one_partner );
1653 templateChanged =
true;
1656 HandleUpdatedPartnerList();
1660 if ( results.homecuData.partner_removed ) {
1662 HandleRemovePartnerFromTemplate( results.homecuData.partner_removed );
1665 templateChanged =
true;
1669 if ( results.homecuData.submit_batch && results.homecuData.submit_batch ==
"Success" ) {
1673 templateChanged =
true;
1677 ShowThisStep( progressStep );
1680 ShowConfirmation( results.homecuData.txn );
1684 if ( results && results.homecuInfo && (results.homecuInfo.length > 0) ) {
1685 $.homecuValidator.settings.formStatusField =
"confirmationStatus";
1686 $.homecuValidator.settings.formInfoTitle =
"";
1687 $.homecuValidator.displayMessage(results.homecuInfo, $.homecuValidator.settings.statusSuccess);
1692 error =
"Error occurred on server that halted this operation.";
1693 $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
1699 error:
function( e ) {
1704 function UpdateBatchAmount( partnerId ) {
1706 if ( Number.isInteger(partnerId) ) {
1707 var numerictextbox = $(
"#amount" + partnerId).data(
"kendoNumericTextBox");
1708 if ( numerictextbox ) {
1709 var value = numerictextbox.value();
1710 if ( value ===
null || value === undefined || value ===
"" ) {
1714 if ( $.isNumeric( value ) ) {
1715 SetBatchAmount( partnerId, value );
1719 numerictextbox.value(0.00);
1724 function UpdateBatchAddenda( partnerId ) {
1726 if ( Number.isInteger(partnerId) ) {
1727 var value = $(
"#addenda"+partnerId).val();
1728 SetBatchAddenda( partnerId, value );
1731 function UpdateBatchNotify( partnerId ) {
1733 if ( Number.isInteger(partnerId) ) {
1734 var value = $(
"#notify"+partnerId).prop(
"checked");
1736 SetBatchNotify( partnerId, value );
1740 function InitDataViews() {
1741 viewModel = kendo.observable({
1745 showRecipient:
false,
1749 disableSaveButton:
false,
1752 achMyAcctSelected:
"",
1753 achSubAcctSelected: 0,
1759 achTemplateName:
"",
1760 achDFISelectedType:
"",
1761 achUpdateTemplate:
false,
1762 nextClick:
function(e) {
1767 backClick:
function( e ) {
1771 $.homecuValidator.hideMessage();
1775 ShowThisStep( progressStep );
1778 $(
"#content-wrapper").animate({ scrollTop: 0 }, { duration: 500 } );
1780 cancel:
function( e ) {
1784 document.formCancel.submit();
1790 editPartnerModel = kendo.observable({
1791 sourcePartner:
null,
1793 sourceDirtyInfo:
false,
1794 sourceDirtyAddr:
false,
1795 sourceDirtyAcct:
false,
1797 showDeleteWarn:
false,
1798 listPartnerTypes: achPartnerTypes,
1799 listAccountTypes: achAccountTypes,
1800 listStates: achStateList,
1801 init:
function(partnerInfo) {
1802 this.
set(
"sourcePartner", partnerInfo);
1805 $.homecuValidator.hideMessage();
1806 $.homecuValidator.setup({
1807 formValidate:
"achPartnerEditor",
1808 formStatusField:
"achPartnerStatus",
1812 kendo.bind($(
"#achPartnerEditor"),
this);
1815 this.
set(
"sourcePartner",
null);
1816 this.
set(
"sourceDirty",
false);
1817 this.
set(
"sourceDirtyInfo",
false);
1818 this.
set(
"sourceDirtyAddr",
false);
1819 this.
set(
"sourceDirtyAcct",
false);
1821 $.homecuValidator.hideMessage();
1822 $.homecuValidator.setup({
1823 formValidate:
"achEditTemplate",
1824 formStatusField:
"formStatus" 1828 kendo.unbind($(
"#achPartnerEditor"));
1831 var otherErrors = [];
1833 if (this.sourcePartner.zip !=
"") {
1835 var zip = this.sourcePartner.zip;
1836 var zipReplace = zip.replace(/_/g,
"");
1837 var zipSplit = zipReplace.split(
"-");
1838 var zipConstruct =
"";
1841 if (zipSplit[0].length < 5) {
1842 otherErrors.push(
"<?php echo $MC->msg("Zip Code Invalid
", HCU_DISPLAY_AS_JS) ?>");
1843 }
else if (zipSplit.length > 1) {
1844 if (zipSplit[1].length > 0 && zipSplit[1].length < 4) {
1845 otherErrors.push(
"<?php echo $MC->msg("Zip Code Invalid
", HCU_DISPLAY_AS_JS) ?>");
1851 zipConstruct += zipSplit[0] +
"-" + zipSplit[1];
1853 zipConstruct += zipSplit[0];
1856 this.
set(
"sourcePartner.zip", zipConstruct);
1859 if (this.sourcePartner.dfi_routing !=
"") {
1861 var routing = this.sourcePartner.dfi_routing;
1862 var routingReplace = routing.replace(/_/g,
"");
1864 if (routingReplace.length < 9) {
1865 otherErrors.push(
"<?php echo $MC->msg("ACH Routing number 9 digits
", HCU_DISPLAY_AS_HTML); ?>");
1868 this.
set(
"sourcePartner.dfi_routing", routingReplace);
1871 $.homecuValidator.validate();
1872 var totalErrors = $.homecuValidator.homecuKendoValidator.errors();
1875 for (var i = 0; i < otherErrors.length; i++) {
1876 if ($.inArray(otherErrors[i], totalErrors) == -1) {
1877 totalErrors.push(otherErrors[i]);
1881 if (totalErrors.length > 0) {
1882 $.homecuValidator.displayMessage(totalErrors, $.homecuValidator.settings.statusError);
1885 action: this.sourcePartner.partner_id == 0 ?
1887 "update_ach_partner",
1888 display_name: this.sourcePartner.display_name,
1889 ach_name: this.sourcePartner.ach_name ?
1890 this.sourcePartner.ach_name :
1891 this.sourcePartner.display_name,
1892 email: this.sourcePartner.email,
1893 email_notify: this.sourcePartner.email_notify ? 1 : 0,
1894 partner_type: this.sourcePartner.partner_type,
1895 address1: this.sourcePartner.address1,
1896 address2: this.sourcePartner.address2,
1897 city: this.sourcePartner.city,
1898 state: this.sourcePartner.state,
1899 zip: this.sourcePartner.zip,
1900 country: this.sourcePartner.country,
1901 dfi_routing: this.sourcePartner.dfi_routing,
1902 dfi_account: this.sourcePartner.dfi_account,
1903 dfi_account_type: this.sourcePartner.dfi_account_type,
1904 partner_id: this.sourcePartner.partner_id,
1905 template_id: selectedTemplate
1908 dsACHHelper.read( request );
1911 cancel:
function(e) {
1912 editPartnerDialog.close();
1914 change:
function(e) {
1916 var accordion =
null;
1918 e.hasOwnProperty(
"sender") ?
1919 target = $(e.sender.element[0]) :
1920 target = $(e.target);
1922 accordion = target.closest(
".achAccordionContent");
1923 accordionIndex = accordion.data(
"accordion-index");
1925 switch (accordionIndex) {
1926 case 0: this.
set(
"sourceDirtyInfo",
true);
break;
1927 case 1: this.
set(
"sourceDirtyAddr",
true);
break;
1928 case 2: this.
set(
"sourceDirtyAcct",
true);
break;
1932 $(target).parent().attr(
"for") ==
"achPartnerNotify" ||
1933 $(target).attr(
"name") ==
"achPartnerNotify" ?
1934 this.
set(
"sourcePartner.email_notify", !this.sourcePartner.email_notify) :
1937 this.
set(
"sourceDirty",
true);
1941 editTemplateModel = kendo.observable({
1944 setDirty:
function(e) {
1945 this.
set(
"dirtyFlag",
true);
1947 SetTemplate:
function( name ) {
1948 this.
set(
"templateName", name );
1949 this.
set(
"dirtyFlag", false );
1951 ClearDirty:
function() {
1952 this.
set(
"dirtyFlag",
false);
1957 $.homecuValidator.setup({formErrorTitle:
"<?php echo $MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS) ?>"});
1959 partnerGrid = $(
'#partnerGrid').kendoGrid({
1960 dataSource: achTemplatePartnerList,
1962 rowTemplate: kendo.template($(
"#partnerRow").html()),
1965 change:
function(e) {
1966 var selectedCell = this.select();
1967 var selectedRow = selectedCell.closest(
"tr");
1968 var cellIndex = selectedCell.index();
1970 if ( cellIndex <= 1 ) {
1971 checkbox = selectedRow.find(
"td:first input");
1972 checkbox.prop(
"checked", !checkbox.prop(
"checked"));
1974 var dataItem = partnerGrid.dataItem(selectedRow);
1977 SetPartnerInBatch( dataItem.partnerId, checkbox.prop(
"checked") );
1980 selectedCell.removeClass(
"k-state-selected" );
1983 { field:
"partnerId", width: 40, headerTemplate:
"<span id='batchTip'><input id='checkAllForBatch' type='checkbox' /> <span class='fa fa-question-circle-o visible-xs-inline'></span></span>" },
1984 { field:
"partnerName", title:
"<?php echo $MC->msg("Name
", HCU_DISPLAY_AS_JS); ?>" },
1985 { title:
"<?php echo $MC->msg("Edit
", HCU_DISPLAY_AS_JS); ?>", width: 65 }
1987 dataBound:
function(e) {
1989 homecuTooltip.bind({
1990 batchTip:
"<?php echo $MC->msg("ACH Set All
", HCU_DISPLAY_AS_JS) ?>",
1991 deleteTip:
"<?php echo $MC->msg("ACH Remove from batch
", HCU_DISPLAY_AS_JS) ?>",
1992 editTip:
"<?php echo $MC->msg("ACH Edit partner
", HCU_DISPLAY_AS_JS) ?>",
1993 updateTemplateTip:
"<?php echo $MC->msg("ACH Update
template help
", HCU_DISPLAY_AS_JS) ?>",
1994 achPartnerNotifyTip:
"<?php echo $MC->msg("ACH Notify Info Init
", HCU_DISPLAY_AS_JS); ?>",
1995 achAmountNotifyTip:
"<?php echo $MC->msg("ACH Notify Info Init
", HCU_DISPLAY_AS_JS); ?>" 1998 }).data(
'kendoGrid');
2000 chooserGrid = $(
'#achPartnerChooser').kendoGrid({
2001 dataSource: achPartnerList,
2005 noRecords: {
template:
"<span class='hcu-sub-text'><?php echo $MC->msg("ACH No Partners
", HCU_DISPLAY_AS_JS) ?></span>"},
2010 title:
"<?php echo $MC->msg("Name
", HCU_DISPLAY_AS_JS) ?>" }
2012 change:
function(e) {
2013 var selectedCell = this.select();
2014 var selectedRow = selectedCell.closest(
"tr");
2016 var dataItem = chooserGrid.dataItem(selectedRow);
2019 var selectedId = dataItem.id;
2021 if ( selectedId > 0 ) {
2022 var request = { action:
"add_template_partner", partner_id: selectedId, template_id: selectedTemplate };
2024 dsACHHelper.read( request );
2027 }).data(
'kendoGrid');
2029 $(
"#templateList").kendoListView({
2030 dataSource: achTemplateList,
2032 template: kendo.template($(
"#templateTemplate").html()),
2033 dataBound:
function() {
2035 var boxWidth = $(
"#templateList").innerWidth();
2036 var columns = Math.trunc( boxWidth / 200);
2037 if ( columns > 0 ) {
2038 var templateWidth = Math.trunc(boxWidth / columns) - 22;
2039 $(
".tmplMeta").width( templateWidth );
2044 $(
"#achPartnerDD").kendoDropDownList({
2045 dataTextField:
"name",
2046 dataValueField:
"id",
2047 dataSource: achPartnerList,
2048 optionLabel: {id:
"", name:
"<?php echo $MC->msg("ACH Choose Partner
", HCU_DISPLAY_AS_JS) ?>"},
2049 change:
function(e) {
2051 var selectedId = this.value();
2052 if ( selectedId > 0 ) {
2053 var request = { action:
"add_template_partner", partner_id: selectedId, template_id: selectedTemplate };
2055 dsACHHelper.read( request );
2060 $(
"#addPartnerButton").kendoButton({
2061 click:
function(e) {
2062 var title =
"<?php echo $MC->msg("ACH Add New Partner
", HCU_DISPLAY_AS_JS) ?>";
2064 var defaultPartnerType =
"<?php echo $initialPartnerType ?>";
2066 editPartnerModel.reset();
2067 editPartnerModel.init({
2069 partner_type: defaultPartnerType,
2074 email_notify:
false,
2083 dfi_account_confirm:
"",
2084 dfi_account_type:
"" 2087 editPartnerDialog.title(title);
2088 editPartnerDialog.center();
2089 editPartnerDialog.open();
2093 $(
"#achSubAcctList").kendoDropDownList({
2094 dataTextField:
"name",
2095 dataValueField:
"id",
2096 dataSource: achSubAccounts,
2097 valueTemplate:
'<span class="local-subleft">#: name #</span><span class="local-subright">#: amount #</span>',
2098 template:
'<span class="k-state-default"><span class="local-subleft local-subname">#: name #</span><span class="local-subright">#: amount #</span></span>',
2099 optionLabel: {name:
"<?php echo $MC->msg("ACH Select Account
", HCU_DISPLAY_AS_JS) ?>", id:
"", amount:
""},
2100 change:
function(e) {
2101 var dataIndex = this.selectedIndex > 0 ? this.selectedIndex-1 : 0;
2102 var dataSource = this.dataSource.data();
2103 var dataItem = dataSource[dataIndex];
2105 var selectedAccount = dataItem.account;
2106 var selectedAvailable = dataItem.amount.substring(1);
2107 viewModel.set(
"achMyAcctSelected", selectedAccount);
2108 viewModel.set(
"achAvailable", selectedAvailable);
2113 effDatePicker = $(
"#achEffDate");
2114 effDatePicker.kendoMaskedTextBox({
2117 effDatePicker.kendoDatePicker({
2119 format:
"MM/dd/yyyy" 2121 effDatePicker.closest(
".k-datepicker").add(effDatePicker).removeClass(
"k-textbox");
2123 $(
"#achPartnerFilter").kendoMultiSelect({
2124 dataTextField:
"display",
2125 dataValueField:
"type",
2126 placeholder:
"<?php echo $MC->msg("ACH Select Types
", HCU_DISPLAY_AS_JS); ?>",
2127 dataSource: achPartnerTypes,
2128 dataBound:
function( e ) {
2129 var multiselect = $(
"#achPartnerFilter").data(
"kendoMultiSelect");
2131 multiselect.value([
"<?php echo $initialPartnerType ?>"]);
2133 change:
function( e ) {
2134 HandleUpdatedPartnerList();
2139 if (
"<?php echo $initialPartnerType ?>" ===
"e" ) {
2140 $(
"#achPartnerFilterPayee").prop(
"checked",
true );
2141 $(
"#achPartnerFilterPayroll").prop(
"checked",
true );
2142 $(
"#achPartnerFilterUnassigned").prop(
"checked",
true );
2143 }
else if (
"<?php echo $initialPartnerType ?>" ===
"r" ) {
2144 $(
"#achPartnerFilterPayor").prop(
"checked",
true );
2145 $(
"#achPartnerFilterUnassigned").prop(
"checked",
true );
2147 $(
"#achPartnerFilterUnassigned").prop(
"checked",
true );
2151 $(
".partner-filter-chooser").click(
function() {
2152 HandleUpdatedPartnerList();
2156 $(
"#step1").click(
function(e) {
2160 $(
"#step2").click(
function(e) {
2164 $(
"#step3").click(
function(e) {
2168 $(
"#step4").click(
function(e) {
2173 $(
'#formChangeType').change(
function(){
2174 $(
'#formChangeType').submit();
2177 $(
"#checkAllForBatch").click(
function() {
2178 var state = $(
"#checkAllForBatch").prop(
"checked" );
2179 $(
".in-batch-checkbox").prop(
"checked", state );
2182 for ( var i = 0; i < achTemplatePartnerList.length; i++ ) {
2183 achTemplatePartnerList[i].inBatch = state;
2188 viewModel.bind(
"save",
function(e) {
2189 viewModel.achServer.read();
2193 viewModel.bind(
"reset",
function(e) {
2198 kendo.bind($(
"#ach-payment"), viewModel);
2201 $(
"#progressBar").kendoProgressBar({
2206 change:
function( e ) {
2207 progressSteps = $(
"#progressBar").data(
"kendoProgressBar");
2208 progressSteps.progressStatus.text(
"(" + progressSteps.value() +
" / 4)" );
2211 progressSteps = $(
"#progressBar").data(
"kendoProgressBar");
2212 progressSteps.progressStatus.text(
"(1 / 4)" );
2214 progressSteps.value( 1 );
2216 ShowThisStep( progressStep );
2218 deleteDialog = $(
"#deleteDialog").kendoDialog({
2220 title:
"<?php echo $MC->msg("ACH Delete Template
", HCU_DISPLAY_AS_JS) ?>",
2221 content:
"<p>" +
"<?php echo $MC->msg("ACH Continue
delete", HCU_DISPLAY_AS_JS) ?>" +
"</p><p>" +
"<?php echo $MC->msg("ACH Continue
", HCU_DISPLAY_AS_JS) ?>" +
"</p>",
2224 window_stack.push(
function(e) {
2225 deleteDialog.close(e);
2228 close:
function(e) {
2232 actions: [{text:
"<?php echo $MC->msg("Cancel
", HCU_DISPLAY_AS_JS) ?>"},
2234 text:
"<?php echo $MC->msg("ACH Continue
", HCU_DISPLAY_AS_JS) ?>",
2235 action:
function(e){
2236 DeleteACHTemplate();
2243 }).data(
"kendoDialog");
2245 editTemplateDialog = $(
"#editDialog").kendoDialog({
2247 title:
"<?php echo $MC->msg("ACH Edit Template Name
", HCU_DISPLAY_AS_JS) ?>",
2248 content:
"<div id='editTemplate' class='form-group hcu-form-group-spacer'>" +
2249 "<div id='editFormStatus' class='homecu-formStatus k-block k-error-colored' style='display:none; margin-bottom:10px;max-width:800px;'></div>" +
2250 "<label class='col-xs-12' for='templateNameUpdate'><?php echo $MC->msg("ACH Template Name
", HCU_DISPLAY_AS_JS) ?></label>" +
2251 "<div class='col-xs-12'>" +
2252 "<input id='templateNameUpdate' \ 2253 name='templateNameUpdate' \ 2255 data-bind='value: templateName, events:{change: setDirty}' \ 2256 placeholder='<?php echo $MC->msg("ACH Template Name required
", HCU_DISPLAY_AS_JS) ?>' \ 2258 class='k-textbox k-autocomplete hcu-all-100' \ 2260 validationMessage = '<?php echo $MC->msg("ACH Template Name required
", HCU_DISPLAY_AS_JS) ?>' \ 2261 autocomplete='off'/>" +
2266 editTemplateModel.ClearDirty();
2270 $(
"#templateNameUpdate").focus();
2273 $.homecuValidator.setup( {formStatusField:
"editFormStatus", formValidate:
"editTemplate"} );
2276 kendo.bind($(
"#editTemplate"), editTemplateModel);
2279 window_stack.push(
function(e) {
2280 if ( editTemplateModel.dirtyFlag ) {
2281 discardDialog.open();
2283 editTemplateDialog.close(e);
2287 close:
function(e) {
2289 $.homecuValidator.setup({formStatusField:
'formStatus'});
2296 text:
"<?php echo $MC->msg("Cancel
", HCU_DISPLAY_AS_JS) ?>",
2297 action:
function(e){
2298 if ( editTemplateModel.dirtyFlag ) {
2299 discardDialog.open();
2305 text:
"<?php echo $MC->msg("Save
", HCU_DISPLAY_AS_JS) ?>",
2306 action:
function(e){
2308 if ( $.homecuValidator.validate() ) {
2310 UpdateACHTemplate();
2318 }).data(
"kendoDialog");
2320 removePartnerDialog = $(
"#removePartnerDialog").kendoDialog({
2322 title:
"<?php echo $MC->msg("ACH Remove Partner
", HCU_DISPLAY_AS_JS) ?>",
2326 window_stack.push(
function(e) {
2327 removePartnerDialog.close(e);
2330 close:
function(e) {
2334 actions: [{text:
"<?php echo $MC->msg("Cancel
", HCU_DISPLAY_AS_JS) ?>"},
2336 text:
"<?php echo $MC->msg("ACH Continue
", HCU_DISPLAY_AS_JS) ?>",
2337 action:
function(e){
2338 var partnerId = $(
"#removePartnerId").val();
2339 RemovePartner( partnerId );
2346 }).data(
"kendoDialog");
2348 uploadCSVDialog = $(
"#csvDialog").kendoDialog({
2352 title:
"<?php echo $MC->msg("CSV File
", HCU_DISPLAY_AS_JS) ?>",
2353 content:
"<div class='k-content'>" +
2354 " <div id='uploadCustomContent'></div>" +
2356 " <h4><?php echo $MC->msg("ACH Upload CSV File
", HCU_DISPLAY_AS_JS); ?></h4>" +
2357 " <div class='dropZoneArea'>" +
2358 " <input id='csvFile' name='csvFile' type='file'>" +
2360 " <div class='upload-hint'><?php echo $MC->msg("ACH Upload CSV Max
", HCU_DISPLAY_AS_JS); ?></div>" +
2361 " <div class='upload-hint'><?php echo $MC->msg("ACH Upload CSV Select
", HCU_DISPLAY_AS_JS); ?></div>" +
2368 ShowNotice(
'<?php echo $noticeURLCSV; ?>',
"<?php echo $noticeLinkDisplayCSV ?>",
2382 csvNotMatched =
null;
2383 $(
"#csvNotMatched").hide();
2384 csvNotSelected =
null;
2385 $(
"#csvNotSelected").hide();
2388 if ( !uploadWidget ) {
2389 uploadWidget = $(
"#csvFile").kendoUpload({
2391 saveUrl:
'hcuACH.data?cu=<?php echo $HB_ENV['cu
']; ?>&action=csv&template_id=' + selectedTemplate
2395 dropFilesHere:
"Drop file here, or select one for upload.",
2396 select:
"Select CSV File" 2399 allowedExtensions: [
".csv",
".txt"],
2400 maxFileSize: 100 * 1024
2402 upload:
function(e) {
2404 complete:
function(e) {
2406 success:
function(e) {
2407 var serverReply = e.response.Results.homecuData.csv;
2408 var upload = $(
"#csvFile").data(
"kendoUpload");
2409 upload.clearAllFiles();
2410 uploadCSVDialog.close();
2413 NextClickedByCSVSuccess();
2414 PopulateBatchGridUsingCSV( serverReply.found );
2417 csvNotMatched =
null;
2418 if ( serverReply.not_found.length > 0 ) {
2419 csvNotMatched = serverReply.not_found;
2420 $(
"#csvNotMatched").show();
2423 csvNotSelected =
null;
2424 if ( serverReply.missed.length > 0 ) {
2425 csvNotSelected = serverReply.missed;
2426 $(
"#csvNotSelected").show();
2432 $(
"div.k-dropzone em").css(
"visibility",
"visible");
2436 window_stack.push(
function(e) {
2437 uploadCSVDialog.close(e);
2440 close:
function(e) {
2446 text:
"<?php echo $MC->msg("Close
", HCU_DISPLAY_AS_JS) ?>",
2447 action:
function(e){
2448 uploadCSVDialog.close(e);
2452 }).data(
"kendoDialog");
2455 var maxHeight = parseInt($(window).height() * .85, 10);
2456 var editPartnerTemplate = $(
"#achPartnerEditorTmp").html();
2457 editPartnerDialog = $(editPartnerTemplate).kendoWindow({
2461 maxHeight: maxHeight,
2465 activate:
function() {
2466 window_stack.push(
function(e) {
2467 if ( editPartnerModel.sourceDirty ) {
2469 discardDialog.open();
2471 editPartnerDialog.close(e);
2474 $(
"#achPartnerEditor").scrollTop(0);
2476 close:
function(e) {
2478 if (editPartnerModel.sourceDirty) {
2479 var fn = window_stack[window_stack.length-1];
2483 $.homecuValidator.setup({
2484 formValidate:
"achEditTemplate",
2485 formStatusField:
"formStatus" 2489 }).data(
"kendoWindow");
2492 csvInfoDialog = $(
"#csvInfoDialog").kendoDialog({
2499 window_stack.push(
function(e) {
2500 csvInfoDialog.close(e);
2503 close:
function(e) {
2507 actions: [{text:
"<?php echo $MC->msg("Close
", HCU_DISPLAY_AS_JS) ?>",
2509 }).data(
"kendoDialog");
2511 discardDialog = $(
"#discardDialog").kendoDialog({
2513 title:
"<?php echo $MC->msg("ACH Discard Changes?
", HCU_DISPLAY_AS_JS) ?>",
2514 content:
"<?php echo $MC->msg("ACH Discard changes warning
", HCU_DISPLAY_AS_JS) ?>" +
"<br><br>" +
"<?php echo $MC->msg("ACH Continue
", HCU_DISPLAY_AS_JS) ?>",
2517 window_stack.push(
function(e) {
2518 discardDialog.close(e);
2521 close:
function(e) {
2526 text:
"<?php echo $MC->msg("Cancel
", HCU_DISPLAY_AS_JS) ?>",
2527 action:
function(e) {
2531 text:
"<?php echo $MC->msg("ACH Continue
", HCU_DISPLAY_AS_JS) ?>",
2533 action:
function(e) {
2535 editTemplateModel.ClearDirty();
2536 editPartnerModel.reset();
2542 var fn = window_stack[window_stack.length - 1];
2546 }).data(
"kendoDialog");
2550 $(
"#achPartnerType").kendoDropDownList({
2551 dataTextField:
"display",
2552 dataValueField:
"type",
2553 dataSource: achPartnerTypes
2557 $(
"#achTypeSingle").click(
function(e) {
2558 $(
"#achFeatureChoice").val(
"<?php echo $batchButton ?>" );
2559 $(
"#formChangeType").submit();
2563 $(
"input[name=\"achPartnerZip\"]").kendoMaskedTextBox({
2565 clearPromptChar:
true 2568 $(
"input[name=\"achPartnerRouting\"]").kendoMaskedTextBox({
2570 clearPromptChar:
true 2573 kendo.data.binders.required = kendo.data.Binder.extend({
2574 refresh:
function() {
2575 var required = this.bindings.required.get();
2577 this.element.setAttribute(
"required",
"required");
2579 this.element.removeAttribute(
"required");
2584 $(
"#csvUploaderLink").click(
function() {
2585 uploadCSVDialog.open();
2588 $(
"#csvNotSelected").click(
function() {
2590 var title =
"<?php echo $MC->msg("ACH Not Selected
", HCU_DISPLAY_AS_JS) ?>";
2595 if ( csvNotSelected && csvNotSelected.length ) {
2596 content = content +
"<ul style='list-style: none'>";
2598 for ( var i = 0; i < csvNotSelected.length; i++ ) {
2599 content = content +
"<li>" + csvNotSelected[i] +
"</li>";
2602 content = content +
"</ul>";
2604 content = content +
"<?php echo $MC->msg("None
", HCU_DISPLAY_AS_JS) ?><br><br>";
2607 csvInfoDialog.title(title).content(content).open();
2610 $(
"#csvNotMatched").click(
function() {
2612 var title =
"<?php echo $MC->msg("ACH Not Matched
", HCU_DISPLAY_AS_JS) ?>";
2617 if ( csvNotMatched && csvNotMatched.length ) {
2618 content = content +
"<ul style='list-style: none'>";
2620 for ( var i = 0; i < csvNotMatched.length; i++ ) {
2621 content = content +
"<li>" + csvNotMatched[i] +
"</li>";
2624 content = content +
"</ul>";
2626 content = content +
"<?php echo $MC->msg("None
", HCU_DISPLAY_AS_JS) ?><br><br>";
2629 csvInfoDialog.title(title).content(content).open();
2632 homecuTooltip.bind({
2633 companyNameTip:
"<?php echo $MC->msg("ACH Company Name Help
", HCU_DISPLAY_AS_JS) ?>" 2637 $(
"#confirmationWindow").kendoDialog({
2638 title:
"<?php echo $MC->msg('ACH Batch Confirmation'); ?>",
2647 text:
"<?php echo $MC->msg('Close', HCU_DISPLAY_AS_JS); ?>",
2652 windowStack.push(
this);
2654 close:
function(e) {
2661 $.homecuValidator.settings.formStatusField =
"formStatus";
2662 $.homecuValidator.settings.formInfoTitle =
"";
2667 function InitScreen() {
2672 $(
"#ach-payment").show();
2675 function ShowConfirmation(txn) {
2676 var confirmationTemplate = kendo.template($(
"#confirmationTemplate").html());
2677 var confirmationDisplay = confirmationTemplate(txn);
2679 $(
"#confirmationWindow").data(
"kendoDialog").content(confirmationDisplay);
2680 $(
"#confirmationWindow").data(
"kendoDialog").open();
2683 $(document).ready(
function(){
2685 ShowNotice(
'<?php echo $termsURLACH; ?>',
"<?php echo $termsLinkDisplayACH ?>",
2689 ShowNotice(
'<?php echo $noticeURLACH; ?>',
"<?php echo $noticeLinkDisplayACH ?>");
2696 var urlInit = window.location.href.substring(0, window.location.href.indexOf(
"hcu"));
2697 var urlCu =
"<?php echo $Cu ?>";
2698 var urlPage =
"hcuAccounts.prg";
2699 var urlRedirect = urlInit + urlPage +
"?cu=" + urlCu;
2701 window.location.replace(urlRedirect);
2704 }
else if (notice) {
2706 ShowNotice(
'<?php echo $noticeURLACH; ?>',
"<?php echo $noticeLinkDisplayACH ?>");
2713 $(document).on(
"click",
".k-overlay",
function (e) {
2714 if(windowStack.length > 0) {
2716 var win = windowStack[windowStack.length - 1];
2722 <div
id=
"confirmationWindow"></div>
2723 <div
id=
"disclosureWindow" name=
"disclosureWindow"></div>
2724 <style type=
"text/css">
2728 .local-subleft { float:left; }
2729 .local-subname { font-weight: 500; }
2730 .local-subright { float:right; }
2733 border-top: 2px solid rgba(0,0,0,.37);
2748 margin-bottom: -1px;
2756 border: 1px solid black;
2767 padding: 3px 5px 0 0;
2768 white-space: nowrap;
2772 text-transform: uppercase;
2773 color: rgba(0,0,0,.56);
2777 padding: 3px 5px 0 0;
2778 white-space: nowrap;
2780 font-weight: normal;
2781 color: rgba(0,0,0,.56);
2783 .tmpl .p#add-
template {
2793 div.icon-container {
2808 .k-grid .k-grid-content tr:hover {
2811 .k-grid .partner-details, .k-grid .partner-edits {
2812 border-left-width: 0;
2814 .partner-details .partner-name {
2817 .partner-details .partner-address {
2818 color: rgba(0,0,0,.87);
2827 #achPartnerChooser .k-grid-content { 2831 .hcu-scrolling-dialog {
2835 color: rgba(0,0,0,.54);
2843 .ach-
switch-button {
2844 margin-bottom: 15px;
2846 .csv-uploader-style, .csv-not-matched-style {
2849 .local-link-style a:link, a:visited, a:hover, a:active {
2850 text-decoration: none;
2853 .local-sm-align-right {
2862 .dropZoneArea .k-dropzone-active {
2863 border: 1px solid red;
2866 .dropZoneArea .k-dropzone-active.k-dropzone-hovered {
2867 border: 1px solid green;
2879 @media (min-width: 768px) {
2880 .local-sm-align-right {
2886 @media (min-width: 992px) {
2893 .local-transfer-msg {
2897 <script type=
"text/x-kendo-template" id=
"templateTemplate">
2899 <div
class=
"tmplMeta" onClick=
'javascript:SelectTemplate(#= templateId #);'>
2900 <h3>#:templateName#</h3>
2901 # if ( templateId == -1 ) { # 2902 <p
id=
"add-template"><?php echo $MC->msg(
"ACH Click add template", HCU_DISPLAY_AS_HTML) ?></p>
2904 <p>Last edit <b>#:templateMeta.last_edit#</b></p>
2905 <p>Submitted <b>#:templateMeta.last_proc#</b></p>
2906 <p>Template Total <b>#:kendo.toString(templateMeta.total,
"c")#</b></p>
2907 <p>Partners <b>#:templateMeta.count#</b></p>
2908 <p>Type <b>#:templateMeta.type#</b></p>
2913 # if ( templateId != -1 ) { # 2914 <div
id=
"icon-container">
2915 <a href=
"javascript:ShowDeleteTemplate('#= templateId #')"><div
class=
"left-icon fa fa-trash"></div></a>
2916 <a href=
"javascript:ShowEditTemplate('#= templateId #')"><div
class=
"right-icon fa fa-pencil"></div></a>
2921 <script
id=
"partnerRow" type=
"text/x-kendo-template">
2925 <input type=
"checkbox" #
if ( inBatch ) { # CHECKED # } #
class=
"in-batch-checkbox" name=
"inBatch" value=
"1" onClick=
"javascript: SetPartnerInBatch( #:partnerId#, this.checked);">
2928 <td
class=
"partner-details">
2929 <span
class=
"partner-name">#: partnerDisplayName#</span>
2930 <span
class=
"partner-address">#: showPartnerAddress#</span><br>
2932 <td
class=
"partner-edits">
2933 <a href=
"javascript:ShowRemovePartner('#= partnerId #')"><div
id=
"deleteTip" class=
"fa fa-trash"></div></a>
2934 <a href=
"javascript:ShowEditPartner('#= partnerId #')"><div
id=
"editTip" class=
"fa fa-pencil"></div></a>
2938 <script
id=
"batchTemplate" type=
"text/x-kendo-template">
2939 # for (var i = 0; i < data.length; i++) { # 2940 <div
class=
"form-group">
2941 <div
class=
"col-xs-12 visible-xs-block h4">#= data[i].name#</div>
2942 <div
class=
"col-sm-3 hidden-xs">#= data[i].name#</div>
2943 <label
class=
"col-xs-12 visible-xs-block"><?php echo $MC->msg(
"Amount", HCU_DISPLAY_AS_JS) ?></label>
2944 <div
class=
"col-xs-12 col-sm-3"><input value=
"#: kendo.toString(data[i].amount, '0.00') #" type=
"text" pattern=
"" id=
"amount#: data[i].id#" class=
"hcu-all-100 batch-amount" maxlength=
"15" required></div>
2945 <label
class=
"col-xs-12 visible-xs-block"><?php echo $MC->msg(
"ACH Addenda", HCU_DISPLAY_AS_JS) ?></label>
2946 <div
class=
"col-xs-12 col-sm-4"><input value=
"#: data[i].addenda #" type=
"text" id=
'addenda#: data[i].id#' class=
"k-textbox hcu-all-100" maxlength=
"100" onchange=
"javascript:UpdateBatchAddenda(#: data[i].id#)"></div>
2947 <label
class=
"col-xs-12 visible-xs-block"><?php echo $MC->msg(
"Notify", HCU_DISPLAY_AS_JS) ?></label>
2948 <div
class=
"col-xs-12 col-sm-2"><input value=
'1' #
if ( data[i].notify ) {# CHECKED #}# type=
"checkbox" id=
'notify#: data[i].id#' onchange=
"javascript:UpdateBatchNotify(#: data[i].id#)" #
if (data[i].disable) {# DISABLED #}#></div>
2953 <div
id=
"deleteDialog"></div>
2954 <div
id=
"editDialog"></div>
2955 <div
id=
"discardDialog"></div>
2956 <div
id=
"successDialog"></div>
2957 <div
id=
"removePartnerDialog"></div>
2958 <div
id=
"csvDialog"></div>
2959 <div
id=
"csvInfoDialog"></div>
2960 <div
class=
"k-content container-fluid" id=
"ach-payment" style=
"display: none;">
2961 <div
class=
'ach-title'><?php echo $pageTitle ?></div>
2962 <form method=
"post" id=
"formChangeType" name=
"formChangeType" action=
'<?php echo $HB_ENV["loginpath"]."/{$HB_ENV['currentscript
']}?".$HB_ENV["cuquery"] ?>'>
2963 <input type=
'hidden' id=
"achFeatureChoice" name=
'ach_feature' value=
'' />
2965 <div
class=
"col-xs-12">
2967 <div
class=
"col-xs-4 ach-switch-button">
2968 <div
class=
"btn-group" role=
"group" aria-label=
"...">
2969 <button type=
"button" id=
"achTypeSingle" class=
"btn btn-default"><?php echo $MC->msg(
"ACH Single", HCU_DISPLAY_AS_HTML); ?></button>
2970 <button type=
"button" id=
"achTypeBatch" class=
"btn btn-primary"><?php echo $MC->msg(
"ACH Batch", HCU_DISPLAY_AS_HTML); ?></button>
2974 <div
class=
"col-xs-8 text-right">
2975 <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>
2976 <span> <?php echo $companyData[
'group_name']; ?></span>
2981 <div
class=
"col-xs-12">
2982 <div
id=
"stepName"><?php echo $progressStep1; ?></div>
2986 <div
class=
"col-xs-12">
2987 <div
id=
"progressBar" class=
"hcu-all-100"></div>
2991 <div
class=
"col-xs-12"> </div>
2995 <div
class=
"tabTemplate tabHide" id=
"achTemplate">
2996 <div
class=
"tabContents">
2997 <div
class=
"well well-sm">
2998 <div
id=
"templateList"></div>
3004 <div
class=
"tabPayment tabHide" id=
"achEditTemplate">
3005 <div
class=
"tabContents">
3006 <div
class=
"form-horizontal">
3007 <div
class=
"well well-sm">
3008 <div
class=
"form-group">
3009 <label
class=
"col-sm-4 col-xs-12 control-label"><?php echo $MC->msg(
"ACH Type", HCU_DISPLAY_AS_HTML); ?><span
class=
"hcu-required-field"><sup>*</sup></span></label>
3010 <div
class=
"col-sm-8 col-xs-12">
3011 <label
class=
"radio-inline">
3013 name=
'ach_entry_type' 3015 data-bind=
"checked: achType" 3016 required> <?php echo $MC->msg(
"ACH PPD", HCU_DISPLAY_AS_HTML); ?>
3018 <label
class=
"radio-inline">
3019 <input type=
'radio' name=
'ach_entry_type' value=
'CCD' data-bind=
"checked: achType"> <?php echo $MC->msg(
"ACH CCD", HCU_DISPLAY_AS_HTML); ?>
3023 <div
class=
"form-group">
3024 <div
class=
"hidden-xs col-sm-4"> </div>
3025 <div
class=
"col-xs-12 col-sm-8"><span
class=
"hcu-required-field"><sup>*</sup></span><?php echo $MC->msg(
"ACH Required", HCU_DISPLAY_AS_HTML); ?></div>
3027 <div data-bind=
"visible: achType">
3028 <div
class=
"hcu-filter-group">
3029 <div
class=
"form-group">
3030 <div
class=
"col-xs-12 h4"><?php echo $MC->msg(
"ACH Add Partners Template", HCU_DISPLAY_AS_HTML); ?></div>
3032 <div
class=
"form-group">
3033 <div
class=
"col-xs-12 visible-xs-block"><div
id=
"achPartnerDD" class=
"hcu-all-100"></div></div>
3034 <div
class=
"col-sm-10 col-sm-offset-1 hidden-xs"><div
id=
"achPartnerChooser" class=
"hcu-all-100"></div></div>
3036 <div
class=
"form-group">
3037 <div
class=
"col-sm-2 hidden-xs"> </div>
3038 <div
class=
"col-sm-2 col-sm-offset-0 col-xs-10 col-xs-offset-1">
3039 <label
class=
"checkbox-inline">
3040 <input type=
"checkbox" id=
"achPartnerFilterPayee" class=
"partner-filter-chooser"> <?php echo $MC->msg(
"ACH Payee", HCU_DISPLAY_AS_HTML); ?>
3043 <div
class=
"col-sm-2 col-sm-offset-0 col-xs-10 col-xs-offset-1">
3044 <label
class=
"checkbox-inline">
3045 <input type=
"checkbox" id=
"achPartnerFilterPayroll" class=
"partner-filter-chooser"> <?php echo $MC->msg(
"ACH Payroll", HCU_DISPLAY_AS_HTML); ?>
3048 <div
class=
"col-sm-2 col-sm-offset-0 col-xs-10 col-xs-offset-1">
3049 <label
class=
"checkbox-inline">
3050 <input type=
"checkbox" id=
"achPartnerFilterPayor" class=
"partner-filter-chooser"> <?php echo $MC->msg(
"ACH Payor", HCU_DISPLAY_AS_HTML); ?>
3053 <div
class=
"col-sm-2 col-sm-offset-0 col-xs-10 col-xs-offset-1">
3054 <label
class=
"checkbox-inline">
3055 <input type=
"checkbox" id=
"achPartnerFilterUnassigned" class=
"partner-filter-chooser"> <?php echo $MC->msg(
"ACH Unassigned", HCU_DISPLAY_AS_HTML); ?>
3059 <div
class=
"form-group">
3060 <div
class=
"col-sm-5 col-sm-offset-1 col-xs-12">
3061 <button
id=
"addPartnerButton" class=
"">
3062 <span
class=
"fa fa-plus"></span>
3063 <span> <?php echo $MC->msg(
"ACH Add Partner", HCU_DISPLAY_AS_HTML); ?></span>
3070 <div
class=
"col-xs-12"> </div>
3072 <div data-bind=
"visible: achType">
3074 <div
class=
"col-xs-12 h4"><?php echo $batchActivity ?></div>
3076 <div
class=
"form-group">
3077 <label
class=
"col-sm-4 col-xs-12 local-sm-align-right"><?php echo $MC->msg(
"ACH Template Name", HCU_DISPLAY_AS_HTML); ?></label>
3078 <div
class=
"col-sm-8 col-xs-12"><span data-bind=
"text: achTemplateName"></span></div>
3081 <div
class=
"hidden-xs col-sm-10 small hcu-sub-text"><?php echo $MC->msg(
"ACH Template change note", HCU_DISPLAY_AS_HTML); ?></div>
3082 <div
class=
"hidden-xs col-sm-2 csv-uploader-style local-link-style"><a
id=
"csvUploaderLink" class=
""><?php echo $MC->msg(
"CSV File", HCU_DISPLAY_AS_HTML); ?></a></div>
3084 <div
class=
"form-group">
3085 <div
class=
"col-xs-12"><div
id=
"partnerGrid"></div></div>
3094 <div
class=
"tabPayment tabHide" id=
"achBatchRemote">
3095 <div
class=
"tabContents form-horizontal">
3096 <div
class=
"form-group">
3097 <div
class=
"hidden-xs col-sm-6 local-link-style"><a
id=
"csvNotSelected" style=
"display:none;"><?php echo $MC->msg(
"ACH Not Selected", HCU_DISPLAY_AS_HTML); ?> <span
class=
'fa fa-exclamation-triangle k-error-colored'></span></a></div>
3098 <div
class=
"hidden-xs col-sm-6 csv-not-matched-style local-link-style"><a
id=
"csvNotMatched" style=
"display:none;"><?php echo $MC->msg(
"ACH Not Matched", HCU_DISPLAY_AS_HTML); ?> <span
class=
'fa fa-exclamation-triangle k-error-colored'></a></div>
3100 <div
class=
"well well-sm">
3101 <div
class=
"form-group">
3102 <div
class=
"col-xs-12 h4"><?php echo $MC->msg(
'ACH Batch Amounts', HCU_DISPLAY_AS_HTML) ?></div>
3104 <div
class=
"form-group hidden-xs">
3105 <label
class=
"col-sm-3"><?php echo $MC->msg(
'Name', HCU_DISPLAY_AS_HTML) ?></label>
3106 <label
class=
"col-sm-3"><?php echo $MC->msg(
'Amount', HCU_DISPLAY_AS_HTML) ?></label>
3107 <label
class=
"col-sm-4"><?php echo $MC->msg(
'ACH Addenda', HCU_DISPLAY_AS_HTML) ?></label>
3108 <label
class=
"col-sm-2"><?php echo $MC->msg(
'Notify', HCU_DISPLAY_AS_HTML) ?> <span
class=
"fa fa-question-circle-o" id=
"achAmountNotifyTip"></span></label>
3110 <div
class=
"form-group">
3111 <div
class=
"col-xs-12"><div
id=
"batchGrid"></div></div>
3113 <div
class=
"form-group">
3114 <label
class=
"col-sm-3 col-xs-3"><?php echo $MC->msg(
'ACH Batch Total', HCU_DISPLAY_AS_HTML) ?></label>
3115 <div
class=
"col-sm-9 col-xs-9"><span data-format=
"c2" data-bind=
"text: achBatchTotal"></span></div>
3117 <div
class=
"form-group">
3118 <div
class=
"col-sm-3 col-xs-3"><label
for=
"updateTemplateFlag" class=
""><?php echo $MC->msg(
'ACH Update Template', HCU_DISPLAY_AS_HTML) ?></label> <span
id=
'updateTemplateTip'><span
class=
'fa fa-question-circle-o'></span></span></div>
3119 <div
class=
"col-sm-9 col-xs-9"><input type=
"checkbox" id=
"updateTemplateFlag" name=
"updateTemplateFlag" data-bind=
"checked: achUpdateTemplate"></span></div>
3126 <div
class=
"tabPayment tabHide" id=
"achLocal">
3127 <div
class=
"tabContents">
3128 <div
class=
"form-horizontal">
3129 <div
class=
"well well-sm">
3130 <div
class=
"form-group">
3131 <div
class=
"col-xs-12 h4"><?php echo $MC->msg(
'ACH Account Info', HCU_DISPLAY_AS_HTML) ?></div>
3133 <div
class=
"form-group">
3134 <label
class=
"col-xs-12 col-sm-3 control-label"><?php echo $accountTypeWords ?><span
class=
"hcu-required-field"><sup>*</sup></span></label>
3135 <div
class=
"col-xs-12 col-sm-9 col-md-6"><input
id=
"achSubAcctList" 3136 name=
"achSubAcctList" 3138 data-bind=
"value: achSubAcctSelected" 3139 validationMessage=
"<?php echo $MC->msg("Please select an account
", HCU_DISPLAY_AS_HTML); ?>" 3142 <div
class=
"form-group">
3143 <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>
3144 <div
class=
"col-xs-12 col-sm-4"><input
id=
"achEffDate" 3146 class=
"hcu-xs-100-only" 3147 data-bind=
"value: achEffDate" 3149 homecu-dategtvalue=
"<?php echo $initialEffDate; ?>" 3150 homecu-dategttype=
"string" 3151 validationMessage=
"<?php echo $MC->msg("ACH Date in past
", HCU_DISPLAY_AS_HTML); ?>" 3153 <div
class=
"col-xs-12 col-sm-5 hcu-secondary">
3154 <span
class=
"hcu-secondary-alt-text"><?php echo $achCutoffMessageString; ?></span>
3157 <div
class=
"form-group">
3158 <label
class=
"col-xs-12 col-sm-3 control-label"><?php echo $MC->msg(
"ACH Memo", HCU_DISPLAY_AS_HTML); ?></label>
3159 <div
class=
"col-xs-12 col-sm-9 col-md-6"><input type=
"text" class=
"k-textbox hcu-all-100" placeholder=
"<?php echo $MC->msg('ACH memo reminder', HCU_DISPLAY_AS_HTML) ?>" maxlength=
"100" data-bind=
"value: achMemo" /></div>
3161 <div
class=
"form-group">
3162 <div
class=
"hidden-xs col-sm-3"> </div>
3163 <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>
3171 <div
class=
" tabFooter hcu-template">
3172 <div
class=
"hcu-edit-buttons k-state-default">
3173 <span
class=
"hcu-icon-delete">
3174 <a
id=
"backButton" class=
"k-link" data-bind=
"visible: showBack, events:{ click: backClick }"><?php echo $MC->msg(
'Back', HCU_DISPLAY_AS_HTML) ?></a>
3176 <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>
3181 <script
id=
"confirmationTemplate" type=
"text/x-kendo-tmpl">
3182 <div
id=
"confirmationStatus"></div>
3183 <div
id=
"responseDiv">
3184 <div
class=
"local-transfer-msg">
3185 <?php echo $MC->msg(
'ACH Batch Posted', HCU_DISPLAY_AS_JS); ?>
3189 # for (i=0; i < data.length; i++ ) { # 3191 <div
class=
"col-xs-6 text-right">
3192 <span
class=
"response-label">#= data[i][
'label'] #:</span>
3194 <div
class=
"col-xs-6">
3195 <span
class=
"response-field">#= data[i][
'caption'] #</span>
3207 throw new Exception( HCU_JsonEncode( $MC->msg(
'Feature Unavailable', HCU_DISPLAY_AS_HTML) ), 915 );
3209 }
catch (Exception $ex) {
3212 $serviceErrorMsg = HCU_JsonDecode($ex->getMessage());
3214 $serviceErrorCode = $ex->getCode();
3216 require_once(dirname(__FILE__) .
'/../includes/hcuErrorPage.i');
3224 require_once(dirname(__FILE__) .
'/../includes/hcuPostContent.i');