2 require_once(
"$admLibrary/ck_aticket.i");
4 $localzone=
"US/Mountain";
6 $dms_ok=array(
'action'=>
'string',
'batch'=>
'string',
'count'=>
'string',
7 'tranfmt'=>
'digits',
'looktx'=>
'digits',
'os'=>
'digits',
'manualonly'=>
'digits');
10 $action = (empty($action) ?
"" : $action);
11 $qstring = $_SERVER[
'QUERY_STRING'];
12 $qstring = preg_replace(
"/action=[^&]*\&?/",
"",$qstring);
13 $qstring = preg_replace(
"/batch=[^&]*\&?/",
"",$qstring);
14 $qstring = preg_replace(
"/count=[^&]*\&?/",
"",$qstring);
15 $qstring = preg_replace(
"/tranfmt=[^&]*\&?/",
"",$qstring);
16 $qstring = preg_replace(
"/looktx=[^&]*\&?/",
"",$qstring);
17 $qstring = preg_replace(
"/\&$/",
"",$qstring);
19 $self = $_SERVER[
'PHP_SELF'] .
"?" . $qstring;
21 $main_url =
"https://" . $_SERVER[
'SERVER_NAME'] . $_SERVER[
'SCRIPT_NAME'] .
"?" . $qstring;
24 # Get the list of default descriptions 27 $sql =
"select trim(trancode), trim(trandesc) 29 $sth = db_query($sql,$dbh);
30 for ($row=0; list($tc,$desc) = db_fetch_array($sth,$row); $row++) {
31 $codelist[
"$tc"]=
"$desc";
34 $codelist[
'AT']=
"Transfer";
35 $codelist[
'CW']=
"Check Withdrawal";
37 # Override descriptions with any customized descriptions 40 $sql =
"select trim(trancode), trim(cudesc) 41 from cuhavetrans where cu = '$Cu'";
42 $sth = db_query($sql,$dbh);
43 for ($row=0; list($tc,$desc) = db_fetch_array($sth,$row); $row++) {
44 if ($desc >
'') { $codelist[
"$tc"]=
"$desc"; }
46 if (trim($tranfmt) ==
'') {
47 $sql =
"select tranformat from cuadmin where cu='$Cu'";
48 $sth = db_query($sql,$dbh);
49 if($sth) { list($tranfmt) = db_fetch_array($sth,0); }
52 # use default format #6 if nothing set in the monitor 53 $tranfmt = (intval($tranfmt) == 0 ?
'6' : intval($tranfmt));
56 # build array of features for download format 65 $tfmt=array(
'ACH',
'AT',
'LP');
66 $tcwhere=
"('AT','LP') ";
69 $tfmt=array(
'ACH',
'AT',
'LP',
'LA');
70 $tcwhere=
"('AT','LP','LA') ";
73 $tfmt=array(
'AT',
'LP',
'LA',
'CW',
'LC');
74 $tcwhere=
"('AT','LP','LA','CW','LC') ";
79 $tfmt=array_keys($codelist);
80 if (in_array(
'ED',$tfmt)) {
81 $t = array_search(
'ED', $tfmt);
86 foreach (array_keys($codelist) as $t) {
87 if (
"$t" <>
'ED') $tcwhere .=
"$d '$t' ";
93 $tfmt=array(
'ACH',
'AT',
'LP',
'LA');
94 $tcwhere=
"('AT','LP','LA') ";
97 $tfmt=array(
'ACH',
'AT',
'LP',
'LA');
98 $tcwhere=
"('AT','LP','LA') ";
101 $tfmt=array(
'ACH',
'AT',
'LP',
'LA');
102 $tcwhere=
"('AT','LP','LA') ";
105 $tfmt=array(
'AT',
'LP');
106 $noxa=
" and memberto = accountnumber ";
107 $tcwhere=
"('AT','LP') ";
110 $tfmt=array(
'ACH',
'AT',
'LP',
'LA');
111 $tcwhere=
"('AT','LP','LA') ";
114 $tfmt=array(
'ACH',
'AT',
'LP',
'LA');
115 $tcwhere=
"('AT','LP','LA') ";
118 $tfmt=array(
'ACH',
'AT');
120 $achlist = ($Cu ==
'LBCU' ?
"('A','0')" :
"('A','X')");
121 $achwhere =
" and trim(tr.reference1) in $achlist and trim(tr.reference2) in $achlist ";
124 $tfmt=array(
'ACH',
'AT',
'LP');
125 $tcwhere=
"('AT','LP') ";
126 $achlist = ($Cu ==
'LBCU' ?
"A0" :
"AX");
129 $tfmt=array(
'ACH',
'AT',
'LP',
'LA');
130 $tcwhere=
"('AT','LP','LA') ";
133 $tfmt=array(
'ACH',
'AT',
'LP');
134 $tcwhere=
"('AT','LP') ";
137 $tfmt=array(
'ACH',
'AT',
'LP',
'LA');
138 $tcwhere=
"('AT','LP','LA') ";
141 $tfmt=array(
'ACH',
'AT',
'LP');
142 $tcwhere=
"('AT','LP') ";
143 $achlist = ($Cu ==
'LBCU' ?
"A0" :
"AX");
146 $tfmt=array(
'ACH',
'AT',
'LP');
147 $tcwhere=
"('AT','LP') ";
150 $tfmt=array(
'ACH',
'AT');
154 $tfmt=array(
'AT',
'LP',
'LA',
'CW',
'LC');
155 $tcwhere=
"('AT','LP','LA','CW','LC') ";
156 $cwshareonly =
" and not (transactioncode = 'CW' and substring(reference1,1,1) <> 'S') ";
160 # tranfmt not found -- refuse to play 166 $tabfile=
"$home_path/sslforms/FEDSTA.tab";
167 $zipfile=
"$home_path/sslforms/FEDSTAtr.zip";
169 $zfile=
"FEDSTAtr.zip";
172 $tabfile=
"$home_path/sslforms/FRANKL.tab";
173 $zipfile=
"$home_path/sslforms/FRANKLtr.zip";
175 $zfile=
"FRANKLtr.zip";
178 $tabfile=
"$home_path/sslforms/IRBFCU.tab";
179 $zipfile=
"$home_path/sslforms/IRBFCUtr.zip";
181 $zfile=
"IRBFCUtr.zip";
184 $tabfile=
"$home_path/sslforms/${Cu}.tab";
185 $zipfile=
"$home_path/sslforms/${Cu}tr.zip";
187 $zfile=
"${Cu}tr.zip";
189 if ($action ==
"CREATE") {
190 $batch = (empty($batch) ?
"new" : $batch);
192 if ((!preg_match(
"/^new$/i",$batch)) && (!preg_match(
"/^[0-9]*$/",$batch))) {
196 # get batch number and identity column 198 list($batch, $identity) = getbatch($dbh,$Cu,$batch);
200 if (preg_match(
"/^new$/i", $batch)) {
201 $msg =
"An error occurred creating your batch, ".
202 "contact HomeCU support.";
204 $msg =
"Batch number $batch does not exist.";
208 $sql =
"select trim(tz), trim(rt), tranfldsep, traneol 209 from cuadmin where cu='$Cu'";
210 $sth = db_query($sql,$dbh);
211 if($sth) { list($tz, $rt, $t_fls, $t_eol) = db_fetch_array($sth,0); }
212 $tz = (
"$tz" ==
"" ?
"Mountain" : $tz);
213 if (strpos(
"$tz",
"/") ===
false) $tz =
"US/$tz";
214 $rt = (substr(
'000000000' . $rt,-9));
221 default: # standard tab
230 case 2: # carriage
return, linefeed
231 $TEOL = chr(13).chr(10);
235 default: # standard newline
241 if (in_array(
"ACH",$tfmt)) {
243 $sql2 =
"select to_char(date,'YYMMDD') from ${Cu}transaction 244 where id = $identity";
245 $sth = db_query($sql2,$dbh);
246 if($sth) { list($tdate) = db_fetch_array($sth,0); }
247 $tdate = (
"$tdate" ==
"" ? strftime(
'%y%m%d') : $tdate);
248 $sql =
"set time zone '$tz'; ";
249 if (in_array(
"AT",$tfmt) ){
250 $sql.=
"select tr.id, trim(tr.accountnumber) as fmember, 251 trim(tr.reference1) as facct, 252 upper(f.deposittype) as ftype, 253 trim(coalesce(tr.memberto, tr.accountnumber)) as tmember, 254 trim(tr.reference2) as tacct, 255 upper(t.deposittype) as ttype, 256 tr.transactioncode as tcode, 257 tr.amount as xamount, 260 tr.reference5 as rptid 261 from ${Cu}transaction tr, 262 ${Cu}accountbalance f, 263 ${Cu}accountbalance t 264 where id <$identity and id > ALL (select MAX(id) 265 from ${Cu}transaction where id <$identity and 266 accountnumber='CHECKPOINT') 267 and tr.accountnumber <> 'demo' 268 and tr.accountnumber = f.accountnumber 269 and tr.reference1=f.accounttype 270 and (tr.memberto = t.accountnumber or 271 (tr.memberto is null and tr.accountnumber = t.accountnumber)) 272 and tr.reference2=t.accounttype 273 and upper(f.deposittype) in ('Y','N','S') 274 and upper(t.deposittype) in ('Y','N','S') 276 and tr.transactioncode in ('AT') ";
279 if (in_array(
"LP",$tfmt) ){
280 $sql .=
"$u select tr.id, trim(tr.accountnumber) as fmember, 281 trim(tr.reference1) as facct, 282 upper(f.deposittype) as ftype, 283 trim(coalesce(tr.memberto, tr.accountnumber)) as tmember, 284 trim(tr.reference2) as tacct, 286 tr.transactioncode as tcode, 287 tr.amount as xamount, 290 tr.reference5 as rptid 291 from ${Cu}transaction tr, 292 ${Cu}accountbalance f, 294 where id <$identity and id > ALL (select MAX(id) 295 from ${Cu}transaction where id <$identity and 296 accountnumber='CHECKPOINT') 297 and tr.accountnumber <> 'demo' 298 and tr.accountnumber = f.accountnumber 299 and tr.reference1=f.accounttype 300 and (tr.memberto = t.accountnumber or 301 (tr.memberto is null and tr.accountnumber = t.accountnumber)) 302 and tr.reference2=t.loannumber 303 and upper(f.deposittype) in ('Y','N','S') 304 and tr.transactioncode in ('LP') ";
307 if (in_array(
"LA",$tfmt) ){
308 $sql .=
"$u select tr.id, trim(tr.accountnumber) as fmember, 309 trim(tr.reference1) as facct, 311 trim(coalesce(tr.memberto, tr.accountnumber)) as tmember, 312 trim(tr.reference2) as tacct, 313 upper(t.deposittype) as ttype, 314 tr.transactioncode as tcode, 315 tr.amount as xamount, 318 tr.reference5 as rptid 319 from ${Cu}transaction tr, 321 ${Cu}accountbalance t 322 where id <$identity and id > ALL (select MAX(id) 323 from ${Cu}transaction where id <$identity and 324 accountnumber='CHECKPOINT') 325 and tr.accountnumber <> 'demo' 326 and tr.accountnumber=f.accountnumber 327 and tr.reference1=f.loannumber 328 and (tr.memberto = t.accountnumber or 329 (tr.memberto is null and tr.accountnumber = t.accountnumber)) 330 and tr.reference2=t.accounttype 331 and upper(t.deposittype) in ('Y','N','S') 332 and tr.transactioncode in ('LA')";
335 $sql =
"set time zone '$tz'; ";
347 from ${Cu}transaction 348 where id <$identity and id > ALL (select MAX(id) 349 from ${Cu}transaction where id < $identity and 350 accountnumber='CHECKPOINT') and accountnumber <> 'demo' 351 and transactioncode in $tcwhere 356 $sql .=
" order by 1 ";
357 $sth = db_query($sql,$dbh);
358 $sth1 = db_query(
"set time zone '$localzone'",$dbh);
359 db_free_result($sth1);
361 mailerror($sql, pg_last_error(), __LINE__, __FILE__);
365 <div align=center><br><form action=
"main.prg?ft=21">
366 <table width=80% cellspacing=0 cellpadding=4 border=0>
367 <tr><td
class=
"bar" align=center>Download $Cu Transactions</td></tr>
368 <tr><td
class=
"dtl" align=center>$msg</td></tr>
369 <tr><td
class=
"hdr" align=center><hr>
370 <input type=submit name=
"action" value=
"OK">
371 </td></tr></table></form></div>
374 # DOCUMENT ROOT is not right on Falcon......but it is on Leopard 375 # also, had to chmod 777 the directory to get write permission. Waaaay uncool. 377 $TRANS=fopen(
"$tabfile",
"w");
380 case 7: # CUC ACH format (no newlines anywhere)
382 # revised 11/2002 to use traneol defined in cuadmin, 383 # which makes the header same as format 8. 385 case 2: # CUSA ACH format (10-digit member + 2 digit trailer)
386 case 3: # Reliance ACH format (3-digit loan squished into 2
char)
387 case 8: # Sharetec ACH format
388 case 9: # Data Systems of Texas ACH format
389 case 11: # Sharetec 4/10 format (4
char acct/loan + 10
char member)
390 case 12: # BSDC Sharetec 4/10 format w/ modified field 8
391 case 15: # DSOT 4/10 format (4 chr acct/4 digit loan + 10 digit member)
392 case 16: # Data Systems of Texas ACH format , no LA
393 case 17: # FedComp 4/10 format (4 chr acct/loan + 10 digit member)
394 case 19: # Cruise ACH format , no LA
395 case 20: # GBS Sharetec 4/10 format w/ modified field 8 AT only
396 $batch = sprintf(
"%05d",$batch);
397 $tstub =
"${batch}${tdate}";
398 $DFI = substr($rt,0,8);
399 # ACH File Header Record 401 "101 ${rt} ${rt}" . strftime(
"%y%m%d%H%M") .
"0094101" .
402 str_pad(
"${Cu}",23) . str_pad(
"DMS HomeCU",31) .
"${TEOL}");
403 # ACH Batch Header Record 405 "5200" . str_pad(
"Website Transfer",36) .
407 strftime(
"%y%m%d") . strftime(
"%y%m%d") .
408 strftime(
"%j") .
"1${DFI}0000001${TEOL}");
413 case 13: # CUSA ACH DFI member only; w/ modified field 8
414 case 14: # CUSA ACH DFI member only; w/ modified field 8
415 case 18: # CUSA ACH w/TXT transactions identified
416 # Batch header (5) record has product name 417 $batch = sprintf(
"%05d",$batch);
418 $tstub =
"${batch}${tdate}";
419 $DFI = substr($rt,0,8);
420 # ACH File Header Record 422 "101 ${rt} ${rt}" . strftime(
"%y%m%d%H%M") .
"0094101" .
423 str_pad(
"${Cu}",23) . str_pad(
"DMS HomeCU",31) .
"${TEOL}");
424 # ACH Batch Header Record 426 "5200" . str_pad(
"Website Transfer",36) .
428 strftime(
"%y%m%d") . strftime(
"%y%m%d") .
429 strftime(
"%j") .
"1${DFI}0000001${TEOL}");
434 case 6: #
default format with destination member
435 $line =
"AADMS HomeCU";
436 $batch = sprintf(
"%05d",$batch);
437 $line .= $batch . strftime(
"%a %b %d %T %Y") . $Cu;
438 $line = str_pad($line,158);
439 fwrite($TRANS,
"$line${TEOL}");
441 case 10: # CUSA format 2 with 25-
char email
443 $line =
"AADMS HomeCU";
444 $batch = sprintf(
"%05d",$batch);
445 $line .= $batch . strftime(
"%a %b %d %T %Y") . $Cu;
446 $line = str_pad($line,80);
447 if ($tranfmt == 4 || $tranfmt == 21) {
448 $line = str_pad($line,170);
450 fwrite($TRANS,
"$line${TEOL}");
453 for ($row=0; $data = db_fetch_array($sth,$row); $row++) {
455 if (in_array(
"ACH",$tfmt)) {
456 if (strpos($data[
'facct'],
"@")) {
457 list($jfacct,$jfmem) = explode(
"@",$data[
'facct']);
458 $data[
'facct'] = $jfacct;
459 $data[
'fmember'] = trim($jfmem);
461 if (strpos($data[
'tacct'],
"@")) {
462 list($jtacct,$jtmem) = explode(
"@",$data[
'tacct']);
463 $data[
'tacct'] = $jtacct;
464 $data[
'tmember'] = trim($jtmem);
467 if (strpos($data[
'reference1'],
"@")) {
468 list($jfacct,$jfmem) = explode(
"@",$data[
'reference1']);
469 $data[
'reference1'] = $jfacct;
470 $data[
'accountnumber'] = trim($jfmem);
472 if (strpos($data[
'reference2'],
"@")) {
473 list($jtacct,$jtmem) = explode(
"@",$data[
'reference2']);
474 $data[
'reference2'] = $jtacct;
475 $data[
'memberto'] = trim($jtmem);
479 case 7: # CUC ACH format
480 switch ($data[
'tcode']) {
482 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
483 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
486 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
491 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
494 switch (
"$ftran$ttran") {
528 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
529 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
530 substr($data[
'xamount'],9,2));
531 $btotal += $data[
'xamount'];
534 $addxdate = date(
"mdHis",strtotime(substr($data[
'xdate'],0,19)));
535 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
538 $fDFI = substr(sprintf(
"%06d",$data[
'fmember']) . sprintf(
"%02d",$data[
'facct']), 0, 8);
539 $fmem = substr(str_pad(
"FROM $fDFI",22), 0, 22);
540 $tDFI = substr(sprintf(
"%06d",$data[
'tmember']) . sprintf(
"%02d",$data[
'tacct']), 0, 8);
541 $tmem = substr(str_pad(
"TO $tDFI",22), 0, 22);
542 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
543 fwrite($TRANS,
"6${ftran}${rt}${fDFI} ${tDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
545 fwrite($TRANS,
"702${stf}1" . str_pad(
"",19) .
546 "${addxdate}" . str_pad(
"",44) .
"${trace}0${TEOL}");
548 fwrite($TRANS,
"6${ttran}${rt}${tDFI} ${fDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
550 fwrite($TRANS,
"702${stt}2" . str_pad(
"",19) .
551 "${addxdate}" . str_pad(
"",44) .
"${trace}1${TEOL}");
555 case 2: # CUSA ACH format
556 switch ($data[
'tcode']) {
558 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
559 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
562 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
566 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
567 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
568 substr($data[
'xamount'],9,2));
569 $btotal += $data[
'xamount'];
572 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
574 $tacct = sprintf(
"%02d",$data[
'tacct']);
575 $facct = sprintf(
"%02d",$data[
'facct']);
577 $fDFI = substr(str_pad(trim(sprintf(
"%10s",$data[
'fmember'])) .
'-' . $facct, 17), 0, 17);
578 $fmem = substr(str_pad(
"FROM $fDFI",22), 0, 22);
579 $tDFI = substr(str_pad(trim(sprintf(
"%10s",$data[
'tmember'])) .
'-' . $tacct, 17), 0, 17);
580 $tmem = substr(str_pad(
"TO $tDFI",22), 0, 22);
581 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
582 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
584 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
588 case 3: # Reliance ACH format
589 switch ($data[
'tcode']) {
591 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
592 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
595 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
600 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
603 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
604 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
605 substr($data[
'xamount'],9,2));
606 $btotal += $data[
'xamount'];
609 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
611 $tacct = sprintf(
"%02d",$data[
'tacct']);
612 $tacct = (intval($tacct) > 99 ?
'X' . substr($tacct,-1,1) : $tacct);
613 $facct = sprintf(
"%02d",$data[
'facct']);
614 $facct = (intval($facct) > 99 ?
'X' . substr($facct,-1,1) : $facct);
617 $fDFI = substr(str_pad($facct . sprintf(
"%09d",$data[
'fmember']), 17), 0, 17);
618 $fmem = substr(str_pad(
"FROM $fDFI",22), 0, 22);
619 $tDFI = substr(str_pad($tacct . sprintf(
"%09d",$data[
'tmember']), 17), 0, 17);
620 $tmem = substr(str_pad(
"TO $tDFI",22), 0, 22);
621 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
622 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
624 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
628 case 8: # Sharetec ACH format
629 switch ($data[
'tcode']) {
631 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
632 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
635 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
640 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
643 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
644 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
645 substr($data[
'xamount'],9,2));
646 $btotal += $data[
'xamount'];
649 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
652 $fDFI = substr(str_pad((sprintf(
"%02d",$data[
'facct']) . sprintf(
"%09d",$data[
'fmember'])), 17), 0, 17);
653 $fmem = substr(str_pad(
"FROM $fDFI",22), 0, 22);
654 $tDFI = substr(str_pad((sprintf(
"%02d",$data[
'tacct']) . sprintf(
"%09d",$data[
'tmember'])), 17), 0, 17);
655 $tmem = substr(str_pad(
"TO $tDFI",22), 0, 22);
656 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
657 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
659 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
663 case 9: # CUSolutions
664 case 16: # Data Systems of Texas ACH format w/o LA
665 switch ($data[
'tcode']) {
667 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
668 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
671 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
676 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
679 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
680 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
681 substr($data[
'xamount'],9,2));
682 $btotal += $data[
'xamount'];
685 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
687 $fDFI = substr(str_pad((sprintf(
"%02d",$data[
'facct']) . sprintf(
"%010d",$data[
'fmember'])),17), 0, 17);
688 $fmem = substr(str_pad(
"FROM $fDFI",22), 0, 22);
689 $tDFI = substr(str_pad((sprintf(
"%02d",$data[
'tacct']) . sprintf(
"%010d",$data[
'tmember'])),17), 0, 17);
690 $tmem = substr(str_pad(
"TO $tDFI",22), 0, 22);
691 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
692 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
694 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
698 case 19: # Cruise ACH format w/o LA
699 switch ($data[
'tcode']) {
701 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
702 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
705 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
710 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
713 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
714 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
715 substr($data[
'xamount'],9,2));
716 $btotal += $data[
'xamount'];
719 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
720 $fDFI = substr(str_pad((str_pad($data[
'facct'],4,0) . sprintf(
"%08d",$data[
'fmember'])),17), 0, 17);
721 $fmem = substr(str_pad(
"$fDFI",22), 0, 22);
722 $tDFI = substr(str_pad((str_pad($data[
'tacct'],4,0) . sprintf(
"%08d",$data[
'tmember'])),17), 0, 17);
723 $tmem = substr(str_pad(
"$tDFI",22), 0, 22);
724 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
725 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
727 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
731 case 11: # Sharetec 4/10 format (4
char acct/loan + 10
char member)
732 switch ($data[
'tcode']) {
734 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
735 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
738 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
743 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
746 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
747 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
748 substr($data[
'xamount'],9,2));
749 $btotal += $data[
'xamount'];
752 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
755 $fDFI = substr(str_pad((sprintf(
"%04d",$data[
'facct']) . sprintf(
"%010d",$data[
'fmember'])), 17), 0, 17);
756 $fmem = substr(str_pad(
"FROM $fDFI",22), 0, 22);
757 $tDFI = substr(str_pad((sprintf(
"%04d",$data[
'tacct']) . sprintf(
"%010d",$data[
'tmember'])), 17), 0, 17);
758 $tmem = substr(str_pad(
"TO $tDFI",22), 0, 22);
759 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
760 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
762 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
766 case 15: # DSOT 4/10 format (4 chr acct/4 digit loan + 10 digit member)
767 switch ($data[
'tcode']) {
769 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
770 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
771 $fDFI = substr(str_pad((str_pad($data[
'facct'],4) . sprintf(
"%010d",$data[
'fmember'])), 17), 0, 17);
772 $tDFI = substr(str_pad((str_pad($data[
'tacct'],4) . sprintf(
"%010d",$data[
'tmember'])), 17), 0, 17);
775 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
777 $fDFI = substr(str_pad((str_pad($data[
'facct'],4) . sprintf(
"%010d",$data[
'fmember'])), 17), 0, 17);
778 $tDFI = substr(str_pad((sprintf(
"%04d",$data[
'tacct']) . sprintf(
"%010d",$data[
'tmember'])), 17), 0, 17);
782 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
783 $fDFI = substr(str_pad((sprintf(
"%04d",$data[
'facct']) . sprintf(
"%010d",$data[
'fmember'])), 17), 0, 17);
784 $tDFI = substr(str_pad((str_pad($data[
'tacct'],4) . sprintf(
"%010d",$data[
'tmember'])), 17), 0, 17);
787 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
788 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
789 substr($data[
'xamount'],9,2));
790 $btotal += $data[
'xamount'];
793 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
796 $fmem = substr(str_pad(
"FROM $fDFI",22), 0, 22);
797 $tmem = substr(str_pad(
"TO $tDFI",22), 0, 22);
798 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
799 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
801 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
805 case 17: # FedComp 4/10 format (4 chr acct/loan + 10 digit member)
806 switch ($data[
'tcode']) {
808 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
809 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
810 $fDFI = substr(str_pad((str_pad($data[
'facct'],4) . sprintf(
"%010d",$data[
'fmember'])), 17), 0, 17);
811 $tDFI = substr(str_pad((str_pad($data[
'tacct'],4) . sprintf(
"%010d",$data[
'tmember'])), 17), 0, 17);
814 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
816 $fDFI = substr(str_pad((str_pad($data[
'facct'],4) . sprintf(
"%010d",$data[
'fmember'])), 17), 0, 17);
817 $tDFI = substr(str_pad((str_pad($data[
'tacct'],4) . sprintf(
"%010d",$data[
'tmember'])), 17), 0, 17);
821 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
822 $fDFI = substr(str_pad((str_pad($data[
'facct'],4) . sprintf(
"%010d",$data[
'fmember'])), 17), 0, 17);
823 $tDFI = substr(str_pad((str_pad($data[
'tacct'],4) . sprintf(
"%010d",$data[
'tmember'])), 17), 0, 17);
826 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
827 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
828 substr($data[
'xamount'],9,2));
829 $btotal += $data[
'xamount'];
832 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
835 $fmem = substr(str_pad(
"FROM $fDFI",22), 0, 22);
836 $tmem = substr(str_pad(
"TO $tDFI",22), 0, 22);
837 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
838 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
840 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
844 case 12: # BSDC Sharetec 4/10 format (4
char acct/loan + 10
char member)
845 case 20: # GBS Sharetec 4/10 format w/ modified field 8 AT only
846 # Individual ID = 4 char DP acct . 4 digit Loan . 10 char member . FROM | TO 847 switch ($data[
'tcode']) {
849 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
850 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
851 $fmem = str_pad($data[
'facct'],4) .
'0000' .
852 sprintf(
"%010d",$data[
'fmember']) .
"FROM";
853 $tmem = str_pad($data[
'tacct'],4) .
'0000' .
854 sprintf(
"%010d",$data[
'tmember']) .
"TO ";
855 $fDFI = str_pad($data[
'facct'],4) .
856 sprintf(
"%010d",$data[
'fmember']);
857 $tDFI = str_pad($data[
'tacct'],4) .
858 sprintf(
"%010d",$data[
'tmember']);
861 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
863 $fmem = str_pad($data[
'facct'],4) .
'0000' .
864 sprintf(
"%010d",$data[
'fmember']) .
"FROM";
865 $tmem =
" " . sprintf(
"%04d",$data[
'tacct']) .
866 sprintf(
"%010d",$data[
'tmember']) .
"TO ";
867 $fDFI = str_pad($data[
'facct'],4) .
868 sprintf(
"%010d",$data[
'fmember']);
869 $tDFI = sprintf(
"%04d",$data[
'tacct']) .
870 sprintf(
"%010d",$data[
'tmember']);
874 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
875 $fmem =
" " . sprintf(
"%04d",$data[
'facct']) .
876 sprintf(
"%010d",$data[
'fmember']) .
"FROM";
877 $tmem = str_pad($data[
'tacct'],4) .
'0000' .
878 sprintf(
"%010d",$data[
'tmember']) .
"TO ";
879 $fDFI = sprintf(
"%04d",$data[
'facct']) .
880 sprintf(
"%010d",$data[
'fmember']);
881 $tDFI = str_pad($data[
'tacct'],4) .
882 sprintf(
"%010d",$data[
'tmember']);
885 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
886 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
887 substr($data[
'xamount'],9,2));
888 $btotal += $data[
'xamount'];
891 $data[
'xdate'] = date(
"Ymd His",strtotime(substr($data[
'xdate'],0,19)));
892 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
896 $fDFI = substr(str_pad($fDFI, 17), 0, 17);
897 $tDFI = substr(str_pad($tDFI, 17), 0, 17);
898 $fmem = substr(str_pad($fmem, 22), 0, 22);
899 $tmem = substr(str_pad($tmem, 22), 0, 22);
902 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${data['xdate']}${tmem} 0${trace}0${TEOL}");
904 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${data['xdate']}${fmem} 0${trace}1${TEOL}");
908 case 13: # CUSA ACH DFI member only; w/ modified field 8
909 case 14: # CUSA ACH DFI member only; w/ modified field 8
910 # Individual ID = 4 char acct#/Loan# . 10 char member . FROM | TO 911 case 18: # CUSA ACH DFI member only; w/ modified field 8
912 # Individual ID = 4 char acct#/Loan# . 10 char member . FROM | TO 913 switch ($data[
'tcode']) {
915 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
916 $ttran = ($data[
'ttype'] ==
'Y' ?
'22' :
'32');
917 $tDFI = (strpos($achlist,$data[
'tacct']) ===
false ?
918 str_pad(($data[
'tmember'] .
"-" . $data[
'tacct']),17)
919 : str_pad($data[
'tmember'],17));
922 $ftran = ($data[
'ftype'] ==
'Y' ?
'27' :
'37');
925 # 52 record tDFI always includes suffix 926 $tDFI = str_pad(($data[
'tmember'] .
"-" . $data[
'tacct']),17);
928 # 52 record tDFI does not include suffix if it's 'A' 929 $tDFI = ($data[
'tacct'] ==
'A' ?
930 str_pad($data[
'tmember'],17) :
931 str_pad(($data[
'tmember'] .
"-" . $data[
'tacct']),17));
935 $fDFI = (strpos($achlist,$data[
'facct']) ===
false ?
936 str_pad(($data[
'fmember'] .
"-" . $data[
'facct']),17)
937 : str_pad($data[
'fmember'],17));
938 if ($tranfmt ==
'18') {
939 $txt = (trim($data[
'rptid']) ==
'TXT' ?
'TXT ' :
'');
940 $fmem = str_pad(
"${txt}FR " . $data[
'fmember']
941 .
"-". $data[
'facct'],15);
942 $tmem = str_pad(
"${txt}TO " . $data[
'tmember']
943 .
"-". $data[
'tacct'],15);
945 $fmem = str_pad(
"FROM " . $data[
'fmember']
946 .
"-". $data[
'facct'],15);
947 $tmem = str_pad(
"TO " . $data[
'tmember']
948 .
"-". $data[
'tacct'],15);
950 $data[
'xamount'] = sprintf(
"%011.2f",$data[
'xamount']);
951 $data[
'xamount'] = (substr($data[
'xamount'],0,8) .
952 substr($data[
'xamount'],9,2));
953 $btotal += $data[
'xamount'];
956 $data[
'xdate'] = date(
"Ymd His ",strtotime(substr($data[
'xdate'],0,19)));
957 $trace=(
"${tstub}" . sprintf(
"%03d",$count));
962 $fDFI = substr(str_pad($fDFI, 17), 0, 17);
963 $tDFI = substr(str_pad($tDFI, 17), 0, 17);
964 $fmem = substr(str_pad($fmem, 15), 0, 15);
965 $tmem = substr(str_pad($tmem, 15), 0, 15);
968 fwrite($TRANS,
"6${ftran}${rt}${fDFI}${data['xamount']}${tmem}${data['xdate']} 0${trace}0${TEOL}");
970 fwrite($TRANS,
"6${ttran}${rt}${tDFI}${data['xamount']}${fmem}${data['xdate']} 0${trace}1${TEOL}");
977 switch ($data[
'transactioncode']) {
989 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" || trim($data[
'reference2']) ==
"-" ?
"Chk Withdraw" :
"{$data['reference2']}");
998 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" || trim($data[
'reference2']) ==
"-" ?
"Chk Withdraw" :
"{$data['reference2']}");
1003 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" ?
"Gen Merc" :
"{$data['reference2']}");
1008 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" ?
"Credit Card" :
"{$data['reference2']}");
1013 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" ?
"Visa Card" :
"{$data['reference2']}");
1018 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" ?
"Visa Home Eq" :
"{$data['reference2']}");
1023 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" ?
"Visa Gold" :
"{$data['reference2']}");
1028 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" ?
"Visa Classic" :
"{$data['reference2']}");
1033 $data[
'reference2'] = (trim($data[
'reference2']) ==
"" ?
"Mastercard" :
"{$data['reference2']}");
1036 if ($tranfmt == 1) {
1037 # Sharetec format with source member; destination member implied as same 1038 $data[
'date'] = date(
"M d Y h:i:sA",strtotime(substr($data[
'date'],0,19)));
1039 $data[
'amount'] = sprintf(
"%12.2f", $data[
'amount'] * -1);
1040 $data[
'txid'] = sprintf(
"%08d",$data[
'txid']);
1042 fwrite($TRANS,
"$FromCode${TFLS}${data['accountnumber']}${TFLS}${data['reference1']}${TFLS}${data['reference2']}${TFLS}$ToCode${TFLS}${data['amount']}${TFLS}${data['date']}${TFLS}${data['txid']}${TFLS}${data['reference3']}${TEOL}");
1045 if ($tranfmt == 4 || $tranfmt == 21) {
1047 $data[
'date'] = date(
"mdy h:i:sA",strtotime(substr($data[
'date'],0,19)));
1048 $data[
'date'] = str_pad( $data[
'date'],25);
1049 $data[
'amount'] = sprintf(
"%12.2f", $data[
'amount']);
1050 $data[
'memberto'] = ($data[
'memberto'] ==
"" ? $data[
'accountnumber'] : $data[
'memberto']);
1051 $data[
'txid'] = sprintf(
"%08d",$data[
'txid']);
1052 if (strlen($data[
'accountnumber']) > 12) {
1053 $data[
'accountnumber'] = substr( $data[
'accountnumber'],0,12);
1055 $data[
'accountnumber'] = str_pad( $data[
'accountnumber'],12);
1057 if (strlen($data[
'memberto']) > 12) {
1058 $data[
'memberto'] = substr( $data[
'memberto'],0,12);
1060 $data[
'memberto'] = str_pad( $data[
'memberto'],12);
1062 if (strlen($data[
'reference1']) > 12) {
1063 $data[
'reference1'] = substr( $data[
'reference1'],0,12);
1065 $data[
'reference1'] = str_pad( $data[
'reference1'],12);
1067 if (strlen($data[
'reference2']) > 12) {
1068 $data[
'reference2'] = substr( $data[
'reference2'],0,12);
1070 $data[
'reference2'] = str_pad( $data[
'reference2'],12);
1072 if (strlen($data[
'reference3']) > 64) {
1073 $data[
'reference3'] = substr( $data[
'reference3'],0,64);
1075 $data[
'reference3'] = str_pad( $data[
'reference3'],64);
1078 fwrite($TRANS,
"$FromCode${TFLS}${data['accountnumber']}${TFLS}${data['reference1']}${TFLS}${data['reference2']}${TFLS}$ToCode${TFLS}${data['memberto']}${TFLS}${data['amount']}${TFLS}${data['date']}${TFLS}${data['txid']}${TFLS}${data['reference3']}${TEOL}");
1081 if ($tranfmt == 3) {
1082 # Compusource format with forced same source and destination member 1083 $data[
'date'] = date(
"M d Y h:i:sA",strtotime(substr($data[
'date'],0,19)));
1084 $amountF = sprintf(
"%12.2f", $data[
'amount'] * -1);
1085 $amountT = sprintf(
"%12.2f", $data[
'amount']);
1087 if ($data[
'transactioncode'] ==
"MA") {
1088 fwrite($TRANS,
"${data['accountnumber']}${TFLS}NA${TFLS}${data['transactioncode']}${TFLS}${data['reference1']}${TFLS}${data['reference2']}${TEOL}");
1090 fwrite($TRANS,
"${data['accountnumber']}${TFLS}${data['reference1']}${TFLS}$FromCode${TFLS}${amountF}${TFLS}${data['date']}${TEOL}");
1091 fwrite($TRANS,
"${data['accountnumber']}${TFLS}${data['reference2']}${TFLS}$ToCode${TFLS}${amountT}${TFLS}${data['date']}${TEOL}");
1095 if ($tranfmt == 5) {
1096 # Compusource format allowing for cross-account transfers 1097 # (source and destination member numbers may or may not be the same) 1098 $data[
'date'] = date(
"M d Y h:i:sA",strtotime(substr($data[
'date'],0,19)));
1099 $amountF = sprintf(
"%12.2f", $data[
'amount'] * -1);
1100 $amountT = sprintf(
"%12.2f", $data[
'amount']);
1101 $data[
'memberto'] = ($data[
'memberto'] ==
"" ? $data[
'accountnumber'] : $data[
'memberto']);
1103 if ($data[
'transactioncode'] ==
"MA") {
1104 fwrite($TRANS,
"${data['accountnumber']}${TFLS}NA${TFLS}${data['transactioncode']}${TFLS}${data['reference1']}${TFLS}${data['reference2']}${TEOL}");
1106 fwrite($TRANS,
"${data['accountnumber']}${TFLS}${data['reference1']}${TFLS}$FromCode${TFLS}${amountF}${TFLS}${data['date']}${TEOL}");
1107 fwrite($TRANS,
"${data['memberto']}${TFLS}${data['reference2']}${TFLS}$ToCode${TFLS}${amountT}${TFLS}${data['date']}${TEOL}");
1112 case 10: # CUSA format 2 with 25-
char email
1113 # CUSA default download w/ 25 character email address (reference3); 1114 # default download format with source member number; destination implied as same 1115 # pad to desired size 1116 $data[
'accountnumber'] = str_pad( $data[
'accountnumber'],12);
1117 $data[
'date'] = date(
"Y-m-d h:i:s T",strtotime(substr($data[
'date'],0,19)));
1118 $data[
'date'] = str_pad( $data[
'date'],25);
1119 $data[
'transactioncode'] = str_pad( $data[
'transactioncode'],2);
1120 $data[
'reference1'] = str_pad( $data[
'reference1'],12);
1121 $data[
'reference2'] = str_pad( $data[
'reference2'],12);
1122 if (strlen($data[
'reference3']) > 25) {
1123 $data[
'reference3'] = substr( $data[
'reference3'],0,25);
1125 $data[
'reference3'] = str_pad( $data[
'reference3'],25);
1127 $data[
'amount'] = sprintf(
"%12.2f", $data[
'amount']);
1128 fwrite($TRANS,
"${data['accountnumber']}${TFLS}${data['date']}${TFLS}${data['transactioncode']}${TFLS}${data['reference1']}${TFLS}${data['reference2']}${TFLS}${data['reference3']}${TFLS}${data['amount']}${TEOL}");
1134 # same as default download format except add destination member number 1135 # pad to desired size 1136 $data[
'accountnumber'] = str_pad( $data[
'accountnumber'],12);
1137 $data[
'memberto'] = ($data[
'memberto'] ==
"" ? $data[
'accountnumber'] : $data[
'memberto']);
1138 $data[
'memberto'] = str_pad( $data[
'memberto'],12);
1139 $data[
'date'] = date(
"Y-m-d h:i:s T",strtotime(substr($data[
'date'],0,19)));
1140 $data[
'date'] = str_pad( $data[
'date'],25);
1141 $data[
'transactioncode'] = str_pad( $data[
'transactioncode'],2);
1142 $data[
'reference1'] = str_pad( $data[
'reference1'],12);
1143 $data[
'reference2'] = str_pad( $data[
'reference2'],12);
1144 $data[
'reference3'] = str_pad( $data[
'reference3'],64);
1145 $data[
'amount'] = sprintf(
"%12.2f", $data[
'amount']);
1146 fwrite($TRANS,
"${data['accountnumber']}${TFLS}${data['date']}${TFLS}${data['transactioncode']}${TFLS}${data['reference1']}${TFLS}${data['reference2']}${TFLS}${data['reference3']}${TFLS}${data['amount']}${TFLS}${data['memberto']}${TEOL}");
1150 case 7: # CUC ACH format without newlines
1151 # revised 11/2002 to use traneol defined in cuadmin, 1152 # which makes the trailer same as format 8. 1153 case 2: # CUSA ACH format
1154 case 3: # Reliance ACH format
1155 case 8: # Sharetec ACH format
1156 case 9: # Data Systems of Texas ACH format
1157 case 11: # Sharetec 4/10 format (4
char acct/loan + 10
char member)
1158 case 12: # BSDC Sharetec 4/10 format w/ modified field 8
1159 case 13: # CUSA ACH DFI member only; w/ modified field 8
1160 case 14: # CUSA ACH DFI member only; w/ modified field 8
1161 case 15: # DSOT 4/10 format (4 chr acct/4 digit loan + 10 digit member)
1162 case 16: # Data Systems of Texas ACH format w/o LA
1163 case 17: # FedComp 4/10 format (4 chr acct/loan + 10 digit member)
1164 case 18: # CUSA ACH w/TXT transfers identified
1165 case 19: # Cruise ACH format w/o LA
1166 case 20: # GBS Sharetec 4/10 format w/ modified field 8 AT only
1167 # ACH Batch Control Trailer Record 1169 "8200" . sprintf(
"%06d",$bcount) .
1170 sprintf(
"%010d",substr($bhash,-10)) .
1171 sprintf(
"%012d",$btotal) .
1172 sprintf(
"%012d",$btotal) .
1173 str_pad(
"9",35) .
"${DFI}0000001${TEOL}");
1174 # ACH File Control Trailer Record 1177 sprintf(
"%06d",(ceil(($bcount+4)/10))) .
1178 sprintf(
"%08d",$bcount) .
1179 sprintf(
"%010d",substr($bhash,-10)) .
1180 sprintf(
"%012d",$btotal) .
1181 sprintf(
"%012d",$btotal) .
1182 str_pad(
" ",39).
"${TEOL}");
1184 case 10: # CUSA format 2 with 25-
char email
1188 fwrite($TRANS,str_pad(
"ZZ",170) .
"${TEOL}");
1191 fwrite($TRANS,str_pad(
"ZZ",80) .
"${TEOL}");
1195 fwrite($TRANS,str_pad(
"ZZ",158) .
"${TEOL}");
1198 db_free_result($sth);
1200 system(
"$zipcmd $zipfile $tabfile");
1201 header(
"Location: $main_url&action=SHOW&batch=$batch&count=$count");
1206 if ($action ==
"SHOW") {
1208 $bnum = intval($batch);
1209 list($b, $identity) = getbatch($dbh,$Cu,$b);
1211 $msg =
"Batch number $batch does not exist.";
1214 $sql =
"select trim(tz), tranformat from cuadmin where cu='$Cu'";
1215 $sth = db_query($sql,$dbh);
1216 if($sth) { list($tz, $tranfmt) = db_fetch_array($sth,0); }
1217 $tz = (
"$tz" ==
"" ?
"Mountain" : $tz);
1218 if (strpos(
"$tz",
"/") ===
false) $tz =
"US/$tz";
1219 $tranfmt = trim($tranfmt);
1220 $sql =
"set time zone '$tz'; select accountnumber, 1229 reference5 as repeatid 1230 from ${Cu}transaction 1231 where id <$identity and id > ALL (select MAX(id) 1232 from ${Cu}transaction where id < $identity and 1233 accountnumber='CHECKPOINT') and accountnumber <> 'demo' 1235 $sth = db_query($sql,$dbh);
1237 mailerror($sql, pg_last_error(), __LINE__, __FILE__);
1239 $sth1 = db_query(
"set time zone '$localzone'",$dbh);
1240 db_free_result($sth1);
1242 if (in_array(
"ACH",$tfmt)) {
1243 $tabhdr=
"ACH-Formatted file";
1245 $tabhdr=
"TAB-Delimited file";
1249 # Find out if there are any manual transactions in this batch 1251 $sql2=
"select count(*) from ${Cu}transaction 1252 where id <$identity and id > ALL (select MAX(id) 1253 from ${Cu}transaction where id < $identity and 1254 accountnumber='CHECKPOINT') and accountnumber <> 'demo' 1255 and (transactioncode not in $tcwhere ";
1256 if ($noxa >
'') { $sql2 .=
" or memberto <> accountnumber "; }
1257 if ($achwhere >
'') { $sql2 .=
" or trim(reference1) not in $achlist or trim(reference2) not in $achlist "; }
1258 if ($cwshareonly >
'') { $sql2 .=
" or ( transactioncode = 'CW' and substring(reference1,1,1) <> 'S') "; }
1260 $sth2 = db_query($sql2,$dbh);
1261 if($sth2) { list($tskcount) = db_fetch_array($sth2,0); }
1263 $tskcount = (
"$tskcount" ==
"" ? 0 : $tskcount);
1265 # if $tskcount is > 0, show message for manual transactions 1266 # if $count == 0, show message for empty batch and don't link files 1268 if ($tskcount > 0 ) {
1269 if (in_array(
"ACH",$tfmt)) {
1270 $mantxn =
'<td bgcolor="yellow" align="center" colspan="2">Caution! Batch contains non-ACH transactions. Manual entry required.';
1272 $mantxn =
'<td bgcolor="yellow" align="center" colspan="2">Caution! Batch contains transactions which will not post automatically. Manual entry required.';
1275 $mantxn =
'<td colspan="2"> ';
1277 $tottxn = $tskcount + $count;
1279 <div align=center><br>
1280 <table width=90% cellspacing=0 cellpadding=2 border=0>
1281 <tr><td
class=
"bar" align=center colspan=2>Download $Cu Transactions</td></tr>
1282 <tr><td
class=
"dtl"><b>$tottxn Transactions in Batch $batch.</b><br>
1283 <b>$tskcount Manual Transactions</b></td>
1288 <td
class=
"dtl" valign=
"bottom">Download <a href=
"main.prg/sslforms/${zfile}?ft=82" target=
"get_file" class=
"link2"> ZIPPED file</a> ${zfile}</td></tr>
1289 <tr><td
class=
"dtl"> </td><td
class=
"dtl">Download <a href=
"main.prg/sslforms/${tfile}?ft=82" target=
"get_file" class=
"link2"> ${tabhdr}</a> ${tfile}</td></tr>
1295 <td
class=
"dtl" valign=
"bottom">ZIPPED file ${zfile} is empty</td></tr>
1296 <tr><td
class=
"dtl"> </td><td
class=
"dtl">${tabhdr} ${tfile} is empty</td></tr>
1299 print
"<tr><td class='dtl'>";
1300 if ($tskcount > 0 ) {
1302 <a href=
"javascript:print_man()" 1303 class=
"link2">View Manual Transactions Only</a></td>
1304 <script language=
"javascript">
1306 function print_man() {
1308 var win_det =
"toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=yes";
1309 var url =
"main.prg?ft=36&action=CREATE&batch=$bnum&tranfmt=$tranfmt&manualonly=1";
1311 window.open (url,
"print_view", win_det,
false);
1317 print
" </td>";
1320 <td
class=
"dtl" align=
"right"><a href=
"javascript:print_view()" 1321 class=
"link2">View Printable Version</a></td></tr>
1322 <script language=
"javascript">
1324 function print_view() {
1326 var win_det =
"toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=yes";
1327 var url =
"main.prg?ft=36&action=CREATE&batch=$bnum&tranfmt=$tranfmt";
1329 window.open (url,
"print_view", win_det,
false);
1337 <a href=\"javascript:window.print()\" class=\"link2\">Print Page</a> 1338 <a href=\"javascript:window.close()\" class=\"link2\">Close Window</a> 1342 <tr>$mantxn</td></tr></table><br>
1345 <table width=90% cellspacing=0 cellpadding=4 border=0>
1346 <tr><td
class=
"bar" align=center colspan=9>Transaction Requests</td></tr>
1348 <td
class=
"hdr">Confirm</td>
1349 <td
class=
"hdr">Date</td>
1350 <td
class=
"hdr">Type</td>
1351 <td
class=
"hdr" colspan=
"2">From</td>
1352 <td
class=
"hdr" colspan=
"2">To</td>
1353 <td
class=
"hdr">Description</td>
1354 <td
class=
"hdr" align=right>Amount</td>
1361 list($acct,$email,$txn,$amt,$date,$memberto,$from,$to,$txid,$rptid)= db_fetch_array($sth,$row);
1363 $from = trim($from);
1365 $memberto = ($memberto ==
"" ? $acct : $memberto);
1366 $xdesc = ($acct == $memberto ?
"" :
"<font color='red'>CROSS ACCOUNT </font>");
1367 list ($xdesc,$tsk) = showline($txn, $xdesc);
1368 if (trim($email) >
"") { $acct = ($txn ==
'ED' ?
"Dep# $email" :
"<a href=mailto:$email class='link2'>$acct</a>"); }
1370 $ytotal += ($tsk ==
"" ? 0 : $amt);
1371 $amt = sprintf(
"%12.2f",$amt);
1372 $atotal = sprintf(
"%12.2f",$atotal);
1373 $date = date(
"m/d/Y h:i:sA",strtotime(substr($date,0,19)));
1374 $goback = urlencode($_SERVER[
'QUERY_STRING']);
1375 if (trim($rptid) ==
"TXT") {
1378 } elseif (intval($rptid) > 0) {
1379 $type =
"<a href=\"$menu_link?ft=95&mode=VIEW&goback=$goback&rptid=" . intval($rptid) .
"\">Repeat</a>";
1384 if ($txn !=
'MA' && (!$manualonly) || (!$tsk ==
"")) {
1385 print
"<tr CLASS=$rbg> 1386 <td><font size=-1>$txid</font></td> 1387 <td><font size=-1>$date</font></td> 1388 <td><font size=-1>$type</font></td> 1389 <td><font size=-1>$acct</font></td> 1390 <td><font size=-1>$from</font></td> 1391 <td><font size=-1>$memberto</font></td> 1392 <td><font size=-1>$to</font></td> 1393 <td$tsk><font size=-1>$xdesc</font></td> 1394 <td><font size=-1><div align=right>$amt</div></font></td> 1396 $rbg = ($rbg ==
"odd" ?
"even" :
"odd");
1399 print
"<tr CLASS=$rbg><td colspan=7 align=right>Total</td>";
1402 $yp = ($ytotal > 0 ?
"<td bgcolor='yellow' align='right'>" . sprintf(
"%12.2f",$ytotal) .
"</td>" :
"<td> </td>");
1403 print
"$yp<td align=right> <b>$atotal</b>";
1405 $yp =
"<td align='right'>" . sprintf(
"%12.2f",$ytotal) .
"</td>";
1406 print
" <td align=right> <b>$yp</b>";
1408 print
"</td></tr></table> 1410 # Need a query here: see if cu allows MA transactions, get 'em and show 'em 1411 $sql=
"select x.date, 1417 from ${Cu}transaction x, cuhavetrans ht 1418 where x.id <$identity and x.id > ALL (select MAX(id) 1419 from ${Cu}transaction where id < $identity and 1420 accountnumber='CHECKPOINT') and accountnumber <> 'demo' 1421 and ht.cu = '$Cu' and ht.trancode = 'MA' 1422 and ht.trancode = x.transactioncode 1424 $sth = db_query($sql,$dbh);
1426 mailerror($sql, pg_last_error(), __LINE__, __FILE__);
1428 if (db_num_rows($sth) > 0 ) {
1430 <div align=center><br>
1431 <table width=90% cellspacing=0 cellpadding=4 border=0>
1432 <tr><td
class=
"bar" align=center colspan=5>Member Activation Requests</td></tr>
1433 <tr><td
class=
"hdr">Confirm</td>
1434 <td
class=
"hdr">Date</td>
1435 <td
class=
"hdr">Account</td>
1436 <td
class=
"hdr">Reference 1</td>
1437 <td
class=
"hdr">Reference 2</td></tr>
1441 list($date,$acct,$ref1,$ref2,$email,$txid)= db_fetch_array($sth,$row);
1443 if (trim($email) >
"") { $acct = ($txn ==
'ED' ?
"Dep# $email" :
"<a href=mailto:$email class='link2'>$acct</a>"); }
1444 $date = date(
"m/d/Y h:i:sA",strtotime(substr($date,0,19)));
1445 print
"<tr CLASS=$rbg><td><font size=-1>$txid</font></td> 1446 <td><font size=-1>$date</font></td> 1447 <td><font size=-1>$acct</font></td> 1448 <td><font size=-1>$ref1</font></td> 1449 <td><font size=-1>$ref2</font></td></tr>";
1450 $rbg = ($rbg ==
"odd" ?
"even" :
"odd");
1455 if (trim($action) ==
"FIND") {
1456 $looktx = intval($looktx);
1457 $sql =
"select trim(tz), tranformat from cuadmin where cu='$Cu'";
1458 $sth = db_query($sql,$dbh);
1459 if($sth) { list($tz, $tranfmt) = db_fetch_array($sth,0); }
1460 $tz = (
"$tz" ==
"" ?
"Mountain" : $tz);
1461 if (strpos(
"$tz",
"/") ===
false) $tz =
"US/$tz";
1462 $sql =
"set time zone '$tz'; select accountnumber, 1471 from ${Cu}transaction 1473 and accountnumber <> 'CHECKPOINT' 1474 and accountnumber <> 'demo'";
1475 $sth = db_query($sql,$dbh);
1477 mailerror($sql, pg_last_error(), __LINE__, __FILE__);
1479 $sql2 =
"select trim(reference3), 1480 to_char(date,'MM/DD/YY HH:MI:SSam TZ') 1481 from ${Cu}transaction where id > $looktx 1482 and id = (select coalesce(min(id),0) 1483 from ${Cu}transaction 1484 where accountnumber = 'CHECKPOINT' 1485 and id > $looktx);";
1486 $sth2 = db_query($sql2,$dbh);
1488 mailerror($sql2, pg_last_error(), __LINE__, __FILE__);
1490 $sth1 = db_query(
"set time zone '$localzone'",$dbh);
1491 db_free_result($sth1);
1492 if (db_num_rows($sth2) == 0 || db_num_rows($sth) == 0)
1494 $d =
"not found in any batch";
1496 list($batch, $date) = db_fetch_array($sth2,0);
1497 $d =
"included in Batch <a href='${self}&action=CREATE&batch=$batch&tranfmt=$tranfmt' class='link2'>$batch</a><br> 1501 <div align=center><br>
1502 <table width=90% cellspacing=0 cellpadding=2 border=0>
1503 <tr><td
class=
"bar" align=center colspan=8>Locate $Cu Transaction</td></tr>
1504 <tr><td
class=
"dtl" colspan=8>Transaction <b>$looktx</b> was $d.</td></tr>
1506 <td
class=
"hdr">Confirm</td>
1507 <td
class=
"hdr">Date</td>
1508 <td
class=
"hdr" colspan=
"2">From</td>
1509 <td
class=
"hdr" colspan=
"2">To</td>
1510 <td
class=
"hdr">Description</td>
1511 <td
class=
"hdr" align=right>Amount</td>
1516 list($acct,$email,$txn,$amt,$date,$memberto,$from,$to,$txid)= db_fetch_array($sth,$row);
1518 $memberto = ($memberto ==
"" ? $acct : $memberto);
1519 $xdesc = ($acct == $memberto ?
"" :
"<font color='red'>CROSS ACCOUNT </font>");
1520 list ($xdesc,$tsk) = showline($txn, $xdesc);
1521 if (trim($email) >
"") { $acct = ($txn ==
'ED' ?
"Dep# $email" :
"<a href=mailto:$email class='link2'>$acct</a>"); }
1523 $ytotal += ($tsk ==
"" ? 0 : $amt);
1524 $amt = sprintf(
"%12.2f",$amt);
1525 $atotal = sprintf(
"%12.2f",$atotal);
1526 $yp = ($ytotal > 0 ?
"<td bgcolor='yellow' align='right'>" . sprintf(
"%12.2f",$ytotal) .
"</td>" :
"<td> </td>");
1527 $date = date(
"m/d/Y h:i:sA",strtotime(substr($date,0,19)));
1528 print
"<tr CLASS=$rbg> 1529 <td><font size=-1>$txid</font></td> 1530 <td><font size=-1>$date</font></td> 1531 <td><font size=-1>$acct</font></td> 1532 <td><font size=-1>$from</font></td> 1533 <td><font size=-1>$memberto</font></td> 1534 <td><font size=-1>$to</font></td> 1535 <td$tsk><font size=-1>$xdesc</font></td> 1536 <td><font size=-1><div align=right>$amt</div></font></td> 1538 $rbg = ($rbg ==
"odd" ?
"even" :
"odd");
1540 print
"<tr CLASS=$rbg><td colspan=6 align=right>Total</td> 1541 $yp<td align=right><b>$atotal</b></td></tr></table> 1544 if ($action ==
"") {
1545 $sql =
"select flagset from cuadmin where cu='$Cu'";
1546 $sth = db_query($sql,$dbh);
1547 if($sth) { list($Fset) = db_fetch_array($sth,0); }
1549 if (($Fset & $CU_SAVETXNS) != $CU_SAVETXNS) {
1552 <div align=center><br><form action=
"main.prg?ft=21">
1553 <table width=80% cellspacing=0 cellpadding=4 border=0>
1554 <tr><td
class=
"bar" align=center>Download $Cu Transactions</td></tr>
1555 <tr><td
class=
"dtl" align=center>
1556 This option is not
set up
for your Credit Union. Contact
1557 HomeCU
for details.</td></tr>
1558 <tr><td
class=
"hdr" align=center><hr>
1559 <input type=submit name=
"action" value=
"OK">
1560 </td></tr></table></form></div>
1565 $sql=
"select count(*) from ${Cu}transaction 1566 where ID > all (select max(ID) from ${Cu}transaction 1567 where AccountNumber='CHECKPOINT') 1568 and accountnumber <> 'demo'";
1570 $sth = db_query($sql,$dbh);
1571 list($rv) = db_fetch_array($sth,0);
1573 $sql=
"select tranformat from cuadmin where cu='${Cu}'";
1574 $sth = db_query($sql,$dbh);
1575 list($tranfmt) = db_fetch_array($sth,0);
1576 db_free_result($sth);
1577 $tranfmt = trim($tranfmt);
1579 print
"<div align=center><br>\n";
1582 <table width=90% cellspacing=0 cellpadding=3 border=0>
1583 <tr><td
class=
"bar" colspan=2 align=center>$Cu Download HomeCU Transactions
1589 <td
class=
"msg" colspan=2>$msg </td></tr>
1594 <td
class=
"dtl" align=right width=50%><b>
1595 Estimated Transactions to Download:</b></td>
1596 <td
class=
"dtl" width=*> $rv</td></tr>
1597 <tr><td
class=
"dtl" align=right><b>Batch Number to Create:</b></td>
1598 <td
class=
"dtl">
1599 <form action=
"$self" method=
"post" style=
"display:inline;">
1600 <input type=text name=batch value=
'New' size=5 maxsize=5>
1601 <input type=submit name=
"action" value=
"CREATE">
1602 <input type=hidden name=tranfmt value=
"$tranfmt">
1605 <tr><td
class=
"dtl" colspan=2 align=
"center"><font size=-1>Leave batch number
set to
'New' unless you want a copy of an old batch.</font></td>
1607 <tr><td
class=
"hdr" colspan=2><hr></td></tr>
1609 <td
class=
"dtl" align=
"right"><b>
1610 Find Confirmation ID:</b></td>
1611 <td
class=
"dtl">
1612 <form action=
"$self" method=
"post" style=
"display:inline;">
1613 <input type=text name=looktx size=5 maxsize=5>  
1614 <input type=submit name=
"action" value=
" FIND ">
1615 </form></td></tr></table>
1627 $spos = (intval($os) * $ret_rows);
1630 $sql =
"select trim(tz) from cuadmin where cu='$Cu'";
1631 $sth = db_query($sql,$dbh);
1632 if($sth) { list($tz) = db_fetch_array($sth,0); }
1633 $tz = (
"$tz" ==
"" ?
"Mountain" : $tz);
1634 if (strpos(
"$tz",
"/") ===
false) $tz =
"US/$tz";
1635 $sql =
"set time zone '$tz'; select to_char(date,'MM/DD/YY HH:MI:SSam TZ'), 1636 trim(reference3), reference4 1637 from ${Cu}transaction 1638 where accountnumber='CHECKPOINT' 1639 order by date desc limit $ret_rows offset $spos ";
1641 $rows_sql =
"select count(accountnumber) 1642 from {$Cu}transaction 1643 where accountnumber = 'CHECKPOINT' ";
1645 $sth = db_query($sql,$dbh);
1646 $rows_rs = db_query($rows_sql, $dbh);
1647 list($rec_rows) = db_fetch_array($rows_rs, 0);
1651 if ($rec_rows > $ret_rows) {
1652 $mp = intval($rec_rows / $ret_rows) + ($rec_rows % $ret_rows > 0 ? 1 : 0);
1660 $pg_flds = intval($pg_cnt / 2);
1661 if ((($os + 1) <= $pg_flds) || $mp <= $pg_cnt) {
1663 } elseif ($os + 1 + $pg_flds > $mp) {
1664 $fp = ($mp - $pg_cnt + 1);
1666 $fp = ($os - ($pg_cnt - $pg_flds) + 2);
1670 $prev =
"<a href=\"$PHP_SELF?ft=$ft&os=0\"><<Begin</a> ";
1671 $prev .=
"<a href=\"$PHP_SELF?ft=$ft&os=" . ($os - 1) .
"\"><Previous</a> ";
1673 $prev =
"<span style='font-size: 10px'><<Begin</span> ";
1674 $prev .=
"<span style='font-size: 10px'><Previous</span> ";
1677 if ($os < ($mp - 1)) {
1678 $next =
"<a href=\"$PHP_SELF?ft=$ft&os=" . ($os + 1) .
"\">Next></a> ";
1679 $next .=
"<a href=\"$PHP_SELF?ft=$ft&os=" . ($mp - 1) .
"\">End>></a> ";
1682 $pg_list = (($fp + $pg_cnt) > ($mp + 1) ? ($mp + 1) : ($fp + $pg_cnt));
1684 for ($i = $fp; $i < $pg_list; $i++) {
1685 if ($i == ($os + 1))
1686 $pages .=
" <span style='font-size: 10px'>$i</span> ";
1688 $pages .=
" <a href=\"$PHP_SELF?ft=$ft&os=" . ($i - 1) .
"\">$i</a> ";
1691 $print_nav =
"<tr><td class='dtl' colspan='3'>$prev $pages $next</td></tr>";
1695 $sth1 = db_query(
"set time zone '$localzone'",$dbh);
1696 db_free_result($sth1);
1699 <table width=90% border=0 cellpadding=2 cellspacing=0>
1700 <tr><td><caption align=
'center'><font size=-1><b>Click Batch Numbers Below to Retrieve Old Batch Files</b></font></caption></td></tr>
1702 <tr><td
class=
"hdr" width=50%>Date Created</td>
1703 <td
class=
"hdr" width=40%>Created By</td>
1704 <td
class=
"hdr" width=*>Batch Number</td></tr>
1706 for ($row=0;list($date,$bnum, $ref4) = db_fetch_array($sth,$row); $row++) {
1707 $ref4 = trim($ref4);
1708 $rbg = ($rbg ==
"odd" ?
"even" :
"odd");
1709 print
"<tr><td class='$rbg'><span class='usu'>$date </span></td> 1710 <td class='$rbg'><span class='usu'>$ref4 </span></td> 1711 <td class='$rbg' align='right'><span class='usu'>";
1712 if (is_numeric($bnum)) {
1713 print
"<a href='${self}&action=CREATE&batch=$bnum&tranfmt=$tranfmt' class='link2'>$bnum</a> </span></td></tr>";
1715 print
"$bnum </span></td></tr>";
1719 db_free_result($sth);
1721 mailerror($sql, pg_last_error(), __LINE__, __FILE__);
1726 function mailerror ($sql, $errstr, $line, $file) {
1731 $notify->line=$line;
1732 $notify->file=$file;
1733 $notify->callingfunction = __FUNCTION__;
1734 $notify->error=$errstr;
1736 $notify->member=
"$Cn - user: $chome";
1737 $notify->sql=
"$sql";
1740 function getbatch($dbh, $cu, $batch) {
1742 if (preg_match(
"/^new$/i",$batch)) {
1743 $sqlcommit =
"commit transaction";
1744 $sqlrollbk =
"rollback transaction";
1745 $sqlbegin =
"begin transaction";
1747 $sql1 =
"update CUAdmin set nextbatch = nextbatch + 1 1748 where cu='" . ${cu} .
"'";
1750 $sql2 =
"select nextval('" . ${cu} .
"transaction_id_seq')";
1752 $sth = db_query($sqlbegin, $dbh);
1754 mailerror ($sqlbegin,pg_last_error(), __LINE__, __FILE__);
1755 db_free_result($sth);
1756 return array(
"new",0);
1758 $sth = db_query($sql1, $dbh);
1760 mailerror ($sql1,pg_last_error(), __LINE__, __FILE__);
1761 $sth = db_query($sqlrollbk, $dbh);
1762 db_free_result($sth);
1763 return array(
"new",0);
1765 $sth = db_query($sql2, $dbh);
1767 mailerror ($sql2,pg_last_error(), __LINE__, __FILE__);
1768 $sth = db_query($sqlrollbk, $dbh);
1769 db_free_result($sth);
1770 return array(
"new",0);
1772 list($id) = db_fetch_array($sth,0);
1774 if (
"$cu" ==
"DEMO") {
1775 $sql3 =
"INSERT INTO ${cu}transaction 1776 (id, accountnumber, transactioncode, reference1, 1777 reference3, reference4, amount, date) 1778 select " . $id .
", 'CHECKPOINT', 'ZB', 'PHASE II', 1779 nextbatch, '$Cn', 0, now() 1780 from cuadmin where cu='" . ${cu} .
"'";
1782 $sql3 =
"INSERT INTO ${cu}transaction 1783 (id, accountnumber, transactioncode, reference1, 1784 reference3, reference4, amount, date) 1785 select " . $id .
", 'CHECKPOINT', 'ZB', 'PHASE I', 1786 nextbatch, '$Cn', 0, now() 1787 from cuadmin where cu='" . ${cu} .
"'";
1790 $sql4 =
"select reference3, id 1791 from ${cu}transaction 1794 $sth = db_query($sql3, $dbh);
1796 mailerror ($sql3,pg_last_error(), __LINE__, __FILE__);
1797 $sth = db_query($sqlrollbk, $dbh);
1798 db_free_result($sth);
1799 return array(
"new",0);
1801 $sth = db_query($sql4, $dbh);
1803 mailerror ($sql4,pg_last_error(), __LINE__, __FILE__);
1804 $sth = db_query($sqlrollbk, $dbh);
1805 db_free_result($sth);
1806 return array(
"new",0);
1808 $sth2 = db_query($sqlcommit, $dbh);
1811 $sql=
"select reference3, id from ${cu}transaction 1812 where reference3 = '" . $batch .
"' and transactioncode = 'ZB'";
1813 $sth = db_query($sql, $dbh);
1815 mailerror ($sql,pg_last_error(), __LINE__, __FILE__);
1816 db_free_result($sth);
1817 return array(
"new",0);
1820 list($batch,$identity) = db_fetch_array($sth,0);
1821 db_free_result($sth);
1822 return array($batch,$identity);
1824 function showline ($txn, $xdesc) {
1829 global $cwshareonly;
1836 if (in_array(
"$txn",array_keys($codelist))) {
1837 $xdesc .= $codelist[$txn];
1838 $tsk=(!in_array(
"$txn",$tfmt) || ($noxa >
'' && $acct != $memberto) ||
1839 ($achwhere >
'' && (strpos($achlist,$from) ===
false || strpos($achlist,$to) ===
false )) ||
1840 ($cwshareonly >
'' &&
"$txn" ==
'CW' && substr($from,0,1) !=
'S') ?
" bgcolor='yellow'" :
"");
1842 $xdesc .=
"($txn) ";
1845 return array($xdesc,$tsk);