@imonth = ("01","02","03","04","05","06","07","08","09","10","11","12"); @iday = ("00","01","02","03","04","05","06","07","08","09"); @timedata = localtime(time); $mon = @timedata[4]; $month = @imonth[$mon]; $tmpday = @timedata[3]; $hour = @timedata[2]; $min = @timedata[1]; $sec = @timedata[0]; if ($tmpday < 10) { $day = @iday[$tmpday]; } else { $day = $tmpday; } $year= @timedata[5] + 1900; $spacer = "_"; $drive = "\\\\xxx\\xxxxx\\ftp\\files"; $in = "\\\\xxx\\xxxxx\\SunTrust"; $script = "\\\\xxx\\xxxxx\\Suntrust\\scripts"; $ap_script = "\\\\xxx\\xxxxxx\ap_scripts"; $payrollin = "$in\\payroll"; $oneworldin = "$in\\oneworld"; $retireein = "$in\\retiree"; $tempin = "$in\\temp"; $valid = 0; while ( $valid < 1) { # Clear the in directory before retrieving files. print `del /Q $in\\ach*.*`; $chk = 0; $dateline = "$year$month$day"; system("cls"); system("color 0A"); print "\n"; print "\n"; print " Bank Master File Send Script\n "; print "\n\n"; print "1.) Payroll ACH Send.\n\n"; print "2.) Positive Pay Send.\n\n"; print "3.) AP Positive Pay Send.\n\n"; print "4.) Echeck Send.\n\n"; print "5.) PSERM Positive Pay. \n\n"; print "6.) Payroll Retiree ACH.\n\n"; print "7.) Exit Menu.\n"; print "\n"; $chk = ; chop ($chk); if ($chk eq "1"){ $source = "\\\\xxx\\xxxxx\\Public\\OneWor~2\\Interfaces"; $dest = $payrollin; $pgpfile = "achout.txt"; system("cls"); $avil = 0; payach(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************************\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Verify that total matches the amount provided by payroll..\n"; print "*\n"; print "*\n"; print "******************************************************************\n"; print "\n\n"; print ".\n"; print `perl $script\\getach.pl payroll`; print `type $dest\\distot.txt`; print `echo ************************** >> $dest\\putpayrollach.log`; print`echo %date% %time% >> $dest\\putpayrollach.log`; pgp_file(); setup_password(); $sitenum = 17; $source_fld = "$in\\payroll"; $location_fld = "\/ACH"; $source_file = "achout.txt.pgp"; send_file(); ftp_files(); print `del $in\\payroll\\achout.txt.pgp`; } } if ($chk eq "2"){ $source = "\\\\xxxxx\\xxxxxx\\Public\\OneWor~2"; $dest = $payrollin; $pgpfile = "positive_pay.txt"; $type = "payroll"; system("cls"); $avil = 0; pospay(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************************\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Payroll Positive Pay send..\n"; print "*\n"; print "*\n"; print "******************************************************************\n"; print "\n\n"; print ".\n"; pgp_file(); setup_password(); $sitenum = 17; $source_fld = "$dest"; $location_fld = "\/Control_Pay"; $source_file = "Positive_Pay.txt.pgp"; send_file(); ftp_files(); print `del $dest\\Positive_Pay.txt.pgp`; print `del $dest\\Positive_Pay.txt`; } } if ($chk eq "3"){ $source = "\\\\xxxxx\\xxxxxx\\Public\\OneWor~1"; $dest = $oneworldin; $pgpfile = "positive_pay.txt"; $type = "Oneworld"; system("cls"); $avil = 0; pospay(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************************\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Oneworld Positive Pay send..\n"; print "*\n"; print "*\n"; print "******************************************************************\n"; print "\n\n"; print ".\n"; pgp_file(); setup_password(); $sitenum = 16; $source_fld = "$dest"; $location_fld = "\/Control_Pay"; $source_file = "Positive_Pay.txt.pgp"; send_file(); ftp_files(); print `del $dest\\Positive_Pay.txt.pgp`; print `del $dest\\Positive_Pay.txt`; } } if ($chk eq "4"){ $source = "c:\\ACH\\oneworld"; $dest = $onworldin; $pgpfile = "eCheckOW"; system("cls"); $avil = 0; OWeCheck(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************************\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Notice the total for the Echeck file..\n"; print "*\n"; print "*\n"; print "******************************************************************\n"; print "\n\n"; print ".\n"; print `perl $in\\scripts\\getach.pl oneworld`; print `type $dest\\\distot.txt`; print `echo ************************** >> $dest\\putecheck.log`; print `echo %date% %time% >> $dest\\putecheck.log`; pgp_file(); setup_password(); $sitenum = 18; $source_fld = "$dest"; $location_fld = "\/ACH"; $source_file = "echeck.pgp"; send_file(); #ftp_files(); } } if ($chk eq "5"){ $source = "\\\\xxxxxx\\xxxxxx\\Public\\OneWor~1"; $dest = $oneworldin; $pgpfile = "positive_pay.txt"; $type = "PSERM"; system("cls"); $pserm_arch = "\\\\xxxxx\\xxxxxx\\Public\\PSERM\\Positi~1\\archive"; $avil = 0; psermpospay(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************************\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* PSERM Positive Pay send..\n"; print "*\n"; print "*\n"; print "******************************************************************\n"; print "\n\n"; print ".\n"; pgp_file(); setup_password(); $sitenum = 18; $source_fld = "$dest"; $location_fld = "\/Control_Pay"; $source_file = "Positive_Pay.txt.pgp"; send_file(); ftp_files(); print `del $dest\\Positive_Pay.txt.pgp`; print `del $dest\\Positive_Pay.txt`; } } if ($chk eq "6"){ $source = "\\\\xxxxx\\xxxxxx\\Public\\OneWor~2\\Interfaces"; $dest = $retireein; $pgpfile = "payach.txt"; system("cls"); $avil = 0; retpayach(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************************\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Verify that total matches the amount provided by payroll..\n"; print "*\n"; print "*\n"; print "******************************************************************\n"; print "\n\n"; print ".\n"; print `perl $in\\scripts\\getach.pl retiree`; print `type $dest\\\distot.txt`; print `echo ************************** >> $dest\\putretireeach.log`; print`echo %date% %time% >> $dest\\putretireeach.log`; pgp_file(); setup_password(); $sitenum = 17; $source_fld = "$dest"; $location_fld = "\/ACH"; $source_file = "uapach.txt.pgp"; send_file(); ftp_files(); #print `del $dest\\uapach.txt.pgp`; } } elsif ($chk eq "7") { $valid = 1; system("color 07"); system("cls"); } else { print "Invalid Option\n"; } } sub OWeCheck{ if (-e "$source\\eCheckOW") { print `del $dest\\eCheckOW.bkup`; $achname = "eCheckOW_$month$day$year.txt"; print `copy $source\\eCheckOW $dest\\eCheckOW`; print `copy $source\\eCheckOW $dest\\echeck\\$achname`; print `move $source\\eCheckOW $dest\\eCheckOW.bak`; } else { system("cls"); system("color cf"); print "\n"; print "\n"; print "The One World eCheck file is not available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub payach{ if (-e "$source\\payach") { print `del $dest\\achout.txt`; $achname = "payach_$month$day$year.txt"; print `copy $source\\payach $dest\\achout.txt`; print `copy $source\\payach $dest\\backup\\$achname`; print `del $dest\\backup\\payach.bak`; print `move $source\\payach $dest\\backup\\payach.bak`; } else { #system("cls"); system("color cf"); print "\n"; print "\n"; print "The Payroll Ach file is not available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub retpayach{ if (-e "$source\\retiree_payach") { print `del $in\\payroll\\uapach.txt`; $achname = "retach_$month$day$year.txt"; print `copy $source\\retiree_payach $dest\\uapach.txt`; print `copy $source\\retiree_payach $dest\\backup\\$achname`; print `del $dest\\backup\\retach.bak`; print `move $source\\retiree_payach $dest\\backup\\retach.bak`; } else { system("cls"); system("color cf"); print "\n"; print "\n"; print "The Retiree Ach file is not available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub pospay{ if (-e "$source\\Interfaces\\positive_pay.txt") { print `copy $source\\Interfaces\\positive_pay.txt $dest\\positive_pay.txt`; print `copy $source\\Interfaces\\positive_pay.txt $source\\Archive-positive-pay\\$type\_positive\_pay\_$month$day$year.dat`; print `del $source\\Interfaces\\positive_pay.txt`; } else { system("cls"); system("color cf"); print "\n"; print "\n"; print "There is no Positive Pay file available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub psermpospay{ if (-e "$source\\Interfaces\\positive_pay.txt") { print `copy $source\\Interfaces\\positive_pay.txt $dest\\positive_pay.txt`; print `copy $source\\Interfaces\\positive_pay.txt $pserm_arch\\$type\_positive\_pay\_$month$day$year.dat`; print `del $source\\Interfaces\\positive_pay.txt`; } else { system("cls"); system("color cf"); print "\n"; print "\n"; print "There is no PSERM Positive Pay file available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub setup_password { #obtain password information for the two remote sites. @passline = (Num1,Site1,User1,Pswd1); open(PASS,"$drive\\password.ctl") || die "cannot open password ctl file....."; @pass_ctl=; close(PASS); foreach $pass (@pass_ctl) { $len = length($pass); if ($len > 1) { @passline = split(/\|/, $pass); $num = $passline[0]; $numint = int($num); @site[$numint] = $passline[1]; @userid[$numint] = $passline[2]; @pswd[$numint] = $passline[3]; } } } sub send_file { # Create the text file for sending files to Bank. open(OUT,">$script\\ftp_put_suntrust.txt") || die "cannot open ftp text file"; print OUT "@userid[$sitenum]\n"; print OUT "@pswd[$sitenum]\n"; print OUT "binary\n"; print OUT "lcd $source_fld\n"; print OUT "cd $location_fld\n"; print OUT "mput $source_file\n"; print OUT "bye\n"; close OUT; } sub pgp_file{ print `pgp --encrypt $dest\\$pgpfile --user \"xxxxxx\" --output $dest\\$pgpfile.pgp --conventional-passphrase \"xxxxxxxxxx\"`; } sub ftp_files { print `ftp -i -s:$script\\ftp_put_suntrust.txt @site[$sitenum]`; }