?? system_gys_back.php
字號(hào):
<?php
require(dirname(__FILE__)."/include/config_rglobals.php");
require(dirname(__FILE__)."/include/config_base.php");
require(dirname(__FILE__)."/include/page.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="style/main.css" rel="stylesheet" type="text/css" />
<title>退回供應(yīng)商</title>
<style type="text/css">
.rtext {background:transparent;border:0px;color:red;font-weight:bold;font-family:Verdana, Arial, Helvetica, sans-serif;}
</style>
<script language="javascript">
function isInteger(sNum) {
var num
num=new RegExp('[^0-9_]','')
if (isNaN(sNum)) {
return false
}
else {
if (sNum.search(num)>=0) {
return false
}
else {
return true
}
}
}
function getinfo(){
window.open('system_basic_list.php?form=form1&field=seek_text','selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=no,width=750,height=500,top=100,left=120');
}
function putrkinfo(){
pid=document.forms[0].seek_number.value;//貨號(hào)
did=document.forms[0].r_dh.value;//單號(hào)
//lid=document.forms[0].labid.value;//倉(cāng)庫(kù)號(hào)
number=document.forms[0].rk_number.value;//退回?cái)?shù)量
if(pid==''){
alert('請(qǐng)選擇要退回的產(chǎn)品!');
return false;
}
if(number=='' || (!isInteger(number)) || number<=0){
alert('請(qǐng)確保輸入了正確的退回?cái)?shù)量');
return false;
}
url="current_order_back.php?pid="+pid+"&did="+did+"&num="+number;
var obj=window.frames["current_order"];
obj.window.location=url;
}
function showsubinfo(tbnum){
whichEl = eval("rk_subinfo" + tbnum);
if (whichEl.style.display == "none"){eval("rk_subinfo" + tbnum + ".style.display=\"\";");}
else{eval("rk_subinfo" + tbnum + ".style.display=\"none\";");}
}
</script>
</head>
<?php
//入庫(kù)單號(hào)設(shè)置
$rs=New Dedesql(falsh);
$query="select * from #@__reportbackgys";
$rs->SetQuery($query);
$rs->Execute();
$rowcount=$rs->GetTotalRow();
if ($rowcount<10)
$cdh="Vb00000".($rowcount+1);
else if ($rowcount<100)
$cdh="Vb0000".($rowcount+1);
else if ($rowcount<1000)
$cdh="Vb000".($rowcount+1);
else if ($rowcount<10000)
$cdh="Vb00".($rowcount+1);
else if ($rowcount<100000)
$cdh="Vb0".($rowcount+1);
else
$cdh="Vb".($rowcount+1);
$rs->close();
if ($action=='save'){//保存退貨單及記錄
$bsql=New Dedesql(false);
$query="select * from #@__kcbackgys where rdh='$r_dh'";//遍歷此單產(chǎn)品
$bsql->SetQuery($query);
$bsql->Execute();
$rowcount=$bsql->GetTotalRow();
if ($rowcount==0){
ShowMsg('非法參數(shù)或沒有要退回產(chǎn)品!','-1');
exit();
}
else{
checkbank();
$money=0;
while($row=$bsql->getArray()){
$money+=$row['number']*getjj($row['productid']);
$csql=New dedesql(false);
$csql->setquery("select * from #@__mainkc where p_id='".$row['productid']."'");
$csql->execute();
$totalrec=$csql->gettotalrow();
if($totalrec!=0){
$err=$csql->getone();
if($err['number']-$row['number']<=0)
$csql->executenonequery("update #@__mainkc set number=0 where p_id='".$row['productid']."'");
else
$csql->executenonequery("update #@__mainkc set number=number-".$row['number']." where p_id='".$row['productid']."'");
}
}
$csql->close();
$loginip=getip();
$logindate=getdatetimemk(time());
$username=str_replace($cfg_cookie_encode,'',$_COOKIE['VioomaUserID']);
WriteNote('退貨單'.$r_dh.'成功保存',$logindate,$loginip,$username);
$newsql=New dedesql(false);
$newsql->executenonequery("insert into #@__reportbackgys(r_dh,r_people,r_date,r_status) values('".$r_dh."','".$r_people."','".$r_date."','1')");
//寫入財(cái)務(wù)記錄
$newsql->executenonequery("insert into #@__accounts(atype,amoney,abank,dtime,apeople,atext) values('收入','".$money."','".BANKID."','".$r_date."','".$r_people."','退回供應(yīng)商返回金額,對(duì)應(yīng)退單號(hào)為:".$r_dh."')");
//更新銀行金額
$newsql->executenonequery("update #@__bank set bank_money=bank_money+".$money." where id='".BANKID."'");
$newsql->close();
ShowMsg('庫(kù)存表產(chǎn)品信息已修改','system_gys_back.php');
$bsql->close();
exit();
}
}
else if($action=='seek'){ //列表
?>
<body>
<table width="100%" border="0" id="table_style_all" cellpadding="0" cellspacing="0">
<tr>
<td id="table_style" class="l_t"> </td>
<td> </td>
<td id="table_style" class="r_t"> </td>
</tr>
<tr>
<td> </td>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td><strong> 產(chǎn)品入庫(kù)單管理</strong> - <a href="system_rk.php">新進(jìn)貨單</a></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<?php
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" id=\"table_border\">";
$query="select * from #@__reportbackgys";
$csql=New Dedesql(false);
$dlist = new DataList();
$dlist->pageSize = $cfg_record;
$dlist->SetParameter("action",$action);//設(shè)置GET參數(shù)表
$dlist->SetSource($query);
echo "<tr class='row_color_head'><td>ID</td><td>入庫(kù)單號(hào)</td><td>操作人員</td><td>創(chuàng)單時(shí)間</td><td>保存狀態(tài)</td><td>相關(guān)操作</td></tr>";
$mylist = $dlist->GetDataList();
while($row = $mylist->GetArray('dm')){
if($row['r_status']==1)
$statusstring="<img src='images/yes.png'>";
else
$statusstring="<img src='images/no.png'>";
echo "<tr><td>ID號(hào):".$row['id']."</td><td> ".$row['r_dh']."</td><td> ".$row['r_people']."</td><td> ".$row['r_date']."</td><td> ".$statusstring."</td><td><span onclick=showsubinfo(".$row['id'].") style='cursor:hand;'>展開詳情</span> | <a href=system_basic_del.php?id=".$row['id'].">打印此單</a></td></tr>";
echo "<tr id='rk_subinfo".$row['id']."' style='display:none;'><td colspan='6'><br><table width=\"98%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" id=\"table_border\" align=\"center\">";
$csql1=New Dedesql(false);
$csql1->SetQuery("select * from #@__kcbackgys where rdh='".$row['r_dh']."'");
$csql1->Execute();
$rowcount=$csql1->GetTotalRow();
echo "<tr class='row1_color_head'><td>貨號(hào)</td><td>名稱</td><td>規(guī)格</td><td>分類</td><td>單位</td><td>進(jìn)價(jià)</td><td>供應(yīng)商<td>入庫(kù)數(shù)量</td><td>操作</tr>";
while($row=$csql1->GetArray()){
$nsql=New dedesql(false);
$query1="select * from #@__basic where cp_number='".$row['productid']."'";
$nsql->setquery($query1);
$nsql->execute();
$row1=$nsql->getone();
echo "<tr onMouseMove=\"javascript:this.bgColor='#EBF1F6';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\"><td>".$row['productid']."</td><td> ".$row1['cp_name']."</td><td>".$row1['cp_gg']."</td><td>".get_name($row1['cp_categories'],'categories').">".get_name($row1['cp_categories_down'],'categories')."</td><td>".get_name($row1['cp_dwname'],'dw')."</td><td>¥".$row1['cp_jj']."</td><td>".$row1['cp_gys']."</td><td>".$row['number']."</td><td><a href=''></a></td></tr>";
$nsql->close();
}
$csql1->close();
echo "</table><br></td></tr>\r\n";
}
$csql->close();
echo "<tr><td colspan='6'> ".$dlist->GetPageList($cfg_record)."</td></tr></table>\r\n </td></tr></table>
</td></tr> <tr>
<td id=\"table_style\" class=\"l_b\"> </td>
<td> </td>
<td id=\"table_style\" class=\"r_b\"> </td>
</tr>
</table>";
}
else{
?>
<body onload="form1.seek_text.focus()">
<table width="100%" border="0" id="table_style_all" cellpadding="0" cellspacing="0">
<tr>
<td id="table_style" class="l_t"> </td>
<td> </td>
<td id="table_style" class="r_t"> </td>
</tr>
<tr>
<td> </td>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td><strong><strong> 退回供應(yīng)商管理</strong>(注:橙色背景為必填選項(xiàng)) - <a href="system_gys_back.php">新退貨單</a> - <a href="system_gys_back.php?action=seek">退貨單查詢</a></td>
</tr><form action="system_gys_back.php?action=save" method="post" name="form1">
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="table_border">
<tr height="30">
<td class="cellcolor">退貨單號(hào):</td>
<td class="cellcolor"> <input type="text" name="r_dh" value="<?php echo $cdh; ?>" readonly class="rtext" size="10"> (創(chuàng)建人:<input type="text" name="r_people" value="<?php echo str_replace($cfg_cookie_encode,'',$_COOKIE['VioomaUserID']); ?>" readonly class="rtext" size="8">創(chuàng)建時(shí)間:<input type="text" name="r_date" value="<?php echo GetDateTimeMk(time());?>" readonly class="rtext">)</td>
</tr>
<tr>
<td class="cellcolor" width="30%">產(chǎn)品檢索信息:<br></td>
<td> <input type="text" name="seek_text" value="單擊選擇產(chǎn)品信息" onclick="getinfo()"> (快速檢索產(chǎn)品信息)
<input type="hidden" name="seek_number" value=""/>
</td>
</tr>
<tr>
<td class="cellcolor" width="30%">退回?cái)?shù)量:<br></td>
<td> <input type="text" name="rk_number" size="5"><input type="text" class="rtext" name="showdw" readonly size="5">(某產(chǎn)品退回?cái)?shù)量大于庫(kù)存時(shí)退回庫(kù)存里所有產(chǎn)品)
</td>
</tr>
<tr id="product_date" style="display:block;">
<td colspan="2">
所檢索產(chǎn)品基本信息:<input type="text" class="rtext" style="width:80%;" name="showinfo" readonly>
</td>
</tr>
<tr>
<td class="cellcolor"> </td>
<td> <input type="button" value=" 登記到此單 " onclick="putrkinfo()"> <input type="submit" value="保存退貨記錄"></td>
</tr></form>
<tr>
<td colspan="2">
<iframe src="current_order_back.php?pid=&did=<?php echo $cdh ?>&action=normal" width="100%" height="400" scrolling="auto" frameborder="0" marginheight="0" marginwidth="0" name="current_order" od="current_order"></iframe>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td> </td>
</tr>
<tr>
<td id="table_style" class="l_b"> </td>
<td> </td>
<td id="table_style" class="r_b"> </td>
</tr>
</table>
<?php
}
copyright();
?>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -