-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsystem_gys_back.php
More file actions
307 lines (302 loc) · 11.9 KB
/
system_gys_back.php
File metadata and controls
307 lines (302 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<?php
require(dirname(__FILE__)."/include/config_rglobals.php");
require(dirname(__FILE__)."/include/config_base.php");
require(dirname(__FILE__)."/include/page.php");
require_once(dirname(__FILE__)."/include/checklogin.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/2019/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<link href="style/main.css" rel="stylesheet" type="text/css" />
<title>采购退货管理</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_kc_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;//货号
did=document.forms[0].r_dh.value;//单号
idh=document.forms[0].i_dh.value;//仓库号
number=document.forms[0].rk_number.value;//退回数量
price=document.forms[0].back_price.value;//进价
labid=document.forms[0].labid.value;//退回仓库
if(pid==''){
alert('请选择要退回的产品!');
return false;
}
if(number=='' || (!isInteger(number)) || number<=0){
alert('请确保输入了正确的退回数量');
return false;
}
url="current_order_back.php?pid="+pid+"&did="+did+"&num="+number+"&idh="+idh+"&back_price="+price+"&lid="+labid;
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
//入库单号设置
$rs=New Dedesql(falsh);
$query="select * from #@__reportbackgys";
$rs->SetQuery($query);
$rs->Execute();
$rowcount=$rs->GetTotalRow();
$cdh="Vb".str_replace('-','',GetDateMk(date(time())))."-".($rowcount+1);
$rs->close();
if ($action=='save'){//保存退货单及记录
$bsql=New Dedesql(false);
$query="select * from #@__kcbackgys where rdh='$r_dh'";//遍历此单产品
$bsql->SetQuery($query);
$bsql->Execute();
$rowcount=$bsql->GetTotalRow();
if ($rowcount==0){
ShowMsg('非法参数或没有要退回产品!','-1');
exit();
}
else{
//checkbank();检索银行列表并返回BankID
$money=0;
while($row=$bsql->getArray()){
$money+=$row['number']*$row['rk_price'];
$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']."' and l_id='".$row['labid']."'");
else
$csql->executenonequery("update #@__mainkc set number=number-".$row['number']." where p_id='".$row['productid']."' and l_id='".$row['labid']."'");
}
$row_bank=$csql->getOne("select * from #@__kc where productid='".$row['productid']."' and labid='".$row['labid']."'");
//更新银行金额
$csql->executenonequery("update #@__bank set bank_money=bank_money+".$money." where id='".$row_bank['bank']."'");
}
$thisbank=$row_bank['bank'];
$csql->close();
$loginip=getip();
$logindate=getdatetimemk(time());
$username=GetCookie('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."','0')");
//写入财务记录
$newsql->executenonequery("insert into #@__accounts(atype,amoney,abank,dtime,apeople,atext) values('退货返款','".$money."','$thisbank','".$r_date."','".$r_people."','退回供应商返回金额,对应退单号为:".$r_dh."')");
$newsql->close();
ShowMsg('库存表产品信息已修改','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> 采购退货管理</strong> - <a href="system_gys_back.php">新退货单</a></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<?php
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" id=\"table_border\">";
if(GetCookie('rank')==1)
$query="select * from #@__reportbackgys";
else
$query="select * from #@__reportbackgys where r_people='".GetCookie('VioomaUserID')."'";
$csql=New Dedesql(false);
$dlist = new DataList();
$dlist->pageSize = $cfg_record;
$dlist->SetParameter("action",$action);//设置GET参数表
$dlist->SetSource($query);
echo "<tr class='row_color_head'>
<td>ID</td>
<td>退货单号</td>
<td>操作人员</td>
<td>创单时间</td>
<td>审核状态</td>
<td>相关操作</td>
</tr>";
$mylist = $dlist->GetDataList();
while($row = $mylist->GetArray('dm')){
if($row['r_status']==1){
if(Getcookie('rank')=='1')
$statusstring="<a href='?action=sure&t=no&id=".$row['id']."'><img src='images/yes.png' alt='取消该单审核' border='0'></a>";
else
if(Getcookie('rank')=='1')
$statusstring="<a href='?action=sure&t=yes&id=".$row['id']."'><img src='images/no.png' alt='审核该单' border='0'></a>";
else
$statusstring="<img src='images/no.png' alt='审核该单' border='0'>";
$printstring=" | <a href=report_b_gys.php?action=save&type=other&sday=".$row['r_dh'].">打印此退单</a>";
}
else{
$statusstring="<a href='?action=sure&t=yes&id=".$row['id']."'><img src='images/no.png' alt='审核该单' border='0'></a>";
$printstring="";
}
echo "<tr>
<td><center>ID号:".$row['id']."</td>
<td><center> ".$row['r_dh']."</td>
<td><center> ".$row['r_people']."</td>
<td><center> ".$row['r_date']."</td>
<td><center> ".$statusstring."</td>
<td><center><span onclick=showsubinfo(".$row['id'].") style='cursor:hand;'>展开详情</span> ".$printstring."</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><center>货号</td>
<td><center>名称</td>
<td><center>规格</td>
<td><center>分类</td>
<td><center>单位</td>
<td><center>进价</td>
<td><center>供应商</td>
<td><center>退货数量</td>
<td><center>操作</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><center>".$row['productid']."</td>
<td><center> ".$row1['cp_name']."</td>
<td><center>".$row1['cp_gg']."</td>
<td><center>".get_name($row1['cp_categories'],'categories').">".get_name($row1['cp_categories_down'],'categories')."</td>
<td><center>".get_name($row1['cp_dwname'],'dw')."</td>
<td><center>¥".$row['rk_price']."</td>
<td><center>".$row1['cp_gys']."</td>
<td><center>".$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 if($action=='sure'){
$susql=new dedesql(false);
if($t=='yes')
$query="update #@__reportbackgys set r_status=1 where id='$id'";
else
$query="update #@__reportbackgys set r_status=0 where id='$id'";
$susql->executenonequery($query);
$susql->close();
showmsg('单据审核状态已修改','system_gys_back.php?action=seek');
}
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> 退回供应商管理</strong>(注:橙色背景为必填选项) - <a href="system_gys_back.php">新退货单</a> - <a href="system_gys_back.php?action=seek">退货单查询</a></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="table_border">
<form action="system_gys_back.php?action=save" method="post" name="form1">
<tr height="30">
<td class="cellcolor">退货单号:</td>
<td class="cellcolor"> <input type="text" name="r_dh" value="<?php echo $cdh; ?>" readonly class="rtext" size="15"> (创建人:<input type="text" name="r_people" value="<?php echo Getcookie('VioomaUserID'); ?>" readonly class="rtext" size="8">创建时间:<input type="text" name="r_date" value="<?php echo GetDateTimeMk(time());?>" readonly class="rtext">)</td>
</tr>
<tr>
<td class="cellcolor" width="30%">产品检索信息:<br></td>
<td> <input type="text" name="seek_text" value="单击选择产品信息" onclick="getinfo()"> (快速检索产品信息)
<input type="hidden" name="seek_number" value=""/><input type="hidden" name="i_dh" value=""/><input type="hidden" name="labid" value=""/>
</td>
</tr>
<tr>
<td class="cellcolor" width="30%">退回数量:<br></td>
<td> <input type="text" name="rk_number" size="5"><input type="text" class="rtext" name="showdw" readonly size="5">(某产品退回数量大于库存时退回库存里所有产品)
<input type="hidden" name="back_price" />
</td>
</tr>
<tr id="product_date" style="display:block;">
<td colspan="2">
所检索产品基本信息:<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>