Exemplo n.º 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;
}
Exemplo n.º 2
0
 function validate()
 {
     $current_user =& singleton("current_user");
     $this->get_value("fromTfID") or $err[] = "Unable to save transaction without a Source TF.";
     $this->get_value("fromTfID") && $this->get_value("fromTfID") == $this->get_value("tfID") and $err[] = "Unable to save transaction with Source TF (" . tf::get_name($this->get_value("fromTfID")) . ") being the same as the Destination TF (" . tf::get_name($this->get_value("tfID")) . ") \"" . $this->get_value("product") . "\"";
     $this->get_value("quantity") or $this->set_value("quantity", 1);
     $this->get_value("transactionDate") or $this->set_value("transactionDate", date("Y-m-d"));
     $old = $this->all_row_fields;
     $status = $old["status"] or $status = $this->get_value("status");
     if ($status != "pending" && !$current_user->have_role("admin")) {
         $err[] = "Unable to save transaction unless status is pending.";
     }
     if ($old["status"] == "pending" && $old["status"] != $this->get_value("status") && !$current_user->have_role("admin")) {
         $err[] = "Unable to change transaction status unless you have admin perm.";
     }
     return parent::validate($err);
 }
Exemplo n.º 3
0
function show_transaction_listR($template_name)
{
    global $timeSheet;
    global $TPL;
    $current_user =& singleton("current_user");
    global $percent_array;
    $db = new db_alloc();
    $db->query("SELECT * FROM transaction WHERE timeSheetID = %d", $timeSheet->get_id());
    if ($db->next_record() || $timeSheet->get_value("status") == "invoiced" || $timeSheet->get_value("status") == "finished") {
        $db->query("SELECT * \n                    FROM tf \n                   WHERE tfActive = 1\n                      OR tfID = %d \n                      OR tfID = %d \n                ORDER BY tfName", $db->f("tfID"), $db->f("fromTfID"));
        while ($db->row()) {
            $tf_array[$db->f("tfID")] = $db->f("tfName");
        }
        $status_options = array("pending" => "Pending", "approved" => "Approved", "rejected" => "Rejected");
        $transactionType_options = transaction::get_transactionTypes();
        if ($timeSheet->have_perm(PERM_TIME_INVOICE_TIMESHEETS) && $timeSheet->get_value("status") == "invoiced") {
            $db->query("SELECT * FROM transaction WHERE timeSheetID = %d ORDER BY transactionID", $timeSheet->get_id());
            while ($db->next_record()) {
                $transaction = new transaction();
                $transaction->read_db_record($db);
                $transaction->set_tpl_values("transaction_");
                $TPL["currency"] = page::money($transaction->get_value("currencyTypeID"), '', "%S");
                $TPL["currency_code"] = page::money($transaction->get_value("currencyTypeID"), '', "%C");
                $TPL["tf_options"] = page::select_options($tf_array, $TPL["transaction_tfID"]);
                $TPL["from_tf_options"] = page::select_options($tf_array, $TPL["transaction_fromTfID"]);
                $TPL["status_options"] = page::select_options($status_options, $transaction->get_value("status"));
                $TPL["transactionType_options"] = page::select_options($transactionType_options, $transaction->get_value("transactionType"));
                $TPL["percent_dropdown"] = page::select_options($percent_array, $empty);
                $TPL["transaction_buttons"] = '
            <button type="submit" name="transaction_delete" value="1" class="delete_button">Delete<i class="icon-trash"></i></button>
            <button type="submit" name="transaction_save" value="1" class="save_button">Save<i class="icon-ok-sign"></i></button>
          ';
                if ($transaction->get_value("transactionType") == "invoice") {
                    $TPL["transaction_transactionType"] = $transaction->get_transaction_type_link();
                    $TPL["transaction_fromTfID"] = tf::get_name($transaction->get_value("fromTfID"));
                    $TPL["transaction_tfID"] = tf::get_name($transaction->get_value("tfID"));
                    $TPL["currency_amount"] = page::money($transaction->get_value("currencyTypeID"), $transaction->get_value("amount"), "%S%mo %c");
                    include_template("templates/timeSheetTransactionListViewR.tpl");
                } else {
                    include_template($template_name);
                }
            }
        } else {
            // If you don't have perm INVOICE TIMESHEETS then only select
            // transactions which you have permissions to see.
            $query = prepare("SELECT * \n                            FROM transaction \n                           WHERE timeSheetID = %d\n                        ORDER BY transactionID", $timeSheet->get_id());
            $db->query($query);
            while ($db->next_record()) {
                $transaction = new transaction();
                $transaction->read_db_record($db);
                $transaction->set_tpl_values("transaction_");
                unset($TPL["transaction_amount_pos"]);
                unset($TPL["transaction_amount_neg"]);
                $TPL["currency_amount"] = page::money($transaction->get_value("currencyTypeID"), $transaction->get_value("amount"), "%S%mo %c");
                $TPL["transaction_fromTfID"] = tf::get_name($transaction->get_value("fromTfID"));
                $TPL["transaction_tfID"] = tf::get_name($transaction->get_value("tfID"));
                $TPL["transaction_transactionType"] = $transactionType_options[$transaction->get_value("transactionType")];
                include_template("templates/timeSheetTransactionListViewR.tpl");
            }
        }
    }
}
Exemplo n.º 4
0
 if ($_POST["field_quotes"] == "double") {
     $quotes = "\"";
 }
 while ($db->next_record()) {
     $odd_even = $odd_even == "even" ? "odd" : "even";
     $TPL["result_row"] .= sprintf($start_row_separator, $odd_even);
     foreach ($fields as $k => $field) {
         $field = end(explode(".", $field));
         if (stripos("ModifiedUser", $field) !== FALSE || stripos("personID", $field) !== FALSE) {
             $person = new person();
             $person->set_id($db->f($field));
             $person->select();
             $result = $person->get_name(array("format" => "nick"));
         } else {
             if (stripos("tfID", $field) !== FALSE) {
                 $result = tf::get_name($db->f($field));
             } else {
                 $result = $db->f($field);
             }
         }
         $TPL["result_row"] .= $start_field_separator;
         $TPL["result_row"] .= $quotes . $result . $quotes;
         if (isset($fields[$k + 1]) || !$_POST["generate_file"]) {
             $TPL["result_row"] .= $end_field_separator;
         }
     }
     $TPL["result_row"] .= $end_row_separator;
     $counter++;
 }
 $TPL["counter"] = "Number of rows(s): " . $counter;
 if ($_POST["generate_file"]) {
Exemplo n.º 5
0
 function update_search_index_doc(&$index)
 {
     $p =& get_cached_table("person");
     $personID = $this->get_value("personID");
     $person_field = $personID . " " . $p[$personID]["username"] . " " . $p[$personID]["name"];
     $managerID = $this->get_value("approvedByManagerPersonID");
     $manager_field = $managerID . " " . $p[$managerID]["username"] . " " . $p[$managerID]["name"];
     $adminID = $this->get_value("approvedByAdminPersonID");
     $admin_field = $adminID . " " . $p[$adminID]["username"] . " " . $p[$adminID]["name"];
     $tf_field = $this->get_value("recipient_tfID") . " " . tf::get_name($this->get_value("recipient_tfID"));
     if ($this->get_value("projectID")) {
         $project = new project();
         $project->set_id($this->get_value("projectID"));
         $project->select();
         $projectName = $project->get_name();
         $projectShortName = $project->get_name(array("showShortProjectLink" => true));
         $projectShortName && $projectShortName != $projectName and $projectName .= " " . $projectShortName;
     }
     $q = prepare("SELECT dateTimeSheetItem, taskID, description, comment, commentPrivate \n                    FROM timeSheetItem \n                   WHERE timeSheetID = %d \n                ORDER BY dateTimeSheetItem ASC", $this->get_id());
     $db = new db_alloc();
     $db->query($q);
     while ($r = $db->row()) {
         $desc .= $br . $r["dateTimeSheetItem"] . " " . $r["taskID"] . " " . $r["description"] . "\n";
         $r["comment"] && $r["commentPrivate"] or $desc .= $r["comment"] . "\n";
         $br = "\n";
     }
     $doc = new Zend_Search_Lucene_Document();
     $doc->addField(Zend_Search_Lucene_Field::Keyword('id', $this->get_id()));
     $doc->addField(Zend_Search_Lucene_Field::Text('project', $projectName, "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('pid', $this->get_value("projectID"), "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('creator', $person_field, "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('desc', $desc, "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('status', $this->get_value("status"), "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('tf', $tf_field, "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('manager', $manager_field, "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('admin', $admin_field, "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('dateManager', str_replace("-", "", $this->get_value("dateSubmittedToManager")), "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('dateAdmin', str_replace("-", "", $this->get_value("dateSubmittedToAdmin")), "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('dateFrom', str_replace("-", "", $this->get_value("dateFrom")), "utf-8"));
     $doc->addField(Zend_Search_Lucene_Field::Text('dateTo', str_replace("-", "", $this->get_value("dateTo")), "utf-8"));
     $index->addDocument($doc);
 }
Exemplo n.º 6
0
function show_invoiceItem_list()
{
    global $invoiceID;
    global $TPL;
    global $invoice;
    $current_user =& singleton("current_user");
    $template = "templates/invoiceItemListR.tpl";
    $db = new db_alloc();
    $db2 = new db_alloc();
    $q = prepare("SELECT *\n                  FROM invoiceItem \n                 WHERE invoiceItem.invoiceID = %d \n              ORDER BY iiDate,invoiceItem.invoiceItemID", $invoiceID);
    $db->query($q);
    while ($db->next_record()) {
        $invoiceItem = new invoiceItem();
        $invoiceItem->currency = $invoice->get_value("currencyTypeID");
        if (!$invoiceItem->read_db_record($db)) {
            continue;
        }
        $invoiceItem->set_tpl_values("invoiceItem_");
        unset($transaction_sum);
        unset($transaction_info);
        unset($transaction_statii);
        unset($one_approved);
        unset($one_rejected);
        unset($one_pending);
        unset($br);
        unset($sel);
        unset($amount);
        unset($TPL["invoiceItem_buttons_top"], $TPL["invoiceItem_buttons"], $TPL["transaction_info"], $TPL["status_label"]);
        // If editing a invoiceItem then don't display it in the list
        if (is_array($_POST["invoiceItem_edit"]) && key($_POST["invoiceItem_edit"]) == $invoiceItem->get_id()) {
            continue;
        }
        $q = prepare("SELECT *\n                       , transaction.amount * pow(10,-currencyType.numberToBasic) AS transaction_amount\n                       , transaction.tfID AS transaction_tfID\n                       , transaction.fromTfID AS transaction_fromTfID\n                       , transaction.status AS transaction_status  \n                       , transaction.currencyTypeID\n                    FROM transaction \n               LEFT JOIN currencyType on transaction.currencyTypeID = currencyType.currencyTypeID\n                   WHERE transaction.invoiceItemID = %d", $invoiceItem->get_id());
        $db2->query($q);
        while ($db2->next_record()) {
            $transaction = new transaction();
            if (!$transaction->read_db_record($db2)) {
                $other_peoples_transactions .= "<br>Tansaction access denied for transaction #" . $db2->f("transactionID");
                continue;
            }
            if ($db2->f("transaction_status") == "approved") {
                $one_approved = true;
            }
            if ($db2->f("transaction_status") == "rejected") {
                $one_rejected = true;
            }
            if ($db2->f("transaction_status") == "pending") {
                $one_pending = true;
            }
            $amounts[$invoiceItem->get_id()] += $db2->f("transaction_amount");
            $db2->f("transaction_status") != "rejected" and $transaction_sum += $db2->f("transaction_amount");
            $transaction_info .= $br . ucwords($db2->f("transaction_status")) . " Transaction ";
            $transaction_info .= "<a href=\"" . $TPL["url_alloc_transaction"] . "transactionID=" . $db2->f("transactionID") . "\">#" . $db2->f("transactionID") . "</a>";
            $transaction_info .= " from ";
            $transaction_info .= "<a href=\"" . $TPL["url_alloc_transactionList"] . "tfID=" . $db2->f("transaction_fromTfID") . "\">" . tf::get_name($db2->f("transaction_fromTfID")) . "</a>";
            $transaction_info .= " to <a href=\"" . $TPL["url_alloc_transactionList"] . "tfID=" . $db2->f("transaction_tfID") . "\">" . tf::get_name($db2->f("transaction_tfID")) . "</a>";
            $transaction_info .= " for <b>" . page::money($db2->f("currencyTypeID"), $db2->f("transaction_amount"), "%s%m") . "</b>";
            $br = "<br>";
        }
        $TPL["transaction_info"] = $transaction_info;
        $TPL["transaction_info"] .= $other_peoples_transactions;
        // Sets the background colour of the invoice item boxes based on transaction.status
        if (!$one_rejected && !$one_pending && $one_approved) {
            $TPL["box_class"] = " approved";
            $transaction_status = "approved";
        } else {
            if ($one_rejected) {
                $TPL["box_class"] = " rejected";
                $transaction_status = "rejected";
            } else {
                if ($one_pending) {
                    $transaction_status = "pending";
                    $TPL["box_class"] = " warn";
                } else {
                    $TPL["box_class"] = " pending";
                    $transaction_status = "";
                }
            }
        }
        $sel[$transaction_status] = " checked";
        if ($sel["rejected"]) {
            $TPL["status_label"] = "<b>[Not Going To Be Paid]</b>";
        } else {
            if ($sel["pending"]) {
                $TPL["status_label"] = "<b>[Pending]</b>";
            } else {
                if ($sel["approved"]) {
                    $TPL["status_label"] = "<b>[Paid]</b>";
                }
            }
        }
        if ($transaction_sum > 0 && $transaction_sum < $invoiceItem->get_value("iiAmount", DST_HTML_DISPLAY)) {
            $TPL["status_label"] = "<b>[Paid in part]</b>";
            $TPL["box_class"] = " warn";
        } else {
            if ($transaction_sum > $invoiceItem->get_value("iiAmount")) {
                $TPL["status_label"] = "<b>[Overpaid]</b>";
            }
        }
        $TPL["status_label"] or $TPL["status_label"] = "<b>[No Transactions Created]</b>";
        if ($invoice->get_value("invoiceStatus") == "reconcile") {
            if ($amounts[$invoiceItem->get_id()] === null) {
                $amount = $invoiceItem->get_value("iiAmount", DST_HTML_DISPLAY);
                if (config::get_config_item("taxPercent") && $invoiceItem->get_value("iiTax") == 0) {
                    $amount = page::money($invoice->get_value("currencyTypeID"), $amount * (config::get_config_item("taxPercent") / 100 + 1), "%m");
                }
            } else {
                $amount = page::money($invoice->get_value("currencyTypeID"), $amounts[$invoiceItem->get_id()], "%m");
            }
            $selected_tfID = $db2->f("transaction_tfID");
            if (!$selected_tfID && $invoiceItem->get_value("timeSheetID")) {
                $timeSheet = $invoiceItem->get_foreign_object("timeSheet");
                $project = $timeSheet->get_foreign_object("project");
                $selected_tfID = $project->get_value("cost_centre_tfID");
            } else {
                if (!$selected_tfID && $invoiceItem->get_value("transactionID")) {
                    $transaction = $invoiceItem->get_foreign_object("transaction");
                    $project = $transaction->get_foreign_object("project");
                    $selected_tfID = $project->get_value("cost_centre_tfID");
                    $selected_tfID or $selected_tfID = $transaction->get_value("tfID");
                }
            }
            $selected_tfID or $selected_tfID = config::get_config_item("mainTfID");
            #$tf_options = page::select_options($tf_array, $selected_tfID);
            #$tf_options = "<select name=\"invoiceItemAmountPaidTfID[".$invoiceItem->get_id()."]\">".$tf_options."</select>";
            #$TPL["invoiceItem_buttons"] = "<input size=\"8\" type=\"text\" id=\"ap_".$invoiceItem->get_id()."\" name=\"invoiceItemAmountPaid[".$invoiceItem->get_id()."]\" value=\"".$amount."\">";
            #$TPL["invoiceItem_buttons"].= $tf_options;
            unset($radio_buttons);
            if ($current_user->have_role('admin')) {
                $radio_buttons = "<label class='radio corner' for=\"invoiceItemStatus_rejected_" . $invoiceItem->get_id() . "\">Not Going To Be Paid";
                $radio_buttons .= "<input type=\"radio\" id=\"invoiceItemStatus_rejected_" . $invoiceItem->get_id() . "\" name=\"invoiceItemStatus[" . $invoiceItem->get_id() . "]\"";
                $radio_buttons .= " value=\"rejected\"" . $sel["rejected"] . ">";
                $radio_buttons .= "</label>";
                $radio_buttons .= "&nbsp;&nbsp;";
                $radio_buttons .= "<label class='radio corner' for=\"invoiceItemStatus_pending_" . $invoiceItem->get_id() . "\">Pending";
                $radio_buttons .= "<input type=\"radio\" id=\"invoiceItemStatus_pending_" . $invoiceItem->get_id() . "\" name=\"invoiceItemStatus[" . $invoiceItem->get_id() . "]\"";
                $radio_buttons .= " value=\"pending\"" . $sel["pending"] . ">";
                $radio_buttons .= "</label>";
                $radio_buttons .= "&nbsp;&nbsp;";
                $radio_buttons .= "<label class='radio corner' for=\"invoiceItemStatus_approved_" . $invoiceItem->get_id() . "\">Paid";
                $radio_buttons .= "<input type=\"radio\" id=\"invoiceItemStatus_approved_" . $invoiceItem->get_id() . "\" name=\"invoiceItemStatus[" . $invoiceItem->get_id() . "]\"";
                $radio_buttons .= " value=\"approved\"" . $sel["approved"] . ">";
                $radio_buttons .= "</label>";
                $TPL["invoiceItem_buttons_top"] = $radio_buttons;
                $TPL["invoiceItem_buttons_top"] .= "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"text\" size=\"7\" name=\"invoiceItemAmountPaid[" . $invoiceItem->get_id() . "]\" value=\"" . $amount . "\">";
                $TPL["invoiceItem_buttons_top"] .= "<input type=\"hidden\" name=\"invoiceItemAmountPaidTfID[" . $invoiceItem->get_id() . "]\" value=\"" . $selected_tfID . "\">";
            }
            unset($TPL["invoiceItem_buttons"]);
        } else {
            if ($invoice->get_value("invoiceStatus") == "finished") {
            } else {
                if (is_object($invoice) && $invoice->get_value("invoiceStatus") == "edit") {
                    $TPL["invoiceItem_buttons"] = '
        <button type="submit" name="invoiceItem_delete[' . $invoiceItem->get_id() . ']" value="1" class="delete_button">Delete<i class="icon-trash"></i></button>
        <button type="submit" name="invoiceItem_edit[' . $invoiceItem->get_id() . ']" value="1">Edit<i class="icon-edit"></i></button>
      ';
                }
            }
        }
        if ($invoiceItem->get_value("timeSheetID")) {
            $t = new timeSheet();
            $t->set_id($invoiceItem->get_value("timeSheetID"));
            $t->select();
            $t->load_pay_info();
            $amount = $t->pay_info["total_customerBilledDollars"] or $amount = $t->pay_info["total_dollars"];
            $TPL["invoiceItem_iiMemo"] = "<a href=\"" . $TPL["url_alloc_timeSheet"] . "timeSheetID=" . $invoiceItem->get_value("timeSheetID") . "\">" . $invoiceItem->get_value("iiMemo") . " (Currently: \$" . $amount . ", Status: " . $t->get_timeSheet_status() . ")</a>";
        } else {
            if ($invoiceItem->get_value("expenseFormID")) {
                $ep = $invoiceItem->get_foreign_object("expenseForm");
                $total = $ep->get_abs_sum_transactions();
                $TPL["invoiceItem_iiMemo"] = "<a href=\"" . $TPL["url_alloc_expenseForm"] . "expenseFormID=" . $invoiceItem->get_value("expenseFormID") . "\">" . $invoiceItem->get_value("iiMemo") . " (Currently: " . page::money(config::get_config_item("currency"), $total, "%s%m %c") . ", Status: " . $ep->get_status() . ")</a>";
            }
        }
        $TPL["currency"] = $invoice->get_value("currencyTypeID");
        include_template($template);
    }
}
Exemplo n.º 7
0
    $temp = $tflist;
    foreach ($remove_these as $dud) {
        unset($temp[$dud]);
    }
    echo page::select_options($temp, $selected);
    return;
}
$productID = $_GET["productID"] or $productID = $_POST["productID"];
$product = new product();
if ($productID) {
    $product->set_id($productID);
    $product->select();
}
$tf = new tf();
$tflist = $tf->get_assoc_array("tfID", "tfName");
$extra_options = array("-1" => "META: Project TF", "-2" => "META: Salesperson TF", config::get_config_item("mainTfID") => "Main Finance TF (" . tf::get_name(config::get_config_item("mainTfID")) . ")", config::get_config_item("outTfID") => "Outgoing Funds TF (" . tf::get_name(config::get_config_item("outTfID")) . ")", config::get_config_item("inTfID") => "Incoming Funds TF (" . tf::get_name(config::get_config_item("inTfID")) . ")");
// Prepend the META options to the tflist.
$tflist = $extra_options + $tflist;
$TPL["companyTF"] = $tflist[config::get_config_item("mainTfID")];
$TPL["taxTF"] = $tflist[config::get_config_item("taxTfID")];
$taxRate = config::get_config_item("taxPercent") / 100.0;
$TPL["taxRate"] = $taxRate;
if ($_POST["save"]) {
    $product->read_globals();
    $product->set_value("productActive", isset($_POST["productActive"]) ? 1 : 0);
    !$product->get_value("productName") and alloc_error("Please enter a Product Name.");
    !$product->get_value("sellPrice") and alloc_error("Please enter a Sell Price.");
    if (!$TPL["message"]) {
        $product->save();
        $productID = $product->get_id();
        // If they were in the middle of creating a sale, return them back there
Exemplo n.º 8
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");
Exemplo n.º 9
0
if (!$productSale->get_id()) {
    $TPL["message_help"][] = "To create a new Sale, optionally select a Client and/or Project and click the Create Sale button.";
} else {
    if ($productSale->get_value("status") == "edit") {
        $TPL["message_help"][] = "Add as many Sale Items as you like by clicking the 'New' link multiple times, and then clicking the\n                            Save Items button.<br><br>When you are done adding Sale Items click the 'Allocate -->' button\n                            to setup the resulting transactions from this Sale.";
    } else {
        if ($productSale->get_value("status") == "allocate") {
            $TPL["message_help"][] = "If necessary, adjust the transactions below. When you're done, submit this Sale\n                            to the Adminstrator, you will no longer be able to edit this Sale.\n\n                            <br><br>Generally, the transactions for the Sale Items will add up correctly if the\n                            <b>Sell Price</b> is equal to <b>Transactions Incoming</b>, and the <b>Margin</b> is\n                            equal to <b>Transactions Other</b>.";
        } else {
            if ($productSale->get_value("status") == "admin" && $productSale->have_perm(PERM_APPROVE_PRODUCT_TRANSACTIONS)) {
                $TPL["message_help"][] = "Please review the Sale Transactions carefully. If accurate <b>approve</b> and save the transactions,\n                            then move this Sale to status 'Completed'.";
            } else {
                if ($productSale->get_value("status") == "admin") {
                    $TPL["message_help"][] = "This Sale is awaiting approval from the Administrator.";
                }
            }
        }
    }
}
if ($productSale->get_value("projectID")) {
    $project = new project();
    $project->set_id($productSale->get_value("projectID"));
    $project->select();
    $ptf = $project->get_value("cost_centre_tfID");
    $ptf and $TPL["project_tfID"] = " (TF: " . tf::get_name($ptf) . ")";
    $ptf or $TPL["project_tfID"] = " (No project TF)";
}
$TPL["taxName"] = config::get_config_item("taxName");
$TPL["main_alloc_title"] = "Sale - " . APPLICATION_NAME;
$productSale->get_id() and $TPL["main_alloc_title"] = "Sale " . $productSale->get_id() . " - " . APPLICATION_NAME;
include_template("templates/productSaleM.tpl");