Exemplo n.º 1
0
        $expenseForm = new expenseForm();
    }
}
if ($_POST["add"]) {
    $_POST["product"] or alloc_error("You must enter a Product.");
    $_POST["companyDetails"] or alloc_error("You must enter the Company Details.");
    $_POST["fromTfID"] or alloc_error("You must enter the Source TF.");
    $_POST["quantity"] or $_POST["quantity"] = 1;
    config::get_config_item("mainTfID") or alloc_error("You must configure the Finance Tagged Fund on the Setup -> Finance screen.");
    if ($_POST["amount"] === "") {
        alloc_error("You must enter the Price.");
    }
    $_POST["amount"] = $_POST["amount"] * $_POST["quantity"];
    $transaction = new transaction();
    $transactionID && $transaction->set_id($_POST["transactionID"]);
    $transaction->read_globals();
    // check we have permission to make the transaction
    if (!$transaction->have_perm(PERM_CREATE)) {
        alloc_error("You do not have permission to create transactions for that Source TF.");
    }
    if (!count($TPL["message"])) {
        $transaction->set_value("transactionType", "expense");
        $transaction->set_value("expenseFormID", $expenseForm->get_id());
        $transaction->set_value("tfID", config::get_config_item("mainTfID"));
        $transaction->save();
    } else {
        $transaction_to_edit = $transaction;
    }
}
if ($_POST["edit"] && $_POST["expenseFormID"] && $_POST["transactionID"]) {
    $transaction_to_edit->set_id($_POST["transactionID"]);
Exemplo n.º 2
0
        if ($_POST["a_button"]) {
            $status = "approved";
        } else {
            if ($_POST["r_button"]) {
                $status = "rejected";
            }
        }
    }
    $query = prepare("UPDATE transaction SET status = '%s' WHERE timeSheetID = %d AND transactionType != 'invoice'", $status, $timeSheet->get_id());
    $db = new db_alloc();
    $db->query($query);
    // Take care of the transaction line items on an invoiced timesheet created by admin
} else {
    if (($_POST["transaction_save"] || $_POST["transaction_delete"]) && $timeSheet->have_perm(PERM_TIME_INVOICE_TIMESHEETS)) {
        $transaction = new transaction();
        $transaction->read_globals();
        $transaction->read_globals("transaction_");
        if ($_POST["transaction_save"]) {
            if (is_numeric($_POST["percent_dropdown"])) {
                $transaction->set_value("amount", $_POST["percent_dropdown"]);
            }
            $transaction->set_value("currencyTypeID", $timeSheet->get_value("currencyTypeID"));
            $transaction->save();
        } else {
            if ($_POST["transaction_delete"]) {
                $transaction->delete();
            }
        }
    }
}
// display the approved by admin and managers name and date