Пример #1
0
function show_all_exp($template)
{
    global $TPL;
    global $expenseForm;
    global $db;
    global $transaction_to_edit;
    if ($expenseForm->get_id()) {
        if ($_POST["transactionID"] && ($_POST["edit"] || is_object($transaction_to_edit) && $transaction_to_edit->get_id())) {
            // if edit is clicked OR if we've rejected changes made to something so are still editing it
            $query = prepare("SELECT * FROM transaction WHERE expenseFormID=%d AND transactionID<>%d ORDER BY transactionID DESC", $expenseForm->get_id(), $_POST["transactionID"]);
        } else {
            $query = prepare("SELECT * FROM transaction WHERE expenseFormID=%d ORDER BY transactionID DESC", $expenseForm->get_id());
        }
        $db->query($query);
        while ($db->next_record()) {
            $transaction = new transaction();
            $transaction->read_db_record($db);
            $transaction->set_values();
            $transaction->get_value("quantity") and $TPL["amount"] = $transaction->get_value("amount") / $transaction->get_value("quantity");
            $TPL["lineTotal"] = $TPL["amount"] * $transaction->get_value("quantity");
            $tf = new tf();
            $tf->set_id($transaction->get_value("fromTfID"));
            $tf->select();
            $TPL["fromTfIDLink"] = $tf->get_link();
            $tf = new tf();
            $tf->set_id($transaction->get_value("tfID"));
            $tf->select();
            $TPL["tfIDLink"] = $tf->get_link();
            $projectID = $transaction->get_value("projectID");
            if ($projectID) {
                $project = new project();
                $project->set_id($transaction->get_value("projectID"));
                $project->select();
                $TPL["projectName"] = $project->get_value("projectName");
            }
            if ($transaction->get_value("fromTfID") == config::get_config_item("expenseFormTfID")) {
                $TPL['expense_class'] = "loud";
            } else {
                $TPL['expense_class'] = "";
            }
            include_template($template);
        }
    }
}
Пример #2
0
    }
    $TPL["invoice_links"] .= "<a href=\"" . $TPL["url_alloc_invoice"] . "clientID=" . $clientID . "&projectID=" . $project->get_id() . "\">New Invoice</a>";
}
$TPL["navigation_links"] = $project->get_navigation_links();
$query = prepare("SELECT tfID AS value, tfName AS label \n                    FROM tf \n                   WHERE tfActive = 1\n                ORDER BY tfName");
$TPL["commission_tf_options"] = page::select_options($query, $TPL["commission_tfID"]);
$TPL["cost_centre_tfID_options"] = page::select_options($query, $TPL["project_cost_centre_tfID"]);
$db->query($query);
while ($db->row()) {
    $tf_array[$db->f("value")] = $db->f("label");
}
if ($TPL["project_cost_centre_tfID"]) {
    $tf = new tf();
    $tf->set_id($TPL["project_cost_centre_tfID"]);
    $tf->select();
    $TPL["cost_centre_tfID_label"] = $tf->get_link();
}
$query = prepare("SELECT roleName,roleID FROM role WHERE roleLevel = 'project' ORDER BY roleSequence");
$db->query($query);
#$project_person_role_array[] = "";
while ($db->next_record()) {
    $project_person_role_array[$db->f("roleID")] = $db->f("roleName");
}
$email_type_array = array("None" => "None", "Assigned Tasks" => "Assigned Tasks", "All Tasks" => "All Tasks");
$t = new meta("currencyType");
$currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID");
$projectType_array = project::get_project_type_array();
$m = new meta("projectStatus");
$projectStatus_array = $m->get_assoc_array("projectStatusID", "projectStatusID");
$timeUnit = new timeUnit();
$rate_type_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelB");
Пример #3
0
#   }
# }
$TPL["field_invoiceNum"] = '<input type="text" name="invoiceNum" value="' . $TPL["invoiceNum"] . '">';
$TPL["field_invoiceName"] = '<input type="text" name="invoiceName" value="' . $TPL["invoiceName"] . '">';
$TPL["field_maxAmount"] = '<input type="text" name="maxAmount" size="10" value="' . $invoice->get_value("maxAmount", DST_HTML_DISPLAY) . '"> ';
$TPL["field_maxAmount"] .= page::help('invoice_maxAmount');
$TPL["field_invoiceDateFrom"] = page::calendar("invoiceDateFrom", $TPL["invoiceDateFrom"]);
$TPL["field_invoiceDateTo"] = page::calendar("invoiceDateTo", $TPL["invoiceDateTo"]);
$clientID = $invoice->get_value("clientID") or $clientID = $_GET["clientID"];
$projectID = $invoice->get_value("projectID") or $projectID = $_GET["projectID"];
list($client_select, $client_link, $project_select, $project_link) = client::get_client_and_project_dropdowns_and_links($clientID, $projectID);
$tf = new tf();
if ($invoice->get_value("tfID")) {
    $tf->set_id($invoice->get_value("tfID"));
    $tf->select();
    $tf_link = $tf->get_link();
    $tf_sel = $invoice->get_value("tfID");
}
$tf_sel or $tf_sel = config::get_config_item("mainTfID");
$tf_select = "<select id='tfID' name='tfID'>" . page::select_options($tf->get_assoc_array("tfID", "tfName"), $tf_sel) . "</select>";
// Main invoice buttons
if ($current_user->have_role('admin')) {
    if (!$invoiceID) {
        $_GET["clientID"] and $TPL["clientID"] = $_GET["clientID"];
        $TPL["invoice_buttons"] = '
         <button type="submit" name="save" value="1" class="save_button">Create Invoice<i class="icon-ok-sign"></i></button>
    ';
        $TPL["field_clientID"] = $client_select;
        $TPL["field_projectID"] = $project_select;
        $TPL["field_tfID"] = $tf_select;
    } else {
Пример #4
0
is_object($transaction) and $TPL["transactionTypeLink"] = $transaction->get_transaction_type_link();
$db = new db_alloc();
$tf = new tf();
$options = $tf->get_assoc_array("tfID", "tfName");
// Special cases for the current tfID and fromTfID
$options = add_tf($transaction->get_value("tfID"), $options, "tfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)");
$options = add_tf($transaction->get_value("fromTfID"), $options, "fromTfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)");
$TPL["tfIDOptions"] = page::select_options($options, $transaction->get_value("tfID"));
$TPL["fromTfIDOptions"] = page::select_options($options, $transaction->get_value("fromTfID"));
$q = "SELECT projectID as value, projectName as label FROM project WHERE projectStatus = 'Current' ORDER BY projectName";
$TPL["projectIDOptions"] = page::select_options($q, $transaction->get_value("projectID"));
$TPL["transactionModifiedUser"] = page::htmlentities(person::get_fullname($TPL["transactionModifiedUser"]));
$TPL["transactionCreatedUser"] = page::htmlentities(person::get_fullname($TPL["transactionCreatedUser"]));
$tf1 = new tf();
$tf1->set_id($TPL["tfID"]);
$tf1->select();
$TPL["tf_link"] = $tf1->get_link();
$tf2 = new tf();
$tf2->set_id($TPL["fromTfID"]);
$tf2->select();
$TPL["from_tf_link"] = $tf2->get_link();
$p = $transaction->get_foreign_object("project");
$TPL["project_link"] = $p->get_link();
$TPL["taxName"] = config::get_config_item("taxName");
if (is_object($current_user) && !$current_user->have_role("admin") && is_object($transaction) && in_array($transaction->get_value("status"), array("approved", "rejected"))) {
    $TPL["main_alloc_title"] = "View Transaction - " . APPLICATION_NAME;
    include_template("templates/viewTransactionM.tpl");
} else {
    $TPL["main_alloc_title"] = "Create Transaction - " . APPLICATION_NAME;
    include_template("templates/editTransactionM.tpl");
}
Пример #5
0
    define("CAN_APPROVE_TRANSACTIONS", 0);
}
$statuses = productSale::get_statii();
$statuses[$TPL["status"]] = "<b>" . $statuses[$TPL["status"]] . "</b>";
$TPL["statusText"] = implode("&nbsp;&nbsp;|&nbsp;&nbsp;", $statuses);
$TPL["productSaleID"] = $productSale->get_id();
$showCosts = $_POST["showCosts"] or $_showCosts = $_GET["showCosts"];
$productSale->set_values();
list($client_select, $client_link, $project_select, $project_link) = client::get_client_and_project_dropdowns_and_links($clientID, $projectID);
$TPL["show_client_options"] = $client_link;
$TPL["show_project_options"] = $project_link;
$tf = new tf();
if ($productSale->get_value("tfID")) {
    $tf->set_id($productSale->get_value("tfID"));
    $tf->select();
    $TPL["show_tf_options"] = $tf->get_link();
    $tf_sel = $productSale->get_value("tfID");
}
$tf_sel or $tf_sel = config::get_config_item("mainTfID");
$tf_select = "<select name='tfID'>" . page::select_options($tflist, $tf_sel) . "</select>";
$TPL["show_person_options"] = person::get_fullname($productSale->get_value("personID"));
$TPL["show_date"] = $productSale->get_value("productSaleDate");
$TPL["show_extRef"] = $productSale->get_value("extRef");
$TPL["show_extRefDate"] = $productSale->get_value("extRefDate");
if (!$productSale->get_id() || $productSale->get_value("status") != "finished" && !($productSale->get_value("status") == "admin" && !CAN_APPROVE_TRANSACTIONS)) {
    $TPL["show_client_options"] = $client_select;
    $TPL["show_project_options"] = $project_select;
    $TPL["show_tf_options"] = $tf_select;
    $personID = $productSale->get_value("personID") or $personID = $current_user->get_id();
    $TPL["show_person_options"] = "<select name='personID'>" . page::select_options(person::get_username_list($personID), $personID) . "</select>";
    $TPL["show_date"] = page::calendar("productSaleDate", $productSale->get_value("productSaleDate"));