⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asset_admin.php

📁 这是一个用于资产管理的源码工具包
💻 PHP
📖 第 1 页 / 共 2 页
字号:
						echo "<blockquote><font class='text12'>The asset has been successfully added to the system</font></blockquote>";						echo "<p></td></tr></table>";						echo "<center>";						echo "<a href='" . $PHP_SELF . "?action=assetview&key=" . $last_insert_id . "'><img src='images/next.jpg' width=88 height=27 border=0></a></center></form>";						echo "<p><br>";						$pass = true;					} else {						$sql_error = mysql_error();					}				} else {					$sql_error = mysql_error();				}			} else {				$sql_error = mysql_error();			}		} else {			// update asset			$sql = "UPDATE Assets SET assettag='A" . $assettag . "',assettype='" . $assettype . "',os='" . $os . "',assetsupplier='" . $assetsupplier . "',assetmodel='" . $assetmodel . "',assetserial='" . $assetserial . "',assetprice=" . $assetprice . ",notes='" . $notes . "' WHERE id=" . $key . ";";			if ($result = doSql($sql)) {				asset_menu_header(true,"Update","Asset Updated Successful",$key);				asset_tabs($key);				asset_print_info($key);				echo "<table width=100% bgcolor='#ffeecc'><tr><td><br>";				echo "<blockquote><font class='text12'>The asset has been successfully updated</font></blockquote>";				echo "<p></td></tr></table>";				$pass = true;			} else {				$sql_error = mysql_error();			}		}		if ($pass == false) {			asset_menu_header(true,"New Asset","<font class=text18bold color='#ff0033'>ERROR: An error occurred while inserting.</font>",$key);			echo "<table width=100% bgcolor='#ffeecc'><tr><td><br>";			echo "<blockquote><font class='text12'>An error occurred while attempting to update the database. Please contact the webmaster. This is action attempted: " . $sql . "<br><br>" . $sql_error . "</font></blockquote>";			echo "<p></td></tr></table>";		}	}}// prints out a calendar version of the abovefunction asset_admin_calendar($key) {	global $day, $month, $year;	asset_menu_header(true,"","Calendar",$key);	asset_tabs($key);	asset_print_info($key);	echo "<table width=100% bgcolor='#ffeecc' class='assetborder'><tr><td>";	echo "<center>";	calendar($day, $month, $year, false, false, true);	echo "</center>";	echo "</td></tr></table>";}function asset_admin_dates($key) {	global $complete;	global $emp_db;	global $action;	global $newrow_x;	global $update_x;	global $complete;	global $id, $employee, $remove;	global $day_start, $month_start, $year_start;	global $day_end, $month_end, $year_end;	//global $start_check, $end_check;		if ($complete == "1") $post_changes = true;	if ($newrow_x != "") $newrow = "1";	if ($update_x != "") $update = "1";		asset_menu_header(true,"","Date Management of Asset","");	asset_tabs($key);	asset_print_info($key);	echo "<table cellspacing=0 cellpadding=0 border=0><tr><td><form action='" . $PHP_SELF . "' method='get'></td></tr></table>";	echo "<input type='hidden' name='action' value='" . $action . "'>";	echo "<input type='hidden' name='key' value='" . $key . "'>";	echo "<input type='hidden' name='complete' value='1'>";	echo "<table width=100% bgcolor='#ffeecc'><tr><td><br>";	echo "<blockquote>";	echo "<p><font class='text13'>";	echo "This screen allows you to make changes to transfer dates. An blank date box for a start date indicates the initial purchase date is unknown. An blank date box for an end date indicates there is no end date and the transfer is permanent. Only <b>ONE</b> blank start date is allowed and one blank end date is <b>REQUIRED</b>.  Consecutive time periods assigned to the same employee will be automatically merged shortly after updating.";	echo "<p><b>Date updating will not take place if any dates overlap or if there is not exactly ONE row with a blank end date.  Each row's start date must be the day after the previous' rows end date (e.g. Row 1 end date is Mar 15, Row 2 start date is Mar 16)</b>";	echo "</font>";	echo "<p><table border=1>";	echo "<tr>";	echo "<td class='text12bold'>Start Date</td>";	echo "<td class='text12bold'>End Date</td>";	echo "<td class='text12bold'>Employee</td>";	echo "<td class='text12bold'>Remove</td>";	echo "<td class='text12bold'>Error (if any)</td>";	echo "</tr>";		// load the array	if ($complete != "1") {		$rec_num = 0;		$sql = "SELECT id, startdate, enddate, employeeid FROM Assignments WHERE assetid=" . $key . " ORDER BY startdate";		if (($result = doSql($sql)) && (mysql_num_rows($result))) {			while ($query_data = mysql_fetch_array($result)) {				$arr_assign[$rec_num] = $query_data;				$arr_assign[$rec_num]["error"] = 0;				$rec_num++;			}		}	} else {		$rec_num = 0;		for ($i=0;$i<count($id);$i++) {			if ((is_array($remove) == false) || (in_array($id[$i],$remove) == false)) {				// id				$arr_assign_id = $id[$i];				// start date				if (($month_start[$i] == "") || ($day_start[$i] == "") || ($year_start[$i] == "")) $arr_assign_startdate = "0";				else $arr_assign_startdate = mktime(0,0,0,$month_start[$i],$day_start[$i],$year_start[$i]);				//if (!((is_array($start_check) == true) && (in_array($id[$i],$start_check) == true))) $arr_assign_startdate = "0";				// end date				if (($month_end[$i] == "") || ($day_end[$i] == "") || ($year_end[$i] == "")) $arr_assign_enddate = "0";				else $arr_assign_enddate = mktime(23,59,59,$month_end[$i],$day_end[$i],$year_end[$i]);				//if (!((is_array($end_check) == true) && (in_array($id[$i],$end_check) == true))) $arr_assign_enddate = "0";								// employee assignments				$arr_assign_employeeid = $employee[$i];				// error checking				$arr_assign_error = 0;				if ((($arr_assign_enddate - $arr_assign_startdate) < 0) && ($arr_assign_enddate != 0)) {					$arr_assign_error = 1;				}								if (($month_start[$i] != "") && ($day_start[$i] != "") && ($year_start[$i] != "")) {					if (checkdate($month_start[$i],$day_start[$i],$year_start[$i]) == false) {						$arr_assign_error = 2;					}				}				if (($month_end[$i] != "") && ($day_end[$i] != "") && ($year_end[$i] != "")) {					if (checkdate($month_end[$i],$day_end[$i],$year_end[$i]) == false) {						$arr_assign_error = 3;					}				}				$arr_assign[$rec_num]["id"] = $arr_assign_id;				$arr_assign[$rec_num]["employeeid"] = $arr_assign_employeeid;				$arr_assign[$rec_num]["startdate"] = $arr_assign_startdate;				$arr_assign[$rec_num]["enddate"] = $arr_assign_enddate;				$arr_assign[$rec_num]["error"] = $arr_assign_error;								$rec_num++;			}		}	}		// add a new row, if requested	if ($newrow == "1") {		$time_start = mktime(0,0,0,date("m",time()),date("d",time()),date ("Y",time()));		$time_end = mktime(23,59,59,date("m",time()),date("d",time()),date ("Y",time()));		$arr_assign[$rec_num]["id"] = time() + (microtime() * 1000);		$arr_assign[$rec_num]["startdate"] = $time_start;		$arr_assign[$rec_num]["enddate"] = $time_end;		$arr_assign[$rec_num]["employeeid"] = "0";		$rec_num++;	}			// sort the dates array	usort($arr_assign, "cmp_array_startdate");	// loop through all the rows	for ($i=0;$i<$rec_num;$i++) {		// check overlaps and consecutive dates		if ($i > 0) {			if ((($arr_assign[$i]["startdate"] - $arr_assign[($i-1)]["enddate"]) != 1) && ($arr_assign[$i]["error"] == 0)) {				$arr_assign[$i]["error"] = 4;			}		}		// check overlaps and consecutive dates		if ($i == ($rec_num-1)) {			if ($arr_assign[$i]["enddate"] != 0) {				$arr_assign[$i]["error"] = 5;			}		}		echo "<input type='hidden' name='id[]' value='" . $arr_assign[$i]["id"] . "'>";		if ($arr_assign[$i]["error"] > 0) {			echo "<tr bgcolor='#ff0033'>";			$post_changes = false;		} else {			echo "<tr>";		}				// start date		$day_start = date("d",$arr_assign[$i]["startdate"]);		$month_start = date("m",$arr_assign[$i]["startdate"]);		$year_start = date ("Y",$arr_assign[$i]["startdate"]);		echo "<td>";		if (strcmp($arr_assign[$i]["startdate"],"0") == 0) $useunknown = true;		else $useunknown = false;				dateDropdown("start[]",$month_start,$day_start,$year_start,0,0,true,$useunknown);		echo "&nbsp;&nbsp;&nbsp;";		echo "</td>";		// end date		echo "<td>";		$day_end = date("d",$arr_assign[$i]["enddate"]);		$month_end = date("m",$arr_assign[$i]["enddate"]);		$year_end = date ("Y",$arr_assign[$i]["enddate"]);		if (strcmp($arr_assign[$i]["enddate"],"0") == 0) $useunknown = true;		else $useunknown = false;				dateDropdown("end[]",$month_end,$day_end,$year_end,0,0,false,$useunknown);		echo "&nbsp;&nbsp;&nbsp;";		echo "</td>";		// employee		echo "<td>";		$sql2 = "SELECT id, LastName, FirstName FROM " . $emp_db . "Employees ORDER BY LastName";		echo "<select name='employee[]' class='boxtext13'>";		if (($result2 = doSql($sql2)) && (mysql_num_rows($result2))) {			if ($arr_assign[$i]["employeeid"] == "0") echo "<option value='0' SELECTED>General Assets</option>";			else echo "<option value='0'>General Assets</option>";			if ($arr_assign[$i]["employeeid"] == "-1") echo "<option value='-1' SELECTED>Surplus</option>";			else echo "<option value='-1'>Surplus</option>";			if ($arr_assign[$i]["employeeid"] == "-2") echo "<option value='-2' SELECTED>Retired</option>";			else echo "<option value='-2'>Retired</option>";			while ($query_data2 = mysql_fetch_array($result2)) {				if ($arr_assign[$i]["employeeid"] == $query_data2["id"]) {					echo "<option value='" . $query_data2["id"] . "' SELECTED>" . $query_data2["LastName"] . ", " . $query_data2["FirstName"] . "</option>";				} else {					echo "<option value='" . $query_data2["id"] . "'>" . $query_data2["LastName"] . ", " . $query_data2["FirstName"] . "</option>";				}			}		}		echo "</select>";		echo "</td>";		echo "<td>";		echo "<input type='checkbox' name='remove[]' value='" . $arr_assign[$i]["id"] . "'>";		echo "</td>";		echo "<td class='text13'>";		switch ($arr_assign[$i]["error"]) {			case 1:				echo "<font color='#ffffff'><b>End Date is before Start Date.</b></font>";				break;			case 2:				echo "<font color='#ffffff'><b>Invalid Start Date, Value has been corrected.</b></font>";				break;			case 3:				echo "<font color='#ffffff'><b>Invalid End Date, Value has been corrected.</b></font>";				break;			case 4:				echo "<font color='#ffffff'><b>Non-consecutive or overlap exist with previous row.</b></font>";				break;			case 5:				echo "<font color='#ffffff'><b>The end date of last row must be blank.</b></font>";				break;			default;				echo "<b>None</b>";				break;		}		echo "</td>";		echo "</tr>";	}		echo "</table>";	if ($post_changes == true) {		doSql("DELETE FROM Assignments WHERE AssetId=" . $key . " AND Temp=0");		for($k=0;$k<$rec_num;$k++) {			doSql("INSERT INTO Assignments (employeeid,assetid,startdate,enddate,approve,temp,completed) VALUES (" . $arr_assign[$k]["employeeid"] ."," . $key . "," . $arr_assign[$k]["startdate"] . "," . $arr_assign[$k]["enddate"] . ",0,0,0)");		}		echo "<p><font class='text12bold' color='#ff0033'>Updating Complete!</font>";	}	echo "</blockquote>";	echo "<p></td></tr></table>";	echo "<p><br><center><input type='image' src='images/addrow.jpg' width=88 height=27 name='newrow' value='1' border=0><input type='image' src='images/update.jpg' width=88 height=27 name='update' value='1'></center>";	echo "<table cellspacing=0 cellpadding=0 border=0><tr><td></form></td></tr></table>";}function asset_admin_erase($key) {	global $complete;	asset_menu_header(true,"","Erase Asset","");	if ($complete == "1") {		$result = doSql("DELETE FROM Assignments WHERE AssetId=" . $key);		$result = doSql("DELETE FROM Assets WHERE Id=" . $key);		asset_print_info($key);		echo "<table width=100% bgcolor='#ffeecc'><tr><td><br>";		echo "<blockquote><font class='text12'>Asset Erased Successfully</font></blockquote>";		echo "<p></td></tr></table>";		echo "<p><center>";		echo "<a href='" . $PHP_SELF . "?action=assets'><img src='images/next.jpg' width=88 height=27 border=0></a>";		echo "</center>";		echo "<p><br>";	} else {		asset_tabs($key);		asset_print_info($key);		echo "<table width=100% bgcolor='#ffeecc'><tr><td><br>";		echo "<blockquote><font class='text12'><font color='#ff0033'><b>WARNING!</b></font> This will erase all traces of the asset including all transfers and sign out.  Are you sure you want to do this?</font></blockquote>";		echo "<p></td></tr></table>";		echo "<p><center>";		echo "<a href='" . $PHP_SELF . "?action=asseterase&key=" . $key . "&complete=1'><img src='images/yes.jpg' width=88 height=27 border=0></a>";		echo "<a href='" . $PHP_SELF . "?action=assetview&key=" . $key . "'><img src='images/no.jpg' width=88 height=27 border=0></a>";		echo "</center>";		echo "<p><br>";	}}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -