示例#1
0
function show_productCost_new($template, $percent = false)
{
    global $TPL;
    $t = new meta("currencyType");
    $currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID");
    $productCost = new productCost();
    $productCost->set_values();
    // wipe clean
    $TPL["currencyOptions"] = page::select_options($currency_array, $productCost->get_value("currencyTypeID"));
    $TPL["taxOptions"] = page::select_options(array("" => "Exempt", 1 => "Included", 0 => "Excluded"), "1");
    $TPL["display"] = "display:none";
    include_template($template);
}
示例#2
0
get_cached_table("config", true);
// flush cache
if (has("finance")) {
    $tf = new tf();
    $options = $tf->get_assoc_array("tfID", "tfName");
}
$TPL["mainTfOptions"] = page::select_options($options, config::get_config_item("mainTfID"));
$TPL["outTfOptions"] = page::select_options($options, config::get_config_item("outTfID"));
$TPL["inTfOptions"] = page::select_options($options, config::get_config_item("inTfID"));
$TPL["taxTfOptions"] = page::select_options($options, config::get_config_item("taxTfID"));
$TPL["expenseFormTfOptions"] = page::select_options($options, config::get_config_item("expenseFormTfID"));
$tabops = array("home" => "Home", "client" => "Clients", "project" => "Projects", "task" => "Tasks", "time" => "Time", "invoice" => "Invoices", "sale" => "Sales", "person" => "People", "wiki" => "Wiki", "inbox" => "Inbox", "tools" => "Tools");
$selected_tabops = config::get_config_item("allocTabs") or $selected_tabops = array_keys($tabops);
$TPL["allocTabsOptions"] = page::select_options($tabops, $selected_tabops);
$m = new meta("currencyType");
$currencyOptions = $m->get_assoc_array("currencyTypeID", "currencyTypeName");
$TPL["currencyOptions"] = page::select_options($currencyOptions, config::get_config_item("currency"));
$db = new db_alloc();
$display = array("", "username", ", ", "emailAddress");
$person = new person();
$people =& get_cached_table("person");
foreach ($people as $p) {
    $peeps[$p["personID"]] = $p["name"];
}
// get the default time sheet manager/admin options
$TPL["defaultTimeSheetManagerListText"] = get_person_list(config::get_config_item("defaultTimeSheetManagerList"));
$TPL["defaultTimeSheetAdminListText"] = get_person_list(config::get_config_item("defaultTimeSheetAdminList"));
$days = array("Sun" => "Sun", "Mon" => "Mon", "Tue" => "Tue", "Wed" => "Wed", "Thu" => "Thu", "Fri" => "Fri", "Sat" => "Sat");
$TPL["calendarFirstDayOptions"] = page::select_options($days, config::get_config_item("calendarFirstDay"));
$TPL["timeSheetPrintOptions"] = page::select_options($TPL["timeSheetPrintOptions"], $TPL["timeSheetPrint"]);
$commentTemplate = new commentTemplate();
示例#3
0
        alloc_error("No permissions to generate TF list");
    }
}
//special case for disabled TF. Include it in the list, but also add a warning message.
$tf = new tf();
$tf->set_id($transactionRepeat->get_value("tfID"));
if ($tf->select() && !$tf->get_value("tfActive")) {
    $TPL["message_help"][] = "This expense is allocated to an inactive TF. It will not create transactions.";
}
$tf = new tf();
$tf->set_id($transactionRepeat->get_value("fromTfID"));
if ($tf->select() && !$tf->get_value("tfActive")) {
    $TPL["message_help"][] = "This expense is sourced from an inactive TF. It will not create transactions.";
}
$m = new meta("currencyType");
$currencyOps = $m->get_assoc_array("currencyTypeID", "currencyTypeID");
$TPL["currencyTypeOptions"] = page::select_options($currencyOps, $transactionRepeat->get_value("currencyTypeID"));
$TPL["tfOptions"] = page::select_options($q, $transactionRepeat->get_value("tfID"));
$TPL["fromTfOptions"] = page::select_options($q, $transactionRepeat->get_value("fromTfID"));
$TPL["basisOptions"] = page::select_options(array("weekly" => "weekly", "fortnightly" => "fortnightly", "monthly" => "monthly", "quarterly" => "quarterly", "yearly" => "yearly"), $transactionRepeat->get_value("paymentBasis"));
$TPL["transactionTypeOptions"] = page::select_options(transaction::get_transactionTypes(), $transactionRepeat->get_value("transactionType"));
if (is_object($transactionRepeat) && $transactionRepeat->get_id() && $current_user->have_role("admin")) {
    $TPL["adminButtons"] .= '
  <select name="changeTransactionStatus"><option value="">Transaction Status<option value="approved">Approve<option value="rejected">Reject<option value="pending">Pending</select>
  ';
}
if (is_object($transactionRepeat) && $transactionRepeat->get_id() && $transactionRepeat->get_value("status") == "pending") {
    $TPL["message_help"][] = "This Repeating Expense will only create Transactions once its status is Approved.";
} else {
    if (!$transactionRepeat->get_id()) {
        $TPL["message_help"][] = "Complete all the details and click the Save button to create an automatically Repeating Expense";
示例#4
0
            return;
        } else {
            if ($_POST["delete"]) {
                $client->read_globals();
                $client->delete();
                alloc_redirect($TPL["url_alloc_clientList"]);
            } else {
                $client->set_id($clientID);
                $client->select();
            }
            $client->set_values("client_");
        }
    }
}
$m = new meta("clientStatus");
$clientStatus_array = $m->get_assoc_array("clientStatusID", "clientStatusID");
$TPL["clientStatusOptions"] = page::select_options($clientStatus_array, $client->get_value("clientStatus"));
$clientCategories = config::get_config_item("clientCategories") or $clientCategories = array();
foreach ($clientCategories as $k => $v) {
    $cc[$v["value"]] = $v["label"];
}
$TPL["clientCategoryOptions"] = page::select_options($cc, $client->get_value("clientCategory"));
$client->get_value("clientCategory") and $TPL["client_clientCategoryLabel"] = $cc[$client->get_value("clientCategory")];
// client contacts
if ($_POST["clientContact_save"] || $_POST["clientContact_delete"]) {
    $clientContact = new clientContact();
    $clientContact->read_globals();
    if ($_POST["clientContact_save"]) {
        #$clientContact->set_value('clientID', $_POST["clientID"]);
        $clientContact->save();
    }
示例#5
0
 function load_task_filter($_FORM)
 {
     $current_user =& singleton("current_user");
     $db = new db_alloc();
     // Load up the forms action url
     $rtn["url_form_action"] = $_FORM["url_form_action"];
     $rtn["hide_field_options"] = $_FORM["hide_field_options"];
     //time Load up the filter bits
     has("project") and $rtn["projectOptions"] = project::get_list_dropdown($_FORM["projectType"], $_FORM["projectID"]);
     $_FORM["projectType"] and $rtn["projectType_checked"][$_FORM["projectType"]] = " checked";
     $ops = array("0" => "Nobody");
     $rtn["personOptions"] = page::select_options($ops + person::get_username_list($_FORM["personID"]), $_FORM["personID"]);
     $rtn["managerPersonOptions"] = page::select_options($ops + person::get_username_list($_FORM["managerID"]), $_FORM["managerID"]);
     $rtn["creatorPersonOptions"] = page::select_options(person::get_username_list($_FORM["creatorID"]), $_FORM["creatorID"]);
     $rtn["all_tags"] = task::get_tags(true);
     $rtn["tags"] = $_FORM["tags"];
     $taskType = new meta("taskType");
     $taskType_array = $taskType->get_assoc_array("taskTypeID", "taskTypeID");
     $rtn["taskTypeOptions"] = page::select_options($taskType_array, $_FORM["taskTypeID"]);
     $_FORM["taskView"] and $rtn["taskView_checked_" . $_FORM["taskView"]] = " checked";
     $taskStatii = task::get_task_statii_array();
     $rtn["taskStatusOptions"] = page::select_options($taskStatii, $_FORM["taskStatus"]);
     $_FORM["showDescription"] and $rtn["showDescription_checked"] = " checked";
     $_FORM["showDates"] and $rtn["showDates_checked"] = " checked";
     $_FORM["showCreator"] and $rtn["showCreator_checked"] = " checked";
     $_FORM["showAssigned"] and $rtn["showAssigned_checked"] = " checked";
     $_FORM["showTimes"] and $rtn["showTimes_checked"] = " checked";
     $_FORM["showPercent"] and $rtn["showPercent_checked"] = " checked";
     $_FORM["showPriority"] and $rtn["showPriority_checked"] = " checked";
     $_FORM["showTaskID"] and $rtn["showTaskID_checked"] = " checked";
     $_FORM["showManager"] and $rtn["showManager_checked"] = " checked";
     $_FORM["showProject"] and $rtn["showProject_checked"] = " checked";
     $_FORM["showTags"] and $rtn["showTags_checked"] = " checked";
     $_FORM["showParentID"] and $rtn["showParentID_checked"] = " checked";
     $arrow = " --&gt;";
     $taskDateOps = array("" => "", "new" => "New Tasks", "due_today" => "Due Today", "overdue" => "Overdue", "d_created" => "Date Created" . $arrow, "d_assigned" => "Date Assigned" . $arrow, "d_targetStart" => "Estimated Start" . $arrow, "d_targetCompletion" => "Estimated Completion" . $arrow, "d_actualStart" => "Date Started" . $arrow, "d_actualCompletion" => "Date Completed" . $arrow);
     $rtn["taskDateOptions"] = page::select_options($taskDateOps, $_FORM["taskDate"], 45, false);
     if (!in_array($_FORM["taskDate"], array("new", "due_today", "overdue"))) {
         $rtn["dateOne"] = $_FORM["dateOne"];
         $rtn["dateTwo"] = $_FORM["dateTwo"];
     }
     $task_num_ops = array("" => "All results", 1 => "1 result", 2 => "2 results", 3 => "3 results", 4 => "4 results", 5 => "5 results", 10 => "10 results", 15 => "15 results", 20 => "20 results", 30 => "30 results", 40 => "40 results", 50 => "50 results", 100 => "100 results", 150 => "150 results", 200 => "200 results", 300 => "300 results", 400 => "400 results", 500 => "500 results", 1000 => "1000 results", 2000 => "2000 results", 3000 => "3000 results", 4000 => "4000 results", 5000 => "5000 results", 10000 => "10000 results");
     $rtn["limitOptions"] = page::select_options($task_num_ops, $_FORM["limit"]);
     // unset vars that aren't necessary
     foreach ((array) $_FORM as $k => $v) {
         if (!$v) {
             unset($_FORM[$k]);
         }
     }
     // Get
     $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM));
     return $rtn;
 }
