$edate) { $query = "UPDATE schools SET expiry_date = '$renewal_date' WHERE record_num = $school_num"; writeLog($query); db_query($query); } // Update school record that the invoice has been paid $query = "UPDATE schools SET renewal_invoice_paid = 'Y' WHERE record_num = $school_num"; writeLog($query); db_query($query); // Get country $school_country = db_getVal("SELECT country FROM schools WHERE record_num = $school_num"); $currency = 'CAD'; if ($school_country == 'USA') $currency = 'USD'; // // Save payment info for deposit report // $table = new Table("invoice_payments"); $invoice_num = $invoice_record_num + 500; $entered = time(); $payment_date = date("Y-m-d",$entered); $batch_num = 0; $entry = array(); $entry['school_num'] = $school_num; $entry['invoice_num'] = $invoice_num; $entry['payment_date'] = $payment_date; $entry['entered'] = $entered; $entry['amount'] = $amount; $entry['currency'] = $currency; $entry['group_with_next'] = 'N'; $entry['batch_num'] = 0; $entry['batch_closed_date'] = NULL; $entry['method'] = $method; $entry['user_ip'] = $_SERVER["REMOTE_ADDR"]; $query = $table->BuildInsert($entry); db_query($query); // Get school info $results = db_query("SELECT * FROM schools WHERE record_num = $school_num"); $row = db_fetch_array($results); $school_name = $row['school_name']; $school_status = $row['status']; $expiry_date = $row['expiry_date']; $system_configuration = $row['system_configuration']; // Send thank you to school include "include/queuemail.php"; // Get school contacts $contacts = db_query("SELECT * FROM school_contact_list WHERE school_num = $school_num AND contact_email != '' AND contact_email IS NOT NULL ORDER BY sequence"); $count = 0; while ($row = db_fetch_assoc($contacts)) { extract($row); $emailMessage = "Hello $contact_name,\n" . "\n" . "Your payment has been received and posted to your account.\n" . "\n" . "Do not hesitate to send me an email with any questions or suggestions that you may have.\n" . "\n" . "School Name: $school_name\n" . "School Status: $school_status\n" . "Renewal Date: $renewal_date\n" . "Configuration: $system_configuration\n" . "\n" . "Thank You\n" . "\n" . "Hot Lunches On-Line\n" . "(604)996-7181" . "\n" . "1-888-9HOTLUNCH (1-888-946-8586)" . "\n" . "\n" . "support@hotlunches.net\n" . "http://www.hotlunches.net/\n\n"; $emailRecipient = $contact_name; $emailTo = $contact_email; $emailReply = "Hot Lunches On-Line"; $emailFrom = "support@hotlunches.net"; $emailSubject = "HotLunches.net Payment Received From $school_name"; QueueEmail($emailTo, $emailFrom, $emailSubject, $emailMessage, $emailReply, $emailRecipient); if ($count == 0) { $emailRecipient = "Hot Lunches Online"; $emailTo = "support@hotlunches.net"; QueueEmail($emailTo, $emailFrom, $emailSubject, $emailMessage, $emailReply, $emailRecipient); } $count++; } writeLog("completed"); ?>