-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsystem_kc.php
More file actions
237 lines (234 loc) · 8.79 KB
/
system_kc.php
File metadata and controls
237 lines (234 loc) · 8.79 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
<?php
require(dirname(__FILE__)."/include/config_base.php");
require(dirname(__FILE__)."/include/config_rglobals.php");
require(dirname(__FILE__)."/include/page.php");
require_once(dirname(__FILE__)."/include/checklogin.php");
check_grant('system_kc.php',GetCookie('rank'));
?>
<!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><?php echo $cfg_softname;?>系统库存</title>
<script language = "JavaScript">
var onecount;
onecount = 0;
subcat = new Array();
<?php
$count=0;
$rsql=New Dedesql(false);
$rsql->SetQuery("select * from #@__categories where reid!=0");
$rsql->Execute();
while($rs=$rsql->GetArray()){
?>
subcat[<?php echo $count;?>] = new Array("<?php echo $rs['categories'];?>","<?php echo $rs['reid'];?>","<?php echo $rs['id'];?>");
<?php
$count++;
}
$rsql->close();
?>
onecount=<?php echo $count?>;
function getCity(locationid)
{
document.form1.cp_categories_down.length = 0;
var locationid=locationid;
var i;
document.form1.cp_categories_down.options[0] = new Option('==所选分类的子分类==','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.cp_categories_down.options[document.form1.cp_categories_down.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
function out_excel(){
cp=document.forms[0].cp_categories.value;
cp_down=document.forms[0].cp_categories_down.value;
s=document.forms[0].sort.value;
st=document.forms[0].stext.value;
window.open('excel_kc.php?cp_categories='+cp+'&cp_categories_down='+cp_down+'&sort='+s+'&stext='+st,'','');
}
function skiplab(lid){
if(!lid==''){
window.location.href='system_kc.php?lid='+lid;
}
}
</script>
</head>
<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>
<table width="100%" border="0" cellspacing="0">
<form action="system_kc.php?action=seek" name="form1" method="post">
<tr height="22" bgcolor="#FFFFFF">
<td style="text-align:right;font-weight:bold;" colspan="2">
<?php
$ksql=New Dedesql(false);
$query="select * from #@__mainkc";
$ksql->setquery($query);
$ksql->execute();
$allrow=$ksql->gettotalrow();
while($row=$ksql->getarray()){
$allnumber+=$row['number'];
$thisjj=$ksql->getone("select * from #@__basic where cp_number='".$row['p_id']."'");
$themoney+=$thisjj['cp_jj']*$row['number'];
}
$ksql->close();
?>
仓库统计:计样 <font color=red><?php echo $allrow;?></font> 个共 <font color=red><?php echo $allnumber;?></font> 件,共计 <font color=red>¥<?php echo number_format($themoney,2,'.',',')?></font>
</td>
</tr>
<tr height="30">
<td>
<strong> 库存管理</strong>
</td>
<td align="right">
仓库:
<?php
$gsql=New Dedesql(false);
$query="select * from #@__lab";
$gsql->setquery($query);
$gsql->execute();
$rowcount=$gsql->gettotalrow();
if($rowcount>0){
echo "<select name='labid' onchange='skiplab(this.value)'>\r\n<option value=''>所有仓库</option>";
while ($row=$gsql->getarray()){
if($lid=='')
if($labid==$row['id'])
echo "<option value='".$row['id']."' selected>".$row['l_name']."</option>";
else
echo "<option value='".$row['id']."'>".$row['l_name']."</option>";
elseif($lid==$row['id'])
echo "<option value='".$row['id']."' selected>".$row['l_name']."</option>";
else
echo "<option value='".$row['id']."'>".$row['l_name']."</option>";
}
echo "</select>";
}
else
{
echo "<select name='labid'>\r\n<option value=''>所有仓库</option></select>";
}
$gsql->close();
?>
分类:
<?php
if ($action=='seek')
getcategories($cp_categories,$cp_categories_down);
else
getcategories(0,'');
?>
<select name="sort">
<option value="1">按货号查询</option>
<option value="2">按条码查询</option>
<option value="3" selected>按名称查询</option>
<option value="4">按助记词查询</option>
</select>
<input type="text" name="stext" size="15" VALUE="<?PHP ECHO $stext ?>"><input type="submit" value="开始检索"> <input type="button" onclick="out_excel()" value="导出excel" />
</td>
</tr></form>
</table>
</td>
</tr>
<form method="post" name="sel">
<tr>
<td bgcolor="#FFFFFF">
<?php
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" id=\"table_border\">";
if($action=='seek'){
if($cp_categories_down=='')echo "<script>alert('请选择小分类');history.go(-1);</script>";
if($labid=='')$labstring="";
else
$labstring=" and #@__mainkc.l_id='$labid'";
switch($sort){
case "1"://按货号
$query="select * from #@__mainkc,#@__basic where #@__basic.cp_number='$stext' and #@__basic.cp_categories='$cp_categories' and #@__basic.cp_categories_down='$cp_categories_down' and #@__mainkc.p_id=#@__basic.cp_number".$labstring;
break;
case "2"://按条码
$query="select * from #@__mainkc,#@__basic where #@__basic.cp_tm='$stext' and #@__basic.cp_categories='$cp_categories' and #@__basic.cp_categories_down='$cp_categories_down' and #@__mainkc.p_id=#@__basic.cp_number".$labstring;
break;
case "3"://按名称
$query="select * from #@__mainkc,#@__basic where #@__basic.cp_name LIKE '%".$stext."%' and #@__basic.cp_categories='$cp_categories' and #@__basic.cp_categories_down='$cp_categories_down' and #@__mainkc.p_id=#@__basic.cp_number".$labstring;
break;
case "4"://按肋记词
$query="select * from #@__mainkc,#@__basic where #@__basic.cp_helpword LIKE '%".$stext."%' and #@__basic.cp_categories='$cp_categories' and #@__basic.cp_categories_down='$cp_categories_down' and #@__mainkc.p_id=#@__basic.cp_number".$labstring;
break;
}
}
elseif($lid=='')
$query="select * from #@__mainkc,#@__basic where #@__mainkc.p_id=#@__basic.cp_number".$labstring;
else
$query="select * from #@__mainkc,#@__basic where #@__mainkc.p_id=#@__basic.cp_number and #@__mainkc.l_id='$lid'";
//echo $query;
//exit();
$csql=New Dedesql(false);
$dlist = new DataList();
$dlist->pageSize = $cfg_record;
//设置GET参数表
if($action=='seek'){
$dlist->SetParameter("action",$action);
$dlist->SetParameter("cp_categories",$cp_categories);
$dlist->SetParameter("cp_categories_down",$cp_categories_down);
$dlist->SetParameter("sort",$sort);
$dlist->SetParameter("stext",$stext);
$dlist->SetParameter("labid",$labid);
}
$dlist->SetParameter("lid",$lid);
$dlist->SetSource($query);
echo "<tr class='row_color_head'>
<td>货号</td>
<td>名称</td>
<td>规格</td>
<td>分类</td>
<td>单位</td>
<td>进价</td>
<td>供应商</td>
<td>所在仓库</td>
<td>库存</td>
<td>选择</td>
</tr>";
$mylist = $dlist->GetDataList();
while($row = $mylist->GetArray('dm')){
echo "<tr onMouseMove=\"javascript:this.bgColor='#EBF1F6';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\">\r\n
<td><center>".$row['p_id']."</td>
<td><center> ".$row['cp_name']."</td>
<td><center>".$row['cp_gg']."</td>
<td><center>".get_name($row['cp_categories'],'categories').">".get_name($row['cp_categories_down'],'categories')."</td>
<td><center>".get_name($row['cp_dwname'],'dw')."</td>
<td><center>¥".$row['cp_jj']."</td>
<td><center><a href='' title='查看与该供应商的数据'>".get_name($row['p_id'],'gys')."</a></td>
<td><center>".get_name($row['l_id'],'lab')."</td>
<td><center><font color=red>".$row['number']."</font></td>
<td><center><a href='system_kc_edit.php?id=".$row['kid']."&lid=".$row['l_id']."&n=".$row['number']."&pid=".$row['cp_number']."'>修改</a>|<a href='system_kc_del.php?action=del&id=".$row['kid']."'>删除</a><input type='checkbox' name='sel_pro".$row['id']."' value='".$row['id']."'></td>\r\n</tr>";
}
echo "<tr><td colspan='8'> ".$dlist->GetPageList($cfg_record)."</td></tr>";
echo "</table>";
$csql->close();
?>
</td>
</tr></form>
</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>
</body>
</html>