BILLING MAILOUT =============== # create file with HTML Headers for e-mailing of Monthly Statement #assigns process id to $pid $pid=$$; # open mailout to notify The Auction Advertiser of useage open(BREF,">/tmp/my_comment.$pid"); open(BREF2,">$billdate"); #print "AUCTIONEER EMAIL: $EMail::email{$au[0]}
\n"; print BREF "From: submit\@theauctionadvertiser.com\n"; print BREF "To: $EMail::email{$au[0]}\n"; print BREF "Cc: sales\@theauctionadvertiser.com\n"; print BREF "Subject: The Auction Advertiser: $tim2 Statement\n"; print BREF "MIME-Version: 1.0\n"; print BREF "Content-Type: text/html; charset=us-ascii\n"; print BREF "Content-Transfer-Encoding: 7bit\n"; X XSIGNIFICANT DIFFERENCE HERE X print BREF "\n"; # START OF MAILOUT HEADER @madd=split(/~/,$mobad{$au[0]}); print "
\n"; print "\n"; print "
\n"; print "
The Auction Advertiser
\n"; print "326 South Big Island Road
\n"; print "Demorestville, Ontario   K0K 1W0
\n"; print "





\n"; print "$madd[1] $madd[0]
\n"; print "$madd[2]
\n"; print "$madd[3]
\n"; print "$madd[4], $madd[5]   $madd[6]

\n"; print "\n"; print "The Auction Advertiser
\n"; print "Promoting Ontario Auctioneers Since 1995

\n"; print "SALE SUBMISSIONS
\n"; print "E-Mail: admin\@ontarioauctioneer.com
\n"; print "E-Form: Our Submission Form

\n"; # ALERT NOTICE TO BE INCLUDED # *************************** if($in{'imnoticeyes'}) { print "
IMPORTANT NOTICE
"; $in{'imnotice'}=~ s/\n/
/g; print "$in{'imnotice'}\n"; } # *************************** print "
\n"; #print "

\n"; print "
__________________________________________________________

\n"; if($in{'sr'}eq"Event Date") { print "STATEMENT OF SERVICES BY EVENT DATE FOR
$tim2
\n"; } else{ print "STATEMENT OF SERVICES BY SUBMISSION DATE FOR
$tim2
\n"; } print "Prepared on $date for


\n"; #print "

\n"; print "\"\"

\n"; #print "NOTE THIS AUCTIONEER PAYS BY: $paymentmethod

\n"; #print "$EMail::email{$au[0]}\n"; # END OF MAILOUT HEADER print BREF "\n"; print BREF "The Auction Advertiser\n"; print BREF "\n"; print BREF "
\n"; print BREF "\n"; print BREF "
\n"; print BREF "
The Auction Advertiser
\n"; print BREF "326 South Big Island Road
\n"; print BREF "Demorestville, Ontario   K0K 1W0
\n"; print BREF "
\n"; print BREF "\n"; print BREF "The Auction Advertiser
\n"; print BREF "Promoting Ontario Auctioneers Since 1995

\n"; print BREF "SALE SUBMISSIONS
\n"; #print BREF "E-Mail: admin\@ontarioauctioneer.com
\n"; print BREF "E-Mail: admin\@ontarioauctioneer.com
\n"; print BREF "E-Form: Our Submission Form


\n"; print BREF2 "\n"; print BREF2 "The Auction Advertiser\n"; print BREF2 "\n"; print BREF2 "
\n"; print BREF2 "\n"; print BREF2 "
\n"; print BREF2 "
The Auction Advertiser
\n"; print BREF2 "326 South Big Island Road
\n"; print BREF2 "Demorestville, Ontario   K0K 1W0
\n"; print BREF2 "
\n"; print BREF2 "\n"; print BREF2 "The Auction Advertiser
\n"; print BREF2 "Promoting Ontario Auctioneers Since 1995

