echo "<p class=\"submenu_bar\">";
     if ($user_usertype_current > 2) {
         echo "<a href=\"index2.php?page=tender_view&amp;question=add&amp;tender_id={$tender_id}\" class=\"submenu_bar\">Add Question</a>";
     }
     if ($_GET[edit_question] == NULL) {
         echo "<a href=\"popup_tender.php?tender_id={$tender_id}\" class=\"submenu_bar\">Printable View</a>";
     }
     echo "</p>";
     if ($tender_instructions != NULL and $_GET[edit_question] == NULL and $_GET[edit_answer] == NULL) {
         echo "<h2>Submission Instructions</h2><blockquote>" . $tender_instructions . "</blockquote>";
     }
     if ($tender_client != NULL and $_GET[edit_question] == NULL and $_GET[edit_answer] == NULL) {
         echo "<h2>Client</h2><blockquote>" . $tender_client . "</blockquote>";
     }
     if ($tender_source != NULL and $_GET[edit_question] == NULL and $_GET[edit_answer] == NULL) {
         echo "<h2>Source of Tender</h2><blockquote>" . TextPresent($tender_source) . "</blockquote>";
     }
     echo "<h2>Submission Deadline</h2><blockquote>" . TimeFormatDetailed($tender_date) . "</blockquote>";
     echo "<h2>Responses</h2>";
     echo "<table summary=\"Lists of questions and responses\">";
     if ($_GET[question] == "add") {
         EditForm('', '', '', '', '', $tender_id);
         echo "</th></tr>";
     }
 }
 if ($answer_response == NULL) {
     $answer_response = "-- Not answered --";
     $bgcolor = "background-color: red";
     $message = "Incomplete";
 } elseif ($answer_wordcount / $answer_words < 0.75 and $answer_words > 0) {
     $bgcolor = "background-color: orange";
     $highlight = " style=\"background-color: #{$settings_alertcolor}\" ";
     $highlight2 = "style=\"background-color: #{$settings_alertcolor}; text-align: right;\"";
 } else {
     $highlight = "";
     $highlight2 = "style=\"text-align: right;\"";
 }
 if ($invoice_baddebt == "yes") {
     echo "<tr><td colspan=\"4\" {$highlight}><strong>Listed as a bad debt</strong></td></tr>";
 }
 print "<tr>";
 print "<td {$highlight} rowspan=\"{$rowspan}\" style=\"width: 25%;\"><a href=\"index2.php?page=timesheet_invoice_view&amp;invoice_id={$invoice_id}\">" . $invoice_ref . "</a>";
 if ($user_usertype_current > 3) {
     print "&nbsp;<a href=\"index2.php?page=timesheet_invoice_edit&amp;status=edit&amp;invoice_id={$invoice_id}\" {$confirm}><img src=\"images/button_edit.png\" alt=\"Edit Invoice\" /></a>";
 }
 if ($invoice_notes != NULL) {
     echo "<br />" . TextPresent($invoice_notes);
 }
 print "</td>";
 print "<td {$highlight}>" . TimeFormat($invoice_date) . "</td>";
 print "<td {$highlight}>" . TimeFormat($invoice_due) . "</td>";
 if ($invoice_paid > 0) {
     print "<td {$highlight}>" . TimeFormat($invoice_paid) . "</td>";
 } else {
     print "<td {$highlight}></td>";
 }
 print "</tr>";
 // Output the Invoice Item details
 if (mysql_num_rows($result2) > 0) {
     while ($array2 = mysql_fetch_array($result2)) {
         $invoice_item_novat = $array2['invoice_item_novat'];
         $invoice_item_vat = $array2['invoice_item_vat'];
             print "&nbsp;<a href=\"index2.php?page=timesheet_invoice_items_edit&amp;invoice_item_id={$invoice_item_id}&amp;proj_id={$proj_id}\" {$confirm}><img src=\"images/button_edit.png\" alt=\"Edit Invoice\" /></a>";
         }
         print "</td><td style=\"text-align: right;\">" . MoneyFormat($invoice_item_novat) . "</td></tr>";
         $invoice_total_all = $invoice_total_all + $invoice_item_vat;
         $invoice_total_sub = $invoice_total_sub + $invoice_item_novat;
     }
     print "<tr><td><u>Fees Sub Total (excl. VAT)</u></td><td style=\"text-align: right;\"><u>" . MoneyFormat($invoice_total_sub) . "</u></td></tr>";
 }
 print "<tr><td colspan=\"2\"><strong>Expenses Details</strong></td></tr>";
 // Output the Invoice Item details
 if (mysql_num_rows($result3) > 0) {
     while ($array3 = mysql_fetch_array($result3)) {
         $ts_expense_id = $array3['ts_expense_id'];
         $ts_expense_value = $array3['ts_expense_value'];
         $ts_expense_vat = $array3['ts_expense_vat'];
         $ts_expense_desc = TextPresent($array3['ts_expense_desc']);
         print "<tr><td><a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id={$ts_expense_id}\">" . $ts_expense_desc . "</a>";
         if ($invoice_date > time()) {
             print "&nbsp;<a href=\"index2.php?page=timesheet_expense_edit&amp;status=edit&amp;ts_expense_id={$ts_expense_id}\"><img src=\"images/button_edit.png\" alt=\"Edit Expense\" /></a>";
         }
         print "</td><td style=\"text-align: right;\">" . MoneyFormat($ts_expense_value) . "</td></tr>";
         $invoice_total_all = $invoice_total_all + $ts_expense_vat;
         $invoice_expense_total = $invoice_expense_total + $ts_expense_value;
     }
     print "<tr><td><u>Expenses Sub Total (excl. VAT)</u></td><td style=\"text-align: right;\"><u>" . MoneyFormat($invoice_expense_total) . "</u></td></tr>";
 } else {
     print "<tr><td>None</td><td style=\"text-align: right;\">--</td></tr>";
 }
 $vat_total = $invoice_total_all - ($invoice_expense_total + $invoice_total_sub);
 print "<tr><td><u>VAT</u></td><td style=\"text-align: right; \"><u>" . MoneyFormat($vat_total) . "</u></td></tr>";
 print "<tr><td><strong>INVOICE TOTAL (inc. VAT)</strong></td><td style=\"text-align: right; \"><strong>" . MoneyFormat($invoice_total_all) . "</strong></td></tr>";