Exemple #1
0
} else {
    if (check_optional_has_line_items() && !$expenseForm->get_value("expenseFormFinalised")) {
        $TPL["message_help"][] = "Step 3/4: When finished adding Expense Form Line Items, click the To Admin button to finalise the Expense Form.";
    } else {
        if (is_object($expenseForm) && $expenseForm->get_id() && !$expenseForm->get_value("expenseFormFinalised")) {
            $TPL["message_help"][] = "Step 2/4: Add Expense Form Line Items by filling in the details and clicking the Add Expense Form Line Item button.";
        } else {
            if (!is_object($expenseForm) || !$expenseForm->get_id()) {
                $TPL["message_help"][] = "Step 1/4: Begin an Expense Form by choosing the Payment Method and then clicking the Create Expense Form button.";
            }
        }
    }
}
$paymentOptionNames = array("", "COD", "Cheque", "Company Amex Charge", "Company Amex Blue", "Company Virgin MasterCard", "Other Credit Card", "Account", "Direct Deposit");
$paymentOptions = page::select_options($paymentOptionNames, $expenseForm->get_value("paymentMethod"));
$rr_options = expenseForm::get_reimbursementRequired_array();
$rr_checked[sprintf("%d", $expenseForm->get_value("reimbursementRequired"))] = " checked";
$expenseForm->get_value("paymentMethod") and $extra = " (" . $paymentOptionNames[$expenseForm->get_value("paymentMethod")] . ")";
$rr_label = $rr_options[$expenseForm->get_value("reimbursementRequired")] . $extra;
$TPL["rr_label"] = $rr_options[$expenseForm->get_value("reimbursementRequired")] . $extra;
foreach ($rr_options as $value => $label) {
    unset($extra);
    $value == 2 and $extra = " <select name=\"paymentMethod\">" . $paymentOptions . "</select>";
    $reimbursementRequiredRadios .= $br . "<input type=\"radio\" name=\"reimbursementRequired\" value=\"" . $value . "\"" . $rr_checked[$value] . ">" . $label . $extra;
    $br = "<br>";
}
$TPL["paymentMethodOptions"] = $expenseForm->get_value("paymentMethod");
$TPL["reimbursementRequiredOption"] = $rr_label;
$scr_label = "No";
if ($expenseForm->get_value("seekClientReimbursement")) {
    $scr_sel = " checked";
Exemple #2
0
 public static function get_list($_FORM = array())
 {
     global $TPL;
     $filter = expenseForm::get_list_filter($_FORM);
     if (is_array($filter) && count($filter)) {
         $f = " AND " . implode(" AND ", $filter);
     }
     $db = new db_alloc();
     $dbTwo = new db_alloc();
     $transDB = new db_alloc();
     $expenseForm = new expenseForm();
     $transaction = new transaction();
     $rr_options = expenseForm::get_reimbursementRequired_array();
     $q = prepare("SELECT expenseForm.*\n                        ,SUM(transaction.amount * pow(10,-currencyType.numberToBasic)) as formTotal\n                        ,transaction.currencyTypeID\n                    FROM expenseForm, transaction\n               LEFT JOIN currencyType on transaction.currencyTypeID = currencyType.currencyTypeID\n                   WHERE expenseForm.expenseFormID = transaction.expenseFormID\n                         " . $f . "\n                GROUP BY expenseForm.expenseFormID, transaction.currencyTypeID\n                ORDER BY expenseFormID");
     $db->query($q);
     while ($row = $db->row()) {
         $amounts[$row["expenseFormID"]] .= $sp[$row["expenseFormID"]] . page::money($row["currencyTypeID"], $row["formTotal"], "%s%m");
         $sp[$row["expenseFormID"]] = " + ";
         $allrows[$row["expenseFormID"]] = $row;
     }
     foreach ((array) $allrows as $expenseFormID => $row) {
         $expenseForm = new expenseForm();
         if ($expenseForm->read_row_record($row)) {
             $expenseForm->set_values();
             $row["formTotal"] = $amounts[$expenseFormID];
             $row["expenseFormModifiedUser"] = person::get_fullname($expenseForm->get_value("expenseFormModifiedUser"));
             $row["expenseFormModifiedTime"] = $expenseForm->get_value("expenseFormModifiedTime");
             $row["expenseFormCreatedUser"] = person::get_fullname($expenseForm->get_value("expenseFormCreatedUser"));
             $row["expenseFormCreatedTime"] = $expenseForm->get_value("expenseFormCreatedTime");
             unset($extra);
             $expenseForm->get_value("paymentMethod") and $extra = " (" . $expenseForm->get_value("paymentMethod") . ")";
             $row["rr_label"] = $rr_options[$expenseForm->get_value("reimbursementRequired")] . $extra;
             $rows[] = $row;
         }
     }
     return (array) $rows;
 }