\n"; print BREF2 "SALE SUBMISSIONS
\n"; #print BREF2 "E-Mail: admin\@ontarioauctioneer.com
\n"; print BREF2 "E-Mail: admin\@ontarioauctioneer.com
\n"; print BREF2 "E-Form: Our Submission Form


\n"; # ALERT NOTICE TO BE INCLUDED # *************************** if($in{'imnoticeyes'}) { print BREF "IMPORTANT NOTICE
"; print BREF2 "IMPORTANT NOTICE
"; $in{'imnotice'}=~ s/\n/
/g; print BREF "$in{'imnotice'}\n"; print BREF2 "$in{'imnotice'}\n"; } # *************************** print BREF "
\n"; print BREF "

\n"; print BREF "


$date

"; print BREF "Statement of Services by $in{'sr'}
$tim2
Prepared For


\n"; print BREF "\"\"

\n"; print BREF2 "
\n"; print BREF2 "

\n"; print BREF2 "


$date

"; print BREF2 "Statement of Services by $in{'sr'}
$tim2
Prepared For


\n"; print BREF2 "\"\"

\n"; # make a file name for the billing file and open into an array if($in{'archive'}) { $billing = "/home4/thomas/public_html/ontarioauctioneer/cgi-bin/billing.txt"."archive"; } else { $billing ="/home4/thomas/public_html/ontarioauctioneer/cgi-bin/billing.txt"; } open(FILE,"<$billing") || &err("Can't open file $billing !"); # make a file name for the submission transactions $sfile = "/home4/thomas/public_html/ontarioauctioneer/cgi-bin/sfile.txt"; open(SFILE,">$sfile") || &err("Can't open file $sfile !"); # make a file name for the other transactions $ofile = "/home4/thomas/public_html/ontarioauctioneer/cgi-bin/ofile.txt"; open(OFILE,">$ofile") || &err("Can't open file $ofile !"); $costt = 0; $cost5 = 0.001; print "\n"; print BREF "
\n"; print BREF2 "
\n"; print OFILE "\n"; print OFILE ""; # TYPE E/F print OFILE ""; # SUBMISSION DATE print OFILE ""; # SUBMISSION DETAILS print OFILE ""; # AMOUNT print OFILE "\n"; print SFILE "\n"; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE "\n"; print SFILE "\n"; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE ""; print SFILE "\n"; while ($line = ) # start loop through submisions { @ddata = split(/~/,$line); # split line into array if (($line =~ /\b$au[0]/) && (($tim eq "") || (($in{'sr'} eq "Submission Month") && ($ddata[3]=~/$tim/)) || (($in{'sr'} eq "Event Date") && ($ddata[4]=~/$tim/)))) { if($ddata[2] eq "X") # entry defines credit, balance or special service item { # get payment method from $ddata[1] if($ddata[4] == 0) { $balin="ZERO"; } print OFILE "\n"; print OFILE ""; # TYPE E/F print OFILE ""; # SUBMISSION DATE print OFILE ""; # SUBMISSION DETAILS if($ddata[4]>=0) { print OFILE ""; # SALE DATE } elsif($ddata[1]=~/Balance/) { print OFILE ""; # PAYMENT AMOUNT } else { print OFILE ""; # PAYMENT AMOUNT } print OFILE "\n"; $costt = $costt + $ddata[4]; } else # submission found { $cost5 = 0.001; # was 400 # ******* $min=1000; # OUTPUT BILL SUMMARY MATCHES BY AUCTIONEER/DATE/MONTH KEYS $ff=1-$ff; $clr="F0F0FF"; if($ff == 0){$clr="F0FFF0";} print SFILE "\n"; print SFILE ""; # TYPE E/F print SFILE ""; # SUBMISSION DATE print SFILE ""; # SALE DATE print SFILE ""; # SALE DAY print SFILE ""; # SALE TIME print SFILE ""; # LOCATION print SFILE ""; # WORD CONTENT #********************** #GST RATE DETERMINATION #********************** #if($ddata[3] =~/Jul|Aug|Sep|Oct|Nov|Dec/){$rgst=0.130;} #else{$rgst=0.050;} $rgst=0.130; #********************** if(($ddata[7] =~ /N/)){$cost1=0.0001;} elsif(($ddata[2] eq "S")){$cost1=$ddata[7]*40.0000001;} # special services, units in dollars elsif(($ddata[2] eq "D")){$cost1=$ddata[7]*14.9500001;} # Domain Hosting charges, units in dollars elsif(($ddata[2] eq "R")){$cost1=$ddata[7];} # Domain Renewal charges, units in dollars elsif(($ddata[2] eq "A")){$cost1=$ddata[7]*30.0000001;} # Flash Ad charges, units in dollars elsif(($ddata[2] eq "B")){$cost1=$ddata[7]*10.0000001;} # eFlyer/Brochure, units in dollars elsif(($ddata[2] eq "P")){$cost1=$ddata[7]*10.0000001;} # NAA Posting charges, units in dollars elsif(($ddata[2] eq "4")){$cost1=$ddata[7];} # 4SaleNow Charges, units in dollars $5 + 1 photo FREE Additional photos $1.00 #else SALE SUBMITTED ON OR AFTER JULY 1 2009 #else($ddata[3] =~/Jul|Aug|Sep|Oct|Nov|Dec/) else { if(!($ddata[7]>0)) # NO WORDS { $cost1=0.00001; } elsif($ddata[7]==1) # UPDATED LISTING { $cost1=30.0000001; if ($ddata[2] eq "E"){$cost1=20.000001;} } elsif($ddata[7]>1) { $cost1=60.0000001; if ($ddata[2] eq "E"){$cost1=40.000001;} } } #else # SALE SUBMITTED ON OR BEFORE JUNE 30 #{ #if(!($ddata[7]>0)) # NO WORDS #{ #$cost1=0.00001; #} #elsif($ddata[7]==1) # UPDATED LISTING #{ #$cost1=20.0000001; #if ($ddata[2] eq "E"){$cost1=15.000001;} #} #elsif($ddata[7]>1) #{ #$cost1=40.0000001; #if ($ddata[2] eq "E"){$cost1=30.000001;} #} #} $cst1=substr($cost1,0,index($cost1,".")+3); print SFILE ""; # WORD COST #CHARGE FOR POSTING TO AAO SITE DECEMBER 18 2008 #$cost2="NO"; #if($ddata[8] eq "y"){$cst2="Y";} #else {$cst2="N";} $cost2=0.00; if($ddata[8] eq "y"){$cost2=5.001;} $cst2=substr($cost2,0,index($cost2,".")+3); print SFILE ""; # AAO SUBMISSION COST $cost3="NO"; if($ddata[10] == ""){$ddata[10]=0;} print SFILE "";# NUMBER OF IMAGES $cost4 = $ddata[10]*1.000001; if($cost4 == 0){$cost4="0.0001";} $cst4=substr($cost4,0,index($cost4,".")+3); print SFILE "";# IMAGE COST #if($ddata[9] eq "y"){$cost3="YES";} if(($cost1 + $cost2 + $cost4) > 0.05) { $cost3=$rgst*($cost1 + $cost2 + $cost4); $cost3=substr($cost3,0,index($cost3,".")+3); } else {$cost3=0.00;} print SFILE ""; # GST $tgst=$tgst+$cost3; $cost5 = $cost1 + $cost2 + $cost3 + $cost4; $cst5=substr($cost5,0,index($cost5,".")+3); #red colour for credit balances (negative amounts :-45.20 if($cst5>=0) { print SFILE "";# SUBMISSION COST 0 or positive } else { print SFILE "";# SUBMISSION COST negative } print SFILE "\n"; $costt = $costt + $cost5; } } } # end loop through submissions # TOTAL COST #$sgst=int(($tgst+0.00001)*100)/100; if($in{'sr'}eq"Event Date") { print SFILE "",$tgst); print SFILE "",$tgst); print SFILE ""; } else { print SFILE "($cstt)"; } if($cstt <= 5) { $balout="ZERO"; } close FILE; close SFILE; close OFILE; if($in{'dt'} eq "") { # make a file name for the other transactions $ofile = "/home4/thomas/public_html/ontarioauctioneer/cgi-bin/ofile.txt"; open(OFILE,"<$ofile") || &err("Can't open file $ofile !"); while ($line = ) { print $line; print BREF $line; print BREF2 $line; } close OFILE; } print "\n"; print BREF "\n"; print BREF2 "\n"; # make a file name for the submission transactions $sfile = "/home4/thomas/public_html/ontarioauctioneer/cgi-bin/sfile.txt"; open(SFILE,"<$sfile") || &err("Can't open file $sfile !"); while ($line = ) { print $line; print BREF $line; print BREF2 $line; } close SFILE; print "
TYPESUBMITDESCRIPTIONAMT
SUBMISSION DETAILSTEXT COST (\$)IMGHSTITEM
TYPESUBMITEVENTDAYTIMECOMMENTREFTAAAAO(\#)(\$)(\$)(\$)
$ddata[2]$ddata[3]$ddata[1]$ddata[4]$ddata[4]$ddata[4]
$ddata[2]$ddata[3]$ddata[4]$ddata[5]$ddata[6]$ddata[1]$ddata[7]$cst1$cst2$ddata[10]$cst4$cost3$cst5($cst5)
"; printf SFILE ("CURRENT EVENT TOTAL INCLUDES G/HST (HST THIS MONTH: \$ %7.2f)"; } else { print SFILE "
"; printf SFILE ("MONTH END BALANCE INCLUDES G/HST (HST THIS MONTH: \$ %7.2f)"; } # added January 17 2017 to fix rounding of negative credit balances #================================================================== # $costt=$costt+0.001; if($costt>=0){$costt=$costt+0.001;} else{$costt=$costt-0.001;} $cstt=substr($costt,0,index("\$".$costt,".")+2); if($cstt>=0) { print SFILE "$cstt
\n"; print "\n"; print "[F: Faxed] [E: E-mailed] [R: Domain Renewal] [S: Special Service] [X:Balance, Credit, Debit] [1: Text Updates]
\n"; print "NOTE: ANY NEGATIVE BALANCE IS A CREDIT TO YOUR ACCOUNT AND NO PAYMENT IS REQUIRED!
\n"; print "(GST#: 85436-4924-RT0001)

\n"; print BREF "\n"; print BREF "\n"; print BREF "\n"; print BREF "[F: Faxed] [E: E-mailed] [R: Domain Renewal] [S: Special Service] [X:Balance, Credit, Debit] [1: Text Updates]
\n"; print BREF "NOTE: ANY NEGATIVE BALANCE IS A CREDIT TO YOUR ACCOUNT AND NO PAYMENT IS REQUIRED!
\n"; print BREF "(GST#: 85436-4924-RT0001)

\n"; print BREF2 "\n"; print BREF2 "\n"; print BREF2 "\n"; print BREF2 "[F: Faxed] [E: E-mailed] [R: Domain Renewal] [S: Special Service] [X:Balance, Credit, Debit] [1: Text Updates]
\n"; print BREF2 "NOTE: ANY NEGATIVE BALANCE IS A CREDIT TO YOUR ACCOUNT AND NO PAYMENT IS REQUIRED!
\n"; print BREF2 "(GST#: 85436-4924-RT0001)

\n"; # print the rest of the response HTML if($in{'sr'} eq "Submission Month") { print BREF "
\n"; print BREF2 "
\n"; print "\n"; print BREF2 "IMPORTANT REMINDER
\n"; print BREF2 "This invoice is your notice that your credit card will be billed
"; print BREF2 "for the above MONTH END BALANCE, if any,
on the 5th of the current month.
\n"; print "IMPORTANT REMINDER
\n"; print "This invoice is your notice that your credit card will be billed
"; print "for the above MONTH END BALANCE, if any,
on the 5th of the current month.
\n"; } elsif($paymentmethod eq "eTransfer") { print BREF "IMPORTANT REMINDER
\n"; print BREF "This invoice is your notice that your eTransfer Payment is due
"; print BREF "for the above MONTH END BALANCE, if any,
on the 5th of the current month.
\n"; print BREF2 "IMPORTANT REMINDER
\n"; print BREF2 "This invoice is your notice that your eTransfer Payment is due
"; print BREF2 "for the above MONTH END BALANCE, if any,
on the 5th of the current month.
\n"; print "IMPORTANT REMINDER
\n"; print "This invoice is your notice that your eTransfer Payment is due
"; print "for the above MONTH END BALANCE, if any,
on the 5th of the current month.
\n"; } else { print BREF "IMPORTANT REMINDER
\n"; print BREF "This invoice is your notice that your payment
for the above MONTH END BALANCE, if any,
"; print BREF "is due by the 20th. of the current month.
"; print BREF "Cheques should be made payable to Judie McLauchlin.
\n"; print BREF2 "IMPORTANT REMINDER
\n"; print BREF2 "This invoice is your notice that your payment
for the above MONTH END BALANCE, if any,
"; print BREF2 "is due by the 20th. of the current month.
"; print BREF2 "Cheques should be made payable to Judie McLauchlin.
\n"; print "IMPORTANT REMINDER
\n"; print "This invoice is your notice that your payment
for the above MONTH END BALANCE, if any,
"; print "is due by the 20th. of the current month.
"; print "Cheques should be made payable to Judie McLauchlin.
\n"; } print BREF "
\n"; if(($paymentmethod eq "VISA")||($paymentmethod eq "MASTERCARD")) { print BREF "IMPORTANT REMINDER
\n"; print BREF "This invoice is your notice that your credit card will be billed
"; print BREF "for the above MONTH END BALANCE, if any,
on the 5th of the current month.
If you have any questions about this statement, please contact
\n"; print BREF "Thom McLauchlin ~ P: 613-885-8466
admin\@ontarioauctioneer.com
\n"; print BREF2 "
If you have any questions about this statement, please contact
\n"; print BREF2 "Thom McLauchlin ~ P: 613-885-8466
admin\@ontarioauctioneer.com
\n"; print "
If you have any questions about this statement, please contact
\n"; print "Thom McLauchlin ~ P: 613-885-8466
admin\@ontarioauctioneer.com
\n"; } # Event Date Statement else { print "
\n"; print "If you have any questions about this statement, please contact
\n"; print "Thom McLauchlin ~ Phone: 613-885-8466 ~ admin\@ontarioauctioneer.com
\n"; print BREF "
\n"; print BREF "If you have any questions about this statement, please contact
\n"; print BREF "Thom McLauchlin ~ 613-885-8466 ~ admin\@ontarioauctioneer.com
\n"; print BREF2 "
\n"; print BREF2 "If you have any questions about this statement, please contact
\n"; print BREF2 "Thom McLauchlin ~ 613-885-8466 ~ admin\@ontarioauctioneer.com
\n"; } print "
\n"; print BREF "
\n"; print BREF2 "\n"; close(BREF2); close(BREF); # send link to month end statement # *************************************** if($in{'ss'}) { #sends comment file as mail to Submitter #$command="/usr/sbin/sendmail -f admin\@ontarioauctioneer.com -t < /tmp/my_comment.$pid"; $command="/usr/sbin/sendmail -f sales\@theauctionadvertiser.com -t < /tmp/my_comment.$pid"; system($command);