$TPL["expenseFormButtons"] .= ' <button type="submit" name="unfinalise" value="1" class="save_button"><i class="icon-arrow-left" style="margin:0px; margin-right:5px;"></i>Edit</button> <button type="submit" name="save" value="1" class="save_button">Save<i class="icon-ok-sign"></i></button> <select name="changeTransactionStatus"><option value="">Transaction Status<option value="approved">Approve<option value="rejected">Reject<option value="pending">Pending</select> '; $TPL["field_clientID"] = $clientName; $TPL["field_expenseFormComment"] = page::textarea("expenseFormComment", $expenseForm->get_value("expenseFormComment", DST_HTML_DISPLAY)); } else { if (is_object($expenseForm) && !$expenseForm->get_value("expenseFormFinalised")) { $TPL["expenseFormButtons"] .= ' <button type="submit" name="save" value="1" class="save_button">Create Expense Form<i class="icon-ok-sign"></i></button>'; $TPL["paymentMethodOptions"] = "<select name=\"paymentMethod\">" . $paymentOptions . "</select>"; $TPL["reimbursementRequiredOption"] = $reimbursementRequiredRadios; $TPL["seekClientReimbursementOption"] = $seekClientReimbursementOption; $options["clientStatus"] = "Current"; $ops = client::get_list($options); $ops = array_kv($ops, "clientID", "clientName"); $TPL["field_clientID"] = "<select name=\"clientID\"><option value=\"\">" . page::select_options($ops, $expenseForm->get_value("clientID")) . "</select>"; $TPL["field_expenseFormComment"] = page::textarea("expenseFormComment", $expenseForm->get_value("expenseFormComment", DST_HTML_DISPLAY)); } } } if (is_object($expenseForm) && $expenseForm->get_id()) { $db = new db_alloc(); $db->query(prepare("SELECT SUM(amount * pow(10,-currencyType.numberToBasic)) AS amount, \n transaction.currencyTypeID as currency\n FROM transaction\n LEFT JOIN currencyType on transaction.currencyTypeID = currencyType.currencyTypeID\n WHERE expenseFormID = %d\n GROUP BY transaction.currencyTypeID\n ", $expenseForm->get_id())); while ($row = $db->row()) { $rows[] = $row; } $TPL["formTotal"] = page::money_print($rows); } if (is_object($expenseForm) && $current_user->have_role("admin") && !$expenseForm->get_invoice_link() && $expenseForm->get_value("expenseFormFinalised") && $expenseForm->get_value("seekClientReimbursement")) {
function load_productSale_filter($_FORM) { $current_user =& singleton("current_user"); // display the list of project name. $db = new db_alloc(); if (!$_FORM['showAllProjects']) { $filter = "WHERE projectStatus = 'Current' "; } $query = prepare("SELECT projectID AS value, projectName AS label FROM project {$filter} ORDER by projectName"); $rtn["show_project_options"] = page::select_options($query, $_FORM["projectID"], 70); // display the list of user name. if (have_entity_perm("productSale", PERM_READ, $current_user, false)) { $rtn["show_userID_options"] = page::select_options(person::get_username_list(), $_FORM["personID"]); } else { $person = new person(); $person->set_id($current_user->get_id()); $person->select(); $person_array = array($current_user->get_id() => $person->get_name()); $rtn["show_userID_options"] = page::select_options($person_array, $_FORM["personID"]); } // display a list of status $status_array = productSale::get_statii(); unset($status_array["create"]); $rtn["show_status_options"] = page::select_options($status_array, $_FORM["status"]); // display the date from filter value $rtn["showAllProjects"] = $_FORM["showAllProjects"]; $options["clientStatus"] = array("Current"); $options["return"] = "dropdown_options"; $ops = client::get_list($options); $ops = array_kv($ops, "clientID", "clientName"); $rtn["clientOptions"] = page::select_options($ops, $_FORM["clientID"]); // Get $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM)); return $rtn; }
function load_invoice_filter($_FORM) { global $TPL; // Load up the forms action url $rtn["url_form_action"] = $_FORM["url_form_action"]; $statii = invoice::get_invoice_statii(); unset($statii["create"]); $rtn["statusOptions"] = page::select_options($statii, $_FORM["invoiceStatus"]); $statii_payment = invoice::get_invoice_statii_payment(); $rtn["statusPaymentOptions"] = page::select_options($statii_payment, $_FORM["invoiceStatusPayment"]); $rtn["status"] = $_FORM["status"]; $rtn["dateOne"] = $_FORM["dateOne"]; $rtn["dateTwo"] = $_FORM["dateTwo"]; $rtn["invoiceID"] = $_FORM["invoiceID"]; $rtn["invoiceName"] = $_FORM["invoiceName"]; $rtn["invoiceNum"] = $_FORM["invoiceNum"]; $rtn["invoiceItemID"] = $_FORM["invoiceItemID"]; $options["clientStatus"] = "Current"; $options["return"] = "dropdown_options"; $ops = client::get_list($options); $ops = array_kv($ops, "clientID", "clientName"); $rtn["clientOptions"] = page::select_options($ops, $_FORM["clientID"]); // Get $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM)); return $rtn; }
function get_client_and_project_dropdowns_and_links($clientID = false, $projectID = false, $onlymine = false) { // This function returns dropdown lists and links for both client and // project. The two dropdown lists are linked, in that if you change the // client, then the project dropdown dynamically updates global $TPL; $project = new project(); $project->set_id($projectID); $project->select(); if (!$clientID) { $clientID = $project->get_value("clientID"); } $client = new client(); $client->set_id($clientID); $client->select(); $options["clientStatus"] = "Current"; $ops = client::get_list($options); $ops = array_kv($ops, "clientID", "clientName"); $client->get_id() and $ops[$client->get_id()] = $client->get_value("clientName"); $client_select = "<select id=\"clientID\" name=\"clientID\" onChange=\"makeAjaxRequest('" . $TPL["url_alloc_updateProjectListByClient"] . "clientID='+\$('#clientID').attr('value')+'&onlymine=" . sprintf("%d", $onlymine) . "','projectDropdown')\"><option></option>"; $client_select .= page::select_options($ops, $clientID, 100) . "</select>"; $client_link = $client->get_link(); $project_select = '<div id="projectDropdown" style="display:inline">' . $project->get_dropdown_by_client($clientID, $onlymine) . '</div>'; $project_link = $project->get_link(); return array($client_select, $client_link, $project_select, $project_link); }
* allocPSA is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. * * allocPSA is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with allocPSA. If not, see <http://www.gnu.org/licenses/>. */ require_once "../alloc.php"; $defaults = array("url_form_action" => $TPL["url_alloc_clientList"], "form_name" => "clientList_filter"); function show_filter() { global $TPL; global $defaults; $_FORM = client::load_form_data($defaults); $arr = client::load_client_filter($_FORM); is_array($arr) and $TPL = array_merge($TPL, $arr); include_template("templates/clientListFilterS.tpl"); } $_FORM = client::load_form_data($defaults); $TPL["clientListRows"] = client::get_list($_FORM); if (!$current_user->prefs["clientList_filter"]) { $TPL["message_help"][] = "\n\nallocPSA allows you to store pertinent information about your Clients and\nthe organisations that you interact with. This page allows you to see a list of Clients.\n\n<br><br>\n\nSimply adjust the filter settings and click the <b>Filter</b> button to\ndisplay a list of previously created Clients. \nIf you would prefer to create a new Client, click the <b>New Client</b> link\nin the top-right hand corner of the box below."; } $TPL["main_alloc_title"] = "Client List - " . APPLICATION_NAME; include_template("templates/clientListM.tpl");