\n");
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
return;
}
// Setup default values on insert
if ($naction == 'add') {
$initTableName = "invoice_header";
$tarray = initializeTableArray($initTableName);
extract($tarray, EXTR_OVERWRITE);
$invoice_date = date("Y-m-d",time());
$due_date = date("Y-m-d",time() + 60 * 60 * 24 * 30);
$monthdate = date("m-d",time());
$yr = date("Y",time());
$renewal_date = "$yr-08-01";
if ($monthdate > "02-15") {
$yr++;
$renewal_date = "$yr-08-01";
}
$charge_gst = 'Y';
$status = 'Open';
$amount_paid = 0.00;
}
if (!isset($selected_school) && isset($school_num)) $selected_school = $school_num;
if (isset($selected_school)) {
$results = db_query("SELECT * FROM schools WHERE record_num = $selected_school");
$school = db_fetch_array($results);
}
$gst_rate = 5;
$tax_code = "GST";
// if ($school['province'] == 'BC') {
// $gst_rate = 12;
// $tax_code = "HST";
// }
if ($school['country'] != 'Canada') {
$charge_gst = 'N';
$gst_rate = 0;
$tax_code = "";
}
else {
if ($school['charge_gst'] == 'N') {
$charge_gst = 'N';
$gst_rate = 0;
$tax_code = "";
}
}
$balance = $total - $amount_paid;
$numLines = 12;
// if ($selected_school == 258) $numLines = 25;
if (isset($record_num) && $record_num > 0) {
$query = "select count(*) from invoice_items " .
"where invoice_num = $record_num";
$num = db_getVal($query);
if ($num > $numLines - 5) $numLines = $num + 5;
}
// echo($numLines." - ".$num);
?>