示例#6
0
 function get_project_type_array()
 {
     // optimization
     static $rows;
     if (!$rows) {
         $m = new meta("projectType");
         $rows = $m->get_assoc_array("projectTypeID", "projectTypeID");
     }
     return $rows;
 }
示例#7
0
    $tf->set_id($TPL["project_cost_centre_tfID"]);
    $tf->select();
    $TPL["cost_centre_tfID_label"] = $tf->get_link();
}
$query = prepare("SELECT roleName,roleID FROM role WHERE roleLevel = 'project' ORDER BY roleSequence");
$db->query($query);
#$project_person_role_array[] = "";
while ($db->next_record()) {
    $project_person_role_array[$db->f("roleID")] = $db->f("roleName");
}
$email_type_array = array("None" => "None", "Assigned Tasks" => "Assigned Tasks", "All Tasks" => "All Tasks");
$t = new meta("currencyType");
$currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID");
$projectType_array = project::get_project_type_array();
$m = new meta("projectStatus");
$projectStatus_array = $m->get_assoc_array("projectStatusID", "projectStatusID");
$timeUnit = new timeUnit();
$rate_type_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelB");
$TPL["project_projectType"] = $projectType_array[$TPL["project_projectType"]];
$TPL["projectType_options"] = page::select_options($projectType_array, $TPL["project_projectType"]);
$TPL["projectStatus_options"] = page::select_options($projectStatus_array, $TPL["project_projectStatus"]);
$TPL["project_projectPriority"] or $TPL["project_projectPriority"] = 3;
$projectPriorities = config::get_config_item("projectPriorities") or $projectPriorities = array();
$tp = array();
foreach ($projectPriorities as $key => $arr) {
    $tp[$key] = $arr["label"];
}
$TPL["projectPriority_options"] = page::select_options($tp, $TPL["project_projectPriority"]);
$TPL["project_projectPriority"] and $TPL["priorityLabel"] = " <div style=\"display:inline; color:" . $projectPriorities[$TPL["project_projectPriority"]]["colour"] . "\">[" . $tp[$TPL["project_projectPriority"]] . "]</div>";
$TPL["defaultTimeSheetRate"] = $project->get_value("defaultTimeSheetRate");
$TPL["defaultTimeSheetUnit_options"] = page::select_options($rate_type_array, $project->get_value("defaultTimeSheetRateUnitID"));
示例#8
0
            }
            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();
