Commit c52bd93305f36cbf89bcbbc7e96aea5421d50c61

Authored by andryeyev
1 parent 71c4ba64

- удаление модификации которых нет в файле продуктов с модификациями

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