当前位置: 首页>>代码示例>>PHP>>正文


PHP page::money方法代码示例

本文整理汇总了PHP中page::money方法的典型用法代码示例。如果您正苦于以下问题:PHP page::money方法的具体用法?PHP page::money怎么用?PHP page::money使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在page的用法示例。


在下文中一共展示了page::money方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: convert

 public static function convert($currency, $amount, $destCurrency = false, $date = false, $format = "%m")
 {
     $date or $date = date("Y-m-d");
     $destCurrency or $destCurrency = config::get_config_item("currency");
     $er = exchangeRate::get_er($currency, $destCurrency, $date);
     return page::money($destCurrency, $amount * $er, $format);
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:7,代码来源:exchangeRate.inc.php

示例2: render

 function render()
 {
     $current_user =& singleton("current_user");
     global $TPL;
     // Get averages for hours worked over the past fortnight and year
     $t = new timeSheetItem();
     $day = 60 * 60 * 24;
     //mktime(0,0,0,date("m"),date("d")-1, date("Y"))
     $today = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 1, date("Y")));
     $yestA = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 2, date("Y")));
     $yestB = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 1, date("Y")));
     $fortn = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 14, date("Y")));
     list($hours_sum_today, $dollars_sum_today) = $t->get_averages($today, $current_user->get_id());
     list($hours_sum_yesterday, $dollars_sum_yesterday) = $t->get_averages($yestA, $current_user->get_id(), null, $yestB);
     list($hours_sum_fortnight, $dollars_sum_fortnight) = $t->get_averages($fortn, $current_user->get_id());
     list($hours_avg_fortnight, $dollars_avg_fortnight) = $t->get_fortnightly_average($current_user->get_id());
     $TPL["hours_sum_today"] = sprintf("%0.2f", $hours_sum_today[$current_user->get_id()]);
     $TPL["dollars_sum_today"] = page::money_print($dollars_sum_today[$current_user->get_id()]);
     $TPL["hours_sum_yesterday"] = sprintf("%0.2f", $hours_sum_yesterday[$current_user->get_id()]);
     $TPL["dollars_sum_yesterday"] = page::money_print($dollars_sum_yesterday[$current_user->get_id()]);
     $TPL["hours_sum_fortnight"] = sprintf("%0.2f", $hours_sum_fortnight[$current_user->get_id()]);
     $TPL["dollars_sum_fortnight"] = page::money_print($dollars_sum_fortnight[$current_user->get_id()]);
     $TPL["hours_avg_fortnight"] = sprintf("%0.2f", $hours_avg_fortnight[$current_user->get_id()]);
     $TPL["dollars_avg_fortnight"] = page::money(config::get_config_item("currency"), $dollars_avg_fortnight[$current_user->get_id()], "%s%m %c");
     $TPL["dateFrom"] = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 28, date("Y")));
     $TPL["dateTo"] = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
     return true;
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:28,代码来源:timeSheetStatusHomeItem.inc.php

示例3: show_productCost_list

