-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarehouse.php
231 lines (223 loc) · 6.78 KB
/
warehouse.php
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
<?php
session_start();
include("includes/functions.php");
if(!$USER=displayLogin()){if(isset($sql)) $sql->close(); exit;}
$TITLE = 'Ïàíåëü óïðàâëåíèÿ ìàãàçèíîì';
$MESSAGE = '';
$ISAJAX = false;
$ADDTRANSACTION=false;
$WRH = getRefElements('warehouse');
$ACTION_TEMPLATE = 'default';
if(!isset($fwrh_id)) $WRH_ID=1; else $WRH_ID=$fwrh_id;
$WRHNAME = $WRH[$WRH_ID];
$RESTS_TOTAL = wrhrests_totals($WRH_ID);
if(isset($action))
{
$WRH = getRefElements('warehouse');
$GOODS_TYPE = getRefElements('wrh_goods_type');
$UNIT = getRefElements('wrh_um');
$CATEGORY = getRefElements('wrh_size','SIZE');
$NEWTRANROW = 0;
$NEWITEM = 0;
$_SESSION['currentrow'] = 0;
switch ($action){
case 'wrh_in':
$dc_flag=1;
$is_reserve=0;
$ADDTRANSACTION=true;
break;
case 'wrh_out':
$dc_flag=-1;
$is_reserve=0;
$ADDTRANSACTION=true;
break;
case 'wrh_reserve':
$dc_flag=-1;
$is_reserve=1;
$ADDTRANSACTION=true;
break;
case 'wrh_unreserve':
$dc_flag=1;
$is_reserve=1;
$ADDTRANSACTION=true;
break;
case 'add_wrh_transactions':
foreach($fnmcl_id as $i=>$fitem_id){
if (strlen($fnmcl_name[$i])>0 && (float)$fquantity[$i] > 0.0){
$ITEM = new item($fitem_id);
$tran_id = $ITEM->createWrhTransaction(
$fwrh_id,
$fgoods_type_id[$i],
(strlen($fctg_id[$i])>0?$fctg_id[$i]:'null'),
(strlen($fprice[$i])>0?$fprice[$i]:'null'),
(strlen($fum_id[$i])>0?$fum_id[$i]:'null'),
$fdc_flag,
(isset($fis_reserve)?$fis_reserve:0),
$fquantity[$i],
'null'
);
if ($tran_id < 0){
echo $ITEM->getMessage();
}
}
}
break;
case 'make_model':break;;
case 'make_prod_order01':
$ACTION_TEMPLATE = 'templates/forms/'.$action.'.htm';
$WRH_ACTION=$action;
$DOCTP = 'PRODORDER';
$DOCS = getDocuments(1);
$VIEWDOC = false;
if (isset($fdoc_id)) {
if($fdoc_id >= 0){
$DOC = new Document($fdoc_id);
if (count($DOC->items)>0)
$_SESSION['currentrow'] = max(array_keys($DOC->items));
}
$VIEWDOC = true;
}
break;
case'workout_orders':break;
case'wrh_msk_out':break;
case'wrh_msk_in':break;
case 'make_prod_order02':;
case 'wrh_bish_in':
$ACTION_TEMPLATE = 'templates/forms/'.$action.'.htm';
$WRH_ACTION=$action;
$DOCTP = 'PRODORDER';
$DOCS = getDocuments(1);
$VIEWDOC = false;
if (isset($fdoc_id)) {
if($fdoc_id >= 0){
$DOC = new Document($fdoc_id);
if (count($DOC->items)>0)
$_SESSION['currentrow'] = max(array_keys($DOC->items));
}
$VIEWDOC = true;
}
break;
case'wrh_bish_in':break;
case'wrh_bish_out':
$ACTION_TEMPLATE = 'templates/forms/'.$action.'.htm';
$WRH_ACTION=$action;
$DOCTP = 'WRHMOVE';
$DOCS = getDocuments(2);
$VIEWDOC = false;
if (isset($fdoc_id)) {
if($fdoc_id >= 0){
$DOC = new Document($fdoc_id);
if (count($DOC->items)>0)
$_SESSION['currentrow'] = max(array_keys($DOC->items));
}
$VIEWDOC = true;
}
break;
}}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//RU" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML lang="ru,en">
<HEAD>
<TITLE><?=$TITLE?></TITLE>
<META content="text/html"; charset="windows-1251" http-equiv="Content-Type" />
<link rel="stylesheet" href="prd_main.css"/>
<!--[if IE7]><link rel="stylesheet" type="text/css" href="prd_main_ie.css" media="all" /><![endif]-->
<script language="JavaScript" src="ajax.js"></script>
</HEAD>
<BODY>
<!-- .......................... Çàãîëîâîê .......................... -->
<?php require("templates/menu.htm");?>
<div id=contMain>
<table border="0" cellspacing="0" cellpadding="0" width=100%>
<tr>
<!-- .......................... Ëåâîå ìåíþ .......................... -->
<td valign=top width=170px>
<div class=nav>
<h3>Ñêëàä</h3>
<div class=navItem>
<?php foreach($WRH as $id=>$wrh): ?>
<?=$wrh?><br>
<form method=get>
<input type=hidden name=action value=wrh_in>
<input type=hidden name=fwrh_id value=<?=$id?>>
<input type=submit value="Ïðèõîä">
</form>
<form method=get>
<input type=hidden name=action value=wrh_out>
<input type=hidden name=fwrh_id value=<?=$id?>>
<input type=submit value="Ðàñõîä">
</form>
<form method=get>
<input type=hidden name=action value=wrh_reserve>
<input type=hidden name=fwrh_id value=<?=$id?>>
<input type=submit value="Ðåçåðâ">
</form>
<form method=get>
<input type=hidden name=action value=wrh_unreserve>
<input type=hidden name=fwrh_id value=<?=$id?>>
<input type=submit value="Îòìåíèòü Ðåçåðâ">
</form>
<br><br>
<?php endforeach?>
</div>
</div>
</td>
<!-- .......................... Ñîäåðæèìîå .......................... -->
<td valign=top>
<div id=catContent>
<?php if($ACTION_TEMPLATE=='default'):?>
<table>
<tr>
<td>
<h2>Ìîñêâà</h2>
<p><a href=warehouse.php?action=make_model>Ðàçðàáîòàòü ìîäåëü</a></p>
<p><a href=warehouse.php?action=make_prod_order01>Çàêàçàòü ïîøèâ</a></p>
<p><a href=warehouse.php?action=workout_orders>Îáðàáîòàòü çàêàçû</a></p>
<p><a href=warehouse.php?action=wrh_msk_out>Îòãðóçèòü</a></p>
<p><a href=warehouse.php?action=wrh_msk_in>Ïîëó÷èòü Òîâàð</a></p>
</td>
<td>
<h2>Áèøêåê</h2>
<p><a href=warehouse.php?action=make_prod_order02>Ïåðåäàòü çàêàçû â öåõ</a></p>
<p><a href=warehouse.php?action=wrh_bish_in>Ïðèíÿòü èç öåõà íà ñêëàä</a></p>
<p><a href=warehouse.php?action=wrh_bish_out>Îòïðàâèòü â ìîñêâó</a></p>
</td>
</tr>
</table>
<?php else:?>
<?php require($ACTION_TEMPLATE);?>
<?php endif;?>
<br><br><br><br><br><br><br>
<div class=editform>
<form method="get" name=wrhrest>
<input type="hidden" name="action" value="view_wrh"/>
<div class=blockedit>
<p><label>Îñòàòêè íà ñêëàäå</label>
<select name=fwrh_id>
<?php foreach($WRH as $id=>$wrh): ?>
<option <?=($id==$WRH_ID?'selected':'')?> value=<?=$id?>><?=$wrh?></option>
<?php endforeach?>
</select>
<input type=submit value="Ïðèìåíèòü">
<label>Ñóììà</label> <?=$RESTS_TOTAL->amount?> <label>Ñóììà ìåëê. îïò</label> <?=$RESTS_TOTAL->amount_mid?> <label>Ñóììà îïò</label> <?=$RESTS_TOTAL->amount_min?>
</p>
</div>
</form>
</div>
<br>
<?php if($ADDTRANSACTION):?>
<?php require('templates/addwrhform.htm');?>
<?php else:?>
<?php require('templates/wrhrests.htm');?>
<?php endif?>
</div>
</td>
</tr>
</table>
</div>
<!-- .......................... Ïîäâàë .......................... -->
<div id="FooterBar">
</div>
</BODY>
</HTML>
<?php if(isset($sql)) $sql->close();?>