$TPL["transactionTypeOptions"] = page::select_options($transactionTypes, $transaction->get_value("transactionType"));
is_object($transaction) and $TPL["transactionTypeLink"] = $transaction->get_transaction_type_link();
$db = new db_alloc();
$tf = new tf();
$options = $tf->get_assoc_array("tfID", "tfName");
// Special cases for the current tfID and fromTfID
$options = add_tf($transaction->get_value("tfID"), $options, "tfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)");
$options = add_tf($transaction->get_value("fromTfID"), $options, "fromTfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)");
$TPL["tfIDOptions"] = page::select_options($options, $transaction->get_value("tfID"));
$TPL["fromTfIDOptions"] = page::select_options($options, $transaction->get_value("fromTfID"));
$q = "SELECT projectID as value, projectName as label FROM project WHERE projectStatus = 'Current' ORDER BY projectName";
示例#9
0
 function load_client_filter($_FORM)
 {
     global $TPL;
     $db = new db_alloc();
     // Load up the forms action url
     $rtn["url_form_action"] = $_FORM["url_form_action"];
     $m = new meta("clientStatus");
     $clientStatus_array = $m->get_assoc_array("clientStatusID", "clientStatusID");
     $rtn["clientStatusOptions"] = page::select_options($clientStatus_array, $_FORM["clientStatus"]);
     $rtn["clientName"] = $_FORM["clientName"];
     $rtn["contactName"] = $_FORM["contactName"];
     $letters = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "ALL");
     foreach ($letters as $letter) {
         if ($_FORM["clientLetter"] == $letter) {
             $rtn["alphabet_filter"] .= "&nbsp;&nbsp;" . $letter;
         } else {
             $rtn["alphabet_filter"] .= "&nbsp;&nbsp;<a href=\"" . $TPL["url_alloc_clientList"] . "clientLetter=" . $letter . "&clientStatus=Current&applyFilter=1\">" . $letter . "</a>";
         }
     }
     $clientCategory = $_FORM["clientCategory"];
     $clientCategories = config::get_config_item("clientCategories") or $clientCategories = array();
     foreach ($clientCategories as $k => $v) {
         $cc[$v["value"]] = $v["label"];
     }
     $rtn["clientCategoryOptions"] = page::select_options($cc, $clientCategory);
     // Get
     $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM));
     return $rtn;
 }
