📄 asset_actions.php
字号:
<?/****************************************************************************** SimpleAssets - an online web based asset management application.* Copyright (C) 2002 Jeff Gordon (jgordon81@users.sourceforge.net). All rights reserved.* Public Works and Government Services Canada (PWGSC)* Architecture and Standards Directorate** Released July 2002** This program is free software licensed under the * GNU General Public License (GPL).** This file is part of SimpleAssets.** SimpleAssets is free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** SimpleAssets 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 General Public License for more details.** You should have received a copy of the GNU General Public License* along with SimpleAssets; if not, write to the Free Software* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*******************************************************************************/// contains functions:// asset_format($query_data, $query_data2, $color, $class, $is_report);// asset_summary($field, $name) // listings with count num// asset_query($key, $field, $name) // listings with details for one type// asset_view($key) // listing of one asset// asset_menu_header($domain, $section, $title, $key)// asset_tabs($assetid)// asset_get_empid($key)// asset_print_info($key)//prints out one assetfunction asset_format($query_data, $query_data2, $color, $class, $is_report) { global $print_screen; global $my_access_level; global $action; global $my_emp_id; global $key; global $temp; global $complete; global $hrcolor; $PHP_SELF = $_SERVER['PHP_SELF']; // determine the owner if ($query_data2 != "") { $is_employee = true; if (($query_data2["Employees_ID"] == 0) || ($query_data2["Employees_ID"] == -1)) $allow_sign_out = true; else $allow_sign_out = false; } else { $is_employee = false; } // display start / end date, if it exists if (strlen($query_data["StartDate"]) > 0) { $start_date = $query_data["StartDate"]; } else { $start_date = ""; } if (strlen($query_data["EndDate"]) > 0) { $end_date = $query_data["EndDate"]; } else { $end_date = ""; } if (($start_date != "") && ($end_date != "")) { if ($is_report == true) { if ($query_data["StartDate"] == "0") $startdate_out = "On an unknown date"; else $startdate_out = "On " . date("M d, Y", $query_data["StartDate"]); $transfer_date_text = $startdate_out; } else { if ($query_data["StartDate"] == "0") $startdate_out = "From an unknown install date"; else $startdate_out = "From " . date("M d, Y", $query_data["StartDate"]); if ($query_data["EndDate"] == "0") $enddate_out = ""; else $enddate_out = " to " . date("M d, Y", $query_data["EndDate"]); $transfer_date_text = $startdate_out . $enddate_out; } echo "<table width=100% bgcolor='" . $color_header . "' class='" . $class . "'>"; echo "<tr>"; echo "<td class='text12bold'>"; // rules for determining if cancel and sign in buttons should be shown if (((($my_access_level > 1) || ($my_emp_id == $query_data["Employees_ID"]))) && ($print_screen == false)) { // user is an admin user or viewing their own profile if ($start_date > time()) { // start date is after today echo $transfer_date_text; echo " <a href='" . $PHP_SELF . "?action=assettransfererase&key=" . $query_data["Assignments_ID"] . "&lastaction=" . $action ."&lastkey=" . html($key) . "'>(cancel)</a> <br>"; } else { // start date is before or on today if ($query_data["Temp"] == "1") { // A signout is being performed if ($query_data["Completed"] == "0") { // asset not signed in $day_now = date("d",time()); $month_now = date("m",time()); $year_now = date ("Y",time()); $new_time = mktime(0,0,0,$month_now,$day_now,$year_now); $time_diff = ceil((($query_data["EndDate"]) - $new_time) / 86400); $time_diff--; if ($time_diff == 0) $due_text = "<font color='#ff6600'>due today</font>"; elseif ($time_diff == 1) $due_text = "due tommorow"; elseif ($time_diff == -1) $due_text = "<font color='#ff0033'>overdue by 1 day</font>"; elseif ($time_diff < 0) $due_text = "<font color='#ff0033'>overdue by " . abs($time_diff) . " days</font>"; else $due_text = "due in " . $time_diff . " days"; echo "<table width=100% cellspacing=0 cellpadding=0 border=0><tr>"; echo "<td class='text12bold'>"; echo $transfer_date_text . " <a href='" . $PHP_SELF . "?action=assettransfersignin&key=" . $query_data["Assignments_ID"] . "&lastaction=" . $action ."&lastkey=" . html($key) . "'>(sign in)</a> "; if ($my_access_level > 1) echo "<a href='" . $PHP_SELF . "?action=assettransfererase&key=" . $query_data["Assignments_ID"] . "&lastaction=" . $action ."&lastkey=" . html($key) . "'>(erase)</a> "; echo "</td>"; echo "<td class='text12bold' align=right>" . $due_text . "</td>"; echo "</tr></table>"; } else { // asset signed in echo $transfer_date_text; if ($my_access_level > 1) echo " <a href='" . $PHP_SELF . "?action=assettransfererase&key=" . $query_data["Assignments_ID"] . "&lastaction=" . $action ."&lastkey=" . html($key) . "'>(erase)</a> "; } } else { // A transfer is occurring echo $transfer_date_text; } } } else { echo $transfer_date_text; } echo "</td>"; echo "</tr>"; echo "</table>"; } echo "<table width=100% cellspacing=5 border=0 bgcolor='" . $color . "' class='" . $class . "'>"; echo "<tr>\n"; echo "<td valign='top' width=10%>"; //Asset Tag if ((strcmp($action,"assetview") == 0) || ($print_screen == true)) echo "<font class='text13bold'>" . $query_data["AssetTag"] . "<br></font>"; else echo "<a href='" . $PHP_SELF . "?action=assetview&key=" . $query_data["Assets_ID"] . "' class='text13bold'>" . $query_data["AssetTag"] . "</a><font class='text13bold'><br></font>"; echo "</td>\n"; echo "<td class='text11' valign='top' width=35%>"; //Asset Type echo "<font class='text10bold'>" . $query_data["AssetType"] . "</font>\n"; //Asset OS if ((strlen($query_data["os"]) > 0) && (strcmp($action,"assetos") != 0)) echo " (" . $query_data["os"] . ")\n"; echo "<font class='text11bold'><br></font>"; // Supplier and Model $sql3 = "SELECT supplier, link FROM Links WHERE supplier='" . $query_data["AssetSupplier"] . "'"; if (($result3 = doSql($sql3)) && (mysql_num_rows($result3)) && ($query_data3 = mysql_fetch_array($result3))) { echo "<font class='text13bold'><a href='" . $query_data3["link"] . "' class='text13bold'>" . $query_data["AssetSupplier"] . "</a> " . $query_data["AssetModel"] . "</font> "; } else { echo "<font class='text13bold'>" . $query_data["AssetSupplier"] . " " . $query_data["AssetModel"] . "</font> "; } // price if ($query_data["AssetPrice"] != 0) echo "<font class='text12'> ($" . number_format($query_data["AssetPrice"],2) . ")</font>\n"; echo "<br>"; // serial number if ($query_data["AssetSerial"]) echo "<font class='text12'>s/n " . $query_data["AssetSerial"] . "</font>\n"; echo "</td>\n"; echo "<td align=right class='text11' valign='top' width=25%>\n"; //Employee Info if ($is_employee == true) { // Employee Name if ((strcmp($action,"employeeview") == 0)) { $sql3 = "SELECT IP FROM IP WHERE AssetId=" . $query_data["Assets_ID"] . " AND EmployeeId=" . $query_data2["Employees_ID"]; if (($result3 = doSql($sql3)) && (mysql_num_rows($result3))) { while ($query_data3 = mysql_fetch_array($result3)) { echo "<font class='text11bold'>" . $query_data3["IP"] . "</font><br>"; } } } else { if (($is_report == true) && ($query_data["Employees_Prev_ID"] != "")) { echo "<font class='text11bold'>From </font>"; switch($query_data["Employees_Prev_ID"]) { case "0": if ($print_screen == false) echo "<font class='text11bold'><a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data["Employees_Prev_ID"] . "'><b>General Assets</b></a></font>\n"; else echo "<font class='text11bold'><b>General Assets</b></font>\n"; break; case "-1": if ($print_screen == false) echo "<font class='text11bold'><a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data["Employees_Prev_ID"] . "'><b>Surplus</b></a></font>\n"; else echo "<font class='text11bold'><b>Surplus</b></font>\n"; break; case "-2": if ($print_screen == false) echo "<font class='text11bold'><a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data["Employees_Prev_ID"] . "'><b>Retired</b></a></font>\n"; else echo "<font class='text11bold'><b>Retired</b></font>\n"; break; default: if ($print_screen == false) echo "<font class='text11bold'><a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data["Employees_Prev_ID"] . "'><b>" . $query_data["Employees_Prev_LastName"] . ", " . $query_data["Employees_Prev_FirstName"] . "</b></a></font>"; else echo "<font class='text11bold'><b>" . $query_data["Employees_Prev_LastName"] . ", " . $query_data["Employees_Prev_FirstName"] . "</b></font>\n"; if (($query_data["Employees_Prev_Building"] != "") || ($query_data["Floor"] != "")) echo "<font class='text11'> - " . $query_data["Employees_Prev_Building"] . " " . $query_data["Employees_Prev_Floor"] . "</font>"; if ($query_data["Employees_Prev_Workstation"] != "") echo "<font class='text11'>-" . $query_data["Employees_Prev_Workstation"] . "</font>\n"; break; } if ($is_report == true) echo "<br><font class='text11bold'>To: </font>"; } else { if ($is_report == true) echo "<font class='text11bold'>Installed: </font>"; } switch($query_data2["Employees_ID"]) { case "0": if ($print_screen == false) echo "<font class='text11bold'><a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data2["Employees_ID"] . "'><b>General Assets</b></a></font>\n"; else echo "<font class='text11bold'><b>General Assets</b></font>\n"; break; case "-1": if ($print_screen == false) echo "<font class='text11bold'><a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data2["Employees_ID"] . "'><b>Surplus</b></a></font>\n"; else echo "<font class='text11bold'><b>Surplus</b></font>\n"; break; case "-2":
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -