国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > PHP > 正文

php小型企業(yè)庫存管理系統(tǒng)的設(shè)計與實現(xiàn)代碼

2024-05-04 23:18:45
字體:
供稿:網(wǎng)友

php小型企業(yè)庫存管理系統(tǒng)的設(shè)計與實現(xiàn)代碼

雙專業(yè)畢業(yè)論文做了一個小型企業(yè)庫存管理系統(tǒng),使用PHP&mysql組合進行開發(fā)。頭一次開發(fā)稍微大一點的東西,php也是自學(xué)的。這里想跟大家一起分享一下

check_login 模塊

復(fù)制代碼 代碼如下:


<!--用戶登陸檢驗?zāi)K-->
<?php
session_start();
$workid=$_GET['wid'];//獲取工作號
if($workid!=$_SESSION['$workid']||$workid==''){
echo "<script language=javascript>alert('您還沒有登陸,無法管理!');location.href='login.php';</script>";
}
?>


function.inc//主要包括數(shù)據(jù)庫連接模塊

復(fù)制代碼 代碼如下:


<?php
function mysql_link($user="admin",$password="admin",$database="systembase"){
$id=mysql_connect("localhost",$user,$password);
if(!$id){
die('Could not connect: ' . mysql_error());
}
if (!mysql_select_db($database,$id)){
die ("Can/'t select_db : " . mysql_error());
}
//改變客戶端字符集編碼為gb2312
mysql_query("SET NAMES gb2312");
return $id;
}
?>


倉庫管理界面storage.php

復(fù)制代碼 代碼如下:


<!--倉庫管理員管理界面-->
2 <?php
3 include "inc/check_login.php";
4 include "inc/function.inc";
5 $id=mysql_link("storage","storage");//建立storage連接
6
7 $query="select * from admin where admin_id='$workid'";//定位倉庫
8 $result=mysql_query($query,$id);
9 $info=mysql_fetch_array($result,MYSQL_ASSOC);
$stoid=$info['storage_id'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<LINK href="images/style.css" type=text/css rel=stylesheet>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<title>倉庫管理</title>
<style type="text/css">
body{
font-family:Arial,Helvetica,sans-serif; /*設(shè)置字體樣式*/
font-size:12px;
margin:0px 240px;
height:auto;
width:800px;
border:1px solid #006633;
background-color:rgb(195,245,200);

}
</style>
</head>
<body>
<div ></div>
<ul>
<li><a href="logout.php">注 銷</a></li>
<?php
echo "<li><a href=input.php?wid=".$workid.">入 庫</a></li>";
echo "<li><a href=output.php?wid=".$workid.">出 庫</a></li>";
?>
</ul>
<div align=center>
<div align=center>
<table cellpadding="3" cellspacing="1">
<?php
$query="select * from storage where storage_id='$stoid'";//定位倉庫信息
$result=mysql_query($query,$id);
if(mysql_num_rows($result)<1){
echo "沒有倉庫".$stoid;
}else{
$info=mysql_fetch_array($result,MYSQL_ASSOC);
echo "倉庫號:".$stoid." 總?cè)萘?".$info['storage_cap']." 剩余容量:".$info['storage_lcap']."
 倉庫地址:".$info['storage_add']." 倉庫電話:".$info['storage_tele'];
if (!mysql_select_db("basicbase",$id)){
die ("Can/'t select_db : " . mysql_error());
}
//在basicbase中建立對應(yīng)倉庫貨物視圖,入庫視圖以及出庫視圖
//判斷是否存在相關(guān)視圖,沒有的話就新建視圖
$query="select * from ".$stoid."_inventory";
if(!mysql_query($query,$id)){
//創(chuàng)建inventory視圖
$query="create view ".$stoid."_inventory as
select inventory.goods_id,name,number from inventory,systembase.goods where storage_id=".$stoid." and inventory.goods_id=systembase.goods.goods_id";
if(!mysql_query($query,$id)){
die ("Can/'t create_view_inventory : " . mysql_error());
}
//創(chuàng)建input視圖
$query="create view ".$stoid."_input as
select input_id,goods_id,number,time from input where admin_id=".$workid;
if(!mysql_query($query,$id)){
die ("Can/'t create_view_input : " . mysql_error());
}
//創(chuàng)建output視圖
$query="create view ".$stoid."_output as
select output_id,goods_id,number,time from output where admin_id=".$workid;
if(!mysql_query($query,$id)){
die ("Can/'t create_view_output : " . mysql_error());
}
}
$query="select * from ".$stoid."_inventory";
$result=mysql_query($query,$id);
if(mysql_num_rows($result)<1){
echo "<br>該倉庫目前是空的";
}else{
$totalnum=mysql_num_rows($result);
$pagesize=7;
$page=$_GET["page"];
if(""==$page){
$page=1;
}
$begin=($page-1)*$pagesize;
$totalpage=ceil($totalnum/$pagesize);

echo "<tr>倉庫中共有".$totalnum."種貨物。";
echo "每頁".$pagesize."種,共".$totalpage."頁。</tr>";
for($j=1;$j<=$totalpage;$j++){
echo "<a href=storage.php?wid=".$workid."&page=".$j.">[".$j."]  </a>";
}
echo "<br>";
$query="select *from ".$stoid."_inventory order by goods_id limit $begin,$pagesize";
$result=mysql_query($query,$id);
$datanum=mysql_num_rows($result);
//echo "<tr><td id=table_title >貨物id</td><td id=table_title >貨物名稱</td><td id=table_title >貨物數(shù)量</td></tr>";
echo "<tr><td >貨物id</td><td >貨物名稱</td><td >貨物數(shù)量</td></tr>";
for($i=1;$i<=$datanum;$i++){
$info=mysql_fetch_array($result,MYSQL_ASSOC);
//echo "<tr><td id=table_title >".$info['goods_id']."</td><td id=table_title >".$info['name']."</td><td id=table_title >".$info['number']."</td></tr>";
echo "<tr><td >".$info['goods_id']."</td><td >".$info['name']."</td><td >".$info['number']."</td></tr>";
}

}
}
mysql_close($id);
?>
</table>
</div>
</div>
<div>版權(quán)所有:Freeze&zhaoL <br>E-mail:zhoujiebin15@qq.com</div>
</body>
</html>


代碼太多不一一貼了,第一次寫碰到很多問題,但不管怎么說程序還是運行起來了

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 乌苏市| 饶平县| 赤壁市| 聊城市| 株洲市| 平舆县| 竹山县| 普格县| 三明市| 阿城市| 永寿县| 海门市| 瑞昌市| 磐安县| 广河县| 娄烦县| 故城县| 杂多县| 淳化县| 龙州县| 新野县| 来凤县| 阿克| 会宁县| 大洼县| 苏尼特右旗| 滦南县| 高尔夫| 湘乡市| 池州市| 沾益县| 遵化市| 磐安县| 桐城市| 玉环县| 静宁县| 平潭县| 博白县| 肃南| 连平县| 达尔|