function show_productCost_list($productID, $template, $percent = false)
{
    global $TPL;
    unset($TPL["display"], $TPL["taxOptions"]);
    // otherwise the commissions don't display.
    if ($productID) {
        $t = new meta("currencyType");
        $currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID");
        $db = new db_alloc();
        $query = prepare("SELECT * \n                        FROM productCost \n                       WHERE productID = %d \n                         AND isPercentage = %d\n                         AND productCostActive = true\n                    ORDER BY productCostID", $productID, $percent);
        $db->query($query);
        while ($db->next_record()) {
            $productCost = new productCost();
            $productCost->read_db_record($db);
            $productCost->set_tpl_values();
            $TPL["currencyOptions"] = page::select_options($currency_array, $productCost->get_value("currencyTypeID"));
            $TPL["taxOptions"] = page::select_options(array("" => "Exempt", 1 => "Included", 0 => "Excluded"), $productCost->get_value("tax"));
            // Hardcoded AUD because productCost table uses percent and dollars in same field
            $percent and $TPL["amount"] = page::money("AUD", $productCost->get_value("amount"), "%mo");
            include_template($template);
        }
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:23,代码来源:product.php

示例4: show_productSale_list

function show_productSale_list($productSaleID, $template)
{
    global $TPL;
    global $productSaleItemsDoExist;
    $productSale = new productSale();
    $productSale->set_id($productSaleID);
    $productSale->select();
    $productSale->set_tpl_values();
    $taxName = config::get_config_item("taxName");
    $product = new product();
    $ops = $product->get_assoc_array("productID", "productName");
    $query = prepare("SELECT *\n                      FROM productSaleItem \n                     WHERE productSaleID = %d", $productSaleID);
    $db = new db_alloc();
    $db->query($query);
    while ($db->next_record()) {
        $productSaleItemsDoExist = true;
        $productSaleItem = new productSaleItem();
        $productSaleItem->read_db_record($db);
        $productSaleItem->set_tpl_values();
        $TPL["itemSellPrice"] = $productSaleItem->get_value("sellPrice");
        $TPL["itemMargin"] = $productSaleItem->get_amount_margin();
        $TPL["itemSpent"] = $productSaleItem->get_amount_spent();
        $TPL["itemEarnt"] = $productSaleItem->get_amount_earnt();
        $TPL["itemOther"] = $productSaleItem->get_amount_other();
        $TPL["itemCosts"] = page::money(config::get_config_item("currency"), product::get_buy_cost($productSaleItem->get_value("productID")) * $productSaleItem->get_value("quantity"), "%s%mo %c");
        $TPL["itemTotalUnallocated"] = $productSaleItem->get_amount_unallocated();
        $TPL["productList_dropdown"] = page::select_options($ops, $productSaleItem->get_value("productID"));
        $TPL["productLink"] = "<a href=\"" . $TPL["url_alloc_product"] . "productID=" . $productSaleItem->get_value("productID") . "\">" . page::htmlentities($ops[$productSaleItem->get_value("productID")]) . "</a>";
        $TPL["transactions"] = $productSale->get_transactions($productSaleItem->get_id());
        if ($taxName) {
            $TPL["sellPriceTax_check"] = sprintf(" <input type='checkbox' name='sellPriceIncTax[]' value='%d'%s> inc %s", $productSaleItem->get_id(), $productSaleItem->get_value("sellPriceIncTax") ? ' checked' : '', $taxName);
            $TPL["sellPriceTax_label"] = $productSaleItem->get_value("sellPriceIncTax") ? " inc " . $taxName : " ex " . $taxName;
        }
        include_template($template);
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:36,代码来源:productSale.php

示例5: show_transaction

function show_transaction($template)
{
    global $db;
    global $TPL;
    global $projectID;
    $current_user =& singleton("current_user");
    $transaction = new transaction();
    if (isset($projectID) && $projectID) {
        $query = prepare("SELECT transaction.*\n                          FROM transaction\n                          WHERE transaction.projectID = %d\n                      ORDER BY transactionModifiedTime desc\n                        ", $projectID);
        $db->query($query);
        while ($db->next_record()) {
            $transaction = new transaction();
            $transaction->read_db_record($db);
            $transaction->set_values("transaction_");
            $tf = $transaction->get_foreign_object("tf");
            $tf->set_values();
            $tf->set_values("tf_");
            $TPL["transaction_username"] = $db->f("username");
            $TPL["transaction_amount"] = page::money($TPL["transaction_currenyTypeID"], $TPL["transaction_amount"], "%s%mo");
            $TPL["transaction_type_link"] = $transaction->get_transaction_type_link() or $TPL["transaction_link"] = $transaction->get_value("transactionType");
            include_template($template);
        }
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:24,代码来源:project.php

示例6: define

 * This file is part of the allocPSA application <info@cyber.com.au>.
 * 
 * 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/>.
*/
define("NO_REDIRECT", 1);
require_once "../alloc.php";
$db = new db_alloc();
$product = $_GET["product"];
$quantity = $_GET["quantity"];
$p = new product();
$p->set_id($product);
$p->select();
$p->set_tpl_values();
// Probably not valid XML, but jQuery will parse it.
echo "<data>\n";
echo "<price>" . page::money($TPL["sellPriceCurrencyTypeID"], $TPL["sellPrice"] * $quantity, "%m") . "</price>\n";
echo "<priceCurrency>" . $TPL["sellPriceCurrencyTypeID"] . "</priceCurrency>\n";
echo "<priceTax>" . ($TPL["sellPriceIncTax"] ? "1" : "") . "</priceTax>\n";
echo "<description>" . $TPL["description"] . "</description>\n";
echo "</data>\n";
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:updateCostPrice.php

示例7: get_list

 public static function get_list($_FORM)
 {
     $current_user =& singleton("current_user");
     global $TPL;
     /*
      * This is the definitive method of getting a list of transactions that need a sophisticated level of filtering
      *
      */
     $_FORM["tfIDs"] = transaction::reduce_tfs($_FORM);
     // Non-admin users must specify a valid TF
     if (!$current_user->have_role("admin") && !$_FORM["tfIDs"]) {
         return;
     }
     $filter = transaction::get_list_filter($_FORM);
     $debug = $_FORM["debug"];
     $debug and print "\n<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
     $debug and print "\n<pre>filter: " . print_r($filter, 1) . "</pre>";
     $_FORM["return"] or $_FORM["return"] = "html";
     $filter["prevBalance"] and $filter2[] = $filter["prevBalance"];
     $filter["tfIDs"] and $filter2[] = $filter["tfIDs"];
     $filter2 and $filter2[] = " (status = 'approved') ";
     unset($filter["prevBalance"]);
     if (is_array($filter2) && count($filter2)) {
         $filter2 = " WHERE " . implode(" AND ", $filter2);
     }
     if (is_array($filter) && count($filter)) {
         $filter = " WHERE " . implode(" AND ", $filter);
     }
     $_FORM["sortTransactions"] or $_FORM["sortTransactions"] = "transactionDate";
     $order_by = "ORDER BY " . $_FORM["sortTransactions"];
     // Determine opening balance
     if (is_array($_FORM['tfIDs']) && count($_FORM['tfIDs'])) {
         $q = prepare("SELECT SUM( IF(fromTfID IN (%s),-amount,amount) * pow(10,-currencyType.numberToBasic) * exchangeRate) AS balance\n                      FROM transaction \n                 LEFT JOIN currencyType ON currencyType.currencyTypeID = transaction.currencyTypeID\n                    " . $filter2, $_FORM['tfIDs']);
         $debug and print "\n<br>QUERY: " . $q;
         $db = new db_alloc();
         $db->query($q);
         $db->row();
         $_FORM["opening_balance"] = $db->f("balance");
         $running_balance = $db->f("balance");
     }
     $q = "SELECT *, \n                 (amount * pow(10,-currencyType.numberToBasic)) as amount1,\n                 (amount * pow(10,-currencyType.numberToBasic) * exchangeRate) as amount2,\n                 if(transactionModifiedTime,transactionModifiedTime,transactionCreatedTime) AS transactionSortDate,\n                 tf1.tfName as fromTfName,\n                 tf2.tfName as tfName\n            FROM transaction \n       LEFT JOIN currencyType ON currencyType.currencyTypeID = transaction.currencyTypeID\n       LEFT JOIN tf tf1 ON transaction.fromTfID = tf1.tfID\n       LEFT JOIN tf tf2 ON transaction.tfID = tf2.tfID\n         " . $filter . " \n         " . $order_by;
     $debug and print "\n<br>QUERY2: " . $q;
     $db = new db_alloc();
     $db->query($q);
     $for_cyber = config::for_cyber();
     while ($row = $db->next_record()) {
         #echo "<pre>".print_r($row,1)."</pre>";
         $i++;
         $t = new transaction();
         if (!$t->read_db_record($db)) {
             continue;
         }
         $print = true;
         // If the destination of this TF is not the current TfID, then invert the $amount
         $amount = $row["amount2"];
         if (!in_array($row["tfID"], (array) $_FORM["tfIDs"])) {
             $amount = -$amount;
             $row["amount1"] = -$row["amount1"];
         }
         $row["amount"] = $amount;
         $row["transactionURL"] = $t->get_url();
         $row["transactionName"] = $t->get_name($_FORM);
         $row["transactionLink"] = $t->get_transaction_link($_FORM);
         $row["transactionTypeLink"] = $t->get_transaction_type_link() or $row["transactionTypeLink"] = $row["transactionType"];
         $row["transactionSortDate"] = format_date("Y-m-d", $row["transactionSortDate"]);
         $row["fromTfIDLink"] = "<a href=\"" . $TPL["url_alloc_transactionList"] . "tfID=" . $row["fromTfID"] . "\">" . page::htmlentities($row["fromTfName"]) . "</a>";
         $row["tfIDLink"] = "<a href=\"" . $TPL["url_alloc_transactionList"] . "tfID=" . $row["tfID"] . "\">" . page::htmlentities($row["tfName"]) . "</a>";
         if ($t->get_value("status") == "approved") {
             $running_balance += $amount;
             $row["running_balance"] = page::money(config::get_config_item("currency"), $running_balance, "%m %c");
         }
         if ($amount > 0) {
             $row["amount_positive"] = page::money($row["currencyTypeID"], $row["amount1"], "%m %c");
             $total_amount_positive += $amount;
         } else {
             $row["amount_negative"] = page::money($row["currencyTypeID"], $row["amount1"], "%m %c");
             $total_amount_negative += $amount;
         }
         // Cyber only hackery for ext ref field on product sales
         if ($for_cyber && $row["productSaleID"]) {
             $ps = new productSale();
             $ps->set_id($row["productSaleID"]);
             if ($ps->select()) {
                 $ps->get_value("extRef") and $row["product"] .= " (Ext ref: " . $ps->get_value("extRef") . ")";
             }
         }
         $transactions[$row["transactionID"]] = $row;
     }
     $_FORM["total_amount_positive"] = page::money(config::get_config_item("currency"), $total_amount_positive, "%s%m %c");
     $_FORM["total_amount_negative"] = page::money(config::get_config_item("currency"), $total_amount_negative, "%s%m %c");
     $_FORM["running_balance"] = page::money(config::get_config_item("currency"), $running_balance, "%s%m %c");
     return array("totals" => $_FORM, "rows" => (array) $transactions);
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:93,代码来源:transaction.inc.php

示例8: get_list

 public static function get_list($_FORM)
 {
     $current_user =& singleton("current_user");
     /*
      * This is the definitive method of getting a list of tasks that need a sophisticated level of filtering
      *
      */
     list($filter, $having) = task::get_list_filter($_FORM);
     $debug = $_FORM["debug"];
     $debug and print "\n<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
     $debug and print "\n<pre>filter: " . print_r($filter, 1) . "</pre>";
     $_FORM["taskView"] or $_FORM["taskView"] = 'prioritised';
     // Zero is a valid limit
     if ($_FORM["limit"] || $_FORM["limit"] === 0 || $_FORM["limit"] === "0") {
         $limit = prepare("limit %d", $_FORM["limit"]);
     }
     $_FORM["return"] or $_FORM["return"] = "html";
     $_FORM["people_cache"] =& get_cached_table("person");
     $_FORM["timeUnit_cache"] =& get_cached_table("timeUnit");
     $_FORM["taskType_cache"] =& get_cached_table("taskType");
     if ($_FORM["taskView"] == "prioritised") {
         unset($filter["parentTaskID"]);
         $order_limit = " " . $limit;
     } else {
         $order_limit = " ORDER BY projectName,taskName " . $limit;
     }
     // Get a hierarchical list of tasks
     if (is_array($filter) && count($filter)) {
         $f = " WHERE " . implode(" AND ", $filter);
     }
     $uid = sprintf("%d", $current_user->get_id());
     $spread = sprintf("%d", config::get_config_item("taskPrioritySpread"));
     $scale = sprintf("%d", config::get_config_item("taskPriorityScale"));
     $scale_halved = sprintf("%d", config::get_config_item("taskPriorityScale") / 2);
     $q = "SELECT task.*\n                ,projectName\n                ,projectShortName\n                ,clientID\n                ,projectPriority\n                ,project.currencyTypeID as currency\n                ,rate\n                ,rateUnitID\n                ,GROUP_CONCAT(pendingTask.pendingTaskID) as pendingTaskIDs\n                ,GROUP_CONCAT(DISTINCT alltag.name SEPARATOR ', ') as tags\n            FROM task\n       LEFT JOIN project ON project.projectID = task.projectID\n       LEFT JOIN projectPerson ON project.projectID = projectPerson.projectID AND projectPerson.personID = '" . $uid . "'\n       LEFT JOIN pendingTask ON pendingTask.taskID = task.taskID\n       LEFT JOIN tag alltag ON alltag.taskID = task.taskID\n       LEFT JOIN tag seltag ON seltag.taskID = task.taskID\n                 " . $f . "\n        GROUP BY task.taskID\n                 " . $having . "\n                 " . $order_limit;
     $debug and print "\n<br>QUERY: " . $q;
     $_FORM["debug"] and print "\n<br>QUERY: " . $q;
     $db = new db_alloc();
     $db->query($q);
     while ($row = $db->next_record()) {
         $task = new task();
         $task->read_db_record($db);
         $row["taskURL"] = $task->get_url();
         $row["taskName"] = $task->get_name($_FORM);
         $row["taskLink"] = $task->get_task_link($_FORM);
         $row["project_name"] = $row["projectShortName"] or $row["project_name"] = $row["projectName"];
         $row["projectPriority"] = $db->f("projectPriority");
         has("project") and $row["projectPriorityLabel"] = project::get_priority_label($db->f("projectPriority"));
         has("project") and list($row["priorityFactor"], $row["daysUntilDue"]) = $task->get_overall_priority($row["projectPriority"], $row["priority"], $row["dateTargetCompletion"]);
         $row["taskTypeImage"] = $task->get_task_image();
         $row["taskTypeSeq"] = $_FORM["taskType_cache"][$row["taskTypeID"]]["taskTypeSeq"];
         $row["taskStatusLabel"] = $task->get_task_status("label");
         $row["taskStatusColour"] = $task->get_task_status("colour");
         $row["creator_name"] = $_FORM["people_cache"][$row["creatorID"]]["name"];
         $row["manager_name"] = $_FORM["people_cache"][$row["managerID"]]["name"];
         $row["assignee_name"] = $_FORM["people_cache"][$row["personID"]]["name"];
         $row["closer_name"] = $_FORM["people_cache"][$row["closerID"]]["name"];
         $row["estimator_name"] = $_FORM["people_cache"][$row["estimatorID"]]["name"];
         $row["creator_username"] = $_FORM["people_cache"][$row["creatorID"]]["username"];
         $row["manager_username"] = $_FORM["people_cache"][$row["managerID"]]["username"];
         $row["assignee_username"] = $_FORM["people_cache"][$row["personID"]]["username"];
         $row["closer_username"] = $_FORM["people_cache"][$row["closerID"]]["username"];
         $row["estimator_username"] = $_FORM["people_cache"][$row["estimatorID"]]["username"];
         $row["newSubTask"] = $task->get_new_subtask_link();
         $_FORM["showPercent"] and $row["percentComplete"] = $task->get_percentComplete();
         $_FORM["showTimes"] and $row["timeActual"] = $task->get_time_billed() / 60 / 60;
         $row["rate"] = page::money($row["currency"], $row["rate"], "%mo");
         $row["rateUnit"] = $_FORM["timeUnit_cache"][$row["rateUnitID"]]["timeUnitName"];
         $row["priorityLabel"] = $task->get_priority_label();
         if (!$_FORM["skipObject"]) {
             $_FORM["return"] == "array" and $row["object"] = $task;
         }
         $row["padding"] = $_FORM["padding"];
         $row["taskID"] = $task->get_id();
         $row["parentTaskID"] = $task->get_value("parentTaskID");
         $row["parentTaskID_link"] = "<a href='" . $task->get_url(false, $task->get_value("parentTaskID")) . "'>" . $task->get_value("parentTaskID") . "</a>";
         $row["timeLimitLabel"] = $row["timeBestLabel"] = $row["timeWorstLabel"] = $row["timeExpectedLabel"] = $row["timeActualLabel"] = "";
         $row["timeLimit"] !== NULL and $row["timeLimitLabel"] = seconds_to_display_format($row["timeLimit"] * 60 * 60);
         $row["timeBest"] !== NULL and $row["timeBestLabel"] = seconds_to_display_format($row["timeBest"] * 60 * 60);
         $row["timeWorst"] !== NULL and $row["timeWorstLabel"] = seconds_to_display_format($row["timeWorst"] * 60 * 60);
         $row["timeExpected"] !== NULL and $row["timeExpectedLabel"] = seconds_to_display_format($row["timeExpected"] * 60 * 60);
         $row["timeActual"] !== NULL and $row["timeActualLabel"] = seconds_to_display_format($row["timeActual"] * 60 * 60);
         if ($_FORM["showComments"] && ($comments = comment::util_get_comments("task", $row["taskID"]))) {
             $row["comments"] = $comments;
         }
         if ($_FORM["taskView"] == "byProject") {
             $rows[$task->get_id()] = array("parentTaskID" => $row["parentTaskID"], "row" => $row);
         } else {
             if ($_FORM["taskView"] == "prioritised") {
                 $rows[$row["taskID"]] = $row;
                 if (is_array($rows) && count($rows)) {
                     uasort($rows, array("task", "priority_compare"));
                 }
             }
         }
     }
     if ($_FORM["taskView"] == "byProject") {
         $parentTaskID = $_FORM["parentTaskID"] or $parentTaskID = 0;
         $t = task::get_recursive_child_tasks($parentTaskID, (array) $rows);
         list($tasks, $done) = task::build_recursive_task_list($t, $_FORM);
//.........这里部分代码省略.........
开发者ID:cjbayliss,项目名称:alloc,代码行数:101,代码来源:task.inc.php

示例9: move_forwards

 function move_forwards()
 {
     $current_user =& singleton("current_user");
     global $TPL;
     $status = $this->get_value("status");
     $db = new db_alloc();
     if ($this->get_value("clientID")) {
         $c = $this->get_foreign_object("client");
         $extra = " for " . $c->get_value("clientName");
         $taskDesc[] = "";
     }
     $taskname1 = "Sale " . $this->get_id() . ": raise an invoice" . $extra;
     $taskname2 = "Sale " . $this->get_id() . ": place an order to the supplier";
     $taskname3 = "Sale " . $this->get_id() . ": pay the supplier";
     $taskname4 = "Sale " . $this->get_id() . ": deliver the goods / action the work";
     $cyberadmin = 59;
     $taskDesc[] = "Sale items:";
     $taskDesc[] = "";
     foreach ((array) $this->get_productSaleItems() as $psiID => $psi_row) {
         $p = new product();
         $p->set_id($psi_row["productID"]);
         $taskDesc[] = "  " . page::money($psi_row["sellPriceCurrencyTypeID"], $psi_row["sellPrice"], "%S%mo") . " for " . $psi_row["quantity"] . " x " . $p->get_name();
         $hasItems = true;
     }
     if (!$hasItems) {
         return alloc_error("No sale items have been added.");
     }
     $amounts = $this->get_amounts();
     $taskDesc[] = "";
     $taskDesc[] = "Total: " . $amounts["total_sellPrice"];
     $taskDesc[] = "Total inc " . config::get_config_item("taxName") . ": " . $amounts["total_sellPrice_plus_gst"];
     $taskDesc[] = "";
     $taskDesc[] = "Refer to the sale in alloc for up-to-date information:";
     $taskDesc[] = config::get_config_item("allocURL") . "sale/productSale.php?productSaleID=" . $this->get_id();
     $taskDesc = implode("\n", $taskDesc);
     if ($status == "edit") {
         $this->set_value("status", "allocate");
         $items = $this->get_productSaleItems();
         foreach ($items as $r) {
             $psi = new productSaleItem();
             $psi->set_id($r["productSaleItemID"]);
             $psi->select();
             if (!$db->qr("SELECT transactionID FROM transaction WHERE productSaleItemID = %d", $psi->get_id())) {
                 $psi->create_transactions();
             }
         }
     } else {
         if ($status == "allocate") {
             $this->set_value("status", "admin");
             // 1. from salesperson to admin
             $q = prepare("SELECT * FROM task WHERE projectID = %d AND taskName = '%s'", $cyberadmin, $taskname1);
             if (config::for_cyber() && !$db->qr($q)) {
                 $task = new task();
                 $task->set_value("projectID", $cyberadmin);
                 // Cyber Admin Project
                 $task->set_value("taskName", $taskname1);
                 $task->set_value("managerID", $this->get_value("personID"));
                 // salesperson
                 $task->set_value("personID", 67);
                 // Cyber Support people (jane)
                 $task->set_value("priority", 3);
                 $task->set_value("taskTypeID", "Task");
                 $task->set_value("taskDescription", $taskDesc);
                 $task->set_value("dateTargetStart", date("Y-m-d"));
                 $task->set_value("dateTargetCompletion", date("Y-m-d", date("U") + 60 * 60 * 24 * 7));
                 $task->save();
                 $TPL["message_good"][] = "Task created: " . $task->get_id() . " " . $task->get_value("taskName");
                 $p1 = new person();
                 $p1->set_id($this->get_value("personID"));
                 $p1->select();
                 $p2 = new person();
                 $p2->set_id(67);
                 $p2->select();
                 $recipients[$p1->get_value("emailAddress")] = array("name" => $p1->get_name(), "addIP" => true, "internal" => true);
                 $recipients[$p2->get_value("emailAddress")] = array("name" => $p2->get_name(), "addIP" => true, "internal" => true);
                 $comment = $p2->get_name() . ",\n\n" . $taskname1 . "\n\n" . $taskDesc;
                 $commentID = comment::add_comment("task", $task->get_id(), $comment, "task", $task->get_id());
                 $emailRecipients = comment::add_interested_parties($commentID, null, $recipients);
                 // Re-email the comment out, including any attachments
                 if (!comment::send_comment($commentID, $emailRecipients)) {
                     alloc_error("Email failed to send.");
                 } else {
                     $TPL["message_good"][] = "Emailed task comment to " . $p1->get_value("emailAddress") . ", " . $p2->get_value("emailAddress") . ".";
                 }
             }
         } else {
             if ($status == "admin" && $this->have_perm(PERM_APPROVE_PRODUCT_TRANSACTIONS)) {
                 $this->set_value("status", "finished");
                 if ($_REQUEST["changeTransactionStatus"]) {
                     $rows = $this->get_productSaleItems();
                     foreach ($rows as $row) {
                         $ids[] = $row["productSaleItemID"];
                     }
                     if ($ids) {
                         $q = prepare("UPDATE transaction SET status = '%s' WHERE productSaleItemID in (%s)", $_REQUEST["changeTransactionStatus"], $ids);
                         $db = new db_alloc();
                         $db->query($q);
                     }
                 }
                 // 2. from admin to salesperson
//.........这里部分代码省略.........
开发者ID:cjbayliss,项目名称:alloc,代码行数:101,代码来源:productSale.inc.php

示例10: validate

 function validate($parent)
 {
     global $TPL;
     if ($parent->doMoney && $this->type == "money") {
         $c = $parent->currency;
         if ($this->currency && isset($parent->data_fields[$this->currency])) {
             $c = $parent->get_value($this->currency);
         }
         if (!$c) {
             return "db_field::validate(): No currency specified for " . $parent->classname . "." . $this->name . " (currency:" . $c . ")";
         } else {
             if ($this->value != $parent->all_row_fields[$this->name]) {
                 $this->set_value(page::money($c, $this->value, "%mi"));
             }
         }
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:17,代码来源:db_field.inc.php

示例11: get_changes_list

 function get_changes_list()
 {
     // This function returns HTML rows for the changes that have been made to this project
     $rows = array();
     $people_cache =& get_cached_table("person");
     $timeUnit = new timeUnit();
     $timeUnits = array_reverse($timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelA"), true);
     $options = array("projectID" => $this->get_id());
     $changes = audit::get_list($options);
     foreach ((array) $changes as $audit) {
         $changeDescription = "";
         $newValue = $audit['value'];
         switch ($audit['field']) {
             case 'created':
                 $changeDescription = $newValue;
                 break;
             case 'dip':
                 $changeDescription = "Default parties set to " . interestedParty::abbreviate($newValue);
                 break;
             case 'projectShortName':
                 $changeDescription = "Project nickname set to '{$newValue}'.";
                 break;
             case 'projectComments':
                 $changeDescription = "Project description set to <a class=\"magic\" href=\"#x\" onclick=\"\$('#audit" . $audit["auditID"] . "').slideToggle('fast');\">Show</a> <div class=\"hidden\" id=\"audit" . $audit["auditID"] . "\"><div>" . $newValue . "</div></div>";
                 break;
             case 'clientID':
                 $newClient = new client($newValue);
                 is_object($newClient) and $newClientLink = $newClient->get_link();
                 $newClientLink or $newClientLink = "&lt;empty&gt;";
                 $changeDescription = "Client set to " . $newClientLink . ".";
                 break;
             case 'clientContactID':
                 $newClientContact = new clientContact($newValue);
                 is_object($newClientContact) and $newClientContactLink = $newClientContact->get_link();
                 $newClientContactLink or $newClientContactLink = "&lt;empty&gt;";
                 $changeDescription = "Client contact set to " . $newClientContactLink . ".";
                 break;
             case 'projectType':
                 $changeDescription = "Project type set to " . $newValue . ".";
                 break;
             case 'projectBudget':
                 $changeDescription = "Project budget set to " . page::money($this->get_value("currencyTypeID"), $newValue) . ".";
                 break;
             case 'currencyTypeID':
                 $changeDescription = "Project currency set to " . $newValue . ".";
                 break;
             case 'projectStatus':
                 $changeDescription = "Project status set to " . $newValue . ".";
                 break;
             case 'projectName':
                 $changeDescription = "Project name set to '{$newValue}'.";
                 break;
             case 'cost_centre_tfID':
                 $newCostCentre = new tf($newValue);
                 is_object($newCostCentre) and $newCostCentreLink = $newCostCentre->get_link();
                 $newCostCentreLink or $newCostCentreLink = "&lt;empty&gt;";
                 $changeDescription = "Cost centre TF set to " . $newCostCentreLink . ".";
                 break;
             case 'customerBilledDollars':
                 $changeDescription = "Client billing set to " . page::money($this->get_value("currencyTypeID"), $newValue) . ".";
                 break;
             case 'defaultTaskLimit':
                 $changeDescription = "Default task limit set to " . $newValue . ".";
                 break;
             case 'defaultTimeSheetRate':
                 $changeDescription = "Default time sheet rate set to " . page::money($this->get_value("currencyTypeID"), $newValue) . ".";
                 break;
             case 'defaultTimeSheetRateUnitID':
                 $changeDescription = "Default time sheet rate unit set to '" . $timeUnits[$newValue] . "'.";
                 break;
             case 'projectPriority':
                 $priorities = config::get_config_item("projectPriorities");
                 $changeDescription = sprintf('Project priority set to <span style="color: %s;">%s</span>.', $priorities[$newValue]["colour"], $priorities[$newValue]["label"]);
                 break;
             case 'dateActualCompletion':
             case 'dateActualStart':
             case 'dateTargetStart':
             case 'dateTargetCompletion':
                 // these cases are more or less identical
                 switch ($audit['field']) {
                     case 'dateActualCompletion':
                         $fieldDesc = "actual completion date";
                         break;
                     case 'dateActualStart':
                         $fieldDesc = "actual start date";
                         break;
                     case 'dateTargetStart':
                         $fieldDesc = "estimate/target start date";
                         break;
                     case 'dateTargetCompletion':
                         $fieldDesc = "estimate/target completion date";
                         break;
                 }
                 if (!$newValue) {
                     $changeDescription = "The {$fieldDesc} was removed.";
                 } else {
                     $changeDescription = "The {$fieldDesc} set to {$newValue}.";
                 }
                 break;
         }
//.........这里部分代码省略.........
开发者ID:cjbayliss,项目名称:alloc,代码行数:101,代码来源:project.inc.php

示例12: get_list

 public static function get_list($_FORM)
 {
     /*
      * This is the definitive method of getting a list of timeSheetItems that need a sophisticated level of filtering
      *
      */
     global $TPL;
     $filter = timeSheetItem::get_list_filter($_FORM);
     $debug = $_FORM["debug"];
     $debug and print "<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
     $debug and print "<pre>filter: " . print_r($filter, 1) . "</pre>";
     $_FORM["return"] or $_FORM["return"] = "html";
     if (is_array($filter) && count($filter)) {
         $filter = " WHERE " . implode(" AND ", $filter);
     }
     $q = "SELECT * FROM timeSheetItem\n       LEFT JOIN timeSheet ON timeSheet.timeSheetID = timeSheetItem.timeSheetID\n                 " . $filter . "\n        ORDER BY timeSheet.timeSheetID,dateTimeSheetItem asc";
     $debug and print "Query: " . $q;
     $db = new db_alloc();
     $db->query($q);
     while ($row = $db->next_record()) {
         $print = true;
         $t = new timeSheet();
         $t->read_db_record($db);
         $tsi = new timeSheetItem();
         $tsi->read_db_record($db);
         $tsi->currency = $t->get_value("currencyTypeID");
         $row["secondsBilled"] = $row["hoursBilled"] = $row["timeLimit"] = $row["limitWarning"] = "";
         # set these for the CLI
         if ($tsi->get_value("taskID")) {
             $task = $tsi->get_foreign_object('task');
             $row["secondsBilled"] = $task->get_time_billed();
             $row["hoursBilled"] = sprintf("%0.2f", $row["secondsBilled"] / 60 / 60);
             $task->get_value('timeLimit') && $row["hoursBilled"] > $task->get_value('timeLimit') and $row["limitWarning"] = 'Exceeds Limit!';
             $row["timeLimit"] = $task->get_value("timeLimit");
         }
         $row["rate"] = $tsi->get_value("rate", DST_HTML_DISPLAY);
         $row["worth"] = page::money($tsi->currency, $row["rate"] * $tsi->get_value("multiplier") * $tsi->get_value("timeSheetItemDuration"), "%m");
         $rows[$row["timeSheetItemID"]] = $row;
     }
     if ($print && $_FORM["return"] == "array") {
         return $rows;
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:43,代码来源:timeSheetItem.inc.php

示例13: get_list

 public static function get_list($_FORM)
 {
     /*
      * This is the definitive method of getting a list of invoices that need a sophisticated level of filtering
      *
      */
     global $TPL;
     $filter1_where = invoice::get_list_filter($_FORM);
     $filter2_having = invoice::get_list_filter2($_FORM);
     $debug = $_FORM["debug"];
     $debug and print "<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
     $debug and print "<pre>filter1_where: " . print_r($filter1_where, 1) . "</pre>";
     $debug and print "<pre>filter2_having: " . print_r($filter2_having, 1) . "</pre>";
     $_FORM["return"] or $_FORM["return"] = "html";
     is_array($filter1_where) && count($filter1_where) and $f1_where = " WHERE " . implode(" AND ", $filter1_where);
     is_array($filter2_having) && count($filter2_having) and $f2_having = " HAVING " . implode(" AND ", $filter2_having);
     $q1 = "CREATE TEMPORARY TABLE invoice_details\n          SELECT SUM(invoiceItem.iiAmount * pow(10,-currencyType.numberToBasic)) as iiAmountSum\n               , invoice.*\n               , client.clientName\n            FROM invoice\n       LEFT JOIN invoiceItem on invoiceItem.invoiceID = invoice.invoiceID\n       LEFT JOIN client ON invoice.clientID = client.clientID\n       LEFT JOIN currencyType on invoice.currencyTypeID = currencyType.currencyTypeID\n              {$f1_where}\n        GROUP BY invoice.invoiceID\n        ORDER BY invoiceDateFrom";
     $db = new db_alloc();
     #$db->query("DROP TABLE IF EXISTS invoice_details");
     $db->query($q1);
     $q2 = "SELECT invoice_details.*\n               , SUM(transaction_approved.amount) as amountPaidApproved\n               , SUM(transaction_pending.amount) as amountPaidPending\n               , SUM(transaction_rejected.amount) as amountPaidRejected\n            FROM invoice_details\n       LEFT JOIN invoiceItem on invoiceItem.invoiceID = invoice_details.invoiceID\n       LEFT JOIN transaction transaction_approved on invoiceItem.invoiceItemID = transaction_approved.invoiceItemID AND transaction_approved.status='approved'\n       LEFT JOIN transaction transaction_pending on invoiceItem.invoiceItemID = transaction_pending.invoiceItemID AND transaction_pending.status='pending'\n       LEFT JOIN transaction transaction_rejected on invoiceItem.invoiceItemID = transaction_rejected.invoiceItemID AND transaction_rejected.status='rejected'\n        GROUP BY invoice_details.invoiceID\n              {$f2_having}\n        ORDER BY invoiceDateFrom";
     // Don't do this! It doubles the totals!
     //LEFT JOIN tfPerson ON tfPerson.tfID = transaction_approved.tfID OR tfPerson.tfID = transaction_pending.tfID OR tfPerson.tfID = transaction_rejected.tfID
     $debug and print "<pre>Query1: " . $q1 . "</pre>";
     $debug and print "<pre>Query2: " . $q2 . "</pre>";
     $db->query($q2);
     while ($row = $db->next_record()) {
         $print = true;
         $i = new invoice();
         $i->read_db_record($db);
         $row["amountPaidApproved"] = page::money($row["currencyTypeID"], $row["amountPaidApproved"], "%mo");
         $row["amountPaidPending"] = page::money($row["currencyTypeID"], $row["amountPaidPending"], "%mo");
         $row["amountPaidRejected"] = page::money($row["currencyTypeID"], $row["amountPaidRejected"], "%mo");
         $row["invoiceLink"] = $i->get_invoice_link();
         $payment_status = array();
         $row["statii"] = invoice::get_invoice_statii();
         $row["payment_statii"] = invoice::get_invoice_statii_payment();
         $row["amountPaidApproved"] == $row["iiAmountSum"] and $payment_status[] = "fully_paid";
         $row["amountPaidApproved"] > $row["iiAmountSum"] and $payment_status[] = "over_paid";
         $row["amountPaidRejected"] > 0 and $payment_status[] = "rejected";
         #$row["amountPaidApproved"] > 0 && $row["amountPaidApproved"] < $row["iiAmountSum"] and $payment_status[] = "partly_paid";
         $row["amountPaidApproved"] < $row["iiAmountSum"] and $payment_status[] = "pending";
         foreach ((array) $payment_status as $ps) {
             $row["image"] .= invoice::get_invoice_statii_payment_image($ps);
             $row["status_label"] .= $ps;
         }
         $row["_FORM"] = $_FORM;
         $row = array_merge($TPL, (array) $row);
         $rows[$row["invoiceID"]] = $row;
     }
     return $rows;
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:52,代码来源:invoice.inc.php

示例14: create_transactions

 function create_transactions()
 {
     $db = new db_alloc();
     $db2 = new db_alloc();
     $product = $this->get_foreign_object("product");
     $productSale = $this->get_foreign_object("productSale");
     $productName = $product->get_value("productName");
     $taxName = config::get_config_item("taxName");
     $taxTfID = config::get_config_item("taxTfID");
     $mainTfID = $productSale->get_value("tfID");
     // Next transaction represents the amount that someone has paid the
     // sellPrice amount for the product. This money is transferred from
     // the Incoming transactions TF, to the Main Finance TF.
     $this->create_transaction(config::get_config_item("inTfID"), $mainTfID, page::money($this->get_value("sellPriceCurrencyTypeID"), $this->get_value("sellPrice"), "%mo"), "Product Sale: " . $productName, $this->get_value("sellPriceCurrencyTypeID"));
     // Now loop through all the productCosts for the sale items product.
     $query = prepare("SELECT productCost.*, product.productName\n                        FROM productCost \n                   LEFT JOIN product ON product.productID = productCost.productID\n                       WHERE productCost.productID = %d \n                         AND isPercentage != 1\n                         AND productCostActive = true\n                    ORDER BY productCostID", $this->get_value("productID"));
     $db2->query($query);
     while ($productCost_row = $db2->next_record()) {
         $amount = page::money($productCost_row["currencyTypeID"], $productCost_row["amount"] * $this->get_value("quantity"), "%mo");
         $this->create_transaction($productCost_row["tfID"], config::get_config_item("outTfID"), $amount, "Product Cost: " . $productCost_row["productName"] . " " . $productCost_row["description"], $productCost_row["currencyTypeID"], $productCost_row["productCostID"]);
     }
     // Need to do the percentages separately because they rely on the $totalUnallocated figure
     $totalUnallocated = page::money(config::get_config_item("currency"), $this->get_amount_unallocated(), "%mo");
     // Now loop through all the productCosts % COMMISSIONS for the sale items product.
     $query = prepare("SELECT productCost.*, product.productName\n                        FROM productCost \n                   LEFT JOIN product ON product.productID = productCost.productID\n                       WHERE productCost.productID = %d \n                         AND isPercentage = 1\n                         AND productCostActive = true\n                    ORDER BY productCostID", $this->get_value("productID"));
     $db2->query($query);
     while ($productComm_row = $db2->next_record()) {
         $amount = page::money($productComm_row["currencyTypeID"], $totalUnallocated * $productComm_row["amount"] / 100, "%mo");
         $this->create_transaction($mainTfID, $productComm_row["tfID"], $amount, "Product Commission: " . $productComm_row["productName"] . " " . $productComm_row["description"], config::get_config_item("currency"), $productComm_row["productCostID"]);
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:productSaleItem.inc.php

示例15: get_list

 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;
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:37,代码来源:expenseForm.inc.php


注:本文中的page::money方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。