コード例 #1
0
function show_expenseFormList($template_name)
{
    global $db;
    global $TPL;
    global $transactionRepeat;
    $current_user =& singleton("current_user");
    $db = new db_alloc();
    $transactionRepeat = new transactionRepeat();
    if (!$_GET["tfID"] && !$current_user->have_role("admin")) {
        $tfIDs = $current_user->get_tfIDs();
        $tfIDs and $sql = prepare("WHERE tfID in (%s)", $tfIDs);
    } else {
        if ($_GET["tfID"]) {
            $sql = prepare("WHERE tfID = %d", $_GET["tfID"]);
        }
    }
    $db->query("select * FROM transactionRepeat " . $sql);
    while ($db->next_record()) {
        $i++;
        $transactionRepeat->read_db_record($db);
        $transactionRepeat->set_values();
        $TPL["tfName"] = tf::get_name($transactionRepeat->get_value("tfID"));
        $TPL["fromTfName"] = tf::get_name($transactionRepeat->get_value("fromTfID"));
        include_template($template_name);
    }
    $TPL["tfID"] = $tfID;
}
コード例 #2
0
ファイル: transactionRepeat.php プロジェクト: cjbayliss/alloc
 * allocPSA is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "../alloc.php";
$current_user->check_employee();
$transactionRepeat = new transactionRepeat();
$db = new db_alloc();
global $TPL;
global $transactionRepeatID;
$transactionRepeatID = $_POST["transactionRepeatID"] or $transactionRepeatID = $_GET["transactionRepeatID"];
if ($transactionRepeatID) {
    $transactionRepeat->set_id($transactionRepeatID);
    $transactionRepeat->select();
    $transactionRepeat->set_values();
}
if (!isset($_POST["reimbursementRequired"])) {
    $_POST["reimbursementRequired"] = 0;
}
if ($_POST["save"] || $_POST["delete"] || $_POST["pending"] || $_POST["approved"] || $_POST["rejected"]) {
    $transactionRepeat->read_globals();
    if ($current_user->have_role("admin")) {
コード例 #3
0
ファイル: checkRepeat.php プロジェクト: cjbayliss/alloc
        return mktime(0, 0, 0, date("m", $mostRecent) + 1, date("d", $mostRecent), date("Y", $mostRecent));
    }
    if ($basis == "quarterly") {
        return mktime(0, 0, 0, date("m", $mostRecent) + 3, date("d", $mostRecent), date("Y", $mostRecent));
    }
    if ($basis == "yearly") {
        return mktime(0, 0, 0, date("m", $mostRecent), date("d", $mostRecent), date("Y", $mostRecent) + 1);
    }
}
$db = new db_alloc();
$dbMaxDate = new db_alloc();
$today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
echo "<br>" . date("Y-m-d") . "<br>";
$db->query("select * from transactionRepeat WHERE status = 'approved'");
while ($db->next_record()) {
    $transactionRepeat = new transactionRepeat();
    $transactionRepeat->read_db_record($db);
    $startDate = format_date("U", $transactionRepeat->get_value("transactionStartDate"));
    $finishDate = format_date("U", $transactionRepeat->get_value("transactionFinishDate"));
    $timeBasisString = $transactionRepeat->get_value("paymentBasis");
    $query = prepare("SELECT max(transactionDate) AS latestDate FROM transaction WHERE transactionRepeatID=%d", $transactionRepeat->get_id());
    $dbMaxDate->query($query);
    $dbMaxDate->next_record();
    if (!$dbMaxDate->f("latestDate")) {
        $nextScheduled = timeWarp($startDate, $timeBasisString);
    } else {
        $mostRecentTransactionDate = format_date("U", $dbMaxDate->f("latestDate"));
        $nextScheduled = timeWarp($mostRecentTransactionDate, $timeBasisString);
    }
    echo "<br>Attempting repeating transaction: " . $transactionRepeat->get_value("product") . " ... ";
    //echo '<br><br>$nextScheduled <= $today && $nextScheduled >= $startDate && $nextScheduled <= $finishDate';
コード例 #4
0
ファイル: expenseForm.inc.php プロジェクト: cjbayliss/alloc
 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;
 }