Commit 3052fe2ebaec5d0d86c83c341fbeab57f5b9cdf8
1 parent
3afff019
+ ссылка просмотра лог действий манагеров
Showing
1 changed file
with
2701 additions
and
0 deletions
Show diff stats
1 | +<? // Ïîäêëþ÷åíèå | ||
2 | + include_once($_SERVER['DOCUMENT_ROOT']."/account/mods/autorizator_admin.php"); | ||
3 | + include_once($_SERVER['DOCUMENT_ROOT']."/account/class/class.report.php"); | ||
4 | + include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.php"); | ||
5 | + | ||
6 | + // ====================================== | ||
7 | + // ====================================== | ||
8 | + // ============ Îáðàáîòêà =============== | ||
9 | + // ====================================== | ||
10 | + // ====================================== | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | +if($_GET['test'] == "1"){ | ||
15 | + | ||
16 | +//eMailing('order-new',"5172", "11181"); | ||
17 | + | ||
18 | +} | ||
19 | + | ||
20 | + if(isset($_GET['orderID']) && isset($_GET['paid'])){ | ||
21 | + $sql = sprintf("UPDATE catalogs_orders SET paid=%d WHERE id=%d", $_GET['paid'], $_GET['orderID']); | ||
22 | + | ||
23 | + mysql_query($sql); | ||
24 | + }elseif(isset($_GET['label'])){ | ||
25 | + $sql = sprintf("UPDATE catalogs_orders SET label=%d WHERE id=%d", $_GET['label'], $_GET['orderID']); | ||
26 | + | ||
27 | + mysql_query($sql); | ||
28 | + } | ||
29 | + | ||
30 | + // ============= | ||
31 | + // == status === | ||
32 | + // ============= | ||
33 | + | ||
34 | +//print_r($_POST); | ||
35 | +//exit; | ||
36 | + if ((isset($_POST['action']) && $_POST['action']=='status') || trim($_POST['status'])!='') { | ||
37 | + | ||
38 | + | ||
39 | + $sql = "UPDATE catalogs_orders SET status='".$_POST['status']."' WHERE `id`='".$_POST['order_id']."'"; | ||
40 | + $result = mysql_query($sql) or die(mysql_error()); | ||
41 | +//exit; | ||
42 | + } | ||
43 | + | ||
44 | + // ==================== | ||
45 | + // ===== order ======== | ||
46 | + // ==================== | ||
47 | + | ||
48 | + // ============== | ||
49 | + // ==== edit ==== | ||
50 | + // ============== | ||
51 | + | ||
52 | + if(isset($_POST['sms_send'])){ | ||
53 | + $sql = "insert into sms_history(order_id,mktime,text,user) values('".$_POST['order_id']."','".mktime()."','".$_POST['sms_msg']."','".$_SESSION['admin']['login']."')"; | ||
54 | + mysql_query($sql); | ||
55 | + foreach($_POST['sms_tel'] as $tel){ | ||
56 | + sendSMS($tel,$_POST['sms_msg']); | ||
57 | + } | ||
58 | + GoBack(1); | ||
59 | + } | ||
60 | + elseif (isset($_POST['send']) && $_POST['send']=='edit-order') { | ||
61 | + | ||
62 | + | ||
63 | + $error=''; | ||
64 | + $error[] = ValidFormData($_POST['user']['email'],'email','email'); | ||
65 | + $error[] = ValidFormData($_POST['user']['city'],'ãîðîä','require'); | ||
66 | + $error[] = ValidFormData($_POST['user']['address'],'àäðåñ','require'); | ||
67 | + $error[] = ValidFormData($_POST['user']['tel'],'ìîá.òåëåôîí','mobile'); | ||
68 | + $error[] = ValidFormData($_POST['user']['username'],'èìÿ','require'); | ||
69 | + | ||
70 | + $alert=implode('\r\n',$error); | ||
71 | + | ||
72 | + $mass=array_filter($error); | ||
73 | + if (empty($mass)) { | ||
74 | + | ||
75 | + $summary=0; | ||
76 | + | ||
77 | + // Ïðîâåðÿåì åñòü ëè óæå â çàêàçàõ | ||
78 | + $sql="SELECT *, product_id as mod_id from catalogs_orders_products WHERE order_id='".$_POST['order_id']."'"; | ||
79 | + $result = mysql_query($sql) or die(mysql_error()); | ||
80 | + if(mysql_affected_rows()!=0){ | ||
81 | + while($item=mysql_fetch_assoc($result)) { | ||
82 | + $ordered[]=$item['mod_id']; | ||
83 | + } | ||
84 | + } | ||
85 | + | ||
86 | + // =========================================== | ||
87 | + // ======= Ïðîâåðÿåì íà èçìåíåíèå =========== | ||
88 | + // =========================================== | ||
89 | + | ||
90 | + $ChangesOfOrder = ChangesOfMass($_POST['item']['mod_id'],$ordered); | ||
91 | + | ||
92 | + // ========== | ||
93 | + // == same == | ||
94 | + // ========== | ||
95 | + | ||
96 | + if (isset($ChangesOfOrder['same'])) { | ||
97 | + | ||
98 | + $mass=array_filter($ChangesOfOrder['same']); | ||
99 | + if (!empty($mass)) { | ||
100 | + | ||
101 | + foreach ($ChangesOfOrder['same'] as $value) { | ||
102 | + | ||
103 | + // Óçíàåì key(èíäåêñ) â ìàññèâå | ||
104 | + $i=array_keys($_POST['item']['mod_id'], $value); $i=$i[0]; | ||
105 | + | ||
106 | + // Îáíîâëÿåì êîëè÷åñòâî | ||
107 | + //print_r($_POST);exit; | ||
108 | + $sql2 = "UPDATE catalogs_orders_products SET `count`='".$_POST['item']['quant'][$i]."',`reservation`='".$_POST['item']['reservation'][$i]."',`status`='".$_POST['item']['status'][$i]."',`vozvrat`='".$_POST['item']['vozvrat'][$i]."' WHERE order_id='".$_POST['order_id']."' AND product_id='".$_POST['item']['mod_id'][$i]."'"; | ||
109 | + // print "<br>"; | ||
110 | + $result2 = mysql_query($sql2) or die(mysql_error()); | ||
111 | + | ||
112 | + // Ñóììà âñåãî çàêàçà | ||
113 | + $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); | ||
114 | + } | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + // ========== | ||
119 | + // === add == | ||
120 | + // ========== | ||
121 | + | ||
122 | + if (isset($ChangesOfOrder['add'])) { | ||
123 | + | ||
124 | + $mass=array_filter($ChangesOfOrder['add']); | ||
125 | + if (!empty($mass)) { | ||
126 | + | ||
127 | + foreach ($ChangesOfOrder['add'] as $value) { | ||
128 | + | ||
129 | + // Óçíàåì key(èíäåêñ) â ìàññèâå | ||
130 | + $i=array_keys($_POST['item']['mod_id'], $value); $i=$i[0]; | ||
131 | + | ||
132 | + // Äîáàâëÿåì òîâàðû | ||
133 | + $sql2=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,code,product_cine_id,count,reservation) VALUES (%s,%s,%s,%s,%s,%s)", | ||
134 | + GetSQLValueString($_POST['order_id'], "text"), | ||
135 | + GetSQLValueString($_POST['item']['mod_id'][$i], "text"), | ||
136 | + GetSQLValueString($_POST['item']['code'][$i], "text"), | ||
137 | + GetSQLValueString($_POST['item']['price'][$i], "text"), | ||
138 | + GetSQLValueString($_POST['item']['quant'][$i], "text"), | ||
139 | + GetSQLValueString($_POST['item']['reservation'][$i], "text")); | ||
140 | + $result2 = mysql_query($sql2) or die(mysql_error()); | ||
141 | + | ||
142 | + // Ñóììà âñåãî çàêàçà | ||
143 | + $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); | ||
144 | + } | ||
145 | + } | ||
146 | + } | ||
147 | + | ||
148 | + // ========== | ||
149 | + // == del === | ||
150 | + // ========== | ||
151 | + /* | ||
152 | + if (isset($ChangesOfOrder['del'])) { | ||
153 | + | ||
154 | + $mass=array_filter($ChangesOfOrder['del']); | ||
155 | + if (!empty($mass)) { | ||
156 | + | ||
157 | + foreach ($ChangesOfOrder['del'] as $value) { | ||
158 | + | ||
159 | + // Äîáàâëÿåì òîâàðû | ||
160 | + $sql2="DELETE FROM catalogs_orders_products WHERE order_id='".$_POST['order_id']."' AND product_id='".$value."'"; | ||
161 | + $result2 = mysql_query($sql2) or die(mysql_error()); | ||
162 | + } | ||
163 | + } | ||
164 | + } | ||
165 | + */ | ||
166 | + // =========== | ||
167 | + // == ÂÑÅÃÎ == | ||
168 | + // =========== | ||
169 | + | ||
170 | + | ||
171 | + if (isset($summary)) { | ||
172 | + //if(trim($_POST['label'])) $_POST['label'] = 1; | ||
173 | +//print_r($_POST); | ||
174 | + // Îáíîâëÿåì äàííûå çàêàçà | ||
175 | + $sql2=sprintf("UPDATE catalogs_orders SET cards=%s,insurance=%s,warehouse=%s,nakladnaya=%s,cost_delivery=%s,paid=%s,cause=%s,label=%s,delivery=%s,declaration=%s,payment=%s,city=%s,adress=%s,comment=%s,mcomment=%s,total=%s,meneger=%s,check2=%s,smst=%s,dedline=%s,sumn=%s,sends=%s,work_user=%s WHERE id='".$_POST['order_id']."'", | ||
176 | + GetSQLValueString($_POST['user']['cards'], "text"), | ||
177 | + GetSQLValueString($_POST['user']['insurance'], "text"), | ||
178 | + GetSQLValueString($_POST['user']['warehouse'], "text"), | ||
179 | + GetSQLValueString($_POST['user']['nakladnaya'], "text"), | ||
180 | + GetSQLValueString($_POST['cost_delivery'], "text"), | ||
181 | + $_POST['paid'], | ||
182 | + $_POST['cause'], | ||
183 | + $_POST['label'], | ||
184 | + $_POST['user']['delivery'], | ||
185 | + GetSQLValueString($_POST['user']['declaration'], "text"), | ||
186 | + GetSQLValueString($_POST['user']['payment'], "text"), | ||
187 | + GetSQLValueString($_POST['user']['city'], "text"), | ||
188 | + GetSQLValueString($_POST['user']['address'], "text"), | ||
189 | + GetSQLValueString($_POST['user']['comment'], "text"), | ||
190 | + GetSQLValueString($_POST['user']['mcomment'], "text"), | ||
191 | + GetSQLValueString($summary, "text"), | ||
192 | + $_POST['meneger'], | ||
193 | + GetSQLValueString($_POST['user']['check'], "text"), | ||
194 | + GetSQLValueString($_POST['user']['smst'], "text"), | ||
195 | + GetSQLValueString($_POST['user']['dedline'], "text"), | ||
196 | + GetSQLValueString($_POST['user']['sumn'], "text"), | ||
197 | + GetSQLValueString($_POST['user']['sends'], "text"), | ||
198 | + GetSQLValueString('0', "text") | ||
199 | + ); | ||
200 | + | ||
201 | + $result2 = mysql_query($sql2) or die(mysql_error()); | ||
202 | + | ||
203 | + eMailing('xml',$_POST['user_id'], $_POST['order_id']); | ||
204 | + $_SESSION['up'] = 1; | ||
205 | + // header("location:/admin.php/orders/?page=".$_GET['page']); | ||
206 | + } else { | ||
207 | + | ||
208 | + //$sql2="DELETE FROM catalogs_orders WHERE id='".$_POST['order_id']."'"; | ||
209 | + //$result2 = mysql_query($sql2) or die(mysql_error()); | ||
210 | + } | ||
211 | + | ||
212 | + // GoBack(1); | ||
213 | + //echo"<script language=\"JavaScript\">document.location='/admin.php/orders/?page=".$_GET['page']."&n=1';</script>"; | ||
214 | + | ||
215 | + } else { | ||
216 | + | ||
217 | + echo"<script language=\"JavaScript\">alert('$alert')</script>"; | ||
218 | + | ||
219 | + } | ||
220 | + | ||
221 | + }else{ | ||
222 | +if(!empty($_GET['exit_order_id'])){ | ||
223 | + $sql = sprintf("UPDATE catalogs_orders SET work_user=0 WHERE id=%d", $_GET['exit_order_id']); | ||
224 | + | ||
225 | + mysql_query($sql); | ||
226 | +} | ||
227 | +if(empty($_SESSION['up']))$_SESSION['up'] = 2; | ||
228 | + | ||
229 | +if(!empty($_GET['order_ID'])){ | ||
230 | + $sql = sprintf("UPDATE catalogs_orders SET work_user=%d WHERE id=%d AND work_user=0", $_SESSION['admin']['id'], $_GET['order_ID']); | ||
231 | + | ||
232 | + mysql_query($sql); | ||
233 | +} | ||
234 | + | ||
235 | + } | ||
236 | + | ||
237 | + // ============== | ||
238 | + // ==== add ===== | ||
239 | + // ============== | ||
240 | + | ||
241 | + if (isset($_POST['send']) && $_POST['send']=='add-order') { | ||
242 | + | ||
243 | + // Ïðîâåðÿåì äûáèë ëè àäìèí | ||
244 | + $debil==false; | ||
245 | + | ||
246 | + for($i=1; $i<=count($_POST['item']); $i++) { | ||
247 | + if(isset($_POST['item']['mod_id'][$i]) && $_POST['item']['mod_id'][$i]=='') { $debil=true; } | ||
248 | + } | ||
249 | + | ||
250 | + if( $debil==false) { | ||
251 | + | ||
252 | + // $error=''; | ||
253 | + // $error[] = ValidFormData($_POST['user']['email'],'email','email'); | ||
254 | + // $error[] = ValidFormData($_POST['user']['city'],'ãîðîä','require'); | ||
255 | + // $error[] = ValidFormData($_POST['user']['address'],'àäðåñ','require'); | ||
256 | + // $error[] = ValidFormData($_POST['user']['tel'],'ìîá.òåëåôîí','mobile'); | ||
257 | + // $error[] = ValidFormData($_POST['user']['username'],'èìÿ','require'); | ||
258 | + | ||
259 | + // $alert=implode('\r\n',$error); | ||
260 | + | ||
261 | + // $mass=array_filter($error); | ||
262 | + // if (empty($mass)) { | ||
263 | + | ||
264 | + // Ïðîâåðÿåì ñóùåñòâóåò ëè ïîëüçîâàòåëü | ||
265 | + // $sql="SELECT * FROM zlo_users WHERE email='".$_POST['user']['email']."' "; | ||
266 | + // $result = mysql_query($sql) or die(mysql_error()); | ||
267 | + // if (mysql_affected_rows()!=0) { | ||
268 | + | ||
269 | + // } | ||
270 | + | ||
271 | + $time=mktime(); | ||
272 | + $date=date('Y-m-d H:i:s',$time); | ||
273 | + | ||
274 | + // Åñëè ñîçäàåì íîâîãî ïîëüçîâàòåëü | ||
275 | + if($_POST['user']['user_id']=='' || $_POST['user']['user_id']==0 || $_POST['user']['user_id']=='0') { | ||
276 | + | ||
277 | + if (strpos($_POST['user']['email'],"@user.com")) { | ||
278 | + $_POST['user']['group']=1; | ||
279 | + } else { | ||
280 | + $_POST['user']['group']=2; | ||
281 | + } | ||
282 | + | ||
283 | + // Äîáàâëÿåì ïîëüçîâàòåëÿ | ||
284 | + $pass=generate_password(6); | ||
285 | + $sql = sprintf("INSERT INTO zlo_users (pass, email, city, address, tel, registered, username, tel2, `group`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", | ||
286 | + GetSQLValueString($pass, "text"), | ||
287 | + GetSQLValueString($_POST['user']['email'], "text"), | ||
288 | + GetSQLValueString($_POST['user']['city'], "text"), | ||
289 | + GetSQLValueString($_POST['user']['address'], "text"), | ||
290 | + GetSQLValueString($_POST['user']['tel'], "text"), | ||
291 | + GetSQLValueString($date, "text"), | ||
292 | + GetSQLValueString($_POST['user']['username'], "text"), | ||
293 | + GetSQLValueString($_POST['user']['tel2'], "text"), | ||
294 | + GetSQLValueString($_POST['user']['group'], "int")); | ||
295 | + $result = mysql_query($sql) or die(mysql_error()); | ||
296 | + | ||
297 | + // Óçíàåì ID ïîëüçîâàòåëÿ | ||
298 | + $sql="SELECT id FROM zlo_users WHERE registered='$date' AND tel='".$_POST['user']['tel']."'"; | ||
299 | + $result = mysql_query($sql) or die(mysql_error()); | ||
300 | + if (mysql_affected_rows()!=0) { | ||
301 | + $user=mysql_fetch_assoc($result); | ||
302 | + | ||
303 | + // Øëåì ïèñüìà | ||
304 | + if($user['group']!=1) { | ||
305 | + eMailing('reg',$user['id']); | ||
306 | + } | ||
307 | + | ||
308 | + $_POST['user']['user_id']=$user['id']; | ||
309 | + | ||
310 | + } else { echo "íåò ïîëüçîâàòåëÿ";} | ||
311 | + | ||
312 | + } | ||
313 | + | ||
314 | + // Äîáàâëÿåì çàêàç | ||
315 | + $sql=sprintf("INSERT INTO catalogs_orders (cost_delivery,cards,insurance,warehouse,paid,label,delivery,declaration,payment,user_id,name,email,city,adress,phone,phonemob,comment,mcomment,mktime,total,sumn,sends,status) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,1)", | ||
316 | + GetSQLValueString($_POST['cost_delivery'], "text"), | ||
317 | + GetSQLValueString($_POST['user']['cards'], "text"), | ||
318 | + GetSQLValueString($_POST['user']['insurance'], "text"), | ||
319 | + GetSQLValueString($_POST['user']['warehouse'], "text"), | ||
320 | + GetSQLValueString($_POST['paid'], "text"), | ||
321 | + GetSQLValueString($_POST['label'], "text"), | ||
322 | + GetSQLValueString($_POST['user']['delivery'], "text"), | ||
323 | + GetSQLValueString($_POST['user']['declaration'], "text"), | ||
324 | + GetSQLValueString($_POST['user']['payment'], "text"), | ||
325 | + GetSQLValueString($_POST['user']['user_id'], "text"), | ||
326 | + GetSQLValueString($_POST['user']['username'], "text"), | ||
327 | + GetSQLValueString($_POST['user']['email'], "text"), | ||
328 | + GetSQLValueString($_POST['user']['city'], "text"), | ||
329 | + GetSQLValueString($_POST['user']['address'], "text"), | ||
330 | + GetSQLValueString($_POST['user']['tel'], "text"), | ||
331 | + GetSQLValueString($_POST['user']['tel2'], "text"), | ||
332 | + GetSQLValueString($_POST['user']['comment'], "text"), | ||
333 | + GetSQLValueString($_POST['user']['mcomment'], "text"), | ||
334 | + GetSQLValueString($time, "text"), | ||
335 | + GetSQLValueString($_POST['summary'], "text"), | ||
336 | + GetSQLValueString($_POST['user']['sumn'], "text"), | ||
337 | + GetSQLValueString($_POST['user']['sends'], "text")); | ||
338 | + $result = mysql_query($sql) or die(mysql_error()); | ||
339 | + | ||
340 | + // Óçíàåì íîìåð çàêàçà | ||
341 | + $sql="SELECT id FROM catalogs_orders WHERE mktime='$time' AND user_id='".$_POST['user']['user_id']."'"; | ||
342 | + $result = mysql_query($sql) or die(mysql_error()); | ||
343 | + if (mysql_affected_rows()!=0) { | ||
344 | + $order=mysql_fetch_assoc($result); | ||
345 | + } else { echo "Îøèáêà";} | ||
346 | + | ||
347 | + | ||
348 | + // Äîáàâëÿåì òîâàðû | ||
349 | + for($i=0; $i<=count($_POST['item']); $i++) { | ||
350 | + if($_POST['item']['code'][$i]!=''){ | ||
351 | + $sql=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,code,product_cine_id,count,reservation) VALUES (%s,%s,%s,%s,%s,%s)", | ||
352 | + GetSQLValueString($order['id'], "text"), | ||
353 | + GetSQLValueString($_POST['item']['mod_id'][$i], "text"), | ||
354 | + GetSQLValueString($_POST['item']['code'][$i], "text"), | ||
355 | + GetSQLValueString($_POST['item']['price'][$i], "text"), | ||
356 | + GetSQLValueString($_POST['item']['quant'][$i], "text"), | ||
357 | + GetSQLValueString($_POST['item']['reservation'][$i], "text")); | ||
358 | + $result = mysql_query($sql) or die(mysql_error()); | ||
359 | + } | ||
360 | + } | ||
361 | + | ||
362 | + // Øëåì ïèñüìà | ||
363 | + if ($user['group']!=1) { | ||
364 | + eMailing('order-new',$_POST['user']['user_id'], $order['id']); | ||
365 | + } | ||
366 | + | ||
367 | + echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/orders/\"; self.focus(); } </script>"; | ||
368 | + | ||
369 | + // } else { | ||
370 | + | ||
371 | + // echo"<script language=\"JavaScript\">alert('$alert')</script>"; | ||
372 | + | ||
373 | + // } | ||
374 | + | ||
375 | + | ||
376 | + } else { | ||
377 | + | ||
378 | + echo"<script language=\"JavaScript\">alert('Íåò òîâàpà - íåò çàêàçà')</script>"; | ||
379 | + | ||
380 | + } | ||
381 | + | ||
382 | + } | ||
383 | + | ||
384 | + // ================= | ||
385 | + // ==== NOTIFY ===== | ||
386 | + // ================= | ||
387 | + | ||
388 | + // ============== | ||
389 | + // == changed === | ||
390 | + // ============== | ||
391 | + | ||
392 | + if (isset($_GET['notify']) && $_GET['notify']=='order-changed') { | ||
393 | + | ||
394 | + eMailing('order-changed',$_GET['user'], $_GET['order']); | ||
395 | + | ||
396 | + echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/orders/\"; self.focus(); } </script>"; | ||
397 | + } | ||
398 | + | ||
399 | + | ||
400 | + // ====================================== | ||
401 | + // ====================================== | ||
402 | + // ============== Âûâîä ================= | ||
403 | + // ====================================== | ||
404 | + // ====================================== | ||
405 | + | ||
406 | + | ||
407 | + // ============= | ||
408 | + // ==== all ==== | ||
409 | + // ============= | ||
410 | + | ||
411 | + if (!isset($_GET['action'])) { | ||
412 | + | ||
413 | + echo"<script type='text/javascript'> | ||
414 | + function notify(url){ | ||
415 | + | ||
416 | + if(confirm(\"Âûñëàòü óâåäîìëåíèå?\")){ | ||
417 | + document.location=url; | ||
418 | + return true; | ||
419 | + } | ||
420 | + return false; | ||
421 | + } | ||
422 | + </script>"; | ||
423 | + | ||
424 | + | ||
425 | + | ||
426 | + // ============== | ||
427 | + // === report === | ||
428 | + // ============== | ||
429 | + | ||
430 | + | ||
431 | + $time=''; | ||
432 | + $time['day'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), date('j'), date('Y')); | ||
433 | + if(date('w')==1) { | ||
434 | + $time['week'] = " o.`mktime` >=".mktime(0, 0, 0, date('n'), date('j'), date('Y'))." "; | ||
435 | + } else { | ||
436 | + $time['week'] = "( o.`mktime` BETWEEN ".strtotime("last Monday")." AND ".mktime(0, 0, 0, date('n'), date('j')+1, date('Y')).") "; | ||
437 | + } | ||
438 | + $time['month'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), 1, date('Y')); | ||
439 | + | ||
440 | + Report::put_time($time); | ||
441 | + Report::make(); | ||
442 | + /* | ||
443 | + echo"<div class='orders-report' style='display:table; overflow:hidden;'>"; | ||
444 | + | ||
445 | + // === êëèåíòû === | ||
446 | + | ||
447 | + echo"<div style='background: url(\"http://".$_SERVER['SERVER_NAME']."/img/bg_report.jpg\"); background-repeat:no-repeat; border:1px solid #B9B9B9; padding:0 15px 5px;'>"; | ||
448 | + | ||
449 | + echo"<span style='padding:5px 0; display:block;'>ÒÎÏ êëèåíòîâ çà ïåðèîä: </span>"; | ||
450 | + echo Report::html_report(Report::get_mass_client()); | ||
451 | + echo"</div>"; | ||
452 | + | ||
453 | + echo"<div style='height:20px;display:block;'></div>"; | ||
454 | + | ||
455 | + // === ïðîäàæè === | ||
456 | + | ||
457 | + echo"<div style='background: url(\"http://".$_SERVER['SERVER_NAME']."/img/bg_report.jpg\"); background-repeat:no-repeat; border:1px solid #B9B9B9; padding:0 15px 5px;'>"; | ||
458 | + | ||
459 | + echo"<span style='padding:5px 0; display:block;'>Ïðîäàæè çà ïåðèîä: </span>"; | ||
460 | + echo Report::html_report(Report::get_mass_order()); | ||
461 | + echo"</div>"; | ||
462 | + | ||
463 | + echo"<div style='height:20px;display:block;'> </div>"; | ||
464 | + | ||
465 | + // === ãðàôèê === | ||
466 | + | ||
467 | + echo"<div style='background: url(\"http://".$_SERVER['SERVER_NAME']."/img/bg_report.jpg\"); background-repeat:no-repeat; border:1px solid #B9B9B9; padding:0 15px 5px;'>"; | ||
468 | + | ||
469 | + echo"<span style='padding:5px 0; display:block;'>Ãðàôèê: </span>"; | ||
470 | + echo"<a href='http://".$_SERVER['SERVER_NAME']."/xml/".date('Y')."/".date('m')."/grafic_report_".date('Y-m')."-".(date('d')-1).".png' ><img src='http://".$_SERVER['SERVER_NAME']."/xml/".date('Y')."/".date('m')."/grafic_report_".date('Y-m')."-".(date('d')-1).".png' width='340px' ></a>"; | ||
471 | + | ||
472 | + // ëåãåíäà | ||
473 | + echo"<div class='legend' style='display:table;text-align:center;'>"; | ||
474 | + echo"<div style='width:15px; height:15px; background:#00A652; float:left;'></div><span style='float:left; padding:0 5px;'>íîâûé</span>"; | ||
475 | + echo"<div style='width:15px; height:15px; background:#0072BB; float:left;'></div><span style='float:left; padding:0 5px;'>ïîäòâåðæäåí</span>"; | ||
476 | + echo"<div style='width:15px; height:15px; background:#F36523; float:left;'></div><span style='float:left; padding:0 5px;'>îòìåíåí</span>"; | ||
477 | + echo"<div style='width:15px; height:15px; background:#ED1B24; float:left;'></div><span style='float:left; padding:0 5px;'>âûïîëíåí</span>"; | ||
478 | + echo"<div style='clear:both;'></div>"; | ||
479 | + echo"</div>"; | ||
480 | + | ||
481 | + echo"</div>"; | ||
482 | + | ||
483 | + echo"</div>";*/ | ||
484 | + | ||
485 | + | ||
486 | + if (!isset($_GET['status'])) {$_GET['status']="1";} | ||
487 | + if (!isset($_GET['page'])) {$_GET['page']="1";} | ||
488 | + | ||
489 | + if(isset($_GET['user'])) {$AND="AND u.id=".$_GET['user'];} else {$AND='';} | ||
490 | + | ||
491 | + // ============= | ||
492 | + // === Ïîèñê === | ||
493 | + // ============= | ||
494 | + | ||
495 | + $th=array("order_id"=>"íîìåð çêàçà","username"=>"êëèåíò", "email"=>"email", "tel"=>"òåëåôîí", "declaration"=>"Äåêëàðàöèÿ ¹", "nakladnaya"=>"¹ íàêëàäíîé", "code"=>"øòðèõêîä", "mcomment"=>"Êîìåíòàðèé" ); | ||
496 | + | ||
497 | + // Åñëè ñóùåñòâóåò Ïîèñê | ||
498 | + if (isset($_REQUEST['search'])) { | ||
499 | + if($_REQUEST['field']=='order_id') {$pre="o";} | ||
500 | + if($_REQUEST['field']=='username') {$pre="u";} | ||
501 | + if($_REQUEST['field']=='email') {$pre="u";} | ||
502 | + if($_REQUEST['field']=='tel') {$pre="u";} | ||
503 | + if($_REQUEST['field']=='code') {$pre="m";} | ||
504 | + if($_REQUEST['field']=='declaration') {$pre="o";} | ||
505 | + if($_REQUEST['field']=='nakladnaya') {$pre="o";} | ||
506 | + if($_REQUEST['field']=='mcomment') {$pre="o";} | ||
507 | + $AND=''; | ||
508 | + if (trim($_REQUEST['look'])!='') { | ||
509 | + if($_REQUEST['field']=="order_id")$AND.="AND $pre.`".$_REQUEST['field']."` LIKE '".trim($_REQUEST['look'])."' "; | ||
510 | + else $AND.="AND $pre.`".$_REQUEST['field']."` LIKE '%".trim($_REQUEST['look'])."%' "; | ||
511 | + } | ||
512 | + if ( ($_REQUEST['form']['date_start'] !='') && ($_REQUEST['form']['date_end'] !='')){ | ||
513 | + | ||
514 | + $dateStart =$_REQUEST['form']['date_start']; | ||
515 | + $dateEnd =$_REQUEST['form']['date_end']; | ||
516 | + | ||
517 | + $mkdate=ExtractDate($_REQUEST['form']['date_start']); | ||
518 | + $_REQUEST['form']['date_start'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); | ||
519 | + | ||
520 | + $mkdate=ExtractDate($_REQUEST['form']['date_end']); | ||
521 | + $_REQUEST['form']['date_end'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); | ||
522 | + | ||
523 | + $AND.=" AND (o.`mktime` BETWEEN '".$_REQUEST['form']['date_start']."' AND '".$_REQUEST['form']['date_end']."') "; | ||
524 | + } | ||
525 | + } | ||
526 | + // ============= | ||
527 | + // === Äàòà ==== | ||
528 | + // ============= | ||
529 | + | ||
530 | + echo"<div class='grid-search'> | ||
531 | + <form action='".GetFormUrl()."' name='search' method='GET'> | ||
532 | + <div class='search'> | ||
533 | + <input type='text' name='look' id='grid-search' value='".$_REQUEST['look']."'> | ||
534 | + <select name='field'>"; | ||
535 | + | ||
536 | + foreach ($th as $key=>$value) { | ||
537 | + if($_REQUEST['field']==$key) {$selected='selected="selected"';} else {$selected='';} | ||
538 | + echo"<option value='$key' $selected>$value</option>"; | ||
539 | + } | ||
540 | + | ||
541 | + echo"</select> | ||
542 | + <input type='submit' value='ïîèñê'> | ||
543 | + <input type='hidden' name='status' value='".$_GET['status']."'> | ||
544 | + </div>"; | ||
545 | + | ||
546 | + echo"<div class='dates'> | ||
547 | + <div class='row'> | ||
548 | + <input type='text' name='form[date_start]' id='date_start_input' value='".$dateStart."'> | ||
549 | + <img src='/img/calendar.gif' id='date_start'> | ||
550 | + </div> | ||
551 | + <div class='row'> | ||
552 | + <input type='text' name='form[date_end]' id='date_end_input' value='".$dateEnd."'> | ||
553 | + <img src='/img/calendar.gif' id='date_end'> | ||
554 | + </div> | ||
555 | + </div>"; | ||
556 | + | ||
557 | + | ||
558 | + echo'<script type="text/javascript"> | ||
559 | + Calendar.setup( | ||
560 | + { | ||
561 | + inputField : "date_start_input", // ID of the input field | ||
562 | + ifFormat : "%Y-%m-%d", // the date format | ||
563 | + button : "date_start" | ||
564 | + } | ||
565 | + ); | ||
566 | + </script>'; | ||
567 | + | ||
568 | + echo'<script type="text/javascript"> | ||
569 | + Calendar.setup( | ||
570 | + { | ||
571 | + inputField : "date_end_input", // ID of the input field | ||
572 | + ifFormat : "%Y-%m-%d", // the date format | ||
573 | + button : "date_end" | ||
574 | + } | ||
575 | + ); | ||
576 | + </script>'; | ||
577 | + | ||
578 | + | ||
579 | + echo"<input type='hidden' name='search' value='ok'> | ||
580 | + | ||
581 | + </form> | ||
582 | + </div>"; | ||
583 | + | ||
584 | + | ||
585 | + // =========== Ãåíåðèì òàáëèöó =========== | ||
586 | + | ||
587 | +$eshka = ""; | ||
588 | +$eshka2 = ""; | ||
589 | +$eshka3 = ""; | ||
590 | +$lll = ""; | ||
591 | +/* | ||
592 | +if(trim(@$_REQUEST['da'])=='1'){ | ||
593 | + $eshka = "o.mktime<'1341090000' AND "; | ||
594 | + $eshka2 = "o.mktime<'1341090000' AND "; | ||
595 | + $lll = "font-weight:bold;"; | ||
596 | +}else{ | ||
597 | + $eshka = "o.mktime>'1341090000' AND "; | ||
598 | + $eshka2 = "o.mktime>'1341090000' AND "; | ||
599 | + $lll = ""; | ||
600 | +}*/ | ||
601 | + | ||
602 | + | ||
603 | + | ||
604 | +if(trim(@$_REQUEST['pr'])=='1'){ | ||
605 | +$tim = (time()-86400); | ||
606 | + $eshka3 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; | ||
607 | +}else{ | ||
608 | +$eshka3 = ""; | ||
609 | +} | ||
610 | + | ||
611 | +if(trim(@$_REQUEST['prs'])=='1'){ | ||
612 | +$tim = (time()-172800); | ||
613 | + $eshka4 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; | ||
614 | +}else{ | ||
615 | +$eshka4 = ""; | ||
616 | +} | ||
617 | + | ||
618 | +$order = ((isset($_GET['order'])) ? $_GET['order'] : 'mktime'); | ||
619 | +$type = ((isset($_GET['type'])) ? $_GET['type'] : 'DESC'); | ||
620 | + | ||
621 | + | ||
622 | +if(isset($_GET['stat']) && $_GET['stat']==1){ | ||
623 | +$AND .= " AND o.status IN(4,5) AND o.mktime<'".mktime(0, 0, 0, "01", "01", "2013")."' "; | ||
624 | +}else{ | ||
625 | +//$mk_and = $AND = "AND o.mktime>='".mktime(0, 0, 0, date("m"), date("d"), date("Y"))."' and o.mktime<='".mktime(0, 0, 0, date("m"), date("d")+1, date("Y"))."' "; | ||
626 | +$AND .= " AND o.status IN(1,2) AND o.mktime>='".mktime(0, 0, 0, "01", "01", "2013")."' "; | ||
627 | +$mk_and = " AND o.status IN(1,2) AND o.mktime>='".mktime(0, 0, 0, "01", "01", "2013")."' "; | ||
628 | +} | ||
629 | + | ||
630 | +if(isset($_GET['sort_label']) && $_GET['sort_label']!=''){ | ||
631 | +$AND .= " AND o.label='".$_GET['sort_label']."' "; | ||
632 | +} | ||
633 | +if(isset($_GET['lab'])){ | ||
634 | +$AND .= " AND o.label IN(".implode(',',$_GET['lab']).")"; | ||
635 | +} | ||
636 | +if(isset($_GET['delivery'])){ | ||
637 | +$AND .= " AND o.delivery IN(".implode(',',$_GET['delivery']).")"; | ||
638 | +} | ||
639 | +if(isset($_GET['meneger']) && $_GET['meneger']>0){ | ||
640 | +$AND .= " AND o.meneger='".$_GET['meneger']."'"; | ||
641 | +} | ||
642 | + | ||
643 | + $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, o.`mktime` as order_date, u.group, o.id as id_order, m.*, m.product_id as mod_id, op.* , p.*, g.color as group_color,za.username as meneger_name, o.order_id as order_id,adm.login as user_work_login | ||
644 | + FROM catalogs_orders_git as o | ||
645 | + LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | ||
646 | + LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | ||
647 | + LEFT JOIN catalogs_products AS p ON p.id = m.product_id | ||
648 | + LEFT JOIN zlo_users as u ON u.id=o.user_id | ||
649 | + LEFT JOIN zlo_users_group as g ON g.id=u.group | ||
650 | + LEFT JOIN zlo_admin as za ON za.id=o.meneger | ||
651 | + LEFT JOIN zlo_admin as adm ON adm.id=o.work_user | ||
652 | + WHERE ".$eshka3.$eshka4.$eshka./*((!isset($_GET['search']))?"o.status='".$_GET['status']."'":"o.status>'0'").*/"1=1 $AND GROUP BY o.id ORDER BY o.$order $type "; | ||
653 | + | ||
654 | + $pager['sql']= $sql; | ||
655 | + //echo $pager['sql']; | ||
656 | + $pager=pagerGetRun($pager,50,15); | ||
657 | + $result = mysql_query($pager['sql']) or die(mysql_error()); | ||
658 | + if (mysql_affected_rows()!=90800) { | ||
659 | + | ||
660 | + | ||
661 | + // ============= | ||
662 | + // === Òàáñ ==== | ||
663 | + // ============= | ||
664 | + | ||
665 | + echo"<div class='clear'></div>"; | ||
666 | + echo"<div class='order-tabs'>"; | ||
667 | + //////$eshka2.$eshka | ||
668 | + $sql0 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | ||
669 | + $result0 = mysql_query($sql0) or die(mysql_error()); | ||
670 | + if (mysql_affected_rows()!=0) { | ||
671 | + while ($rows=mysql_fetch_assoc($result0)) { | ||
672 | + | ||
673 | + //$AND | ||
674 | + | ||
675 | + // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | ||
676 | + $sql2 = "SELECT count(o.id) AS calc, o . * , m.*, m.product_id as mod_id, op.* , p.* | ||
677 | + FROM catalogs_orders as o | ||
678 | + LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | ||
679 | + LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | ||
680 | + LEFT JOIN catalogs_products AS p ON p.id = m.product_id | ||
681 | + LEFT JOIN zlo_users as u ON u.id=o.user_id | ||
682 | + LEFT JOIN zlo_users_group as g ON g.id=u.group | ||
683 | + WHERE ".$eshka2."o.status='".$rows['id']."' $AND"; | ||
684 | + | ||
685 | + | ||
686 | +//if(trim($_REQUEST['test'])=="1") echo $sql2; | ||
687 | + | ||
688 | + | ||
689 | +/* | ||
690 | + $sql2 = "SELECT count(o.id) AS calc FROM catalogs_orders as o WHERE ".$eshka2."o.status='".$rows['id']."'"; | ||
691 | + | ||
692 | + | ||
693 | + $result2 = mysql_query($sql2) or die(mysql_error()); | ||
694 | + $row2=mysql_fetch_assoc($result2); | ||
695 | + $yyyyyy = str_replace("prs=1","prs=0",str_replace("pr=1","pr=0",urlQueryChange2('status',$rows['id']))); | ||
696 | + echo"<div class='status-tabs' ".(($_GET['status']==$rows['id'])?"style='border:1px solid red;'":"")." onclick=\"location.href='".$yyyyyy."'\">".$rows['title']."(".$row2['calc'].")</div>"; | ||
697 | + */ | ||
698 | + } | ||
699 | + } | ||
700 | + | ||
701 | +$array_label = array(0=>"íîâûå çàêàçû",1=>"îáðàáîòàí",110=>"ïåðåìåùàåòñÿ",2=>"äîñòàâèòü",3=>"îòïðàâèòü",4=>"ñàìîâûâîç",5=>"",510=>"",6=>"", | ||
702 | + 7=>"âîçâðàò",8=>"",9=>"îòìåíåí",10=>"âûïîëíåí"); | ||
703 | +print'<div style="float:left;padding:10px 0px;"> | ||
704 | +<form action="/admin.php/orders/" name="form" method="get"> | ||
705 | +<input type="hidden" name="stat" value="'.$_GET['stat'].'"> | ||
706 | +<input type="hidden" name="look" value="'.$_GET['look'].'"> | ||
707 | +<input type="hidden" name="field" value="'.$_GET['field'].'"> | ||
708 | +<input type="hidden" name="form[date_start]" value="'.$dateStart.'"> | ||
709 | +<input type="hidden" name="form[date_end]" value="'.$dateEnd.'"> | ||
710 | +<input type="hidden" name="page" value="1"> | ||
711 | +<input type="hidden" name="search" value="ok"> | ||
712 | +'; | ||
713 | +print'</form></div>'; | ||
714 | + | ||
715 | + | ||
716 | + | ||
717 | + // =================== | ||
718 | + // === ÏÐÎÄÎËÆÅÍÈÅ === | ||
719 | + // =================== | ||
720 | + $url_l = '/admin.php/orders-git/?look='.$_GET['look'].'&field='.$_GET['field'].'&form[date_start]='.$dateStart.'&form[date_end]='.$dateEnd.'&search=ok&stat='.$_GET['stat'].'&page='.$_GET['page'].'&'; | ||
721 | + foreach($_GET['lab'] as $lab){ | ||
722 | + $url_l .= "lab[]=".$lab."&"; | ||
723 | + } | ||
724 | + foreach($_GET['delivery'] as $delivery){ | ||
725 | + $url_l .= "delivery[]=".$delivery."&"; | ||
726 | + } | ||
727 | + //print $url_l; | ||
728 | + print"<table border='0' width='100%' cellpadding='6' cellspacing='1' bgcolor='#d7decc' style='border-radius:10px;'> | ||
729 | + <tr style='color:#acd2f6;text-align:center;' bgcolor='#1372c6'> | ||
730 | + <td width='50' style='border-radius:10px 0px 0px 0px;'><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=id&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Êîïïèÿ</a></td> | ||
731 | + <td width='90'>Íîìåð çàêàçà</td> | ||
732 | + <td width='90'>Èçìåíÿë</td> | ||
733 | + <td width='90'><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=mktime&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Äàòà êîïïèè</a></td> | ||
734 | + <td width='90'>Äåäëàéí</td> | ||
735 | + <td width='150'>ÔÈÎ</td> | ||
736 | + <td width='50'><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=total&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Îáùàÿ ñóììà</a></td> | ||
737 | + <td width='50'><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=paid&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Îïëà÷åí</a></td> | ||
738 | + <td>Òåëåôîí</td> | ||
739 | + <td width='300'>Àäðåñ</td> | ||
740 | + <td><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=label&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Ìåòêà</a></td> | ||
741 | + <td>Ñòàòóñ</td> | ||
742 | + <td width='150'>Êîìåíòàðèé ìåíåäæåðà</td> | ||
743 | + <td style='border-radius:0px 10px 0px 0px;' width='100'>ÑÌÑ</td> | ||
744 | + </tr>"; | ||
745 | + $i1 = 0; | ||
746 | + while ($order=mysql_fetch_assoc($result)) { | ||
747 | + //print_r($order); | ||
748 | + if(empty($order['order_id']))$order['order_id']=0; | ||
749 | + print" <tr style='text-align:center;' bgcolor='".((($i1%2)==0)?"#fefff5":"#eff5e7")."'> | ||
750 | + <td id='ID{$order['id_order']}'><a href='".$url_l.(($_GET['order_ID']!=$order['id_order'])?"order_ID={$order['id_order']}#ID{$order['id_order']}":"")."'>{$order['id_order']}</a><br />{$order['meneger_name']}</td> | ||
751 | + <td width='90'>".$order['order_id']."</td> | ||
752 | + <td width='90'>".$order['user_work_login']."</td> | ||
753 | + <td width='90'>".date('Y-m-d H:i:s',$order['order_date'])."</td> | ||
754 | + <td width='90' style='color:".($order['dedline']<date("Y-m-d")?'red':'black')."'>".$order['dedline']."</td> | ||
755 | + <td width='150' align='left'><!--<a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>-->".$order['username']."<!--</a>--></td> | ||
756 | + <td width='50'>{$order['total']}</td> | ||
757 | + <td width='50'> | ||
758 | +"; | ||
759 | + | ||
760 | +if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4 || $_SESSION['admin']['group']==6){ | ||
761 | +echo "<select onChange='document.location=\"".$url_l."orderID={$order['order_id']}&paid=\"+this.value;'> | ||
762 | + <option value='0' ".(($order['paid']==0)?'selected':'').">íåò</option> | ||
763 | + <option value='1' ".(($order['paid']==1)?'selected':'').">äà</option> | ||
764 | + </select>"; | ||
765 | +}else{ | ||
766 | +if($order['paid']==1) print "Äà"; | ||
767 | +else print "Íåò"; | ||
768 | +} | ||
769 | + | ||
770 | + | ||
771 | +echo " | ||
772 | +</td> | ||
773 | + <td>{$order['tel']}<br/> <a href='/admin.php/sms/?orderID={$order['order_id']}'>Îòïðàâèòü CMC</a></td> | ||
774 | + <td align='left'>{$order['city']}, {$order['address']}</td> | ||
775 | + <td>"; | ||
776 | + | ||
777 | + | ||
778 | +//if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ | ||
779 | + | ||
780 | +if($_SESSION['admin']['group']==2 and ($order['label']==9 or $order['label']==10)){ | ||
781 | +print $order['label']; | ||
782 | +}else{ | ||
783 | +echo " <select onChange='if(this.value==9){o=\"&order_ID={$order['order_id']}\"}else{o=\"\";}document.location=\"".$url_l."orderID={$order['order_id']}&label=\"+this.value+o;'> "; | ||
784 | + for($i=0;$i<=10;$i++){ | ||
785 | + | ||
786 | +if(($_SESSION['admin']['group']==2) && ($i==9 || $i==10) && ($_SESSION['admin']['id']!=17)){ | ||
787 | + | ||
788 | +}else | ||
789 | +print'<option value="'.$i.'" '.(($order['label']==$i)?'selected':'').'>'.$i.'</option>'; | ||
790 | +if($i==1){print'<option value="110" '.(($order['label']==110)?'selected':'').'>1.1</option>';} | ||
791 | +if($i==5){print'<option value="510" '.(($order['label']==510)?'selected':'').'>5.1</option>';} | ||
792 | +} | ||
793 | + echo "</select>"; | ||
794 | +} | ||
795 | + | ||
796 | +//}else{ | ||
797 | +//print $order['label']; | ||
798 | +//} | ||
799 | + | ||
800 | +$s = "select * from catalogs_orders_products where order_id=".$order['order_id']; | ||
801 | +$r = mysql_query($s) or die(mysql_error()); | ||
802 | +$status = array(); | ||
803 | +while ($op=mysql_fetch_assoc($r)) { | ||
804 | + if(!empty($op['status']))$status[] = $op['status']; | ||
805 | +} | ||
806 | + echo "</td> | ||
807 | + <td>".implode(', ',$status)."</td> | ||
808 | + <td align='left'>"; | ||
809 | + if(strlen($order['mcomment'])>0)print"<a href='#' rel='msg' title='{$order['mcomment']}'>".substr($order['mcomment'],0,30)."...</a>"; | ||
810 | + print"</td> | ||
811 | + "; | ||
812 | + print"<td>".$order['smst']."</td>"; | ||
813 | + /* | ||
814 | + echo"<div class='orders'>"; | ||
815 | + | ||
816 | + echo"<div class='order-info-all'> | ||
817 | + | ||
818 | + <div class=order-info> | ||
819 | + <h4>Çàêàç #".$order['order_id']."<br> | ||
820 | + Äàòà: ".date('Y-m-d H:i:s',$order['order_date'])." | ||
821 | + </h4> | ||
822 | + <fieldset id='order-info' style=\"background:".$order['group_color'].";\"> | ||
823 | + <legend>Êëèåíò</legend> | ||
824 | + | ||
825 | + <label>Êëèåíò:</label> | ||
826 | + <div class=info><a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>".$order['username']."</a> </div> | ||
827 | + | ||
828 | + <label>Òåë:</label> | ||
829 | + <div class=info>".$order['tel']." </div> | ||
830 | + | ||
831 | + <label>Òåë 2:</label> | ||
832 | + <div class=info>".$order['tel2']." </div> | ||
833 | + | ||
834 | + <label>Ãðóïïà:</label> | ||
835 | + <div class=info>".viewBook('zlo_users_group', $order['group'], 'id', 'name')." </div> | ||
836 | + | ||
837 | + <div class=clear></div> | ||
838 | + <a class='history' href='/admin.php/orders/?action=show&user=".$order['user_id']."'>[Èñòîðèÿ çàêàçîâ]</a> | ||
839 | + | ||
840 | + </fieldset> | ||
841 | + | ||
842 | + <fieldset id='order-info' style='background:".$order['group_color'].";'> | ||
843 | + <legend>Äîñòàâêà</legend> | ||
844 | + | ||
845 | + <label>Äîñòàâêà:</label> | ||
846 | + <div class=info>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." </div> | ||
847 | + | ||
848 | + <label>Ãîðîä:</label> | ||
849 | + <div class=info>".$order['city']." </div> | ||
850 | + | ||
851 | + <label>Àäðåñ:</label> | ||
852 | + <div class=info>".$order['address']." </div> | ||
853 | + | ||
854 | + <label>Èíôî:</label> | ||
855 | + <div class=info> ".$order['comment']." </div> | ||
856 | + | ||
857 | + <div class=clear></div> | ||
858 | + | ||
859 | + </fieldset> | ||
860 | + <div class=clear></div> | ||
861 | + </div> | ||
862 | + </div>"; | ||
863 | + */ | ||
864 | + | ||
865 | + // Òàáëèöà òîâàðîâ | ||
866 | + /* | ||
867 | + echo" | ||
868 | + <div class='order-details'> | ||
869 | + <fieldset id='order-details'> | ||
870 | + <legend>Òîâàðû</legend>"; | ||
871 | + echo"<table> | ||
872 | + <tr> | ||
873 | + <td>¹</td> | ||
874 | + <td>Êîä</td> | ||
875 | + <td>Áðåíä</td> | ||
876 | + <td>Íàçâàíèå</td> | ||
877 | + <td>Ðàçìåð</td> | ||
878 | + <td>Öâåò</td> | ||
879 | + <td>Êîë.</td> | ||
880 | + <td>Öåíà</td> | ||
881 | + <td>Ñóììà</td> | ||
882 | + <td>Íàëè÷èå</td> | ||
883 | + <td></td> | ||
884 | + </tr>"; | ||
885 | + | ||
886 | + $sql3 = " | ||
887 | + SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* | ||
888 | + FROM catalogs_orders AS o | ||
889 | + LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | ||
890 | + LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | ||
891 | + LEFT JOIN catalogs_products AS p ON p.id = m.product_id | ||
892 | + WHERE o.id='".$order['order_id']."'"; | ||
893 | + $result3 = mysql_query($sql3) or die(mysql_error()); | ||
894 | + if (mysql_affected_rows()!=0) { | ||
895 | + while ($item=mysql_fetch_assoc($result3)) { { $i++; | ||
896 | + | ||
897 | + | ||
898 | + // íàëè÷èå òîâàðà | ||
899 | + $sql5 = "SELECT c.name as city, o.count | ||
900 | + FROM catalogs_keys_products_cities as o | ||
901 | + LEFT JOIN catalogs_cities as c | ||
902 | + ON o.city_id=c.id | ||
903 | + WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | ||
904 | + $result5 = mysql_query($sql5) or die(mysql_error()); | ||
905 | + if (mysql_affected_rows()!=0) { | ||
906 | + $onStockDesc=''; | ||
907 | + while ($onStock=mysql_fetch_assoc($result5)) { | ||
908 | + $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | ||
909 | + } | ||
910 | + } else { $onStockDesc='íåò'; } | ||
911 | + | ||
912 | + echo"<tr> | ||
913 | + <td>$i .</td> | ||
914 | + <td>".$item['code']."</td> | ||
915 | + <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | ||
916 | + <td><a href='/".$item['rubric_id']."-catalogs/".$item['translit']."-".$item['id']."/' target='_new'>".$item['name']."</a></td> | ||
917 | + <td>".$item['size']."</td> | ||
918 | + <td>".$item['color']."</td> | ||
919 | + <td>".$item['count']."</td> | ||
920 | + <td>".$item['cine']."</td> | ||
921 | + <td>".($item['cine']*$item['count'])."</td> | ||
922 | + <td>".$onStockDesc."</td> | ||
923 | + <td></td> | ||
924 | + </tr>"; | ||
925 | + | ||
926 | + } | ||
927 | + | ||
928 | + } | ||
929 | + } | ||
930 | + | ||
931 | + echo"</table> | ||
932 | + <b>Îáùàÿ ñóììà: ".$order['total']." ãðí.</b> | ||
933 | + </div>"; | ||
934 | + | ||
935 | + | ||
936 | + | ||
937 | + echo"<div class='clear'></div>"; | ||
938 | + */ | ||
939 | + // ***** Àäìèí ðåæèì ***** | ||
940 | + if(isset($_SESSION['admin']['edit1'])) { | ||
941 | + | ||
942 | + // Ñìåíà ñòàòóñà | ||
943 | + if ($order['status']!=6) { | ||
944 | + echo " | ||
945 | + <td width='20'>"; | ||
946 | + $sql4 = "SELECT * FROM zlo_book_status WHERE id IN ({$order['status']})"; | ||
947 | + $result4 = mysql_query($sql4) or die(mysql_error()); | ||
948 | + if (mysql_affected_rows()!=0) { | ||
949 | + while ($row4=mysql_fetch_assoc($result4)) { | ||
950 | + if($row4['id']!="5") | ||
951 | + echo $row4['title']; | ||
952 | + } | ||
953 | + | ||
954 | + } | ||
955 | + echo" | ||
956 | + </td><td width='20'> | ||
957 | + <div id='records'><a href='/admin.php/orders/?action=edit&user=".$order['user_id']."&order=".$order['order_id']."' class='button-edit2' target='_blank'>Èçìåíèòü</a></div> | ||
958 | + </form></td> | ||
959 | + "; | ||
960 | + } | ||
961 | + | ||
962 | + } print"</tr>"; | ||
963 | + if($order['id_order']==$_GET['order_ID']){ | ||
964 | + | ||
965 | + print'<tr><td colspan="13">'; | ||
966 | + // =========== Ãåíåðèì òàáëèöó =========== | ||
967 | + | ||
968 | + $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id, o.adress as address, g.name as user_group, g.color as user_color | ||
969 | + FROM catalogs_orders_git as o | ||
970 | + LEFT JOIN zlo_users as u ON u.id=o.user_id | ||
971 | + LEFT JOIN zlo_users_group as g ON g.id=u.group | ||
972 | + WHERE o.id='".$_GET['order_ID']."'"; | ||
973 | + $result1 = mysql_query($sql) or die(mysql_error()); | ||
974 | + if (mysql_affected_rows()!=0) { | ||
975 | + | ||
976 | + $order=mysql_fetch_assoc($result1); | ||
977 | + | ||
978 | + $r = mysql_query("select * from card where user_id='".$order['user_id']."'") or die(mysql_error()); | ||
979 | + $c=mysql_fetch_assoc($r); | ||
980 | + $order['cards'] = $c['card']; | ||
981 | + | ||
982 | + | ||
983 | + echo"<form action='$url_l' method='POST' name='edit_order' id='add-item'>"; | ||
984 | + echo"<div class='orders' style='margin:0px;width:100%;'>"; | ||
985 | + | ||
986 | + echo" | ||
987 | + <div class=order-info> | ||
988 | + <fieldset id='order-info'> | ||
989 | + <legend>Çàêàç #".$order['order_id']." Ãðóïïà: <font color='".$order['user_color']."'>".$order['user_group']."</font> Cóììà: ".$order['total']." ãðí.</legend> | ||
990 | + <div style='float:left;'> | ||
991 | + <label>Äàòà:</label> | ||
992 | + <div class=info>".date('d-m-Y H:i:s',$order['mktime'])."</div> | ||
993 | + <label>Äåäëàéí:</label> | ||
994 | + <div class=info> | ||
995 | + <input type='text' id='dedline_input' name='user[dedline]' value='".$order['dedline']."' style='width:100px;'><img src='/img/calendar.gif' id='date_dedline'> | ||
996 | +<script type=\"text/javascript\"> | ||
997 | + Calendar.setup( | ||
998 | + { | ||
999 | + inputField : \"dedline_input\", // ID of the input field | ||
1000 | + ifFormat : \"%Y-%m-%d\", // the date format | ||
1001 | + button : \"date_dedline\" | ||
1002 | + } | ||
1003 | + ); | ||
1004 | + </script> | ||
1005 | + </div> | ||
1006 | + <label>Îïëà÷åí:</label> | ||
1007 | + <div class=info style='float:left;padding-right:20px;'>"; | ||
1008 | + | ||
1009 | + | ||
1010 | +if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4 || $_SESSION['admin']['group']==6){ | ||
1011 | +echo "<select name='paid'> | ||
1012 | + <option value='0' ".(($order['paid']==0)?'selected':'').">íåò</option> | ||
1013 | + <option value='1' ".(($order['paid']==1)?'selected':'').">äà</option> | ||
1014 | + </select>"; | ||
1015 | +}else{ | ||
1016 | +if($order['paid']==1) print "Äà"; | ||
1017 | +else print "Íåò"; | ||
1018 | +echo "<input type=\"hidden\" name=\"paid\" value=\"".$order['paid']."\">"; | ||
1019 | + | ||
1020 | +} | ||
1021 | + | ||
1022 | + | ||
1023 | + | ||
1024 | + | ||
1025 | + echo "</div> | ||
1026 | + <div class=info style='float:left;padding-right:20px;width:100px;'> | ||
1027 | + <label style='width:50px'>Ìåòêà:</label> | ||
1028 | + <div class=info>"; | ||
1029 | + | ||
1030 | +//////////if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ | ||
1031 | +echo "<select name='label'>"; | ||
1032 | + for($i=0;$i<=10;$i++){ | ||
1033 | +if(($_SESSION['admin']['group']==2) && ($i==9 || $i==10) && ($_SESSION['admin']['id']!=17)){ | ||
1034 | + | ||
1035 | +}else | ||
1036 | +print'<option value="'.$i.'" '.(($order['label']==$i)?'selected':'').'>'.$i.'</option>'; | ||
1037 | +if($i==1){print'<option value="110" '.(($order['label']==110)?'selected':'').'>1.1</option>';} | ||
1038 | +if($i==5){print'<option value="510" '.(($order['label']==510)?'selected':'').'>5.1</option>';} | ||
1039 | +} | ||
1040 | + | ||
1041 | + echo "</select>"; | ||
1042 | +////////////}else{ | ||
1043 | +//////////////echo $order['label']; | ||
1044 | +/////} | ||
1045 | + | ||
1046 | + | ||
1047 | +echo " </div> | ||
1048 | + </div> | ||
1049 | + <div> | ||
1050 | + <label style='width:60px'>Ïðè÷èíû:</label> | ||
1051 | + | ||
1052 | + <div class=info> | ||
1053 | + <select name='cause' style='width:70px;'> | ||
1054 | + <option value='0'></option> | ||
1055 | + <option value='1' ".(($order['cause']==1)?'selected':'').">Íåò òîâàðà</option> | ||
1056 | + <option value='2' ".(($order['cause']==2)?'selected':'').">Íåò îïëàòû</option> | ||
1057 | + <option value='3' ".(($order['cause']==3)?'selected':'').">Ïåðåäóìàë</option> | ||
1058 | + | ||
1059 | + <option value='31' ".(($order['cause']==31)?'selected':'')."> - Êóïèë â äðóãîì ìåñòå</option> | ||
1060 | + <option value='32' ".(($order['cause']==32)?'selected':'')."> - Íå ïîäîøëè óñëîâèÿ äîñòàâêè</option> | ||
1061 | + <option value='33' ".(($order['cause']==33)?'selected':'')."> - Íå ïîäîøåë ñðîê äîñòàâêè</option> | ||
1062 | + <option value='34' ".(($order['cause']==34)?'selected':'')."> - Íåò äåíåã</option> | ||
1063 | + <option value='35' ".(($order['cause']==35)?'selected':'')."> - Êóïèò ïîçæå</option> | ||
1064 | + | ||
1065 | + <option value='4' ".(($order['cause']==4)?'selected':'').">Êóïèë â äðóãîì ìåñòå</option> | ||
1066 | + <option value='5' ".(($order['cause']==5)?'selected':'').">Ïîäüåäåò â ìàã.</option> | ||
1067 | + <option value='6' ".(($order['cause']==6)?'selected':'').">Äóáëü çàêàçà.</option> | ||
1068 | + <option value='7' ".(($order['cause']==7)?'selected':'').">Äðóãîå</option> | ||
1069 | + | ||
1070 | + <option value='8' ".(($order['cause']==8)?'selected':'').">Áðàê</option> | ||
1071 | + <option value='9' ".(($order['cause']==9)?'selected':'').">Îòêàçàëñÿ îò Ñàìîâûâîçà</option> | ||
1072 | + <option value='10' ".(($order['cause']==10)?'selected':'').">Íå ïðèåõàë çà Ñàìîâûâîçîì</option> | ||
1073 | + <option value='11' ".(($order['cause']==11)?'selected':'').">Îòìåíèë çàêàç</option> | ||
1074 | + <option value='12' ".(($order['cause']==12)?'selected':'').">Íå áåðåò òðóáêó</option> | ||
1075 | + | ||
1076 | + | ||
1077 | + | ||
1078 | + <option value='13' ".(($order['cause']==13)?'selected':'').">Òîâàð íå ñîîòâåòñòâóåò îïèñàíèþ íà ñàéòå</option> | ||
1079 | + </select> | ||
1080 | + </div> | ||
1081 | + | ||
1082 | + </div><div style='clear:both'></div> | ||
1083 | + <label>Êëèåíò:</label> | ||
1084 | + <div class=info> | ||
1085 | + <input type='text' name='user[username]' value='".$order['username']."' style='width:300px;' disabled='disabled'> | ||
1086 | + <input type='hidden' name='user[username]' value='".$order['username']."'> | ||
1087 | + </div> | ||
1088 | + | ||
1089 | + <label>Email:</label> | ||
1090 | + <div class=info> | ||
1091 | + <input type='text' name='user[email]' value='".$order['email']."' style='width:300px;' disabled='disabled'> | ||
1092 | + <input type='hidden' name='user[email]' value='".$order['email']."'> | ||
1093 | + </div> | ||
1094 | + | ||
1095 | + <label>Òåëåôîí:</label> | ||
1096 | + <div class=info> | ||
1097 | + <input type='text' name='user[tel]' value='".$order['tel']."' style='width:270px;' disabled='disabled'> | ||
1098 | + <input type='hidden' name='user[tel]' value='".$order['tel']."'> | ||
1099 | + <input type='checkbox' name='sms_tel[]' id='sms_tel1' value='".$order['tel']."'> | ||
1100 | + </div> | ||
1101 | + | ||
1102 | + <label>Òåëåôîí 2:</label> | ||
1103 | + <div class=info> | ||
1104 | + <input type='text' name='user[tel2]' value='".$order['tel2']."' style='width:270px;' disabled='disabled'> | ||
1105 | + <input type='hidden' name='user[tel2]' value='".$order['tel2']."'> | ||
1106 | + <input type='checkbox' name='sms_tel[]' id='sms_tel2' value='".$order['tel2']."'> | ||
1107 | + </div> | ||
1108 | + | ||
1109 | + <label>¹ êàðòî÷êè:</label> | ||
1110 | + <div class=info> | ||
1111 | + <input type='text' name='user[cards]' value='".$order['cards']."' style='width:300px;' disabled='disabled'> | ||
1112 | + <input type='hidden' name='user[cards]' value='".$order['cards']."'> | ||
1113 | + </div> | ||
1114 | + | ||
1115 | + <label>Êîìåíòàðèé:</label><br /> | ||
1116 | + <div class=info><textarea rows='4' style='width:400px;' name='user[comment]' cols='30' name='comment'>".$order['comment']."</textarea></div> | ||
1117 | + | ||
1118 | + <label>Îòïðàâêà ÑÌÑ:</label>"; | ||
1119 | + global $setup; | ||
1120 | + $res = $setup->db->getAll("select * from sms_tpl",array(),DB_FETCHMODE_ASSOC); | ||
1121 | + echo " | ||
1122 | + <div class=info> | ||
1123 | + <select name='sms_tpl' id='sms_tpl' style='width:300px'> | ||
1124 | + <option value='0'>ÂÛÁÐÀÒÜ ØÀÁËÎÍ</option>"; | ||
1125 | + foreach($res as $row){ | ||
1126 | + echo"<option value='".$row['id']."'>".$row['title']."</option>"; | ||
1127 | + } | ||
1128 | + echo "</select> | ||
1129 | + </div>"; | ||
1130 | + $sms_count = $setup->db->getOne("select count(*) from sms_history where order_id=?",array($order['id'])); | ||
1131 | + echo"<div class=info><div style='float:left;margin-right:10px;'><textarea rows='4' style='width:400px;' name='sms_msg' id='sms_msg' cols='30' ></textarea><br /><input type='radio' name='sms_type' id='sms_type' value='l' checked />ëàòèíèöà <input type='radio' name='sms_type' id='sms_type' value='k' />êèðèëèöà Êîëëè÷åñòâî ñèìâîëîâ <span id='sms_c'>0</span> (<span id='sms_c_sum'></span>)</div>"; | ||
1132 | + //echo"<div style='float:left'><a href='/admin.php/sms_history/?orderID=".$order['id']."' target='_blank'>Èñòîðèÿ</a>"; | ||
1133 | + //echo"<br /><input type='submit' style='margin-top:4px;' class='submit_green' id='sms_send' value='Îòïðàâèòü' name='sms_send'> | ||
1134 | + //<br />Îòïðàâëåíî ÑÌÑ (".$sms_count.")</div>"; | ||
1135 | + echo "</div>"; | ||
1136 | + | ||
1137 | + echo "</div> | ||
1138 | + <div style='float:right;'> | ||
1139 | + <label>Äîñòàâêà</label>"; | ||
1140 | + echo " | ||
1141 | + <div class=info> | ||
1142 | + <select name='user[delivery]' style='width:300px'>"; | ||
1143 | + viewBookSelectValue('zlo_book_delivery', 'id', 'title', $order['delivery']); | ||
1144 | + echo "</select> | ||
1145 | + </div>"; | ||
1146 | + | ||
1147 | + echo " | ||
1148 | + <label>Äåêëàðàöèÿ ¹:</label> | ||
1149 | + <div class=info><input type='text' name='user[declaration]' style='width:300px;' class=\"validate[required]\" value='".$order['declaration']."' id='declarationValidate'></div>"; | ||
1150 | + | ||
1151 | + echo " | ||
1152 | + <label>¹ ñêëàäà:</label> | ||
1153 | + <div class=info><input type='text' name='user[warehouse]' style='width:300px;' class=\"validate[required]\" value='".$order['warehouse']."' id='warehouseValidate'></div>"; | ||
1154 | + | ||
1155 | + echo " | ||
1156 | + <label>¹ íàêëàäíîé:</label> | ||
1157 | + <div class=info><input type='text' name='user[nakladnaya]' style='width:300px;' class=\"validate[required]\" value='".$order['nakladnaya']."' id='nakladnayaValidate'></div>"; | ||
1158 | + | ||
1159 | + $array_method = array("Îïëàòèòü íàëè÷íûìè","Îïëàòèòü íà êàðòó Ïðèâàò Áàíêà","Îïëàòèòü ïî áåçíàëè÷íîìó ðàñ÷åòó","Îïëàòèòü Ïðàâåêñ-òåëåãðàô","Íàëîæåííûì ïëàòåæîì"); | ||
1160 | + echo" | ||
1161 | + <div class=info> | ||
1162 | + <label>Ñïîñîá îïëàòû:</label> | ||
1163 | + <select name='user[payment]' style='width:300px'><option value=''></option>"; | ||
1164 | + foreach($array_method as $method){ | ||
1165 | + echo'<option value="'.$method.'" '; | ||
1166 | + if($order['payment']==$method)echo'selected'; | ||
1167 | + echo'>'.$method.'</option>'; | ||
1168 | + } | ||
1169 | + echo "</select> | ||
1170 | + </div>"; | ||
1171 | + | ||
1172 | + echo"<label>Ñòðàõîâêà:</label> | ||
1173 | + <div class=info><input type='text' name='user[insurance]' style='width:300px;' class=\"validate[required]\" value='".$order['insurance']."' id='insuranceValidate'></div>"; | ||
1174 | + $sumn_disabled = "";if($_SESSION['admin']['id']==22 || $_SESSION['admin']['id']==7 || $_SESSION['admin']['id']==1)$sumn_disabled = "";else $sumn_disabled = "disabled"; | ||
1175 | + echo"<label>Ñóììà íàëîæåííîãî:</label> | ||
1176 | + <div class=info><input type='text' name='user[sumn]' style='width:300px;' class=\"validate[required]\" value='".$order['sumn']."' id='sumnValidate' $sumn_disabled></div><br />"; | ||
1177 | + $array_method = array("Ïîëó÷àòåëÿ","Îòïðàâèòåëÿ"); | ||
1178 | + echo" | ||
1179 | + <div class=info> | ||
1180 | + <label>Îòïðàâêà çà ñ÷åò:</label> | ||
1181 | + <select name='user[sends]' style='width:300px'><option value=''></option>"; | ||
1182 | + foreach($array_method as $method){ | ||
1183 | + echo'<option value="'.$method.'" '; | ||
1184 | + if($order['sends']==$method)echo'selected'; | ||
1185 | + echo'>'.$method.'</option>'; | ||
1186 | + } | ||
1187 | + echo "</select> | ||
1188 | + </div>"; | ||
1189 | + echo"<label>Ãîðîä:</label> | ||
1190 | + <div class=info><input type='text' name='user[city]' style='width:300px;' class=\"validate[required]\" value='".$order['city']."' id='cityValidate'></div> | ||
1191 | + | ||
1192 | + <label>Àäðåñ:</label> | ||
1193 | + <div class=info><input type='text' name='user[address]' style='width:300px;' class=\"validate[required]\" value='".$order['address']."' id='addressValidate'></div> | ||
1194 | + | ||
1195 | + <label>Êîìåíòàðèé (ìåíåäæåðà):</label> | ||
1196 | + <div class=info><textarea rows='4' id='mcomment' style='width:400px;' name='user[mcomment]' cols='30' name='mcomment'>".$order['mcomment']."</textarea></div> | ||
1197 | + | ||
1198 | + "; | ||
1199 | + $disabled = ""; | ||
1200 | + if($order['meneger']>0){ | ||
1201 | + if($_SESSION['admin']['id']!=1 and $_SESSION['admin']['id']!=7 and $_SESSION['admin']['group']!=1){$disabled = "disabled";} | ||
1202 | + } | ||
1203 | + //print_r($_SESSION['admin']['group']); | ||
1204 | + echo"<label>Ìåíåäæåð:</label> | ||
1205 | + <div class=info><select name='meneger' $disabled> | ||
1206 | + <option value='0' ".(($_SESSION['admin']['group']!=1)?'disabled':'')."></option>"; | ||
1207 | + $selected = ($order['meneger']>0) ? $order['meneger'] : $_SESSION['admin']['id']; | ||
1208 | + | ||
1209 | + $result_1 = mysql_query("select * from zlo_admin"); | ||
1210 | + while ($row = mysql_fetch_assoc($result_1)) { | ||
1211 | + echo "<option value='".$row["id"]."' ".(($selected==$row["id"])?'selected':'')." ".(($_SESSION['admin']['group']!=1 && $selected!=$row["id"])?'disabled':'').">".$row["username"]."</option>"; | ||
1212 | + } | ||
1213 | + echo"</select>"; | ||
1214 | + if($disabled == "disabled"){echo"<input type='hidden' name='meneger' value='".$order['meneger']."'>";} | ||
1215 | + echo"</div>"; | ||
1216 | + | ||
1217 | + $disabled = ""; | ||
1218 | + if($_SESSION['admin']['id']!=7 and $_SESSION['admin']['id']!=17){$disabled = "disabled";} | ||
1219 | + echo"<label>×åê:</label> | ||
1220 | + <div class=info><input $disabled type='text' name='user[check]' style='width:300px;' class=\"validate[required]\" value='".$order['check2']."' id='checkValidate'></div>"; | ||
1221 | + if($disabled == "disabled"){echo"<input type='hidden' name='user[check]' value='".$order['check2']."'>";} | ||
1222 | + echo"<label>SMS:</label> | ||
1223 | + <div class=info><input type='text' name='user[smst]' style='width:300px;' class=\"validate[required]\" value='".$order['smst']."' id='smstValidate'></div>"; | ||
1224 | + | ||
1225 | + echo"</div> | ||
1226 | + </fieldset> | ||
1227 | + <div class=clear></div> | ||
1228 | + </div>"; | ||
1229 | + | ||
1230 | + // Òàáëèöà òîâàðîâ | ||
1231 | + | ||
1232 | + $sql3 = "SELECT * FROM catalogs_orders_products_git | ||
1233 | + WHERE `order_id`='".$order['order_id']."' "; | ||
1234 | + $result3 = mysql_query($sql3) or die(mysql_error()); | ||
1235 | + if (mysql_affected_rows()!=0) { $i=0; | ||
1236 | + echo" | ||
1237 | + <fieldset id='order-details'> | ||
1238 | + <legend>Òîâàðû</legend> | ||
1239 | + <div class='table'> | ||
1240 | + <div class='count'>¹</div> | ||
1241 | + <div class='code'>Êîä</div> | ||
1242 | + <div class='brand'>Áðåíä</div> | ||
1243 | + <div class='title'>Íàéìåíîâàíèå</div> | ||
1244 | + <div class='size'>Ðàçìåð</div> | ||
1245 | + <div class='color'>Öâåò</div> | ||
1246 | + <div class='quant'>Êîë.</div> | ||
1247 | + <div class='price'>Öåíà</div> | ||
1248 | + <div class='total'>Ñóììà</div> | ||
1249 | + <div class='reservation'>Áðîíü</div> | ||
1250 | + <div class='status'>Ñòàòóñ</div> | ||
1251 | + <div class='status'>Âîçâðàò</div> | ||
1252 | + <div class='onstock'>Íàëè÷èå</div> | ||
1253 | + <div class='control' style='float:right;'><a href='javascript:return false;' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a></div> | ||
1254 | + <div class='clear'></div> | ||
1255 | + </div> | ||
1256 | + <div id='lines'> | ||
1257 | + <!-- Ïðÿ÷åì ýòó ñòðî÷êó, òàê êàê ÿâàñêðèïò êîïèïóåò ïåðâóþ ñòðî÷êó êàê ïóñòóþ --> | ||
1258 | + <div id='line0'> | ||
1259 | + <div class='row'> | ||
1260 | + <div class='count' id='id(0)'>1</div> | ||
1261 | + <div class='code'> | ||
1262 | + <input type='text' name='item[code][]' value='' id='code(0)' autocomplete='off' onkeyup=flyFind(this.value,'(0)') onkeydown=selectFirst(event.keyCode)> | ||
1263 | + <!-- search ---> | ||
1264 | + <div class='livesearch-block'> | ||
1265 | + <div id='livesearch(0)'></div> | ||
1266 | + </div> | ||
1267 | + <!-- ---> | ||
1268 | + </div> | ||
1269 | + <div class='brand' id='brand(0)'> </div> | ||
1270 | + <div class='title' id='title(0)'> </div> | ||
1271 | + <div class='size' id='size(0)'> </div> | ||
1272 | + <div class='color' id='color(0)'> </div> | ||
1273 | + <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(0)' onBlur='SumPerRow();'></div> | ||
1274 | + <div class='price' id='price(0)'>0</div> | ||
1275 | + <div class='total' id='total(0)'>0</div> | ||
1276 | + <div class='reservation'><input type='text' size='3' name='item[reservation][]' /></div> | ||
1277 | + <div class='status'>"; | ||
1278 | + echo'<input type="text" class="input_status" name="item[status][]" data-id="1" id="input_status_1" size="5" value="" /> | ||
1279 | + <div class="status_box" id="status_box_1" data-id="1"> | ||
1280 | + <ul> | ||
1281 | + <li data-id="1" class="name_city">Ì?</li> | ||
1282 | + <li data-id="1" class="name_city">Ìñòîê?</li> | ||
1283 | + <li data-id="1" class="name_city">Ãî?</li> | ||
1284 | + <li data-id="1" class="name_city">Ãð?</li> | ||
1285 | + <li data-id="1" class="name_city">Õ?</li> | ||
1286 | + <li data-id="1" class="name_city">Î?</li> | ||
1287 | + <li data-id="1" class="name_city">Ä?</li> | ||
1288 | + <li data-id="1" class="name_city">Á?</li> | ||
1289 | + <li data-id="1" class="name_city">Á2?</li> | ||
1290 | + <li data-id="1" class="name_city">áðàê</li> | ||
1291 | + <li data-id="1" class="name_city">áðîíü</li> | ||
1292 | + <li data-id="1" class="name_city">âåðíåò</li> | ||
1293 | + <li data-id="1" class="other"><i>Ââåäèòå</i></li> | ||
1294 | + </ul> | ||
1295 | + </div>'; | ||
1296 | + echo"</div>"; | ||
1297 | + echo"<div class='status'><select name='item[vozvrat][]'> | ||
1298 | + <option value=''></option> | ||
1299 | + <option value='äà' >äà</option> | ||
1300 | + <option value='íåò' >íåò</option> | ||
1301 | + </select></div>"; | ||
1302 | + echo" | ||
1303 | + <div class='onstock' id='onstock(0)'></div> | ||
1304 | + | ||
1305 | + <input type='hidden' name='item[mod_id][]' id='mod_idValue(0)' value=''> | ||
1306 | + <input type='hidden' name='item[product_id][]' id='product_idValue(0)' value=''> | ||
1307 | + <input type='hidden' name='item[brand_id][]' id='brand_idValue(0)' value=''> | ||
1308 | + <input type='hidden' name='item[price][]' id='priceValue(0)' value='0'> | ||
1309 | + <input type='hidden' name='item[total][]' id='totalValue(0)' value='0'> | ||
1310 | + | ||
1311 | + <div class='control' style='float:right;'> | ||
1312 | + <a href='javascript:return false;' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | ||
1313 | + <a href='javascript:return false;' onclick='DDivLine(0);'><img src='/account/pic/del.png' width='18px'></a> | ||
1314 | + </div> | ||
1315 | + | ||
1316 | + <div class='clear'></div> | ||
1317 | + </div><div style='clear:both;'></div> | ||
1318 | + </div> | ||
1319 | + | ||
1320 | + <!---------------------------------------------------------------------------------->"; | ||
1321 | + | ||
1322 | + while ($item_id=mysql_fetch_assoc($result3)) { $i++; | ||
1323 | + | ||
1324 | + // Èíôî î òîâàðå | ||
1325 | + $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m | ||
1326 | + LEFT JOIN catalogs_products as p | ||
1327 | + ON p.id=m.product_id | ||
1328 | + WHERE m.code='".$item_id['code']."' "; | ||
1329 | + //WHERE m.id='".$item_id['product_id']."' "; | ||
1330 | + $result4 = mysql_query($sql4) or die(mysql_error()); | ||
1331 | + if (mysql_affected_rows()==11110) { | ||
1332 | + $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m | ||
1333 | + LEFT JOIN catalogs_products as p | ||
1334 | + ON p.id=m.product_id | ||
1335 | + WHERE m.code='".$item_id['code']."' "; | ||
1336 | + $result4 = mysql_query($sql4) or die(mysql_error()); | ||
1337 | + } | ||
1338 | + //if (mysql_affected_rows()!=0) { | ||
1339 | + $item=mysql_fetch_assoc($result4); | ||
1340 | + | ||
1341 | + | ||
1342 | + if(!empty($item['code'])){ | ||
1343 | + // íàëè÷èå òîâàðà | ||
1344 | + $sql5 = "SELECT c.name as city, o.count | ||
1345 | + FROM catalogs_keys_products_cities as o | ||
1346 | + LEFT JOIN catalogs_cities as c | ||
1347 | + ON o.city_id=c.id | ||
1348 | + WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | ||
1349 | + //print $sql5; | ||
1350 | + $result5 = mysql_query($sql5) or die(mysql_error()); | ||
1351 | + if (mysql_affected_rows()!=0) { | ||
1352 | + $onStockDesc=''; | ||
1353 | + while ($onStock=mysql_fetch_assoc($result5)) { | ||
1354 | + $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | ||
1355 | + } | ||
1356 | + } else { $onStock='íåò';} | ||
1357 | + } | ||
1358 | + echo"<div id='line$i' ".(($item_id['count']==0)?"style='background:#ffc5c5;'":"")."> | ||
1359 | + <div class='row'> | ||
1360 | + <div class='count' id='id($i)'>$i (".$item['mod_id'].")</div> | ||
1361 | + <div class='code'>"; | ||
1362 | + if($item_id['count']==0){ | ||
1363 | + echo"<input type='text' value='".$item['code']."' disabled />"; | ||
1364 | + echo"<input type='hidden' name='item[code][]' value='".$item['code']."' />"; | ||
1365 | + } | ||
1366 | + else{ | ||
1367 | + echo" | ||
1368 | + <input type='text' name='item[code][]' disabled value='".$item['code']."' id='code($i)' autocomplete='off' onkeyup=flyFind(this.value,'($i)') onkeydown=selectFirst(event.keyCode)> | ||
1369 | + <!-- search ---> | ||
1370 | + <div class='livesearch-block'> | ||
1371 | + <div id='livesearch($i)'></div> | ||
1372 | + </div> | ||
1373 | + <!-- --->"; | ||
1374 | + echo"<input type='hidden' name='item[code][]' value='".$item['code']."' />"; | ||
1375 | + } | ||
1376 | + echo" | ||
1377 | + </div> | ||
1378 | + <div class='brand' id='brand($i)'>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." </div> | ||
1379 | + <div class='title' id='title($i)'><a rel='msg' title='".$item['text']."' href='http://extremstyle.ua/uploaded/pic/catalogs/products/".$item['pic']."'>".$item['name']."</a> </div> | ||
1380 | + <div class='size' id='size($i)'>".$item['size']." </div> | ||
1381 | + <div class='color' id='color($i)'>".$item['color']." </div> | ||
1382 | + <div class='quant'><input type='text' name='item[quant][]' value='".$item_id['count']."' id='quantValue($i)' onBlur='SumPerRow();'></div> | ||
1383 | + <div class='price' id='price($i)'>"."(".$item_id['product_cine_id'].") ".$item['cine']."</div> | ||
1384 | + <div class='total' id='total($i)'>".($item['cine']*$item_id['count'])."</div> | ||
1385 | + <div class='reservation'>"; | ||
1386 | + if($item_id['count']==0){ | ||
1387 | + echo"<input type='text' size='3' value='".$item_id['reservation']."' disabled />"; | ||
1388 | + echo"<input type='hidden' name='item[reservation][]' value='".$item_id['reservation']."' />"; | ||
1389 | + }else{ | ||
1390 | + //echo"<input type='text' size='3' name='item[reservation][]' value='".$item_id['reservation']."' />"; | ||
1391 | + echo"<select name='item[reservation][]'> | ||
1392 | + <option value=''></option> | ||
1393 | + <option value='Ì' ".($item_id['reservation']=='Ì'?'selected':'').">Ì</option> | ||
1394 | + <option value='Ìñòîê' ".($item_id['reservation']=='Ìñòîê'?'selected':'').">Ìñòîê</option> | ||
1395 | + <option value='Ãî' ".($item_id['reservation']=='Ãî'?'selected':'').">Ãî</option> | ||
1396 | + <option value='Ãð' ".($item_id['reservation']=='Ãð'?'selected':'').">Ãð</option> | ||
1397 | + <option value='Õ' ".($item_id['reservation']=='Õ'?'selected':'').">Õ</option> | ||
1398 | + <option value='Î' ".($item_id['reservation']=='Î'?'selected':'').">Î</option> | ||
1399 | + <option value='Ä' ".($item_id['reservation']=='Ä'?'selected':'').">Ä</option> | ||
1400 | + <option value='Á' ".($item_id['reservation']=='Á'?'selected':'').">Á</option> | ||
1401 | + <option value='Á2' ".($item_id['reservation']=='Á2'?'selected':'').">Á2</option> | ||
1402 | + </select>"; | ||
1403 | + } | ||
1404 | + echo"</div> | ||
1405 | + <div class='status'>"; | ||
1406 | + echo'<input type="text" class="input_status" name="item[status][]" data-id="'.$item_id['id'].'" id="input_status_'.$item_id['id'].'" size="5" value="'.$item_id['status'].'" /> | ||
1407 | + <div class="status_box" id="status_box_'.$item_id['id'].'" data-id="'.$item_id['id'].'"> | ||
1408 | + <ul> | ||
1409 | + <li data-id="'.$item_id['id'].'" class="name_city">Ì?</li> | ||
1410 | + <li data-id="'.$item_id['id'].'" class="name_city">Ìñòîê?</li> | ||
1411 | + <li data-id="'.$item_id['id'].'" class="name_city">Ãî?</li> | ||
1412 | + <li data-id="'.$item_id['id'].'" class="name_city">Ãð?</li> | ||
1413 | + <li data-id="'.$item_id['id'].'" class="name_city">Õ?</li> | ||
1414 | + <li data-id="'.$item_id['id'].'" class="name_city">Î?</li> | ||
1415 | + <li data-id="'.$item_id['id'].'" class="name_city">Ä?</li> | ||
1416 | + <li data-id="'.$item_id['id'].'" class="name_city">Á?</li> | ||
1417 | + <li data-id="'.$item_id['id'].'" class="name_city">Á2?</li> | ||
1418 | + <li data-id="'.$item_id['id'].'" class="name_city">áðàê</li> | ||
1419 | + <li data-id="'.$item_id['id'].'" class="name_city">áðîíü</li> | ||
1420 | + <li data-id="'.$item_id['id'].'" class="name_city">âåðíåò</li> | ||
1421 | + <li data-id="'.$item_id['id'].'" class="name_city">Ó íàñ</li> | ||
1422 | + <li data-id="'.$item_id['id'].'" class="other"><i>Ââåäèòå</i></li> | ||
1423 | + </ul> | ||
1424 | + </div>'; | ||
1425 | + echo"</div>"; | ||
1426 | + echo"<div class='status'><select name='item[vozvrat][]'> | ||
1427 | + <option value=''></option> | ||
1428 | + <option value='äà' ".($item_id['vozvrat']=='äà'?'selected':'').">äà</option> | ||
1429 | + <option value='íåò' ".($item_id['vozvrat']=='íåò'?'selected':'').">íåò</option> | ||
1430 | + </select></div>"; | ||
1431 | + echo" | ||
1432 | + <div class='onstock' id='onstock($i)'>$onStockDesc</div> | ||
1433 | + | ||
1434 | + | ||
1435 | + <input type='hidden' name='item[mod_id][]' id='mod_idValue($i)' value='".$item['mod_id']."'> | ||
1436 | + <input type='hidden' name='item[product_id][]' id='product_idValue($i)' value='".$item['product_id']."'> | ||
1437 | + <input type='hidden' name='item[brand_id][]' id='brand_idValue($i)' value='".$item['brend_id']."'> | ||
1438 | + <input type='hidden' name='item[price][]' id='priceValue($i)' value='".$item_id['product_cine_id']."'> | ||
1439 | + <input type='hidden' name='item[total][]' id='totalValue($i)' value='".($item_id['product_cine_id']*$item_id['count'])."'> | ||
1440 | + | ||
1441 | + <div class='control' style='float:right;'> | ||
1442 | + <a href='javascript:return false;' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | ||
1443 | + <!--a href='javascript:return false;' onclick='RemoveDivLine($i);'><img src='/account/pic/del.png' width='18px'></a--> | ||
1444 | + <a href='javascript:return false;' onclick='DDivLine($i);'><img src='/account/pic/del.png' width='18px'></a> | ||
1445 | + </div> | ||
1446 | + | ||
1447 | + <div class='clear'></div> | ||
1448 | + </div><div style='clear:both;'></div> | ||
1449 | + </div>"; | ||
1450 | + | ||
1451 | + | ||
1452 | + } | ||
1453 | + | ||
1454 | + echo"</div> | ||
1455 | + | ||
1456 | + <div class='report'> | ||
1457 | + Ñòîèìîñòü äîñòàâêè <input type='text' size='10' name='cost_delivery' id='cost_delivery' value='".$order['cost_delivery']."' onBlur='SumPerRow()' /> | ||
1458 | + Âñåãî: <span id='quantity'>0</span> òîâàðîâ íà <span id='summary'>0</span> ãðí. | ||
1459 | + </div> | ||
1460 | + | ||
1461 | + <input type='hidden' name='summary' value='' id='summaryValue'> | ||
1462 | + <input type='hidden' name='user_id' value='".$order['user_id']."'> | ||
1463 | + <input type='hidden' name='order_id' value='".$order['order_id']."'> | ||
1464 | + <input type='hidden' name='send' value='edit-order'> | ||
1465 | + | ||
1466 | + | ||
1467 | + "; | ||
1468 | + | ||
1469 | + echo"<div class='clear'></div>"; | ||
1470 | + | ||
1471 | + // Äëÿ XML ôàéëà | ||
1472 | + $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); | ||
1473 | + | ||
1474 | + // Ñìåíà ñòàòóñà | ||
1475 | + if ($order['status']!=6) { | ||
1476 | + echo "<div class='pager-pages'>"; | ||
1477 | + /*"<div id='show'>Ïåðåâåñòè</div> | ||
1478 | + <form method='POST' action='".$_SERVER["REQUEST_URI"]."' id='PerPageForm' name='SetStatus'> | ||
1479 | + <select size='1' name='status' id='PerPage' >"; | ||
1480 | + $sql4 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | ||
1481 | + $result4 = mysql_query($sql4) or die(mysql_error()); | ||
1482 | + if (mysql_affected_rows()!=0) { | ||
1483 | + | ||
1484 | + while ($row4=mysql_fetch_assoc($result4)) { | ||
1485 | + if($row4['id'] == $order['status']) $chek ="SELECTED"; | ||
1486 | + else $chek = ""; | ||
1487 | + echo"<option value='".$row4['id']."' ".$chek.">".$row4['title']."</option>\n"; | ||
1488 | + } | ||
1489 | + echo"</select>"; | ||
1490 | + echo"<input type='hidden' name='action' value='status'> | ||
1491 | + <input type='hidden' name='order_id' value='".$order['order_id']."'>"; | ||
1492 | + } | ||
1493 | + | ||
1494 | + | ||
1495 | + echo"</form>";*/ | ||
1496 | + /* if($order['work_user']>0 && $order['work_user']!=$_SESSION['admin']['id']){$r=mysql_query('select login from zlo_admin where id='.$order['work_user']);print'<tr><td colspan="12">Ñ ýòèì çàêàçîì óæå ðàáîòàåò ïîëüçîâàòåëü '.mysql_result($r,0).'</td></tr>';} | ||
1497 | + else | ||
1498 | + echo" | ||
1499 | + <!--<div id='records'><input type='submit' value='Ïåðåâåñòè' class='button-save' onclick=\"if(document.getElementById('mcomment').value=='' && document.getElementById('PerPage').value=='5'){ alert('Äëÿ ñìåíû ñòàòóñà çàêàçà íà \'Îòìåíåí\', îáÿçàòåëüíî, çàïîëíåíèå ïîëÿ \'Êîìåíòàðèé (ìåíåäæåðà)\''); return false;} else document.forms['SetStatus'].submit();\" ></div>--> | ||
1500 | + <div id='records'><input type='submit' class='button-save' title='Ñîõðàíèòü' value='Ñîõðàíèòü' onclick=\"document.forms['edit_order'].submit();\"></div> | ||
1501 | + <div id='records'><a href='/account/admin/orders.php?action=print&order_id=".$order['order_id']."' target='_new' class='button-save'>Ïå÷àòü</a></div> | ||
1502 | + <div id='records'><a href='/admin.php/orders/?page=".$_GET['page']."&exit_order_id=".$order['order_id']."' class='button-save'>Âûéòè èç çàêàçà</a></div>"; | ||
1503 | + */ | ||
1504 | + /* if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { | ||
1505 | + echo"<div id='records'><a href='/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml'><img src='/account/pic/xml.png' width='38px' title='xml çàêàç ïîëüçîâàòåëÿ'></a></div>"; | ||
1506 | + }*/ | ||
1507 | + | ||
1508 | + | ||
1509 | + echo"</div>"; | ||
1510 | + } | ||
1511 | + echo"</fieldset></div>"; | ||
1512 | + | ||
1513 | + echo"</div>"; | ||
1514 | + | ||
1515 | + } | ||
1516 | + | ||
1517 | + } else { echo"<p>Ïóñòî</p>";} | ||
1518 | + | ||
1519 | + // ===================== | ||
1520 | + // ===== javascript ==== | ||
1521 | + // ===================== | ||
1522 | + | ||
1523 | + echo" | ||
1524 | + <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | ||
1525 | + <script type='text/javascript' src='/js/msg.js'></script> | ||
1526 | + <script src='/js/JsHttpRequest.js'></script> | ||
1527 | + <script src='/js/OrderContol.js' type='text/javascript'></script>"; | ||
1528 | +echo '<script language="JavaScript"> | ||
1529 | +jQuery(document).ready(function() { | ||
1530 | + | ||
1531 | + | ||
1532 | + jQuery(".input_status").click(function() { | ||
1533 | + $( "#status_box_"+$(this).attr("data-id") ).show(); | ||
1534 | + }) | ||
1535 | + | ||
1536 | + $( ".status_box ul li.name_city" ).click(function(){ | ||
1537 | + $("#input_status_"+$(this).attr("data-id")).val($(this).text()); | ||
1538 | + $( ".status_box" ).hide(); | ||
1539 | + }); | ||
1540 | + $( ".status_box ul li.other" ).click(function(){ | ||
1541 | + $("#input_status_"+$(this).attr("data-id")).val(""); | ||
1542 | + $( ".status_box" ).hide(); | ||
1543 | + $("#input_status_"+$(this).attr("data-id")).focus(); | ||
1544 | + }); | ||
1545 | + | ||
1546 | + | ||
1547 | +}); | ||
1548 | + | ||
1549 | +</script>'; | ||
1550 | + echo'<script> | ||
1551 | +jQuery(document).ready(function(){ | ||
1552 | +$( "#sms_tpl" ).change(function() { | ||
1553 | +$.get("/ajax/sms_tpl.php", { tplID: this.value },function(data) { | ||
1554 | + $("#sms_msg").val(data); | ||
1555 | + $("#sms_c").html($("#sms_msg").val().length); | ||
1556 | +}); | ||
1557 | +}); | ||
1558 | + | ||
1559 | +$( "#sms_send" ).click(function() { | ||
1560 | + if($("#sms_tel1").attr("checked") || $("#sms_tel2").attr("checked")) { | ||
1561 | + return true; | ||
1562 | + }else{ | ||
1563 | + alert("Íå óêàçàí íîìåð òåëåôîíà!"); | ||
1564 | + return false; | ||
1565 | + } | ||
1566 | +}); | ||
1567 | + | ||
1568 | +w=120; | ||
1569 | +$( "input[name=\'sms_type\']" ).click(function() { | ||
1570 | + i = $("#sms_msg").val().length; | ||
1571 | + if(this.value=="l"){w=120;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} | ||
1572 | + else{w=70;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} | ||
1573 | + $("#sms_c_sum").html(w); | ||
1574 | + }); | ||
1575 | +$("#sms_c_sum").html(w); | ||
1576 | + | ||
1577 | + | ||
1578 | +$("#sms_msg").keyup(function(){ | ||
1579 | + i = this.value.length; | ||
1580 | + if(i>w){$("#sms_c").css( "color","red" );} | ||
1581 | + else{$("#sms_c").css( "color","black" );} | ||
1582 | + $("#sms_c").html(i); | ||
1583 | + }); | ||
1584 | + | ||
1585 | + | ||
1586 | +}); | ||
1587 | + </script>'; | ||
1588 | + | ||
1589 | + echo" | ||
1590 | + <!-------[ Form falidator ]-------> | ||
1591 | + <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> | ||
1592 | + <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | ||
1593 | + | ||
1594 | + <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> | ||
1595 | + <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script> | ||
1596 | + | ||
1597 | + <script> | ||
1598 | + jQuery(document).ready(function(){ | ||
1599 | + // binds form submission and fields to the validation engine | ||
1600 | + jQuery('#add-item').validationEngine(); | ||
1601 | + }); | ||
1602 | + </script> | ||
1603 | + <!-------->"; | ||
1604 | + | ||
1605 | + print'</td></tr>'; | ||
1606 | + } | ||
1607 | + | ||
1608 | + | ||
1609 | + $i1++; | ||
1610 | + } print"</table>"; | ||
1611 | + print"<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | ||
1612 | + <script type='text/javascript' src='/js/msg2.js'></script>"; | ||
1613 | + | ||
1614 | + echo"</div>"; | ||
1615 | + | ||
1616 | + | ||
1617 | + | ||
1618 | + // === Pager | ||
1619 | + | ||
1620 | + echo"<div class='grid-pager'> | ||
1621 | + ".pagerGetShow($pager)." | ||
1622 | + </div>"; | ||
1623 | + | ||
1624 | + } | ||
1625 | + | ||
1626 | + } | ||
1627 | + | ||
1628 | + // =============== | ||
1629 | + // ===== show ==== | ||
1630 | + // =============== | ||
1631 | + | ||
1632 | + if (isset($_GET['action']) && $_GET['action']=='show') { | ||
1633 | + | ||
1634 | + // Òàáñ | ||
1635 | + | ||
1636 | + echo"<div class='order-tabs'>"; | ||
1637 | + $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | ||
1638 | + $result = mysql_query($sql) or die(mysql_error()); | ||
1639 | + if (mysql_affected_rows()!=0) { | ||
1640 | + while ($row=mysql_fetch_assoc($result)) { | ||
1641 | + | ||
1642 | + // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | ||
1643 | + $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; | ||
1644 | + $result2 = mysql_query($sql2) or die(mysql_error()); | ||
1645 | + $row2=mysql_fetch_assoc($result2); | ||
1646 | + | ||
1647 | + echo"<div class='status-tabs' onclick=\"location.href='".urlQueryChange2('status',$row['id'])."&page=1'\">".$row['title']."(".$row2['calc'].")</div>"; | ||
1648 | + } | ||
1649 | + } | ||
1650 | + echo"</div> | ||
1651 | + <div class='clear'></div> | ||
1652 | + "; | ||
1653 | + | ||
1654 | + if(!isset($_GET['status'])) {$_GET['status']=1;} | ||
1655 | + | ||
1656 | + // =========== Ãåíåðèì òàáëèöó =========== | ||
1657 | + | ||
1658 | + $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id | ||
1659 | + FROM catalogs_orders as o | ||
1660 | + LEFT JOIN zlo_users as u on u.id=o.user_id | ||
1661 | + WHERE u.id=".$_GET['user']." AND o.status=".$_GET['status']." ORDER BY mktime DESC "; | ||
1662 | + $pager['sql']= $sql; | ||
1663 | + $pager=pagerGetRun($pager,10,15); //echo$pager['sql']; | ||
1664 | + $result = mysql_query($pager['sql']) or die(mysql_error()); | ||
1665 | + if (mysql_affected_rows()!=0) { | ||
1666 | + | ||
1667 | + // =================== | ||
1668 | + // === ÏÐÎÄÎËÆÅÍÈÅ === | ||
1669 | + // =================== | ||
1670 | + | ||
1671 | + while ($order=mysql_fetch_assoc($result)) { | ||
1672 | + | ||
1673 | + echo"<div class='orders'>"; | ||
1674 | + | ||
1675 | + echo"<div class='order-info-all'> | ||
1676 | + | ||
1677 | + <div class=order-info> | ||
1678 | + <h4>Çàêàç #".$order['order_id']."<br> | ||
1679 | + Äàòà: ".date('Y-m-d H:i:s',$order['mktime'])." | ||
1680 | + </h4> | ||
1681 | + <fieldset id='order-info' style='background: ".$order['color'].";'> | ||
1682 | + <legend>Êëèåíò</legend> | ||
1683 | + | ||
1684 | + <label>Êëèåíò:</label> | ||
1685 | + <div class=info><a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>".$order['username']."</a> </div> | ||
1686 | + | ||
1687 | + <label>Òåë:</label> | ||
1688 | + <div class=info>".$order['tel']." </div> | ||
1689 | + | ||
1690 | + <label>Òåë 2:</label> | ||
1691 | + <div class=info>".$order['tel2']." </div> | ||
1692 | + | ||
1693 | + <label>Ãðóïïà:</label> | ||
1694 | + <div class=info>".viewBook('zlo_users_group', $order['group'], 'id', 'name')." </div> | ||
1695 | + | ||
1696 | + <div class=clear></div> | ||
1697 | + <a class='history' href='/admin.php/orders/?action=show&user=".$order['user_id']."'>[Èñòîðèÿ çàêàçîâ]</a> | ||
1698 | + | ||
1699 | + </fieldset> | ||
1700 | + | ||
1701 | + <fieldset id='order-info' style='background: ".$order['color'].";'> | ||
1702 | + <legend>Äîñòàâêà</legend> | ||
1703 | + | ||
1704 | + <label>Äîñòàâêà:</label> | ||
1705 | + <div class=info>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." </div> | ||
1706 | + | ||
1707 | + <label>Ãîðîä:</label> | ||
1708 | + <div class=info>".$order['city']." </div> | ||
1709 | + | ||
1710 | + <label>Àäðåñ:</label> | ||
1711 | + <div class=info>".$order['address']." </div> | ||
1712 | + | ||
1713 | + <label>Èíôî:</label> | ||
1714 | + <div class=info> ".$order['comment']." </div> | ||
1715 | + | ||
1716 | + <div class=clear></div> | ||
1717 | + | ||
1718 | + </fieldset> | ||
1719 | + <div class=clear></div> | ||
1720 | + </div> | ||
1721 | + </div>"; | ||
1722 | + | ||
1723 | + | ||
1724 | + // Òàáëèöà òîâàðîâ | ||
1725 | + | ||
1726 | + echo" | ||
1727 | + <div class='order-details'> | ||
1728 | + <fieldset id='order-details'> | ||
1729 | + <legend>Òîâàðû</legend>"; | ||
1730 | + echo"<table> | ||
1731 | + <tr> | ||
1732 | + <td>¹</td> | ||
1733 | + <td>Êîä</td> | ||
1734 | + <td>Áðåíä</td> | ||
1735 | + <td>Íàçâàíèå</td> | ||
1736 | + <td>Ðàçìåð</td> | ||
1737 | + <td>Öâåò</td> | ||
1738 | + <td>Êîë.</td> | ||
1739 | + <td>Öåíà</td> | ||
1740 | + <td>Ñóììà</td> | ||
1741 | + <td>Íàëè÷èå</td> | ||
1742 | + <td></td> | ||
1743 | + </tr>"; | ||
1744 | + | ||
1745 | + $sql3 = " | ||
1746 | + SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* | ||
1747 | + FROM catalogs_orders AS o | ||
1748 | + LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | ||
1749 | + LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | ||
1750 | + LEFT JOIN catalogs_products AS p ON p.id = m.product_id | ||
1751 | + WHERE o.id='".$order['order_id']."'"; | ||
1752 | + $result3 = mysql_query($sql3) or die(mysql_error()); | ||
1753 | + if (mysql_affected_rows()!=0) { | ||
1754 | + while ($item=mysql_fetch_assoc($result3)) { { $i++; | ||
1755 | + | ||
1756 | + | ||
1757 | + // íàëè÷èå òîâàðà | ||
1758 | + $sql5 = "SELECT c.name as city, o.count | ||
1759 | + FROM catalogs_keys_products_cities as o | ||
1760 | + LEFT JOIN catalogs_cities as c | ||
1761 | + ON o.city_id=c.id | ||
1762 | + WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | ||
1763 | + $result5 = mysql_query($sql5) or die(mysql_error()); | ||
1764 | + if (mysql_affected_rows()!=0) { | ||
1765 | + $onStockDesc=''; | ||
1766 | + while ($onStock=mysql_fetch_assoc($result5)) { | ||
1767 | + $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | ||
1768 | + } | ||
1769 | + } else { $onStockDesc='íåò'; } | ||
1770 | + | ||
1771 | + echo"<tr> | ||
1772 | + <td>$i .</td> | ||
1773 | + <td>".$item['code']."</td> | ||
1774 | + <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | ||
1775 | + <td><a href='/".$item['rubric_id']."-catalogs/".$item['translit']."-".$item['id']."/' target='_new'>".$item['name']."</a></td> | ||
1776 | + <td>".$item['size']."</td> | ||
1777 | + <td>".$item['color']."</td> | ||
1778 | + <td>".$item['count']."</td> | ||
1779 | + <td>".$item['cine']."</td> | ||
1780 | + <td>".($item['cine']*$item['count'])."</td> | ||
1781 | + <td>".$onStockDesc."</td> | ||
1782 | + <td></td> | ||
1783 | + </tr>"; | ||
1784 | + | ||
1785 | + } | ||
1786 | + | ||
1787 | + } | ||
1788 | + } | ||
1789 | + | ||
1790 | + echo"</table> | ||
1791 | + <b>Îáùàÿ ñóììà: ".$order['total']." ãðí.</b> | ||
1792 | + </div>"; | ||
1793 | + | ||
1794 | + | ||
1795 | + | ||
1796 | + echo"<div class='clear'></div></div>"; | ||
1797 | + | ||
1798 | + } | ||
1799 | + | ||
1800 | + // === Pager | ||
1801 | + | ||
1802 | + echo"<div class='grid-pager'> | ||
1803 | + ".pagerGetShow($pager)." | ||
1804 | + </div>"; | ||
1805 | + } | ||
1806 | + } | ||
1807 | + | ||
1808 | + // =============== | ||
1809 | + // ===== edit ==== | ||
1810 | + // =============== | ||
1811 | + | ||
1812 | + if (isset($_GET['action']) && $_GET['action']=='edit') { | ||
1813 | + | ||
1814 | + // Òàáñ | ||
1815 | + | ||
1816 | + if (!isset($_GET['status'])) {$status=1;} else {$status=$_GET['status'];} | ||
1817 | + | ||
1818 | + echo"<div class='order-tabs'>"; | ||
1819 | + $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | ||
1820 | + $result = mysql_query($sql) or die(mysql_error()); | ||
1821 | + if (mysql_affected_rows()!=0) { | ||
1822 | + while ($row=mysql_fetch_assoc($result)) { | ||
1823 | + | ||
1824 | + // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | ||
1825 | + $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; | ||
1826 | + $result2 = mysql_query($sql2) or die(mysql_error()); | ||
1827 | + $row2=mysql_fetch_assoc($result2); | ||
1828 | + | ||
1829 | + echo"<div class='status-tabs' onclick=\"location.href='".urlQueryChange2('status',$row['id'])."&page=1'\">".$row['title']."(".$row2['calc'].")</div>"; | ||
1830 | + } | ||
1831 | + } | ||
1832 | + echo"</div> | ||
1833 | + <div class='clear'></div> | ||
1834 | + "; | ||
1835 | + | ||
1836 | + | ||
1837 | + // =========== Ãåíåðèì òàáëèöó =========== | ||
1838 | + | ||
1839 | + $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id, o.adress as address, g.color | ||
1840 | + FROM catalogs_orders as o | ||
1841 | + LEFT JOIN zlo_users as u ON u.id=o.user_id | ||
1842 | + LEFT JOIN zlo_users_group as g ON g.id=u.group | ||
1843 | + WHERE o.id='".$_GET['order']."'"; | ||
1844 | + $result = mysql_query($sql) or die(mysql_error()); | ||
1845 | + if (mysql_affected_rows()!=0) { | ||
1846 | + | ||
1847 | + $order=mysql_fetch_assoc($result); | ||
1848 | + | ||
1849 | + echo"<form action='' method='POST' name='edit_order' id='add-item'>"; | ||
1850 | + echo"<div class='orders'>"; | ||
1851 | + | ||
1852 | + echo" | ||
1853 | + <div class=order-info> | ||
1854 | + <fieldset id='order-info' style='background: ".$order['color'].";'> | ||
1855 | + <legend>Çàêàç #".$order['order_id']." Cóììà: ".$order['total']." ãðí.</legend> | ||
1856 | + | ||
1857 | + <label>Äàòà:</label> | ||
1858 | + <div class=info>".date('Y-m-d H:i:s',$order['mktime'])."</div> | ||
1859 | + | ||
1860 | + <label>Îïëà÷åí:</label> | ||
1861 | + <div class=info> | ||
1862 | + <input type='radio' name='paid' value='1' ".(($order['paid']==1)?'checked':'')."> äà<Br> | ||
1863 | + <input type='radio' name='paid' value='0' ".(($order['paid']==0)?'checked':'')."> íåò | ||
1864 | + </div> | ||
1865 | + | ||
1866 | + <label>Ìåòêà:</label> | ||
1867 | + <div class=info> | ||
1868 | + <select name='label'> | ||
1869 | + "; | ||
1870 | + for($i=0;$i<=10;$i++){print'<option value="'.$i.'" '.(($order['label']==$i)?'selected':'').'>'.$i.'</option>';}; | ||
1871 | + echo"</select> | ||
1872 | + </div> | ||
1873 | + | ||
1874 | + <label>Êëèåíò:</label> | ||
1875 | + <div class=info> | ||
1876 | + <input type='text' name='user[username]' value='".$order['username']."' disabled='disabled'> | ||
1877 | + <input type='hidden' name='user[username]' value='".$order['username']."'> | ||
1878 | + </div> | ||
1879 | + | ||
1880 | + <label>Email:</label> | ||
1881 | + <div class=info> | ||
1882 | + <input type='text' name='user[email]' value='".$order['email']."' disabled='disabled'> | ||
1883 | + <input type='hidden' name='user[email]' value='".$order['email']."'> | ||
1884 | + </div> | ||
1885 | + | ||
1886 | + <label>Òåëåôîí:</label> | ||
1887 | + <div class=info> | ||
1888 | + <input type='text' name='user[tel]' value='".$order['tel']."' disabled='disabled'> | ||
1889 | + <input type='hidden' name='user[tel]' value='".$order['tel']."'> | ||
1890 | + </div> | ||
1891 | + | ||
1892 | + <label>Òåëåôîí 2:</label> | ||
1893 | + <div class=info> | ||
1894 | + <input type='text' name='user[tel2]' value='".$order['tel2']."' disabled='disabled'> | ||
1895 | + <input type='hidden' name='user[tel2]' value='".$order['tel2']."'> | ||
1896 | + </div> | ||
1897 | + | ||
1898 | + <label>Äîñòàâêà</label>"; | ||
1899 | + echo " | ||
1900 | + <div class=info> | ||
1901 | + <select name='user[delivery]'>"; | ||
1902 | + viewBookSelectValue('zlo_book_delivery', 'id', 'title', $order['delivery']); | ||
1903 | + echo "</select> | ||
1904 | + </div>"; | ||
1905 | + | ||
1906 | + echo " | ||
1907 | + <label>Ãîðîä:</label> | ||
1908 | + <div class=info><input type='text' name='user[city]' class=\"validate[required]\" value='".$order['city']."' id='cityValidate'> </div> | ||
1909 | + | ||
1910 | + <label>Àäðåñ:</label> | ||
1911 | + <div class=info><input type='text' name='user[address]' class=\"validate[required]\" value='".$order['address']."' id='addressValidate'> </div> | ||
1912 | + | ||
1913 | + <label>Êîìåíòàðèé:</label> | ||
1914 | + <div class=info><textarea rows='4' style='width:400px;' name='user[comment]' cols='30' name='comment'>".$order['comment']."</textarea></div> | ||
1915 | + | ||
1916 | + <label>Êîìåíòàðèé (ìåíåäæåðà):</label> | ||
1917 | + <div class=info><textarea rows='4' id='mcomment' style='width:400px;' name='user[mcomment]' cols='30' name='mcomment'>".$order['mcomment']."</textarea></div> | ||
1918 | + | ||
1919 | + "; | ||
1920 | + | ||
1921 | + echo" | ||
1922 | + </fieldset> | ||
1923 | + <div class=clear></div> | ||
1924 | + </div>"; | ||
1925 | + | ||
1926 | + // Òàáëèöà òîâàðîâ | ||
1927 | + | ||
1928 | + $sql3 = "SELECT * FROM catalogs_orders_products | ||
1929 | + WHERE `order_id`='".$order['order_id']."' "; | ||
1930 | + $result3 = mysql_query($sql3) or die(mysql_error()); | ||
1931 | + if (mysql_affected_rows()!=0) { $i=0; | ||
1932 | + echo" | ||
1933 | + <fieldset id='order-details'> | ||
1934 | + <legend>Òîâàðû</legend> | ||
1935 | + <div class='table'> | ||
1936 | + <div class='count'>¹</div> | ||
1937 | + <div class='code'>Êîä</div> | ||
1938 | + <div class='brand'>Áðåíä</div> | ||
1939 | + <div class='title'>Íàéìåíîâàíèå</div> | ||
1940 | + <div class='size'>Ðàçìåð</div> | ||
1941 | + <div class='color'>Öâåò</div> | ||
1942 | + <div class='quant'>Êîë.</div> | ||
1943 | + <div class='price'>Öåíà</div> | ||
1944 | + <div class='total'>Ñóììà</div> | ||
1945 | + <div class='onstock'>Íàëè÷èå</div> | ||
1946 | + <div class='control' ></div> | ||
1947 | + <div class='clear'></div> | ||
1948 | + </div> | ||
1949 | + <div id='lines'> | ||
1950 | + <!-- Ïðÿ÷åì ýòó ñòðî÷êó, òàê êàê ÿâàñêðèïò êîïèïóåò ïåðâóþ ñòðî÷êó êàê ïóñòóþ --> | ||
1951 | + <div id='line0'> | ||
1952 | + <div class='row'> | ||
1953 | + <div class='count' id='id(0)'>1</div> | ||
1954 | + <div class='code'> | ||
1955 | + <input type='text' name='item[code][]' value='' id='code(0)' autocomplete='off' onkeyup=flyFind(this.value,'(0)') onkeydown=selectFirst(event.keyCode)> | ||
1956 | + <!-- search ---> | ||
1957 | + <div class='livesearch-block'> | ||
1958 | + <div id='livesearch(0)'></div> | ||
1959 | + </div> | ||
1960 | + <!-- ---> | ||
1961 | + </div> | ||
1962 | + <div class='brand' id='brand(0)'> </div> | ||
1963 | + <div class='title' id='title(0)'> </div> | ||
1964 | + <div class='size' id='size(0)'> </div> | ||
1965 | + <div class='color' id='color(0)'> </div> | ||
1966 | + <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(0)' onBlur='SumPerRow();'></div> | ||
1967 | + <div class='price' id='price(0)'>0</div> | ||
1968 | + <div class='total' id='total(0)'>0</div> | ||
1969 | + <div class='onstock' id='onstock(0)'></div> | ||
1970 | + | ||
1971 | + <input type='hidden' name='item[mod_id][]' id='mod_idValue(0)' value=''> | ||
1972 | + <input type='hidden' name='item[product_id][]' id='product_idValue(0)' value=''> | ||
1973 | + <input type='hidden' name='item[brand_id][]' id='brand_idValue(0)' value=''> | ||
1974 | + <input type='hidden' name='item[price][]' id='priceValue(0)' value='0'> | ||
1975 | + <input type='hidden' name='item[total][]' id='totalValue(0)' value='0'> | ||
1976 | + | ||
1977 | + <div class='control'> | ||
1978 | + <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | ||
1979 | + <a href='#' onclick='RemoveDivLine(0);'><img src='/account/pic/del.png' width='18px'></a> | ||
1980 | + </div> | ||
1981 | + | ||
1982 | + <div class='clear'></div> | ||
1983 | + </div> | ||
1984 | + </div> | ||
1985 | + <!---------------------------------------------------------------------------------->"; | ||
1986 | + | ||
1987 | + while ($item_id=mysql_fetch_assoc($result3)) { $i++; | ||
1988 | + | ||
1989 | + // Èíôî î òîâàðå | ||
1990 | + $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m | ||
1991 | + LEFT JOIN catalogs_products as p | ||
1992 | + ON p.id=m.product_id | ||
1993 | + WHERE m.id='".$item_id['product_id']."' "; | ||
1994 | + | ||
1995 | + $result4 = mysql_query($sql4) or die(mysql_error()); | ||
1996 | + if (mysql_affected_rows()!=0) { | ||
1997 | + $item=mysql_fetch_assoc($result4); | ||
1998 | + | ||
1999 | + // íàëè÷èå òîâàðà | ||
2000 | + $sql5 = "SELECT c.name as city, o.count | ||
2001 | + FROM catalogs_keys_products_cities as o | ||
2002 | + LEFT JOIN catalogs_cities as c | ||
2003 | + ON o.city_id=c.id | ||
2004 | + WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | ||
2005 | + $result5 = mysql_query($sql5) or die(mysql_error()); | ||
2006 | + if (mysql_affected_rows()!=0) { | ||
2007 | + $onStockDesc=''; | ||
2008 | + while ($onStock=mysql_fetch_assoc($result5)) { | ||
2009 | + $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | ||
2010 | + } | ||
2011 | + } else { $onStock='íåò';} | ||
2012 | + | ||
2013 | + echo"<div id='line$i' ".(($item_id['count']==0)?"style='background:#ffc5c5;'":"")."> | ||
2014 | + <div class='row'> | ||
2015 | + <div class='count' id='id($i)'>$i</div> | ||
2016 | + <div class='code'> | ||
2017 | + <input type='text' name='item[code][]' value='".$item['code']."' id='code($i)' autocomplete='off' onkeyup=flyFind(this.value,'($i)') onkeydown=selectFirst(event.keyCode)> | ||
2018 | + <!-- search ---> | ||
2019 | + <div class='livesearch-block'> | ||
2020 | + <div id='livesearch($i)'></div> | ||
2021 | + </div> | ||
2022 | + <!-- ---> | ||
2023 | + </div> | ||
2024 | + <div class='brand' id='brand($i)'>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." </div> | ||
2025 | + <div class='title' id='title($i)'><a rel='msg' title='".$item['text']."' href='http://extremstyle.ua/uploaded/pic/catalogs/products/".$item['pic']."'>".$item['name']."</a> </div> | ||
2026 | + <div class='size' id='size($i)'>".$item['size']." </div> | ||
2027 | + <div class='color' id='color($i)'>".$item['color']." </div> | ||
2028 | + <div class='quant'><input type='text' name='item[quant][]' value='".$item_id['count']."' id='quantValue($i)' onBlur='SumPerRow();'></div> | ||
2029 | + <div class='price' id='price($i)'>".$item['cine']."</div> | ||
2030 | + <div class='total' id='total($i)'>".($item['cine']*$item_id['count'])."</div> | ||
2031 | + <div class='onstock' id='onstock($i)'>$onStockDesc</div> | ||
2032 | + | ||
2033 | + <input type='hidden' name='item[mod_id][]' id='mod_idValue($i)' value='".$item['mod_id']."'> | ||
2034 | + <input type='hidden' name='item[product_id][]' id='product_idValue($i)' value='".$item['product_id']."'> | ||
2035 | + <input type='hidden' name='item[brand_id][]' id='brand_idValue($i)' value='".$item['brend_id']."'> | ||
2036 | + <input type='hidden' name='item[price][]' id='priceValue($i)' value='".$item['cine']."'> | ||
2037 | + <input type='hidden' name='item[total][]' id='totalValue($i)' value='".($item['cine']*$item_id['count'])."'> | ||
2038 | + | ||
2039 | + <div class='control'> | ||
2040 | + <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | ||
2041 | + <a href='#' onclick='RemoveDivLine($i);'><img src='/account/pic/del.png' width='18px'></a> | ||
2042 | + <a href='#' onclick='DDivLine($i);'>Ä</a> | ||
2043 | + </div> | ||
2044 | + | ||
2045 | + <div class='clear'></div> | ||
2046 | + </div><div style='clear:both;'></div> | ||
2047 | + </div>"; | ||
2048 | + } | ||
2049 | + | ||
2050 | + } | ||
2051 | + | ||
2052 | + echo"</div> | ||
2053 | + | ||
2054 | + <div class='report'> | ||
2055 | + Âñåãî: <span id='quantity'>0</span> òîâàðîâ íà <span id='summary'>0</span> ãðí. | ||
2056 | + </div> | ||
2057 | + | ||
2058 | + <input type='hidden' name='summary' value='' id='summaryValue'> | ||
2059 | + <input type='hidden' name='user_id' value='".$order['user_id']."'> | ||
2060 | + <input type='hidden' name='order_id' value='".$order['order_id']."'> | ||
2061 | + <input type='hidden' name='send' value='edit-order'> | ||
2062 | + | ||
2063 | + | ||
2064 | + "; | ||
2065 | + | ||
2066 | + echo"<div class='clear'></div>"; | ||
2067 | + | ||
2068 | + // Äëÿ XML ôàéëà | ||
2069 | + $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); | ||
2070 | + | ||
2071 | + // Ñìåíà ñòàòóñà | ||
2072 | + if ($order['status']!=6) { | ||
2073 | + echo "<div class='pager-pages'> | ||
2074 | + <div id='show'>Ïåðåâåñòè</div> | ||
2075 | + <form method='POST' action='".$_SERVER["REQUEST_URI"]."' id='PerPageForm' name='SetStatus'> | ||
2076 | + <select size='1' name='status' id='PerPage' >"; | ||
2077 | + $sql4 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | ||
2078 | + $result4 = mysql_query($sql4) or die(mysql_error()); | ||
2079 | + if (mysql_affected_rows()!=0) { | ||
2080 | + | ||
2081 | + while ($row4=mysql_fetch_assoc($result4)) { | ||
2082 | + if($row4['id'] == $order['status']) $chek ="SELECTED"; | ||
2083 | + else $chek = ""; | ||
2084 | + echo"<option value='".$row4['id']."' ".$chek.">".$row4['title']."</option>\n"; | ||
2085 | + } | ||
2086 | + echo"</select>"; | ||
2087 | + echo"<input type='hidden' name='action' value='status'> | ||
2088 | + <input type='hidden' name='order_id' value='".$order['order_id']."'>"; | ||
2089 | + } | ||
2090 | + | ||
2091 | + | ||
2092 | + echo"</form>"; | ||
2093 | + | ||
2094 | + echo" | ||
2095 | + <div id='records'><input type='submit' value='Ïåðåâåñòè' class='button-save' onclick=\"if(document.getElementById('mcomment').value=='' && document.getElementById('PerPage').value=='5'){ alert('Äëÿ ñìåíû ñòàòóñà çàêàçà íà \'Îòìåíåí\', îáÿçàòåëüíî, çàïîëíåíèå ïîëÿ \'Êîìåíòàðèé (ìåíåäæåðà)\''); return false;} else document.forms['SetStatus'].submit();\" ></div> | ||
2096 | + <div id='records'><input type='submit' class='button-save' title='Ñîõðàíèòü' value='Ñîõðàíèòü' onclick=\"document.forms['edit_order'].submit();\"></div> | ||
2097 | + <div id='records'><a href='/account/admin/orders.php?action=print&order_id=".$order['order_id']."' target='_new' class='button-save'>Ïå÷àòü</a></div>"; | ||
2098 | + | ||
2099 | + if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { | ||
2100 | + echo"<div id='records'><a href='/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml'><img src='/account/pic/xml.png' width='38px' title='xml çàêàç ïîëüçîâàòåëÿ'></a></div>"; | ||
2101 | + } | ||
2102 | + | ||
2103 | + | ||
2104 | + echo"</div>"; | ||
2105 | + } | ||
2106 | + echo"</fieldset></div>"; | ||
2107 | + | ||
2108 | + echo"</div>"; | ||
2109 | + | ||
2110 | + } | ||
2111 | + | ||
2112 | + } else { echo"<p>Ïóñòî</p>";} | ||
2113 | + | ||
2114 | + // ===================== | ||
2115 | + // ===== javascript ==== | ||
2116 | + // ===================== | ||
2117 | + | ||
2118 | + echo" | ||
2119 | + <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | ||
2120 | + <script type='text/javascript' src='/js/msg.js'></script> | ||
2121 | + <script src='/js/JsHttpRequest.js'></script> | ||
2122 | + <script src='/js/OrderContol.js' type='text/javascript'></script>"; | ||
2123 | + | ||
2124 | + | ||
2125 | + | ||
2126 | + echo" | ||
2127 | + <!-------[ Form falidator ]-------> | ||
2128 | + <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> | ||
2129 | + <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | ||
2130 | + | ||
2131 | + <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> | ||
2132 | + <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script> | ||
2133 | + | ||
2134 | + <script> | ||
2135 | + jQuery(document).ready(function(){ | ||
2136 | + // binds form submission and fields to the validation engine | ||
2137 | + jQuery('#add-item').validationEngine(); | ||
2138 | + }); | ||
2139 | + </script> | ||
2140 | + <!-------->"; | ||
2141 | + } | ||
2142 | + | ||
2143 | + | ||
2144 | + | ||
2145 | + | ||
2146 | + // ============= | ||
2147 | + // ==== add ==== | ||
2148 | + // ============= | ||
2149 | + | ||
2150 | + if (isset($_GET['action']) && $_GET['action']=='add') { | ||
2151 | + | ||
2152 | + if (isset($_POST['user'])) {} | ||
2153 | + | ||
2154 | + $user=array(); | ||
2155 | + | ||
2156 | + if(isset($_GET['user'])) { | ||
2157 | + | ||
2158 | + $sql = "SELECT * FROM zlo_users WHERE id='".$_GET['user']."'"; | ||
2159 | + $result = mysql_query($sql) or die(mysql_error()); | ||
2160 | + if (mysql_affected_rows()!=0) { | ||
2161 | + $user=mysql_fetch_assoc($result); | ||
2162 | + } | ||
2163 | + | ||
2164 | + } else { | ||
2165 | + | ||
2166 | + if(isset($_POST)) {$user=$_POST['user'];} | ||
2167 | + | ||
2168 | + } | ||
2169 | + | ||
2170 | + | ||
2171 | + | ||
2172 | + echo"<form action='' method='POST' name='add_order' id='add-item'>"; | ||
2173 | + echo"<div class='add-order'>"; | ||
2174 | + echo"<div class='orders'>"; | ||
2175 | + | ||
2176 | + echo" | ||
2177 | + <div class=order-info> | ||
2178 | + <fieldset id='order-info'> | ||
2179 | + <legend>Íîâûé çàêàç</legend> | ||
2180 | + <div style='float:left;width:400px;'> | ||
2181 | + <label>Äàòà:</label> | ||
2182 | + <div class=info>".date('d-m-Y H:i:s')."</div>"; | ||
2183 | + | ||
2184 | + echo"<label>Îïëà÷åí:</label> | ||
2185 | + <div class=info style='float:left;padding-right:20px;'> | ||
2186 | + <select name='paid'> | ||
2187 | + <option value='0' ".(($user['paid']==0)?'selected':'').">íåò</option> | ||
2188 | + <option value='1' ".(($user['paid']==1)?'selected':'').">äà</option> | ||
2189 | + </select> | ||
2190 | + </div> | ||
2191 | + <div> | ||
2192 | + <label style='width:50px'>Ìåòêà:</label> | ||
2193 | + <div class=info> | ||
2194 | + <select name='label'> | ||
2195 | + "; | ||
2196 | + for($i=0;$i<=10;$i++){print'<option value="'.$i.'" '.(($user['label']==$i)?'selected':'').'>'.$i.'</option>';}; | ||
2197 | + echo"</select> | ||
2198 | + </div> | ||
2199 | + </div>"; | ||
2200 | + | ||
2201 | + if(!isset($_GET['user'])) { | ||
2202 | + echo"<div class='new'>Ïî óìîë÷àíèþ<input type='checkbox' onChange='newUnknownUser();' id='default'></div>"; | ||
2203 | + } | ||
2204 | + | ||
2205 | + if(isset($_GET['user'])) { | ||
2206 | + | ||
2207 | + $readonly='readonly="readonly"'; | ||
2208 | + $disabled='disabled="disabled"'; | ||
2209 | + | ||
2210 | + } else {$readonly='';$disabled='';} | ||
2211 | + | ||
2212 | + echo" | ||
2213 | + <label>Email:<font color='red'>*</font></label> | ||
2214 | + <div class=info><input type='text' style='width:300px;' name='user[email]' value='".$user['email']."' class='validate[required,user[email]] text-input' id='emailValue' $readonly autocomplete='off' onkeyup=livesearchEmail(this.value,'(0)')></div> | ||
2215 | + <!-- search ---> | ||
2216 | + <div class='livesearch-email-block'> | ||
2217 | + <div id='livesearch-email-list'></div> | ||
2218 | + </div> | ||
2219 | + <!-- ---> | ||
2220 | + | ||
2221 | + <label>Òåëåôîí:<font color='red'>*</font></label> | ||
2222 | + <div class=info><input type='text' style='width:300px;' name='user[tel]' value='".$user['tel']."' class='validate[required,custom[cell_phone]] text-input' id='telValue' $readonly autocomplete='off' onkeyup=livesearchTel(this.value,'(0)')></div> | ||
2223 | + <!-- search ---> | ||
2224 | + <div class='livesearch-tel-block'> | ||
2225 | + <div id='livesearch-tel-list'></div> | ||
2226 | + </div> | ||
2227 | + <!-- ---> | ||
2228 | + | ||
2229 | + | ||
2230 | + <label>Êëèåíò:<font color='red'>*</font></label> | ||
2231 | + <div class=info><input type='text' style='width:300px;' name='user[username]' value='".$user['username']."' id='usernameValue' $readonly></div> | ||
2232 | + | ||
2233 | + <label>Òåëåôîí 2:</label> | ||
2234 | + <div class=info><input type='text' style='width:300px;' name='user[tel2]' value='".$user['tel2']."' id='tel2Value'></div>"; | ||
2235 | + | ||
2236 | + echo"<label>¹ êàðòî÷êè:</label> | ||
2237 | + <div class=info> | ||
2238 | + <input type='text' name='user[cards]' value='".$user['cards']."' style='width:300px;' id='cardsValue'> | ||
2239 | + </div>"; | ||
2240 | + | ||
2241 | + echo " | ||
2242 | + <label>Êîìåíòàðèé:</label> | ||
2243 | + <div class=info><textarea rows='2' style='width:300px;' name='user[comment]' cols='30' name='comment'>".$user['comment']."</textarea></div>"; | ||
2244 | + | ||
2245 | + // ãðóïïà | ||
2246 | + echo" | ||
2247 | + <label>Ãðóïïà</label>"; | ||
2248 | + | ||
2249 | + echo "<select style='width:300px;' name='user[group]' id='usergroup' $disabled >"; | ||
2250 | + viewBookSelectValue('zlo_users_group', 'id', 'name', $user['group']); | ||
2251 | + echo "</select>"; | ||
2252 | + | ||
2253 | + // hidden | ||
2254 | + if (isset($_GET['user'])) { | ||
2255 | + echo"<input type='hidden' name='user[group]' value='".$user['group']."'>"; | ||
2256 | + } | ||
2257 | + | ||
2258 | + echo"<input type='hidden' name='user[user_id]' value='".$user['id']."' id='user_id'>"; | ||
2259 | + | ||
2260 | + echo"</div><div style='float:right;'> | ||
2261 | + <label>Äîñòàâêà</label>"; | ||
2262 | + echo " | ||
2263 | + <div class=info> | ||
2264 | + <select name='user[delivery]' style='width:300px'>"; | ||
2265 | + viewBookSelectValue('zlo_book_delivery', 'id', 'title', $user['delivery']); | ||
2266 | + echo "</select> | ||
2267 | + </div>"; | ||
2268 | + | ||
2269 | + echo " | ||
2270 | + <label>Äåêëàðàöèÿ ¹:</label> | ||
2271 | + <div class=info><input type='text' name='user[declaration]' style='width:300px;' value='".$user['declaration']."' id='declarationValidate'></div>"; | ||
2272 | + | ||
2273 | + echo " | ||
2274 | + <label>¹ ñêëàäà:</label> | ||
2275 | + <div class=info><input type='text' name='user[warehouse]' style='width:300px;' value='".$user['warehouse']."' id='warehouseValidate'></div>"; | ||
2276 | + | ||
2277 | + | ||
2278 | + $array_method = array("Îïëàòèòü íàëè÷íûìè","Îïëàòèòü íà êàðòó Ïðèâàò Áàíêà","Îïëàòèòü ïî áåçíàëè÷íîìó ðàñ÷åòó","Îïëàòèòü Ïðàâåêñ-òåëåãðàô","Íàëîæåííûì ïëàòåæîì"); | ||
2279 | + echo" | ||
2280 | + <div class=info> | ||
2281 | + <label>Ñïîñîá îïëàòû:</label> | ||
2282 | + <select name='user[payment]' style='width:300px'><option value=''></option>"; | ||
2283 | + foreach($array_method as $method){ | ||
2284 | + echo'<option value="'.$method.'" '; | ||
2285 | + if($user['payment']==$method)echo'selected'; | ||
2286 | + echo'>'.$method.'</option>'; | ||
2287 | + } | ||
2288 | + echo "</select> | ||
2289 | + </div>"; | ||
2290 | + | ||
2291 | + echo"<label>Ñòðàõîâêà:</label> | ||
2292 | + <div class=info><input type='text' name='user[insurance]' style='width:300px;' value='".$user['insurance']."' id='insuranceValidate'></div>"; | ||
2293 | + echo"<label>Ñóììà íàëîæåííîãî:</label> | ||
2294 | + <div class=info><input type='text' name='user[sumn]' style='width:300px;' value='".$user['sumn']."' id='insuranceValidate'></div>"; | ||
2295 | + $array_method = array("Ïîëó÷àòåëÿ","Îòïðàâèòåëÿ"); | ||
2296 | + echo" | ||
2297 | + <div class=info> | ||
2298 | + <label>Îòïðàâêà çà ñ÷åò:</label> | ||
2299 | + <select name='user[sends]' style='width:300px'><option value=''></option>"; | ||
2300 | + foreach($array_method as $method){ | ||
2301 | + echo'<option value="'.$method.'" '; | ||
2302 | + if($order['sends']==$method)echo'selected'; | ||
2303 | + echo'>'.$method.'</option>'; | ||
2304 | + } | ||
2305 | + echo "</select> | ||
2306 | + </div>"; | ||
2307 | + echo"<label>Ãîðîä:<font color='red'>*</font></label> | ||
2308 | + <div class=info><input type='text' name='user[city]' style='width:300px;' class=\"validate[required]\" value='".$user['city']."' id='cityValue'></div> | ||
2309 | + | ||
2310 | + <label>Àäðåñ:<font color='red'>*</font></label> | ||
2311 | + <div class=info><input type='text' name='user[address]' style='width:300px;' class=\"validate[required]\" value='".$user['address']."' id='addressValue'></div> | ||
2312 | + | ||
2313 | + <label>Êîìåíòàðèé (ìåíåäæåðà):</label> | ||
2314 | + <div class=info><textarea rows='4' id='mcomment' style='width:400px;' name='user[mcomment]' cols='30' name='mcomment'>".$user['mcomment']."</textarea></div> | ||
2315 | + </div> | ||
2316 | + "; | ||
2317 | + | ||
2318 | + echo"<div class=clear></div> | ||
2319 | + </fieldset> | ||
2320 | + <div class=clear></div> | ||
2321 | + </div>"; | ||
2322 | + | ||
2323 | + echo" | ||
2324 | + <fieldset id='order-details'> | ||
2325 | + <legend>Òîâàðû</legend> | ||
2326 | + <div class='table'> | ||
2327 | + <div class='count'>¹</div> | ||
2328 | + <div class='code'>Êîä</div> | ||
2329 | + <div class='brand'>Áðåíä</div> | ||
2330 | + <div class='title'>Íàéìåíîâàíèå</div> | ||
2331 | + <div class='size'>Ðàçìåð</div> | ||
2332 | + <div class='color'>Öâåò</div> | ||
2333 | + <div class='quant'>Êîë.</div> | ||
2334 | + <div class='price'>Öåíà</div> | ||
2335 | + <div class='total'>Ñóììà</div> | ||
2336 | + <div class='reservation'>Áðîíü</div> | ||
2337 | + <div class='onstock'>Íàëè÷èå</div> | ||
2338 | + <div class='control' ></div> | ||
2339 | + <div class='clear'></div> | ||
2340 | + </div> | ||
2341 | + <div id='lines'> | ||
2342 | + <!-- Ïðÿ÷åì ýòó ñòðî÷êó, òàê êàê ÿâàñêðèïò êîïèïóåò ïåðâóþ ñòðî÷êó êàê ïóñòóþ --> | ||
2343 | + <div id='line0'> | ||
2344 | + <div class='row'> | ||
2345 | + <div class='count' id='id(0)'>1</div> | ||
2346 | + <div class='code'> | ||
2347 | + <input type='text' name='item[code][]' value='' id='code(0)' autocomplete='off' onkeyup=flyFind(this.value,'(0)') onkeydown=selectFirst(event.keyCode)> | ||
2348 | + <!-- search ---> | ||
2349 | + <div class='livesearch-block'> | ||
2350 | + <div id='livesearch(0)'></div> | ||
2351 | + </div> | ||
2352 | + <!-- ---> | ||
2353 | + </div> | ||
2354 | + <div class='brand' id='brand(0)'> </div> | ||
2355 | + <div class='title' id='title(0)'> </div> | ||
2356 | + <div class='size' id='size(0)'> </div> | ||
2357 | + <div class='color' id='color(0)'> </div> | ||
2358 | + <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(0)' onBlur='SumPerRow();'></div> | ||
2359 | + <div class='price' id='price(0)'>0</div> | ||
2360 | + <div class='total' id='total(0)'>0</div> | ||
2361 | + <div class='reservation'><input type='text' size='3' name='item[reservation][]' value='' /></div> | ||
2362 | + <div class='onstock' id='onstock(0)'></div> | ||
2363 | + | ||
2364 | + <input type='hidden' name='item[mod_id][]' id='mod_idValue(0)' value=''> | ||
2365 | + <input type='hidden' name='item[product_id][]' id='product_idValue(0)' value=''> | ||
2366 | + <input type='hidden' name='item[brand_id][]' id='brand_idValue(0)' value=''> | ||
2367 | + <input type='hidden' name='item[price][]' id='priceValue(0)' value='0'> | ||
2368 | + <input type='hidden' name='item[total][]' id='totalValue(0)' value='0'> | ||
2369 | + | ||
2370 | + <div class='control' style='float:right;'> | ||
2371 | + <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | ||
2372 | + <a href='#' onclick='RemoveDivLine(0);'><img src='/account/pic/del.png' width='18px'></a> | ||
2373 | + </div> | ||
2374 | + | ||
2375 | + <div class='clear'></div> | ||
2376 | + </div> | ||
2377 | + </div> | ||
2378 | + <!----------------------------------------------------------------------------------> | ||
2379 | + <div id='line1'> | ||
2380 | + <div class='row'> | ||
2381 | + <div class='count' id='id(1)'>1</div> | ||
2382 | + <div class='code'> | ||
2383 | + <input type='text' name='item[code][]' value='' id='code(1)' autocomplete='off' onkeyup=flyFind(this.value,'(1)') onkeydown=selectFirst(event.keyCode)> | ||
2384 | + <!-- search ---> | ||
2385 | + <div class='livesearch-block'> | ||
2386 | + <div id='livesearch(1)'></div> | ||
2387 | + </div> | ||
2388 | + <!-- ---> | ||
2389 | + </div> | ||
2390 | + <div class='brand' id='brand(1)'> </div> | ||
2391 | + <div class='title' id='title(1)'> </div> | ||
2392 | + <div class='size' id='size(1)'> </div> | ||
2393 | + <div class='color' id='color(1)'> </div> | ||
2394 | + <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(1)' onBlur='SumPerRow();'></div> | ||
2395 | + <div class='price' id='price(1)'>0</div> | ||
2396 | + <div class='total' id='total(1)'>0</div> | ||
2397 | + <div class='reservation'><input type='text' size='3' name='item[reservation][]' value='' /></div> | ||
2398 | + <div class='onstock' id='onstock(1)'></div> | ||
2399 | + | ||
2400 | + <input type='hidden' name='item[mod_id][]' id='mod_idValue(1)' value=''> | ||
2401 | + <input type='hidden' name='item[product_id][]' id='product_idValue(1)' value=''> | ||
2402 | + <input type='hidden' name='item[brand_id][]' id='brand_idValue(1)' value=''> | ||
2403 | + <input type='hidden' name='item[price][]' id='priceValue(1)' value='0'> | ||
2404 | + <input type='hidden' name='item[total][]' id='totalValue(1)' value='0'> | ||
2405 | + | ||
2406 | + <div class='control' style='float:right;'> | ||
2407 | + <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | ||
2408 | + <a href='#' onclick='RemoveDivLine(1);'><img src='/account/pic/del.png' width='18px'></a> | ||
2409 | + </div> | ||
2410 | + | ||
2411 | + <div class='clear'></div> | ||
2412 | + </div> | ||
2413 | + </div> | ||
2414 | + </div> | ||
2415 | + | ||
2416 | + <div class='report'> | ||
2417 | + Ñòîèìîñòü äîñòàâêè <input type='text' size='10' name='cost_delivery' id='cost_delivery' value='0' onBlur='SumPerRow()' /> | ||
2418 | + Âñåãî: <span id='quantity'>0</span> òîâàðîâ íà <span id='summary'>0</span> ãðí. | ||
2419 | + </div> | ||
2420 | + | ||
2421 | + <input type='hidden' name='summary' id='summaryValue' value=''> | ||
2422 | + <input type='hidden' name='send' value='add-order'> | ||
2423 | + <input type='submit' class='button-add' title='Äîáàâèòü' value='Äîáàâèòü' onclick=\"document.form.submit();\"> | ||
2424 | + | ||
2425 | + </fieldset > | ||
2426 | + </div> | ||
2427 | + </form>"; | ||
2428 | + | ||
2429 | + // ===================== | ||
2430 | + // ===== javascript ==== | ||
2431 | + // ===================== | ||
2432 | + | ||
2433 | + echo" | ||
2434 | + <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | ||
2435 | + <script src='/js/JsHttpRequest.js'></script> | ||
2436 | + <script src='/js/OrderContol.js' type='text/javascript'></script>"; | ||
2437 | + | ||
2438 | + | ||
2439 | + echo" | ||
2440 | + <!-------[ Form falidator ]-------> | ||
2441 | + <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> | ||
2442 | + <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | ||
2443 | + | ||
2444 | + <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> | ||
2445 | + <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script> | ||
2446 | + | ||
2447 | + <script> | ||
2448 | + jQuery(document).ready(function(){ | ||
2449 | + // binds form submission and fields to the validation engine | ||
2450 | + jQuery('#add-item').validationEngine(); | ||
2451 | + }); | ||
2452 | + </script> | ||
2453 | + <!-------->"; | ||
2454 | + | ||
2455 | + } | ||
2456 | + | ||
2457 | + | ||
2458 | + // ============= | ||
2459 | + // === print === | ||
2460 | + // ============= | ||
2461 | + | ||
2462 | + if (isset($_GET['action']) && $_GET['action']=='print') { | ||
2463 | + | ||
2464 | + // =========== Ãåíåðèì òàáëèöó =========== | ||
2465 | + | ||
2466 | + if (!isset($_GET['status'])) {$_GET['status']=1;} | ||
2467 | + | ||
2468 | + $sql = "SELECT o.*,u.*, o.id as order_id,o.city as city FROM catalogs_orders as o | ||
2469 | + RIGHT JOIN zlo_users as u on u.id=o.user_id | ||
2470 | + WHERE o.id='".$_GET['order_id']."' "; | ||
2471 | + | ||
2472 | + $sql = "SELECT o.*, o.id as order_id,o.city as city,adm.login as meneger FROM catalogs_orders as o | ||
2473 | + LEFT JOIN zlo_admin adm ON adm.id=o.meneger | ||
2474 | + WHERE o.id='".$_GET['order_id']."' "; | ||
2475 | + $result = mysql_query($sql) or die(mysql_error()); | ||
2476 | + if (mysql_affected_rows()!=0) { | ||
2477 | + $view=''; | ||
2478 | + $view.="<div class='print'>"; | ||
2479 | + | ||
2480 | + $order=mysql_fetch_assoc($result); | ||
2481 | + | ||
2482 | + $view.="<div class='client'> | ||
2483 | + <table> | ||
2484 | + <tr> | ||
2485 | + <td>Ìåíåäæåð: </td> | ||
2486 | + <td>".$order['meneger']."</td> | ||
2487 | + </tr> | ||
2488 | + <tr> | ||
2489 | + <td>Çàêàç # </td> | ||
2490 | + <td>".$order['order_id']."</td> | ||
2491 | + </tr> | ||
2492 | + <tr> | ||
2493 | + <td>Äàòà: </td> | ||
2494 | + <td>".date('Y-m-d H:i:s',$order['mktime'])."</td> | ||
2495 | + </tr> | ||
2496 | + <tr> | ||
2497 | + <td>Êëèåíò: </td> | ||
2498 | + <td>".$order['name']."</td> | ||
2499 | + </tr> | ||
2500 | + <tr> | ||
2501 | + <td>Email: </td> | ||
2502 | + <td>".$order['email']."</td> | ||
2503 | + </tr> | ||
2504 | + <tr> | ||
2505 | + <td>Òåë: </td> | ||
2506 | + <td>".$order['phone']."</td> | ||
2507 | + </tr> | ||
2508 | + <tr> | ||
2509 | + <td>Äîï. òåë: </td> | ||
2510 | + <td>".$order['phonemob']."</td> | ||
2511 | + </tr> | ||
2512 | + <tr> | ||
2513 | + <td>¹ êàðòî÷êè: </td> | ||
2514 | + <td>".$order['cards']."</td> | ||
2515 | + </tr> | ||
2516 | + <tr> | ||
2517 | + <td>Êîìåíòàðèé: </td> | ||
2518 | + <td>".$order['comment']."</td> | ||
2519 | + </tr> | ||
2520 | + <tr> | ||
2521 | + <td>Äîñòàâêà: </td> | ||
2522 | + <td>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')."</td> | ||
2523 | + </tr> | ||
2524 | + <tr> | ||
2525 | + <td>Äåêëàðàöèÿ ¹: </td> | ||
2526 | + <td>".$order['declaration']."</td> | ||
2527 | + </tr> | ||
2528 | + <tr> | ||
2529 | + <td>¹ ñêëàäà: </td> | ||
2530 | + <td>".$order['warehouse']."</td> | ||
2531 | + </tr> | ||
2532 | + <tr> | ||
2533 | + <td>Ñïîñîá îïëàòû: </td> | ||
2534 | + <td>".$order['payment']."</td> | ||
2535 | + </tr> | ||
2536 | + <tr> | ||
2537 | + <td>Ñòðàõîâêà: </td> | ||
2538 | + <td>".$order['insurance']."</td> | ||
2539 | + </tr> | ||
2540 | + <tr> | ||
2541 | + <td>Ñóììà íàëîæåííîãî: </td> | ||
2542 | + <td>".$order['sumn']."</td> | ||
2543 | + </tr> | ||
2544 | + <tr> | ||
2545 | + <td>Îòïðàâêà çà ñ÷åò: </td> | ||
2546 | + <td>".$order['sends']."</td> | ||
2547 | + </tr> | ||
2548 | + <tr> | ||
2549 | + <td>Ãîðîä: </td> | ||
2550 | + <td>".$order['city']."</td> | ||
2551 | + </tr> | ||
2552 | + <tr> | ||
2553 | + <td>Àäðåñ: </td> | ||
2554 | + <td>".$order['adress']."</td> | ||
2555 | + </tr> | ||
2556 | + <tr> | ||
2557 | + <td>Êîìåíòàðèé (ìåíåäæåðà): </td> | ||
2558 | + <td>".$order['mcomment']."</td> | ||
2559 | + </tr> | ||
2560 | + | ||
2561 | + </table> | ||
2562 | + </div>"; | ||
2563 | + | ||
2564 | + | ||
2565 | + // Òàáëèöà òîâàðîâ | ||
2566 | + | ||
2567 | + $sql3 = "SELECT * FROM catalogs_orders_products | ||
2568 | + WHERE `order_id`='".$order['order_id']."' "; | ||
2569 | + $result3 = mysql_query($sql3) or die(mysql_error()); | ||
2570 | + if (mysql_affected_rows()!=0) { $i=0; | ||
2571 | + | ||
2572 | + $view.="<div class='details'>"; | ||
2573 | + | ||
2574 | +$sum = array(); | ||
2575 | + while ($item_id=mysql_fetch_assoc($result3)) { $i++; | ||
2576 | + | ||
2577 | + $sql4 = "SELECT *,IF(m.cine>0,m.cine,p.cine) as cine FROM catalogs_modifications as m | ||
2578 | + LEFT JOIN catalogs_products as p | ||
2579 | + ON p.id=m.product_id | ||
2580 | + WHERE m.id='".$item_id['product_id']."' "; | ||
2581 | + $result4 = mysql_query($sql4) or die(mysql_error()); | ||
2582 | + if (mysql_affected_rows()==0) { | ||
2583 | + $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m | ||
2584 | + LEFT JOIN catalogs_products as p | ||
2585 | + ON p.id=m.product_id | ||
2586 | + WHERE m.code='".$item_id['code']."' "; | ||
2587 | + $result4 = mysql_query($sql4) or die(mysql_error()); | ||
2588 | + } | ||
2589 | + if (mysql_affected_rows()!=0) { | ||
2590 | + while ($item=mysql_fetch_assoc($result4)) { | ||
2591 | + | ||
2592 | + $view.=" | ||
2593 | + <table> | ||
2594 | + <tr> | ||
2595 | + <td>¹</td> | ||
2596 | + <td>$i .</td> | ||
2597 | + <td> </td> | ||
2598 | + <td>Êîä</td> | ||
2599 | + <td>".$item['code']."</td> | ||
2600 | + <td> </td> | ||
2601 | + <td>Áðåíä</td> | ||
2602 | + <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | ||
2603 | + <td> </td> | ||
2604 | + <td>Íàçâàíèå</td> | ||
2605 | + <td>".$item['name']."</td> | ||
2606 | + <td> </td> | ||
2607 | + <td>Ðàçìåð</td> | ||
2608 | + <td>".$item['size']."</td> | ||
2609 | + <td> </td> | ||
2610 | + <td>Öâåò</td> | ||
2611 | + <td>".$item['color']."</td> | ||
2612 | + <td> </td> | ||
2613 | + <td>Êîë.</td> | ||
2614 | + <td>".$item_id['count']."</td> | ||
2615 | + <td> </td> | ||
2616 | + <td>Öåíà</td> | ||
2617 | + <td>"."(".$item_id['product_cine_id'].") ".$item['cine']."</td> | ||
2618 | + <td> </td> | ||
2619 | + <td>Ñóììà</td> | ||
2620 | + <td>".($item_id['product_cine_id']*$item_id['count'])."</td> | ||
2621 | + <td> </td> | ||
2622 | + <td>Áðîíü</td> | ||
2623 | + <td>".$item_id['reservation']."</td> | ||
2624 | + </tr> | ||
2625 | + </table>"; | ||
2626 | + $sum[] =($item_id['product_cine_id']*$item_id['count']); | ||
2627 | + | ||
2628 | + } | ||
2629 | + | ||
2630 | + } | ||
2631 | + } | ||
2632 | + | ||
2633 | + $view.="<span class='total'>Îáùàÿ ñóììà: ".array_sum($sum)." ãðí. </span> | ||
2634 | + <span class='total'>Ñòîèìîñòü äîñòàâêè: ".$order['cost_delivery']." ãðí. </span> | ||
2635 | + </div>"; | ||
2636 | + | ||
2637 | + } | ||
2638 | + | ||
2639 | + $view.="</div>"; | ||
2640 | + | ||
2641 | + // Âûâîäèì 2 ðàçà | ||
2642 | + | ||
2643 | + echo $view; | ||
2644 | + echo "<div class='print'><div class='separator'></div></div>"; | ||
2645 | + $view2=''; | ||
2646 | + $view2.="<div class='print'>"; | ||
2647 | + | ||
2648 | + | ||
2649 | + $view2.="<div class='client'> | ||
2650 | + <table style='font-size:16px;'> | ||
2651 | + <tr> | ||
2652 | + <td>Çàêàç # </td> | ||
2653 | + <td>".$order['order_id']."</td> | ||
2654 | + </tr> | ||
2655 | + <tr> | ||
2656 | + <td>Äàòà: </td> | ||
2657 | + <td>".date('Y-m-d H:i:s',$order['mktime'])."</td> | ||
2658 | + </tr> | ||
2659 | + <tr> | ||
2660 | + <td>Êëèåíò: </td> | ||
2661 | + <td>".$order['name']."</td> | ||
2662 | + </tr> | ||
2663 | + <tr> | ||
2664 | + <td>Òåë: </td> | ||
2665 | + <td>".$order['phone']."</td> | ||
2666 | + </tr> | ||
2667 | + <tr> | ||
2668 | + <td>Ãîðîä: </td> | ||
2669 | + <td>".$order['city']."</td> | ||
2670 | + </tr> | ||
2671 | + <tr> | ||
2672 | + <td>¹ ñêëàäà: </td> | ||
2673 | + <td>".$order['warehouse']."</td> | ||
2674 | + </tr> | ||
2675 | + <tr> | ||
2676 | + <td>Ñòðàõîâêà: </td> | ||
2677 | + <td>".$order['insurance']."</td> | ||
2678 | + </tr> | ||
2679 | + <tr> | ||
2680 | + <td>Ñóììà íàëîæåííîãî: </td> | ||
2681 | + <td>".$order['sumn']."</td> | ||
2682 | + </tr> | ||
2683 | + <tr> | ||
2684 | + <td>Îòïðàâêà çà ñ÷åò: </td> | ||
2685 | + <td>".$order['sends']."</td> | ||
2686 | + </tr> | ||
2687 | + <tr> | ||
2688 | + <td>Êîìåíòàðèé: </td> | ||
2689 | + <td>".$order['mcomment']."</td> | ||
2690 | + </tr> | ||
2691 | + | ||
2692 | + </table> | ||
2693 | + </div> | ||
2694 | + </div>"; | ||
2695 | + | ||
2696 | + echo $view2; | ||
2697 | + | ||
2698 | + | ||
2699 | + } | ||
2700 | + } | ||
2701 | +?> |