Example #1
0
            echo "<br>Skipping because tf not active: " . $tf->get_value("tfName");
            continue 2;
        }
        $tf = new tf();
        $tf->set_id($transactionRepeat->get_value("fromTfID"));
        $tf->select();
        if (!$tf->get_value("tfActive")) {
            echo "<br>Skipping because tf not active: " . $tf->get_value("tfName");
            continue 2;
        }
        $amount = page::money_out($transactionRepeat->get_value("currencyTypeID"), $transactionRepeat->get_value("amount"));
        $transaction = new transaction();
        $transaction->set_value("fromTfID", $transactionRepeat->get_value("fromTfID"));
        $transaction->set_value("tfID", $transactionRepeat->get_value("tfID"));
        $transaction->set_value("companyDetails", $transactionRepeat->get_value("companyDetails"));
        $transaction->set_value("amount", $amount);
        $transaction->set_value("currencyTypeID", $transactionRepeat->get_value("currencyTypeID"));
        $transaction->set_value("product", $transactionRepeat->get_value("product"));
        $transaction->set_value("transactionType", $transactionRepeat->get_value("transactionType"));
        $transaction->set_value("status", "pending");
        $transaction->set_value("transactionRepeatID", $transactionRepeat->get_id());
        $transaction->set_value("transactionDate", date("Y-m-d", $nextScheduled));
        $transaction->save();
        echo "\n<br>" . $transaction->get_value("transactionDate");
        echo " " . $transactionRepeat->get_value("paymentBasis") . " \$" . $transaction->get_value("amount") . " for TF: " . tf::get_name($transaction->get_value("tfID"));
        echo " (transactionID: " . $transaction->get_id() . " transactionRepeatID:" . $transactionRepeat->get_id() . " name:" . $transactionRepeat->get_value("product") . ")";
        $nextScheduled = timeWarp($nextScheduled, $timeBasisString);
    }
}
$TPL["main_alloc_title"] = "Execute Repeating Expenses - " . APPLICATION_NAME;
include_template("templates/checkRepeatM.tpl");
Example #2
0
    $transaction->get_value("transactionType") or alloc_error("You must set a transaction type");
    $transaction->get_value("currencyTypeID") or alloc_error("You must set a transaction currency");
    #$transaction->get_value("projectID")       or alloc_error("You must select a project");
    #$transaction->get_value("companyDetails")  or alloc_error("You must enter the company details");
    if (!count($TPL["message"])) {
        $transaction->set_value("amount", str_replace(array("\$", ","), "", $transaction->get_value("amount")));
        if ($transaction->save()) {
            // need to check this again as transaction->save might have triggered an error
            $TPL["message_good"][] = "Transaction Saved";
            if ($_POST["saveAndNew"]) {
                alloc_redirect($TPL["url_alloc_transaction"] . "new=true");
            }
            if ($_POST["saveGoTf"]) {
                alloc_redirect($TPL["url_alloc_transactionList"] . "tfID=" . $transaction->get_value("tfID"));
            }
            alloc_redirect($TPL["url_alloc_transaction"] . "transactionID=" . $transaction->get_id());
        }
    }
} else {
    if ($_POST["delete"]) {
        $transaction->delete();
        alloc_redirect($TPL["url_alloc_transactionList"] . "tfID=" . $transaction->get_value("tfID"));
    }
}
$transaction->set_tpl_values();
$t = new meta("currencyType");
$currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID");
$TPL["currencyOptions"] = page::select_options($currency_array, $transaction->get_value("currencyTypeID"));
$TPL["product"] = page::htmlentities($transaction->get_value("product"));
$TPL["statusOptions"] = page::select_options(array("pending" => "Pending", "rejected" => "Rejected", "approved" => "Approved"), $transaction->get_value("status"));
$transactionTypes = transaction::get_transactionTypes();
Example #3
0
                $transaction->delete();
                $deleted .= $commar1 . $transactionID;
                $commar1 = ", ";
                // Save
            } else {
                if ($_POST["amount"][$k]) {
                    $a = array("amount" => $_POST["amount"][$k], "tfID" => $_POST["tfID"][$k], "fromTfID" => $_POST["fromTfID"][$k], "product" => $_POST["product"][$k], "description" => $_POST["description"][$k], "transactionType" => $_POST["transactionType"][$k], "transactionDate" => $_POST["transactionDate"][$k], "status" => $_POST["status"][$k], "transactionGroupID" => $transactionGroupID, "transactionID" => $_POST["transactionID"][$k]);
                    $transaction = new transaction();
                    if ($_POST["transactionID"][$k]) {
                        $transaction->set_id($_POST["transactionID"][$k]);
                        $transaction->select();
                    }
                    $transaction->read_array($a);
                    $v = $transaction->validate();
                    if ($v == "") {
                        $transaction->save();
                        $saved .= $commar2 . $transaction->get_id();
                        $commar2 = ", ";
                    } else {
                        alloc_error(implode("<br>", $v));
                    }
                }
            }
        }
    }
    $saved and $TPL["message_good"][] = "Transaction " . $saved . " saved.";
    $deleted and $TPL["message_good"][] = "Transaction " . $deleted . " deleted.";
    alloc_redirect($TPL["url_alloc_transactionGroup"] . "transactionGroupID=" . $transactionGroupID);
}
$TPL["main_alloc_title"] = "Edit Transactions - " . APPLICATION_NAME;
include_template("templates/transactionGroupM.tpl");