基于PHP的工资管理系统Word文件下载.doc
《基于PHP的工资管理系统Word文件下载.doc》由会员分享,可在线阅读,更多相关《基于PHP的工资管理系统Word文件下载.doc(19页珍藏版)》请在冰点文库上搜索。
此页面为注册页面,通过此模块可以注册员工的信息,包括工种,比率等。
Update.php
此页面为计算年终总平均工资页面,由此页面可以进行员工的整体操作。
5.模块运行效果
开启服务器,登陆10.91.4.11/1/home.php,进入如下页面
点击新员工注册进入如下页面
写入相应信息,成功。
返回主页面:
点击工种工资设计:
设计基本工资和比率;
返回主页面
对已有工人进行查询并查看得到如下界面
输入基本工资及各月考勤,津贴得到年终平均工资。
六、程序代码
1.php
<
?
php
include_once("
global.php"
);
header('
Content-Type:
text/html;
charset=GB2312'
$gz=$_GET['
gz'
];
$sql="
select*fromgzgz"
;
$query=mysql_query($sql);
while($row=mysql_fetch_array($query))
{
if($gz==$row[gz])echo$row[jbgz]."
元"
}
>
2.php
$dj=$_GET['
dj'
if($gz==$row[gz]){
$a=pow($row['
bl'
],$_GET['
]-1);
$b=$row['
jbgz'
]*$a;
echo$b;
}
Config.php
$host="
localhost"
$p_username="
root"
$password="
135510"
$db="
gz"
$coding="
gbk"
Global.php
session_start();
include_once('
./config.php'
./mysql_class.php'
./page_class.php'
$db=newmysql($host,$p_username,$password,$db,$coding);
Gzsd.php
include_once("
$db->
select("
gzgz"
"
*"
"
if($_POST[sub]){
for($i=1;
$i=6;
$i++){
$db->
update("
jbgz='
$_POST[jbgz]'
bl='
$_POST[bl]'
id='
$i'
header("
location:
'
./home.php'
tableborder="
1"
formmethod="
post"
action=>
tr>
thwidth="
100"
工种<
/th>
基本工资<
比率<
/tr>
while($result=$db->
fetch_row()){
tralign="
center"
td>
=$result[1]?
/td>
inputtype="
text"
name="
jbgz"
value=<
=$result[2]?
bl"
=$result[3]?
thcolspan="
2"
submit"
sub"
value="
修改"
th>
button"
返回"
onclick="
location.href='
/table>
if($_GET['
del'
]){//删除数据
$id=$_GET['
$db->
delete("
gzb"
"
$id'
jt"
y_id='
kqb"
ygxx"
if($_GET[out]=='
loginout'
){
session_destroy();
header("
./login.php"
ahref="
./register.php"
新员工注册<
/a>
br>
ahref="
./gzsd.php"
工种工资设计<
formaction="
method="
姓名:
xm"
查询"
/form>
./home.php"
返回<
姓名<
等级<
200"
考勤、津贴/工资、年终奖<
$db1=mysql_query("
selectidfromgzb"
$num=mysql_num_rows($db1);
pageft($num,20);
if($firstcount<
0)
$firstcount=0;
if(!
isset($_POST['
sub'
])){
select_limit("
$firstcount,$displaypg);
else{
echo"
11111"
$name=$_POST['
xm'
xmlike'
%$_POST[xm]%'
while($result=$db->
echo$result[4]?
del=<
=$result[0]?
删除<
/<
update.php?
id=<
修改、查看<
7"
=$pagenav?
Mysql_class.php
classmysql{
private$host;
private$user;
private$password;
private$db;
private$coding;
private$sql;
private$que;
function__construct($host,$user,$password,$db,$coding){
$this->
host=$host;
user=$user;
password=$password;
db=$db;
coding=$coding;
connect();
}
functionconnect(){
$con=mysql_connect($this->
host,$this->
user,$this->
password);
if(!
mysql_select_db($this->
db,$con)){
$this->
show_error("
数据库不可用:
$this->
db);
}
mysql_query("
setnames$this->
coding"
functionquery($sql){
//echo$sql."
if($sql=="
$this->
SQL语句错误"
查询语句SQL为空"
}
$que=mysql_query($sql);
if(!
$que){
$sql);
//echo$que;
que=$que;
return$this->
que;
functionselect($table,$name,$condition){
$condition=$condition?
where"
.$condition:
NULL;
query("
select$namefrom$table$condition"
functionselect_limit($table,$name,$condition,$pageval,$pagesize){
$condition=$condition?
$this->
select$namefrom$table$conditionlimit$pageval,$pagesize"
functionupdate($table,$con,$condition){
update$tableset$con$condition"
functioninsert($table,$name,$value){
insertinto$table($name)values($value)"
functioninsert_id(){
returnmysql_insert_id();
functiondelete($table,$condition){
deletefrom$table$condition"
functionfetch_row(){
$result=mysql_fetch_row($this->
que);
return$result;
functionfetch_array(){
$result=mysql_fetch_array($this->
functionshow_error($message="
$sql="
$sql){
echo"
fontcolor='
red'
$message<
/font>
}else{
echo"
错误原因:
.mysql_error()."
echo$message."
&
nbsp;
.$sql;
}
Page_class.php
$page=$_GET[page];
if(!
function_exists(pageft)){
functionpageft($totle,$displaypg=20,$url='
global$page,$firstcount,$pagenav,$_SERVER;
$GLOBALS["
displaypg"
]=$displaypg;
$page)$page=1;
$url){$url=$_SERVER["
REQUEST_URI"
$parse_url=parse_url($url);
$url_query=$parse_url["
query"
if($url_query){
$url_query=ereg_replace("
(^|&
)page=$page"
$url_query);
$url=str_replace($parse_url["
],$url_query,$url);
if($url_query)$url.="
page"
else$url.="
}else{
$url.="
$lastpg=ceil($totle/$displaypg);
$page=min($lastpg,$page);
$prepg=$page-1;
$nextpg=($page==$lastpg?
0:
$page+1);
$firstcount=($page-1)*$displaypg;
$pagenav="
显示第<
B>
.($totle?
($firstcount+1):
0)."
/B>
-<
.min($firstcount+$displaypg,$totle)."
条记录,共$totle条记录"
if($lastpg<
=1)returnfalse;
$pagenav.="
<
ahref='
$url=1'
首页<
"
if($prepg)$pagenav.="
$url=$prepg'
前页<
else$pagenav.="
前页"
if($nextpg)$pagenav.="
$url=$nextpg'
后页<
后页"
$url=$lastpg'
尾页<
到第<
selectname='
topage'
size='
1'
onchange='
window.location=\"
$url=\"
+this.value'
\n"
for($i=1;
$i<
=$lastpg;
if($i==$page)$pagenav.="
optionvalue='
selected>
/option>
else$pagenav.="
/select>
页,共$lastpg页"
Regester.php
if($_POST['
]){
$xm=$_POST['
$gz=$_POST['
$dj=$_POST['
$jbgz=$_POST['
$wy=$_POST['
wy'
if($bm=="
null"
)$bm="
空"
if($zc=="
)$zc="
insert("
xm,gz,dj,jbgz"
$xm'
'
$gz'
$dj'
$jbgz'
$query=mysql_query("
selectmax(ID)fromgzb"
$row=mysql_fetch_row($query);
$db->
xm,y_id,1y,2y,3y,4y,5y,6y,7y,8y,9y,10y,11y,12y"
$row[0]'
0,0,0,0,0,0,0,0,0,0,0,0"
xm,y_id,jtsj,jtlx,jtts,jtqk"
0,0,0,0"
xm,y_id,jbxx"
$_POST[jbxx]'
header("
scriptlanguage="
javascript"
varxmlHttp;
functioncreateXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp=newActiveXObject("
Microsoft.XMLHTTP"
}elseif(window.XMLHttpRequest){
xmlHttp=newXMLHttpRequest();
functionselect_class(){
vargz=document.getElementById("
).value;
createXMLHttpRequest();
varurl="
1.php?
gz="
+gz+"
+Math.random();
xmlHttp.open("
GET"
url,true);
xmlHttp.setRequestHeader("
cache-control"
no-control"
xmlHttp.onreadystatechange=showclass;
xmlHttp.send(null);
functionshowclass(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
varby=xmlHttp.responseText;
document.getElementById("
).innerHTML=by;
}
functionshowHint(){
vardj=document.getElementById("
dj"
vargz=document.getElementById("
createXMLHttpRequest()
2.php?
dj="
+dj+"
xmlHttp.onreadystatechange=show;
functionshow(){
ygz"
).innerHTML