Пример #1
0
            if (file_exists($logo)) {
                if (unlink($logo)) {
                    $TPL["message_good"][] = "Deleted " . $logo;
                }
            }
            if (file_exists($logo)) {
                alloc_error("Unable to delete " . $logo);
            }
        }
    }
}
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();
Пример #2
0
function show_new_transaction($template)
{
    global $timeSheet;
    global $TPL;
    global $db;
    global $percent_array;
    if ($timeSheet->get_value("status") == "invoiced" && $timeSheet->have_perm(PERM_TIME_INVOICE_TIMESHEETS)) {
        $tf = new tf();
        $options = $tf->get_assoc_array("tfID", "tfName");
        $TPL["tf_options"] = page::select_options($options, $none);
        $transactionType_options = transaction::get_transactionTypes();
        $TPL["transactionType_options"] = page::select_options($transactionType_options);
        $status_options = array("pending" => "Pending", "approved" => "Approved", "rejected" => "Rejected");
        $TPL["status_options"] = page::select_options($status_options);
        $TPL["transaction_timeSheetID"] = $timeSheet->get_id();
        $TPL["transaction_transactionDate"] = date("Y-m-d");
        $TPL["transaction_product"] = "";
        $TPL["transaction_buttons"] = '
            <button type="submit" name="transaction_save" value="1" class="save_button">Add<i class="icon-plus-sign"></i></button>
      ';
        $TPL["percent_dropdown"] = page::select_options($percent_array, $empty);
        include_template($template);
    }
}
Пример #3
0
$TPL["field_maxAmount"] = '<input type="text" name="maxAmount" size="10" value="' . $invoice->get_value("maxAmount", DST_HTML_DISPLAY) . '"> ';
$TPL["field_maxAmount"] .= page::help('invoice_maxAmount');
$TPL["field_invoiceDateFrom"] = page::calendar("invoiceDateFrom", $TPL["invoiceDateFrom"]);
$TPL["field_invoiceDateTo"] = page::calendar("invoiceDateTo", $TPL["invoiceDateTo"]);
$clientID = $invoice->get_value("clientID") or $clientID = $_GET["clientID"];
$projectID = $invoice->get_value("projectID") or $projectID = $_GET["projectID"];
list($client_select, $client_link, $project_select, $project_link) = client::get_client_and_project_dropdowns_and_links($clientID, $projectID);
$tf = new tf();
if ($invoice->get_value("tfID")) {
    $tf->set_id($invoice->get_value("tfID"));
    $tf->select();
    $tf_link = $tf->get_link();
    $tf_sel = $invoice->get_value("tfID");
}
$tf_sel or $tf_sel = config::get_config_item("mainTfID");
$tf_select = "<select id='tfID' name='tfID'>" . page::select_options($tf->get_assoc_array("tfID", "tfName"), $tf_sel) . "</select>";
// Main invoice buttons
if ($current_user->have_role('admin')) {
    if (!$invoiceID) {
        $_GET["clientID"] and $TPL["clientID"] = $_GET["clientID"];
        $TPL["invoice_buttons"] = '
         <button type="submit" name="save" value="1" class="save_button">Create Invoice<i class="icon-ok-sign"></i></button>
    ';
        $TPL["field_clientID"] = $client_select;
        $TPL["field_projectID"] = $project_select;
        $TPL["field_tfID"] = $tf_select;
    } else {
        if ($invoice->get_value("invoiceStatus") == "edit") {
            $TPL["invoice_buttons"] = '
        <button type="submit" name="delete" value="1" class="delete_button">Delete<i class="icon-trash"></i></button>
        <button type="submit" name="save" value="1" class="save_button">Save<i class="icon-ok-sign"></i></button>
Пример #4
0
    global $tflist;
    $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();
Пример #5
0
/*
 * Copyright (C) 2006-2011 Alex Lance, Clancy Malcolm, Cyber IT Solutions
 * Pty. Ltd.
 * 
 * This file is part of the allocPSA application <*****@*****.**>.
 * 
 * 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";
if ($_GET["projectID"]) {
    usleep(300000);
    $project = new project();
    $project->set_id($_GET["projectID"]);
    $project->select();
    $tf_sel = $project->get_value("cost_centre_tfID") or $tf_sel = config::get_config_item("mainTfID");
    $tf = new tf();
    $options = page::select_options($tf->get_assoc_array("tfID", "tfName"), $tf_sel);
    echo "<select id=\"tfID\" name=\"tfID\">" . $options . "</select>";
}
Пример #6
0
 function load_transaction_filter($_FORM)
 {
     global $TPL;
     $rtn["statusOptions"] = page::select_options(array("" => "", "pending" => "Pending", "approved" => "Approved", "rejected" => "Rejected"), $_FORM["status"]);
     $transactionTypeOptions = transaction::get_transactionTypes();
     $rtn["transactionTypeOptions"] = page::select_options($transactionTypeOptions, $_FORM["transactionType"]);
     $rtn["startDate"] = $_FORM["startDate"];
     $rtn["endDate"] = $_FORM["endDate"];
     if ($_FORM["monthDate"]) {
         $rtn["startDate"] = format_date("Y-m-", $_FORM["monthDate"]) . "01";
         $t = format_date("U", $_FORM["monthDate"]);
         $rtn["endDate"] = date("Y-m-d", mktime(1, 1, 1, date("m", $t) + 1, 1, date("Y", $t)));
     }
     $display_format = "M";
     // Fiddle $_FORM["monthDate"]. It may be a real date (2010-11-23) so change the last 2 chars to "01".
     $_FORM["monthDate"] = substr_replace($_FORM["monthDate"], "01", 8);
     // If this month is January, go from last Feb to this Feb
     $m = date("m") + 1;
     $y = date("Y");
     // jump back a year iff it's December now
     if ($m == 13) {
         $m = 1;
     } else {
         $y -= 1;
     }
     $label_monthDate = date($display_format);
     for ($j = 0; $j < 13; $j++) {
         $label = date($display_format, mktime(0, 0, 0, $m, 1, $y));
         $monthDate = date("Y-m-d", mktime(0, 0, 0, $m, 1, $y));
         $bold = false;
         if ($monthDate == format_date("Y-m-d", $_FORM["monthDate"])) {
             $bold = true;
         }
         $link = $TPL["url_alloc_transactionList"] . "tfID=" . $_FORM["tfID"] . "&monthDate=" . $monthDate . "&applyFilter=true";
         $bold and $rtn["month_links"] .= "<b>";
         $rtn["month_links"] .= $sp . "<a href=\"" . $link . "\">" . $label . "</a>";
         $bold and $rtn["month_links"] .= "</b>";
         $sp = "&nbsp;&nbsp;";
         if ($m == 12) {
             $m = 1;
             $y += 1;
         } else {
             $m += 1;
         }
     }
     if ($_FORM["sortTransactions"] == "transactionSortDate") {
         $rtn["checked_transactionSortDate"] = " checked";
     } else {
         $rtn["checked_transactionDate"] = " checked";
     }
     $tf = new tf();
     $options = $tf->get_assoc_array("tfID", "tfName");
     $rtn["tfOptions"] = page::select_options($options, $_FORM["tfID"]);
     $rtn["fromTfOptions"] = page::select_options($options, $_FORM["fromTfID"]);
     $rtn["transactionID"] = $_FORM["transactionID"];
     $rtn["expenseFormID"] = $_FORM["expenseFormID"];
     $rtn["product"] = $_FORM["product"];
     $rtn["amount"] = $_FORM["amount"];
     return $rtn;
 }