59 lines
2.0 KiB
PHP
59 lines
2.0 KiB
PHP
<?php
|
|
|
|
include "db.php";
|
|
include "include/queuemail.php";
|
|
|
|
$symbol = '$';
|
|
|
|
$query = "SELECT * FROM invoice_header WHERE status = 'Open'";
|
|
$invoices = db_query($query);
|
|
|
|
$count = 0;
|
|
|
|
while ($row = db_fetch_assoc($invoices)) {
|
|
extract($row);
|
|
|
|
$inv_num = sprintf("%06d-HL",$record_num + 500);
|
|
$balance = $symbol . number_format($total - $amount_paid,2);
|
|
|
|
$school = db_getVal("SELECT * FROM schools WHERE record_num = $school_num");
|
|
|
|
$reseller = $school['reseller'];
|
|
if ($reseller != 'hotlunch') continue;
|
|
|
|
$school_name = $school['school_name'];
|
|
echo("$school_name - $balance\n");
|
|
|
|
$emailSubject = "Re: Current Hot Lunches Online Invoice";
|
|
$emailFrom = "sales@hotlunches.net";
|
|
$emailReply = "Hot Lunches Online";
|
|
$emailMessage = "Hello,\n\n" .
|
|
"We want to let you know that all unpaid invoices will be adjusted on August 1 to remove the Early Bird Discount, as this discount is only offered to schools that pay the outstanding balance by July 31. You are receiving this email as your school currently has an Unpaid invoice.\n\n" .
|
|
"$school_name\n" .
|
|
"Invoice #$inv_num\n" .
|
|
"Balance: $balance\n\n" .
|
|
"Please contact us if this is an error or if your school does not wish to renew the subscription for the Hot Lunches Application.\n\n" .
|
|
"Regards\n" .
|
|
"Hot Lunches Online\n" .
|
|
"sales@hotlunches.net\n" .
|
|
"(888) 946-8586\n\n";
|
|
|
|
$contacts = db_query("SELECT * FROM school_contact_list WHERE school_num = $school_num");
|
|
while ($row = db_fetch_assoc($contacts)) {
|
|
extract($row);
|
|
echo(" - $contact_name $contact_email\n");
|
|
|
|
if (strlen($contact_email)) {
|
|
$emailTo = $contact_email;
|
|
$emailRecipient = $contact_name;
|
|
QueueEmail($emailTo, $emailFrom, $emailSubject, $emailMessage, $emailReply, $emailRecipient);
|
|
$count++;
|
|
}
|
|
}
|
|
}
|
|
|
|
echo("\n");
|
|
echo("Count: $count\n");
|
|
|
|
?>
|