Your IP : 18.225.234.226


Current Path : /home/church/public_html/advancingblackentrepreneurship.com/
Upload File :
Current File : /home/church/public_html/advancingblackentrepreneurship.com/sendattachment.pl

#!/usr/local/bin/perl
# send_dues.pl
# sanitarian dues
# Wendy Roseberry
# 02/10/2004

$dbname= 'asbrs';
use INA::DBS;
my $DBS = INA::DBS->new('wendy','mysql2',$dbname, 'root', '', 'ina2');
use Date::Calc qw(Add_Delta_Days);
(undef, undef, undef, $mday, $mon , $year) = localtime();
($y3, $m3, $d3) = Add_Delta_Days(($year+1900), ($mon+1), ($mday), '-1');
$today = ($m3).'/'.$d3.'/'.($y3);
$filedate = $y3.$m3.$d3;
#$dues_file = '/ina/misc/sanitarian/renewals/data_files/dues'.$today.'.txt';
$dues_file = '/web/shtml/development/wendy/sanitarian/renewals/renewals_src/backend/data_files/dues'.$filedate.'.txt';
open (RENEW, ">$dues_file") or die ('Can not open dues file for Sanitarians');

$agencyemail = 'wendy@ark.org';
#$agencyemail = 'mcartwright@HealthyArkansas.com';
$archivemail = 'sbrs_dues@ark.org';

$sql = "SELECT firstname, lastname, address, city, state, zip, email, reg_num, date_format(date_online, '%m/%d/%Y'), orderid, renewal_fee, coa FROM sanitarian_renewals WHERE status = 'I' and orderid <> ''";
$rows=$DBS->fetchall_arrayref($sql);
foreach $row (@$rows){
	@field=@$row;
	$reg_num=''; $orderid=''; $coa='';
	$record = join("\t", @field);
	
	$reg_num = $field[7];
	$orderid = $field[9];
	$coa = $field[11];
	
	print RENEW $record."\n";

$sql1 = "update sanitarian_renewals set status='S' where reg_num='".$reg_num."' and orderid='".$orderid."'";
$DBS->Run($sql1);

}
close RENEW;

if ($record){
	 use MIME::Lite;

    $mmsg = new MIME::Lite
     From   => 'support@ark.org',
     To     => $agencyemail,
     subject=> 'Sanitarian Online Registration Dues '.$today,
     Type   => 'multipart/mixed';
    
    attach $mmsg
     Type  => 'TEXT',
     Data  => "The file containing today's online dues payments is attached.";
     
    attach $mmsg
     Type   => 'TEXT',
     Path   => $dues_file,
     Filename =>'online_dues.txt';
     
     $mmsg->send;
     
     $mmsg2 = new MIME::Lite
     From   => 'support@ark.org',
     To     => $archiveemail,
     subject=> $today.' Sanitarian Online Registration Dues',
     Type   => 'multipart/mixed';
    
    attach $mmsg2
     Type  => 'TEXT',
     Data  => "The file containing today's online dues payments is attached.";
     
    attach $mmsg2
     Type   => 'TEXT',
     Path   => $dues_file,
     Filename =>'online_dues.txt';
     
     $mmsg2->send;
	
}