Exemplo n.º 1
0
function show_invoices()
{
    $current_user =& singleton("current_user");
    global $project;
    $clientID = $project->get_value("clientID");
    $projectID = $project->get_id();
    $_FORM["showHeader"] = true;
    $_FORM["showInvoiceNumber"] = true;
    $_FORM["showInvoiceClient"] = true;
    $_FORM["showInvoiceName"] = true;
    $_FORM["showInvoiceAmount"] = true;
    $_FORM["showInvoiceAmountPaid"] = true;
    $_FORM["showInvoiceDate"] = true;
    $_FORM["showInvoiceStatus"] = true;
    $_FORM["clientID"] = $clientID;
    $_FORM["projectID"] = $projectID;
    // Restrict non-admin users records
    if (!$current_user->have_role("admin")) {
        $_FORM["personID"] = $current_user->get_id();
    }
    $rows = invoice::get_list($_FORM);
    echo invoice::get_list_html($rows, $_FORM);
}
Exemplo n.º 2
0
*/
require_once "../alloc.php";
$current_user->check_employee();
$defaults = array("showHeader" => true, "showInvoiceNumber" => true, "showInvoiceClient" => true, "showInvoiceName" => true, "showInvoiceAmount" => true, "showInvoiceAmountPaid" => true, "showInvoiceDate" => true, "showInvoiceStatus" => true, "url_form_action" => $TPL["url_alloc_invoiceList"], "form_name" => "invoiceList_filter");
function show_filter()
{
    global $TPL;
    global $defaults;
    $_FORM = invoice::load_form_data($defaults);
    $arr = invoice::load_invoice_filter($_FORM);
    is_array($arr) and $TPL = array_merge($TPL, $arr);
    $payment_statii = invoice::get_invoice_statii_payment();
    foreach ($payment_statii as $payment_status => $label) {
        $summary .= "\n" . $nbsp . invoice::get_invoice_statii_payment_image($payment_status) . " " . $label;
        $nbsp = "  ";
    }
    $TPL["status_legend"] = $summary;
    include_template("templates/invoiceListFilterS.tpl");
}
$_FORM = invoice::load_form_data($defaults);
// Restrict non-admin users records
if (!$current_user->have_role("admin")) {
    $_FORM["personID"] = $current_user->get_id();
}
$TPL["invoiceListRows"] = invoice::get_list($_FORM);
$TPL["_FORM"] = $_FORM;
if (!$current_user->prefs["invoiceList_filter"]) {
    $TPL["message_help"][] = "\n\nallocPSA allows you to create Invoices for your Clients and record the\npayment status of those Invoices. This page allows you to view a list of\nInvoices.\n\n<br><br>\n\nSimply adjust the filter settings and click the <b>Filter</b> button to\ndisplay a list of previously created Invoices. \nIf you would prefer to create a new Invoice, click the <b>New Invoice</b> link\nin the top-right hand corner of the box below.";
}
$TPL["main_alloc_title"] = "Invoice List - " . APPLICATION_NAME;
include_template("templates/invoiceListM.tpl");
Exemplo n.º 3
0
            $TPL["field_expenseFormComment"] = page::textarea("expenseFormComment", $expenseForm->get_value("expenseFormComment", DST_HTML_DISPLAY));
        }
    }
}
if (is_object($expenseForm) && $expenseForm->get_id()) {
    $db = new db_alloc();
    $db->query(prepare("SELECT SUM(amount * pow(10,-currencyType.numberToBasic)) AS amount, \n                             transaction.currencyTypeID as currency\n                        FROM transaction\n                   LEFT JOIN currencyType on transaction.currencyTypeID = currencyType.currencyTypeID\n                       WHERE expenseFormID = %d\n                    GROUP BY transaction.currencyTypeID\n                  ", $expenseForm->get_id()));
    while ($row = $db->row()) {
        $rows[] = $row;
    }
    $TPL["formTotal"] = page::money_print($rows);
}
if (is_object($expenseForm) && $current_user->have_role("admin") && !$expenseForm->get_invoice_link() && $expenseForm->get_value("expenseFormFinalised") && $expenseForm->get_value("seekClientReimbursement")) {
    $ops["invoiceStatus"] = "edit";
    $ops["clientID"] = $expenseForm->get_value("clientID");
    $invoice_list = invoice::get_list($ops);
    $invoice_list = array_kv($invoice_list, "invoiceID", array("invoiceNum", "invoiceName"));
    $q = prepare("SELECT * FROM invoiceItem WHERE expenseFormID = %d", $expenseForm->get_id());
    $db = new db_alloc();
    $db->query($q);
    $row = $db->row();
    $sel_invoice = $row["invoiceID"];
    $TPL["attach_to_invoice_button"] = "<select name=\"attach_to_invoiceID\">";
    $TPL["attach_to_invoice_button"] .= "<option value=\"create_new\">Create New Invoice</option>";
    $TPL["attach_to_invoice_button"] .= page::select_options($invoice_list, $sel_invoice) . "</select>";
    $TPL["attach_to_invoice_button"] .= "<input type=\"submit\" name=\"attach_transactions_to_invoice\" value=\"Add to Invoice\"> ";
    $TPL["invoice_label"] = "Invoice:";
}
if (is_object($expenseForm)) {
    $invoice_link = $expenseForm->get_invoice_link();
    if ($invoice_link) {