Commit 84f56040c95c8200f30ec40b2edbf5639cdc47ec
1 parent
bde80a8f
+ Редактирование телефона в заказе
Showing
7 changed files
with
1003 additions
and
7869 deletions
Show diff stats
account/admin/orders-git.php deleted
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 | -?> |
account/admin/orders.php
... | ... | @@ -32,9 +32,9 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); |
32 | 32 | GoBack (1); |
33 | 33 | } |
34 | 34 | |
35 | -// ============= | |
36 | -// == status === | |
37 | -// ============= | |
35 | +// ================= | |
36 | +// ==== status ===== | |
37 | +// ================= | |
38 | 38 | |
39 | 39 | // print_r($_POST); |
40 | 40 | // exit; |
... | ... | @@ -102,9 +102,9 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); |
102 | 102 | |
103 | 103 | $ChangesOfOrder = ChangesOfMass ($_POST['item']['mod_id'], $ordered); |
104 | 104 | |
105 | - // ========== | |
106 | - // == same == | |
107 | - // ========== | |
105 | + // ============== | |
106 | + // ==== same ==== | |
107 | + // ============== | |
108 | 108 | |
109 | 109 | if (isset ($ChangesOfOrder['same'])) |
110 | 110 | { |
... | ... | @@ -130,9 +130,9 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | - // ========== | |
134 | - // === add == | |
135 | - // ========== | |
133 | + // ============= | |
134 | + // ==== add ==== | |
135 | + // ============= | |
136 | 136 | |
137 | 137 | if (isset ($ChangesOfOrder['add'])) |
138 | 138 | { |
... | ... | @@ -437,9 +437,9 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); |
437 | 437 | // ==== NOTIFY ===== |
438 | 438 | // ================= |
439 | 439 | |
440 | - // ============== | |
441 | - // == changed === | |
442 | - // ============== | |
440 | + // ================== | |
441 | + // ==== changed ===== | |
442 | + // ================== | |
443 | 443 | |
444 | 444 | if (isset ($_GET['notify']) && $_GET['notify'] == 'order-changed') |
445 | 445 | { |
... | ... | @@ -454,22 +454,26 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); |
454 | 454 | // ============== Âûâîä ================= |
455 | 455 | // ====================================== |
456 | 456 | // ====================================== |
457 | - | |
458 | - // ===================== | |
459 | - // ===== javascript ==== | |
460 | - // ===================== | |
461 | - | |
462 | - | |
457 | + | |
458 | + // ===== javascript ==== | |
459 | + | |
463 | 460 | echo " |
464 | - <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | |
465 | - <script type='text/javascript' src='/js/msg.js'></script> | |
461 | + <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script> | |
466 | 462 | <script src='/js/JsHttpRequest.js'></script> |
467 | - <script src='/js/OrderContol.js' type='text/javascript'></script>"; | |
463 | + <script src='/js/OrderContol.js' type='text/javascript'></script> | |
464 | + <script src='/js/msg.js'></script> | |
465 | + <script src='/js/msg2.js'></script>"; | |
468 | 466 | |
467 | + // modal | |
468 | + echo " | |
469 | + <script src='/js/modalBox/modalBox.js'></script> | |
470 | + <script src='/js/bpopup/jquery.bpopup.min.js'></script> | |
471 | + <link href='/js/bpopup/bpopup.min.css' type='text/css' rel='stylesheet'/>"; | |
472 | + | |
473 | + // validator | |
469 | 474 | echo " |
470 | 475 | <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> |
471 | - <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | |
472 | - | |
476 | + <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | |
473 | 477 | <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> |
474 | 478 | <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script>"; |
475 | 479 | |
... | ... | @@ -479,23 +483,7 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); |
479 | 483 | |
480 | 484 | if (! isset ($_GET['action'])) |
481 | 485 | { |
482 | - | |
483 | - echo " | |
484 | - <script type='text/javascript'> | |
485 | - | |
486 | - function notify(url) | |
487 | - { | |
488 | - if (confirm(\"Âûñëàòü óâåäîìëåíèå?\")) | |
489 | - { | |
490 | - document.location=url; | |
491 | - return true; | |
492 | - } | |
493 | 486 | |
494 | - return false; | |
495 | - } | |
496 | - | |
497 | - </script>"; | |
498 | - | |
499 | 487 | // ***** Àäìèí ðåæèì ***** |
500 | 488 | if (isset ($_SESSION['admin']['edit']) || $_SESSION['admin']['group'] == 4 || $_SESSION['admin']['group'] == 2) |
501 | 489 | { |
... | ... | @@ -661,65 +649,69 @@ if (! isset ($_GET['action'])) |
661 | 649 | // === Äàòà ==== |
662 | 650 | // ============= |
663 | 651 | |
664 | - echo "<div class='grid-search'> | |
665 | - <form action='" . GetFormUrl () . "' name='search' method='GET'> | |
666 | - <div class='search'> | |
667 | - <input type='text' name='look' id='grid-search' value='" . $_REQUEST['look'] . "'> | |
668 | - <select name='field'>"; | |
669 | - | |
670 | - foreach ($th as $key => $value) | |
671 | - { | |
672 | - if ($_REQUEST['field'] == $key) | |
673 | - { | |
674 | - $selected = 'selected="selected"'; | |
675 | - } | |
676 | - else | |
677 | - { | |
678 | - $selected = ''; | |
679 | - } | |
680 | - echo "<option value='$key' $selected>$value</option>"; | |
681 | - } | |
682 | - | |
683 | - echo "</select> | |
684 | - <input type='submit' value='ïîèñê'> | |
685 | - <input type='hidden' name='status' value='" . $_GET['status'] . "'> | |
686 | - </div>"; | |
687 | - | |
688 | - echo "<div class='dates'> | |
689 | - <div class='row'> | |
690 | - <input type='text' name='form[date_start]' id='date_start_input' value='" . $dateStart . "'> | |
691 | - <img src='/img/calendar.gif' id='date_start'> | |
692 | - </div> | |
693 | - <div class='row'> | |
694 | - <input type='text' name='form[date_end]' id='date_end_input' value='" . $dateEnd . "'> | |
695 | - <img src='/img/calendar.gif' id='date_end'> | |
696 | - </div> | |
697 | - </div>"; | |
652 | + echo " | |
653 | + <div class='grid-search'> | |
654 | + <form action='" . GetFormUrl () . "' name='search' method='GET'> | |
655 | + <div class='search'> | |
656 | + <input type='text' name='look' id='grid-search' value='" . $_REQUEST['look'] . "'> | |
657 | + <select name='field'>"; | |
658 | + | |
659 | + foreach ($th as $key => $value) | |
660 | + { | |
661 | + if ($_REQUEST['field'] == $key) | |
662 | + { | |
663 | + $selected = 'selected="selected"'; | |
664 | + } | |
665 | + else | |
666 | + { | |
667 | + $selected = ''; | |
668 | + } | |
669 | + echo "<option value='$key' $selected>$value</option>"; | |
670 | + } | |
671 | + | |
672 | + echo "</select> | |
673 | + <input type='submit' value='ïîèñê'> | |
674 | + <input type='hidden' name='status' value='" . $_GET['status'] . "'> | |
675 | + </div>"; | |
698 | 676 | |
699 | - echo '<script type="text/javascript"> | |
677 | + echo " | |
678 | + <div class='dates'> | |
679 | + <div class='row'> | |
680 | + <input type='text' name='form[date_start]' id='date_start_input' value='" . $dateStart . "'> | |
681 | + <img src='/img/calendar.gif' id='date_start'> | |
682 | + </div> | |
683 | + <div class='row'> | |
684 | + <input type='text' name='form[date_end]' id='date_end_input' value='" . $dateEnd . "'> | |
685 | + <img src='/img/calendar.gif' id='date_end'> | |
686 | + </div> | |
687 | + </div>"; | |
688 | + | |
689 | + echo ' | |
690 | + <script type="text/javascript"> | |
700 | 691 | Calendar.setup( |
701 | 692 | { |
702 | - inputField : "date_start_input", // ID of the input field | |
703 | - ifFormat : "%Y-%m-%d", // the date format | |
693 | + inputField : "date_start_input", | |
694 | + ifFormat : "%Y-%m-%d", | |
704 | 695 | button : "date_start" |
705 | 696 | } |
706 | 697 | ); |
707 | 698 | </script>'; |
708 | - | |
709 | - echo '<script type="text/javascript"> | |
699 | + | |
700 | + echo ' | |
701 | + <script type="text/javascript"> | |
710 | 702 | Calendar.setup( |
711 | 703 | { |
712 | - inputField : "date_end_input", // ID of the input field | |
713 | - ifFormat : "%Y-%m-%d", // the date format | |
704 | + inputField : "date_end_input", | |
705 | + ifFormat : "%Y-%m-%d", | |
714 | 706 | button : "date_end" |
715 | 707 | } |
716 | 708 | ); |
717 | 709 | </script>'; |
718 | 710 | |
719 | - echo "<input type='hidden' name='search' value='ok'> | |
720 | - | |
721 | - </form> | |
722 | - </div>"; | |
711 | + echo " | |
712 | + <input type='hidden' name='search' value='ok'> | |
713 | + </form> | |
714 | + </div>"; | |
723 | 715 | |
724 | 716 | // =========== Ãåíåðèì òàáëèöó =========== |
725 | 717 | |
... | ... | @@ -949,20 +941,20 @@ if (! isset ($_GET['action'])) |
949 | 941 | |
950 | 942 | <div class='status-tabs' style=\"" . $lll . "\" onclick=\"location.href='" . urlQueryChange2 ('stat', "1") . "&page=1'\">Êîðçèíà</div>"; |
951 | 943 | echo " |
952 | - <div class='status-tabs'> | |
953 | - <a href=\"/order/index.php\" target=\"_blank\" style=\"text-decoration:none; color:#157100\">Ñòàòèñòèêà çàêàçîâ</a> | |
954 | - </div> | |
955 | - </div> | |
956 | - <!--<div class='clear'></div> | |
957 | - <div onclick=\"location.href='?pr=1&status=1&page=1'\" style=\"" . $yyyyyt . "cursor:pointer; float: left; font-family: Arial,Helvetica,sans-serif; font-size: 12px; margin-left:25px;\"> | |
958 | - Ïðîñòð. (" . $row3['count'] . ") | |
959 | - </div> | |
960 | - | |
961 | - <div onclick=\"location.href='?prs=1&status=2&page=1'\" style=\"" . $yyyyyt2 . "cursor:pointer; float: left; font-family: Arial,Helvetica,sans-serif; font-size: 12px; margin-left:45px;\"> | |
962 | - Ïðîñòð. (" . $row4['count'] . ") | |
963 | - </div>--> | |
964 | -<div class='clear'></div> | |
965 | -<div> </div> | |
944 | + <div class='status-tabs'> | |
945 | + <a href=\"/order/index.php\" target=\"_blank\" style=\"text-decoration:none; color:#157100\">Ñòàòèñòèêà çàêàçîâ</a> | |
946 | + </div> | |
947 | + </div> | |
948 | + <!--<div class='clear'></div> | |
949 | + <div onclick=\"location.href='?pr=1&status=1&page=1'\" style=\"" . $yyyyyt . "cursor:pointer; float: left; font-family: Arial,Helvetica,sans-serif; font-size: 12px; margin-left:25px;\"> | |
950 | + Ïðîñòð. (" . $row3['count'] . ") | |
951 | + </div> | |
952 | + | |
953 | + <div onclick=\"location.href='?prs=1&status=2&page=1'\" style=\"" . $yyyyyt2 . "cursor:pointer; float: left; font-family: Arial,Helvetica,sans-serif; font-size: 12px; margin-left:45px;\"> | |
954 | + Ïðîñòð. (" . $row4['count'] . ") | |
955 | + </div>--> | |
956 | + <div class='clear'></div> | |
957 | + <div> </div> | |
966 | 958 | "; |
967 | 959 | |
968 | 960 | // =================== |
... | ... | @@ -1085,132 +1077,7 @@ if (! isset ($_GET['action'])) |
1085 | 1077 | print "</td> |
1086 | 1078 | "; |
1087 | 1079 | print "<td>" . $order['smst'] . "</td>"; |
1088 | - /* | |
1089 | - * echo"<div class='orders'>"; | |
1090 | - * | |
1091 | - * echo"<div class='order-info-all'> | |
1092 | - * | |
1093 | - * <div class=order-info> | |
1094 | - * <h4>Çàêàç #".$order['order_id']."<br> | |
1095 | - * Äàòà: ".date('Y-m-d H:i:s',$order['order_date'])." | |
1096 | - * </h4> | |
1097 | - * <fieldset id='order-info' style=\"background:".$order['group_color'].";\"> | |
1098 | - * <legend>Êëèåíò</legend> | |
1099 | - * | |
1100 | - * <label>Êëèåíò:</label> | |
1101 | - * <div class=info><a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>".$order['username']."</a> </div> | |
1102 | - * | |
1103 | - * <label>Òåë:</label> | |
1104 | - * <div class=info>".$order['tel']." </div> | |
1105 | - * | |
1106 | - * <label>Òåë 2:</label> | |
1107 | - * <div class=info>".$order['tel2']." </div> | |
1108 | - * | |
1109 | - * <label>Ãðóïïà:</label> | |
1110 | - * <div class=info>".viewBook('zlo_users_group', $order['group'], 'id', 'name')." </div> | |
1111 | - * | |
1112 | - * <div class=clear></div> | |
1113 | - * <a class='history' href='/admin.php/orders/?action=show&user=".$order['user_id']."'>[Èñòîðèÿ çàêàçîâ]</a> | |
1114 | - * | |
1115 | - * </fieldset> | |
1116 | - * | |
1117 | - * <fieldset id='order-info' style='background:".$order['group_color'].";'> | |
1118 | - * <legend>Äîñòàâêà</legend> | |
1119 | - * | |
1120 | - * <label>Äîñòàâêà:</label> | |
1121 | - * <div class=info>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." </div> | |
1122 | - * | |
1123 | - * <label>Ãîðîä:</label> | |
1124 | - * <div class=info>".$order['city']." </div> | |
1125 | - * | |
1126 | - * <label>Àäðåñ:</label> | |
1127 | - * <div class=info>".$order['address']." </div> | |
1128 | - * | |
1129 | - * <label>Èíôî:</label> | |
1130 | - * <div class=info> ".$order['comment']." </div> | |
1131 | - * | |
1132 | - * <div class=clear></div> | |
1133 | - * | |
1134 | - * </fieldset> | |
1135 | - * <div class=clear></div> | |
1136 | - * </div> | |
1137 | - * </div>"; | |
1138 | - */ | |
1139 | - | |
1140 | - // Òàáëèöà òîâàðîâ | |
1141 | - /* | |
1142 | - * echo" | |
1143 | - * <div class='order-details'> | |
1144 | - * <fieldset id='order-details'> | |
1145 | - * <legend>Òîâàðû</legend>"; | |
1146 | - * echo"<table> | |
1147 | - * <tr> | |
1148 | - * <td>¹</td> | |
1149 | - * <td>Êîä</td> | |
1150 | - * <td>Áðåíä</td> | |
1151 | - * <td>Íàçâàíèå</td> | |
1152 | - * <td>Ðàçìåð</td> | |
1153 | - * <td>Öâåò</td> | |
1154 | - * <td>Êîë.</td> | |
1155 | - * <td>Öåíà</td> | |
1156 | - * <td>Ñóììà</td> | |
1157 | - * <td>Íàëè÷èå</td> | |
1158 | - * <td></td> | |
1159 | - * </tr>"; | |
1160 | - * | |
1161 | - * $sql3 = " | |
1162 | - * SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* | |
1163 | - * FROM catalogs_orders AS o | |
1164 | - * LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
1165 | - * LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
1166 | - * LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
1167 | - * WHERE o.id='".$order['order_id']."'"; | |
1168 | - * $result3 = mysql_query($sql3) or die(mysql_error()); | |
1169 | - * if (mysql_affected_rows()!=0) { | |
1170 | - * while ($item=mysql_fetch_assoc($result3)) { { $i++; | |
1171 | - * | |
1172 | - * | |
1173 | - * // íàëè÷èå òîâàðà | |
1174 | - * $sql5 = "SELECT c.name as city, o.count | |
1175 | - * FROM catalogs_keys_products_cities as o | |
1176 | - * LEFT JOIN catalogs_cities as c | |
1177 | - * ON o.city_id=c.id | |
1178 | - * WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | |
1179 | - * $result5 = mysql_query($sql5) or die(mysql_error()); | |
1180 | - * if (mysql_affected_rows()!=0) { | |
1181 | - * $onStockDesc=''; | |
1182 | - * while ($onStock=mysql_fetch_assoc($result5)) { | |
1183 | - * $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | |
1184 | - * } | |
1185 | - * } else { $onStockDesc='íåò'; } | |
1186 | - * | |
1187 | - * echo"<tr> | |
1188 | - * <td>$i .</td> | |
1189 | - * <td>".$item['code']."</td> | |
1190 | - * <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | |
1191 | - * <td><a href='/".$item['rubric_id']."-catalogs/".$item['translit']."-".$item['id']."/' target='_new'>".$item['name']."</a></td> | |
1192 | - * <td>".$item['size']."</td> | |
1193 | - * <td>".$item['color']."</td> | |
1194 | - * <td>".$item['count']."</td> | |
1195 | - * <td>".$item['cine']."</td> | |
1196 | - * <td>".($item['cine']*$item['count'])."</td> | |
1197 | - * <td>".$onStockDesc."</td> | |
1198 | - * <td></td> | |
1199 | - * </tr>"; | |
1200 | - * | |
1201 | - * } | |
1202 | - * | |
1203 | - * } | |
1204 | - * } | |
1205 | - * | |
1206 | - * echo"</table> | |
1207 | - * <b>Îáùàÿ ñóììà: ".$order['total']." ãðí.</b> | |
1208 | - * </div>"; | |
1209 | - * | |
1210 | - * | |
1211 | - * | |
1212 | - * echo"<div class='clear'></div>"; | |
1213 | - */ | |
1080 | + | |
1214 | 1081 | // ***** Àäìèí ðåæèì ***** |
1215 | 1082 | if (isset ($_SESSION['admin']['edit1'])) |
1216 | 1083 | { |
... | ... | @@ -1387,22 +1254,28 @@ if (! isset ($_GET['action'])) |
1387 | 1254 | <div class=info> |
1388 | 1255 | <input type='text' name='user[email]' value='" . $order['email'] . "' style='width:300px;' disabled='disabled'> |
1389 | 1256 | <input type='hidden' name='user[email]' value='" . $order['email'] . "'> |
1390 | - </div> | |
1257 | + </div>"; | |
1258 | + | |
1259 | + // ==== TEL ==== | |
1260 | + | |
1261 | + $disabled_tel = $_SESSION['admin']['group'] == 1 ? '' : "disabled='disabled'"; | |
1391 | 1262 | |
1263 | + echo " | |
1392 | 1264 | <label>Òåëåôîí:</label> |
1393 | - <div class=info> | |
1394 | - <input type='text' name='user[tel]' value='" . $order['tel'] . "' style='width:270px;' disabled='disabled'> | |
1265 | + <div class='info tel'> | |
1266 | + <input type='text' name='user[tel]' value='" . $order['tel'] . "' style='width:270px;' ".$disabled_tel."> | |
1395 | 1267 | <input type='hidden' name='user[tel]' value='" . $order['tel'] . "'> |
1396 | 1268 | <input type='checkbox' name='sms_tel[]' id='sms_tel1' value='" . $order['tel'] . "'> |
1397 | 1269 | </div> |
1398 | 1270 | |
1399 | 1271 | <label>Òåëåôîí 2:</label> |
1400 | - <div class=info> | |
1401 | - <input type='text' name='user[tel2]' value='" . $order['tel2'] . "' style='width:270px;' disabled='disabled'> | |
1272 | + <div class='info tel'> | |
1273 | + <input type='text' name='user[tel2]' value='" . $order['tel2'] . "' style='width:270px;' ".$disabled_tel."> | |
1402 | 1274 | <input type='hidden' name='user[tel2]' value='" . $order['tel2'] . "'> |
1403 | 1275 | <input type='checkbox' name='sms_tel[]' id='sms_tel2' value='" . $order['tel2'] . "'> |
1404 | - </div> | |
1276 | + </div>"; | |
1405 | 1277 | |
1278 | + echo " | |
1406 | 1279 | <label>¹ êàðòî÷êè:</label> |
1407 | 1280 | <div class=info> |
1408 | 1281 | <input type='text' name='user[cards]' value='" . $order['cards'] . "' style='width:300px;' disabled='disabled'> |
... | ... | @@ -1434,25 +1307,26 @@ if (! isset ($_GET['action'])) |
1434 | 1307 | <br />Îòïðàâëåíî ÑÌÑ (" . $sms_count . ")</div>"; |
1435 | 1308 | echo "</div>"; |
1436 | 1309 | |
1437 | - echo "</div> | |
1310 | + echo "</div> | |
1438 | 1311 | <div style='float:right;'> |
1439 | 1312 | <label>Äîñòàâêà</label>"; |
1440 | - echo " | |
1313 | + | |
1314 | + echo " | |
1441 | 1315 | <div class=info> |
1442 | 1316 | <select name='user[delivery]' style='width:300px'>"; |
1443 | 1317 | viewBookSelectValue ('zlo_book_delivery', 'id', 'title', $order['delivery']); |
1444 | 1318 | echo "</select> |
1445 | 1319 | </div>"; |
1446 | 1320 | |
1447 | - echo " | |
1321 | + echo " | |
1448 | 1322 | <label>Äåêëàðàöèÿ ¹:</label> |
1449 | 1323 | <div class=info><input type='text' name='user[declaration]' style='width:300px;' class=\"validate[required]\" value='" . $order['declaration'] . "' id='declarationValidate'></div>"; |
1450 | 1324 | |
1451 | - echo " | |
1325 | + echo " | |
1452 | 1326 | <label>¹ ñêëàäà:</label> |
1453 | 1327 | <div class=info><input type='text' name='user[warehouse]' style='width:300px;' class=\"validate[required]\" value='" . $order['warehouse'] . "' id='warehouseValidate'></div>"; |
1454 | 1328 | |
1455 | - echo " | |
1329 | + echo " | |
1456 | 1330 | <label>¹ íàêëàäíîé:</label> |
1457 | 1331 | <div class=info><input type='text' name='user[nakladnaya]' style='width:300px;' class=\"validate[required]\" value='" . $order['nakladnaya'] . "' id='nakladnayaValidate'></div>"; |
1458 | 1332 | |
... | ... | @@ -1464,7 +1338,7 @@ if (! isset ($_GET['action'])) |
1464 | 1338 | "Íàëîæåííûì ïëàòåæîì", |
1465 | 1339 | "Îïëàòèòü íà Áàíê Áîãóñëàâ" |
1466 | 1340 | ); |
1467 | - echo " | |
1341 | + echo " | |
1468 | 1342 | <div class=info> |
1469 | 1343 | <label>Ñïîñîá îïëàòû:</label> |
1470 | 1344 | <select name='user[payment]' style='width:300px'><option value=''></option>"; |
... | ... | @@ -1478,14 +1352,14 @@ if (! isset ($_GET['action'])) |
1478 | 1352 | echo "</select> |
1479 | 1353 | </div>"; |
1480 | 1354 | |
1481 | - echo "<label>Ñòðàõîâêà:</label> | |
1355 | + echo "<label>Ñòðàõîâêà:</label> | |
1482 | 1356 | <div class=info><input type='text' name='user[insurance]' style='width:300px;' class=\"validate[required]\" value='" . $order['insurance'] . "' id='insuranceValidate'></div>"; |
1483 | 1357 | $sumn_disabled = ""; |
1484 | 1358 | if ($_SESSION['admin']['id'] == 22 || $_SESSION['admin']['id'] == 7 || $_SESSION['admin']['id'] == 1 || $_SESSION['admin']['id'] == 19) |
1485 | 1359 | $sumn_disabled = ""; |
1486 | 1360 | else |
1487 | 1361 | $sumn_disabled = "disabled"; |
1488 | - echo "<label>Ñóììà íàëîæåííîãî:</label> | |
1362 | + echo "<label>Ñóììà íàëîæåííîãî:</label> | |
1489 | 1363 | <div class=info><input type='text' name='user[sumn]' style='width:300px;' class=\"validate[required]\" value='" . $order['sumn'] . "' id='sumnValidate' $sumn_disabled></div><br />"; |
1490 | 1364 | $array_method = array ( |
1491 | 1365 | "Ïîëó÷àòåëÿ", |
... | ... | @@ -1523,9 +1397,11 @@ if (! isset ($_GET['action'])) |
1523 | 1397 | } |
1524 | 1398 | } |
1525 | 1399 | // print_r($_SESSION['admin']['group']); |
1526 | - echo "<label>Ìåíåäæåð:</label> | |
1527 | - <div class=info><select name='meneger' $disabled> | |
1528 | - <option value='0' " . (($_SESSION['admin']['group'] != 1) ? 'disabled' : '') . "></option>"; | |
1400 | + echo " | |
1401 | + <label>Ìåíåäæåð:</label> | |
1402 | + <div class=info><select name='meneger' $disabled> | |
1403 | + <option value='0' " . (($_SESSION['admin']['group'] != 1) ? 'disabled' : '') . "></option>"; | |
1404 | + | |
1529 | 1405 | $selected = ($order['meneger'] > 0) ? $order['meneger'] : $_SESSION['admin']['id']; |
1530 | 1406 | |
1531 | 1407 | $result_1 = mysql_query ("select * from zlo_admin"); |
... | ... | @@ -1545,12 +1421,16 @@ if (! isset ($_GET['action'])) |
1545 | 1421 | { |
1546 | 1422 | $disabled = "disabled"; |
1547 | 1423 | } |
1548 | - echo "<label>×åê:</label> | |
1549 | - <div class=info><input $disabled type='text' name='user[check]' style='width:300px;' class=\"validate[required]\" value='" . $order['check2'] . "' id='checkValidate'></div>"; | |
1424 | + | |
1425 | + echo " | |
1426 | + <label>×åê:</label> | |
1427 | + <div class=info><input $disabled type='text' name='user[check]' style='width:300px;' class=\"validate[required]\" value='" . $order['check2'] . "' id='checkValidate'></div>"; | |
1428 | + | |
1550 | 1429 | if ($disabled == "disabled") |
1551 | 1430 | { |
1552 | 1431 | echo "<input type='hidden' name='user[check]' value='" . $order['check2'] . "'>"; |
1553 | 1432 | } |
1433 | + | |
1554 | 1434 | echo "<label>SMS:</label> |
1555 | 1435 | <div class=info><input type='text' name='user[smst]' style='width:300px;' class=\"validate[required]\" value='" . $order['smst'] . "' id='smstValidate'></div>"; |
1556 | 1436 | |
... | ... | @@ -1559,15 +1439,15 @@ if (! isset ($_GET['action'])) |
1559 | 1439 | <div class=clear></div> |
1560 | 1440 | </div>"; |
1561 | 1441 | |
1562 | - // Òàáëèöà òîâàðîâ | |
1563 | - | |
1564 | - $sql3 = "SELECT * FROM catalogs_orders_products | |
1565 | - WHERE `order_id`='" . $order['order_id'] . "' "; | |
1566 | - $result3 = mysql_query ($sql3) or die (mysql_error ()); | |
1567 | - if (mysql_affected_rows () != 0) | |
1568 | - { | |
1569 | - $i = 0; | |
1570 | - echo " | |
1442 | + // Òàáëèöà òîâàðîâ | |
1443 | + | |
1444 | + $sql3 = "SELECT * FROM catalogs_orders_products | |
1445 | + WHERE `order_id`='" . $order['order_id'] . "' "; | |
1446 | + $result3 = mysql_query ($sql3) or die (mysql_error ()); | |
1447 | + if (mysql_affected_rows () != 0) | |
1448 | + { | |
1449 | + $i = 0; | |
1450 | + echo " | |
1571 | 1451 | <fieldset id='order-details'> |
1572 | 1452 | <legend>Òîâàðû</legend> |
1573 | 1453 | <div class='table'> |
... | ... | @@ -1610,24 +1490,24 @@ if (! isset ($_GET['action'])) |
1610 | 1490 | <div class='reservation'><input type='text' size='3' name='item[reservation][]' /></div> |
1611 | 1491 | <div class='status'>"; |
1612 | 1492 | echo '<input type="text" class="input_status" name="item[status][]" data-id="1" id="input_status_1" size="5" value="" /> |
1613 | - <div class="status_box" id="status_box_1" data-id="1"> | |
1614 | - <ul> | |
1615 | - <li data-id="1" class="name_city">Ì?</li> | |
1616 | - <li data-id="1" class="name_city">Ìñòîê?</li> | |
1617 | - <li data-id="1" class="name_city">Ãî?</li> | |
1618 | - <li data-id="1" class="name_city">Ãð?</li> | |
1619 | - <li data-id="1" class="name_city">Õ?</li> | |
1620 | - <li data-id="1" class="name_city">Î?</li> | |
1621 | - <li data-id="1" class="name_city">Ä?</li> | |
1622 | - <li data-id="1" class="name_city">Á?</li> | |
1623 | - <li data-id="1" class="name_city">Á2?</li> | |
1624 | - <li data-id="1" class="name_city">Îñîê?</li> | |
1625 | - <li data-id="1" class="name_city">áðàê</li> | |
1626 | - <li data-id="1" class="name_city">áðîíü</li> | |
1627 | - <li data-id="1" class="name_city">âåðíåò</li> | |
1628 | - <li data-id="1" class="other"><i>Ââåäèòå</i></li> | |
1629 | - </ul> | |
1630 | - </div>'; | |
1493 | + <div class="status_box" id="status_box_1" data-id="1"> | |
1494 | + <ul> | |
1495 | + <li data-id="1" class="name_city">Ì?</li> | |
1496 | + <li data-id="1" class="name_city">Ìñòîê?</li> | |
1497 | + <li data-id="1" class="name_city">Ãî?</li> | |
1498 | + <li data-id="1" class="name_city">Ãð?</li> | |
1499 | + <li data-id="1" class="name_city">Õ?</li> | |
1500 | + <li data-id="1" class="name_city">Î?</li> | |
1501 | + <li data-id="1" class="name_city">Ä?</li> | |
1502 | + <li data-id="1" class="name_city">Á?</li> | |
1503 | + <li data-id="1" class="name_city">Á2?</li> | |
1504 | + <li data-id="1" class="name_city">Îñîê?</li> | |
1505 | + <li data-id="1" class="name_city">áðàê</li> | |
1506 | + <li data-id="1" class="name_city">áðîíü</li> | |
1507 | + <li data-id="1" class="name_city">âåðíåò</li> | |
1508 | + <li data-id="1" class="other"><i>Ââåäèòå</i></li> | |
1509 | + </ul> | |
1510 | + </div>'; | |
1631 | 1511 | echo "</div>"; |
1632 | 1512 | |
1633 | 1513 | echo " |
... | ... | @@ -1892,106 +1772,15 @@ if (! isset ($_GET['action'])) |
1892 | 1772 | { |
1893 | 1773 | echo "<p>Ïóñòî</p>"; |
1894 | 1774 | } |
1895 | - | |
1896 | - // ===================== | |
1897 | - // ===== javascript ==== | |
1898 | - // ===================== | |
1899 | - | |
1900 | - echo ' | |
1901 | - <script language="JavaScript"> | |
1902 | - jQuery(document).ready(function() { | |
1903 | - | |
1904 | - jQuery(".input_status").click(function() { | |
1905 | - $( "#status_box_"+$(this).attr("data-id") ).show(); | |
1906 | - }) | |
1907 | - | |
1908 | - $( ".status_box ul li.name_city" ).click(function(){ | |
1909 | - $("#input_status_"+$(this).attr("data-id")).val($(this).text()); | |
1910 | - $( ".status_box" ).hide(); | |
1911 | - }); | |
1912 | - $( ".status_box ul li.other" ).click(function(){ | |
1913 | - $("#input_status_"+$(this).attr("data-id")).val(""); | |
1914 | - $( ".status_box" ).hide(); | |
1915 | - $("#input_status_"+$(this).attr("data-id")).focus(); | |
1916 | - }); | |
1917 | - | |
1918 | - }); | |
1919 | - </script>'; | |
1920 | - | |
1921 | - echo ' | |
1922 | - <script> | |
1923 | - | |
1924 | - | |
1925 | - jQuery(document).ready(function() | |
1926 | - { | |
1927 | - $(".need-confirm").click(function(e) | |
1928 | - { | |
1929 | - e.preventDefault(); | |
1930 | - | |
1931 | - if (confirm ("Âû äåéñòâèòåëüíî æåëàåòå óäàëèòü?") == true) | |
1932 | - { | |
1933 | - window.location = $(this).attr("href"); | |
1934 | - | |
1935 | - return true; | |
1936 | - } | |
1937 | - | |
1938 | - return false; | |
1939 | - }); | |
1940 | - | |
1941 | - $( "#sms_tpl" ).change(function() { | |
1942 | - $.get("/ajax/sms_tpl.php", { tplID: this.value },function(data) { | |
1943 | - $("#sms_msg").val(data); | |
1944 | - $("#sms_c").html($("#sms_msg").val().length); | |
1945 | - }); | |
1946 | - }); | |
1947 | - | |
1948 | - $( "#sms_send" ).click(function() { | |
1949 | - if($("#sms_tel1").attr("checked") || $("#sms_tel2").attr("checked")) { | |
1950 | - return true; | |
1951 | - }else{ | |
1952 | - alert("Íå óêàçàí íîìåð òåëåôîíà!"); | |
1953 | - return false; | |
1954 | - } | |
1955 | - }); | |
1956 | - | |
1957 | - w=120; | |
1958 | - $( "input[name=\'sms_type\']" ).click(function() { | |
1959 | - i = $("#sms_msg").val().length; | |
1960 | - if(this.value=="l"){w=120;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} | |
1961 | - else{w=70;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} | |
1962 | - $("#sms_c_sum").html(w); | |
1963 | - }); | |
1964 | - $("#sms_c_sum").html(w); | |
1965 | - | |
1966 | - | |
1967 | - $("#sms_msg").keyup(function(){ | |
1968 | - i = this.value.length; | |
1969 | - if(i>w){$("#sms_c").css( "color","red" );} | |
1970 | - else{$("#sms_c").css( "color","black" );} | |
1971 | - $("#sms_c").html(i); | |
1972 | - }); | |
1973 | - | |
1974 | - | |
1975 | - }); | |
1976 | - </script>'; | |
1977 | - | |
1978 | - echo " | |
1979 | - <script> | |
1980 | - jQuery(document).ready(function(){ | |
1981 | - // binds form submission and fields to the validation engine | |
1982 | - jQuery('#add-item').validationEngine(); | |
1983 | - }); | |
1984 | - </script>"; | |
1985 | - | |
1775 | + | |
1986 | 1776 | print '</td></tr>'; |
1987 | 1777 | } |
1988 | 1778 | |
1989 | 1779 | $i1 ++; |
1990 | 1780 | } |
1991 | - print "</table>"; | |
1992 | - | |
1993 | - print "<script type='text/javascript' src='/js/msg2.js'></script>"; | |
1994 | 1781 | |
1782 | + echo "</table>"; | |
1783 | + | |
1995 | 1784 | echo "</div>"; |
1996 | 1785 | |
1997 | 1786 | // === Pager |
... | ... | @@ -2264,14 +2053,14 @@ if (isset ($_GET['action']) && $_GET['action'] == 'edit') |
2264 | 2053 | |
2265 | 2054 | <label>Ìåòêà:</label> |
2266 | 2055 | <div class=info> |
2267 | - <select name='label'> | |
2268 | - "; | |
2269 | - for ($i = 0; $i <= 10; $i ++) | |
2270 | - { | |
2271 | - print '<option value="' . $i . '" ' . (($order['label'] == $i) ? 'selected' : '') . '>' . $i . '</option>'; | |
2272 | - } | |
2273 | - ; | |
2274 | - echo "</select> | |
2056 | + <select name='label'>"; | |
2057 | + | |
2058 | + for ($i = 0; $i <= 10; $i ++) | |
2059 | + { | |
2060 | + print '<option value="' . $i . '" ' . (($order['label'] == $i) ? 'selected' : '') . '>' . $i . '</option>'; | |
2061 | + } | |
2062 | + | |
2063 | + echo "</select> | |
2275 | 2064 | </div> |
2276 | 2065 | |
2277 | 2066 | <label>Êëèåíò:</label> |
... | ... | @@ -2301,9 +2090,9 @@ if (isset ($_GET['action']) && $_GET['action'] == 'edit') |
2301 | 2090 | <label>Äîñòàâêà</label>"; |
2302 | 2091 | echo " |
2303 | 2092 | <div class=info> |
2304 | - <select name='user[delivery]'>"; | |
2305 | - viewBookSelectValue ('zlo_book_delivery', 'id', 'title', $order['delivery']); | |
2306 | - echo "</select> | |
2093 | + <select name='user[delivery]'>"; | |
2094 | + viewBookSelectValue ('zlo_book_delivery', 'id', 'title', $order['delivery']); | |
2095 | + echo "</select> | |
2307 | 2096 | </div>"; |
2308 | 2097 | |
2309 | 2098 | echo " |
... | ... | @@ -2526,18 +2315,6 @@ if (isset ($_GET['action']) && $_GET['action'] == 'edit') |
2526 | 2315 | { |
2527 | 2316 | echo "<p>Ïóñòî</p>"; |
2528 | 2317 | } |
2529 | - | |
2530 | - // ===================== | |
2531 | - // ===== javascript ==== | |
2532 | - // ===================== | |
2533 | - | |
2534 | - echo " | |
2535 | - <script> | |
2536 | - jQuery(document).ready(function(){ | |
2537 | - // binds form submission and fields to the validation engine | |
2538 | - jQuery('#add-item').validationEngine(); | |
2539 | - }); | |
2540 | - </script>"; | |
2541 | 2318 | } |
2542 | 2319 | |
2543 | 2320 | // ============= | ... | ... |
account/admin/orders25.php deleted
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 | -if($_GET['test'] == "1"){ | |
14 | - | |
15 | -//eMailing('order-new',"5172", "11181"); | |
16 | - | |
17 | -} | |
18 | - | |
19 | - if(isset($_GET['orderID']) && isset($_GET['paid'])){ | |
20 | - $sql = sprintf("UPDATE catalogs_orders SET paid=%d WHERE id=%d", $_GET['paid'], $_GET['orderID']); | |
21 | - | |
22 | - mysql_query($sql); | |
23 | - }elseif(isset($_GET['label'])){ | |
24 | - $sql = sprintf("UPDATE catalogs_orders SET label=%d WHERE id=%d", $_GET['label'], $_GET['orderID']); | |
25 | - | |
26 | - mysql_query($sql); | |
27 | - } | |
28 | - | |
29 | - // ============= | |
30 | - // == status === | |
31 | - // ============= | |
32 | - | |
33 | -//print_r($_POST); | |
34 | -//exit; | |
35 | - if ((isset($_POST['action']) && $_POST['action']=='status') || trim($_POST['status'])!='') { | |
36 | - | |
37 | - | |
38 | - $sql = "UPDATE catalogs_orders SET status='".$_POST['status']."' WHERE `id`='".$_POST['order_id']."'"; | |
39 | - $result = mysql_query($sql) or die(mysql_error()); | |
40 | -//exit; | |
41 | - } | |
42 | - | |
43 | - // ==================== | |
44 | - // ===== order ======== | |
45 | - // ==================== | |
46 | - | |
47 | - // ============== | |
48 | - // ==== edit ==== | |
49 | - // ============== | |
50 | - | |
51 | - if(isset($_POST['sms_send'])){ | |
52 | - $sql = "insert into sms_history(order_id,mktime,text,user) values('".$_POST['order_id']."','".mktime()."','".$_POST['sms_msg']."','".$_SESSION['admin']['login']."')"; | |
53 | - mysql_query($sql); | |
54 | - foreach($_POST['sms_tel'] as $tel){ | |
55 | - sendSMS($tel,$_POST['sms_msg']); | |
56 | - } | |
57 | - } | |
58 | - elseif (isset($_POST['send']) && $_POST['send']=='edit-order') { | |
59 | - | |
60 | - | |
61 | - $error=''; | |
62 | - $error[] = ValidFormData($_POST['user']['email'],'email','email'); | |
63 | - $error[] = ValidFormData($_POST['user']['city'],'ãîðîä','require'); | |
64 | - $error[] = ValidFormData($_POST['user']['address'],'àäðåñ','require'); | |
65 | - $error[] = ValidFormData($_POST['user']['tel'],'ìîá.òåëåôîí','mobile'); | |
66 | - $error[] = ValidFormData($_POST['user']['username'],'èìÿ','require'); | |
67 | - | |
68 | - $alert=implode('\r\n',$error); | |
69 | - | |
70 | - $mass=array_filter($error); | |
71 | - if (empty($mass)) { | |
72 | - | |
73 | - $summary=0; | |
74 | - | |
75 | - // Ïðîâåðÿåì åñòü ëè óæå â çàêàçàõ | |
76 | - $sql="SELECT *, product_id as mod_id from catalogs_orders_products WHERE order_id='".$_POST['order_id']."'"; | |
77 | - $result = mysql_query($sql) or die(mysql_error()); | |
78 | - if(mysql_affected_rows()!=0){ | |
79 | - while($item=mysql_fetch_assoc($result)) { | |
80 | - $ordered[]=$item['mod_id']; | |
81 | - } | |
82 | - } | |
83 | - | |
84 | - // =========================================== | |
85 | - // ======= Ïðîâåðÿåì íà èçìåíåíèå =========== | |
86 | - // =========================================== | |
87 | - | |
88 | - $ChangesOfOrder = ChangesOfMass($_POST['item']['mod_id'],$ordered); | |
89 | - | |
90 | - // ========== | |
91 | - // == same == | |
92 | - // ========== | |
93 | - | |
94 | - if (isset($ChangesOfOrder['same'])) { | |
95 | - | |
96 | - $mass=array_filter($ChangesOfOrder['same']); | |
97 | - if (!empty($mass)) { | |
98 | - | |
99 | - foreach ($ChangesOfOrder['same'] as $value) { | |
100 | - | |
101 | - // Óçíàåì key(èíäåêñ) â ìàññèâå | |
102 | - $i=array_keys($_POST['item']['mod_id'], $value); $i=$i[0]; | |
103 | - | |
104 | - // Îáíîâëÿåì êîëè÷åñòâî | |
105 | - $sql2 = "UPDATE catalogs_orders_products SET `count`='".$_POST['item']['quant'][$i]."',`reservation`='".$_POST['item']['reservation'][$i]."' WHERE order_id='".$_POST['order_id']."' AND product_id='".$_POST['item']['mod_id'][$i]."'"; | |
106 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
107 | - | |
108 | - // Ñóììà âñåãî çàêàçà | |
109 | - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); | |
110 | - } | |
111 | - } | |
112 | - } | |
113 | - | |
114 | - // ========== | |
115 | - // === add == | |
116 | - // ========== | |
117 | - | |
118 | - if (isset($ChangesOfOrder['add'])) { | |
119 | - | |
120 | - $mass=array_filter($ChangesOfOrder['add']); | |
121 | - if (!empty($mass)) { | |
122 | - | |
123 | - foreach ($ChangesOfOrder['add'] as $value) { | |
124 | - | |
125 | - // Óçíàåì key(èíäåêñ) â ìàññèâå | |
126 | - $i=array_keys($_POST['item']['mod_id'], $value); $i=$i[0]; | |
127 | - | |
128 | - // Äîáàâëÿåì òîâàðû | |
129 | - $sql2=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,code,product_cine_id,count,reservation) VALUES (%s,%s,%s,%s,%s,%s)", | |
130 | - GetSQLValueString($_POST['order_id'], "text"), | |
131 | - GetSQLValueString($_POST['item']['mod_id'][$i], "text"), | |
132 | - GetSQLValueString($_POST['item']['code'][$i], "text"), | |
133 | - GetSQLValueString($_POST['item']['price'][$i], "text"), | |
134 | - GetSQLValueString($_POST['item']['quant'][$i], "text"), | |
135 | - GetSQLValueString($_POST['item']['reservation'][$i], "text")); | |
136 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
137 | - | |
138 | - // Ñóììà âñåãî çàêàçà | |
139 | - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); | |
140 | - } | |
141 | - } | |
142 | - } | |
143 | - | |
144 | - // ========== | |
145 | - // == del === | |
146 | - // ========== | |
147 | - /* | |
148 | - if (isset($ChangesOfOrder['del'])) { | |
149 | - | |
150 | - $mass=array_filter($ChangesOfOrder['del']); | |
151 | - if (!empty($mass)) { | |
152 | - | |
153 | - foreach ($ChangesOfOrder['del'] as $value) { | |
154 | - | |
155 | - // Äîáàâëÿåì òîâàðû | |
156 | - $sql2="DELETE FROM catalogs_orders_products WHERE order_id='".$_POST['order_id']."' AND product_id='".$value."'"; | |
157 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
158 | - } | |
159 | - } | |
160 | - } | |
161 | - */ | |
162 | - // =========== | |
163 | - // == ÂÑÅÃÎ == | |
164 | - // =========== | |
165 | - | |
166 | - | |
167 | - if (isset($summary)) { | |
168 | - //if(trim($_POST['label'])) $_POST['label'] = 1; | |
169 | -//print_r($_POST); | |
170 | - // Îáíîâëÿåì äàííûå çàêàçà | |
171 | - $sql2=sprintf("UPDATE catalogs_orders SET cards=%s,insurance=%s,warehouse=%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 WHERE id='".$_POST['order_id']."'", | |
172 | - GetSQLValueString($_POST['user']['cards'], "text"), | |
173 | - GetSQLValueString($_POST['user']['insurance'], "text"), | |
174 | - GetSQLValueString($_POST['user']['warehouse'], "text"), | |
175 | - GetSQLValueString($_POST['cost_delivery'], "text"), | |
176 | - $_POST['paid'], | |
177 | - $_POST['cause'], | |
178 | - $_POST['label'], | |
179 | - $_POST['user']['delivery'], | |
180 | - GetSQLValueString($_POST['user']['declaration'], "text"), | |
181 | - GetSQLValueString($_POST['user']['payment'], "text"), | |
182 | - GetSQLValueString($_POST['user']['city'], "text"), | |
183 | - GetSQLValueString($_POST['user']['address'], "text"), | |
184 | - GetSQLValueString($_POST['user']['comment'], "text"), | |
185 | - GetSQLValueString($_POST['user']['mcomment'], "text"), | |
186 | - GetSQLValueString($summary, "text"), | |
187 | - $_POST['meneger']); | |
188 | - | |
189 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
190 | - | |
191 | - eMailing('xml',$_POST['user_id'], $_POST['order_id']); | |
192 | - | |
193 | - } else { | |
194 | - | |
195 | - //$sql2="DELETE FROM catalogs_orders WHERE id='".$_POST['order_id']."'"; | |
196 | - //$result2 = mysql_query($sql2) or die(mysql_error()); | |
197 | - } | |
198 | - | |
199 | - GoBack(1); | |
200 | - | |
201 | - } else { | |
202 | - | |
203 | - echo"<script language=\"JavaScript\">alert('$alert')</script>"; | |
204 | - | |
205 | - } | |
206 | - | |
207 | - } | |
208 | - | |
209 | - // ============== | |
210 | - // ==== add ===== | |
211 | - // ============== | |
212 | - | |
213 | - if (isset($_POST['send']) && $_POST['send']=='add-order') { | |
214 | - | |
215 | - // Ïðîâåðÿåì äûáèë ëè àäìèí | |
216 | - $debil==false; | |
217 | - | |
218 | - for($i=1; $i<=count($_POST['item']); $i++) { | |
219 | - if(isset($_POST['item']['mod_id'][$i]) && $_POST['item']['mod_id'][$i]=='') { $debil=true; } | |
220 | - } | |
221 | - | |
222 | - if( $debil==false) { | |
223 | - | |
224 | - // $error=''; | |
225 | - // $error[] = ValidFormData($_POST['user']['email'],'email','email'); | |
226 | - // $error[] = ValidFormData($_POST['user']['city'],'ãîðîä','require'); | |
227 | - // $error[] = ValidFormData($_POST['user']['address'],'àäðåñ','require'); | |
228 | - // $error[] = ValidFormData($_POST['user']['tel'],'ìîá.òåëåôîí','mobile'); | |
229 | - // $error[] = ValidFormData($_POST['user']['username'],'èìÿ','require'); | |
230 | - | |
231 | - // $alert=implode('\r\n',$error); | |
232 | - | |
233 | - // $mass=array_filter($error); | |
234 | - // if (empty($mass)) { | |
235 | - | |
236 | - // Ïðîâåðÿåì ñóùåñòâóåò ëè ïîëüçîâàòåëü | |
237 | - // $sql="SELECT * FROM zlo_users WHERE email='".$_POST['user']['email']."' "; | |
238 | - // $result = mysql_query($sql) or die(mysql_error()); | |
239 | - // if (mysql_affected_rows()!=0) { | |
240 | - | |
241 | - // } | |
242 | - | |
243 | - $time=mktime(); | |
244 | - $date=date('Y-m-d H:i:s',$time); | |
245 | - | |
246 | - // Åñëè ñîçäàåì íîâîãî ïîëüçîâàòåëü | |
247 | - if($_POST['user']['user_id']=='' || $_POST['user']['user_id']==0 || $_POST['user']['user_id']=='0') { | |
248 | - | |
249 | - if (strpos($_POST['user']['email'],"@user.com")) { | |
250 | - $_POST['user']['group']=1; | |
251 | - } else { | |
252 | - $_POST['user']['group']=2; | |
253 | - } | |
254 | - | |
255 | - // Äîáàâëÿåì ïîëüçîâàòåëÿ | |
256 | - $pass=generate_password(6); | |
257 | - $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)", | |
258 | - GetSQLValueString($pass, "text"), | |
259 | - GetSQLValueString($_POST['user']['email'], "text"), | |
260 | - GetSQLValueString($_POST['user']['city'], "text"), | |
261 | - GetSQLValueString($_POST['user']['address'], "text"), | |
262 | - GetSQLValueString($_POST['user']['tel'], "text"), | |
263 | - GetSQLValueString($date, "text"), | |
264 | - GetSQLValueString($_POST['user']['username'], "text"), | |
265 | - GetSQLValueString($_POST['user']['tel2'], "text"), | |
266 | - GetSQLValueString($_POST['user']['group'], "int")); | |
267 | - $result = mysql_query($sql) or die(mysql_error()); | |
268 | - | |
269 | - // Óçíàåì ID ïîëüçîâàòåëÿ | |
270 | - $sql="SELECT id FROM zlo_users WHERE registered='$date' AND tel='".$_POST['user']['tel']."'"; | |
271 | - $result = mysql_query($sql) or die(mysql_error()); | |
272 | - if (mysql_affected_rows()!=0) { | |
273 | - $user=mysql_fetch_assoc($result); | |
274 | - | |
275 | - // Øëåì ïèñüìà | |
276 | - if($user['group']!=1) { | |
277 | - eMailing('reg',$user['id']); | |
278 | - } | |
279 | - | |
280 | - $_POST['user']['user_id']=$user['id']; | |
281 | - | |
282 | - } else { echo "íåò ïîëüçîâàòåëÿ";} | |
283 | - | |
284 | - } | |
285 | - | |
286 | - // Äîáàâëÿåì çàêàç | |
287 | - $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,status) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,1)", | |
288 | - GetSQLValueString($_POST['cost_delivery'], "text"), | |
289 | - GetSQLValueString($_POST['user']['cards'], "text"), | |
290 | - GetSQLValueString($_POST['user']['insurance'], "text"), | |
291 | - GetSQLValueString($_POST['user']['warehouse'], "text"), | |
292 | - GetSQLValueString($_POST['paid'], "text"), | |
293 | - GetSQLValueString($_POST['label'], "text"), | |
294 | - GetSQLValueString($_POST['user']['delivery'], "text"), | |
295 | - GetSQLValueString($_POST['user']['declaration'], "text"), | |
296 | - GetSQLValueString($_POST['user']['payment'], "text"), | |
297 | - GetSQLValueString($_POST['user']['user_id'], "text"), | |
298 | - GetSQLValueString($_POST['user']['username'], "text"), | |
299 | - GetSQLValueString($_POST['user']['email'], "text"), | |
300 | - GetSQLValueString($_POST['user']['city'], "text"), | |
301 | - GetSQLValueString($_POST['user']['address'], "text"), | |
302 | - GetSQLValueString($_POST['user']['tel'], "text"), | |
303 | - GetSQLValueString($_POST['user']['tel2'], "text"), | |
304 | - GetSQLValueString($_POST['user']['comment'], "text"), | |
305 | - GetSQLValueString($_POST['user']['mcomment'], "text"), | |
306 | - GetSQLValueString($time, "text"), | |
307 | - GetSQLValueString($_POST['summary'], "text")); | |
308 | - $result = mysql_query($sql) or die(mysql_error()); | |
309 | - | |
310 | - // Óçíàåì íîìåð çàêàçà | |
311 | - $sql="SELECT id FROM catalogs_orders WHERE mktime='$time' AND user_id='".$_POST['user']['user_id']."'"; | |
312 | - $result = mysql_query($sql) or die(mysql_error()); | |
313 | - if (mysql_affected_rows()!=0) { | |
314 | - $order=mysql_fetch_assoc($result); | |
315 | - } else { echo "Îøèáêà";} | |
316 | - | |
317 | - | |
318 | - // Äîáàâëÿåì òîâàðû | |
319 | - for($i=0; $i<=count($_POST['item']); $i++) { | |
320 | - if($_POST['item']['code'][$i]!=''){ | |
321 | - $sql=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,code,product_cine_id,count,reservation) VALUES (%s,%s,%s,%s,%s,%s)", | |
322 | - GetSQLValueString($order['id'], "text"), | |
323 | - GetSQLValueString($_POST['item']['mod_id'][$i], "text"), | |
324 | - GetSQLValueString($_POST['item']['code'][$i], "text"), | |
325 | - GetSQLValueString($_POST['item']['price'][$i], "text"), | |
326 | - GetSQLValueString($_POST['item']['quant'][$i], "text"), | |
327 | - GetSQLValueString($_POST['item']['reservation'][$i], "text")); | |
328 | - $result = mysql_query($sql) or die(mysql_error()); | |
329 | - } | |
330 | - } | |
331 | - | |
332 | - // Øëåì ïèñüìà | |
333 | - if ($user['group']!=1) { | |
334 | - eMailing('order-new',$_POST['user']['user_id'], $order['id']); | |
335 | - } | |
336 | - | |
337 | - echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/orders/\"; self.focus(); } </script>"; | |
338 | - | |
339 | - // } else { | |
340 | - | |
341 | - // echo"<script language=\"JavaScript\">alert('$alert')</script>"; | |
342 | - | |
343 | - // } | |
344 | - | |
345 | - | |
346 | - } else { | |
347 | - | |
348 | - echo"<script language=\"JavaScript\">alert('Íåò òîâàpà - íåò çàêàçà')</script>"; | |
349 | - | |
350 | - } | |
351 | - | |
352 | - } | |
353 | - | |
354 | - // ================= | |
355 | - // ==== NOTIFY ===== | |
356 | - // ================= | |
357 | - | |
358 | - // ============== | |
359 | - // == changed === | |
360 | - // ============== | |
361 | - | |
362 | - if (isset($_GET['notify']) && $_GET['notify']=='order-changed') { | |
363 | - | |
364 | - eMailing('order-changed',$_GET['user'], $_GET['order']); | |
365 | - | |
366 | - echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/orders/\"; self.focus(); } </script>"; | |
367 | - } | |
368 | - | |
369 | - | |
370 | - // ====================================== | |
371 | - // ====================================== | |
372 | - // ============== Âûâîä ================= | |
373 | - // ====================================== | |
374 | - // ====================================== | |
375 | - | |
376 | - | |
377 | - // ============= | |
378 | - // ==== all ==== | |
379 | - // ============= | |
380 | - | |
381 | - if (!isset($_GET['action'])) { | |
382 | - | |
383 | - echo"<script type='text/javascript'> | |
384 | - function notify(url){ | |
385 | - | |
386 | - if(confirm(\"Âûñëàòü óâåäîìëåíèå?\")){ | |
387 | - document.location=url; | |
388 | - return true; | |
389 | - } | |
390 | - return false; | |
391 | - } | |
392 | - </script>"; | |
393 | - | |
394 | - // ***** Àäìèí ðåæèì ***** | |
395 | - if(isset($_SESSION['admin']['edit']) || $_SESSION['admin']['group']==4 || $_SESSION['admin']['group']==2) { | |
396 | - echo"<a href='/admin.php/sms_tpl/'>SMS øàáëîíû</a><br />"; | |
397 | - echo"<a href='/admin.php/orders/?action=add' class='button-save'>Äîáàâèòü</a>"; | |
398 | - } | |
399 | - // *********************** | |
400 | - | |
401 | - // ============== | |
402 | - // === report === | |
403 | - // ============== | |
404 | - | |
405 | - | |
406 | - $time=''; | |
407 | - $time['day'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), date('j'), date('Y')); | |
408 | - if(date('w')==1) { | |
409 | - $time['week'] = " o.`mktime` >=".mktime(0, 0, 0, date('n'), date('j'), date('Y'))." "; | |
410 | - } else { | |
411 | - $time['week'] = "( o.`mktime` BETWEEN ".strtotime("last Monday")." AND ".mktime(0, 0, 0, date('n'), date('j')+1, date('Y')).") "; | |
412 | - } | |
413 | - $time['month'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), 1, date('Y')); | |
414 | - | |
415 | - Report::put_time($time); | |
416 | - Report::make(); | |
417 | - /* | |
418 | - echo"<div class='orders-report' style='display:table; overflow:hidden;'>"; | |
419 | - | |
420 | - // === êëèåíòû === | |
421 | - | |
422 | - 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;'>"; | |
423 | - | |
424 | - echo"<span style='padding:5px 0; display:block;'>ÒÎÏ êëèåíòîâ çà ïåðèîä: </span>"; | |
425 | - echo Report::html_report(Report::get_mass_client()); | |
426 | - echo"</div>"; | |
427 | - | |
428 | - echo"<div style='height:20px;display:block;'></div>"; | |
429 | - | |
430 | - // === ïðîäàæè === | |
431 | - | |
432 | - 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;'>"; | |
433 | - | |
434 | - echo"<span style='padding:5px 0; display:block;'>Ïðîäàæè çà ïåðèîä: </span>"; | |
435 | - echo Report::html_report(Report::get_mass_order()); | |
436 | - echo"</div>"; | |
437 | - | |
438 | - echo"<div style='height:20px;display:block;'> </div>"; | |
439 | - | |
440 | - // === ãðàôèê === | |
441 | - | |
442 | - 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;'>"; | |
443 | - | |
444 | - echo"<span style='padding:5px 0; display:block;'>Ãðàôèê: </span>"; | |
445 | - 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>"; | |
446 | - | |
447 | - // ëåãåíäà | |
448 | - echo"<div class='legend' style='display:table;text-align:center;'>"; | |
449 | - echo"<div style='width:15px; height:15px; background:#00A652; float:left;'></div><span style='float:left; padding:0 5px;'>íîâûé</span>"; | |
450 | - echo"<div style='width:15px; height:15px; background:#0072BB; float:left;'></div><span style='float:left; padding:0 5px;'>ïîäòâåðæäåí</span>"; | |
451 | - echo"<div style='width:15px; height:15px; background:#F36523; float:left;'></div><span style='float:left; padding:0 5px;'>îòìåíåí</span>"; | |
452 | - echo"<div style='width:15px; height:15px; background:#ED1B24; float:left;'></div><span style='float:left; padding:0 5px;'>âûïîëíåí</span>"; | |
453 | - echo"<div style='clear:both;'></div>"; | |
454 | - echo"</div>"; | |
455 | - | |
456 | - echo"</div>"; | |
457 | - | |
458 | - echo"</div>";*/ | |
459 | - | |
460 | - | |
461 | - if (!isset($_GET['status'])) {$_GET['status']="1";} | |
462 | - if (!isset($_GET['page'])) {$_GET['page']="1";} | |
463 | - | |
464 | - if(isset($_GET['user'])) {$AND="AND u.id=".$_GET['user'];} else {$AND='';} | |
465 | - | |
466 | - // ============= | |
467 | - // === Ïîèñê === | |
468 | - // ============= | |
469 | - | |
470 | - $th=array("id"=>"íîìåð çêàçà","username"=>"êëèåíò", "email"=>"email", "tel"=>"òåëåôîí", "code"=>"øòðèõêîä"); | |
471 | - | |
472 | - // Åñëè ñóùåñòâóåò Ïîèñê | |
473 | - if (isset($_REQUEST['search'])) { | |
474 | - if($_REQUEST['field']=='id') {$pre="o";} | |
475 | - if($_REQUEST['field']=='username') {$pre="u";} | |
476 | - if($_REQUEST['field']=='email') {$pre="u";} | |
477 | - if($_REQUEST['field']=='tel') {$pre="u";} | |
478 | - if($_REQUEST['field']=='code') {$pre="m";} | |
479 | - $AND=''; | |
480 | - if (trim($_REQUEST['look'])!='') { | |
481 | - if($_REQUEST['field']=="id")$AND.="AND $pre.`".$_REQUEST['field']."` LIKE '".trim($_REQUEST['look'])."' "; | |
482 | - else $AND.="AND $pre.`".$_REQUEST['field']."` LIKE '%".trim($_REQUEST['look'])."%' "; | |
483 | - } | |
484 | - if ( ($_REQUEST['form']['date_start'] !='') && ($_REQUEST['form']['date_end'] !='')){ | |
485 | - | |
486 | - $dateStart =$_REQUEST['form']['date_start']; | |
487 | - $dateEnd =$_REQUEST['form']['date_end']; | |
488 | - | |
489 | - $mkdate=ExtractDate($_REQUEST['form']['date_start']); | |
490 | - $_REQUEST['form']['date_start'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); | |
491 | - | |
492 | - $mkdate=ExtractDate($_REQUEST['form']['date_end']); | |
493 | - $_REQUEST['form']['date_end'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); | |
494 | - | |
495 | - $AND.=" AND (o.`mktime` BETWEEN '".$_REQUEST['form']['date_start']."' AND '".$_REQUEST['form']['date_end']."') "; | |
496 | - } | |
497 | - } | |
498 | - // ============= | |
499 | - // === Äàòà ==== | |
500 | - // ============= | |
501 | - | |
502 | - echo"<div class='grid-search'> | |
503 | - <form action='".GetFormUrl()."' name='search' method='GET'> | |
504 | - <div class='search'> | |
505 | - <input type='text' name='look' id='grid-search' value='".$_REQUEST['look']."'> | |
506 | - <select name='field'>"; | |
507 | - | |
508 | - foreach ($th as $key=>$value) { | |
509 | - if($_REQUEST['field']==$key) {$selected='selected="selected"';} else {$selected='';} | |
510 | - echo"<option value='$key' $selected>$value</option>"; | |
511 | - } | |
512 | - | |
513 | - echo"</select> | |
514 | - <input type='submit' value='ïîèñê'> | |
515 | - <input type='hidden' name='status' value='".$_GET['status']."'> | |
516 | - </div>"; | |
517 | - | |
518 | - echo"<div class='dates'> | |
519 | - <div class='row'> | |
520 | - <input type='text' name='form[date_start]' id='date_start_input' value='".$dateStart."'> | |
521 | - <img src='/img/calendar.gif' id='date_start'> | |
522 | - </div> | |
523 | - <div class='row'> | |
524 | - <input type='text' name='form[date_end]' id='date_end_input' value='".$dateEnd."'> | |
525 | - <img src='/img/calendar.gif' id='date_end'> | |
526 | - </div> | |
527 | - </div>"; | |
528 | - | |
529 | - | |
530 | - echo'<script type="text/javascript"> | |
531 | - Calendar.setup( | |
532 | - { | |
533 | - inputField : "date_start_input", // ID of the input field | |
534 | - ifFormat : "%Y-%m-%d", // the date format | |
535 | - button : "date_start" | |
536 | - } | |
537 | - ); | |
538 | - </script>'; | |
539 | - | |
540 | - echo'<script type="text/javascript"> | |
541 | - Calendar.setup( | |
542 | - { | |
543 | - inputField : "date_end_input", // ID of the input field | |
544 | - ifFormat : "%Y-%m-%d", // the date format | |
545 | - button : "date_end" | |
546 | - } | |
547 | - ); | |
548 | - </script>'; | |
549 | - | |
550 | - | |
551 | - echo"<input type='hidden' name='search' value='ok'> | |
552 | - | |
553 | - </form> | |
554 | - </div>"; | |
555 | - | |
556 | - | |
557 | - // =========== Ãåíåðèì òàáëèöó =========== | |
558 | - | |
559 | -$eshka = ""; | |
560 | -$eshka2 = ""; | |
561 | -$eshka3 = ""; | |
562 | -$lll = ""; | |
563 | -/* | |
564 | -if(trim(@$_REQUEST['da'])=='1'){ | |
565 | - $eshka = "o.mktime<'1341090000' AND "; | |
566 | - $eshka2 = "o.mktime<'1341090000' AND "; | |
567 | - $lll = "font-weight:bold;"; | |
568 | -}else{ | |
569 | - $eshka = "o.mktime>'1341090000' AND "; | |
570 | - $eshka2 = "o.mktime>'1341090000' AND "; | |
571 | - $lll = ""; | |
572 | -}*/ | |
573 | - | |
574 | - | |
575 | - | |
576 | -if(trim(@$_REQUEST['pr'])=='1'){ | |
577 | -$tim = (time()-86400); | |
578 | - $eshka3 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; | |
579 | -}else{ | |
580 | -$eshka3 = ""; | |
581 | -} | |
582 | - | |
583 | -if(trim(@$_REQUEST['prs'])=='1'){ | |
584 | -$tim = (time()-172800); | |
585 | - $eshka4 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; | |
586 | -}else{ | |
587 | -$eshka4 = ""; | |
588 | -} | |
589 | - | |
590 | -$order = ((isset($_GET['order'])) ? $_GET['order'] : 'mktime'); | |
591 | -$type = ((isset($_GET['type'])) ? $_GET['type'] : 'DESC'); | |
592 | - | |
593 | - | |
594 | -if(isset($_GET['stat']) && $_GET['stat']==1){ | |
595 | -$AND .= " AND o.status IN(4,5) AND o.mktime<'".mktime(0, 0, 0, "01", "01", "2013")."' "; | |
596 | -}else{ | |
597 | -//$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"))."' "; | |
598 | -$AND .= " AND o.status IN(1,2) AND o.mktime>='".mktime(0, 0, 0, "01", "01", "2013")."' "; | |
599 | -$mk_and = " AND o.status IN(1,2) AND o.mktime>='".mktime(0, 0, 0, "01", "01", "2013")."' "; | |
600 | -} | |
601 | - | |
602 | -if(isset($_GET['sort_label']) && $_GET['sort_label']!=''){ | |
603 | -$AND .= " AND o.label='".$_GET['sort_label']."' "; | |
604 | -} | |
605 | -if(isset($_GET['lab'])){ | |
606 | -$AND .= " AND o.label IN(".implode(',',$_GET['lab']).")"; | |
607 | -} | |
608 | -if(isset($_GET['delivery'])){ | |
609 | -$AND .= " AND o.delivery IN(".implode(',',$_GET['delivery']).")"; | |
610 | -} | |
611 | -if(isset($_GET['meneger']) && $_GET['meneger']>0){ | |
612 | -$AND .= " AND o.meneger='".$_GET['meneger']."'"; | |
613 | -} | |
614 | - | |
615 | - $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 order_id, m.*, m.product_id as mod_id, op.* , p.*, g.color as group_color,za.username as meneger_name | |
616 | - FROM catalogs_orders as o | |
617 | - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
618 | - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
619 | - LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
620 | - LEFT JOIN zlo_users as u ON u.id=o.user_id | |
621 | - LEFT JOIN zlo_users_group as g ON g.id=u.group | |
622 | - LEFT JOIN zlo_admin as za ON za.id=o.meneger | |
623 | - 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 "; | |
624 | - | |
625 | - $pager['sql']= $sql; | |
626 | - //echo $pager['sql']; | |
627 | - $pager=pagerGetRun($pager,50,15); | |
628 | - $result = mysql_query($pager['sql']) or die(mysql_error()); | |
629 | - if (mysql_affected_rows()!=90800) { | |
630 | - | |
631 | - | |
632 | - // ============= | |
633 | - // === Òàáñ ==== | |
634 | - // ============= | |
635 | - | |
636 | - echo"<div class='clear'></div>"; | |
637 | - echo"<div class='order-tabs'>"; | |
638 | - //////$eshka2.$eshka | |
639 | - $sql0 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
640 | - $result0 = mysql_query($sql0) or die(mysql_error()); | |
641 | - if (mysql_affected_rows()!=0) { | |
642 | - while ($rows=mysql_fetch_assoc($result0)) { | |
643 | - | |
644 | - //$AND | |
645 | - | |
646 | - // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | |
647 | - $sql2 = "SELECT count(o.id) AS calc, o . * , m.*, m.product_id as mod_id, op.* , p.* | |
648 | - FROM catalogs_orders as o | |
649 | - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
650 | - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
651 | - LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
652 | - LEFT JOIN zlo_users as u ON u.id=o.user_id | |
653 | - LEFT JOIN zlo_users_group as g ON g.id=u.group | |
654 | - WHERE ".$eshka2."o.status='".$rows['id']."' $AND"; | |
655 | - | |
656 | - | |
657 | -//if(trim($_REQUEST['test'])=="1") echo $sql2; | |
658 | - | |
659 | - | |
660 | -/* | |
661 | - $sql2 = "SELECT count(o.id) AS calc FROM catalogs_orders as o WHERE ".$eshka2."o.status='".$rows['id']."'"; | |
662 | - | |
663 | - | |
664 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
665 | - $row2=mysql_fetch_assoc($result2); | |
666 | - $yyyyyy = str_replace("prs=1","prs=0",str_replace("pr=1","pr=0",urlQueryChange2('status',$rows['id']))); | |
667 | - echo"<div class='status-tabs' ".(($_GET['status']==$rows['id'])?"style='border:1px solid red;'":"")." onclick=\"location.href='".$yyyyyy."'\">".$rows['title']."(".$row2['calc'].")</div>"; | |
668 | - */ | |
669 | - } | |
670 | - } | |
671 | - | |
672 | -$array_label = array(0=>"íîâûå çàêàçû",1=>"îáðàáîòàí",2=>"äîñòàâèòü",3=>"îòïðàâèòü",4=>"ñàìîâûâîç",5=>"",6=>"", | |
673 | - 7=>"âîçâðàò",8=>"",9=>"îòìåíåí",10=>"âûïîëíåí"); | |
674 | -print'<div style="float:left;padding:10px 0px;"> | |
675 | -<form action="/admin.php/orders/" name="form" method="get"> | |
676 | -<input type="hidden" name="stat" value="'.$_GET['stat'].'"> | |
677 | -<input type="hidden" name="look" value="'.$_GET['look'].'"> | |
678 | -<input type="hidden" name="field" value="'.$_GET['field'].'"> | |
679 | -<input type="hidden" name="form[date_start]" value="'.$dateStart.'"> | |
680 | -<input type="hidden" name="form[date_end]" value="'.$dateEnd.'"> | |
681 | -<input type="hidden" name="page" value="1"> | |
682 | -<input type="hidden" name="search" value="ok"> | |
683 | -'; | |
684 | -for($i=0;$i<=10;$i++){ | |
685 | -$sql = "select count(*) from catalogs_orders o where o.label='".$i."'"; | |
686 | -if(isset($_GET['stat']) && $_GET['stat']==1){ | |
687 | -$sql .= " AND o.status IN(4,5)"; | |
688 | -}else{ | |
689 | -$sql .= $mk_and; | |
690 | -} | |
691 | -$r = mysql_query($sql) or die(mysql_error()); | |
692 | -$count = mysql_result($r,0); | |
693 | -print'<input type="checkbox" id="cb'.$i.'" name="lab[]" value="'.$i.'" '; | |
694 | -//.(($_GET['label'][$i]==$i)?'checked':''). | |
695 | -foreach($_GET['lab'] as $l){ | |
696 | -if($l==$i)print 'checked'; | |
697 | -} | |
698 | -print' onclick="document.form.submit();"/><label for="cb'.$i.'">'.$i.'-'.$array_label[$i].'('.$count.')</label>'; | |
699 | -} | |
700 | -print"<br /><br /><br />"; | |
701 | - | |
702 | -print"<select name='meneger' onChange='document.form.submit();'>"; | |
703 | -print"<option value='0'>Ìåíåäæåð</option>"; | |
704 | - $result_1 = mysql_query("select * from zlo_admin"); | |
705 | - while ($row = mysql_fetch_assoc($result_1)) { | |
706 | - echo "<option value='".$row["id"]."' ".(($_GET['meneger']==$row["id"])?"selected":"").">".$row["username"]."</option>"; | |
707 | - } | |
708 | -print"</select>"; | |
709 | - | |
710 | -$sql = "select * from zlo_book_delivery"; | |
711 | -$r = mysql_query($sql) or die(mysql_error()); | |
712 | -$i=0; | |
713 | -while ($row=mysql_fetch_assoc($r)) { | |
714 | -print'<input type="checkbox" id="delivery_'.$i.'" name="delivery[]" value="'.$row['id'].'" '; | |
715 | -foreach($_GET['delivery'] as $l){ | |
716 | -if($l==$row['id'])print 'checked'; | |
717 | -} | |
718 | -print' onclick="document.form.submit();"/><label for="delivery_'.$i.'">'.$row['title'].'</label>'; | |
719 | -$i++; | |
720 | -} | |
721 | -print'</form></div>'; | |
722 | - | |
723 | -$tim = (time()-86400); | |
724 | - $sql3 = " | |
725 | - SELECT count(*) count FROM catalogs_orders WHERE `status`=1 AND `upd`<'".date("Y-m-d H:i:s",$tim)."';"; | |
726 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
727 | - $row3=mysql_fetch_assoc($result3); | |
728 | -$yyyyyt = ""; | |
729 | -if(trim($_REQUEST['pr'])=="1") $yyyyyt = "font-weight:bold; "; | |
730 | - | |
731 | -$tim2 = (time()-172800); | |
732 | - $sql4 = " | |
733 | - SELECT count(*) count FROM catalogs_orders WHERE `status`=2 AND `upd`<'".date("Y-m-d H:i:s",$tim2)."';"; | |
734 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
735 | - $row4=mysql_fetch_assoc($result4); | |
736 | -$yyyyyt2 = ""; | |
737 | -if(trim($_REQUEST['prs'])=="1") $yyyyyt2 = "font-weight:bold; "; | |
738 | - | |
739 | - | |
740 | - echo" | |
741 | - | |
742 | - <div class='status-tabs' style=\"".$lll."\" onclick=\"location.href='".urlQueryChange2('stat',"1")."&page=1'\">Êîðçèíà</div>"; | |
743 | - echo" | |
744 | - <div class='status-tabs'> | |
745 | - <a href=\"/order/index.php\" target=\"_blank\" style=\"text-decoration:none; color:#157100\">Ñòàòèñòèêà çàêàçîâ</a> | |
746 | - </div> | |
747 | - </div> | |
748 | - <!--<div class='clear'></div> | |
749 | - <div onclick=\"location.href='?pr=1&status=1&page=1'\" style=\"".$yyyyyt."cursor:pointer; float: left; font-family: Arial,Helvetica,sans-serif; font-size: 12px; margin-left:25px;\"> | |
750 | - Ïðîñòð. (".$row3['count'].") | |
751 | - </div> | |
752 | - | |
753 | - <div onclick=\"location.href='?prs=1&status=2&page=1'\" style=\"".$yyyyyt2."cursor:pointer; float: left; font-family: Arial,Helvetica,sans-serif; font-size: 12px; margin-left:45px;\"> | |
754 | - Ïðîñòð. (".$row4['count'].") | |
755 | - </div>--> | |
756 | -<div class='clear'></div> | |
757 | -<div> </div> | |
758 | - "; | |
759 | - | |
760 | - // =================== | |
761 | - // === ÏÐÎÄÎËÆÅÍÈÅ === | |
762 | - // =================== | |
763 | - $url_l = '/admin.php/orders/?look='.$_GET['look'].'&field='.$_GET['field'].'&form[date_start]='.$dateStart.'&form[date_end]='.$dateEnd.'&search=ok&stat='.$_GET['stat'].'&page='.$_GET['page'].'&'; | |
764 | - foreach($_GET['lab'] as $lab){ | |
765 | - $url_l .= "lab[]=".$lab."&"; | |
766 | - } | |
767 | - foreach($_GET['delivery'] as $delivery){ | |
768 | - $url_l .= "delivery[]=".$delivery."&"; | |
769 | - } | |
770 | - //print $url_l; | |
771 | - print"<table border='0' width='100%' cellpadding='6' cellspacing='1' bgcolor='#d7decc' style='border-radius:10px;'> | |
772 | - <tr style='color:#acd2f6;text-align:center;' bgcolor='#1372c6'> | |
773 | - <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> | |
774 | - <td width='90'><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=mktime&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Äàòà çàêàçà</a></td> | |
775 | - <td width='150'>ÔÈÎ</td> | |
776 | - <td width='50'><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=total&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Îáùàÿ ñóììà</a></td> | |
777 | - <td width='50'><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=paid&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Îïëà÷åí</a></td> | |
778 | - <td>Òåëåôîí</td> | |
779 | - <td width='300'>Àäðåñ</td> | |
780 | - <td><a style='color:#acd2f6;' href='".$url_l."stat=".$_GET['stat']."&order=label&type=".(($_GET['type']=="asc")?"desc":"asc")."'>Ìåòêà</a></td> | |
781 | - <td style='border-radius:0px 10px 0px 0px;' width='250'>Êîìåíòàðèé ìåíåäæåðà</td> | |
782 | - </tr>"; | |
783 | - $i1 = 0; | |
784 | - while ($order=mysql_fetch_assoc($result)) { | |
785 | - //print_r($order); | |
786 | - print" <tr style='text-align:center;' bgcolor='".((($i1%2)==0)?"#fefff5":"#eff5e7")."'> | |
787 | - <td id='ID{$order['order_id']}'><a href='".$url_l.(($_GET['order_ID']!=$order['order_id'])?"order_ID={$order['order_id']}#ID{$order['order_id']}":"")."'>{$order['order_id']}</a><br />{$order['meneger_name']}</td> | |
788 | - <td width='90'>".date('Y-m-d H:i:s',$order['order_date'])."</td> | |
789 | - <td width='150' align='left'><!--<a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>-->".$order['username']."<!--</a>--></td> | |
790 | - <td width='50'>{$order['total']}</td> | |
791 | - <td width='50'> | |
792 | -"; | |
793 | - | |
794 | -if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ | |
795 | -echo "<select onChange='document.location=\"".$url_l."orderID={$order['order_id']}&paid=\"+this.value;'> | |
796 | - <option value='0' ".(($order['paid']==0)?'selected':'').">íåò</option> | |
797 | - <option value='1' ".(($order['paid']==1)?'selected':'').">äà</option> | |
798 | - </select>"; | |
799 | -}else{ | |
800 | -if($order['paid']==1) print "Äà"; | |
801 | -else print "Íåò"; | |
802 | -} | |
803 | - | |
804 | - | |
805 | -echo " | |
806 | -</td> | |
807 | - <td>{$order['tel']}<br/> <a href='/admin.php/sms/?orderID={$order['order_id']}'>Îòïðàâèòü CMC</a></td> | |
808 | - <td align='left'>{$order['city']}, {$order['address']}</td> | |
809 | - <td>"; | |
810 | - | |
811 | - | |
812 | -//if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ | |
813 | - | |
814 | -if($_SESSION['admin']['group']==2 and ($order['label']==9 or $order['label']==10)){ | |
815 | -print $order['label']; | |
816 | -}else{ | |
817 | -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;'> "; | |
818 | - for($i=0;$i<=10;$i++){ | |
819 | - | |
820 | -if(($_SESSION['admin']['group']==2) && ($i==9 || $i==10)){ | |
821 | - | |
822 | -}else | |
823 | -print'<option value="'.$i.'" '.(($order['label']==$i)?'selected':'').'>'.$i.'</option>'; | |
824 | -} | |
825 | - echo "</select>"; | |
826 | -} | |
827 | - | |
828 | -//}else{ | |
829 | -//print $order['label']; | |
830 | -//} | |
831 | - | |
832 | - | |
833 | - echo "</td> | |
834 | - <td align='left'>"; | |
835 | - if(strlen($order['mcomment'])>0)print"<a href='#' rel='msg' title='{$order['mcomment']}'>".substr($order['mcomment'],0,30)."...</a>"; | |
836 | - print"</td> | |
837 | - "; | |
838 | - /* | |
839 | - echo"<div class='orders'>"; | |
840 | - | |
841 | - echo"<div class='order-info-all'> | |
842 | - | |
843 | - <div class=order-info> | |
844 | - <h4>Çàêàç #".$order['order_id']."<br> | |
845 | - Äàòà: ".date('Y-m-d H:i:s',$order['order_date'])." | |
846 | - </h4> | |
847 | - <fieldset id='order-info' style=\"background:".$order['group_color'].";\"> | |
848 | - <legend>Êëèåíò</legend> | |
849 | - | |
850 | - <label>Êëèåíò:</label> | |
851 | - <div class=info><a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>".$order['username']."</a> </div> | |
852 | - | |
853 | - <label>Òåë:</label> | |
854 | - <div class=info>".$order['tel']." </div> | |
855 | - | |
856 | - <label>Òåë 2:</label> | |
857 | - <div class=info>".$order['tel2']." </div> | |
858 | - | |
859 | - <label>Ãðóïïà:</label> | |
860 | - <div class=info>".viewBook('zlo_users_group', $order['group'], 'id', 'name')." </div> | |
861 | - | |
862 | - <div class=clear></div> | |
863 | - <a class='history' href='/admin.php/orders/?action=show&user=".$order['user_id']."'>[Èñòîðèÿ çàêàçîâ]</a> | |
864 | - | |
865 | - </fieldset> | |
866 | - | |
867 | - <fieldset id='order-info' style='background:".$order['group_color'].";'> | |
868 | - <legend>Äîñòàâêà</legend> | |
869 | - | |
870 | - <label>Äîñòàâêà:</label> | |
871 | - <div class=info>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." </div> | |
872 | - | |
873 | - <label>Ãîðîä:</label> | |
874 | - <div class=info>".$order['city']." </div> | |
875 | - | |
876 | - <label>Àäðåñ:</label> | |
877 | - <div class=info>".$order['address']." </div> | |
878 | - | |
879 | - <label>Èíôî:</label> | |
880 | - <div class=info> ".$order['comment']." </div> | |
881 | - | |
882 | - <div class=clear></div> | |
883 | - | |
884 | - </fieldset> | |
885 | - <div class=clear></div> | |
886 | - </div> | |
887 | - </div>"; | |
888 | - */ | |
889 | - | |
890 | - // Òàáëèöà òîâàðîâ | |
891 | - /* | |
892 | - echo" | |
893 | - <div class='order-details'> | |
894 | - <fieldset id='order-details'> | |
895 | - <legend>Òîâàðû</legend>"; | |
896 | - echo"<table> | |
897 | - <tr> | |
898 | - <td>¹</td> | |
899 | - <td>Êîä</td> | |
900 | - <td>Áðåíä</td> | |
901 | - <td>Íàçâàíèå</td> | |
902 | - <td>Ðàçìåð</td> | |
903 | - <td>Öâåò</td> | |
904 | - <td>Êîë.</td> | |
905 | - <td>Öåíà</td> | |
906 | - <td>Ñóììà</td> | |
907 | - <td>Íàëè÷èå</td> | |
908 | - <td></td> | |
909 | - </tr>"; | |
910 | - | |
911 | - $sql3 = " | |
912 | - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* | |
913 | - FROM catalogs_orders AS o | |
914 | - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
915 | - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
916 | - LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
917 | - WHERE o.id='".$order['order_id']."'"; | |
918 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
919 | - if (mysql_affected_rows()!=0) { | |
920 | - while ($item=mysql_fetch_assoc($result3)) { { $i++; | |
921 | - | |
922 | - | |
923 | - // íàëè÷èå òîâàðà | |
924 | - $sql5 = "SELECT c.name as city, o.count | |
925 | - FROM catalogs_keys_products_cities as o | |
926 | - LEFT JOIN catalogs_cities as c | |
927 | - ON o.city_id=c.id | |
928 | - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | |
929 | - $result5 = mysql_query($sql5) or die(mysql_error()); | |
930 | - if (mysql_affected_rows()!=0) { | |
931 | - $onStockDesc=''; | |
932 | - while ($onStock=mysql_fetch_assoc($result5)) { | |
933 | - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | |
934 | - } | |
935 | - } else { $onStockDesc='íåò'; } | |
936 | - | |
937 | - echo"<tr> | |
938 | - <td>$i .</td> | |
939 | - <td>".$item['code']."</td> | |
940 | - <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | |
941 | - <td><a href='/".$item['rubric_id']."-catalogs/".$item['translit']."-".$item['id']."/' target='_new'>".$item['name']."</a></td> | |
942 | - <td>".$item['size']."</td> | |
943 | - <td>".$item['color']."</td> | |
944 | - <td>".$item['count']."</td> | |
945 | - <td>".$item['cine']."</td> | |
946 | - <td>".($item['cine']*$item['count'])."</td> | |
947 | - <td>".$onStockDesc."</td> | |
948 | - <td></td> | |
949 | - </tr>"; | |
950 | - | |
951 | - } | |
952 | - | |
953 | - } | |
954 | - } | |
955 | - | |
956 | - echo"</table> | |
957 | - <b>Îáùàÿ ñóììà: ".$order['total']." ãðí.</b> | |
958 | - </div>"; | |
959 | - | |
960 | - | |
961 | - | |
962 | - echo"<div class='clear'></div>"; | |
963 | - */ | |
964 | - // ***** Àäìèí ðåæèì ***** | |
965 | - if(isset($_SESSION['admin']['edit1'])) { | |
966 | - | |
967 | - // Ñìåíà ñòàòóñà | |
968 | - if ($order['status']!=6) { | |
969 | - echo " | |
970 | - <td width='20'>"; | |
971 | - $sql4 = "SELECT * FROM zlo_book_status WHERE id IN ({$order['status']})"; | |
972 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
973 | - if (mysql_affected_rows()!=0) { | |
974 | - while ($row4=mysql_fetch_assoc($result4)) { | |
975 | - if($row4['id']!="5") | |
976 | - echo $row4['title']; | |
977 | - } | |
978 | - | |
979 | - } | |
980 | - echo" | |
981 | - </td><td width='20'> | |
982 | - <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> | |
983 | - </form></td> | |
984 | - "; | |
985 | - } | |
986 | - | |
987 | - } print"</tr>"; | |
988 | - if($order['order_id']==$_GET['order_ID']){ | |
989 | - print'<tr><td colspan="11">'; | |
990 | - // =========== Ãåíåðèì òàáëèöó =========== | |
991 | - | |
992 | - $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 | |
993 | - FROM catalogs_orders as o | |
994 | - LEFT JOIN zlo_users as u ON u.id=o.user_id | |
995 | - LEFT JOIN zlo_users_group as g ON g.id=u.group | |
996 | - WHERE o.id='".$_GET['order_ID']."'"; | |
997 | - $result1 = mysql_query($sql) or die(mysql_error()); | |
998 | - if (mysql_affected_rows()!=0) { | |
999 | - | |
1000 | - $order=mysql_fetch_assoc($result1); | |
1001 | - | |
1002 | - $r = mysql_query("select * from card where user_id='".$order['user_id']."'") or die(mysql_error()); | |
1003 | - $c=mysql_fetch_assoc($r); | |
1004 | - $order['cards'] = $c['card']; | |
1005 | - | |
1006 | - | |
1007 | - echo"<form action='' method='POST' name='edit_order' id='add-item'>"; | |
1008 | - echo"<div class='orders' style='margin:0px;'>"; | |
1009 | - | |
1010 | - echo" | |
1011 | - <div class=order-info> | |
1012 | - <fieldset id='order-info'> | |
1013 | - <legend>Çàêàç #".$order['order_id']." Ãðóïïà: <font color='".$order['user_color']."'>".$order['user_group']."</font> Cóììà: ".$order['total']." ãðí.</legend> | |
1014 | - <div style='float:left;'> | |
1015 | - <label>Äàòà:</label> | |
1016 | - <div class=info>".date('d-m-Y H:i:s',$order['mktime'])."</div> | |
1017 | - | |
1018 | - <label>Îïëà÷åí:</label> | |
1019 | - <div class=info style='float:left;padding-right:20px;'>"; | |
1020 | - | |
1021 | - | |
1022 | -if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ | |
1023 | -echo "<select name='paid'> | |
1024 | - <option value='0' ".(($order['paid']==0)?'selected':'').">íåò</option> | |
1025 | - <option value='1' ".(($order['paid']==1)?'selected':'').">äà</option> | |
1026 | - </select>"; | |
1027 | -}else{ | |
1028 | -if($order['paid']==1) print "Äà"; | |
1029 | -else print "Íåò"; | |
1030 | -echo "<input type=\"hidden\" name=\"paid\" value=\"".$order['paid']."\">"; | |
1031 | - | |
1032 | -} | |
1033 | - | |
1034 | - | |
1035 | - | |
1036 | - | |
1037 | - echo "</div> | |
1038 | - <div class=info style='float:left;padding-right:20px;width:100px;'> | |
1039 | - <label style='width:50px'>Ìåòêà:</label> | |
1040 | - <div class=info>"; | |
1041 | - | |
1042 | -//////////if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ | |
1043 | -echo "<select name='label'>"; | |
1044 | - for($i=0;$i<=10;$i++){ | |
1045 | -if(($_SESSION['admin']['group']==2) && ($i==9 || $i==10)){ | |
1046 | - | |
1047 | -}else | |
1048 | -print'<option value="'.$i.'" '.(($order['label']==$i)?'selected':'').'>'.$i.'</option>'; | |
1049 | - | |
1050 | -} | |
1051 | - | |
1052 | - echo "</select>"; | |
1053 | -////////////}else{ | |
1054 | -//////////////echo $order['label']; | |
1055 | -/////} | |
1056 | - | |
1057 | - | |
1058 | -echo " </div> | |
1059 | - </div> | |
1060 | - <div> | |
1061 | - <label style='width:60px'>Ïðè÷èíû:</label> | |
1062 | - | |
1063 | - <div class=info> | |
1064 | - <select name='cause' style='width:70px;'> | |
1065 | - <option value='0'></option> | |
1066 | - <option value='1' ".(($order['cause']==1)?'selected':'').">Íåò òîâàðà</option> | |
1067 | - <option value='2' ".(($order['cause']==2)?'selected':'').">Íåò îïëàòû</option> | |
1068 | - <option value='3' ".(($order['cause']==3)?'selected':'').">Ïåðåäóìàë</option> | |
1069 | - <option value='4' ".(($order['cause']==4)?'selected':'').">Êóïèë â äðóãîì ìåñòå</option> | |
1070 | - <option value='5' ".(($order['cause']==5)?'selected':'').">Ïîäüåäåò â ìàã.</option> | |
1071 | - <option value='6' ".(($order['cause']==6)?'selected':'').">Äóáëü çàêàçà.</option> | |
1072 | - <option value='7' ".(($order['cause']==7)?'selected':'').">Äðóãîå</option> | |
1073 | - </select> | |
1074 | - </div> | |
1075 | - | |
1076 | - </div><div style='clear:both'></div> | |
1077 | - <label>Êëèåíò:</label> | |
1078 | - <div class=info> | |
1079 | - <input type='text' name='user[username]' value='".$order['username']."' style='width:300px;' disabled='disabled'> | |
1080 | - <input type='hidden' name='user[username]' value='".$order['username']."'> | |
1081 | - </div> | |
1082 | - | |
1083 | - <label>Email:</label> | |
1084 | - <div class=info> | |
1085 | - <input type='text' name='user[email]' value='".$order['email']."' style='width:300px;' disabled='disabled'> | |
1086 | - <input type='hidden' name='user[email]' value='".$order['email']."'> | |
1087 | - </div> | |
1088 | - | |
1089 | - <label>Òåëåôîí:</label> | |
1090 | - <div class=info> | |
1091 | - <input type='text' name='user[tel]' value='".$order['tel']."' style='width:270px;' disabled='disabled'> | |
1092 | - <input type='hidden' name='user[tel]' value='".$order['tel']."'> | |
1093 | - <input type='checkbox' name='sms_tel[]' id='sms_tel1' value='".$order['tel']."'> | |
1094 | - </div> | |
1095 | - | |
1096 | - <label>Òåëåôîí 2:</label> | |
1097 | - <div class=info> | |
1098 | - <input type='text' name='user[tel2]' value='".$order['tel2']."' style='width:270px;' disabled='disabled'> | |
1099 | - <input type='hidden' name='user[tel2]' value='".$order['tel2']."'> | |
1100 | - <input type='checkbox' name='sms_tel[]' id='sms_tel2' value='".$order['tel2']."'> | |
1101 | - </div> | |
1102 | - | |
1103 | - <label>¹ êàðòî÷êè:</label> | |
1104 | - <div class=info> | |
1105 | - <input type='text' name='user[cards]' value='".$order['cards']."' style='width:300px;' disabled='disabled'> | |
1106 | - <input type='hidden' name='user[cards]' value='".$order['cards']."'> | |
1107 | - </div> | |
1108 | - | |
1109 | - <label>Êîìåíòàðèé:</label><br /> | |
1110 | - <div class=info><textarea rows='4' style='width:400px;' name='user[comment]' cols='30' name='comment'>".$order['comment']."</textarea></div> | |
1111 | - | |
1112 | - <label>Îòïðàâêà ÑÌÑ:</label>"; | |
1113 | - global $setup; | |
1114 | - $res = $setup->db->getAll("select * from sms_tpl",array(),DB_FETCHMODE_ASSOC); | |
1115 | - echo " | |
1116 | - <div class=info> | |
1117 | - <select name='sms_tpl' id='sms_tpl' style='width:300px'> | |
1118 | - <option value='0'>ÂÛÁÐÀÒÜ ØÀÁËÎÍ</option>"; | |
1119 | - foreach($res as $row){ | |
1120 | - echo"<option value='".$row['id']."'>".$row['title']."</option>"; | |
1121 | - } | |
1122 | - echo "</select> | |
1123 | - </div>"; | |
1124 | - $sms_count = $setup->db->getOne("select count(*) from sms_history where order_id=?",array($order['id'])); | |
1125 | - 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>"; | |
1126 | - echo"<div style='float:left'><a href='/admin.php/sms_history/?orderID=".$order['id']."' target='_blank'>Èñòîðèÿ</a>"; | |
1127 | - echo"<br /><input type='submit' style='margin-top:4px;' class='submit_green' id='sms_send' value='Îòïðàâèòü' name='sms_send'> | |
1128 | - <br />Îòïðàâëåíî ÑÌÑ (".$sms_count.")</div>"; | |
1129 | - echo "</div>"; | |
1130 | - | |
1131 | - echo "</div> | |
1132 | - <div style='float:right;'> | |
1133 | - <label>Äîñòàâêà</label>"; | |
1134 | - echo " | |
1135 | - <div class=info> | |
1136 | - <select name='user[delivery]' style='width:300px'>"; | |
1137 | - viewBookSelectValue('zlo_book_delivery', 'id', 'title', $order['delivery']); | |
1138 | - echo "</select> | |
1139 | - </div>"; | |
1140 | - | |
1141 | - echo " | |
1142 | - <label>Äåêëàðàöèÿ ¹:</label> | |
1143 | - <div class=info><input type='text' name='user[declaration]' style='width:300px;' class=\"validate[required]\" value='".$order['declaration']."' id='declarationValidate'></div>"; | |
1144 | - | |
1145 | - echo " | |
1146 | - <label>¹ ñêëàäà:</label> | |
1147 | - <div class=info><input type='text' name='user[warehouse]' style='width:300px;' class=\"validate[required]\" value='".$order['warehouse']."' id='warehouseValidate'></div>"; | |
1148 | - | |
1149 | - | |
1150 | - $array_method = array("Îïëàòèòü íàëè÷íûìè","Îïëàòèòü íà êàðòó Ïðèâàò Áàíêà","Îïëàòèòü ïî áåçíàëè÷íîìó ðàñ÷åòó","Îïëàòèòü Ïðàâåêñ-òåëåãðàô"); | |
1151 | - echo" | |
1152 | - <div class=info> | |
1153 | - <label>Ñïîñîá îïëàòû:</label> | |
1154 | - <select name='user[payment]' style='width:300px'><option value=''></option>"; | |
1155 | - foreach($array_method as $method){ | |
1156 | - echo'<option value="'.$method.'" '; | |
1157 | - if($order['payment']==$method)echo'selected'; | |
1158 | - echo'>'.$method.'</option>'; | |
1159 | - } | |
1160 | - echo "</select> | |
1161 | - </div>"; | |
1162 | - | |
1163 | - echo"<label>Ñòðàõîâêà:</label> | |
1164 | - <div class=info><input type='text' name='user[insurance]' style='width:300px;' class=\"validate[required]\" value='".$order['insurance']."' id='insuranceValidate'></div>"; | |
1165 | - | |
1166 | - echo"<label>Ãîðîä:</label> | |
1167 | - <div class=info><input type='text' name='user[city]' style='width:300px;' class=\"validate[required]\" value='".$order['city']."' id='cityValidate'></div> | |
1168 | - | |
1169 | - <label>Àäðåñ:</label> | |
1170 | - <div class=info><input type='text' name='user[address]' style='width:300px;' class=\"validate[required]\" value='".$order['address']."' id='addressValidate'></div> | |
1171 | - | |
1172 | - <label>Êîìåíòàðèé (ìåíåäæåðà):</label> | |
1173 | - <div class=info><textarea rows='4' id='mcomment' style='width:400px;' name='user[mcomment]' cols='30' name='mcomment'>".$order['mcomment']."</textarea></div> | |
1174 | - | |
1175 | - "; | |
1176 | - $disabled = ""; | |
1177 | - if($order['meneger']>0){ | |
1178 | - if($_SESSION['admin']['id']!=1 and $_SESSION['admin']['id']!=7){$disabled = "disabled";} | |
1179 | - } | |
1180 | - echo"<label>Ìåíåäæåð:</label> | |
1181 | - <div class=info><select name='meneger' $disabled> | |
1182 | - <option value='0'></option>"; | |
1183 | - $selected = ($order['meneger']>0) ? $order['meneger'] : $_SESSION['admin']['id']; | |
1184 | - $result_1 = mysql_query("select * from zlo_admin"); | |
1185 | - while ($row = mysql_fetch_assoc($result_1)) { | |
1186 | - echo "<option value='".$row["id"]."' ".(($selected==$row["id"])?'selected':'').">".$row["username"]."</option>"; | |
1187 | - } | |
1188 | - echo"</select>"; | |
1189 | - if($disabled == "disabled"){echo"<input type='hidden' name='meneger' value='".$order['meneger']."'>";} | |
1190 | - echo"</div>"; | |
1191 | - | |
1192 | - echo"</div> | |
1193 | - </fieldset> | |
1194 | - <div class=clear></div> | |
1195 | - </div>"; | |
1196 | - | |
1197 | - // Òàáëèöà òîâàðîâ | |
1198 | - | |
1199 | - $sql3 = "SELECT * FROM catalogs_orders_products | |
1200 | - WHERE `order_id`='".$order['order_id']."' "; | |
1201 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
1202 | - if (mysql_affected_rows()!=0) { $i=0; | |
1203 | - echo" | |
1204 | - <fieldset id='order-details'> | |
1205 | - <legend>Òîâàðû</legend> | |
1206 | - <div class='table'> | |
1207 | - <div class='count'>¹</div> | |
1208 | - <div class='code'>Êîä</div> | |
1209 | - <div class='brand'>Áðåíä</div> | |
1210 | - <div class='title'>Íàéìåíîâàíèå</div> | |
1211 | - <div class='size'>Ðàçìåð</div> | |
1212 | - <div class='color'>Öâåò</div> | |
1213 | - <div class='quant'>Êîë.</div> | |
1214 | - <div class='price'>Öåíà</div> | |
1215 | - <div class='total'>Ñóììà</div> | |
1216 | - <div class='reservation'>Áðîíü</div> | |
1217 | - <div class='onstock'>Íàëè÷èå</div> | |
1218 | - <div class='control' style='float:right;'><a href='javascript:return false;' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a></div> | |
1219 | - <div class='clear'></div> | |
1220 | - </div> | |
1221 | - <div id='lines'> | |
1222 | - <!-- Ïðÿ÷åì ýòó ñòðî÷êó, òàê êàê ÿâàñêðèïò êîïèïóåò ïåðâóþ ñòðî÷êó êàê ïóñòóþ --> | |
1223 | - <div id='line0'> | |
1224 | - <div class='row'> | |
1225 | - <div class='count' id='id(0)'>1</div> | |
1226 | - <div class='code'> | |
1227 | - <input type='text' name='item[code][]' value='' id='code(0)' autocomplete='off' onkeyup=flyFind(this.value,'(0)') onkeydown=selectFirst(event.keyCode)> | |
1228 | - <!-- search ---> | |
1229 | - <div class='livesearch-block'> | |
1230 | - <div id='livesearch(0)'></div> | |
1231 | - </div> | |
1232 | - <!-- ---> | |
1233 | - </div> | |
1234 | - <div class='brand' id='brand(0)'> </div> | |
1235 | - <div class='title' id='title(0)'> </div> | |
1236 | - <div class='size' id='size(0)'> </div> | |
1237 | - <div class='color' id='color(0)'> </div> | |
1238 | - <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(0)' onBlur='SumPerRow();'></div> | |
1239 | - <div class='price' id='price(0)'>0</div> | |
1240 | - <div class='total' id='total(0)'>0</div> | |
1241 | - <div class='reservation'><input type='text' size='3' name='item[reservation][]' /></div> | |
1242 | - <div class='onstock' id='onstock(0)'></div> | |
1243 | - | |
1244 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue(0)' value=''> | |
1245 | - <input type='hidden' name='item[product_id][]' id='product_idValue(0)' value=''> | |
1246 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue(0)' value=''> | |
1247 | - <input type='hidden' name='item[price][]' id='priceValue(0)' value='0'> | |
1248 | - <input type='hidden' name='item[total][]' id='totalValue(0)' value='0'> | |
1249 | - | |
1250 | - <div class='control' style='float:right;'> | |
1251 | - <a href='javascript:return false;' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
1252 | - <a href='javascript:return false;' onclick='DDivLine(0);'><img src='/account/pic/del.png' width='18px'></a> | |
1253 | - </div> | |
1254 | - | |
1255 | - <div class='clear'></div> | |
1256 | - </div><div style='clear:both;'></div> | |
1257 | - </div> | |
1258 | - | |
1259 | - <!---------------------------------------------------------------------------------->"; | |
1260 | - | |
1261 | - while ($item_id=mysql_fetch_assoc($result3)) { $i++; | |
1262 | - | |
1263 | - // Èíôî î òîâàðå | |
1264 | - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m | |
1265 | - LEFT JOIN catalogs_products as p | |
1266 | - ON p.id=m.product_id | |
1267 | - WHERE m.id='".$item_id['product_id']."' "; | |
1268 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
1269 | - if (mysql_affected_rows()==0) { | |
1270 | - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m | |
1271 | - LEFT JOIN catalogs_products as p | |
1272 | - ON p.id=m.product_id | |
1273 | - WHERE m.code='".$item_id['code']."' "; | |
1274 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
1275 | - } | |
1276 | - if (mysql_affected_rows()!=0) { | |
1277 | - $item=mysql_fetch_assoc($result4); | |
1278 | - | |
1279 | - // íàëè÷èå òîâàðà | |
1280 | - $sql5 = "SELECT c.name as city, o.count | |
1281 | - FROM catalogs_keys_products_cities as o | |
1282 | - LEFT JOIN catalogs_cities as c | |
1283 | - ON o.city_id=c.id | |
1284 | - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | |
1285 | - $result5 = mysql_query($sql5) or die(mysql_error()); | |
1286 | - if (mysql_affected_rows()!=0) { | |
1287 | - $onStockDesc=''; | |
1288 | - while ($onStock=mysql_fetch_assoc($result5)) { | |
1289 | - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | |
1290 | - } | |
1291 | - } else { $onStock='íåò';} | |
1292 | - | |
1293 | - echo"<div id='line$i' ".(($item_id['count']==0)?"style='background:#ffc5c5;'":"")."> | |
1294 | - <div class='row'> | |
1295 | - <div class='count' id='id($i)'>$i</div> | |
1296 | - <div class='code'>"; | |
1297 | - if($item_id['count']==0){ | |
1298 | - echo"<input type='text' value='".$item['code']."' disabled />"; | |
1299 | - echo"<input type='hidden' name='item[code][]' value='".$item['code']."' />"; | |
1300 | - } | |
1301 | - else{ | |
1302 | - echo" | |
1303 | - <input type='text' name='item[code][]' value='".$item['code']."' id='code($i)' autocomplete='off' onkeyup=flyFind(this.value,'($i)') onkeydown=selectFirst(event.keyCode)> | |
1304 | - <!-- search ---> | |
1305 | - <div class='livesearch-block'> | |
1306 | - <div id='livesearch($i)'></div> | |
1307 | - </div> | |
1308 | - <!-- --->"; | |
1309 | - } | |
1310 | - echo" | |
1311 | - </div> | |
1312 | - <div class='brand' id='brand($i)'>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." </div> | |
1313 | - <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> | |
1314 | - <div class='size' id='size($i)'>".$item['size']." </div> | |
1315 | - <div class='color' id='color($i)'>".$item['color']." </div> | |
1316 | - <div class='quant'><input type='text' name='item[quant][]' value='".$item_id['count']."' id='quantValue($i)' onBlur='SumPerRow();'></div> | |
1317 | - <div class='price' id='price($i)'>".$item['cine']."</div> | |
1318 | - <div class='total' id='total($i)'>".($item['cine']*$item_id['count'])."</div> | |
1319 | - <div class='reservation'>"; | |
1320 | - if($item_id['count']==0){ | |
1321 | - echo"<input type='text' size='3' value='".$item_id['reservation']."' disabled />"; | |
1322 | - echo"<input type='hidden' name='item[reservation][]' value='".$item_id['reservation']."' />"; | |
1323 | - }else{ | |
1324 | - echo"<input type='text' size='3' name='item[reservation][]' value='".$item_id['reservation']."' />"; | |
1325 | - } | |
1326 | - echo"</div> | |
1327 | - <div class='onstock' id='onstock($i)'>$onStockDesc</div> | |
1328 | - | |
1329 | - | |
1330 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue($i)' value='".$item['mod_id']."'> | |
1331 | - <input type='hidden' name='item[product_id][]' id='product_idValue($i)' value='".$item['product_id']."'> | |
1332 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue($i)' value='".$item['brend_id']."'> | |
1333 | - <input type='hidden' name='item[price][]' id='priceValue($i)' value='".$item['cine']."'> | |
1334 | - <input type='hidden' name='item[total][]' id='totalValue($i)' value='".($item['cine']*$item_id['count'])."'> | |
1335 | - | |
1336 | - <div class='control' style='float:right;'> | |
1337 | - <a href='javascript:return false;' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
1338 | - <!--a href='javascript:return false;' onclick='RemoveDivLine($i);'><img src='/account/pic/del.png' width='18px'></a--> | |
1339 | - <a href='javascript:return false;' onclick='DDivLine($i);'><img src='/account/pic/del.png' width='18px'></a> | |
1340 | - </div> | |
1341 | - | |
1342 | - <div class='clear'></div> | |
1343 | - </div><div style='clear:both;'></div> | |
1344 | - </div>"; | |
1345 | - } | |
1346 | - | |
1347 | - } | |
1348 | - | |
1349 | - echo"</div> | |
1350 | - | |
1351 | - <div class='report'> | |
1352 | - Ñòîèìîñòü äîñòàâêè <input type='text' size='10' name='cost_delivery' id='cost_delivery' value='".$order['cost_delivery']."' onBlur='SumPerRow()' /> | |
1353 | - Âñåãî: <span id='quantity'>0</span> òîâàðîâ íà <span id='summary'>0</span> ãðí. | |
1354 | - </div> | |
1355 | - | |
1356 | - <input type='hidden' name='summary' value='' id='summaryValue'> | |
1357 | - <input type='hidden' name='user_id' value='".$order['user_id']."'> | |
1358 | - <input type='hidden' name='order_id' value='".$order['order_id']."'> | |
1359 | - <input type='hidden' name='send' value='edit-order'> | |
1360 | - | |
1361 | - | |
1362 | - "; | |
1363 | - | |
1364 | - echo"<div class='clear'></div>"; | |
1365 | - | |
1366 | - // Äëÿ XML ôàéëà | |
1367 | - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); | |
1368 | - | |
1369 | - // Ñìåíà ñòàòóñà | |
1370 | - if ($order['status']!=6) { | |
1371 | - echo "<div class='pager-pages'>"; | |
1372 | - /*"<div id='show'>Ïåðåâåñòè</div> | |
1373 | - <form method='POST' action='".$_SERVER["REQUEST_URI"]."' id='PerPageForm' name='SetStatus'> | |
1374 | - <select size='1' name='status' id='PerPage' >"; | |
1375 | - $sql4 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
1376 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
1377 | - if (mysql_affected_rows()!=0) { | |
1378 | - | |
1379 | - while ($row4=mysql_fetch_assoc($result4)) { | |
1380 | - if($row4['id'] == $order['status']) $chek ="SELECTED"; | |
1381 | - else $chek = ""; | |
1382 | - echo"<option value='".$row4['id']."' ".$chek.">".$row4['title']."</option>\n"; | |
1383 | - } | |
1384 | - echo"</select>"; | |
1385 | - echo"<input type='hidden' name='action' value='status'> | |
1386 | - <input type='hidden' name='order_id' value='".$order['order_id']."'>"; | |
1387 | - } | |
1388 | - | |
1389 | - | |
1390 | - echo"</form>";*/ | |
1391 | - | |
1392 | - echo" | |
1393 | - <!--<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>--> | |
1394 | - <div id='records'><input type='submit' class='button-save' title='Ñîõðàíèòü' value='Ñîõðàíèòü' onclick=\"document.forms['edit_order'].submit();\"></div> | |
1395 | - <div id='records'><a href='/account/admin/orders.php?action=print&order_id=".$order['order_id']."' target='_new' class='button-save'>Ïå÷àòü</a></div>"; | |
1396 | - | |
1397 | - /* if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { | |
1398 | - 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>"; | |
1399 | - }*/ | |
1400 | - | |
1401 | - | |
1402 | - echo"</div>"; | |
1403 | - } | |
1404 | - echo"</fieldset></div>"; | |
1405 | - | |
1406 | - echo"</div>"; | |
1407 | - | |
1408 | - } | |
1409 | - | |
1410 | - } else { echo"<p>Ïóñòî</p>";} | |
1411 | - | |
1412 | - // ===================== | |
1413 | - // ===== javascript ==== | |
1414 | - // ===================== | |
1415 | - | |
1416 | - echo" | |
1417 | - <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | |
1418 | - <script type='text/javascript' src='/js/msg.js'></script> | |
1419 | - <script src='/js/JsHttpRequest.js'></script> | |
1420 | - <script src='/js/OrderContol.js' type='text/javascript'></script>"; | |
1421 | - | |
1422 | - echo'<script> | |
1423 | -jQuery(document).ready(function(){ | |
1424 | -$( "#sms_tpl" ).change(function() { | |
1425 | -$.get("/ajax/sms_tpl.php", { tplID: this.value },function(data) { | |
1426 | - $("#sms_msg").val(data); | |
1427 | - $("#sms_c").html($("#sms_msg").val().length); | |
1428 | -}); | |
1429 | -}); | |
1430 | - | |
1431 | -$( "#sms_send" ).click(function() { | |
1432 | - if($("#sms_tel1").attr("checked") || $("#sms_tel2").attr("checked")) { | |
1433 | - return true; | |
1434 | - }else{ | |
1435 | - alert("Íå óêàçàí íîìåð òåëåôîíà!"); | |
1436 | - return false; | |
1437 | - } | |
1438 | -}); | |
1439 | - | |
1440 | -w=120; | |
1441 | -$( "input[name=\'sms_type\']" ).click(function() { | |
1442 | - i = $("#sms_msg").val().length; | |
1443 | - if(this.value=="l"){w=120;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} | |
1444 | - else{w=70;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} | |
1445 | - $("#sms_c_sum").html(w); | |
1446 | - }); | |
1447 | -$("#sms_c_sum").html(w); | |
1448 | - | |
1449 | - | |
1450 | -$("#sms_msg").keyup(function(){ | |
1451 | - i = this.value.length; | |
1452 | - if(i>w){$("#sms_c").css( "color","red" );} | |
1453 | - else{$("#sms_c").css( "color","black" );} | |
1454 | - $("#sms_c").html(i); | |
1455 | - }); | |
1456 | - | |
1457 | - | |
1458 | -}); | |
1459 | - </script>'; | |
1460 | - | |
1461 | - echo" | |
1462 | - <!-------[ Form falidator ]-------> | |
1463 | - <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> | |
1464 | - <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | |
1465 | - | |
1466 | - <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> | |
1467 | - <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script> | |
1468 | - | |
1469 | - <script> | |
1470 | - jQuery(document).ready(function(){ | |
1471 | - // binds form submission and fields to the validation engine | |
1472 | - jQuery('#add-item').validationEngine(); | |
1473 | - }); | |
1474 | - </script> | |
1475 | - <!-------->"; | |
1476 | - | |
1477 | - print'</td></tr>'; | |
1478 | - } | |
1479 | - | |
1480 | - | |
1481 | - $i1++; | |
1482 | - } print"</table>"; | |
1483 | - print"<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | |
1484 | - <script type='text/javascript' src='/js/msg2.js'></script>"; | |
1485 | - | |
1486 | - echo"</div>"; | |
1487 | - | |
1488 | - | |
1489 | - | |
1490 | - // === Pager | |
1491 | - | |
1492 | - echo"<div class='grid-pager'> | |
1493 | - ".pagerGetShow($pager)." | |
1494 | - </div>"; | |
1495 | - | |
1496 | - } | |
1497 | - | |
1498 | - } | |
1499 | - | |
1500 | - // =============== | |
1501 | - // ===== show ==== | |
1502 | - // =============== | |
1503 | - | |
1504 | - if (isset($_GET['action']) && $_GET['action']=='show') { | |
1505 | - | |
1506 | - // Òàáñ | |
1507 | - | |
1508 | - echo"<div class='order-tabs'>"; | |
1509 | - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
1510 | - $result = mysql_query($sql) or die(mysql_error()); | |
1511 | - if (mysql_affected_rows()!=0) { | |
1512 | - while ($row=mysql_fetch_assoc($result)) { | |
1513 | - | |
1514 | - // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | |
1515 | - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; | |
1516 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
1517 | - $row2=mysql_fetch_assoc($result2); | |
1518 | - | |
1519 | - echo"<div class='status-tabs' onclick=\"location.href='".urlQueryChange2('status',$row['id'])."&page=1'\">".$row['title']."(".$row2['calc'].")</div>"; | |
1520 | - } | |
1521 | - } | |
1522 | - echo"</div> | |
1523 | - <div class='clear'></div> | |
1524 | - "; | |
1525 | - | |
1526 | - if(!isset($_GET['status'])) {$_GET['status']=1;} | |
1527 | - | |
1528 | - // =========== Ãåíåðèì òàáëèöó =========== | |
1529 | - | |
1530 | - $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 | |
1531 | - FROM catalogs_orders as o | |
1532 | - LEFT JOIN zlo_users as u on u.id=o.user_id | |
1533 | - WHERE u.id=".$_GET['user']." AND o.status=".$_GET['status']." ORDER BY mktime DESC "; | |
1534 | - $pager['sql']= $sql; | |
1535 | - $pager=pagerGetRun($pager,10,15); //echo$pager['sql']; | |
1536 | - $result = mysql_query($pager['sql']) or die(mysql_error()); | |
1537 | - if (mysql_affected_rows()!=0) { | |
1538 | - | |
1539 | - // =================== | |
1540 | - // === ÏÐÎÄÎËÆÅÍÈÅ === | |
1541 | - // =================== | |
1542 | - | |
1543 | - while ($order=mysql_fetch_assoc($result)) { | |
1544 | - | |
1545 | - echo"<div class='orders'>"; | |
1546 | - | |
1547 | - echo"<div class='order-info-all'> | |
1548 | - | |
1549 | - <div class=order-info> | |
1550 | - <h4>Çàêàç #".$order['order_id']."<br> | |
1551 | - Äàòà: ".date('Y-m-d H:i:s',$order['mktime'])." | |
1552 | - </h4> | |
1553 | - <fieldset id='order-info' style='background: ".$order['color'].";'> | |
1554 | - <legend>Êëèåíò</legend> | |
1555 | - | |
1556 | - <label>Êëèåíò:</label> | |
1557 | - <div class=info><a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>".$order['username']."</a> </div> | |
1558 | - | |
1559 | - <label>Òåë:</label> | |
1560 | - <div class=info>".$order['tel']." </div> | |
1561 | - | |
1562 | - <label>Òåë 2:</label> | |
1563 | - <div class=info>".$order['tel2']." </div> | |
1564 | - | |
1565 | - <label>Ãðóïïà:</label> | |
1566 | - <div class=info>".viewBook('zlo_users_group', $order['group'], 'id', 'name')." </div> | |
1567 | - | |
1568 | - <div class=clear></div> | |
1569 | - <a class='history' href='/admin.php/orders/?action=show&user=".$order['user_id']."'>[Èñòîðèÿ çàêàçîâ]</a> | |
1570 | - | |
1571 | - </fieldset> | |
1572 | - | |
1573 | - <fieldset id='order-info' style='background: ".$order['color'].";'> | |
1574 | - <legend>Äîñòàâêà</legend> | |
1575 | - | |
1576 | - <label>Äîñòàâêà:</label> | |
1577 | - <div class=info>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." </div> | |
1578 | - | |
1579 | - <label>Ãîðîä:</label> | |
1580 | - <div class=info>".$order['city']." </div> | |
1581 | - | |
1582 | - <label>Àäðåñ:</label> | |
1583 | - <div class=info>".$order['address']." </div> | |
1584 | - | |
1585 | - <label>Èíôî:</label> | |
1586 | - <div class=info> ".$order['comment']." </div> | |
1587 | - | |
1588 | - <div class=clear></div> | |
1589 | - | |
1590 | - </fieldset> | |
1591 | - <div class=clear></div> | |
1592 | - </div> | |
1593 | - </div>"; | |
1594 | - | |
1595 | - | |
1596 | - // Òàáëèöà òîâàðîâ | |
1597 | - | |
1598 | - echo" | |
1599 | - <div class='order-details'> | |
1600 | - <fieldset id='order-details'> | |
1601 | - <legend>Òîâàðû</legend>"; | |
1602 | - echo"<table> | |
1603 | - <tr> | |
1604 | - <td>¹</td> | |
1605 | - <td>Êîä</td> | |
1606 | - <td>Áðåíä</td> | |
1607 | - <td>Íàçâàíèå</td> | |
1608 | - <td>Ðàçìåð</td> | |
1609 | - <td>Öâåò</td> | |
1610 | - <td>Êîë.</td> | |
1611 | - <td>Öåíà</td> | |
1612 | - <td>Ñóììà</td> | |
1613 | - <td>Íàëè÷èå</td> | |
1614 | - <td></td> | |
1615 | - </tr>"; | |
1616 | - | |
1617 | - $sql3 = " | |
1618 | - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* | |
1619 | - FROM catalogs_orders AS o | |
1620 | - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
1621 | - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
1622 | - LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
1623 | - WHERE o.id='".$order['order_id']."'"; | |
1624 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
1625 | - if (mysql_affected_rows()!=0) { | |
1626 | - while ($item=mysql_fetch_assoc($result3)) { { $i++; | |
1627 | - | |
1628 | - | |
1629 | - // íàëè÷èå òîâàðà | |
1630 | - $sql5 = "SELECT c.name as city, o.count | |
1631 | - FROM catalogs_keys_products_cities as o | |
1632 | - LEFT JOIN catalogs_cities as c | |
1633 | - ON o.city_id=c.id | |
1634 | - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | |
1635 | - $result5 = mysql_query($sql5) or die(mysql_error()); | |
1636 | - if (mysql_affected_rows()!=0) { | |
1637 | - $onStockDesc=''; | |
1638 | - while ($onStock=mysql_fetch_assoc($result5)) { | |
1639 | - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | |
1640 | - } | |
1641 | - } else { $onStockDesc='íåò'; } | |
1642 | - | |
1643 | - echo"<tr> | |
1644 | - <td>$i .</td> | |
1645 | - <td>".$item['code']."</td> | |
1646 | - <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | |
1647 | - <td><a href='/".$item['rubric_id']."-catalogs/".$item['translit']."-".$item['id']."/' target='_new'>".$item['name']."</a></td> | |
1648 | - <td>".$item['size']."</td> | |
1649 | - <td>".$item['color']."</td> | |
1650 | - <td>".$item['count']."</td> | |
1651 | - <td>".$item['cine']."</td> | |
1652 | - <td>".($item['cine']*$item['count'])."</td> | |
1653 | - <td>".$onStockDesc."</td> | |
1654 | - <td></td> | |
1655 | - </tr>"; | |
1656 | - | |
1657 | - } | |
1658 | - | |
1659 | - } | |
1660 | - } | |
1661 | - | |
1662 | - echo"</table> | |
1663 | - <b>Îáùàÿ ñóììà: ".$order['total']." ãðí.</b> | |
1664 | - </div>"; | |
1665 | - | |
1666 | - | |
1667 | - | |
1668 | - echo"<div class='clear'></div></div>"; | |
1669 | - | |
1670 | - } | |
1671 | - | |
1672 | - // === Pager | |
1673 | - | |
1674 | - echo"<div class='grid-pager'> | |
1675 | - ".pagerGetShow($pager)." | |
1676 | - </div>"; | |
1677 | - } | |
1678 | - } | |
1679 | - | |
1680 | - // =============== | |
1681 | - // ===== edit ==== | |
1682 | - // =============== | |
1683 | - | |
1684 | - if (isset($_GET['action']) && $_GET['action']=='edit') { | |
1685 | - | |
1686 | - // Òàáñ | |
1687 | - | |
1688 | - if (!isset($_GET['status'])) {$status=1;} else {$status=$_GET['status'];} | |
1689 | - | |
1690 | - echo"<div class='order-tabs'>"; | |
1691 | - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
1692 | - $result = mysql_query($sql) or die(mysql_error()); | |
1693 | - if (mysql_affected_rows()!=0) { | |
1694 | - while ($row=mysql_fetch_assoc($result)) { | |
1695 | - | |
1696 | - // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | |
1697 | - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; | |
1698 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
1699 | - $row2=mysql_fetch_assoc($result2); | |
1700 | - | |
1701 | - echo"<div class='status-tabs' onclick=\"location.href='".urlQueryChange2('status',$row['id'])."&page=1'\">".$row['title']."(".$row2['calc'].")</div>"; | |
1702 | - } | |
1703 | - } | |
1704 | - echo"</div> | |
1705 | - <div class='clear'></div> | |
1706 | - "; | |
1707 | - | |
1708 | - | |
1709 | - // =========== Ãåíåðèì òàáëèöó =========== | |
1710 | - | |
1711 | - $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 | |
1712 | - FROM catalogs_orders as o | |
1713 | - LEFT JOIN zlo_users as u ON u.id=o.user_id | |
1714 | - LEFT JOIN zlo_users_group as g ON g.id=u.group | |
1715 | - WHERE o.id='".$_GET['order']."'"; | |
1716 | - $result = mysql_query($sql) or die(mysql_error()); | |
1717 | - if (mysql_affected_rows()!=0) { | |
1718 | - | |
1719 | - $order=mysql_fetch_assoc($result); | |
1720 | - | |
1721 | - echo"<form action='' method='POST' name='edit_order' id='add-item'>"; | |
1722 | - echo"<div class='orders'>"; | |
1723 | - | |
1724 | - echo" | |
1725 | - <div class=order-info> | |
1726 | - <fieldset id='order-info' style='background: ".$order['color'].";'> | |
1727 | - <legend>Çàêàç #".$order['order_id']." Cóììà: ".$order['total']." ãðí.</legend> | |
1728 | - | |
1729 | - <label>Äàòà:</label> | |
1730 | - <div class=info>".date('Y-m-d H:i:s',$order['mktime'])."</div> | |
1731 | - | |
1732 | - <label>Îïëà÷åí:</label> | |
1733 | - <div class=info> | |
1734 | - <input type='radio' name='paid' value='1' ".(($order['paid']==1)?'checked':'')."> äà<Br> | |
1735 | - <input type='radio' name='paid' value='0' ".(($order['paid']==0)?'checked':'')."> íåò | |
1736 | - </div> | |
1737 | - | |
1738 | - <label>Ìåòêà:</label> | |
1739 | - <div class=info> | |
1740 | - <select name='label'> | |
1741 | - "; | |
1742 | - for($i=0;$i<=10;$i++){print'<option value="'.$i.'" '.(($order['label']==$i)?'selected':'').'>'.$i.'</option>';}; | |
1743 | - echo"</select> | |
1744 | - </div> | |
1745 | - | |
1746 | - <label>Êëèåíò:</label> | |
1747 | - <div class=info> | |
1748 | - <input type='text' name='user[username]' value='".$order['username']."' disabled='disabled'> | |
1749 | - <input type='hidden' name='user[username]' value='".$order['username']."'> | |
1750 | - </div> | |
1751 | - | |
1752 | - <label>Email:</label> | |
1753 | - <div class=info> | |
1754 | - <input type='text' name='user[email]' value='".$order['email']."' disabled='disabled'> | |
1755 | - <input type='hidden' name='user[email]' value='".$order['email']."'> | |
1756 | - </div> | |
1757 | - | |
1758 | - <label>Òåëåôîí:</label> | |
1759 | - <div class=info> | |
1760 | - <input type='text' name='user[tel]' value='".$order['tel']."' disabled='disabled'> | |
1761 | - <input type='hidden' name='user[tel]' value='".$order['tel']."'> | |
1762 | - </div> | |
1763 | - | |
1764 | - <label>Òåëåôîí 2:</label> | |
1765 | - <div class=info> | |
1766 | - <input type='text' name='user[tel2]' value='".$order['tel2']."' disabled='disabled'> | |
1767 | - <input type='hidden' name='user[tel2]' value='".$order['tel2']."'> | |
1768 | - </div> | |
1769 | - | |
1770 | - <label>Äîñòàâêà</label>"; | |
1771 | - echo " | |
1772 | - <div class=info> | |
1773 | - <select name='user[delivery]'>"; | |
1774 | - viewBookSelectValue('zlo_book_delivery', 'id', 'title', $order['delivery']); | |
1775 | - echo "</select> | |
1776 | - </div>"; | |
1777 | - | |
1778 | - echo " | |
1779 | - <label>Ãîðîä:</label> | |
1780 | - <div class=info><input type='text' name='user[city]' class=\"validate[required]\" value='".$order['city']."' id='cityValidate'> </div> | |
1781 | - | |
1782 | - <label>Àäðåñ:</label> | |
1783 | - <div class=info><input type='text' name='user[address]' class=\"validate[required]\" value='".$order['address']."' id='addressValidate'> </div> | |
1784 | - | |
1785 | - <label>Êîìåíòàðèé:</label> | |
1786 | - <div class=info><textarea rows='4' style='width:400px;' name='user[comment]' cols='30' name='comment'>".$order['comment']."</textarea></div> | |
1787 | - | |
1788 | - <label>Êîìåíòàðèé (ìåíåäæåðà):</label> | |
1789 | - <div class=info><textarea rows='4' id='mcomment' style='width:400px;' name='user[mcomment]' cols='30' name='mcomment'>".$order['mcomment']."</textarea></div> | |
1790 | - | |
1791 | - "; | |
1792 | - | |
1793 | - echo" | |
1794 | - </fieldset> | |
1795 | - <div class=clear></div> | |
1796 | - </div>"; | |
1797 | - | |
1798 | - // Òàáëèöà òîâàðîâ | |
1799 | - | |
1800 | - $sql3 = "SELECT * FROM catalogs_orders_products | |
1801 | - WHERE `order_id`='".$order['order_id']."' "; | |
1802 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
1803 | - if (mysql_affected_rows()!=0) { $i=0; | |
1804 | - echo" | |
1805 | - <fieldset id='order-details'> | |
1806 | - <legend>Òîâàðû</legend> | |
1807 | - <div class='table'> | |
1808 | - <div class='count'>¹</div> | |
1809 | - <div class='code'>Êîä</div> | |
1810 | - <div class='brand'>Áðåíä</div> | |
1811 | - <div class='title'>Íàéìåíîâàíèå</div> | |
1812 | - <div class='size'>Ðàçìåð</div> | |
1813 | - <div class='color'>Öâåò</div> | |
1814 | - <div class='quant'>Êîë.</div> | |
1815 | - <div class='price'>Öåíà</div> | |
1816 | - <div class='total'>Ñóììà</div> | |
1817 | - <div class='onstock'>Íàëè÷èå</div> | |
1818 | - <div class='control' ></div> | |
1819 | - <div class='clear'></div> | |
1820 | - </div> | |
1821 | - <div id='lines'> | |
1822 | - <!-- Ïðÿ÷åì ýòó ñòðî÷êó, òàê êàê ÿâàñêðèïò êîïèïóåò ïåðâóþ ñòðî÷êó êàê ïóñòóþ --> | |
1823 | - <div id='line0'> | |
1824 | - <div class='row'> | |
1825 | - <div class='count' id='id(0)'>1</div> | |
1826 | - <div class='code'> | |
1827 | - <input type='text' name='item[code][]' value='' id='code(0)' autocomplete='off' onkeyup=flyFind(this.value,'(0)') onkeydown=selectFirst(event.keyCode)> | |
1828 | - <!-- search ---> | |
1829 | - <div class='livesearch-block'> | |
1830 | - <div id='livesearch(0)'></div> | |
1831 | - </div> | |
1832 | - <!-- ---> | |
1833 | - </div> | |
1834 | - <div class='brand' id='brand(0)'> </div> | |
1835 | - <div class='title' id='title(0)'> </div> | |
1836 | - <div class='size' id='size(0)'> </div> | |
1837 | - <div class='color' id='color(0)'> </div> | |
1838 | - <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(0)' onBlur='SumPerRow();'></div> | |
1839 | - <div class='price' id='price(0)'>0</div> | |
1840 | - <div class='total' id='total(0)'>0</div> | |
1841 | - <div class='onstock' id='onstock(0)'></div> | |
1842 | - | |
1843 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue(0)' value=''> | |
1844 | - <input type='hidden' name='item[product_id][]' id='product_idValue(0)' value=''> | |
1845 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue(0)' value=''> | |
1846 | - <input type='hidden' name='item[price][]' id='priceValue(0)' value='0'> | |
1847 | - <input type='hidden' name='item[total][]' id='totalValue(0)' value='0'> | |
1848 | - | |
1849 | - <div class='control'> | |
1850 | - <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
1851 | - <a href='#' onclick='RemoveDivLine(0);'><img src='/account/pic/del.png' width='18px'></a> | |
1852 | - </div> | |
1853 | - | |
1854 | - <div class='clear'></div> | |
1855 | - </div> | |
1856 | - </div> | |
1857 | - <!---------------------------------------------------------------------------------->"; | |
1858 | - | |
1859 | - while ($item_id=mysql_fetch_assoc($result3)) { $i++; | |
1860 | - | |
1861 | - // Èíôî î òîâàðå | |
1862 | - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m | |
1863 | - LEFT JOIN catalogs_products as p | |
1864 | - ON p.id=m.product_id | |
1865 | - WHERE m.id='".$item_id['product_id']."' "; | |
1866 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
1867 | - if (mysql_affected_rows()!=0) { | |
1868 | - $item=mysql_fetch_assoc($result4); | |
1869 | - | |
1870 | - // íàëè÷èå òîâàðà | |
1871 | - $sql5 = "SELECT c.name as city, o.count | |
1872 | - FROM catalogs_keys_products_cities as o | |
1873 | - LEFT JOIN catalogs_cities as c | |
1874 | - ON o.city_id=c.id | |
1875 | - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | |
1876 | - $result5 = mysql_query($sql5) or die(mysql_error()); | |
1877 | - if (mysql_affected_rows()!=0) { | |
1878 | - $onStockDesc=''; | |
1879 | - while ($onStock=mysql_fetch_assoc($result5)) { | |
1880 | - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | |
1881 | - } | |
1882 | - } else { $onStock='íåò';} | |
1883 | - | |
1884 | - echo"<div id='line$i' ".(($item_id['count']==0)?"style='background:#ffc5c5;'":"")."> | |
1885 | - <div class='row'> | |
1886 | - <div class='count' id='id($i)'>$i</div> | |
1887 | - <div class='code'> | |
1888 | - <input type='text' name='item[code][]' value='".$item['code']."' id='code($i)' autocomplete='off' onkeyup=flyFind(this.value,'($i)') onkeydown=selectFirst(event.keyCode)> | |
1889 | - <!-- search ---> | |
1890 | - <div class='livesearch-block'> | |
1891 | - <div id='livesearch($i)'></div> | |
1892 | - </div> | |
1893 | - <!-- ---> | |
1894 | - </div> | |
1895 | - <div class='brand' id='brand($i)'>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." </div> | |
1896 | - <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> | |
1897 | - <div class='size' id='size($i)'>".$item['size']." </div> | |
1898 | - <div class='color' id='color($i)'>".$item['color']." </div> | |
1899 | - <div class='quant'><input type='text' name='item[quant][]' value='".$item_id['count']."' id='quantValue($i)' onBlur='SumPerRow();'></div> | |
1900 | - <div class='price' id='price($i)'>".$item['cine']."</div> | |
1901 | - <div class='total' id='total($i)'>".($item['cine']*$item_id['count'])."</div> | |
1902 | - <div class='onstock' id='onstock($i)'>$onStockDesc</div> | |
1903 | - | |
1904 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue($i)' value='".$item['mod_id']."'> | |
1905 | - <input type='hidden' name='item[product_id][]' id='product_idValue($i)' value='".$item['product_id']."'> | |
1906 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue($i)' value='".$item['brend_id']."'> | |
1907 | - <input type='hidden' name='item[price][]' id='priceValue($i)' value='".$item['cine']."'> | |
1908 | - <input type='hidden' name='item[total][]' id='totalValue($i)' value='".($item['cine']*$item_id['count'])."'> | |
1909 | - | |
1910 | - <div class='control'> | |
1911 | - <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
1912 | - <a href='#' onclick='RemoveDivLine($i);'><img src='/account/pic/del.png' width='18px'></a> | |
1913 | - <a href='#' onclick='DDivLine($i);'>Ä</a> | |
1914 | - </div> | |
1915 | - | |
1916 | - <div class='clear'></div> | |
1917 | - </div><div style='clear:both;'></div> | |
1918 | - </div>"; | |
1919 | - } | |
1920 | - | |
1921 | - } | |
1922 | - | |
1923 | - echo"</div> | |
1924 | - | |
1925 | - <div class='report'> | |
1926 | - Âñåãî: <span id='quantity'>0</span> òîâàðîâ íà <span id='summary'>0</span> ãðí. | |
1927 | - </div> | |
1928 | - | |
1929 | - <input type='hidden' name='summary' value='' id='summaryValue'> | |
1930 | - <input type='hidden' name='user_id' value='".$order['user_id']."'> | |
1931 | - <input type='hidden' name='order_id' value='".$order['order_id']."'> | |
1932 | - <input type='hidden' name='send' value='edit-order'> | |
1933 | - | |
1934 | - | |
1935 | - "; | |
1936 | - | |
1937 | - echo"<div class='clear'></div>"; | |
1938 | - | |
1939 | - // Äëÿ XML ôàéëà | |
1940 | - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); | |
1941 | - | |
1942 | - // Ñìåíà ñòàòóñà | |
1943 | - if ($order['status']!=6) { | |
1944 | - echo "<div class='pager-pages'> | |
1945 | - <div id='show'>Ïåðåâåñòè</div> | |
1946 | - <form method='POST' action='".$_SERVER["REQUEST_URI"]."' id='PerPageForm' name='SetStatus'> | |
1947 | - <select size='1' name='status' id='PerPage' >"; | |
1948 | - $sql4 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
1949 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
1950 | - if (mysql_affected_rows()!=0) { | |
1951 | - | |
1952 | - while ($row4=mysql_fetch_assoc($result4)) { | |
1953 | - if($row4['id'] == $order['status']) $chek ="SELECTED"; | |
1954 | - else $chek = ""; | |
1955 | - echo"<option value='".$row4['id']."' ".$chek.">".$row4['title']."</option>\n"; | |
1956 | - } | |
1957 | - echo"</select>"; | |
1958 | - echo"<input type='hidden' name='action' value='status'> | |
1959 | - <input type='hidden' name='order_id' value='".$order['order_id']."'>"; | |
1960 | - } | |
1961 | - | |
1962 | - | |
1963 | - echo"</form>"; | |
1964 | - | |
1965 | - echo" | |
1966 | - <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> | |
1967 | - <div id='records'><input type='submit' class='button-save' title='Ñîõðàíèòü' value='Ñîõðàíèòü' onclick=\"document.forms['edit_order'].submit();\"></div> | |
1968 | - <div id='records'><a href='/account/admin/orders.php?action=print&order_id=".$order['order_id']."' target='_new' class='button-save'>Ïå÷àòü</a></div>"; | |
1969 | - | |
1970 | - if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { | |
1971 | - 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>"; | |
1972 | - } | |
1973 | - | |
1974 | - | |
1975 | - echo"</div>"; | |
1976 | - } | |
1977 | - echo"</fieldset></div>"; | |
1978 | - | |
1979 | - echo"</div>"; | |
1980 | - | |
1981 | - } | |
1982 | - | |
1983 | - } else { echo"<p>Ïóñòî</p>";} | |
1984 | - | |
1985 | - // ===================== | |
1986 | - // ===== javascript ==== | |
1987 | - // ===================== | |
1988 | - | |
1989 | - echo" | |
1990 | - <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | |
1991 | - <script type='text/javascript' src='/js/msg.js'></script> | |
1992 | - <script src='/js/JsHttpRequest.js'></script> | |
1993 | - <script src='/js/OrderContol.js' type='text/javascript'></script>"; | |
1994 | - | |
1995 | - | |
1996 | - | |
1997 | - echo" | |
1998 | - <!-------[ Form falidator ]-------> | |
1999 | - <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> | |
2000 | - <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | |
2001 | - | |
2002 | - <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> | |
2003 | - <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script> | |
2004 | - | |
2005 | - <script> | |
2006 | - jQuery(document).ready(function(){ | |
2007 | - // binds form submission and fields to the validation engine | |
2008 | - jQuery('#add-item').validationEngine(); | |
2009 | - }); | |
2010 | - </script> | |
2011 | - <!-------->"; | |
2012 | - } | |
2013 | - | |
2014 | - | |
2015 | - | |
2016 | - | |
2017 | - // ============= | |
2018 | - // ==== add ==== | |
2019 | - // ============= | |
2020 | - | |
2021 | - if (isset($_GET['action']) && $_GET['action']=='add') { | |
2022 | - | |
2023 | - if (isset($_POST['user'])) {} | |
2024 | - | |
2025 | - $user=array(); | |
2026 | - | |
2027 | - if(isset($_GET['user'])) { | |
2028 | - | |
2029 | - $sql = "SELECT * FROM zlo_users WHERE id='".$_GET['user']."'"; | |
2030 | - $result = mysql_query($sql) or die(mysql_error()); | |
2031 | - if (mysql_affected_rows()!=0) { | |
2032 | - $user=mysql_fetch_assoc($result); | |
2033 | - } | |
2034 | - | |
2035 | - } else { | |
2036 | - | |
2037 | - if(isset($_POST)) {$user=$_POST['user'];} | |
2038 | - | |
2039 | - } | |
2040 | - | |
2041 | - | |
2042 | - | |
2043 | - echo"<form action='' method='POST' name='add_order' id='add-item'>"; | |
2044 | - echo"<div class='add-order'>"; | |
2045 | - echo"<div class='orders'>"; | |
2046 | - | |
2047 | - echo" | |
2048 | - <div class=order-info> | |
2049 | - <fieldset id='order-info'> | |
2050 | - <legend>Íîâûé çàêàç</legend> | |
2051 | - <div style='float:left;width:400px;'> | |
2052 | - <label>Äàòà:</label> | |
2053 | - <div class=info>".date('d-m-Y H:i:s')."</div>"; | |
2054 | - | |
2055 | - echo"<label>Îïëà÷åí:</label> | |
2056 | - <div class=info style='float:left;padding-right:20px;'> | |
2057 | - <select name='paid'> | |
2058 | - <option value='0' ".(($user['paid']==0)?'selected':'').">íåò</option> | |
2059 | - <option value='1' ".(($user['paid']==1)?'selected':'').">äà</option> | |
2060 | - </select> | |
2061 | - </div> | |
2062 | - <div> | |
2063 | - <label style='width:50px'>Ìåòêà:</label> | |
2064 | - <div class=info> | |
2065 | - <select name='label'> | |
2066 | - "; | |
2067 | - for($i=0;$i<=10;$i++){print'<option value="'.$i.'" '.(($user['label']==$i)?'selected':'').'>'.$i.'</option>';}; | |
2068 | - echo"</select> | |
2069 | - </div> | |
2070 | - </div>"; | |
2071 | - | |
2072 | - if(!isset($_GET['user'])) { | |
2073 | - echo"<div class='new'>Ïî óìîë÷àíèþ<input type='checkbox' onChange='newUnknownUser();' id='default'></div>"; | |
2074 | - } | |
2075 | - | |
2076 | - if(isset($_GET['user'])) { | |
2077 | - | |
2078 | - $readonly='readonly="readonly"'; | |
2079 | - $disabled='disabled="disabled"'; | |
2080 | - | |
2081 | - } else {$readonly='';$disabled='';} | |
2082 | - | |
2083 | - echo" | |
2084 | - <label>Email:<font color='red'>*</font></label> | |
2085 | - <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> | |
2086 | - <!-- search ---> | |
2087 | - <div class='livesearch-email-block'> | |
2088 | - <div id='livesearch-email-list'></div> | |
2089 | - </div> | |
2090 | - <!-- ---> | |
2091 | - | |
2092 | - <label>Òåëåôîí:<font color='red'>*</font></label> | |
2093 | - <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> | |
2094 | - <!-- search ---> | |
2095 | - <div class='livesearch-tel-block'> | |
2096 | - <div id='livesearch-tel-list'></div> | |
2097 | - </div> | |
2098 | - <!-- ---> | |
2099 | - | |
2100 | - | |
2101 | - <label>Êëèåíò:<font color='red'>*</font></label> | |
2102 | - <div class=info><input type='text' style='width:300px;' name='user[username]' value='".$user['username']."' id='usernameValue' $readonly></div> | |
2103 | - | |
2104 | - <label>Òåëåôîí 2:</label> | |
2105 | - <div class=info><input type='text' style='width:300px;' name='user[tel2]' value='".$user['tel2']."' id='tel2Value'></div>"; | |
2106 | - | |
2107 | - echo"<label>¹ êàðòî÷êè:</label> | |
2108 | - <div class=info> | |
2109 | - <input type='text' name='user[cards]' value='".$user['cards']."' style='width:300px;' id='cardsValue'> | |
2110 | - </div>"; | |
2111 | - | |
2112 | - echo " | |
2113 | - <label>Êîìåíòàðèé:</label> | |
2114 | - <div class=info><textarea rows='2' style='width:300px;' name='user[comment]' cols='30' name='comment'>".$user['comment']."</textarea></div>"; | |
2115 | - | |
2116 | - // ãðóïïà | |
2117 | - echo" | |
2118 | - <label>Ãðóïïà</label>"; | |
2119 | - | |
2120 | - echo "<select style='width:300px;' name='user[group]' id='usergroup' $disabled >"; | |
2121 | - viewBookSelectValue('zlo_users_group', 'id', 'name', $user['group']); | |
2122 | - echo "</select>"; | |
2123 | - | |
2124 | - // hidden | |
2125 | - if (isset($_GET['user'])) { | |
2126 | - echo"<input type='hidden' name='user[group]' value='".$user['group']."'>"; | |
2127 | - } | |
2128 | - | |
2129 | - echo"<input type='hidden' name='user[user_id]' value='".$user['id']."' id='user_id'>"; | |
2130 | - | |
2131 | - echo"</div><div style='float:right;'> | |
2132 | - <label>Äîñòàâêà</label>"; | |
2133 | - echo " | |
2134 | - <div class=info> | |
2135 | - <select name='user[delivery]' style='width:300px'>"; | |
2136 | - viewBookSelectValue('zlo_book_delivery', 'id', 'title', $user['delivery']); | |
2137 | - echo "</select> | |
2138 | - </div>"; | |
2139 | - | |
2140 | - echo " | |
2141 | - <label>Äåêëàðàöèÿ ¹:</label> | |
2142 | - <div class=info><input type='text' name='user[declaration]' style='width:300px;' value='".$user['declaration']."' id='declarationValidate'></div>"; | |
2143 | - | |
2144 | - echo " | |
2145 | - <label>¹ ñêëàäà:</label> | |
2146 | - <div class=info><input type='text' name='user[warehouse]' style='width:300px;' value='".$user['warehouse']."' id='warehouseValidate'></div>"; | |
2147 | - | |
2148 | - | |
2149 | - $array_method = array("Îïëàòèòü íàëè÷íûìè","Îïëàòèòü íà êàðòó Ïðèâàò Áàíêà","Îïëàòèòü ïî áåçíàëè÷íîìó ðàñ÷åòó","Îïëàòèòü Ïðàâåêñ-òåëåãðàô"); | |
2150 | - echo" | |
2151 | - <div class=info> | |
2152 | - <label>Ñïîñîá îïëàòû:</label> | |
2153 | - <select name='user[payment]' style='width:300px'><option value=''></option>"; | |
2154 | - foreach($array_method as $method){ | |
2155 | - echo'<option value="'.$method.'" '; | |
2156 | - if($user['payment']==$method)echo'selected'; | |
2157 | - echo'>'.$method.'</option>'; | |
2158 | - } | |
2159 | - echo "</select> | |
2160 | - </div>"; | |
2161 | - | |
2162 | - echo"<label>Ñòðàõîâêà:</label> | |
2163 | - <div class=info><input type='text' name='user[insurance]' style='width:300px;' value='".$user['insurance']."' id='insuranceValidate'></div>"; | |
2164 | - | |
2165 | - echo"<label>Ãîðîä:<font color='red'>*</font></label> | |
2166 | - <div class=info><input type='text' name='user[city]' style='width:300px;' class=\"validate[required]\" value='".$user['city']."' id='cityValue'></div> | |
2167 | - | |
2168 | - <label>Àäðåñ:<font color='red'>*</font></label> | |
2169 | - <div class=info><input type='text' name='user[address]' style='width:300px;' class=\"validate[required]\" value='".$user['address']."' id='addressValue'></div> | |
2170 | - | |
2171 | - <label>Êîìåíòàðèé (ìåíåäæåðà):</label> | |
2172 | - <div class=info><textarea rows='4' id='mcomment' style='width:400px;' name='user[mcomment]' cols='30' name='mcomment'>".$user['mcomment']."</textarea></div> | |
2173 | - </div> | |
2174 | - "; | |
2175 | - | |
2176 | - echo"<div class=clear></div> | |
2177 | - </fieldset> | |
2178 | - <div class=clear></div> | |
2179 | - </div>"; | |
2180 | - | |
2181 | - echo" | |
2182 | - <fieldset id='order-details'> | |
2183 | - <legend>Òîâàðû</legend> | |
2184 | - <div class='table'> | |
2185 | - <div class='count'>¹</div> | |
2186 | - <div class='code'>Êîä</div> | |
2187 | - <div class='brand'>Áðåíä</div> | |
2188 | - <div class='title'>Íàéìåíîâàíèå</div> | |
2189 | - <div class='size'>Ðàçìåð</div> | |
2190 | - <div class='color'>Öâåò</div> | |
2191 | - <div class='quant'>Êîë.</div> | |
2192 | - <div class='price'>Öåíà</div> | |
2193 | - <div class='total'>Ñóììà</div> | |
2194 | - <div class='reservation'>Áðîíü</div> | |
2195 | - <div class='onstock'>Íàëè÷èå</div> | |
2196 | - <div class='control' ></div> | |
2197 | - <div class='clear'></div> | |
2198 | - </div> | |
2199 | - <div id='lines'> | |
2200 | - <!-- Ïðÿ÷åì ýòó ñòðî÷êó, òàê êàê ÿâàñêðèïò êîïèïóåò ïåðâóþ ñòðî÷êó êàê ïóñòóþ --> | |
2201 | - <div id='line0'> | |
2202 | - <div class='row'> | |
2203 | - <div class='count' id='id(0)'>1</div> | |
2204 | - <div class='code'> | |
2205 | - <input type='text' name='item[code][]' value='' id='code(0)' autocomplete='off' onkeyup=flyFind(this.value,'(0)') onkeydown=selectFirst(event.keyCode)> | |
2206 | - <!-- search ---> | |
2207 | - <div class='livesearch-block'> | |
2208 | - <div id='livesearch(0)'></div> | |
2209 | - </div> | |
2210 | - <!-- ---> | |
2211 | - </div> | |
2212 | - <div class='brand' id='brand(0)'> </div> | |
2213 | - <div class='title' id='title(0)'> </div> | |
2214 | - <div class='size' id='size(0)'> </div> | |
2215 | - <div class='color' id='color(0)'> </div> | |
2216 | - <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(0)' onBlur='SumPerRow();'></div> | |
2217 | - <div class='price' id='price(0)'>0</div> | |
2218 | - <div class='total' id='total(0)'>0</div> | |
2219 | - <div class='reservation'><input type='text' size='3' name='item[reservation][]' value='' /></div> | |
2220 | - <div class='onstock' id='onstock(0)'></div> | |
2221 | - | |
2222 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue(0)' value=''> | |
2223 | - <input type='hidden' name='item[product_id][]' id='product_idValue(0)' value=''> | |
2224 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue(0)' value=''> | |
2225 | - <input type='hidden' name='item[price][]' id='priceValue(0)' value='0'> | |
2226 | - <input type='hidden' name='item[total][]' id='totalValue(0)' value='0'> | |
2227 | - | |
2228 | - <div class='control' style='float:right;'> | |
2229 | - <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
2230 | - <a href='#' onclick='RemoveDivLine(0);'><img src='/account/pic/del.png' width='18px'></a> | |
2231 | - </div> | |
2232 | - | |
2233 | - <div class='clear'></div> | |
2234 | - </div> | |
2235 | - </div> | |
2236 | - <!----------------------------------------------------------------------------------> | |
2237 | - <div id='line1'> | |
2238 | - <div class='row'> | |
2239 | - <div class='count' id='id(1)'>1</div> | |
2240 | - <div class='code'> | |
2241 | - <input type='text' name='item[code][]' value='' id='code(1)' autocomplete='off' onkeyup=flyFind(this.value,'(1)') onkeydown=selectFirst(event.keyCode)> | |
2242 | - <!-- search ---> | |
2243 | - <div class='livesearch-block'> | |
2244 | - <div id='livesearch(1)'></div> | |
2245 | - </div> | |
2246 | - <!-- ---> | |
2247 | - </div> | |
2248 | - <div class='brand' id='brand(1)'> </div> | |
2249 | - <div class='title' id='title(1)'> </div> | |
2250 | - <div class='size' id='size(1)'> </div> | |
2251 | - <div class='color' id='color(1)'> </div> | |
2252 | - <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(1)' onBlur='SumPerRow();'></div> | |
2253 | - <div class='price' id='price(1)'>0</div> | |
2254 | - <div class='total' id='total(1)'>0</div> | |
2255 | - <div class='reservation'><input type='text' size='3' name='item[reservation][]' value='' /></div> | |
2256 | - <div class='onstock' id='onstock(1)'></div> | |
2257 | - | |
2258 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue(1)' value=''> | |
2259 | - <input type='hidden' name='item[product_id][]' id='product_idValue(1)' value=''> | |
2260 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue(1)' value=''> | |
2261 | - <input type='hidden' name='item[price][]' id='priceValue(1)' value='0'> | |
2262 | - <input type='hidden' name='item[total][]' id='totalValue(1)' value='0'> | |
2263 | - | |
2264 | - <div class='control' style='float:right;'> | |
2265 | - <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
2266 | - <a href='#' onclick='RemoveDivLine(1);'><img src='/account/pic/del.png' width='18px'></a> | |
2267 | - </div> | |
2268 | - | |
2269 | - <div class='clear'></div> | |
2270 | - </div> | |
2271 | - </div> | |
2272 | - </div> | |
2273 | - | |
2274 | - <div class='report'> | |
2275 | - Ñòîèìîñòü äîñòàâêè <input type='text' size='10' name='cost_delivery' id='cost_delivery' value='0' onBlur='SumPerRow()' /> | |
2276 | - Âñåãî: <span id='quantity'>0</span> òîâàðîâ íà <span id='summary'>0</span> ãðí. | |
2277 | - </div> | |
2278 | - | |
2279 | - <input type='hidden' name='summary' id='summaryValue' value=''> | |
2280 | - <input type='hidden' name='send' value='add-order'> | |
2281 | - <input type='submit' class='button-add' title='Äîáàâèòü' value='Äîáàâèòü' onclick=\"document.form.submit();\"> | |
2282 | - | |
2283 | - </fieldset > | |
2284 | - </div> | |
2285 | - </form>"; | |
2286 | - | |
2287 | - // ===================== | |
2288 | - // ===== javascript ==== | |
2289 | - // ===================== | |
2290 | - | |
2291 | - echo" | |
2292 | - <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | |
2293 | - <script src='/js/JsHttpRequest.js'></script> | |
2294 | - <script src='/js/OrderContol.js' type='text/javascript'></script>"; | |
2295 | - | |
2296 | - | |
2297 | - echo" | |
2298 | - <!-------[ Form falidator ]-------> | |
2299 | - <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> | |
2300 | - <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | |
2301 | - | |
2302 | - <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> | |
2303 | - <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script> | |
2304 | - | |
2305 | - <script> | |
2306 | - jQuery(document).ready(function(){ | |
2307 | - // binds form submission and fields to the validation engine | |
2308 | - jQuery('#add-item').validationEngine(); | |
2309 | - }); | |
2310 | - </script> | |
2311 | - <!-------->"; | |
2312 | - | |
2313 | - } | |
2314 | - | |
2315 | - | |
2316 | - // ============= | |
2317 | - // === print === | |
2318 | - // ============= | |
2319 | - | |
2320 | - if (isset($_GET['action']) && $_GET['action']=='print') { | |
2321 | - | |
2322 | - // =========== Ãåíåðèì òàáëèöó =========== | |
2323 | - | |
2324 | - if (!isset($_GET['status'])) {$_GET['status']=1;} | |
2325 | - | |
2326 | - $sql = "SELECT o.*,u.*, o.id as order_id,o.city as city FROM catalogs_orders as o | |
2327 | - RIGHT JOIN zlo_users as u on u.id=o.user_id | |
2328 | - WHERE o.id='".$_GET['order_id']."' "; | |
2329 | - | |
2330 | - $sql = "SELECT o.*, o.id as order_id,o.city as city FROM catalogs_orders as o | |
2331 | - WHERE o.id='".$_GET['order_id']."' "; | |
2332 | - $result = mysql_query($sql) or die(mysql_error()); | |
2333 | - if (mysql_affected_rows()!=0) { | |
2334 | - $view=''; | |
2335 | - $view.="<div class='print'>"; | |
2336 | - | |
2337 | - $order=mysql_fetch_assoc($result); | |
2338 | - | |
2339 | - $view.="<div class='client'> | |
2340 | - <table> | |
2341 | - <tr> | |
2342 | - <td>Çàêàç # </td> | |
2343 | - <td>".$order['order_id']."</td> | |
2344 | - </tr> | |
2345 | - <tr> | |
2346 | - <td>Äàòà: </td> | |
2347 | - <td>".date('Y-m-d H:i:s',$order['mktime'])."</td> | |
2348 | - </tr> | |
2349 | - <tr> | |
2350 | - <td>Êëèåíò: </td> | |
2351 | - <td>".$order['name']."</td> | |
2352 | - </tr> | |
2353 | - <tr> | |
2354 | - <td>Email: </td> | |
2355 | - <td>".$order['email']."</td> | |
2356 | - </tr> | |
2357 | - <tr> | |
2358 | - <td>Òåë: </td> | |
2359 | - <td>".$order['phone']."</td> | |
2360 | - </tr> | |
2361 | - <tr> | |
2362 | - <td>Äîï. òåë: </td> | |
2363 | - <td>".$order['tel2']."</td> | |
2364 | - </tr> | |
2365 | - <tr> | |
2366 | - <td>¹ êàðòî÷êè: </td> | |
2367 | - <td>".$order['cards']."</td> | |
2368 | - </tr> | |
2369 | - <tr> | |
2370 | - <td>Êîìåíòàðèé: </td> | |
2371 | - <td>".$order['comment']."</td> | |
2372 | - </tr> | |
2373 | - <tr> | |
2374 | - <td>Äîñòàâêà: </td> | |
2375 | - <td>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')."</td> | |
2376 | - </tr> | |
2377 | - <tr> | |
2378 | - <td>Äåêëàðàöèÿ ¹: </td> | |
2379 | - <td>".$order['declaration']."</td> | |
2380 | - </tr> | |
2381 | - <tr> | |
2382 | - <td>¹ ñêëàäà: </td> | |
2383 | - <td>".$order['warehouse']."</td> | |
2384 | - </tr> | |
2385 | - <tr> | |
2386 | - <td>Ñïîñîá îïëàòû: </td> | |
2387 | - <td>".$order['payment']."</td> | |
2388 | - </tr> | |
2389 | - <tr> | |
2390 | - <td>Ñòðàõîâêà: </td> | |
2391 | - <td>".$order['insurance']."</td> | |
2392 | - </tr> | |
2393 | - <tr> | |
2394 | - <td>Ãîðîä: </td> | |
2395 | - <td>".$order['city']."</td> | |
2396 | - </tr> | |
2397 | - <tr> | |
2398 | - <td>Àäðåñ: </td> | |
2399 | - <td>".$order['adress']."</td> | |
2400 | - </tr> | |
2401 | - <tr> | |
2402 | - <td>Êîìåíòàðèé (ìåíåäæåðà): </td> | |
2403 | - <td>".$order['mcomment']."</td> | |
2404 | - </tr> | |
2405 | - | |
2406 | - </table> | |
2407 | - </div>"; | |
2408 | - | |
2409 | - | |
2410 | - // Òàáëèöà òîâàðîâ | |
2411 | - | |
2412 | - $sql3 = "SELECT * FROM catalogs_orders_products | |
2413 | - WHERE `order_id`='".$order['order_id']."' "; | |
2414 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
2415 | - if (mysql_affected_rows()!=0) { $i=0; | |
2416 | - | |
2417 | - $view.="<div class='details'>"; | |
2418 | - | |
2419 | - | |
2420 | - while ($item_id=mysql_fetch_assoc($result3)) { $i++; | |
2421 | - | |
2422 | - $sql4 = "SELECT * FROM catalogs_modifications as m | |
2423 | - LEFT JOIN catalogs_products as p | |
2424 | - ON p.id=m.product_id | |
2425 | - WHERE m.id='".$item_id['product_id']."' "; | |
2426 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
2427 | - if (mysql_affected_rows()!=0) { | |
2428 | - while ($item=mysql_fetch_assoc($result4)) { | |
2429 | - | |
2430 | - $view.=" | |
2431 | - <table> | |
2432 | - <tr> | |
2433 | - <td>¹</td> | |
2434 | - <td>$i .</td> | |
2435 | - <td> </td> | |
2436 | - <td>Êîä</td> | |
2437 | - <td>".$item['code']."</td> | |
2438 | - <td> </td> | |
2439 | - <td>Áðåíä</td> | |
2440 | - <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | |
2441 | - <td> </td> | |
2442 | - <td>Íàçâàíèå</td> | |
2443 | - <td>".$item['name']."</td> | |
2444 | - <td> </td> | |
2445 | - <td>Ðàçìåð</td> | |
2446 | - <td>".$item['size']."</td> | |
2447 | - <td> </td> | |
2448 | - <td>Öâåò</td> | |
2449 | - <td>".$item['color']."</td> | |
2450 | - <td> </td> | |
2451 | - <td>Êîë.</td> | |
2452 | - <td>".$item_id['count']."</td> | |
2453 | - <td> </td> | |
2454 | - <td>Öåíà</td> | |
2455 | - <td>".$item['cine']."</td> | |
2456 | - <td> </td> | |
2457 | - <td>Ñóììà</td> | |
2458 | - <td>".($item['cine']*$item_id['count'])."</td> | |
2459 | - <td> </td> | |
2460 | - <td>Áðîíü</td> | |
2461 | - <td>".$item_id['reservation']."</td> | |
2462 | - </tr> | |
2463 | - </table>"; | |
2464 | - | |
2465 | - } | |
2466 | - | |
2467 | - } | |
2468 | - } | |
2469 | - | |
2470 | - $view.="<span class='total'>Îáùàÿ ñóììà: ".$order['total']." ãðí. </span> | |
2471 | - <span class='total'>Ñòîèìîñòü äîñòàâêè: ".$order['cost_delivery']." ãðí. </span> | |
2472 | - </div>"; | |
2473 | - | |
2474 | - } | |
2475 | - | |
2476 | - $view.="</div>"; | |
2477 | - | |
2478 | - // Âûâîäèì 2 ðàçà | |
2479 | - | |
2480 | - echo $view; | |
2481 | - echo "<div class='print'><div class='separator'></div></div>"; | |
2482 | - $view2=''; | |
2483 | - $view2.="<div class='print'>"; | |
2484 | - | |
2485 | - | |
2486 | - $view2.="<div class='client'> | |
2487 | - <table style='font-size:16px;'> | |
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>Òåë: </td> | |
2502 | - <td>".$order['phone']."</td> | |
2503 | - </tr> | |
2504 | - <tr> | |
2505 | - <td>Ãîðîä: </td> | |
2506 | - <td>".$order['city']."</td> | |
2507 | - </tr> | |
2508 | - <tr> | |
2509 | - <td>¹ ñêëàäà: </td> | |
2510 | - <td>".$order['warehouse']."</td> | |
2511 | - </tr> | |
2512 | - <tr> | |
2513 | - <td>Ñòðàõîâêà: </td> | |
2514 | - <td>".$order['insurance']."</td> | |
2515 | - </tr> | |
2516 | - <tr> | |
2517 | - <td>Êîìåíòàðèé: </td> | |
2518 | - <td>".$order['mcomment']."</td> | |
2519 | - </tr> | |
2520 | - | |
2521 | - </table> | |
2522 | - </div> | |
2523 | - </div>"; | |
2524 | - | |
2525 | - echo $view2; | |
2526 | - | |
2527 | - | |
2528 | - } | |
2529 | - } | |
2530 | -?> |
account/admin/orders_.php deleted
1 | -<? // Ïîäêëþ÷åíèå | |
2 | - include_once($_SERVER['DOCUMENT_ROOT']."/account/mods/autorizator_admin.php"); | |
3 | - include_once($_SERVER['DOCUMENT_ROOT']."/account/class/class.report.php"); | |
4 | - | |
5 | - // ====================================== | |
6 | - // ====================================== | |
7 | - // ============ Îáðàáîòêà =============== | |
8 | - // ====================================== | |
9 | - // ====================================== | |
10 | - | |
11 | - | |
12 | -if($_GET['test'] == "1"){ | |
13 | - | |
14 | -//eMailing('order-new',"5172", "11181"); | |
15 | - | |
16 | -} | |
17 | - | |
18 | - | |
19 | - // ============= | |
20 | - // == status === | |
21 | - // ============= | |
22 | - | |
23 | -//print_r($_POST); | |
24 | -//exit; | |
25 | - if ((isset($_POST['action']) && $_POST['action']=='status') || trim($_POST['status'])!='') { | |
26 | - | |
27 | - | |
28 | - $sql = "UPDATE catalogs_orders SET status='".$_POST['status']."' WHERE `id`='".$_POST['order_id']."'"; | |
29 | - $result = mysql_query($sql) or die(mysql_error()); | |
30 | -//exit; | |
31 | - } | |
32 | - | |
33 | - // ==================== | |
34 | - // ===== order ======== | |
35 | - // ==================== | |
36 | - | |
37 | - // ============== | |
38 | - // ==== edit ==== | |
39 | - // ============== | |
40 | - | |
41 | - if (isset($_POST['send']) && $_POST['send']=='edit-order') { | |
42 | - | |
43 | - | |
44 | - $error=''; | |
45 | - $error[] = ValidFormData($_POST['user']['email'],'email','email'); | |
46 | - $error[] = ValidFormData($_POST['user']['city'],'ãîðîä','require'); | |
47 | - $error[] = ValidFormData($_POST['user']['address'],'àäðåñ','require'); | |
48 | - $error[] = ValidFormData($_POST['user']['tel'],'ìîá.òåëåôîí','mobile'); | |
49 | - $error[] = ValidFormData($_POST['user']['username'],'èìÿ','require'); | |
50 | - | |
51 | - $alert=implode('\r\n',$error); | |
52 | - | |
53 | - $mass=array_filter($error); | |
54 | - if (empty($mass)) { | |
55 | - | |
56 | - $summary=0; | |
57 | - | |
58 | - // Ïðîâåðÿåì åñòü ëè óæå â çàêàçàõ | |
59 | - $sql="SELECT *, product_id as mod_id from catalogs_orders_products WHERE order_id='".$_POST['order_id']."'"; | |
60 | - $result = mysql_query($sql) or die(mysql_error()); | |
61 | - if(mysql_affected_rows()!=0){ | |
62 | - while($item=mysql_fetch_assoc($result)) { | |
63 | - $ordered[]=$item['mod_id']; | |
64 | - } | |
65 | - } | |
66 | - | |
67 | - // =========================================== | |
68 | - // ======= Ïðîâåðÿåì íà èçìåíåíèå =========== | |
69 | - // =========================================== | |
70 | - | |
71 | - $ChangesOfOrder = ChangesOfMass($_POST['item']['mod_id'],$ordered); | |
72 | - | |
73 | - // ========== | |
74 | - // == same == | |
75 | - // ========== | |
76 | - | |
77 | - if (isset($ChangesOfOrder['same'])) { | |
78 | - | |
79 | - $mass=array_filter($ChangesOfOrder['same']); | |
80 | - if (!empty($mass)) { | |
81 | - | |
82 | - foreach ($ChangesOfOrder['same'] as $value) { | |
83 | - | |
84 | - // Óçíàåì key(èíäåêñ) â ìàññèâå | |
85 | - $i=array_keys($_POST['item']['mod_id'], $value); $i=$i[0]; | |
86 | - | |
87 | - // Îáíîâëÿåì êîëè÷åñòâî | |
88 | - $sql2 = "UPDATE catalogs_orders_products SET `count`='".$_POST['item']['quant'][$i]."' WHERE order_id='".$_POST['order_id']."' AND product_id='".$_POST['item']['mod_id'][$i]."'"; | |
89 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
90 | - | |
91 | - // Ñóììà âñåãî çàêàçà | |
92 | - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); | |
93 | - } | |
94 | - } | |
95 | - } | |
96 | - | |
97 | - // ========== | |
98 | - // === add == | |
99 | - // ========== | |
100 | - | |
101 | - if (isset($ChangesOfOrder['add'])) { | |
102 | - | |
103 | - $mass=array_filter($ChangesOfOrder['add']); | |
104 | - if (!empty($mass)) { | |
105 | - | |
106 | - foreach ($ChangesOfOrder['add'] as $value) { | |
107 | - | |
108 | - // Óçíàåì key(èíäåêñ) â ìàññèâå | |
109 | - $i=array_keys($_POST['item']['mod_id'], $value); $i=$i[0]; | |
110 | - | |
111 | - // Äîáàâëÿåì òîâàðû | |
112 | - $sql2=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,product_cine_id,count) VALUES (%s,%s,%s,%s)", | |
113 | - GetSQLValueString($_POST['order_id'], "text"), | |
114 | - GetSQLValueString($_POST['item']['mod_id'][$i], "text"), | |
115 | - GetSQLValueString($_POST['item']['price'][$i], "text"), | |
116 | - GetSQLValueString($_POST['item']['quant'][$i], "text")); | |
117 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
118 | - | |
119 | - // Ñóììà âñåãî çàêàçà | |
120 | - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); | |
121 | - } | |
122 | - } | |
123 | - } | |
124 | - | |
125 | - // ========== | |
126 | - // == del === | |
127 | - // ========== | |
128 | - | |
129 | - if (isset($ChangesOfOrder['del'])) { | |
130 | - | |
131 | - $mass=array_filter($ChangesOfOrder['del']); | |
132 | - if (!empty($mass)) { | |
133 | - | |
134 | - foreach ($ChangesOfOrder['del'] as $value) { | |
135 | - | |
136 | - // Äîáàâëÿåì òîâàðû | |
137 | - $sql2="DELETE FROM catalogs_orders_products WHERE order_id='".$_POST['order_id']."' AND product_id='".$value."'"; | |
138 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
139 | - } | |
140 | - } | |
141 | - } | |
142 | - | |
143 | - // =========== | |
144 | - // == ÂÑÅÃÎ == | |
145 | - // =========== | |
146 | - | |
147 | - if ($summary>0) { | |
148 | - | |
149 | - // Îáíîâëÿåì äàííûå çàêàçà | |
150 | - $sql2=sprintf("UPDATE catalogs_orders SET city=%s,adress=%s,comment=%s,mcomment=%s,total=%s WHERE id='".$_POST['order_id']."'", | |
151 | - GetSQLValueString($_POST['user']['city'], "text"), | |
152 | - GetSQLValueString($_POST['user']['address'], "text"), | |
153 | - GetSQLValueString($_POST['user']['comment'], "text"), | |
154 | - GetSQLValueString($_POST['user']['mcomment'], "text"), | |
155 | - GetSQLValueString($summary, "text")); | |
156 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
157 | - | |
158 | - eMailing('xml',$_POST['user_id'], $_POST['order_id']); | |
159 | - | |
160 | - } else { | |
161 | - | |
162 | - $sql2="DELETE FROM catalogs_orders WHERE id='".$_POST['order_id']."'"; | |
163 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
164 | - } | |
165 | - | |
166 | - GoBack(1); | |
167 | - | |
168 | - } else { | |
169 | - | |
170 | - echo"<script language=\"JavaScript\">alert('$alert')</script>"; | |
171 | - | |
172 | - } | |
173 | - | |
174 | - } | |
175 | - | |
176 | - // ============== | |
177 | - // ==== add ===== | |
178 | - // ============== | |
179 | - | |
180 | - if (isset($_POST['send']) && $_POST['send']=='add-order') { | |
181 | - | |
182 | - // Ïðîâåðÿåì äûáèë ëè àäìèí | |
183 | - $debil==false; | |
184 | - | |
185 | - for($i=1; $i<=count($_POST['item']); $i++) { | |
186 | - if(isset($_POST['item']['mod_id'][$i]) && $_POST['item']['mod_id'][$i]=='') { $debil=true; } | |
187 | - } | |
188 | - | |
189 | - if( $debil==false) { | |
190 | - | |
191 | - // $error=''; | |
192 | - // $error[] = ValidFormData($_POST['user']['email'],'email','email'); | |
193 | - // $error[] = ValidFormData($_POST['user']['city'],'ãîðîä','require'); | |
194 | - // $error[] = ValidFormData($_POST['user']['address'],'àäðåñ','require'); | |
195 | - // $error[] = ValidFormData($_POST['user']['tel'],'ìîá.òåëåôîí','mobile'); | |
196 | - // $error[] = ValidFormData($_POST['user']['username'],'èìÿ','require'); | |
197 | - | |
198 | - // $alert=implode('\r\n',$error); | |
199 | - | |
200 | - // $mass=array_filter($error); | |
201 | - // if (empty($mass)) { | |
202 | - | |
203 | - // Ïðîâåðÿåì ñóùåñòâóåò ëè ïîëüçîâàòåëü | |
204 | - // $sql="SELECT * FROM zlo_users WHERE email='".$_POST['user']['email']."' "; | |
205 | - // $result = mysql_query($sql) or die(mysql_error()); | |
206 | - // if (mysql_affected_rows()!=0) { | |
207 | - | |
208 | - // } | |
209 | - | |
210 | - $time=mktime(); | |
211 | - $date=date('Y-m-d H:i:s',$time); | |
212 | - | |
213 | - // Åñëè ñîçäàåì íîâîãî ïîëüçîâàòåëü | |
214 | - if($_POST['user']['user_id']=='' || $_POST['user']['user_id']==0 || $_POST['user']['user_id']=='0') { | |
215 | - | |
216 | - if (strpos($_POST['user']['email'],"@user.com")) { | |
217 | - $_POST['user']['group']=1; | |
218 | - } else { | |
219 | - $_POST['user']['group']=2; | |
220 | - } | |
221 | - | |
222 | - // Äîáàâëÿåì ïîëüçîâàòåëÿ | |
223 | - $pass=generate_password(6); | |
224 | - $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)", | |
225 | - GetSQLValueString($pass, "text"), | |
226 | - GetSQLValueString($_POST['user']['email'], "text"), | |
227 | - GetSQLValueString($_POST['user']['city'], "text"), | |
228 | - GetSQLValueString($_POST['user']['address'], "text"), | |
229 | - GetSQLValueString($_POST['user']['tel'], "text"), | |
230 | - GetSQLValueString($date, "text"), | |
231 | - GetSQLValueString($_POST['user']['username'], "text"), | |
232 | - GetSQLValueString($_POST['user']['tel2'], "text"), | |
233 | - GetSQLValueString($_POST['user']['group'], "int")); | |
234 | - $result = mysql_query($sql) or die(mysql_error()); | |
235 | - | |
236 | - // Óçíàåì ID ïîëüçîâàòåëÿ | |
237 | - $sql="SELECT id FROM zlo_users WHERE registered='$date' AND tel='".$_POST['user']['tel']."'"; | |
238 | - $result = mysql_query($sql) or die(mysql_error()); | |
239 | - if (mysql_affected_rows()!=0) { | |
240 | - $user=mysql_fetch_assoc($result); | |
241 | - | |
242 | - // Øëåì ïèñüìà | |
243 | - if($user['group']!=1) { | |
244 | - eMailing('reg',$user['id']); | |
245 | - } | |
246 | - | |
247 | - $_POST['user']['user_id']=$user['id']; | |
248 | - | |
249 | - } else { echo "íåò ïîëüçîâàòåëÿ";} | |
250 | - | |
251 | - } | |
252 | - | |
253 | - // Äîáàâëÿåì çàêàç | |
254 | - $sql=sprintf("INSERT INTO catalogs_orders (user_id,name,email,city,adress,phone,phonemob,comment,mktime,total,status) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,1)", | |
255 | - GetSQLValueString($_POST['user']['user_id'], "text"), | |
256 | - GetSQLValueString($_POST['user']['username'], "text"), | |
257 | - GetSQLValueString($_POST['user']['email'], "text"), | |
258 | - GetSQLValueString($_POST['user']['city'], "text"), | |
259 | - GetSQLValueString($_POST['user']['address'], "text"), | |
260 | - GetSQLValueString($_POST['user']['tel'], "text"), | |
261 | - GetSQLValueString($_POST['user']['tel2'], "text"), | |
262 | - GetSQLValueString($_POST['user']['comment'], "text"), | |
263 | - GetSQLValueString($time, "text"), | |
264 | - GetSQLValueString($_POST['summary'], "text")); | |
265 | - $result = mysql_query($sql) or die(mysql_error()); | |
266 | - | |
267 | - // Óçíàåì íîìåð çàêàçà | |
268 | - $sql="SELECT id FROM catalogs_orders WHERE mktime='$time' AND user_id='".$_POST['user']['user_id']."'"; | |
269 | - $result = mysql_query($sql) or die(mysql_error()); | |
270 | - if (mysql_affected_rows()!=0) { | |
271 | - $order=mysql_fetch_assoc($result); | |
272 | - } else { echo "Îøèáêà";} | |
273 | - | |
274 | - | |
275 | - // Äîáàâëÿåì òîâàðû | |
276 | - for($i=0; $i<=count($_POST['item']); $i++) { | |
277 | - if($_POST['item']['code'][$i]!=''){ | |
278 | - $sql=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,product_cine_id,count) VALUES (%s,%s,%s,%s)", | |
279 | - GetSQLValueString($order['id'], "text"), | |
280 | - GetSQLValueString($_POST['item']['mod_id'][$i], "text"), | |
281 | - GetSQLValueString($_POST['item']['price'][$i], "text"), | |
282 | - GetSQLValueString($_POST['item']['quant'][$i], "text")); | |
283 | - $result = mysql_query($sql) or die(mysql_error()); | |
284 | - } | |
285 | - } | |
286 | - | |
287 | - // Øëåì ïèñüìà | |
288 | - if ($user['group']!=1) { | |
289 | - eMailing('order-new',$_POST['user']['user_id'], $order['id']); | |
290 | - } | |
291 | - | |
292 | - echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/orders/\"; self.focus(); } </script>"; | |
293 | - | |
294 | - // } else { | |
295 | - | |
296 | - // echo"<script language=\"JavaScript\">alert('$alert')</script>"; | |
297 | - | |
298 | - // } | |
299 | - | |
300 | - | |
301 | - } else { | |
302 | - | |
303 | - echo"<script language=\"JavaScript\">alert('Íåò òîâàpà - íåò çàêàçà')</script>"; | |
304 | - | |
305 | - } | |
306 | - | |
307 | - } | |
308 | - | |
309 | - // ================= | |
310 | - // ==== NOTIFY ===== | |
311 | - // ================= | |
312 | - | |
313 | - // ============== | |
314 | - // == changed === | |
315 | - // ============== | |
316 | - | |
317 | - if (isset($_GET['notify']) && $_GET['notify']=='order-changed') { | |
318 | - | |
319 | - eMailing('order-changed',$_GET['user'], $_GET['order']); | |
320 | - | |
321 | - echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/orders/\"; self.focus(); } </script>"; | |
322 | - } | |
323 | - | |
324 | - | |
325 | - // ====================================== | |
326 | - // ====================================== | |
327 | - // ============== Âûâîä ================= | |
328 | - // ====================================== | |
329 | - // ====================================== | |
330 | - | |
331 | - | |
332 | - // ============= | |
333 | - // ==== all ==== | |
334 | - // ============= | |
335 | - | |
336 | - if (!isset($_GET['action'])) { | |
337 | - | |
338 | - echo"<script type='text/javascript'> | |
339 | - function notify(url){ | |
340 | - | |
341 | - if(confirm(\"Âûñëàòü óâåäîìëåíèå?\")){ | |
342 | - document.location=url; | |
343 | - return true; | |
344 | - } | |
345 | - return false; | |
346 | - } | |
347 | - </script>"; | |
348 | - | |
349 | - // ***** Àäìèí ðåæèì ***** | |
350 | - if(isset($_SESSION['admin']['edit'])) { | |
351 | - echo"<a href='/admin.php/orders/?action=add' class='button-save'>Äîáàâèòü</a>"; | |
352 | - } | |
353 | - // *********************** | |
354 | - | |
355 | - // ============== | |
356 | - // === report === | |
357 | - // ============== | |
358 | - | |
359 | - | |
360 | - $time=''; | |
361 | - $time['day'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), date('j'), date('Y')); | |
362 | - if(date('w')==1) { | |
363 | - $time['week'] = " o.`mktime` >=".mktime(0, 0, 0, date('n'), date('j'), date('Y'))." "; | |
364 | - } else { | |
365 | - $time['week'] = "( o.`mktime` BETWEEN ".strtotime("last Monday")." AND ".mktime(0, 0, 0, date('n'), date('j')+1, date('Y')).") "; | |
366 | - } | |
367 | - $time['month'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), 1, date('Y')); | |
368 | - | |
369 | - Report::put_time($time); | |
370 | - Report::make(); | |
371 | - | |
372 | - echo"<div class='orders-report' style='display:table; overflow:hidden;'>"; | |
373 | - | |
374 | - // === êëèåíòû === | |
375 | - | |
376 | - 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;'>"; | |
377 | - | |
378 | - echo"<span style='padding:5px 0; display:block;'>ÒÎÏ êëèåíòîâ çà ïåðèîä: </span>"; | |
379 | - echo Report::html_report(Report::get_mass_client()); | |
380 | - echo"</div>"; | |
381 | - | |
382 | - echo"<div style='height:20px;display:block;'></div>"; | |
383 | - | |
384 | - // === ïðîäàæè === | |
385 | - | |
386 | - 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;'>"; | |
387 | - | |
388 | - echo"<span style='padding:5px 0; display:block;'>Ïðîäàæè çà ïåðèîä: </span>"; | |
389 | - echo Report::html_report(Report::get_mass_order()); | |
390 | - echo"</div>"; | |
391 | - | |
392 | - echo"<div style='height:20px;display:block;'> </div>"; | |
393 | - | |
394 | - // === ãðàôèê === | |
395 | - | |
396 | - 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;'>"; | |
397 | - | |
398 | - echo"<span style='padding:5px 0; display:block;'>Ãðàôèê: </span>"; | |
399 | - 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>"; | |
400 | - | |
401 | - // ëåãåíäà | |
402 | - echo"<div class='legend' style='display:table;text-align:center;'>"; | |
403 | - echo"<div style='width:15px; height:15px; background:#00A652; float:left;'></div><span style='float:left; padding:0 5px;'>íîâûé</span>"; | |
404 | - echo"<div style='width:15px; height:15px; background:#0072BB; float:left;'></div><span style='float:left; padding:0 5px;'>ïîäòâåðæäåí</span>"; | |
405 | - echo"<div style='width:15px; height:15px; background:#F36523; float:left;'></div><span style='float:left; padding:0 5px;'>îòìåíåí</span>"; | |
406 | - echo"<div style='width:15px; height:15px; background:#ED1B24; float:left;'></div><span style='float:left; padding:0 5px;'>âûïîëíåí</span>"; | |
407 | - echo"<div style='clear:both;'></div>"; | |
408 | - echo"</div>"; | |
409 | - | |
410 | - echo"</div>"; | |
411 | - | |
412 | - echo"</div>"; | |
413 | - | |
414 | - | |
415 | - if (!isset($_GET['status'])) {$_GET['status']=1;} | |
416 | - if(isset($_GET['user'])) {$AND="AND u.id=".$_GET['user'];} else {$AND='';} | |
417 | - | |
418 | - // ============= | |
419 | - // === Ïîèñê === | |
420 | - // ============= | |
421 | - | |
422 | - $th=array("id"=>"íîìåð çêàçà","username"=>"êëèåíò", "email"=>"email", "tel"=>"òåëåôîí", "code"=>"øòðèõêîä"); | |
423 | - | |
424 | - // Åñëè ñóùåñòâóåò Ïîèñê | |
425 | - if (isset($_REQUEST['search'])) { | |
426 | - if($_REQUEST['field']=='id') {$pre="o";} | |
427 | - if($_REQUEST['field']=='username') {$pre="u";} | |
428 | - if($_REQUEST['field']=='email') {$pre="u";} | |
429 | - if($_REQUEST['field']=='tel') {$pre="u";} | |
430 | - if($_REQUEST['field']=='code') {$pre="m";} | |
431 | - $AND=''; | |
432 | - if (trim($_REQUEST['look'])!='') { | |
433 | - $AND.="AND $pre.`".$_REQUEST['field']."` LIKE '%".trim($_REQUEST['look'])."%'"; | |
434 | - } | |
435 | - if ( ($_REQUEST['form']['date_start'] !='') && ($_REQUEST['form']['date_end'] !='')){ | |
436 | - | |
437 | - $dateStart =$_REQUEST['form']['date_start']; | |
438 | - $dateEnd =$_REQUEST['form']['date_end']; | |
439 | - | |
440 | - $mkdate=ExtractDate($_REQUEST['form']['date_start']); | |
441 | - $_REQUEST['form']['date_start'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); | |
442 | - | |
443 | - $mkdate=ExtractDate($_REQUEST['form']['date_end']); | |
444 | - $_REQUEST['form']['date_end'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); | |
445 | - | |
446 | - $AND.=" AND (o.`mktime` BETWEEN '".$_REQUEST['form']['date_start']."' AND '".$_REQUEST['form']['date_end']."') "; | |
447 | - } | |
448 | - } | |
449 | - // ============= | |
450 | - // === Äàòà ==== | |
451 | - // ============= | |
452 | - | |
453 | - echo"<div class='grid-search'> | |
454 | - <form action='".GetFormUrl()."' name='search' method='GET'> | |
455 | - <div class='search'> | |
456 | - <input type='text' name='look' id='grid-search' value='".$_REQUEST['look']."'> | |
457 | - <select name='field'>"; | |
458 | - | |
459 | - foreach ($th as $key=>$value) { | |
460 | - if($_REQUEST['field']==$key) {$selected='selected="selected"';} else {$selected='';} | |
461 | - echo"<option value='$key' $selected>$value</option>"; | |
462 | - } | |
463 | - | |
464 | - echo"</select> | |
465 | - <input type='submit' value='ïîèñê'> | |
466 | - <input type='hidden' name='status' value='".$_GET['status']."'> | |
467 | - </div>"; | |
468 | - | |
469 | - echo"<div class='dates'> | |
470 | - <div class='row'> | |
471 | - <input type='text' name='form[date_start]' id='date_start_input' value='".$dateStart."'> | |
472 | - <img src='/img/calendar.gif' id='date_start'> | |
473 | - </div> | |
474 | - <div class='row'> | |
475 | - <input type='text' name='form[date_end]' id='date_end_input' value='".$dateEnd."'> | |
476 | - <img src='/img/calendar.gif' id='date_end'> | |
477 | - </div> | |
478 | - </div>"; | |
479 | - | |
480 | - | |
481 | - echo'<script type="text/javascript"> | |
482 | - Calendar.setup( | |
483 | - { | |
484 | - inputField : "date_start_input", // ID of the input field | |
485 | - ifFormat : "%Y-%m-%d", // the date format | |
486 | - button : "date_start" | |
487 | - } | |
488 | - ); | |
489 | - </script>'; | |
490 | - | |
491 | - echo'<script type="text/javascript"> | |
492 | - Calendar.setup( | |
493 | - { | |
494 | - inputField : "date_end_input", // ID of the input field | |
495 | - ifFormat : "%Y-%m-%d", // the date format | |
496 | - button : "date_end" | |
497 | - } | |
498 | - ); | |
499 | - </script>'; | |
500 | - | |
501 | - | |
502 | - echo"<input type='hidden' name='search' value='ok'> | |
503 | - | |
504 | - </form> | |
505 | - </div>"; | |
506 | - | |
507 | - | |
508 | - // =========== Ãåíåðèì òàáëèöó =========== | |
509 | - | |
510 | -$eshka = ""; | |
511 | -$eshka2 = ""; | |
512 | -$eshka3 = ""; | |
513 | -$lll = ""; | |
514 | -if(trim(@$_REQUEST['da'])=='1'){ | |
515 | - $eshka = "o.mktime<'1341090000' AND "; | |
516 | - $eshka2 = "o.mktime<'1341090000' AND "; | |
517 | - $lll = "font-weight:bold;"; | |
518 | -}else{ | |
519 | - $eshka = "o.mktime>'1341090000' AND "; | |
520 | - $eshka2 = "o.mktime>'1341090000' AND "; | |
521 | - $lll = ""; | |
522 | -} | |
523 | - | |
524 | - | |
525 | - | |
526 | -if(trim(@$_REQUEST['pr'])=='1'){ | |
527 | -$tim = (time()-86400); | |
528 | - $eshka3 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; | |
529 | -}else{ | |
530 | -$eshka3 = ""; | |
531 | -} | |
532 | - | |
533 | -if(trim(@$_REQUEST['prs'])=='1'){ | |
534 | -$tim = (time()-172800); | |
535 | - $eshka4 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; | |
536 | -}else{ | |
537 | -$eshka4 = ""; | |
538 | -} | |
539 | - | |
540 | - | |
541 | - $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 order_id, m.*, m.product_id as mod_id, op.* , p.*, g.color as group_color | |
542 | - FROM catalogs_orders as o | |
543 | - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
544 | - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
545 | - LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
546 | - LEFT JOIN zlo_users as u ON u.id=o.user_id | |
547 | - LEFT JOIN zlo_users_group as g ON g.id=u.group | |
548 | - WHERE ".$eshka3.$eshka4.$eshka."o.status='".$_GET['status']."' $AND GROUP BY o.id ORDER BY o.mktime DESC "; | |
549 | - $pager['sql']= $sql; | |
550 | - $pager=pagerGetRun($pager,10,15); | |
551 | - // echo$pager['sql']; | |
552 | - $result = mysql_query($pager['sql']) or die(mysql_error()); | |
553 | - if (mysql_affected_rows()!=90800) { | |
554 | - | |
555 | - | |
556 | - // ============= | |
557 | - // === Òàáñ ==== | |
558 | - // ============= | |
559 | - | |
560 | - echo"<div class='clear'></div>"; | |
561 | - echo"<div class='order-tabs'>"; | |
562 | - //////$eshka2.$eshka | |
563 | - $sql0 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
564 | - $result0 = mysql_query($sql0) or die(mysql_error()); | |
565 | - if (mysql_affected_rows()!=0) { | |
566 | - while ($rows=mysql_fetch_assoc($result0)) { | |
567 | - | |
568 | - //$AND | |
569 | - | |
570 | - // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | |
571 | - $sql2 = "SELECT count(o.id) AS calc, o . * , m.*, m.product_id as mod_id, op.* , p.* | |
572 | - FROM catalogs_orders as o | |
573 | - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
574 | - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
575 | - LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
576 | - LEFT JOIN zlo_users as u ON u.id=o.user_id | |
577 | - LEFT JOIN zlo_users_group as g ON g.id=u.group | |
578 | - WHERE ".$eshka2."o.status='".$rows['id']."' $AND"; | |
579 | - | |
580 | - | |
581 | -//if(trim($_REQUEST['test'])=="1") echo $sql2; | |
582 | - | |
583 | - | |
584 | - | |
585 | - $sql2 = "SELECT count(o.id) AS calc FROM catalogs_orders as o WHERE ".$eshka2."o.status='".$rows['id']."'"; | |
586 | - | |
587 | - | |
588 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
589 | - $row2=mysql_fetch_assoc($result2); | |
590 | - $yyyyyy = str_replace("prs=1","prs=0",str_replace("pr=1","pr=0",urlQueryChange2('status',$rows['id']))); | |
591 | - echo"<div class='status-tabs' onclick=\"location.href='".$yyyyyy."'\">".$rows['title']."(".$row2['calc'].")</div>"; | |
592 | - } | |
593 | - } | |
594 | - | |
595 | - | |
596 | - | |
597 | - | |
598 | -$tim = (time()-86400); | |
599 | - $sql3 = " | |
600 | - SELECT count(*) count FROM catalogs_orders WHERE `status`=1 AND `upd`<'".date("Y-m-d H:i:s",$tim)."';"; | |
601 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
602 | - $row3=mysql_fetch_assoc($result3); | |
603 | -$yyyyyt = ""; | |
604 | -if(trim($_REQUEST['pr'])=="1") $yyyyyt = "font-weight:bold; "; | |
605 | - | |
606 | -$tim2 = (time()-172800); | |
607 | - $sql4 = " | |
608 | - SELECT count(*) count FROM catalogs_orders WHERE `status`=2 AND `upd`<'".date("Y-m-d H:i:s",$tim2)."';"; | |
609 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
610 | - $row4=mysql_fetch_assoc($result4); | |
611 | -$yyyyyt2 = ""; | |
612 | -if(trim($_REQUEST['prs'])=="1") $yyyyyt2 = "font-weight:bold; "; | |
613 | - | |
614 | - | |
615 | - echo" | |
616 | - | |
617 | - <div class='status-tabs' style=\"".$lll."\" onclick=\"location.href='".urlQueryChange2('da',"1")."&page=1'\">Êîðçèíà</div> | |
618 | - <div class='status-tabs'> | |
619 | - <a href=\"/order/index.php\" target=\"_blank\" style=\"text-decoration:none; color:#157100\">Ñòàòèñòèêà çàêàçîâ</a> | |
620 | - </div> | |
621 | - </div> | |
622 | - <div class='clear'></div> | |
623 | - <div onclick=\"location.href='?pr=1&status=1&page=1'\" style=\"".$yyyyyt."cursor:pointer; float: left; font-family: Arial,Helvetica,sans-serif; font-size: 12px; margin-left:25px;\"> | |
624 | - Ïðîñòð. (".$row3['count'].") | |
625 | - </div> | |
626 | - | |
627 | - <div onclick=\"location.href='?prs=1&status=2&page=1'\" style=\"".$yyyyyt2."cursor:pointer; float: left; font-family: Arial,Helvetica,sans-serif; font-size: 12px; margin-left:45px;\"> | |
628 | - Ïðîñòð. (".$row4['count'].") | |
629 | - </div> | |
630 | -<div class='clear'></div> | |
631 | -<div> </div> | |
632 | - "; | |
633 | - | |
634 | - // =================== | |
635 | - // === ÏÐÎÄÎËÆÅÍÈÅ === | |
636 | - // =================== | |
637 | - | |
638 | - while ($order=mysql_fetch_assoc($result)) { | |
639 | - | |
640 | - echo"<div class='orders'>"; | |
641 | - | |
642 | - echo"<div class='order-info-all'> | |
643 | - | |
644 | - <div class=order-info> | |
645 | - <h4>Çàêàç #".$order['order_id']."<br> | |
646 | - Äàòà: ".date('Y-m-d H:i:s',$order['order_date'])." | |
647 | - </h4> | |
648 | - <fieldset id='order-info' style=\"background:".$order['group_color'].";\"> | |
649 | - <legend>Êëèåíò</legend> | |
650 | - | |
651 | - <label>Êëèåíò:</label> | |
652 | - <div class=info><a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>".$order['username']."</a> </div> | |
653 | - | |
654 | - <label>Òåë:</label> | |
655 | - <div class=info>".$order['tel']." </div> | |
656 | - | |
657 | - <label>Òåë 2:</label> | |
658 | - <div class=info>".$order['tel2']." </div> | |
659 | - | |
660 | - <label>Ãðóïïà:</label> | |
661 | - <div class=info>".viewBook('zlo_users_group', $order['group'], 'id', 'name')." </div> | |
662 | - | |
663 | - <div class=clear></div> | |
664 | - <a class='history' href='/admin.php/orders/?action=show&user=".$order['user_id']."'>[Èñòîðèÿ çàêàçîâ]</a> | |
665 | - | |
666 | - </fieldset> | |
667 | - | |
668 | - <fieldset id='order-info' style='background:".$order['group_color'].";'> | |
669 | - <legend>Äîñòàâêà</legend> | |
670 | - | |
671 | - <label>Äîñòàâêà:</label> | |
672 | - <div class=info>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." </div> | |
673 | - | |
674 | - <label>Ãîðîä:</label> | |
675 | - <div class=info>".$order['city']." </div> | |
676 | - | |
677 | - <label>Àäðåñ:</label> | |
678 | - <div class=info>".$order['address']." </div> | |
679 | - | |
680 | - <label>Èíôî:</label> | |
681 | - <div class=info> ".$order['comment']." </div> | |
682 | - | |
683 | - <div class=clear></div> | |
684 | - | |
685 | - </fieldset> | |
686 | - <div class=clear></div> | |
687 | - </div> | |
688 | - </div>"; | |
689 | - | |
690 | - | |
691 | - // Òàáëèöà òîâàðîâ | |
692 | - | |
693 | - echo" | |
694 | - <div class='order-details'> | |
695 | - <fieldset id='order-details'> | |
696 | - <legend>Òîâàðû</legend>"; | |
697 | - echo"<table> | |
698 | - <tr> | |
699 | - <td>¹</td> | |
700 | - <td>Êîä</td> | |
701 | - <td>Áðåíä</td> | |
702 | - <td>Íàçâàíèå</td> | |
703 | - <td>Ðàçìåð</td> | |
704 | - <td>Öâåò</td> | |
705 | - <td>Êîë.</td> | |
706 | - <td>Öåíà</td> | |
707 | - <td>Ñóììà</td> | |
708 | - <td>Íàëè÷èå</td> | |
709 | - <td></td> | |
710 | - </tr>"; | |
711 | - | |
712 | - $sql3 = " | |
713 | - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* | |
714 | - FROM catalogs_orders AS o | |
715 | - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
716 | - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
717 | - LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
718 | - WHERE o.id='".$order['order_id']."'"; | |
719 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
720 | - if (mysql_affected_rows()!=0) { | |
721 | - while ($item=mysql_fetch_assoc($result3)) { { $i++; | |
722 | - | |
723 | - | |
724 | - // íàëè÷èå òîâàðà | |
725 | - $sql5 = "SELECT c.name as city, o.count | |
726 | - FROM catalogs_keys_products_cities as o | |
727 | - LEFT JOIN catalogs_cities as c | |
728 | - ON o.city_id=c.id | |
729 | - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | |
730 | - $result5 = mysql_query($sql5) or die(mysql_error()); | |
731 | - if (mysql_affected_rows()!=0) { | |
732 | - $onStockDesc=''; | |
733 | - while ($onStock=mysql_fetch_assoc($result5)) { | |
734 | - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | |
735 | - } | |
736 | - } else { $onStockDesc='íåò'; } | |
737 | - | |
738 | - echo"<tr> | |
739 | - <td>$i .</td> | |
740 | - <td>".$item['code']."</td> | |
741 | - <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | |
742 | - <td><a href='/catalogs/".$item['rubric_id'].'/t'.$item['id']."/' target='_new'>".$item['name']."</a></td> | |
743 | - <td>".$item['size']."</td> | |
744 | - <td>".$item['color']."</td> | |
745 | - <td>".$item['count']."</td> | |
746 | - <td>".$item['cine']."</td> | |
747 | - <td>".($item['cine']*$item['count'])."</td> | |
748 | - <td>".$onStockDesc."</td> | |
749 | - <td></td> | |
750 | - </tr>"; | |
751 | - | |
752 | - } | |
753 | - | |
754 | - } | |
755 | - } | |
756 | - | |
757 | - echo"</table> | |
758 | - <b>Îáùàÿ ñóììà: ".$order['total']." ãðí.</b> | |
759 | - </div>"; | |
760 | - | |
761 | - | |
762 | - | |
763 | - echo"<div class='clear'></div>"; | |
764 | - | |
765 | - // ***** Àäìèí ðåæèì ***** | |
766 | - if(isset($_SESSION['admin']['edit'])) { | |
767 | - | |
768 | - // Ñìåíà ñòàòóñà | |
769 | - if ($order['status']!=6) { | |
770 | - echo "<div class='pager-pages'> | |
771 | - <div id='show'>Ïåðåâåñòè</div> | |
772 | - <form method='POST' action='".$_SERVER["REQUEST_URI"]."' id='PerPageForm'> | |
773 | - <select size='1' name='status' id='PerPage' >"; | |
774 | - $sql4 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
775 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
776 | - if (mysql_affected_rows()!=0) { | |
777 | - while ($row4=mysql_fetch_assoc($result4)) { | |
778 | - if($row4['id']!="5") | |
779 | - echo"<option value='".$row4['id']."'>".$row4['title']."</option>\n"; | |
780 | - } | |
781 | - echo "<optgroup label=\"Îòìåíåí (×åðåç èçìåíåíèÿ çàêàçà)\"></optgroup>"; | |
782 | - echo"<input type='hidden' name='action' value='status'> | |
783 | - <input type='hidden' name='order_id' value='".$order['order_id']."'>"; | |
784 | - } | |
785 | - echo"</select> | |
786 | - <div id='records'><input type='submit' value='Ïåðåâåñòè' class='button-save' onclick='this.form.submit();' ></div> | |
787 | - <div id='records'><a href='/admin.php/orders/?action=edit&user=".$order['user_id']."&order=".$order['order_id']."' class='button-edit'>Èçìåíèòü</a></div> | |
788 | - <div id='records'><a href='/account/admin/orders.php?action=print&order_id=".$order['order_id']."' target='_new' class='button-save'>Ïå÷àòü</a></div> | |
789 | - <div id='records'><a href='#' class='button-save' onClick=\"notify('/admin.php/orders/?notify=order-changed&user=".$order['user_id']."&order=".$order['order_id']."')\" >Óâåäîìèòü</a></div> | |
790 | - </form> | |
791 | - </div>"; | |
792 | - } | |
793 | - | |
794 | - } | |
795 | - echo"</div>"; | |
796 | - | |
797 | - | |
798 | - } | |
799 | - | |
800 | - echo"</div>"; | |
801 | - | |
802 | - | |
803 | - | |
804 | - // === Pager | |
805 | - | |
806 | - echo"<div class='grid-pager'> | |
807 | - ".pagerGetShow($pager)." | |
808 | - </div>"; | |
809 | - | |
810 | - } | |
811 | - | |
812 | - } | |
813 | - | |
814 | - // =============== | |
815 | - // ===== show ==== | |
816 | - // =============== | |
817 | - | |
818 | - if (isset($_GET['action']) && $_GET['action']=='show') { | |
819 | - | |
820 | - // Òàáñ | |
821 | - | |
822 | - echo"<div class='order-tabs'>"; | |
823 | - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
824 | - $result = mysql_query($sql) or die(mysql_error()); | |
825 | - if (mysql_affected_rows()!=0) { | |
826 | - while ($row=mysql_fetch_assoc($result)) { | |
827 | - | |
828 | - // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | |
829 | - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; | |
830 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
831 | - $row2=mysql_fetch_assoc($result2); | |
832 | - | |
833 | - echo"<div class='status-tabs' onclick=\"location.href='".urlQueryChange2('status',$row['id'])."&page=1'\">".$row['title']."(".$row2['calc'].")</div>"; | |
834 | - } | |
835 | - } | |
836 | - echo"</div> | |
837 | - <div class='clear'></div> | |
838 | - "; | |
839 | - | |
840 | - if(!isset($_GET['status'])) {$_GET['status']=1;} | |
841 | - | |
842 | - // =========== Ãåíåðèì òàáëèöó =========== | |
843 | - | |
844 | - $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 | |
845 | - FROM catalogs_orders as o | |
846 | - LEFT JOIN zlo_users as u on u.id=o.user_id | |
847 | - WHERE u.id=".$_GET['user']." AND o.status=".$_GET['status']." ORDER BY mktime DESC "; | |
848 | - $pager['sql']= $sql; | |
849 | - $pager=pagerGetRun($pager,10,15); //echo$pager['sql']; | |
850 | - $result = mysql_query($pager['sql']) or die(mysql_error()); | |
851 | - if (mysql_affected_rows()!=0) { | |
852 | - | |
853 | - // =================== | |
854 | - // === ÏÐÎÄÎËÆÅÍÈÅ === | |
855 | - // =================== | |
856 | - | |
857 | - while ($order=mysql_fetch_assoc($result)) { | |
858 | - | |
859 | - echo"<div class='orders'>"; | |
860 | - | |
861 | - echo"<div class='order-info-all'> | |
862 | - | |
863 | - <div class=order-info> | |
864 | - <h4>Çàêàç #".$order['order_id']."<br> | |
865 | - Äàòà: ".date('Y-m-d H:i:s',$order['mktime'])." | |
866 | - </h4> | |
867 | - <fieldset id='order-info' style='background: ".$order['color'].";'> | |
868 | - <legend>Êëèåíò</legend> | |
869 | - | |
870 | - <label>Êëèåíò:</label> | |
871 | - <div class=info><a href='/admin.php/users/?action=edit&user=".$order['user_id']."'>".$order['username']."</a> </div> | |
872 | - | |
873 | - <label>Òåë:</label> | |
874 | - <div class=info>".$order['tel']." </div> | |
875 | - | |
876 | - <label>Òåë 2:</label> | |
877 | - <div class=info>".$order['tel2']." </div> | |
878 | - | |
879 | - <label>Ãðóïïà:</label> | |
880 | - <div class=info>".viewBook('zlo_users_group', $order['group'], 'id', 'name')." </div> | |
881 | - | |
882 | - <div class=clear></div> | |
883 | - <a class='history' href='/admin.php/orders/?action=show&user=".$order['user_id']."'>[Èñòîðèÿ çàêàçîâ]</a> | |
884 | - | |
885 | - </fieldset> | |
886 | - | |
887 | - <fieldset id='order-info' style='background: ".$order['color'].";'> | |
888 | - <legend>Äîñòàâêà</legend> | |
889 | - | |
890 | - <label>Äîñòàâêà:</label> | |
891 | - <div class=info>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." </div> | |
892 | - | |
893 | - <label>Ãîðîä:</label> | |
894 | - <div class=info>".$order['city']." </div> | |
895 | - | |
896 | - <label>Àäðåñ:</label> | |
897 | - <div class=info>".$order['address']." </div> | |
898 | - | |
899 | - <label>Èíôî:</label> | |
900 | - <div class=info> ".$order['comment']." </div> | |
901 | - | |
902 | - <div class=clear></div> | |
903 | - | |
904 | - </fieldset> | |
905 | - <div class=clear></div> | |
906 | - </div> | |
907 | - </div>"; | |
908 | - | |
909 | - | |
910 | - // Òàáëèöà òîâàðîâ | |
911 | - | |
912 | - echo" | |
913 | - <div class='order-details'> | |
914 | - <fieldset id='order-details'> | |
915 | - <legend>Òîâàðû</legend>"; | |
916 | - echo"<table> | |
917 | - <tr> | |
918 | - <td>¹</td> | |
919 | - <td>Êîä</td> | |
920 | - <td>Áðåíä</td> | |
921 | - <td>Íàçâàíèå</td> | |
922 | - <td>Ðàçìåð</td> | |
923 | - <td>Öâåò</td> | |
924 | - <td>Êîë.</td> | |
925 | - <td>Öåíà</td> | |
926 | - <td>Ñóììà</td> | |
927 | - <td>Íàëè÷èå</td> | |
928 | - <td></td> | |
929 | - </tr>"; | |
930 | - | |
931 | - $sql3 = " | |
932 | - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* | |
933 | - FROM catalogs_orders AS o | |
934 | - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id | |
935 | - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id | |
936 | - LEFT JOIN catalogs_products AS p ON p.id = m.product_id | |
937 | - WHERE o.id='".$order['order_id']."'"; | |
938 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
939 | - if (mysql_affected_rows()!=0) { | |
940 | - while ($item=mysql_fetch_assoc($result3)) { { $i++; | |
941 | - | |
942 | - | |
943 | - // íàëè÷èå òîâàðà | |
944 | - $sql5 = "SELECT c.name as city, o.count | |
945 | - FROM catalogs_keys_products_cities as o | |
946 | - LEFT JOIN catalogs_cities as c | |
947 | - ON o.city_id=c.id | |
948 | - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | |
949 | - $result5 = mysql_query($sql5) or die(mysql_error()); | |
950 | - if (mysql_affected_rows()!=0) { | |
951 | - $onStockDesc=''; | |
952 | - while ($onStock=mysql_fetch_assoc($result5)) { | |
953 | - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | |
954 | - } | |
955 | - } else { $onStockDesc='íåò'; } | |
956 | - | |
957 | - echo"<tr> | |
958 | - <td>$i .</td> | |
959 | - <td>".$item['code']."</td> | |
960 | - <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | |
961 | - <td><a href='/catalogs/".$item['rubric_id'].'/t'.$item['id']."/' target='_new'>".$item['name']."</a></td> | |
962 | - <td>".$item['size']."</td> | |
963 | - <td>".$item['color']."</td> | |
964 | - <td>".$item['count']."</td> | |
965 | - <td>".$item['cine']."</td> | |
966 | - <td>".($item['cine']*$item['count'])."</td> | |
967 | - <td>".$onStockDesc."</td> | |
968 | - <td></td> | |
969 | - </tr>"; | |
970 | - | |
971 | - } | |
972 | - | |
973 | - } | |
974 | - } | |
975 | - | |
976 | - echo"</table> | |
977 | - <b>Îáùàÿ ñóììà: ".$order['total']." ãðí.</b> | |
978 | - </div>"; | |
979 | - | |
980 | - | |
981 | - | |
982 | - echo"<div class='clear'></div></div>"; | |
983 | - | |
984 | - } | |
985 | - | |
986 | - // === Pager | |
987 | - | |
988 | - echo"<div class='grid-pager'> | |
989 | - ".pagerGetShow($pager)." | |
990 | - </div>"; | |
991 | - } | |
992 | - } | |
993 | - | |
994 | - // =============== | |
995 | - // ===== edit ==== | |
996 | - // =============== | |
997 | - | |
998 | - if (isset($_GET['action']) && $_GET['action']=='edit') { | |
999 | - | |
1000 | - // Òàáñ | |
1001 | - | |
1002 | - if (!isset($_GET['status'])) {$status=1;} else {$status=$_GET['status'];} | |
1003 | - | |
1004 | - echo"<div class='order-tabs'>"; | |
1005 | - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
1006 | - $result = mysql_query($sql) or die(mysql_error()); | |
1007 | - if (mysql_affected_rows()!=0) { | |
1008 | - while ($row=mysql_fetch_assoc($result)) { | |
1009 | - | |
1010 | - // Ïîäñ÷åò êîëè÷åñòâà çàêàçîâ ïî ñòàòóñó | |
1011 | - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; | |
1012 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
1013 | - $row2=mysql_fetch_assoc($result2); | |
1014 | - | |
1015 | - echo"<div class='status-tabs' onclick=\"location.href='".urlQueryChange2('status',$row['id'])."&page=1'\">".$row['title']."(".$row2['calc'].")</div>"; | |
1016 | - } | |
1017 | - } | |
1018 | - echo"</div> | |
1019 | - <div class='clear'></div> | |
1020 | - "; | |
1021 | - | |
1022 | - | |
1023 | - // =========== Ãåíåðèì òàáëèöó =========== | |
1024 | - | |
1025 | - $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 | |
1026 | - FROM catalogs_orders as o | |
1027 | - LEFT JOIN zlo_users as u ON u.id=o.user_id | |
1028 | - LEFT JOIN zlo_users_group as g ON g.id=u.group | |
1029 | - WHERE o.id='".$_GET['order']."'"; | |
1030 | - $result = mysql_query($sql) or die(mysql_error()); | |
1031 | - if (mysql_affected_rows()!=0) { | |
1032 | - | |
1033 | - $order=mysql_fetch_assoc($result); | |
1034 | - | |
1035 | - echo"<form action='' method='POST' name='edit_order' id='add-item'>"; | |
1036 | - echo"<div class='orders'>"; | |
1037 | - | |
1038 | - echo" | |
1039 | - <div class=order-info> | |
1040 | - <fieldset id='order-info' style='background: ".$order['color'].";'> | |
1041 | - <legend>Çàêàç #".$order['order_id']." Cóììà: ".$order['total']." ãðí.</legend> | |
1042 | - | |
1043 | - <label>Äàòà:</label> | |
1044 | - <div class=info>".date('Y-m-d H:i:s')."</div> | |
1045 | - | |
1046 | - <label>Êëèåíò:</label> | |
1047 | - <div class=info> | |
1048 | - <input type='text' name='user[username]' value='".$order['username']."' disabled='disabled'> | |
1049 | - <input type='hidden' name='user[username]' value='".$order['username']."'> | |
1050 | - </div> | |
1051 | - | |
1052 | - <label>Email:</label> | |
1053 | - <div class=info> | |
1054 | - <input type='text' name='user[email]' value='".$order['email']."' disabled='disabled'> | |
1055 | - <input type='hidden' name='user[email]' value='".$order['email']."'> | |
1056 | - </div> | |
1057 | - | |
1058 | - <label>Òåëåôîí:</label> | |
1059 | - <div class=info> | |
1060 | - <input type='text' name='user[tel]' value='".$order['tel']."' disabled='disabled'> | |
1061 | - <input type='hidden' name='user[tel]' value='".$order['tel']."'> | |
1062 | - </div> | |
1063 | - | |
1064 | - <label>Òåëåôîí 2:</label> | |
1065 | - <div class=info> | |
1066 | - <input type='text' name='user[tel2]' value='".$order['tel2']."' disabled='disabled'> | |
1067 | - <input type='hidden' name='user[tel2]' value='".$order['tel2']."'> | |
1068 | - </div> | |
1069 | - | |
1070 | - <label>Äîñòàâêà</label>"; | |
1071 | - echo " | |
1072 | - <div class=info> | |
1073 | - <select name='user[delivery]'>"; | |
1074 | - viewBookSelectValue('zlo_book_delivery', 'id', 'title', $order['delivery']); | |
1075 | - echo "</select> | |
1076 | - </div>"; | |
1077 | - | |
1078 | - echo " | |
1079 | - <label>Ãîðîä:</label> | |
1080 | - <div class=info><input type='text' name='user[city]' class=\"validate[required]\" value='".$order['city']."' id='cityValidate'> </div> | |
1081 | - | |
1082 | - <label>Àäðåñ:</label> | |
1083 | - <div class=info><input type='text' name='user[address]' class=\"validate[required]\" value='".$order['address']."' id='addressValidate'> </div> | |
1084 | - | |
1085 | - <label>Êîìåíòàðèé:</label> | |
1086 | - <div class=info><textarea rows='4' style='width:400px;' name='user[comment]' cols='30' name='comment'>".$order['comment']."</textarea></div> | |
1087 | - | |
1088 | - <label>Êîìåíòàðèé (ìåíåäæåðà):</label> | |
1089 | - <div class=info><textarea rows='4' id='mcomment' style='width:400px;' name='user[mcomment]' cols='30' name='mcomment'>".$order['mcomment']."</textarea></div> | |
1090 | - | |
1091 | - "; | |
1092 | - | |
1093 | - echo" | |
1094 | - </fieldset> | |
1095 | - <div class=clear></div> | |
1096 | - </div>"; | |
1097 | - | |
1098 | - // Òàáëèöà òîâàðîâ | |
1099 | - | |
1100 | - $sql3 = "SELECT * FROM catalogs_orders_products | |
1101 | - WHERE `order_id`='".$order['order_id']."' "; | |
1102 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
1103 | - if (mysql_affected_rows()!=0) { $i=0; | |
1104 | - echo" | |
1105 | - <fieldset id='order-details'> | |
1106 | - <legend>Òîâàðû</legend> | |
1107 | - <div class='table'> | |
1108 | - <div class='count'>¹</div> | |
1109 | - <div class='code'>Êîä</div> | |
1110 | - <div class='brand'>Áðåíä</div> | |
1111 | - <div class='title'>Íàéìåíîâàíèå</div> | |
1112 | - <div class='size'>Ðàçìåð</div> | |
1113 | - <div class='color'>Öâåò</div> | |
1114 | - <div class='quant'>Êîë.</div> | |
1115 | - <div class='price'>Öåíà</div> | |
1116 | - <div class='total'>Ñóììà</div> | |
1117 | - <div class='onstock'>Íàëè÷èå</div> | |
1118 | - <div class='control' ></div> | |
1119 | - <div class='clear'></div> | |
1120 | - </div> | |
1121 | - <div id='lines'> | |
1122 | - <!-- Ïðÿ÷åì ýòó ñòðî÷êó, òàê êàê ÿâàñêðèïò êîïèïóåò ïåðâóþ ñòðî÷êó êàê ïóñòóþ --> | |
1123 | - <div id='line0'> | |
1124 | - <div class='row'> | |
1125 | - <div class='count' id='id(0)'>1</div> | |
1126 | - <div class='code'> | |
1127 | - <input type='text' name='item[code][]' value='' id='code(0)' autocomplete='off' onkeyup=flyFind(this.value,'(0)') onkeydown=selectFirst(event.keyCode)> | |
1128 | - <!-- search ---> | |
1129 | - <div class='livesearch-block'> | |
1130 | - <div id='livesearch(0)'></div> | |
1131 | - </div> | |
1132 | - <!-- ---> | |
1133 | - </div> | |
1134 | - <div class='brand' id='brand(0)'> </div> | |
1135 | - <div class='title' id='title(0)'> </div> | |
1136 | - <div class='size' id='size(0)'> </div> | |
1137 | - <div class='color' id='color(0)'> </div> | |
1138 | - <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(0)' onBlur='SumPerRow();'></div> | |
1139 | - <div class='price' id='price(0)'>0</div> | |
1140 | - <div class='total' id='total(0)'>0</div> | |
1141 | - <div class='onstock' id='onstock(0)'></div> | |
1142 | - | |
1143 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue(0)' value=''> | |
1144 | - <input type='hidden' name='item[product_id][]' id='product_idValue(0)' value=''> | |
1145 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue(0)' value=''> | |
1146 | - <input type='hidden' name='item[price][]' id='priceValue(0)' value='0'> | |
1147 | - <input type='hidden' name='item[total][]' id='totalValue(0)' value='0'> | |
1148 | - | |
1149 | - <div class='control'> | |
1150 | - <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
1151 | - <a href='#' onclick='RemoveDivLine(0);'><img src='/account/pic/del.png' width='18px'></a> | |
1152 | - </div> | |
1153 | - | |
1154 | - <div class='clear'></div> | |
1155 | - </div> | |
1156 | - </div> | |
1157 | - <!---------------------------------------------------------------------------------->"; | |
1158 | - | |
1159 | - while ($item_id=mysql_fetch_assoc($result3)) { $i++; | |
1160 | - | |
1161 | - // Èíôî î òîâàðå | |
1162 | - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m | |
1163 | - LEFT JOIN catalogs_products as p | |
1164 | - ON p.id=m.product_id | |
1165 | - WHERE m.id='".$item_id['product_id']."' "; | |
1166 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
1167 | - if (mysql_affected_rows()!=0) { | |
1168 | - $item=mysql_fetch_assoc($result4); | |
1169 | - | |
1170 | - // íàëè÷èå òîâàðà | |
1171 | - $sql5 = "SELECT c.name as city, o.count | |
1172 | - FROM catalogs_keys_products_cities as o | |
1173 | - LEFT JOIN catalogs_cities as c | |
1174 | - ON o.city_id=c.id | |
1175 | - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; | |
1176 | - $result5 = mysql_query($sql5) or die(mysql_error()); | |
1177 | - if (mysql_affected_rows()!=0) { | |
1178 | - $onStockDesc=''; | |
1179 | - while ($onStock=mysql_fetch_assoc($result5)) { | |
1180 | - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; | |
1181 | - } | |
1182 | - } else { $onStock='íåò';} | |
1183 | - | |
1184 | - echo"<div id='line$i'> | |
1185 | - <div class='row'> | |
1186 | - <div class='count' id='id($i)'>$i</div> | |
1187 | - <div class='code'> | |
1188 | - <input type='text' name='item[code][]' value='".$item['code']."' id='code($i)' autocomplete='off' onkeyup=flyFind(this.value,'($i)') onkeydown=selectFirst(event.keyCode)> | |
1189 | - <!-- search ---> | |
1190 | - <div class='livesearch-block'> | |
1191 | - <div id='livesearch($i)'></div> | |
1192 | - </div> | |
1193 | - <!-- ---> | |
1194 | - </div> | |
1195 | - <div class='brand' id='brand($i)'>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." </div> | |
1196 | - <div class='title' id='title($i)'>".$item['name']." </div> | |
1197 | - <div class='size' id='size($i)'>".$item['size']." </div> | |
1198 | - <div class='color' id='color($i)'>".$item['color']." </div> | |
1199 | - <div class='quant'><input type='text' name='item[quant][]' value='".$item_id['count']."' id='quantValue($i)' onBlur='SumPerRow();'></div> | |
1200 | - <div class='price' id='price($i)'>".$item['cine']."</div> | |
1201 | - <div class='total' id='total($i)'>".($item['cine']*$item_id['count'])."</div> | |
1202 | - <div class='onstock' id='onstock($i)'>$onStockDesc</div> | |
1203 | - | |
1204 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue($i)' value='".$item['mod_id']."'> | |
1205 | - <input type='hidden' name='item[product_id][]' id='product_idValue($i)' value='".$item['product_id']."'> | |
1206 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue($i)' value='".$item['brend_id']."'> | |
1207 | - <input type='hidden' name='item[price][]' id='priceValue($i)' value='".$item['cine']."'> | |
1208 | - <input type='hidden' name='item[total][]' id='totalValue($i)' value='".($item['cine']*$item_id['count'])."'> | |
1209 | - | |
1210 | - <div class='control'> | |
1211 | - <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
1212 | - <a href='#' onclick='RemoveDivLine($i);'><img src='/account/pic/del.png' width='18px'></a> | |
1213 | - </div> | |
1214 | - | |
1215 | - <div class='clear'></div> | |
1216 | - </div> | |
1217 | - </div>"; | |
1218 | - } | |
1219 | - | |
1220 | - } | |
1221 | - | |
1222 | - echo"</div> | |
1223 | - | |
1224 | - <div class='report'> | |
1225 | - Âñåãî: <span id='quantity'>0</span> òîâàðîâ íà <span id='summary'>0</span> ãðí. | |
1226 | - </div> | |
1227 | - | |
1228 | - <input type='hidden' name='summary' value='' id='summaryValue'> | |
1229 | - <input type='hidden' name='user_id' value='".$order['user_id']."'> | |
1230 | - <input type='hidden' name='order_id' value='".$order['order_id']."'> | |
1231 | - <input type='hidden' name='send' value='edit-order'> | |
1232 | - | |
1233 | - | |
1234 | - "; | |
1235 | - | |
1236 | - echo"<div class='clear'></div>"; | |
1237 | - | |
1238 | - // Äëÿ XML ôàéëà | |
1239 | - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); | |
1240 | - | |
1241 | - // Ñìåíà ñòàòóñà | |
1242 | - if ($order['status']!=6) { | |
1243 | - echo "<div class='pager-pages'> | |
1244 | - <div id='show'>Ïåðåâåñòè</div> | |
1245 | - <form method='POST' action='".$_SERVER["REQUEST_URI"]."' id='PerPageForm' name='SetStatus'> | |
1246 | - <select size='1' name='status' id='PerPage' >"; | |
1247 | - $sql4 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; | |
1248 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
1249 | - if (mysql_affected_rows()!=0) { | |
1250 | - | |
1251 | - while ($row4=mysql_fetch_assoc($result4)) { | |
1252 | - if($row4['id'] == $order['status']) $chek ="SELECTED"; | |
1253 | - else $chek = ""; | |
1254 | - echo"<option value='".$row4['id']."' ".$chek.">".$row4['title']."</option>\n"; | |
1255 | - } | |
1256 | - echo"</select>"; | |
1257 | - echo"<input type='hidden' name='action' value='status'> | |
1258 | - <input type='hidden' name='order_id' value='".$order['order_id']."'>"; | |
1259 | - } | |
1260 | - | |
1261 | - | |
1262 | - echo"</form>"; | |
1263 | - | |
1264 | - echo" | |
1265 | - <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> | |
1266 | - <div id='records'><input type='submit' class='button-save' title='Ñîõðàíèòü' value='Ñîõðàíèòü' onclick=\"document.forms['edit_order'].submit();\"></div> | |
1267 | - <div id='records'><a href='/account/admin/orders.php?action=print&order_id=".$order['order_id']."' target='_new' class='button-save'>Ïå÷àòü</a></div>"; | |
1268 | - | |
1269 | - if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { | |
1270 | - 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>"; | |
1271 | - } | |
1272 | - | |
1273 | - | |
1274 | - echo"</div>"; | |
1275 | - } | |
1276 | - echo"</fieldset></div>"; | |
1277 | - | |
1278 | - echo"</div>"; | |
1279 | - | |
1280 | - } | |
1281 | - | |
1282 | - } else { echo"<p>Ïóñòî</p>";} | |
1283 | - | |
1284 | - // ===================== | |
1285 | - // ===== javascript ==== | |
1286 | - // ===================== | |
1287 | - | |
1288 | - echo" | |
1289 | - <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | |
1290 | - <script src='/js/JsHttpRequest.js'></script> | |
1291 | - <script src='/js/OrderContol.js' type='text/javascript'></script>"; | |
1292 | - | |
1293 | - echo" | |
1294 | - <!-------[ Form falidator ]-------> | |
1295 | - <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> | |
1296 | - <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | |
1297 | - | |
1298 | - <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> | |
1299 | - <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script> | |
1300 | - | |
1301 | - <script> | |
1302 | - jQuery(document).ready(function(){ | |
1303 | - // binds form submission and fields to the validation engine | |
1304 | - jQuery('#add-item').validationEngine(); | |
1305 | - }); | |
1306 | - </script> | |
1307 | - <!-------->"; | |
1308 | - } | |
1309 | - | |
1310 | - | |
1311 | - | |
1312 | - | |
1313 | - // ============= | |
1314 | - // ==== add ==== | |
1315 | - // ============= | |
1316 | - | |
1317 | - if (isset($_GET['action']) && $_GET['action']=='add') { | |
1318 | - | |
1319 | - if (isset($_POST['user'])) {} | |
1320 | - | |
1321 | - $user=array(); | |
1322 | - | |
1323 | - if(isset($_GET['user'])) { | |
1324 | - | |
1325 | - $sql = "SELECT * FROM zlo_users WHERE id='".$_GET['user']."'"; | |
1326 | - $result = mysql_query($sql) or die(mysql_error()); | |
1327 | - if (mysql_affected_rows()!=0) { | |
1328 | - $user=mysql_fetch_assoc($result); | |
1329 | - } | |
1330 | - | |
1331 | - } else { | |
1332 | - | |
1333 | - if(isset($_POST)) {$user=$_POST['user'];} | |
1334 | - | |
1335 | - } | |
1336 | - | |
1337 | - | |
1338 | - | |
1339 | - echo"<form action='' method='POST' name='add_order' id='add-item'>"; | |
1340 | - echo"<div class='add-order'>"; | |
1341 | - echo"<div class='orders'>"; | |
1342 | - | |
1343 | - echo" | |
1344 | - <div class=order-info> | |
1345 | - <fieldset id='order-info'> | |
1346 | - <legend>Íîâûé çàêàç</legend> | |
1347 | - | |
1348 | - <label>Äàòà:</label> | |
1349 | - <div class=info>".date('Y-m-d H:i:s')."</div>"; | |
1350 | - | |
1351 | - if(!isset($_GET['user'])) { | |
1352 | - echo"<div class='new'>Ïî óìîë÷àíèþ<input type='checkbox' onChange='newUnknownUser();' id='default'></div>"; | |
1353 | - } | |
1354 | - | |
1355 | - if(isset($_GET['user'])) { | |
1356 | - | |
1357 | - $readonly='readonly="readonly"'; | |
1358 | - $disabled='disabled="disabled"'; | |
1359 | - | |
1360 | - } else {$readonly='';$disabled='';} | |
1361 | - | |
1362 | - echo" | |
1363 | - <label>Email:*</label> | |
1364 | - <div class=info><input type='text' name='user[email]' value='".$user['email']."' class='validate[required,user[email]] text-input' id='emailValue' $readonly autocomplete='off' onkeyup=livesearchEmail(this.value,'(0)')> </div> | |
1365 | - <!-- search ---> | |
1366 | - <div class='livesearch-email-block'> | |
1367 | - <div id='livesearch-email-list'></div> | |
1368 | - </div> | |
1369 | - <!-- ---> | |
1370 | - | |
1371 | - <label>Òåëåôîí:*</label> | |
1372 | - <div class=info><input type='text' 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> | |
1373 | - <!-- search ---> | |
1374 | - <div class='livesearch-tel-block'> | |
1375 | - <div id='livesearch-tel-list'></div> | |
1376 | - </div> | |
1377 | - <!-- ---> | |
1378 | - | |
1379 | - | |
1380 | - <label>Êëèåíò:*</label> | |
1381 | - <div class=info><input type='text' name='user[username]' value='".$user['username']."' id='usernameValue' $readonly> </div> | |
1382 | - | |
1383 | - <label>Òåëåôîí 2:</label> | |
1384 | - <div class=info><input type='text' name='user[tel2]' value='".$user['tel2']."' id='tel2Value'> </div> | |
1385 | - | |
1386 | - <label>Äîñòàâêà</label>"; | |
1387 | - echo " | |
1388 | - <div class=info> | |
1389 | - <select name='user[delivery]'>"; | |
1390 | - viewBookSelectValue('zlo_book_delivery', 'id', 'title', $user['delivery']); | |
1391 | - echo " </select> | |
1392 | - </div>"; | |
1393 | - | |
1394 | - echo " | |
1395 | - <label>Ãîðîä:*</label> | |
1396 | - <div class=info><input type='text' name='user[city]' class=\"validate[required]\" value='".$user['city']."' id='cityValue'> </div> | |
1397 | - | |
1398 | - <label>Àäðåñ:*</label> | |
1399 | - <div class=info><input type='text' name='user[address]' class=\"validate[required]\" value='".$user['address']."' id='addressValue'> </div> | |
1400 | - | |
1401 | - <label>Êîìåíòàðèé:</label> | |
1402 | - <div class=info><textarea rows='2' name='user[comment]' cols='30' name='comment'>".$user['comment']."</textarea></div>"; | |
1403 | - | |
1404 | - // ãðóïïà | |
1405 | - echo" | |
1406 | - <label>Ãðóïïà</label>"; | |
1407 | - | |
1408 | - echo "<select name='user[group]' id='usergroup' $disabled >"; | |
1409 | - viewBookSelectValue('zlo_users_group', 'id', 'name', $user['group']); | |
1410 | - echo "</select>"; | |
1411 | - | |
1412 | - // hidden | |
1413 | - if (isset($_GET['user'])) { | |
1414 | - echo"<input type='hidden' name='user[group]' value='".$user['group']."'>"; | |
1415 | - } | |
1416 | - | |
1417 | - echo"<input type='hidden' name='user[user_id]' value='".$user['id']."' id='user_id'>"; | |
1418 | - | |
1419 | - echo"<div class=clear></div> | |
1420 | - </fieldset> | |
1421 | - <div class=clear></div> | |
1422 | - </div>"; | |
1423 | - | |
1424 | - echo" | |
1425 | - <fieldset id='order-details'> | |
1426 | - <legend>Òîâàðû</legend> | |
1427 | - <div class='table'> | |
1428 | - <div class='count'>¹</div> | |
1429 | - <div class='code'>Êîä</div> | |
1430 | - <div class='brand'>Áðåíä</div> | |
1431 | - <div class='title'>Íàéìåíîâàíèå</div> | |
1432 | - <div class='size'>Ðàçìåð</div> | |
1433 | - <div class='color'>Öâåò</div> | |
1434 | - <div class='quant'>Êîë.</div> | |
1435 | - <div class='price'>Öåíà</div> | |
1436 | - <div class='total'>Ñóììà</div> | |
1437 | - <div class='onstock'>Íàëè÷èå</div> | |
1438 | - <div class='control' ></div> | |
1439 | - <div class='clear'></div> | |
1440 | - </div> | |
1441 | - <div id='lines'> | |
1442 | - <!-- Ïðÿ÷åì ýòó ñòðî÷êó, òàê êàê ÿâàñêðèïò êîïèïóåò ïåðâóþ ñòðî÷êó êàê ïóñòóþ --> | |
1443 | - <div id='line0'> | |
1444 | - <div class='row'> | |
1445 | - <div class='count' id='id(0)'>1</div> | |
1446 | - <div class='code'> | |
1447 | - <input type='text' name='item[code][]' value='' id='code(0)' autocomplete='off' onkeyup=flyFind(this.value,'(0)') onkeydown=selectFirst(event.keyCode)> | |
1448 | - <!-- search ---> | |
1449 | - <div class='livesearch-block'> | |
1450 | - <div id='livesearch(0)'></div> | |
1451 | - </div> | |
1452 | - <!-- ---> | |
1453 | - </div> | |
1454 | - <div class='brand' id='brand(0)'> </div> | |
1455 | - <div class='title' id='title(0)'> </div> | |
1456 | - <div class='size' id='size(0)'> </div> | |
1457 | - <div class='color' id='color(0)'> </div> | |
1458 | - <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(0)' onBlur='SumPerRow();'></div> | |
1459 | - <div class='price' id='price(0)'>0</div> | |
1460 | - <div class='total' id='total(0)'>0</div> | |
1461 | - <div class='onstock' id='onstock(0)'></div> | |
1462 | - | |
1463 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue(0)' value=''> | |
1464 | - <input type='hidden' name='item[product_id][]' id='product_idValue(0)' value=''> | |
1465 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue(0)' value=''> | |
1466 | - <input type='hidden' name='item[price][]' id='priceValue(0)' value='0'> | |
1467 | - <input type='hidden' name='item[total][]' id='totalValue(0)' value='0'> | |
1468 | - | |
1469 | - <div class='control'> | |
1470 | - <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
1471 | - <a href='#' onclick='RemoveDivLine(0);'><img src='/account/pic/del.png' width='18px'></a> | |
1472 | - </div> | |
1473 | - | |
1474 | - <div class='clear'></div> | |
1475 | - </div> | |
1476 | - </div> | |
1477 | - <!----------------------------------------------------------------------------------> | |
1478 | - <div id='line1'> | |
1479 | - <div class='row'> | |
1480 | - <div class='count' id='id(1)'>1</div> | |
1481 | - <div class='code'> | |
1482 | - <input type='text' name='item[code][]' value='' id='code(1)' autocomplete='off' onkeyup=flyFind(this.value,'(1)') onkeydown=selectFirst(event.keyCode)> | |
1483 | - <!-- search ---> | |
1484 | - <div class='livesearch-block'> | |
1485 | - <div id='livesearch(1)'></div> | |
1486 | - </div> | |
1487 | - <!-- ---> | |
1488 | - </div> | |
1489 | - <div class='brand' id='brand(1)'> </div> | |
1490 | - <div class='title' id='title(1)'> </div> | |
1491 | - <div class='size' id='size(1)'> </div> | |
1492 | - <div class='color' id='color(1)'> </div> | |
1493 | - <div class='quant'><input type='text' name='item[quant][]' value='1' id='quantValue(1)' onBlur='SumPerRow();'></div> | |
1494 | - <div class='price' id='price(1)'>0</div> | |
1495 | - <div class='total' id='total(1)'>0</div> | |
1496 | - <div class='onstock' id='onstock(1)'></div> | |
1497 | - | |
1498 | - <input type='hidden' name='item[mod_id][]' id='mod_idValue(1)' value=''> | |
1499 | - <input type='hidden' name='item[product_id][]' id='product_idValue(1)' value=''> | |
1500 | - <input type='hidden' name='item[brand_id][]' id='brand_idValue(1)' value=''> | |
1501 | - <input type='hidden' name='item[price][]' id='priceValue(1)' value='0'> | |
1502 | - <input type='hidden' name='item[total][]' id='totalValue(1)' value='0'> | |
1503 | - | |
1504 | - <div class='control'> | |
1505 | - <a href='#' onclick='AddRow()'><img src='/account/pic/add2.png' width='18px'></a> | |
1506 | - <a href='#' onclick='RemoveDivLine(1);'><img src='/account/pic/del.png' width='18px'></a> | |
1507 | - </div> | |
1508 | - | |
1509 | - <div class='clear'></div> | |
1510 | - </div> | |
1511 | - </div> | |
1512 | - </div> | |
1513 | - | |
1514 | - <div class='report'> | |
1515 | - Âñåãî: <span id='quantity'>0</span> òîâàðîâ íà <span id='summary'>0</span> ãðí. | |
1516 | - </div> | |
1517 | - | |
1518 | - <input type='hidden' name='summary' id='summaryValue' value=''> | |
1519 | - <input type='hidden' name='send' value='add-order'> | |
1520 | - <input type='submit' class='button-add' title='Äîáàâèòü' value='Äîáàâèòü' onclick=\"document.form.submit();\"> | |
1521 | - | |
1522 | - </fieldset > | |
1523 | - </div> | |
1524 | - </form>"; | |
1525 | - | |
1526 | - // ===================== | |
1527 | - // ===== javascript ==== | |
1528 | - // ===================== | |
1529 | - | |
1530 | - echo" | |
1531 | - <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script> | |
1532 | - <script src='/js/JsHttpRequest.js'></script> | |
1533 | - <script src='/js/OrderContol.js' type='text/javascript'></script>"; | |
1534 | - | |
1535 | - echo" | |
1536 | - <!-------[ Form falidator ]-------> | |
1537 | - <link rel='stylesheet' href='/js/validator/validationEngine.jquery.css' type='text/css'/> | |
1538 | - <link rel='stylesheet' href='/js/validator/template.css' type='text/css'/> | |
1539 | - | |
1540 | - <script src='/js/validator/languages/jquery.validationEngine-ru.js' type='text/javascript' charset='utf-8'></script> | |
1541 | - <script src='/js/validator/jquery.validationEngine.js' type='text/javascript' charset='utf-8'></script> | |
1542 | - | |
1543 | - <script> | |
1544 | - jQuery(document).ready(function(){ | |
1545 | - // binds form submission and fields to the validation engine | |
1546 | - jQuery('#add-item').validationEngine(); | |
1547 | - }); | |
1548 | - </script> | |
1549 | - <!-------->"; | |
1550 | - | |
1551 | - } | |
1552 | - | |
1553 | - | |
1554 | - // ============= | |
1555 | - // === print === | |
1556 | - // ============= | |
1557 | - | |
1558 | - if (isset($_GET['action']) && $_GET['action']=='print') { | |
1559 | - | |
1560 | - // =========== Ãåíåðèì òàáëèöó =========== | |
1561 | - | |
1562 | - if (!isset($_GET['status'])) {$_GET['status']=1;} | |
1563 | - | |
1564 | - $sql = "SELECT o.*,u.*, o.id as order_id FROM catalogs_orders as o | |
1565 | - RIGHT JOIN zlo_users as u on u.id=o.user_id | |
1566 | - WHERE o.id='".$_GET['order_id']."' "; | |
1567 | - $result = mysql_query($sql) or die(mysql_error()); | |
1568 | - if (mysql_affected_rows()!=0) { | |
1569 | - $view=''; | |
1570 | - $view.="<div class='print'>"; | |
1571 | - | |
1572 | - $order=mysql_fetch_assoc($result); | |
1573 | - | |
1574 | - $view.="<div class='client'> | |
1575 | - <table> | |
1576 | - <tr> | |
1577 | - <td>Çàêàç # </td> | |
1578 | - <td>".$order['order_id']."</td> | |
1579 | - </tr> | |
1580 | - <tr> | |
1581 | - <td>Äàòà: </td> | |
1582 | - <td>".date('Y-m-d H:i:s',$order['mktime'])."</td> | |
1583 | - </tr> | |
1584 | - <tr> | |
1585 | - <td>Êëèåíò: </td> | |
1586 | - <td>".$order['username']."</td> | |
1587 | - </tr> | |
1588 | - <tr> | |
1589 | - <td>Òåë: </td> | |
1590 | - <td>".$order['tel']."</td> | |
1591 | - </tr> | |
1592 | - <tr> | |
1593 | - <td>Äîï. òåë: </td> | |
1594 | - <td>".$order['tel2']."</td> | |
1595 | - </tr> | |
1596 | - <tr> | |
1597 | - <td>Äîñòàâêà: </td> | |
1598 | - <td>".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')."</td> | |
1599 | - </tr> | |
1600 | - <tr> | |
1601 | - <td>Ãîðîä: </td> | |
1602 | - <td>".$order['city']."</td> | |
1603 | - </tr> | |
1604 | - <tr> | |
1605 | - <td>Àäðåñ: </td> | |
1606 | - <td>".$order['address']."</td> | |
1607 | - </tr> | |
1608 | - <tr> | |
1609 | - <td>Êîìåíòàðèé: </td> | |
1610 | - <td>".$order['comment']."</td> | |
1611 | - </tr> | |
1612 | - </table> | |
1613 | - </div>"; | |
1614 | - | |
1615 | - | |
1616 | - // Òàáëèöà òîâàðîâ | |
1617 | - | |
1618 | - $sql3 = "SELECT * FROM catalogs_orders_products | |
1619 | - WHERE `order_id`='".$order['order_id']."' "; | |
1620 | - $result3 = mysql_query($sql3) or die(mysql_error()); | |
1621 | - if (mysql_affected_rows()!=0) { $i=0; | |
1622 | - | |
1623 | - $view.="<div class='details'>"; | |
1624 | - | |
1625 | - | |
1626 | - while ($item_id=mysql_fetch_assoc($result3)) { $i++; | |
1627 | - | |
1628 | - $sql4 = "SELECT * FROM catalogs_modifications as m | |
1629 | - LEFT JOIN catalogs_products as p | |
1630 | - ON p.id=m.product_id | |
1631 | - WHERE m.id='".$item_id['product_id']."' "; | |
1632 | - $result4 = mysql_query($sql4) or die(mysql_error()); | |
1633 | - if (mysql_affected_rows()!=0) { | |
1634 | - while ($item=mysql_fetch_assoc($result4)) { | |
1635 | - | |
1636 | - $view.=" | |
1637 | - <table> | |
1638 | - <tr> | |
1639 | - <td>¹</td> | |
1640 | - <td>$i .</td> | |
1641 | - </tr> | |
1642 | - <tr> | |
1643 | - <td>Êîä</td> | |
1644 | - <td>".$item['code']."</td> | |
1645 | - </tr> | |
1646 | - <tr> | |
1647 | - <td>Áðåíä</td> | |
1648 | - <td>".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."</td> | |
1649 | - </tr> | |
1650 | - <tr> | |
1651 | - <td>Íàçâàíèå</td> | |
1652 | - <td>".$item['name']."</td> | |
1653 | - </tr> | |
1654 | - <tr> | |
1655 | - <td>Ðàçìåð</td> | |
1656 | - <td>".$item['size']."</td> | |
1657 | - </tr> | |
1658 | - <tr> | |
1659 | - <td>Öâåò</td> | |
1660 | - <td>".$item['color']."</td> | |
1661 | - </tr> | |
1662 | - <tr> | |
1663 | - <td>Êîë.</td> | |
1664 | - <td>".$item_id['count']."</td> | |
1665 | - </tr> | |
1666 | - <tr> | |
1667 | - <td>Öåíà</td> | |
1668 | - <td>".$item['cine']."</td> | |
1669 | - </tr> | |
1670 | - <tr> | |
1671 | - <td>Ñóììà</td> | |
1672 | - <td>".($item['cine']*$item_id['count'])."</td> | |
1673 | - </tr> | |
1674 | - | |
1675 | - </table>"; | |
1676 | - | |
1677 | - } | |
1678 | - | |
1679 | - } | |
1680 | - } | |
1681 | - | |
1682 | - $view.="<span class='total'>Îáùàÿ ñóììà: ".$order['total']." ãðí. </span> | |
1683 | - | |
1684 | - </div>"; | |
1685 | - | |
1686 | - } | |
1687 | - | |
1688 | - $view.="</div>"; | |
1689 | - | |
1690 | - // Âûâîäèì 2 ðàçà | |
1691 | - | |
1692 | - echo $view; | |
1693 | - echo "<div class='print'><div class='separator'></div></div>"; | |
1694 | - echo $view; | |
1695 | - | |
1696 | - | |
1697 | - } | |
1698 | - } | |
1699 | -?> |
account/func/func.php
1 | -<? | |
2 | - | |
3 | -function sendSMS($tel,$text){ | |
4 | - | |
5 | -$text = iconv('windows-1251', 'utf-8', htmlspecialchars($text)); | |
6 | -$description = iconv('windows-1251', 'utf-8', htmlspecialchars('Îòïðàâêà íîìåðà çàêàçà êëèåíòó')); | |
7 | - | |
8 | - | |
9 | - | |
10 | -/* | |
11 | -$content = implode("",file("http://yandex.ru")); | |
12 | -$content = str_replace(">","",$content); | |
13 | -$content = str_replace("<","",$content); | |
14 | -$content = str_replace("/","",$content); | |
15 | -$content = str_replace("'","",$content); | |
16 | -$content = str_replace('"',"",$content); | |
17 | -$content = str_replace(":","",$content); | |
18 | -list($a,$b)=spliti("b-region__time",$content,2); | |
19 | -list($times,$b)=spliti("!",$b,2); | |
20 | -$times = preg_replace("/[^0-9]+/","",$times); | |
21 | - | |
22 | -$times1 = substr($times,2,2); | |
23 | -$times2 = substr($times,0,2); | |
24 | -$times = strtotime(date("d-m-Y")." ".$times2.":".$times1.":00"); | |
25 | -*/ | |
26 | - | |
27 | -$times = time(); | |
28 | - | |
29 | - | |
30 | - | |
31 | -//$start_time = date("Y-m-d H:i:s",$times+360); | |
32 | -//$end_time = date("Y-m-d H:i:s", $times+360); // ïëþñ 3 ÷àñà | |
33 | - | |
34 | -$start_time = 'AUTO'; | |
35 | -$end_time = 'AUTO'; | |
36 | - | |
37 | -//echo $start_time."(".date("Y-m-d H:i:s").")"."=>".$end_time; | |
38 | -$rate = 120; | |
39 | -$livetime = 4; | |
40 | -$source = 'extremstyle'; // Alfaname | |
41 | -$recipient = $tel; | |
42 | -$user = '380674064008'; | |
43 | -$password = 'smsartweb2012'; | |
44 | - | |
45 | -$myXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; | |
46 | -$myXML .= "<request>"; | |
47 | -$myXML .= "<operation>SENDSMS</operation>"; | |
48 | -$myXML .= ' <message start_time="'.$start_time.'" end_time="'.$end_time.'" livetime="'.$livetime.'" rate="'.$rate.'" desc="'.$description.'" source="'.$source.'">'."\n"; | |
49 | -$myXML .= " <body>".$text."</body>"; | |
50 | -$myXML .= " <recipient>".$recipient."</recipient>"; | |
51 | -$myXML .= "</message>"; | |
52 | -$myXML .= "</request>"; | |
53 | - | |
54 | -$ch = curl_init(); | |
55 | -curl_setopt($ch, CURLOPT_USERPWD , $user.':'.$password); | |
56 | -curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
57 | -curl_setopt($ch, CURLOPT_POST, 1); | |
58 | -curl_setopt($ch, CURLOPT_URL, 'http://sms-fly.com/api/api.php'); | |
59 | -curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: text/xml")); | |
60 | -curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
61 | -curl_setopt($ch, CURLOPT_POSTFIELDS, $myXML); | |
62 | -$response = curl_exec($ch); | |
63 | -curl_close($ch); | |
64 | - | |
65 | -//echo $response; | |
66 | -//exit; | |
1 | +<?php | |
67 | 2 | |
3 | +function sendSMS ($tel, $text) | |
4 | +{ | |
5 | + $text = iconv ('windows-1251', 'utf-8', htmlspecialchars ($text)); | |
6 | + $description = iconv ('windows-1251', 'utf-8', htmlspecialchars ('Îòïðàâêà íîìåðà çàêàçà êëèåíòó')); | |
7 | + | |
8 | + $times = time (); | |
9 | + | |
10 | + $start_time = 'AUTO'; | |
11 | + $end_time = 'AUTO'; | |
12 | + | |
13 | + $rate = 120; | |
14 | + $livetime = 4; | |
15 | + $source = 'extremstyle'; // Alfaname | |
16 | + $recipient = $tel; | |
17 | + $user = '380674064008'; | |
18 | + $password = 'smsartweb2012'; | |
19 | + | |
20 | + $myXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; | |
21 | + $myXML .= "<request>"; | |
22 | + $myXML .= "<operation>SENDSMS</operation>"; | |
23 | + $myXML .= ' <message start_time="' . $start_time . '" end_time="' . $end_time . '" livetime="' . $livetime . '" rate="' . $rate . '" desc="' . $description . '" source="' . $source . '">' . "\n"; | |
24 | + $myXML .= " <body>" . $text . "</body>"; | |
25 | + $myXML .= " <recipient>" . $recipient . "</recipient>"; | |
26 | + $myXML .= "</message>"; | |
27 | + $myXML .= "</request>"; | |
28 | + | |
29 | + $ch = curl_init (); | |
30 | + curl_setopt ($ch, CURLOPT_USERPWD, $user . ':' . $password); | |
31 | + curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
32 | + curl_setopt ($ch, CURLOPT_POST, 1); | |
33 | + curl_setopt ($ch, CURLOPT_URL, 'http://sms-fly.com/api/api.php'); | |
34 | + curl_setopt ($ch, CURLOPT_HTTPHEADER, array ( | |
35 | + "Content-Type: text/xml", | |
36 | + "Accept: text/xml" | |
37 | + )); | |
38 | + curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); | |
39 | + curl_setopt ($ch, CURLOPT_POSTFIELDS, $myXML); | |
40 | + $response = curl_exec ($ch); | |
41 | + curl_close ($ch); | |
42 | + | |
43 | + // echo $response; | |
44 | + // exit; | |
68 | 45 | } |
69 | 46 | |
70 | - | |
71 | -function ValidFormData($data,$titles,$type){ | |
72 | - | |
73 | - switch($type) { | |
74 | - | |
75 | - case 'only_digits': | |
76 | - | |
77 | - $error = "Îøèáêà ââîäà ïîëÿ $titles, òîëüêî öèôðû."; | |
78 | - | |
79 | - if(strlen($data)>0){ | |
80 | - if(preg_match("/[0-9]+/i",$data)) {$error='';} | |
81 | - } | |
82 | - return $error; | |
83 | - break; | |
84 | - | |
85 | - case 'mobile': | |
86 | - | |
87 | - $error = "Îøèáêà ââîäà ïîëÿ $titles (ôîðìàò: +380XXXXXXXXX)."; | |
88 | - | |
89 | - if(strlen($data)>0){ | |
90 | - // if(preg_match("/^(\+)[0-9]+$/i",$data.$names)) {$error='';} | |
91 | - } | |
92 | - // return $error; | |
93 | - break; | |
94 | - | |
95 | - case 'require': | |
96 | - | |
97 | - $error = "Ïîëå $titles îáÿçàòåëüíîå ê çàïîëíåíèþ."; | |
47 | +function ValidFormData ($data, $titles, $type) | |
48 | +{ | |
49 | + switch ($type) | |
50 | + { | |
51 | + case 'only_digits' : | |
52 | + | |
53 | + $error = "Îøèáêà ââîäà ïîëÿ $titles, òîëüêî öèôðû."; | |
54 | + | |
55 | + if (strlen ($data) > 0) | |
56 | + { | |
57 | + if (preg_match ("/[0-9]+/i", $data)) | |
58 | + { | |
59 | + $error = ''; | |
60 | + } | |
61 | + } | |
62 | + return $error; | |
63 | + break; | |
98 | 64 | |
99 | - if(strlen($data)>0){ | |
100 | - if(preg_match("/.{1,100}/i",$data.$names)) {$error='';} | |
101 | - } | |
102 | - return $error; | |
103 | - break; | |
65 | + case 'mobile' : | |
66 | + | |
67 | + $error = "Îøèáêà ââîäà ïîëÿ $titles (ôîðìàò: +380XXXXXXXXX)."; | |
68 | + | |
69 | + if (strlen ($data) > 0) | |
70 | + { | |
71 | + // if(preg_match("/^(\+)[0-9]+$/i",$data.$names)) {$error='';} | |
72 | + } | |
73 | + // return $error; | |
74 | + break; | |
104 | 75 | |
105 | - case 'email': | |
106 | - | |
107 | - // Ïðîâåðêà email | |
108 | - $error = "Îøèáêà ââîäà ïîëÿ $titles. "; | |
109 | - | |
110 | - if(strlen($data)>0) { | |
76 | + case 'require' : | |
111 | 77 | |
112 | - if(preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $data)) { | |
113 | - | |
114 | - $error=''; | |
115 | - | |
78 | + $error = "Ïîëå $titles îáÿçàòåëüíîå ê çàïîëíåíèþ."; | |
79 | + | |
80 | + if (strlen ($data) > 0) | |
81 | + { | |
82 | + if (preg_match ("/.{1,100}/i", $data . $names)) | |
83 | + { | |
84 | + $error = ''; | |
85 | + } | |
116 | 86 | } |
117 | - } | |
118 | - return $error; | |
119 | - break; | |
87 | + return $error; | |
88 | + break; | |
120 | 89 | |
121 | - default: | |
122 | - | |
123 | - return $error = "Îøèáêà $type"; | |
124 | - break; | |
90 | + case 'email' : | |
91 | + | |
92 | + // Ïðîâåðêà email | |
93 | + $error = "Îøèáêà ââîäà ïîëÿ $titles. "; | |
94 | + | |
95 | + if (strlen ($data) > 0) | |
96 | + { | |
97 | + | |
98 | + if (preg_match ("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $data)) | |
99 | + { | |
100 | + | |
101 | + $error = ''; | |
102 | + } | |
103 | + } | |
104 | + return $error; | |
105 | + break; | |
125 | 106 | |
126 | - return $error; | |
127 | - | |
128 | - } | |
107 | + default : | |
108 | + | |
109 | + return $error = "Îøèáêà $type"; | |
110 | + break; | |
111 | + | |
112 | + return $error; | |
113 | + } | |
129 | 114 | } |
130 | - | |
131 | 115 | |
132 | -function FreandlyDigits($what) { | |
133 | - | |
134 | - $total=strlen($what); | |
135 | - $mass=''; $result=''; $j=0; | |
116 | +function FreandlyDigits ($what) | |
117 | +{ | |
118 | + $total = strlen ($what); | |
119 | + $mass = ''; | |
120 | + $result = ''; | |
121 | + $j = 0; | |
136 | 122 | |
137 | - for($i=$total;$i>=0;$i--){ | |
138 | - $mass[]=substr($what,$i,1); | |
139 | - if ($i!=0) { | |
140 | - if ($j==3) {$mass[]=' '; $j=0;} | |
141 | - $j++; | |
123 | + for ($i = $total; $i >= 0; $i --) | |
124 | + { | |
125 | + $mass[] = substr ($what, $i, 1); | |
126 | + if ($i != 0) | |
127 | + { | |
128 | + if ($j == 3) | |
129 | + { | |
130 | + $mass[] = ' '; | |
131 | + $j = 0; | |
132 | + } | |
133 | + $j ++; | |
142 | 134 | } |
143 | 135 | } |
144 | 136 | |
145 | - krsort($mass); | |
137 | + krsort ($mass); | |
146 | 138 | |
147 | - foreach($mass as $digit){$i++; $j++; | |
148 | - $result.=$digit; | |
139 | + foreach ($mass as $digit) | |
140 | + { | |
141 | + $i ++; | |
142 | + $j ++; | |
143 | + $result .= $digit; | |
149 | 144 | } |
150 | 145 | |
151 | 146 | return $result; |
152 | 147 | } |
153 | 148 | |
154 | -function ExtractDate($date){ //2011-02-03 10:45:20 | |
155 | - | |
156 | - if (strpos(trim($date)," ")) { | |
157 | - | |
158 | - list($Date,$Time)=explode(" ",trim($date)); | |
159 | - $result1=explode("-",trim($Date)); | |
160 | - $result2=explode(":",trim($Time)); | |
161 | - | |
162 | - foreach ($result2 as $key=>$value) { | |
163 | - $result1[]=$value; | |
149 | +function ExtractDate ($date) | |
150 | +{ // 2011-02-03 10:45:20 | |
151 | + if (strpos (trim ($date), " ")) | |
152 | + { | |
153 | + | |
154 | + list ($Date, $Time) = explode (" ", trim ($date)); | |
155 | + $result1 = explode ("-", trim ($Date)); | |
156 | + $result2 = explode (":", trim ($Time)); | |
157 | + | |
158 | + foreach ($result2 as $key => $value) | |
159 | + { | |
160 | + $result1[] = $value; | |
164 | 161 | } |
165 | - | |
162 | + | |
166 | 163 | return $result1; |
164 | + } | |
165 | + elseif (strpos (trim ($date), "-")) | |
166 | + { | |
167 | 167 | |
168 | - } elseif (strpos(trim($date),"-")) { | |
169 | - | |
170 | - return $result=explode("-",trim($date)); | |
171 | - | |
172 | - } elseif (strpos(trim($date),":")) { | |
173 | - | |
174 | - return $result=explode(":",trim($date)); | |
168 | + return $result = explode ("-", trim ($date)); | |
169 | + } | |
170 | + elseif (strpos (trim ($date), ":")) | |
171 | + { | |
172 | + | |
173 | + return $result = explode (":", trim ($date)); | |
175 | 174 | } |
176 | - | |
177 | 175 | } |
178 | 176 | |
179 | -function AddZeroDate ($i) { | |
180 | - | |
181 | - if($i=='') {$i= "00"; } | |
182 | - if($i<10) {$i= "0".$i; } | |
177 | +function AddZeroDate ($i) | |
178 | +{ | |
179 | + if ($i == '') | |
180 | + { | |
181 | + $i = "00"; | |
182 | + } | |
183 | + if ($i < 10) | |
184 | + { | |
185 | + $i = "0" . $i; | |
186 | + } | |
183 | 187 | |
184 | 188 | return $i; |
185 | 189 | } |
186 | 190 | |
187 | -function WhatMonth ($i) { | |
188 | - | |
189 | - $month1['1']="ÿíâàðÿ"; | |
190 | - $month1['2']="ôåâðàëÿ"; | |
191 | - $month1['3']="ìàðòà"; | |
192 | - $month1['4']="àïðåëÿ"; | |
193 | - $month1['5']="ìàÿ"; | |
194 | - $month1['6']="èþíÿ"; | |
195 | - $month1['7']="èþëÿ"; | |
196 | - $month1['8']="àâãóñòà"; | |
197 | - $month1['9']="ñåíòÿáðÿ"; | |
198 | - $month1['10']="îêòÿáðÿ"; | |
199 | - $month1['11']="íîÿáðÿ"; | |
200 | - $month1['12']="äåêàáðÿ"; | |
201 | - | |
202 | - $month2['1']="ßíâàðü"; | |
203 | - $month2['2']="Ôåâðàëü"; | |
204 | - $month2['3']="Ìàðò"; | |
205 | - $month2['4']="Àïðåëü"; | |
206 | - $month2['5']="Ìàé"; | |
207 | - $month2['6']="Èþíü"; | |
208 | - $month2['7']="Èþëü"; | |
209 | - $month2['8']="Àâãóñò"; | |
210 | - $month2['9']="Ñåíòÿáðü"; | |
211 | - $month2['10']="Îêòÿáðü"; | |
212 | - $month2['11']="Íîÿáðü"; | |
213 | - $month2['12']="Äåêàáðü"; | |
191 | +function WhatMonth ($i) | |
192 | +{ | |
193 | + $month1['1'] = "ÿíâàðÿ"; | |
194 | + $month1['2'] = "ôåâðàëÿ"; | |
195 | + $month1['3'] = "ìàðòà"; | |
196 | + $month1['4'] = "àïðåëÿ"; | |
197 | + $month1['5'] = "ìàÿ"; | |
198 | + $month1['6'] = "èþíÿ"; | |
199 | + $month1['7'] = "èþëÿ"; | |
200 | + $month1['8'] = "àâãóñòà"; | |
201 | + $month1['9'] = "ñåíòÿáðÿ"; | |
202 | + $month1['10'] = "îêòÿáðÿ"; | |
203 | + $month1['11'] = "íîÿáðÿ"; | |
204 | + $month1['12'] = "äåêàáðÿ"; | |
214 | 205 | |
215 | - return $month2[$i]; | |
206 | + $month2['1'] = "ßíâàðü"; | |
207 | + $month2['2'] = "Ôåâðàëü"; | |
208 | + $month2['3'] = "Ìàðò"; | |
209 | + $month2['4'] = "Àïðåëü"; | |
210 | + $month2['5'] = "Ìàé"; | |
211 | + $month2['6'] = "Èþíü"; | |
212 | + $month2['7'] = "Èþëü"; | |
213 | + $month2['8'] = "Àâãóñò"; | |
214 | + $month2['9'] = "Ñåíòÿáðü"; | |
215 | + $month2['10'] = "Îêòÿáðü"; | |
216 | + $month2['11'] = "Íîÿáðü"; | |
217 | + $month2['12'] = "Äåêàáðü"; | |
216 | 218 | |
219 | + return $month2[$i]; | |
217 | 220 | } |
218 | 221 | |
219 | -function GetFormUrl() { | |
222 | +function GetFormUrl () | |
223 | +{ | |
220 | 224 | $link = $_SERVER['REQUEST_URI']; |
221 | - if (!isset($_SERVER['QUERY_STRING'])) { | |
222 | - $link.= "?".htmlentities($_SERVER['QUERY_STRING']); | |
225 | + if (! isset ($_SERVER['QUERY_STRING'])) | |
226 | + { | |
227 | + $link .= "?" . htmlentities ($_SERVER['QUERY_STRING']); | |
223 | 228 | } |
224 | 229 | return $link; |
225 | 230 | } |
226 | 231 | |
227 | -function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { | |
228 | - | |
229 | - if (PHP_VERSION < 6) { | |
230 | - $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; | |
231 | - } | |
232 | - | |
233 | - $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); | |
234 | - | |
235 | - switch ($theType) { | |
236 | - case "text": | |
237 | - $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; | |
238 | - break; | |
239 | - case "long": | |
240 | - case "int": | |
241 | - $theValue = ($theValue != "") ? intval($theValue) : "NULL"; | |
242 | - break; | |
243 | - case "double": | |
244 | - $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; | |
245 | - break; | |
246 | - case "date": | |
247 | - $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; | |
248 | - break; | |
249 | - case "defined": | |
250 | - $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; | |
251 | - break; | |
252 | - } | |
253 | - | |
254 | - return $theValue; | |
232 | +function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") | |
233 | +{ | |
234 | + if (PHP_VERSION < 6) | |
235 | + { | |
236 | + $theValue = get_magic_quotes_gpc () ? stripslashes ($theValue) : $theValue; | |
237 | + } | |
238 | + | |
239 | + $theValue = function_exists ("mysql_real_escape_string") ? mysql_real_escape_string ($theValue) : mysql_escape_string ($theValue); | |
240 | + | |
241 | + switch ($theType) | |
242 | + { | |
243 | + case "text" : | |
244 | + $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; | |
245 | + break; | |
246 | + case "long" : | |
247 | + case "int" : | |
248 | + $theValue = ($theValue != "") ? intval ($theValue) : "NULL"; | |
249 | + break; | |
250 | + case "double" : | |
251 | + $theValue = ($theValue != "") ? doubleval ($theValue) : "NULL"; | |
252 | + break; | |
253 | + case "date" : | |
254 | + $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; | |
255 | + break; | |
256 | + case "defined" : | |
257 | + $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; | |
258 | + break; | |
259 | + } | |
260 | + | |
261 | + return $theValue; | |
255 | 262 | } |
256 | 263 | |
257 | -function generate_password($number) { | |
258 | - | |
264 | +function generate_password ($number) | |
265 | +{ | |
259 | 266 | $arr = array('a','b','c','d','e','f', |
260 | - 'g','h','i','j','k','l', | |
261 | - 'm','n','o','p','r','s', | |
262 | - 't','u','v','x','y','z', | |
263 | - 'A','B','C','D','E','F', | |
264 | - 'G','H','I','J','K','L', | |
265 | - 'M','N','O','P','R','S', | |
266 | - 'T','U','V','X','Y','Z', | |
267 | - '1','2','3','4','5','6', | |
268 | - '7','8','9','0'); | |
267 | + 'g','h','i','j','k','l', | |
268 | + 'm','n','o','p','r','s', | |
269 | + 't','u','v','x','y','z', | |
270 | + 'A','B','C','D','E','F', | |
271 | + 'G','H','I','J','K','L', | |
272 | + 'M','N','O','P','R','S', | |
273 | + 'T','U','V','X','Y','Z', | |
274 | + '1','2','3','4','5','6', | |
275 | + '7','8','9','0'); | |
269 | 276 | // Ãåíåðèðóåì ïàðîëü |
270 | 277 | $pass = ""; |
271 | - for($i = 0; $i < $number; $i++) { | |
272 | - // Âû÷èñëÿåì ñëó÷àéíûé èíäåêñ ìàññèâà | |
273 | - $index = rand(0, count($arr) - 1); | |
274 | - $pass .= $arr[$index]; | |
278 | + for ($i = 0; $i < $number; $i++) | |
279 | + { | |
280 | + // Âû÷èñëÿåì ñëó÷àéíûé èíäåêñ ìàññèâà | |
281 | + $index = rand(0, count($arr) - 1); | |
282 | + $pass .= $arr[$index]; | |
275 | 283 | } |
276 | - return $pass; | |
277 | -} | |
278 | - | |
279 | - | |
280 | -// ========================= Pager GET ============================= | |
281 | 284 | |
282 | - | |
283 | -function pagerGetRun($pager, $PerPage='', $Size=''){ | |
284 | - | |
285 | - | |
286 | - global $url; | |
287 | - if ($PerPage!='') {$pager['PerPage']=$PerPage;} | |
288 | - if ($Size!='') {$pager['Size']=$Size;} | |
289 | - | |
290 | - $result=mysql_query($pager['sql']) or die (mysql_error()); | |
291 | - $pager['TotalRows']=mysql_affected_rows(); | |
292 | - $pager['All10']=ceil($pager['TotalRows']/($pager['PerPage']*$pager['Size'])); # êîë. âñåõ ñòðàíèö ïî 10 øò. *** | |
293 | - $pager['AllPages']=ceil($pager['TotalRows']/$pager['PerPage']); # êîë. ñòðàíèö *** | |
294 | - $pager['ActivePage']=1; # àêòèâíàÿ ñòðàíèöà *** | |
295 | - if (isset($_GET['page'])) { $pager['ActivePage']=$_GET['page'];} | |
296 | - $pager['Active10']=ceil($pager['ActivePage']/$pager['Size']); | |
297 | - | |
298 | - $pager['sql'].=" LIMIT ".($pager['ActivePage']-1)*$pager['PerPage'].", ".$pager['PerPage']; | |
299 | - return $pager; | |
300 | - | |
285 | + return $pass; | |
301 | 286 | } |
302 | 287 | |
303 | -function pagerGetShow($pager) { | |
304 | - | |
305 | - if ($pager['AllPages']!=1) { | |
306 | - | |
307 | - echo '<div class="pager">'; | |
308 | - | |
309 | - // ======= Íà÷àëî | |
310 | - | |
311 | - if ($pager['ActivePage']>$pager['Size']) { | |
312 | - // Àêòèâíî | |
313 | - echo "<a href=".urlQueryChange("page",1)." class='begin-active'>Íà÷àëî</a> "; | |
314 | - echo "<a href=".urlQueryChange("page",(($pager['Active10']-1)*$pager['Size']))." class='prev-active'>".(($pager['Active10']-2)*$pager['Size'])."...".(($pager['Active10']-1)*$pager['Size'])."</a> "; | |
315 | - | |
316 | - // Íåàêòèâíî | |
317 | - } else { | |
318 | - echo "<a class='begin'>Íà÷àëî</a> "; | |
288 | +// =============== | |
289 | +// ==== Pager ==== | |
290 | +// =============== | |
319 | 291 | |
320 | - } | |
292 | +function pagerGetRun ($pager, $PerPage = '', $Size = '') | |
293 | +{ | |
294 | + global $url; | |
295 | + if ($PerPage != '') | |
296 | + { | |
297 | + $pager['PerPage'] = $PerPage; | |
298 | + } | |
299 | + if ($Size != '') | |
300 | + { | |
301 | + $pager['Size'] = $Size; | |
302 | + } | |
321 | 303 | |
322 | - // ======= Ñåðåäèíà | |
323 | - | |
324 | - // Åñëè íå ïîñëåäíèé ðÿä âûâîäà | |
325 | - | |
326 | - if ($pager['All10']>$pager['Active10']) { | |
327 | - | |
328 | - for ($i=($pager['Active10']-1)*$pager['Size']+1; $i<=$pager['Active10']*$pager['Size']; $i++) | |
329 | - | |
330 | - if ($i==$pager['ActivePage']) { | |
331 | - echo "<a class='numbers-active'>".$i."</a> "; | |
332 | - } else { | |
333 | - echo "<a href=".urlQueryChange("page",$i)." class='numbers'>".$i."</a> "; | |
334 | - } | |
335 | - | |
336 | - // Åñëè ïîñëåäíèé ðÿä âûâîäà | |
337 | - | |
338 | - } else { | |
339 | - | |
340 | - for ($i=($pager['Active10']-1)*$pager['Size']+1; $i<=$pager['AllPages']; $i++) | |
341 | - | |
342 | - if ($i==$pager['ActivePage']) { | |
343 | - echo "<a class='numbers-active'>".$i."</a> "; | |
344 | - } else { | |
345 | - echo "<a href=".urlQueryChange("page",$i)." class='numbers'>".$i."</a> "; | |
346 | - } | |
347 | - } | |
348 | - | |
349 | - // ======= Êîíåö | |
350 | - | |
351 | - // 50...60 | |
352 | - if ((($pager['All10']-$pager['Active10'])>=1) && ($pager['All10']!=$pager['Active10']+1)) { | |
353 | - echo "<a href='".urlQueryChange("page",($pager['Active10']*$pager['Size'])+1)."' class='next-active'>".($pager['Active10']*$pager['Size']+1)."...".(($pager['Active10']+1)*$pager['Size'])."</a> "; | |
354 | - echo "<a href=".urlQueryChange("page",$pager['AllPages'])." class='end-active'>Êîíåö</a>"; | |
355 | - } | |
356 | - // 50...58 | |
357 | - if ((($pager['All10']-$pager['Active10'])>=1) && ($pager['All10']==$pager['Active10']+1)) { | |
358 | - echo "<a href='".urlQueryChange("page",($pager['Active10']*$pager['Size'])+1)."' class='next-active'>".($pager['Active10']*$pager['Size']+1)."...".$pager['AllPages']."</a> "; | |
359 | - echo "<a href=".urlQueryChange("page",$pager['AllPages'])." class='end-active'>Êîíåö</a>"; | |
360 | - } | |
361 | - | |
362 | - if ($pager['Active10']==$pager['All10']) { echo "<a class='end'>Êîíåö</a>"; } | |
363 | - | |
364 | - | |
365 | - echo '</div>'; | |
366 | - } | |
367 | - | |
368 | -} | |
369 | - | |
370 | - | |
371 | -function urlQueryChange ($what, $for) { | |
372 | - | |
373 | - $url=$_SERVER['REQUEST_URI']; | |
304 | + $result = mysql_query ($pager['sql']) or die (mysql_error ()); | |
305 | + $pager['TotalRows'] = mysql_affected_rows (); | |
306 | + $pager['All10'] = ceil ($pager['TotalRows'] / ($pager['PerPage'] * $pager['Size'])); // êîë. âñåõ ñòðàíèö ïî 10 øò. *** | |
307 | + $pager['AllPages'] = ceil ($pager['TotalRows'] / $pager['PerPage']); // êîë. ñòðàíèö *** | |
308 | + $pager['ActivePage'] = 1; // àêòèâíàÿ ñòðàíèöà *** | |
374 | 309 | |
375 | - if (!isset($_SERVER['QUERY_STRING']) || isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']=='') { | |
310 | + if (isset ($_GET['page'])) | |
311 | + { | |
312 | + $pager['ActivePage'] = $_GET['page']; | |
313 | + } | |
376 | 314 | |
377 | - $url.="?".$what."=1"; | |
315 | + $pager['Active10'] = ceil ($pager['ActivePage'] / $pager['Size']); | |
378 | 316 | |
379 | - } else { | |
380 | - | |
381 | - if (!isset($_GET['page']) or $_GET['page']==1) {$url.="&".$what."=1";} | |
317 | + $pager['sql'] .= " LIMIT " . ($pager['ActivePage'] - 1) * $pager['PerPage'] . ", " . $pager['PerPage']; | |
318 | + return $pager; | |
319 | +} | |
382 | 320 | |
321 | +function pagerGetShow ($pager) | |
322 | +{ | |
323 | + if ($pager['AllPages'] != 1) | |
324 | + { | |
325 | + | |
326 | + echo '<div class="pager">'; | |
327 | + | |
328 | + // ==== Íà÷àëî ==== | |
329 | + | |
330 | + if ($pager['ActivePage'] > $pager['Size']) | |
331 | + { | |
332 | + // Àêòèâíî | |
333 | + echo "<a href=" . urlQueryChange ("page", 1) . " class='begin-active'>Íà÷àëî</a> "; | |
334 | + echo "<a href=" . urlQueryChange ("page", (($pager['Active10'] - 1) * $pager['Size'])) . " class='prev-active'>" . (($pager['Active10'] - 2) * $pager['Size']) . "..." . (($pager['Active10'] - 1) * $pager['Size']) . "</a> "; | |
335 | + | |
336 | + // Íåàêòèâíî | |
337 | + } | |
338 | + else | |
339 | + { | |
340 | + echo "<a class='begin'>Íà÷àëî</a> "; | |
341 | + } | |
342 | + | |
343 | + // ==== Ñåðåäèíà ==== | |
344 | + | |
345 | + // Åñëè íå ïîñëåäíèé ðÿä âûâîäà | |
346 | + | |
347 | + if ($pager['All10'] > $pager['Active10']) | |
348 | + { | |
349 | + | |
350 | + for ($i = ($pager['Active10'] - 1) * $pager['Size'] + 1; $i <= $pager['Active10'] * $pager['Size']; $i ++) | |
351 | + | |
352 | + if ($i == $pager['ActivePage']) | |
353 | + { | |
354 | + echo "<a class='numbers-active'>" . $i . "</a> "; | |
355 | + } | |
356 | + else | |
357 | + { | |
358 | + echo "<a href=" . urlQueryChange ("page", $i) . " class='numbers'>" . $i . "</a> "; | |
359 | + } | |
360 | + | |
361 | + // Åñëè ïîñëåäíèé ðÿä âûâîäà | |
362 | + } | |
363 | + else | |
364 | + { | |
365 | + | |
366 | + for ($i = ($pager['Active10'] - 1) * $pager['Size'] + 1; $i <= $pager['AllPages']; $i ++) | |
367 | + | |
368 | + if ($i == $pager['ActivePage']) | |
369 | + { | |
370 | + echo "<a class='numbers-active'>" . $i . "</a> "; | |
371 | + } | |
372 | + else | |
373 | + { | |
374 | + echo "<a href=" . urlQueryChange ("page", $i) . " class='numbers'>" . $i . "</a> "; | |
375 | + } | |
376 | + } | |
377 | + | |
378 | + // ==== Êîíåö ==== | |
379 | + | |
380 | + // 50...60 | |
381 | + if ((($pager['All10'] - $pager['Active10']) >= 1) && ($pager['All10'] != $pager['Active10'] + 1)) | |
382 | + { | |
383 | + echo "<a href='" . urlQueryChange ("page", ($pager['Active10'] * $pager['Size']) + 1) . "' class='next-active'>" . ($pager['Active10'] * $pager['Size'] + 1) . "..." . (($pager['Active10'] + 1) * $pager['Size']) . "</a> "; | |
384 | + echo "<a href=" . urlQueryChange ("page", $pager['AllPages']) . " class='end-active'>Êîíåö</a>"; | |
385 | + } | |
386 | + // 50...58 | |
387 | + if ((($pager['All10'] - $pager['Active10']) >= 1) && ($pager['All10'] == $pager['Active10'] + 1)) | |
388 | + { | |
389 | + echo "<a href='" . urlQueryChange ("page", ($pager['Active10'] * $pager['Size']) + 1) . "' class='next-active'>" . ($pager['Active10'] * $pager['Size'] + 1) . "..." . $pager['AllPages'] . "</a> "; | |
390 | + echo "<a href=" . urlQueryChange ("page", $pager['AllPages']) . " class='end-active'>Êîíåö</a>"; | |
391 | + } | |
392 | + | |
393 | + if ($pager['Active10'] == $pager['All10']) | |
394 | + { | |
395 | + echo "<a class='end'>Êîíåö</a>"; | |
396 | + } | |
397 | + | |
398 | + echo '</div>'; | |
383 | 399 | } |
384 | - | |
385 | - //if (empty($_GET['page'])) return $url.="&".$what."=".$for; | |
386 | - | |
387 | - //print_r($_GET); | |
388 | - | |
389 | - preg_match ("/$what=(.+)/",$url, $xbefore); $before= preg_replace ('/\&.*/','', $xbefore[1]); | |
390 | - $result = str_replace("$what=$before", "$what=$for", $url); | |
391 | - return $result; | |
392 | 400 | } |
393 | 401 | |
394 | -// ================================================================== | |
395 | - | |
402 | +function urlQueryChange ($what, $for) | |
403 | +{ | |
404 | + $url = $_SERVER['REQUEST_URI']; | |
405 | + | |
406 | + if (! isset ($_SERVER['QUERY_STRING']) || isset ($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] == '') | |
407 | + { | |
408 | + | |
409 | + $url .= "?" . $what . "=1"; | |
410 | + } | |
411 | + else | |
412 | + { | |
413 | + | |
414 | + if (! isset ($_GET['page']) or $_GET['page'] == 1) | |
415 | + { | |
416 | + $url .= "&" . $what . "=1"; | |
417 | + } | |
418 | + } | |
419 | + | |
420 | + // if (empty($_GET['page'])) return $url.="&".$what."=".$for; | |
421 | + | |
422 | + // print_r($_GET); | |
423 | + | |
424 | + preg_match ("/$what=(.+)/", $url, $xbefore); | |
425 | + $before = preg_replace ('/\&.*/', '', $xbefore[1]); | |
426 | + $result = str_replace ("$what=$before", "$what=$for", $url); | |
427 | + return $result; | |
428 | +} | |
396 | 429 | |
397 | -function viewBook($table, $value, $what, $title="title") { | |
430 | +// ============== | |
431 | +// ==== VIEW ==== | |
432 | +// ============== | |
398 | 433 | |
399 | - $sql="SELECT `$title` FROM $table WHERE $what='$value' "; | |
400 | - $result = mysql_query($sql) or die(mysql_error()); | |
401 | - $row = mysql_fetch_assoc($result); | |
402 | - | |
403 | - return $row[$title]; | |
404 | - | |
434 | +function viewBook ($table, $value, $what, $title = "title") | |
435 | +{ | |
436 | + $sql = "SELECT `$title` FROM $table WHERE $what='$value' "; | |
437 | + $result = mysql_query ($sql) or die (mysql_error ()); | |
438 | + $row = mysql_fetch_assoc ($result); | |
439 | + | |
440 | + return $row[$title]; | |
405 | 441 | } |
406 | - | |
407 | -function viewBookSelectValue($table, $field, $value_title='title', $default='' ) { | |
408 | 442 | |
409 | - $sql="SELECT $field,$value_title FROM $table"; | |
410 | - $result = mysql_query($sql) or die(mysql_error()); | |
411 | - while ($row = mysql_fetch_assoc($result)) { | |
412 | - if ($default!='') { | |
413 | - if ($row[$field]==$default) { | |
414 | - echo "<option value=\"".$row[$field]."\" selected>".$row[$value_title]."</option>"; | |
415 | - } else { echo "<option value=\"".$row[$field]."\">".$row[$value_title]."</option>"; | |
416 | - } | |
417 | - } else { | |
418 | - echo "<option value=\"".$row[$field]."\">".$row[$value_title]."</option>"; | |
419 | - } | |
420 | - } | |
443 | +function viewBookSelectValue ($table, $field, $value_title = 'title', $default = '') | |
444 | +{ | |
445 | + $sql = "SELECT $field,$value_title FROM $table"; | |
446 | + $result = mysql_query ($sql) or die (mysql_error ()); | |
447 | + while ($row = mysql_fetch_assoc ($result)) | |
448 | + { | |
449 | + if ($default != '') | |
450 | + { | |
451 | + if ($row[$field] == $default) | |
452 | + { | |
453 | + echo "<option value=\"" . $row[$field] . "\" selected>" . $row[$value_title] . "</option>"; | |
454 | + } | |
455 | + else | |
456 | + { | |
457 | + echo "<option value=\"" . $row[$field] . "\">" . $row[$value_title] . "</option>"; | |
458 | + } | |
459 | + } | |
460 | + else | |
461 | + { | |
462 | + echo "<option value=\"" . $row[$field] . "\">" . $row[$value_title] . "</option>"; | |
463 | + } | |
464 | + } | |
421 | 465 | } |
422 | 466 | |
423 | -function urlQueryChange2 ($what, $for, $url='') { | |
424 | - | |
425 | - if ($url=='') { | |
426 | - | |
427 | - $url=$_SERVER['REQUEST_URI']; | |
428 | - | |
429 | - if (!isset($_SERVER['QUERY_STRING']) || isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']=='') { | |
430 | - | |
431 | - $url.='?'.$what."=1"; | |
467 | +function urlQueryChange2 ($what, $for, $url = '') | |
468 | +{ | |
469 | + if ($url == '') | |
470 | + { | |
432 | 471 | |
433 | - } else { | |
472 | + $url = $_SERVER['REQUEST_URI']; | |
434 | 473 | |
435 | - if (!isset($_GET[$what])) { $url.='&'.$what."=1"; } | |
436 | - | |
437 | - } | |
474 | + if (! isset ($_SERVER['QUERY_STRING']) || isset ($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] == '') | |
475 | + { | |
476 | + | |
477 | + $url .= '?' . $what . "=1"; | |
478 | + } | |
479 | + else | |
480 | + { | |
481 | + | |
482 | + if (! isset ($_GET[$what])) | |
483 | + { | |
484 | + $url .= '&' . $what . "=1"; | |
485 | + } | |
486 | + } | |
487 | + } | |
488 | + else | |
489 | + { | |
438 | 490 | |
439 | - } else { | |
440 | - | |
441 | - if (!isset($_GET[$what])) { $url.='&'.$what."=1"; } | |
491 | + if (! isset ($_GET[$what])) | |
492 | + { | |
493 | + $url .= '&' . $what . "=1"; | |
494 | + } | |
442 | 495 | } |
443 | 496 | |
444 | 497 | // $url=preg_replace ('/st.*/','', $url); |
445 | - preg_match ("/$what=(.+)/",$url, $xbefore); $before= preg_replace ('/\&.*/','', $xbefore[1]); | |
446 | - $result = str_replace("$what=$before", "$what=$for", $url); | |
498 | + preg_match ("/$what=(.+)/", $url, $xbefore); | |
499 | + $before = preg_replace ('/\&.*/', '', $xbefore[1]); | |
500 | + $result = str_replace ("$what=$before", "$what=$for", $url); | |
447 | 501 | return $result; |
448 | 502 | } |
449 | 503 | |
450 | -function ChangesOfMass ($a, $b){ | |
451 | - | |
452 | - $mass=''; | |
453 | - | |
454 | - foreach($a as $key=>$value) { | |
455 | - if ($value!=NULL) { | |
456 | - if (in_array($value,$b)) { | |
457 | - $mass['same'][]=$value; | |
458 | - } else { | |
459 | - $mass['add'][]=$value; | |
504 | +function ChangesOfMass ($a, $b) | |
505 | +{ | |
506 | + $mass = ''; | |
507 | + | |
508 | + foreach ($a as $key => $value) | |
509 | + { | |
510 | + if ($value != NULL) | |
511 | + { | |
512 | + if (in_array ($value, $b)) | |
513 | + { | |
514 | + $mass['same'][] = $value; | |
515 | + } | |
516 | + else | |
517 | + { | |
518 | + $mass['add'][] = $value; | |
460 | 519 | } |
461 | 520 | } |
462 | 521 | } |
463 | 522 | |
464 | - foreach($b as $key=>$value) { | |
465 | - if ($value!=NULL) { | |
466 | - if (in_array($value,$a)) { | |
467 | - | |
468 | - } else { | |
469 | - $mass['del'][]=$value; | |
523 | + foreach ($b as $key => $value) | |
524 | + { | |
525 | + if ($value != NULL) | |
526 | + { | |
527 | + if (in_array ($value, $a)) | |
528 | + { | |
529 | + } | |
530 | + else | |
531 | + { | |
532 | + $mass['del'][] = $value; | |
470 | 533 | } |
471 | 534 | } |
472 | - } | |
473 | - | |
474 | - return $mass; | |
535 | + } | |
536 | + | |
537 | + return $mass; | |
475 | 538 | } |
476 | 539 | |
477 | -function GoBack($back=''){ | |
478 | - | |
479 | - global $_SESSION; $url=$_SERVER['REQUEST_URI']; | |
480 | - if (!isset($_SESSION['data']['GoBack'])) {$_SESSION['data']['GoBack']=array("/","/","/");} | |
481 | - if ($_SESSION['data']['GoBack'][0]!=$url) { | |
482 | - array_unshift($_SESSION['data']['GoBack'],$url); | |
483 | - unset($_SESSION['data']['GoBack'][3]); | |
540 | +function GoBack ($back = '') | |
541 | +{ | |
542 | + global $_SESSION; | |
543 | + $url = $_SERVER['REQUEST_URI']; | |
544 | + if (! isset ($_SESSION['data']['GoBack'])) | |
545 | + { | |
546 | + $_SESSION['data']['GoBack'] = array ( | |
547 | + "/", | |
548 | + "/", | |
549 | + "/" | |
550 | + ); | |
551 | + } | |
552 | + if ($_SESSION['data']['GoBack'][0] != $url) | |
553 | + { | |
554 | + array_unshift ($_SESSION['data']['GoBack'], $url); | |
555 | + unset ($_SESSION['data']['GoBack'][3]); | |
484 | 556 | } |
485 | 557 | |
486 | - if ($back!='') { | |
487 | - | |
488 | - echo "<script language=\"JavaScript\">{ location.href=\"".$_SESSION['data']['GoBack'][$back]."\"; self.focus(); } </script>"; | |
489 | - | |
558 | + if ($back != '') | |
559 | + { | |
560 | + | |
561 | + echo "<script language=\"JavaScript\">{ location.href=\"" . $_SESSION['data']['GoBack'][$back] . "\"; self.focus(); } </script>"; | |
490 | 562 | } |
491 | 563 | |
492 | - //print_r($_SESSION['data']['GoBack']); | |
564 | + // print_r($_SESSION['data']['GoBack']); | |
493 | 565 | } |
494 | 566 | |
495 | - function AuthorizationUser($post) { | |
496 | - | |
497 | - if (isset($post)) { | |
498 | - | |
499 | - $sql = "SELECT u.*, u.id as user_id FROM zlo_users as u | |
500 | - WHERE u.email='".htmlspecialchars($post['form']['login'],ENT_QUOTES)."' AND u.pass='".htmlspecialchars($post['form']['pass'],ENT_QUOTES)."' "; | |
501 | - $result = mysql_query($sql) or die(mysql_error()); | |
502 | - if (mysql_affected_rows()!=0) { | |
503 | - | |
504 | - $row=mysql_fetch_assoc($result); | |
567 | +function AuthorizationUser ($post) | |
568 | +{ | |
569 | + if (isset ($post)) | |
570 | + { | |
571 | + | |
572 | + $sql = "SELECT u.*, u.id as user_id FROM zlo_users as u | |
573 | + WHERE u.email='" . htmlspecialchars ($post['form']['login'], ENT_QUOTES) . "' AND u.pass='" . htmlspecialchars ($post['form']['pass'], ENT_QUOTES) . "' "; | |
574 | + $result = mysql_query ($sql) or die (mysql_error ()); | |
575 | + if (mysql_affected_rows () != 0) | |
576 | + { | |
577 | + | |
578 | + $row = mysql_fetch_assoc ($result); | |
505 | 579 | |
506 | 580 | // ===== Îòìå÷àåì äàòó âõîäà ===== |
507 | - $sql2="SELECT * FROM zlo_users_in_out WHERE user_id=".$row['id']." "; | |
508 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
509 | - if (mysql_affected_rows()!=0) { | |
581 | + $sql2 = "SELECT * FROM zlo_users_in_out WHERE user_id=" . $row['id'] . " "; | |
582 | + $result2 = mysql_query ($sql2) or die (mysql_error ()); | |
583 | + if (mysql_affected_rows () != 0) | |
584 | + { | |
510 | 585 | // îáíîâëÿåì |
511 | - $sql2="UPDATE zlo_users_in_out SET `in`=NOW() WHERE user_id=".$row['id']." "; | |
512 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
513 | - } else { | |
586 | + $sql2 = "UPDATE zlo_users_in_out SET `in`=NOW() WHERE user_id=" . $row['id'] . " "; | |
587 | + $result2 = mysql_query ($sql2) or die (mysql_error ()); | |
588 | + } | |
589 | + else | |
590 | + { | |
514 | 591 | // äîáàâëÿåì |
515 | - $sql2="INSERT INTO zlo_users_in_out (user_id,`in`) VALUES (".$row['id'].",NOW())"; | |
516 | - $result2 = mysql_query($sql2) or die(mysql_error()); | |
517 | - | |
592 | + $sql2 = "INSERT INTO zlo_users_in_out (user_id,`in`) VALUES (" . $row['id'] . ",NOW())"; | |
593 | + $result2 = mysql_query ($sql2) or die (mysql_error ()); | |
594 | + | |
518 | 595 | // =================== |
519 | 596 | // === ïðèâåäñòâèå === |
520 | 597 | // =================== |
521 | - | |
522 | - $message=''; | |
523 | - $message[0]='Ðåãèñòðàöèîííîå ñîãëàøåíèå'; | |
524 | - $message[1]='\n\r\n\rÏðàâà è îáÿçàííîñòè'; | |
525 | - $message[2]='\n\r\n\rÀäìèíèñòðàöèÿ ñàéòà ãàðàíòèðóåò, ÷òî äàííûå, êîòîðûå ïîëüçîâàòåëü óêàçûâàåò ïðè ðåãèñòðàöèè íà ñàéòå, à òàêæå ïðè äàëüíåéøåì èñïîëüçîâàíèè ëè÷íîãî êàáèíåòà, íå ïåðåäàþòñÿ òðåòüèì ëèöàì, à èñïîëüçóþòñÿ ëèøü äëÿ óäîáñòâà ïîëüçîâàòåëåé ïðè ïîêóïêå è âûáîðå òîâàðîâ íà ñàéòå extremstyle.ua. Äàííàÿ ðåãèñòðàöèÿ ñîîòâåòñòâóåò äåéñòâóþùåìó çàêîíîäàòåëüñòâó Óêðàèíû î íåïðèêîñíîâåííîñòè ëè÷íîé èíôîðìàöèè.'; | |
526 | - $message[3]='\n\r\n\rÀäìèíèñòðàöèÿ ñàéòà îñòàâëÿåò çà ñîáîé ïðàâî âíîñèòü èçìåíåíèÿ â öåíû íà òîâàðû è àññîðòèìåíò, à òàêæå ìåíÿòü ëþáóþ èíôîðìàöèþ, ðàçìåùåííóþ íà ñàéòå. Àäìèíèñòðàöèÿ ñàéòà íå ãàðàíòèðóåò òî÷íîñòè â ïåðåäà÷å öâåòîâ òîâàðîâ, ïîëíîòó è 100% êîððåêòíîñòü èíôîðìàöèè.'; | |
527 | - $message[4]='\n\r\n\rÏðàâà è îáÿçàííîñòè ïîëüçîâàòåëÿ'; | |
528 | - $message[5]='\n\r\n\rÐåãèñòðèðóÿñü íà ñàéòå extremstyle.ua, âû ïîëó÷àåòå âîçìîæíîñòü èñïîëüçîâàòü âñå ïðåèìóùåñòâà ëè÷íîãî êàáèíåòà.  ñëó÷àå óòåðè ïàðîëÿ, extremstyle.ua âîññòàíàâëèâàåò åãî è ïåðåñûëàåò íà ýëåêòðîííûé ÿùèê, óêàçàííûé âàìè ïðè ðåãèñòðàöèè.'; | |
529 | - $message[6]='\n\r\n\rÂñå ìàòåðèàëû ñàéòà extremstyle.ua ìîãóò áûòü èñïîëüçîâàíû òîëüêî äëÿ ëè÷íûõ íåêîììåð÷åñêèõ öåëåé. Çàïðåùåíî èñïîëüçîâàòü èíôîðìàöèþ è ôîòîãðàôèè ñàéòà extremstyle.ua â ëþáûõ êîììåð÷åñêèõ èëè îáùåñòâåííûõ öåëÿõ, â ëþáûõ ïå÷àòíûõ è ýëåêòðîííûõ ñðåäñòâàõ ìàññîâîé èíôîðìàöèè áåç ïèñüìåííîãî ðàçðåøåíèÿ Àäìèíèñòðàöèè ñàéòà.'; | |
530 | - $message[7]='\n\r\n\rÐåãèñòðèðóÿñü íà ñàéòå èíòåðíåò-ìàãàçèíà extremstyle.ua, âû ñîãëàøàåòåñü ñ äàííûìè óñëîâèÿìè.'; | |
531 | 598 | |
532 | - $_SESSION['alert']['message']=implode(" ", $message); | |
533 | - | |
534 | - echo '<script>alert("'.$_SESSION['alert']['message'].'"); </script>'; | |
535 | - unset($_SESSION['alert']['message']); | |
599 | + $message = ''; | |
600 | + $message[0] = 'Ðåãèñòðàöèîííîå ñîãëàøåíèå'; | |
601 | + $message[1] = '\n\r\n\rÏðàâà è îáÿçàííîñòè'; | |
602 | + $message[2] = '\n\r\n\rÀäìèíèñòðàöèÿ ñàéòà ãàðàíòèðóåò, ÷òî äàííûå, êîòîðûå ïîëüçîâàòåëü óêàçûâàåò ïðè ðåãèñòðàöèè íà ñàéòå, à òàêæå ïðè äàëüíåéøåì èñïîëüçîâàíèè ëè÷íîãî êàáèíåòà, íå ïåðåäàþòñÿ òðåòüèì ëèöàì, à èñïîëüçóþòñÿ ëèøü äëÿ óäîáñòâà ïîëüçîâàòåëåé ïðè ïîêóïêå è âûáîðå òîâàðîâ íà ñàéòå extremstyle.ua. Äàííàÿ ðåãèñòðàöèÿ ñîîòâåòñòâóåò äåéñòâóþùåìó çàêîíîäàòåëüñòâó Óêðàèíû î íåïðèêîñíîâåííîñòè ëè÷íîé èíôîðìàöèè.'; | |
603 | + $message[3] = '\n\r\n\rÀäìèíèñòðàöèÿ ñàéòà îñòàâëÿåò çà ñîáîé ïðàâî âíîñèòü èçìåíåíèÿ â öåíû íà òîâàðû è àññîðòèìåíò, à òàêæå ìåíÿòü ëþáóþ èíôîðìàöèþ, ðàçìåùåííóþ íà ñàéòå. Àäìèíèñòðàöèÿ ñàéòà íå ãàðàíòèðóåò òî÷íîñòè â ïåðåäà÷å öâåòîâ òîâàðîâ, ïîëíîòó è 100% êîððåêòíîñòü èíôîðìàöèè.'; | |
604 | + $message[4] = '\n\r\n\rÏðàâà è îáÿçàííîñòè ïîëüçîâàòåëÿ'; | |
605 | + $message[5] = '\n\r\n\rÐåãèñòðèðóÿñü íà ñàéòå extremstyle.ua, âû ïîëó÷àåòå âîçìîæíîñòü èñïîëüçîâàòü âñå ïðåèìóùåñòâà ëè÷íîãî êàáèíåòà.  ñëó÷àå óòåðè ïàðîëÿ, extremstyle.ua âîññòàíàâëèâàåò åãî è ïåðåñûëàåò íà ýëåêòðîííûé ÿùèê, óêàçàííûé âàìè ïðè ðåãèñòðàöèè.'; | |
606 | + $message[6] = '\n\r\n\rÂñå ìàòåðèàëû ñàéòà extremstyle.ua ìîãóò áûòü èñïîëüçîâàíû òîëüêî äëÿ ëè÷íûõ íåêîììåð÷åñêèõ öåëåé. Çàïðåùåíî èñïîëüçîâàòü èíôîðìàöèþ è ôîòîãðàôèè ñàéòà extremstyle.ua â ëþáûõ êîììåð÷åñêèõ èëè îáùåñòâåííûõ öåëÿõ, â ëþáûõ ïå÷àòíûõ è ýëåêòðîííûõ ñðåäñòâàõ ìàññîâîé èíôîðìàöèè áåç ïèñüìåííîãî ðàçðåøåíèÿ Àäìèíèñòðàöèè ñàéòà.'; | |
607 | + $message[7] = '\n\r\n\rÐåãèñòðèðóÿñü íà ñàéòå èíòåðíåò-ìàãàçèíà extremstyle.ua, âû ñîãëàøàåòåñü ñ äàííûìè óñëîâèÿìè.'; | |
608 | + | |
609 | + $_SESSION['alert']['message'] = implode (" ", $message); | |
610 | + | |
611 | + echo '<script>alert("' . $_SESSION['alert']['message'] . '"); </script>'; | |
612 | + unset ($_SESSION['alert']['message']); | |
536 | 613 | } |
537 | 614 | |
538 | - $_SESSION['user']['id'] =$row['user_id']; | |
539 | - $_SESSION['user']['login'] =$row['username']; | |
540 | - $_SESSION['user']['pass'] =$row['pass']; | |
541 | - $_SESSION['user']['name'] =$row['username']; | |
542 | - $_SESSION['user']['email'] =$row['email']; | |
543 | - $_SESSION['user']['tel'] =$row['tel']; | |
544 | - $_SESSION['user']['tel2'] =$row['tel2']; | |
545 | - $_SESSION['user']['address']=$row['address']; | |
546 | - $_SESSION['user']['city'] =$row['city']; | |
615 | + $_SESSION['user']['id'] = $row['user_id']; | |
616 | + $_SESSION['user']['login'] = $row['username']; | |
617 | + $_SESSION['user']['pass'] = $row['pass']; | |
618 | + $_SESSION['user']['name'] = $row['username']; | |
619 | + $_SESSION['user']['email'] = $row['email']; | |
620 | + $_SESSION['user']['tel'] = $row['tel']; | |
621 | + $_SESSION['user']['tel2'] = $row['tel2']; | |
622 | + $_SESSION['user']['address'] = $row['address']; | |
623 | + $_SESSION['user']['city'] = $row['city']; | |
547 | 624 | |
548 | 625 | // ======================= |
549 | 626 | // === íîâûå ñîîáùåíèè === |
550 | 627 | // ======================= |
551 | 628 | |
552 | - $message=''; | |
629 | + $message = ''; | |
553 | 630 | |
554 | 631 | // Ïîäñ÷åò íîâûõ ñîîáùåíèé |
555 | - $sql = "SELECT id FROM zlo_users_message WHERE `status`=3 AND `to`='".$_SESSION['user']['id']."'"; | |
556 | - $result = mysql_query($sql) or die(mysql_error()); | |
557 | - $total_messages=mysql_affected_rows(); | |
558 | - if ($total_messages!=0) { | |
559 | - $message="Ó âàñ åñòü íîâûå ñîîáùåíèÿ ($total_messages) "; | |
632 | + $sql = "SELECT id FROM zlo_users_message WHERE `status`=3 AND `to`='" . $_SESSION['user']['id'] . "'"; | |
633 | + $result = mysql_query ($sql) or die (mysql_error ()); | |
634 | + $total_messages = mysql_affected_rows (); | |
635 | + if ($total_messages != 0) | |
636 | + { | |
637 | + $message = "Ó âàñ åñòü íîâûå ñîîáùåíèÿ ($total_messages) "; | |
560 | 638 | } |
561 | - | |
562 | - | |
639 | + | |
563 | 640 | // ======================= |
564 | 641 | // ==== íîâûõ îïðîñîâ === |
565 | 642 | // ======================= |
566 | - | |
643 | + | |
567 | 644 | $sql = "SELECT a.id |
568 | 645 | FROM zlo_users_audience AS a |
569 | 646 | WHERE a.`date_end` > NOW( ) |
... | ... | @@ -571,19 +648,29 @@ function GoBack($back=''){ |
571 | 648 | AND a.id NOT IN ( |
572 | 649 | SELECT audience_id |
573 | 650 | FROM zlo_users_audience_answers AS w |
574 | - WHERE w.user_id ='".$_SESSION['user']['id']."')"; | |
575 | - $result = mysql_query($sql) or die(mysql_error()); | |
576 | - $total_audience=mysql_affected_rows(); | |
577 | - if ($total_audience!=0) { | |
578 | - $message.='\nÓ Âàñ åñòü íîâûå îïðîñû ('.$total_audience.')'; | |
651 | + WHERE w.user_id ='" . $_SESSION['user']['id'] . "')"; | |
652 | + $result = mysql_query ($sql) or die (mysql_error ()); | |
653 | + $total_audience = mysql_affected_rows (); | |
654 | + if ($total_audience != 0) | |
655 | + { | |
656 | + $message .= '\nÓ Âàñ åñòü íîâûå îïðîñû (' . $total_audience . ')'; | |
579 | 657 | } |
580 | 658 | |
581 | - if($message!='') { echo("<script>alert('$message')</script>"); } | |
582 | - | |
583 | - } else { echo ("<script>alert('Íå ïðàâèëüíûé ëîãèí èëè ïàðîëü')</script>");} | |
584 | - | |
585 | - } | |
586 | - | |
659 | + if ($message != '') | |
660 | + { | |
661 | + echo ("<script>alert('$message')</script>"); | |
662 | + } | |
663 | + } | |
664 | + else | |
665 | + { | |
666 | + echo ("<script>alert('Íå ïðàâèëüíûé ëîãèí èëè ïàðîëü')</script>"); | |
667 | + } | |
587 | 668 | } |
669 | +} | |
670 | + | |
671 | +function htmlMessage ($status, $text) | |
672 | +{ | |
673 | + return '<div class="alert '.$status.'"><div class="pic"></div><div class="info">'.$text.'</div></div>'; | |
674 | +} | |
588 | 675 | |
589 | 676 | ?> |
590 | 677 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + | |
3 | +// Подключение | |
4 | +include_once ($_SERVER['DOCUMENT_ROOT'] . "/config/config.php"); | |
5 | +include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); | |
6 | + | |
7 | +switch ($_REQUEST['jaction']) | |
8 | +{ | |
9 | + case 'tel-save': | |
10 | + | |
11 | + // имя поля | |
12 | + preg_match ('/^user\[(.+)\]/', $_GET['field'], $field); | |
13 | + $field = $field[1]; | |
14 | + | |
15 | + // находим заказ | |
16 | + $sql = ' | |
17 | + SELECT user_id | |
18 | + FROM `catalogs_orders` | |
19 | + WHERE id = '.(int)$_GET['order_id']; | |
20 | + $result = mysql_query($sql) or die(mysql_error()); | |
21 | + if (mysql_affected_rows() > 0) | |
22 | + { | |
23 | + $row = mysql_fetch_assoc ($result); | |
24 | + | |
25 | + // меняем заказ | |
26 | + $field_order = $field == 'tel' ? 'phone' : 'phonemob'; | |
27 | + | |
28 | + $sql = ' | |
29 | + UPDATE `catalogs_orders` | |
30 | + SET '.$field_order.' = "'.$_GET['value'].'" | |
31 | + WHERE id = '.(int)$_GET['order_id'].' | |
32 | + '; | |
33 | + $result = mysql_query($sql) or die(mysql_error()); | |
34 | + | |
35 | + // меняем пользователя | |
36 | + $sql = ' | |
37 | + UPDATE `zlo_users` | |
38 | + SET '.$field.' = "'.$_GET['value'].'" | |
39 | + WHERE id = '.(int)$row['user_id'].' | |
40 | + '; | |
41 | + $result = mysql_query($sql) or die(mysql_error()); | |
42 | + | |
43 | + echo json_encode (array ( | |
44 | + 'html' => htmlMessage ('success', 'Телефон успешно сохранен') | |
45 | + )); | |
46 | + } | |
47 | + else | |
48 | + { | |
49 | + echo json_encode (array ( | |
50 | + 'html' => htmlMessage ('error', 'Заказ не найден!') | |
51 | + )); | |
52 | + } | |
53 | + | |
54 | + break; | |
55 | +} | |
0 | 56 | \ No newline at end of file | ... | ... |
js/OrderContol.js
1 | +// ================== | |
2 | +// ==== function ==== | |
3 | +// ================== | |
4 | + | |
5 | + // =============== | |
6 | + // ==== ÎÁÙÅÅ ==== | |
7 | + // =============== | |
8 | + | |
9 | + function getUrlVars (name) | |
10 | + { | |
11 | + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | |
12 | + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
13 | + results = regex.exec(location.search); | |
14 | + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
15 | + } | |
1 | 16 | |
2 | - // ===================== | |
3 | - // ===== javascript ==== | |
4 | - // ===================== | |
17 | + function RemoveDiv(div) | |
18 | + { | |
19 | + if(typeof div== 'string') div=document.getElementById(div); | |
20 | + if(div && div.parentNode)div.parentNode.removeChild(div); | |
21 | + SumPerRow(); | |
22 | + | |
23 | + return false; | |
24 | + } | |
25 | + | |
26 | + function notify(url) | |
27 | + { | |
28 | + if (confirm("Âûñëàòü óâåäîìëåíèå?")) | |
29 | + { | |
30 | + document.location = url; | |
31 | + return true; | |
32 | + } | |
33 | + return false; | |
34 | + } | |
35 | + | |
36 | + function empty (mixed_var) { | |
37 | + if (mixed_var === "" || mixed_var === 0 || mixed_var === "0" || mixed_var === null || mixed_var === false || typeof mixed_var === 'undefined') { | |
38 | + return true; | |
39 | + } | |
40 | + } | |
5 | 41 | |
6 | - // ================================ | |
7 | - // ==== Íåîáõîäèìûå ïåðåìåííûå ==== | |
8 | - // ================================ | |
42 | + function isset(id) { | |
43 | + | |
44 | + if((document) && (document.getElementById(id))) { | |
45 | + return true; | |
46 | + } else { | |
47 | + return false; | |
48 | + } | |
49 | + | |
50 | + } | |
51 | + | |
52 | + // =============== | |
53 | + // ==== ÇÀÊÀÇ ==== | |
54 | + // =============== | |
9 | 55 | |
10 | 56 | var c = 0; |
11 | 57 | var CleanRow = ''; |
... | ... | @@ -98,18 +144,18 @@ |
98 | 144 | |
99 | 145 | function flyFind(value, number) { // ==== flyFind ==== |
100 | 146 | |
101 | - $.post("/ajax/flySearch.php", {load:'search',what: ""+value+"", row_number: number}, function(data,textStatus){ | |
102 | - if (data!=0) { | |
147 | + $.post("/ajax/flySearch.php", { | |
148 | + load:'search',what: ""+value+"", row_number: number}, function(data,textStatus) | |
149 | + { | |
150 | + if (data!=0) | |
151 | + { | |
103 | 152 | window.document.getElementById('livesearch'+number).innerHTML=data; |
104 | 153 | // Ïîêàçûâàåì îêíî |
105 | 154 | document.getElementById('livesearch'+number).style.display='block'; |
106 | - } | |
107 | - | |
108 | - }); | |
109 | - | |
155 | + } | |
156 | + }); | |
110 | 157 | |
111 | 158 | return false; |
112 | - | |
113 | 159 | } |
114 | 160 | |
115 | 161 | function displaySearch(id){ |
... | ... | @@ -118,15 +164,14 @@ |
118 | 164 | |
119 | 165 | function selectFirst(key) { // ==== Ñòðåëêà âíèç ïåðâûé åëåìåíò èç ñïèñêà ==== |
120 | 166 | |
121 | - // Mozilla | |
122 | - if(key==40) { | |
123 | - window.document.getElementById('searchSelect('+c+')').focus(); | |
124 | - window.document.getElementById('searchSelect('+c+')').selectedIndex=0; | |
125 | - | |
126 | - } | |
127 | - | |
128 | - return false; | |
167 | + // Mozilla | |
168 | + if(key == 40) | |
169 | + { | |
170 | + window.document.getElementById('searchSelect('+c+')').focus(); | |
171 | + window.document.getElementById('searchSelect('+c+')').selectedIndex=0; | |
172 | + } | |
129 | 173 | |
174 | + return false; | |
130 | 175 | } |
131 | 176 | |
132 | 177 | function SubmitForm(key) { // ==== ENTER - âñòàâêà âûáðàíîãî ïóíêòà ìåíþ ==== |
... | ... | @@ -291,24 +336,24 @@ |
291 | 336 | // ==== Tel ===== |
292 | 337 | // ============== |
293 | 338 | |
294 | - function livesearchTel(value) { // ==== livesearchEmail ==== | |
295 | - | |
296 | - $.post("/ajax/flySearch.php", {load:'searchTel',what: ""+value+""}, function(data,textStatus){ | |
297 | - if (data!=0) { | |
339 | + function livesearchTel(value) | |
340 | + { | |
341 | + $.post("/ajax/flySearch.php", {load:'searchTel',what: ""+value+""}, function(data,textStatus) | |
342 | + { | |
343 | + if (data!=0) | |
344 | + { | |
298 | 345 | window.document.getElementById('livesearch-tel-list').innerHTML=data; |
299 | 346 | // Ïîêàçûâàåì îêíî |
300 | 347 | document.getElementById('livesearch-tel-list').style.display='block'; |
301 | - } | |
302 | - | |
303 | - }); | |
304 | - | |
305 | - | |
348 | + } | |
349 | + }); | |
350 | + | |
306 | 351 | return false; |
307 | 352 | |
308 | 353 | } |
309 | 354 | |
310 | - function SelectTel(){ // ==== Âûáîðêà è çàïîëíåíèå ==== | |
311 | - | |
355 | + function SelectTel() | |
356 | + { | |
312 | 357 | // Ïîëó÷àåì çíà÷åíèå |
313 | 358 | var _obj = document.getElementById('choose-tel'); |
314 | 359 | _value=document.getElementById('telValue'); |
... | ... | @@ -338,32 +383,76 @@ |
338 | 383 | |
339 | 384 | } |
340 | 385 | |
341 | - function SelectTelFirst(key) { // ==== Ñòðåëêà âíèç ïåðâûé åëåìåíò èç ñïèñêà ==== | |
342 | - | |
343 | - // Mozilla | |
344 | - if(key==40) { | |
345 | - window.document.getElementById('livesearch-tel-list').focus(); | |
346 | - window.document.getElementById('livesearch-tel-list').selectedIndex=0; | |
347 | - } | |
348 | - | |
349 | - return false; | |
386 | + function SelectTelFirst(key) | |
387 | + { | |
388 | + // Mozilla | |
389 | + if (key == 40) | |
390 | + { | |
391 | + window.document.getElementById('livesearch-tel-list').focus(); | |
392 | + window.document.getElementById('livesearch-tel-list').selectedIndex=0; | |
393 | + } | |
350 | 394 | |
395 | + return false; | |
351 | 396 | } |
352 | 397 | |
353 | - function SelectTelSubmit(key) { // ==== ENTER - âñòàâêà âûáðàíîãî ïóíêòà ìåíþ ==== | |
398 | + function SelectTelSubmit(key) | |
399 | + { | |
400 | + // ENTER - âñòàâêà âûáðàíîãî ïóíêòà ìåíþ | |
401 | + | |
402 | + // Mozilla | |
403 | + if (key == 13) | |
404 | + { | |
405 | + SelectTel(); | |
406 | + } | |
354 | 407 | |
355 | - //Mozilla | |
356 | - if (key==13) { | |
357 | - SelectTel(); | |
358 | - } | |
359 | - | |
360 | - return false; | |
408 | + return false; | |
361 | 409 | } |
362 | - | |
363 | - | |
364 | - // ============== | |
365 | - // =unknownUser = | |
366 | - // ============== | |
410 | + | |
411 | + function telAction ($array) | |
412 | + { | |
413 | + $.ajax({ | |
414 | + type: 'GET', | |
415 | + url: '/ajax/OrderContol.php', | |
416 | + dataType: 'json', | |
417 | + data: $.param ($array['json']), | |
418 | + success: function (response) | |
419 | + { | |
420 | + switch ($array['json']['jaction']) | |
421 | + { | |
422 | + case 'tel-save': | |
423 | + | |
424 | + modalBoxLoad (response.html, { | |
425 | + autoClose: 800, | |
426 | + }); | |
427 | + break; | |
428 | + } | |
429 | + }, | |
430 | + error: function() | |
431 | + { | |
432 | + modalBoxLoad ('×òî-òî ïîøëî íå òàê...'); | |
433 | + } | |
434 | + }); | |
435 | +/* | |
436 | + $.post({ | |
437 | + url: '/js/OrderContol.php?jaction=' + $array['json']['jaction'], | |
438 | + queryString: 1, | |
439 | + }) | |
440 | + .done(function (response) | |
441 | + { | |
442 | + modalBoxLoad (response.html, { | |
443 | + autoClose: 600, | |
444 | + }); | |
445 | + }) | |
446 | + .fail (function() | |
447 | + { | |
448 | + modalBoxLoad ('×òî-òî ïîøëî íå òàê...'); | |
449 | + }); | |
450 | + */ | |
451 | + } | |
452 | + | |
453 | + // ===================== | |
454 | + // ==== unknownUser ==== | |
455 | + // ===================== | |
367 | 456 | |
368 | 457 | function newUnknownUser() { |
369 | 458 | |
... | ... | @@ -387,9 +476,9 @@ |
387 | 476 | } |
388 | 477 | } |
389 | 478 | |
390 | - // =================== | |
391 | - // == userCheckData == | |
392 | - // =================== | |
479 | + // ======================= | |
480 | + // ==== userCheckData ==== | |
481 | + // ======================= | |
393 | 482 | |
394 | 483 | function userCheckData(value,fields) { // ==== livesearchEmail ==== |
395 | 484 | |
... | ... | @@ -406,44 +495,100 @@ |
406 | 495 | return false; |
407 | 496 | |
408 | 497 | } |
409 | - | |
410 | - | |
411 | - // ============================= | |
412 | - // ==== Íåîáõîäèìûå ôóíêöèè ==== | |
413 | - // ============================= | |
414 | - | |
415 | - function RemoveDiv(div) { // ==== Óäàëÿåì ëþáûå div ==== | |
498 | + | |
499 | +// =================== | |
500 | +// ==== LISTENERS ==== | |
501 | +// =================== | |
416 | 502 | |
417 | - if(typeof div== 'string') div=document.getElementById(div); | |
418 | - if(div && div.parentNode)div.parentNode.removeChild(div); | |
419 | - SumPerRow(); | |
503 | +jQuery(document).ready(function() | |
504 | +{ | |
420 | 505 | |
421 | - return false; | |
422 | - } | |
506 | + $(".input_status").click(function() | |
507 | + { | |
508 | + $( "#status_box_"+$(this).attr("data-id") ).show(); | |
509 | + }) | |
423 | 510 | |
424 | - function notify(url){ | |
511 | + $( ".status_box ul li.name_city" ).click(function() | |
512 | + { | |
513 | + $("#input_status_"+$(this).attr("data-id")).val($(this).text()); | |
514 | + $( ".status_box" ).hide(); | |
515 | + }); | |
516 | + | |
517 | + $( ".status_box ul li.other" ).click(function() | |
518 | + { | |
519 | + $("#input_status_"+$(this).attr("data-id")).val(""); | |
520 | + $( ".status_box" ).hide(); | |
521 | + $("#input_status_"+$(this).attr("data-id")).focus(); | |
522 | + }); | |
523 | + | |
524 | + $(".need-confirm").click(function(e) | |
525 | + { | |
526 | + e.preventDefault(); | |
425 | 527 | |
426 | - if(confirm("Âûñëàòü óâåäîìëåíèå?")){ | |
427 | - document.location=url; | |
528 | + if (confirm ("Âû äåéñòâèòåëüíî æåëàåòå óäàëèòü?") == true) | |
529 | + { | |
530 | + window.location = $(this).attr("href"); | |
531 | + | |
428 | 532 | return true; |
429 | 533 | } |
534 | + | |
430 | 535 | return false; |
431 | - } | |
536 | + }); | |
432 | 537 | |
433 | - function empty (mixed_var) { | |
434 | - if (mixed_var === "" || mixed_var === 0 || mixed_var === "0" || mixed_var === null || mixed_var === false || typeof mixed_var === 'undefined') { | |
435 | - return true; | |
436 | - } | |
437 | - } | |
538 | + $("#sms_tpl").change(function() | |
539 | + { | |
540 | + $.get("/ajax/sms_tpl.php", { tplID: this.value },function(data) { | |
541 | + $("#sms_msg").val(data); | |
542 | + $("#sms_c").html($("#sms_msg").val().length); | |
543 | + }); | |
544 | + }); | |
438 | 545 | |
439 | - function isset(id) { | |
440 | - | |
441 | - if((document) && (document.getElementById(id))) { | |
546 | + $("#sms_send").click(function() | |
547 | + { | |
548 | + if($("#sms_tel1").attr("checked") || $("#sms_tel2").attr("checked")) { | |
442 | 549 | return true; |
443 | - } else { | |
550 | + }else{ | |
551 | + alert("Íå óêàçàí íîìåð òåëåôîíà!"); | |
444 | 552 | return false; |
445 | 553 | } |
554 | + }); | |
446 | 555 | |
447 | - } | |
556 | + w=120; | |
557 | + | |
558 | + $("input[name=\'sms_type\']").click(function() | |
559 | + { | |
560 | + i = $("#sms_msg").val().length; | |
561 | + if(this.value=="l"){w=120;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} | |
562 | + else{w=70;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} | |
563 | + $("#sms_c_sum").html(w); | |
564 | + }); | |
565 | + | |
566 | + $("#sms_c_sum").html(w); | |
567 | + | |
568 | + | |
569 | + $("#sms_msg").keyup(function() | |
570 | + { | |
571 | + i = this.value.length; | |
572 | + if(i>w){$("#sms_c").css( "color","red" );} | |
573 | + else{$("#sms_c").css( "color","black" );} | |
574 | + $("#sms_c").html(i); | |
575 | + }); | |
576 | + | |
577 | + // âàëèäàöèÿ ôîðìû | |
578 | + // $("#add-item").validationEngine(); | |
579 | + | |
580 | + | |
581 | + // Òåëåôîí | |
582 | + $('.info.tel input').on('change', function() | |
583 | + { | |
584 | + telAction({ | |
585 | + 'json': { | |
586 | + 'jaction': 'tel-save', | |
587 | + 'field': $(this).attr('name'), | |
588 | + 'value': $(this).val(), | |
589 | + 'order_id': getUrlVars('order_ID'), | |
590 | + } | |
591 | + }); | |
592 | + }); | |
448 | 593 | |
449 | - | |
450 | 594 | \ No newline at end of file |
595 | +}); | |
451 | 596 | \ No newline at end of file | ... | ... |