示例#10
0
    $item->set_value("itemType", $_POST["update_itemType"]);
    $item->save();
}
if ($_POST["remove_items"]) {
    for ($i = 0; $i < count($_POST["itemID"]); $i++) {
        $item = new item();
        $item->set_id($_POST["itemID"][$i]);
        $item->select();
        $item->delete();
    }
}
//so that the user can edit the item later
$TPL["personID"] = $current_user->get_id();
// item types
$itemType = new meta("itemType");
$TPL["itemTypes"] = page::select_options($itemType->get_assoc_array("itemTypeID", "itemTypeID"), $item->get_value("itemType"));
// setup item list (for removals)
$item_list = array();
$db = new db_alloc();
$db->query("SELECT * FROM item ORDER BY itemName");
while ($db->next_record()) {
    $item = new item();
    $item->read_db_record($db);
    $item_list[$item->get_id()] = $item->get_value('itemName');
}
$TPL["item_list"] = page::select_options($item_list, "");
if ($_POST["edit_items"]) {
    $item = new item();
    $item->set_id($_POST["itemID"][0]);
    $item->select();
    if (count($_POST["itemID"]) < 1) {
示例#11
0
function show_transaction_new($template)
{
    global $TPL;
    global $tflist;
    $transaction = new transaction();
    $transaction->set_values();
    // wipe clean
    $TPL["display"] = "display:none";
    $m = new meta("currencyType");
    $currencyOptions = $m->get_assoc_array("currencyTypeID", "currencyTypeID");
    $TPL["currencyOptions"] = page::select_options($currencyOptions);
    $TPL["tfList_dropdown"] = page::select_options($tflist);
    $TPL["fromTfList_dropdown"] = page::select_options($tflist);
    if (CAN_APPROVE_TRANSACTIONS && $TPL["productSale_status"] == "admin") {
        $TPL["status"] = "<select name='status[]' class='txStatus'>";
        $TPL["status"] .= page::select_options(transaction::get_transactionStatii()) . "</select>";
    }
    $TPL["pc_productCostID"] = '';
    $TPL["pc_amount"] = '';
    $TPL["pc_isPercentage"] = '';
    $TPL["pc_currency"] = '';
    $TPL["amountClass"] = '';
    include_template($template);
}