Example #1
0
}
if (is_object($invoice) && $invoice->get_id() && ($invoice->get_value("invoiceStatus") == "reconcile" || $invoice->get_value("invoiceStatus") == "finished") && $invoice->has_attachment_permission($current_user)) {
    define("SHOW_INVOICE_ATTACHMENTS", 1);
}
if ($invoiceID) {
    $TPL["main_alloc_title"] = "Invoice " . $TPL["invoiceNum"] . " - " . APPLICATION_NAME;
} else {
    $TPL["main_alloc_title"] = "New Invoice - " . APPLICATION_NAME;
}
$invoiceRepeat = new invoiceRepeat();
if (is_object($invoice) && $invoice->get_id()) {
    $q = prepare("SELECT * FROM invoiceRepeat WHERE invoiceID = %d LIMIT 1", $invoice->get_id());
    $qid1 = $db->query($q);
    if ($db->row($qid1)) {
        $invoiceRepeat->read_db_record($db);
        $invoiceRepeat->set_values("invoiceRepeat_");
        foreach (explode(" ", $TPL["invoiceRepeat_frequency"]) as $id) {
            if ($id) {
                $qid2 = $db->query("SELECT * FROM invoice WHERE invoiceRepeatID = %d AND invoiceRepeatDate = '%s'", $invoiceRepeat->get_id(), $id);
                if ($idrow = $db->row($qid2)) {
                    $links[] = "<a href='" . $TPL["url_alloc_invoice"] . "invoiceID=" . $idrow["invoiceID"] . "'>" . $id . "</a>";
                } else {
                    $links[] = $id;
                }
            }
        }
        $TPL["message_help_no_esc"][] = "This invoice is also a template for the scheduled creation of new invoices on the following dates:\n                              <br>" . implode("&nbsp;&nbsp;", (array) $links) . "\n                              <br>Click the Repeating Invoice link for more information.";
    }
    if ($invoice->get_value("invoiceRepeatID")) {
        $ir = new invoiceRepeat();
        $ir->set_id($invoice->get_value("invoiceRepeatID"));