示例#1
0
function show_transaction_new($template)
{
    global $TPL;
    global $tflist;
    $transaction = new transaction();
    $transaction->set_values();
    // wipe clean
    $TPL["display"] = "display:none";
    $TPL["tfList_dropdown"] = page::select_options($tflist, NULL, 500);
    $TPL["fromTfList_dropdown"] = page::select_options($tflist, NULL, 500);
    $TPL["transactionType_dropdown"] = page::select_options(transaction::get_transactionTypes());
    $TPL["status_dropdown"] = page::select_options(transaction::get_transactionStatii());
    $TPL["link"] = "";
    include_template($template);
}
示例#2
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);
        }
    }
}
示例#3
0
function show_transaction($template)
{
    global $db;
    global $TPL;
    global $projectID;
    $current_user =& singleton("current_user");
    $transaction = new transaction();
    if (isset($projectID) && $projectID) {
        $query = prepare("SELECT transaction.*\n                          FROM transaction\n                          WHERE transaction.projectID = %d\n                      ORDER BY transactionModifiedTime desc\n                        ", $projectID);
        $db->query($query);
        while ($db->next_record()) {
            $transaction = new transaction();
            $transaction->read_db_record($db);
            $transaction->set_values("transaction_");
            $tf = $transaction->get_foreign_object("tf");
            $tf->set_values();
            $tf->set_values("tf_");
            $TPL["transaction_username"] = $db->f("username");
            $TPL["transaction_amount"] = page::money($TPL["transaction_currenyTypeID"], $TPL["transaction_amount"], "%s%mo");
            $TPL["transaction_type_link"] = $transaction->get_transaction_type_link() or $TPL["transaction_link"] = $transaction->get_value("transactionType");
            include_template($template);
        }
    }
}
示例#4
0
    $invoice = $transaction->get_foreign_object("invoice");
}
$invoice->set_values();
if ($invoice->get_id()) {
    $TPL["invoice_link"] = "<a href=\"" . $TPL["url_alloc_invoice"] . "invoiceID=" . $invoice->get_id() . "\">#" . $invoice->get_value("invoiceNum");
    $TPL["invoice_link"] .= " " . $invoice->get_value("invoiceDateFrom") . " to " . $invoice->get_value("invoiceDateTo") . "</a>";
}
$expenseForm = $transaction->get_foreign_object("expenseForm");
if ($expenseForm->get_id()) {
    $TPL["expenseForm_link"] = "<a href=\"" . $TPL["url_alloc_expenseForm"] . "expenseFormID=" . $expenseForm->get_id() . "\">#" . $expenseForm->get_id() . "</a>";
}
$timeSheet = $transaction->get_foreign_object("timeSheet");
if ($timeSheet->get_id()) {
    $TPL["timeSheet_link"] = "<a href=\"" . $TPL["url_alloc_timeSheet"] . "timeSheetID=" . $timeSheet->get_id() . "\">#" . $timeSheet->get_id() . "</a>";
}
$transaction->set_values();
if ($_POST["save"] || $_POST["saveAndNew"] || $_POST["saveGoTf"]) {
    /*
      if ($transaction->get_value("status") != "pending") {
        alloc_error("This transaction is no longer editable.");
      }
    */
    $transaction->read_globals();
    // Tweaked validation to allow reporting of multiple errors
    $transaction->get_value("amount") or alloc_error("You must enter a valid amount");
    $transaction->get_value("transactionDate") or alloc_error("You must enter a date for the transaction");
    $transaction->get_value("product") or alloc_error("You must enter a product");
    $transaction->get_value("status") or alloc_error("You must set the status of the transaction");
    $transaction->get_value("fromTfID") or alloc_error("You must select a Source Tagged Fund to take this transaction from");
    $transaction->get_value("tfID") or alloc_error("You must select a Destination Tagged Fund to add this transaction against");
    $transaction->get_value("transactionType") or alloc_error("You must set a transaction type");
示例#5
0
function show_transaction_new($template)
{
    global $TPL;
    global $tflist;
    $transaction = new transaction();
    $transaction->set_values();
    // wipe clean
    $TPL["display"] = "display:none";
    $m = new meta("currencyType");
    $currencyOptions = $m->get_assoc_array("currencyTypeID", "currencyTypeID");
    $TPL["currencyOptions"] = page::select_options($currencyOptions);
    $TPL["tfList_dropdown"] = page::select_options($tflist);
    $TPL["fromTfList_dropdown"] = page::select_options($tflist);
    if (CAN_APPROVE_TRANSACTIONS && $TPL["productSale_status"] == "admin") {
        $TPL["status"] = "<select name='status[]' class='txStatus'>";
        $TPL["status"] .= page::select_options(transaction::get_transactionStatii()) . "</select>";
    }
    $TPL["pc_productCostID"] = '';
    $TPL["pc_amount"] = '';
    $TPL["pc_isPercentage"] = '';
    $TPL["pc_currency"] = '';
    $TPL["amountClass"] = '';
    include_template($template);
}
示例#6
0
 function get_pending_repeat_transaction_list()
 {
     global $TPL;
     $transactionTypes = transaction::get_transactionTypes();
     $q = "SELECT * FROM transaction \n              LEFT JOIN transactionRepeat on transactionRepeat.transactionRepeatID = transaction.transactionRepeatID \n                  WHERE transaction.transactionRepeatID IS NOT NULL AND transaction.status = 'pending'";
     $db = new db_alloc();
     $db->query($q);
     while ($row = $db->row()) {
         $transaction = new transaction();
         $transaction->read_db_record($db);
         $transaction->set_values();
         $transactionRepeat = new transactionRepeat();
         $transactionRepeat->read_db_record($db);
         $transactionRepeat->set_values();
         $row["transactionType"] = $transactionTypes[$transaction->get_value("transactionType")];
         $row["formTotal"] = $db->f("amount");
         $row["transactionModifiedTime"] = $transaction->get_value("transactionModifiedTime");
         $row["transactionCreatedTime"] = $transaction->get_value("transactionCreatedTime");
         $row["transactionCreatedUser"] = person::get_fullname($transaction->get_value("transactionCreatedUser"));
         $rows[] = $row;
     }
     return (array) $rows;
 }