From c52bd93305f36cbf89bcbbc7e96aea5421d50c61 Mon Sep 17 00:00:00 2001 From: andryeyev Date: Wed, 25 Nov 2015 12:13:31 +0200 Subject: [PATCH] - удаление модификации которых нет в файле продуктов с модификациями + fix кнопки "не обновлять описание при импорте" + удаление заказа с админки --- account/admin/orders.php | 4441 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- account/func/func.php | 6 +++--- css/account.css | 11 ++++++++++- js/OrderContol.js | 32 +++++++++++++++++++++----------- libs/catalogs.class.php | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------- modules/admin/catalogs/product_save.php | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------- 6 files changed, 2557 insertions(+), 2181 deletions(-) diff --git a/account/admin/orders.php b/account/admin/orders.php index 90839af..e0d479d 100644 --- a/account/admin/orders.php +++ b/account/admin/orders.php @@ -1,633 +1,695 @@ -"; - $result2 = mysql_query($sql2) or die(mysql_error()); - - // - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); - - - - - - - - + // print_r($_POST);exit; + $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] . "'"; + // print "
"; + $result2 = mysql_query ($sql2) or die (mysql_error ()); + + // + $summary = $summary + ($_POST['item']['quant'][$i] * $_POST['item']['price'][$i]); } } - } - + } + // ========== // === add == // ========== - - if (isset($ChangesOfOrder['add'])) { - $mass=array_filter($ChangesOfOrder['add']); - if (!empty($mass)) { - - foreach ($ChangesOfOrder['add'] as $value) { - - // key() - $i=array_keys($_POST['item']['mod_id'], $value); $i=$i[0]; + if (isset ($ChangesOfOrder['add'])) + { + $mass = array_filter ($ChangesOfOrder['add']); + if (! empty ($mass)) + { + foreach ($ChangesOfOrder['add'] as $value) + { + // key() + $i = array_keys ($_POST['item']['mod_id'], $value); + $i = $i[0]; - $r = mysql_query("select count(*) from catalogs_orders_products where order_id='{$_POST['order_id']}' and product_id='{$_POST['item']['mod_id'][$i]}'"); - $c = mysql_result($r,0); - if(!$c){ - // - $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")); - $result2 = mysql_query($sql2) or die(mysql_error()); - - // - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); - } - } - } + $r = mysql_query ("select count(*) from catalogs_orders_products where order_id='{$_POST['order_id']}' and product_id='{$_POST['item']['mod_id'][$i]}'"); + $c = mysql_result ($r, 0); + if (! $c) + { + // + $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")); + $result2 = mysql_query ($sql2) or die (mysql_error ()); + + // + $summary = $summary + ($_POST['item']['quant'][$i] * $_POST['item']['price'][$i]); + } + } + } } // ========== // == del === // ========== + /* - if (isset($ChangesOfOrder['del'])) { + * if (isset($ChangesOfOrder['del'])) { + * + * $mass=array_filter($ChangesOfOrder['del']); + * if (!empty($mass)) { + * + * foreach ($ChangesOfOrder['del'] as $value) { + * + * // + * $sql2="DELETE FROM catalogs_orders_products WHERE order_id='".$_POST['order_id']."' AND product_id='".$value."'"; + * $result2 = mysql_query($sql2) or die(mysql_error()); + * } + * } + * } + */ - $mass=array_filter($ChangesOfOrder['del']); - if (!empty($mass)) { - - foreach ($ChangesOfOrder['del'] as $value) { - - // - $sql2="DELETE FROM catalogs_orders_products WHERE order_id='".$_POST['order_id']."' AND product_id='".$value."'"; - $result2 = mysql_query($sql2) or die(mysql_error()); - } - } - } - */ // =========== // == == // =========== - - if (isset($summary)) { - //if(trim($_POST['label'])) $_POST['label'] = 1; -//print_r($_POST); + if (isset ($summary)) + { + // if(trim($_POST['label'])) $_POST['label'] = 1; + // print_r($_POST); // - $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") - ); - - $result2 = mysql_query($sql2) or die(mysql_error()); - - eMailing('xml',$_POST['user_id'], $_POST['order_id']); - - - - $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']); - $resultg = mysql_query($sql) or die(mysql_error()); - $id_order_git = mysql_insert_id(); - - - for($i=0; $i<=count($_POST['item']); $i++){ - if(!empty($_POST['item']['mod_id'][$i])){ - $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")); - $result2 = mysql_query($sql2) or die(mysql_error()); - }} - - - // header("location:/admin.php/orders/?page=".$_GET['page']); - } else { + $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")); - //$sql2="DELETE FROM catalogs_orders WHERE id='".$_POST['order_id']."'"; - //$result2 = mysql_query($sql2) or die(mysql_error()); + $result2 = mysql_query ($sql2) or die (mysql_error ()); + + eMailing ('xml', $_POST['user_id'], $_POST['order_id']); + + $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']); + $resultg = mysql_query ($sql) or die (mysql_error ()); + $id_order_git = mysql_insert_id (); + + for ($i = 0; $i <= count ($_POST['item']); $i ++) + { + if (! empty ($_POST['item']['mod_id'][$i])) + { + $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")); + $result2 = mysql_query ($sql2) or die (mysql_error ()); + } + } + + // header("location:/admin.php/orders/?page=".$_GET['page']); + } + else + { + + // $sql2="DELETE FROM catalogs_orders WHERE id='".$_POST['order_id']."'"; + // $result2 = mysql_query($sql2) or die(mysql_error()); } - // GoBack(1); - //echo""; + // GoBack(1); + // echo""; + } + else + { + + echo ""; + } + } + else + { + if (! empty ($_GET['exit_order_id'])) + { + $sql = sprintf ("UPDATE catalogs_orders SET work_user=0 WHERE id=%d", $_GET['exit_order_id']); + + mysql_query ($sql); + } + + if (empty ($_SESSION['up'])) + { + $_SESSION['up'] = 2; + } - } else { - - echo""; + if (! empty ($_GET['order_ID'])) + { + $sql = sprintf ("UPDATE catalogs_orders SET work_user=%d WHERE id=%d AND work_user=0", $_SESSION['admin']['id'], $_GET['order_ID']); - } - - }else{ -if(!empty($_GET['exit_order_id'])){ - $sql = sprintf("UPDATE catalogs_orders SET work_user=0 WHERE id=%d", $_GET['exit_order_id']); - - mysql_query($sql); -} -if(empty($_SESSION['up']))$_SESSION['up'] = 2; - -if(!empty($_GET['order_ID'])){ - $sql = sprintf("UPDATE catalogs_orders SET work_user=%d WHERE id=%d AND work_user=0", $_SESSION['admin']['id'], $_GET['order_ID']); - - mysql_query($sql); -} - - } - - // ============== - // ==== add ===== - // ============== - - if (isset($_POST['send']) && $_POST['send']=='add-order') { - - // - $debil==false; - - for($i=1; $i<=count($_POST['item']); $i++) { - if(isset($_POST['item']['mod_id'][$i]) && $_POST['item']['mod_id'][$i]=='') { $debil=true; } + mysql_query ($sql); + } } - if( $debil==false) { - - // $error=''; - // $error[] = ValidFormData($_POST['user']['email'],'email','email'); - // $error[] = ValidFormData($_POST['user']['city'],'','require'); - // $error[] = ValidFormData($_POST['user']['address'],'','require'); - // $error[] = ValidFormData($_POST['user']['tel'],'.','mobile'); - // $error[] = ValidFormData($_POST['user']['username'],'','require'); - - // $alert=implode('\r\n',$error); - - // $mass=array_filter($error); - // if (empty($mass)) { + // ============== + // ==== add ===== + // ============== + + if (isset ($_POST['send']) && $_POST['send'] == 'add-order') + { + // + $debil == false; - // - // $sql="SELECT * FROM zlo_users WHERE email='".$_POST['user']['email']."' "; - // $result = mysql_query($sql) or die(mysql_error()); - // if (mysql_affected_rows()!=0) { + for ($i = 1; $i <= count ($_POST['item']); $i ++) + { + if (isset ($_POST['item']['mod_id'][$i]) && $_POST['item']['mod_id'][$i] == '') + { + $debil = true; + } + } - // } - - $time=mktime(); - $date=date('Y-m-d H:i:s',$time); - - // - if($_POST['user']['user_id']=='' || $_POST['user']['user_id']==0 || $_POST['user']['user_id']=='0') { - - if (strpos($_POST['user']['email'],"@user.com")) { - $_POST['user']['group']=1; - } else { - $_POST['user']['group']=2; + if ($debil == false) + { + + // $error=''; + // $error[] = ValidFormData($_POST['user']['email'],'email','email'); + // $error[] = ValidFormData($_POST['user']['city'],'','require'); + // $error[] = ValidFormData($_POST['user']['address'],'','require'); + // $error[] = ValidFormData($_POST['user']['tel'],'.','mobile'); + // $error[] = ValidFormData($_POST['user']['username'],'','require'); + + // $alert=implode('\r\n',$error); + + // $mass=array_filter($error); + // if (empty($mass)) { + + // + // $sql="SELECT * FROM zlo_users WHERE email='".$_POST['user']['email']."' "; + // $result = mysql_query($sql) or die(mysql_error()); + // if (mysql_affected_rows()!=0) { + + // } + + $time = mktime (); + $date = date ('Y-m-d H:i:s', $time); + + // + if ($_POST['user']['user_id'] == '' || $_POST['user']['user_id'] == 0 || $_POST['user']['user_id'] == '0') + { + + if (strpos ($_POST['user']['email'], "@user.com")) + { + $_POST['user']['group'] = 1; } - - // - $pass=generate_password(6); - $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")); - $result = mysql_query($sql) or die(mysql_error()); - + else + { + $_POST['user']['group'] = 2; + } + + // + $pass = generate_password (6); + $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")); + $result = mysql_query ($sql) or die (mysql_error ()); + // ID - $sql="SELECT id FROM zlo_users WHERE registered='$date' AND tel='".$_POST['user']['tel']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $user=mysql_fetch_assoc($result); + $sql = "SELECT id FROM zlo_users WHERE registered='$date' AND tel='" . $_POST['user']['tel'] . "'"; + $result = mysql_query ($sql) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $user = mysql_fetch_assoc ($result); // - if($user['group']!=1) { - eMailing('reg',$user['id']); + if ($user['group'] != 1) + { + eMailing ('reg', $user['id']); } - $_POST['user']['user_id']=$user['id']; - - } else { echo " ";} - + $_POST['user']['user_id'] = $user['id']; + } + else + { + echo " "; + } } - - - - // - $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")); - $result = mysql_query($sql) or die(mysql_error()); - + // + $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")); + $result = mysql_query ($sql) or die (mysql_error ()); + // - $sql="SELECT id FROM catalogs_orders WHERE mktime='$time' AND user_id='".$_POST['user']['user_id']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $order=mysql_fetch_assoc($result); - } else { echo "";} - - + $sql = "SELECT id FROM catalogs_orders WHERE mktime='$time' AND user_id='" . $_POST['user']['user_id'] . "'"; + $result = mysql_query ($sql) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $order = mysql_fetch_assoc ($result); + } + else + { + echo ""; + } + // - for($i=0; $i<=count($_POST['item']); $i++) { - if($_POST['item']['code'][$i]!=''){ - $r = mysql_query("select count(*) from catalogs_orders_products where order_id='{$order['id']}' and product_id='{$_POST['item']['mod_id'][$i]}'"); - $c = mysql_result($r,0); - if(!$c){ - $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")); - $result = mysql_query($sql) or die(mysql_error()); - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); - } + for ($i = 0; $i <= count ($_POST['item']); $i ++) + { + if ($_POST['item']['code'][$i] != '') + { + $r = mysql_query ("select count(*) from catalogs_orders_products where order_id='{$order['id']}' and product_id='{$_POST['item']['mod_id'][$i]}'"); + $c = mysql_result ($r, 0); + if (! $c) + { + $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")); + $result = mysql_query ($sql) or die (mysql_error ()); + $summary = $summary + ($_POST['item']['quant'][$i] * $_POST['item']['price'][$i]); + } } } - mysql_query("update catalogs_orders set total='$summary' where id='{$order['id']}'"); - // - if ($user['group']!=1) { - eMailing('order-new',$_POST['user']['user_id'], $order['id']); + + mysql_query ("update catalogs_orders set total='$summary' where id='{$order['id']}'"); + + // + if ($user['group'] != 1) + { + eMailing ('order-new', $_POST['user']['user_id'], $order['id']); } - - echo ""; - - // } else { - + + echo ""; + + // } else { + // echo""; - // } - - - } else { - - echo""; - + // } + } + else + { + + echo ""; + } } + + // ============= + // ==== Del ==== + // ============= + if (isset ($_GET['del_order']) && $_GET['del_order'] == 1) + { + function delOrder (array $orders_id, $del_user = false) + { + foreach ($orders_id as $order_id) + { + // + if ($del_user) + { + mysql_query (' + DELETE `zlo_users` FROM `zlo_users` + INNER JOIN `catalogs_orders` as `order` ON `order`.user_id = `zlo_users`.id + AND `order`.id = '.(int)$order_id + ) or die (mysql_error ()); + } + + // + mysql_query (' + DELETE `catalogs_orders_products` FROM `catalogs_orders_products` + INNER JOIN `catalogs_orders` as `order` ON `order`.id = `catalogs_orders_products`.order_id + AND `order`.id = '.(int)$order_id + ) or die (mysql_error ()); + + // + mysql_query (' + DELETE FROM `catalogs_orders` + WHERE `id` = '.(int)$order_id + ) or die (mysql_error ()); + } + } + + delOrder (array ( + 'order_id' => $_GET['order_id']) + ); + + echo ""; } + +// ================= +// ==== NOTIFY ===== +// ================= - // ================= - // ==== NOTIFY ===== - // ================= - - // ============== + // ============== // == changed === // ============== - - if (isset($_GET['notify']) && $_GET['notify']=='order-changed') { - - eMailing('order-changed',$_GET['user'], $_GET['order']); - + + if (isset ($_GET['notify']) && $_GET['notify'] == 'order-changed') + { + + eMailing ('order-changed', $_GET['user'], $_GET['order']); + echo ""; } - - - // ====================================== - // ====================================== - // ============== ================= - // ====================================== - // ====================================== +// ====================================== +// ====================================== +// ============== ================= +// ====================================== +// ====================================== + + // ===================== + // ===== javascript ==== + // ===================== - // ============= - // ==== all ==== - // ============= + + echo " + + + + "; - if (!isset($_GET['action'])) { + echo " + + + + + "; + +// ============= +// ==== all ==== +// ============= + +if (! isset ($_GET['action'])) +{ - echo""; // ***** ***** - if(isset($_SESSION['admin']['edit']) || $_SESSION['admin']['group']==4 || $_SESSION['admin']['group']==2) { - echo"SMS
"; - echo""; + if (isset ($_SESSION['admin']['edit']) || $_SESSION['admin']['group'] == 4 || $_SESSION['admin']['group'] == 2) + { + echo "SMS
"; + echo ""; } // *********************** - - // ============== - // === report === - // ============== - - - $time=''; - $time['day'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), date('j'), date('Y')); - if(date('w')==1) { - $time['week'] = " o.`mktime` >=".mktime(0, 0, 0, date('n'), date('j'), date('Y'))." "; - } else { - $time['week'] = "( o.`mktime` BETWEEN ".strtotime("last Monday")." AND ".mktime(0, 0, 0, date('n'), date('j')+1, date('Y')).") "; + + // ============== + // === report === + // ============== + + $time = ''; + $time['day'] = "o.`mktime` >= " . mktime (0, 0, 0, date ('n'), date ('j'), date ('Y')); + if (date ('w') == 1) + { + $time['week'] = " o.`mktime` >=" . mktime (0, 0, 0, date ('n'), date ('j'), date ('Y')) . " "; + } + else + { + $time['week'] = "( o.`mktime` BETWEEN " . strtotime ("last Monday") . " AND " . mktime (0, 0, 0, date ('n'), date ('j') + 1, date ('Y')) . ") "; + } + $time['month'] = "o.`mktime` >= " . mktime (0, 0, 0, date ('n'), 1, date ('Y')); + + Report::put_time ($time); + Report::make (); + /* + * echo"
"; + * + * // === === + * + * echo"
"; + * + * echo" : "; + * echo Report::html_report(Report::get_mass_client()); + * echo"
"; + * + * echo"
"; + * + * // === === + * + * echo"
"; + * + * echo" : "; + * echo Report::html_report(Report::get_mass_order()); + * echo"
"; + * + * echo"
"; + * + * // === === + * + * echo"
"; + * + * echo": "; + * echo""; + * + * // + * echo"
"; + * echo"
"; + * echo"
"; + * echo"
"; + * echo"
"; + * echo"
"; + * echo"
"; + * + * echo"
"; + * + * echo"
"; + */ + + if (! isset ($_GET['status'])) + { + $_GET['status'] = "1"; + } + if (! isset ($_GET['page'])) + { + $_GET['page'] = "1"; + } + + if (isset ($_GET['user'])) + { + $AND = "AND u.id=" . $_GET['user']; + } + else + { + $AND = ''; + } + + // ============= + // === === + // ============= + + $th = array ( + "id" => " ", + "username" => "", + "email" => "email", + "tel" => "", + "declaration" => " ", + "nakladnaya" => " ", + "code" => "", + "mcomment" => "" + ); + + // + if (isset ($_REQUEST['search'])) + { + if ($_REQUEST['field'] == 'id') + { + $pre = "o"; } - $time['month'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), 1, date('Y')); - - Report::put_time($time); - Report::make(); - /* - echo"
"; - - // === === - - echo"
"; - - echo" : "; - echo Report::html_report(Report::get_mass_client()); - echo"
"; + if ($_REQUEST['field'] == 'username') + { + $pre = "u"; + } + if ($_REQUEST['field'] == 'email') + { + $pre = "u"; + } + if ($_REQUEST['field'] == 'tel') + { + $pre = "u"; + } + if ($_REQUEST['field'] == 'code') + { + $pre = "m"; + } + if ($_REQUEST['field'] == 'declaration') + { + $pre = "o"; + } + if ($_REQUEST['field'] == 'nakladnaya') + { + $pre = "o"; + } + if ($_REQUEST['field'] == 'mcomment') + { + $pre = "o"; + } + $AND = ''; + if (trim ($_REQUEST['look']) != '') + { + if ($_REQUEST['field'] == "id") + $AND .= "AND $pre.`" . $_REQUEST['field'] . "` LIKE '" . trim ($_REQUEST['look']) . "' "; + else + $AND .= "AND $pre.`" . $_REQUEST['field'] . "` LIKE '%" . trim ($_REQUEST['look']) . "%' "; + } + if (($_REQUEST['form']['date_start'] != '') && ($_REQUEST['form']['date_end'] != '')) + { - echo"
"; - - // === === - - echo"
"; - - echo" : "; - echo Report::html_report(Report::get_mass_order()); - echo"
"; - - echo"
"; - - // === === - - echo"
"; - - echo": "; - echo""; - - // - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - - echo"
"; - - echo"
";*/ - - - if (!isset($_GET['status'])) {$_GET['status']="1";} - if (!isset($_GET['page'])) {$_GET['page']="1";} - - if(isset($_GET['user'])) {$AND="AND u.id=".$_GET['user'];} else {$AND='';} - - // ============= - // === === - // ============= - - $th=array("id"=>" ","username"=>"", "email"=>"email", "tel"=>"", "declaration"=>" ", "nakladnaya"=>" ", "code"=>"", "mcomment"=>"" ); - - // - if (isset($_REQUEST['search'])) { - if($_REQUEST['field']=='id') {$pre="o";} - if($_REQUEST['field']=='username') {$pre="u";} - if($_REQUEST['field']=='email') {$pre="u";} - if($_REQUEST['field']=='tel') {$pre="u";} - if($_REQUEST['field']=='code') {$pre="m";} - if($_REQUEST['field']=='declaration') {$pre="o";} - if($_REQUEST['field']=='nakladnaya') {$pre="o";} - if($_REQUEST['field']=='mcomment') {$pre="o";} - $AND=''; - if (trim($_REQUEST['look'])!='') { - if($_REQUEST['field']=="id")$AND.="AND $pre.`".$_REQUEST['field']."` LIKE '".trim($_REQUEST['look'])."' "; - else $AND.="AND $pre.`".$_REQUEST['field']."` LIKE '%".trim($_REQUEST['look'])."%' "; - } - if ( ($_REQUEST['form']['date_start'] !='') && ($_REQUEST['form']['date_end'] !='')){ + $dateStart = $_REQUEST['form']['date_start']; + $dateEnd = $_REQUEST['form']['date_end']; - $dateStart =$_REQUEST['form']['date_start']; - $dateEnd =$_REQUEST['form']['date_end']; + $mkdate = ExtractDate ($_REQUEST['form']['date_start']); + $_REQUEST['form']['date_start'] = mktime (0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - $mkdate=ExtractDate($_REQUEST['form']['date_start']); - $_REQUEST['form']['date_start'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - - $mkdate=ExtractDate($_REQUEST['form']['date_end']); - $_REQUEST['form']['date_end'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - - $AND.=" AND (o.`mktime` BETWEEN '".$_REQUEST['form']['date_start']."' AND '".$_REQUEST['form']['date_end']."') "; - } + $mkdate = ExtractDate ($_REQUEST['form']['date_end']); + $_REQUEST['form']['date_end'] = mktime (0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); + + $AND .= " AND (o.`mktime` BETWEEN '" . $_REQUEST['form']['date_start'] . "' AND '" . $_REQUEST['form']['date_end'] . "') "; } - // ============= - // === ==== - // ============= - - echo"'; + echo ""; + + echo " +
+ +
"; + + echo "
@@ -1469,126 +1651,141 @@ echo " "; - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - // - $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m + while ($item_id = mysql_fetch_assoc ($result3)) + { + $i ++; + + // + $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m LEFT JOIN catalogs_products as p ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()==11110) { - $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m + WHERE m.id='" . $item_id['product_id'] . "' "; + $result4 = mysql_query ($sql4) or die (mysql_error ()); + if (mysql_affected_rows () == 11110) + { + $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m LEFT JOIN catalogs_products as p ON p.id=m.product_id - WHERE m.code='".$item_id['code']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - } - if (mysql_affected_rows()!=0) { - $item=mysql_fetch_assoc($result4); - - - if(!empty($item['code'])){ - // - $sql5 = "SELECT c.name as city, o.count + WHERE m.code='" . $item_id['code'] . "' "; + $result4 = mysql_query ($sql4) or die (mysql_error ()); + } + if (mysql_affected_rows () != 0) + { + $item = mysql_fetch_assoc ($result4); + + if (! empty ($item['code'])) + { + // + $sql5 = "SELECT c.name as city, o.count FROM catalogs_keys_products_cities as o LEFT JOIN catalogs_cities as c ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - //print $sql5; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; + WHERE o.mod_code='" . $item['code'] . "' AND o.count>0 "; + // print $sql5; + $result5 = mysql_query ($sql5) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $onStockDesc = ''; + while ($onStock = mysql_fetch_assoc ($result5)) + { + $onStockDesc .= $onStock['city'] . "(" . $onStock['count'] . ") "; + } + } + else + { + $onStock = ''; + } } - } else { $onStock='';} - } - echo"
+ echo "
-
$i (".$item['mod_id'].")
+
$i (" . $item['mod_id'] . ")
"; - if($item_id['count']==0){ - echo""; - echo""; - } - else{ - echo" - + if ($item_id['count'] == 0) + { + echo ""; + echo ""; + } + else + { + echo " +
"; - echo""; - } - echo" + echo ""; + } + echo "
-
".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." 
- -
".$item['size']." 
-
".$item['color']." 
-
-
"."(".$item_id['product_cine_id'].") ".$item['cine']."
-
".($item['cine']*$item_id['count'])."
+
" . viewBook ('catalogs_brends', $item['brend_id'], 'id', 'name') . " 
+ +
" . $item['size'] . " 
+
" . $item['color'] . " 
+
+
" . "(" . $item_id['product_cine_id'] . ") " . $item['cine'] . "
+
" . ($item['cine'] * $item_id['count']) . "
"; - if($item_id['count']==0){ - echo""; - echo""; - }else{ - //echo""; - echo""; + echo ""; + } + else + { + // echo""; + echo ""; - } - echo"
+ } + echo "
"; - echo' -
+ echo ' +
    -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • 2?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • 2?
  • ?
  • -
  • -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • +
-
'; - echo"
"; - echo"
- - + +
"; - echo" + echo "
$onStockDesc
- - - - - + + + + +
@@ -1599,271 +1796,298 @@ echo "
"; + } + } - - }} - - echo"
+ echo "
- + : 0 0 .
- - - - - - "; - - echo"
"; - - // XML - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); - - // - if ($order['status']!=6) { - echo "
"; - /*"
- - "; - echo" - "; - } - - - echo"";*/ - 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' '.mysql_result($r,0).'';} - else - echo" - -
-
- "; + + + "; + + echo "
"; + + // XML + $dateFromDate = ExtractDate ((date ('Y-m-d H:i:s', $order['mktime']))); + + // + if ($order['status'] != 6) + { + echo "
"; + /* + * "
+ *
+ * "; + * echo" + * "; + * } + * + * + * echo"
"; + */ + + // ================= + // ==== CONTROL ==== + // ================= + + 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 ' ' . mysql_result ($r, 0) . ''; + } + else + { + // c + echo ""; + // + echo "
"; + // + echo "
"; + // + echo ""; + // + echo ""; + } - /* if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { - echo"
"; - }*/ + /* + * if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { + * echo"
"; + * } + */ - - echo"
"; + echo "
"; + } + echo ""; + + echo ""; + } + } + else + { + echo "

"; } - echo""; - echo""; - - } - - } else { echo"

";} + // ===================== + // ===== javascript ==== + // ===================== + + echo ' + '; + + echo ' + '; + + echo " + "; + + print ''; + } - // ===================== - // ===== javascript ==== - // ===================== + $i1 ++; + } + print ""; - echo" - - - - "; -echo ''; - echo''; + print ""; - echo" - - - - - - - - - "; - - print''; - } - - - $i1++; - } print""; - print" - "; - - echo""; - - - - // === Pager + echo ""; - echo"
- ".pagerGetShow($pager)." -
"; - - } + // === Pager + + echo " +
+ " . pagerGetShow ($pager) . " +
"; + } +} - } - - // =============== - // ===== show ==== - // =============== +// =============== +// ===== show ==== +// =============== + +if (isset ($_GET['action']) && $_GET['action'] == 'show') +{ - if (isset($_GET['action']) && $_GET['action']=='show') { + // - // - - echo"
"; - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row=mysql_fetch_assoc($result)) { + echo "
"; + $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; + $result = mysql_query ($sql) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + while ($row = mysql_fetch_assoc ($result)) + { - // - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - - echo"
".$row['title']."(".$row2['calc'].")
"; - } + // + $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='" . $row['id'] . "' AND user_id=" . $_GET['user'] . ""; + $result2 = mysql_query ($sql2) or die (mysql_error ()); + $row2 = mysql_fetch_assoc ($result2); + + echo "
" . $row['title'] . "(" . $row2['calc'] . ")
"; } - echo"
+ } + echo "
"; - - if(!isset($_GET['status'])) {$_GET['status']=1;} - - // =========== =========== - - $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 + + if (! isset ($_GET['status'])) + { + $_GET['status'] = 1; + } + + // =========== =========== + + $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 FROM catalogs_orders as o LEFT JOIN zlo_users as u on u.id=o.user_id - WHERE u.id=".$_GET['user']." AND o.status=".$_GET['status']." ORDER BY mktime DESC "; - $pager['sql']= $sql; - $pager=pagerGetRun($pager,10,15); //echo$pager['sql']; - $result = mysql_query($pager['sql']) or die(mysql_error()); - if (mysql_affected_rows()!=0) { + WHERE u.id=" . $_GET['user'] . " AND o.status=" . $_GET['status'] . " ORDER BY mktime DESC "; + $pager['sql'] = $sql; + $pager = pagerGetRun ($pager, 10, 15); // echo$pager['sql']; + $result = mysql_query ($pager['sql']) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { // =================== - // === === - // =================== + // === === + // =================== - while ($order=mysql_fetch_assoc($result)) { - - echo"
"; + while ($order = mysql_fetch_assoc ($result)) + { + + echo "
"; - echo"
+ echo "
-

#".$order['order_id']."
- : ".date('Y-m-d H:i:s',$order['mktime'])." +

#" . $order['order_id'] . "
+ : " . date ('Y-m-d H:i:s', $order['mktime']) . "

-
+
- + -
".$order['tel']." 
+
" . $order['tel'] . " 
-
".$order['tel2']." 
+
" . $order['tel2'] . " 
-
".viewBook('zlo_users_group', $order['group'], 'id', 'name')." 
+
" . viewBook ('zlo_users_group', $order['group'], 'id', 'name') . " 
- [ ] + [ ]
-
+
-
".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." 
+
" . viewBook ('zlo_book_delivery', $order['delivery'], 'id', 'title') . " 
-
".$order['city']." 
+
" . $order['city'] . " 
-
".$order['address']." 
+
" . $order['address'] . " 
-
".$order['comment']." 
+
" . $order['comment'] . " 
@@ -1872,14 +2096,13 @@ $("#sms_msg").keyup(function(){
"; - // - echo" + echo "
"; - echo" + echo "
@@ -1893,195 +2116,215 @@ $("#sms_msg").keyup(function(){ "; - - $sql3 = " + + $sql3 = " SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* FROM catalogs_orders AS o LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id LEFT JOIN catalogs_products AS p ON p.id = m.product_id - WHERE o.id='".$order['order_id']."'"; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result3)) { { $i++; - - - // - $sql5 = "SELECT c.name as city, o.count + WHERE o.id='" . $order['order_id'] . "'"; + $result3 = mysql_query ($sql3) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + while ($item = mysql_fetch_assoc ($result3)) + { + { + $i ++; + + // + $sql5 = "SELECT c.name as city, o.count FROM catalogs_keys_products_cities as o LEFT JOIN catalogs_cities as c ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; + WHERE o.mod_code='" . $item['code'] . "' AND o.count>0 "; + $result5 = mysql_query ($sql5) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $onStockDesc = ''; + while ($onStock = mysql_fetch_assoc ($result5)) + { + $onStockDesc .= $onStock['city'] . "(" . $onStock['count'] . ") "; + } } - } else { $onStockDesc=''; } - - echo" + else + { + $onStockDesc = ''; + } + + echo " - - - - - - - - - + + + + + + + + + - "; - - } - + "; + } } } - echo"
$i .".$item['code']."".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."".$item['name']."".$item['size']."".$item['color']."".$item['count']."".$item['cine']."".($item['cine']*$item['count'])."".$onStockDesc."" . $item['code'] . "" . viewBook ('catalogs_brends', $item['brend_id'], 'id', 'name') . "" . $item['name'] . "" . $item['size'] . "" . $item['color'] . "" . $item['count'] . "" . $item['cine'] . "" . ($item['cine'] * $item['count']) . "" . $onStockDesc . "
- : ".$order['total']." . + echo " + : " . $order['total'] . " .
"; - - - echo"
"; - - } - - // === Pager + echo "
"; + } + + // === Pager - echo"
- ".pagerGetShow($pager)." + echo "
+ " . pagerGetShow ($pager) . "
"; - } } +} + +// =============== +// ===== edit ==== +// =============== + +if (isset ($_GET['action']) && $_GET['action'] == 'edit') +{ - // =============== - // ===== edit ==== - // =============== + // - if (isset($_GET['action']) && $_GET['action']=='edit') { + if (! isset ($_GET['status'])) + { + $status = 1; + } + else + { + $status = $_GET['status']; + } - // - - if (!isset($_GET['status'])) {$status=1;} else {$status=$_GET['status'];} - - echo"
"; - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row=mysql_fetch_assoc($result)) { + echo "
"; + $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; + $result = mysql_query ($sql) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + while ($row = mysql_fetch_assoc ($result)) + { - // - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - - echo"
".$row['title']."(".$row2['calc'].")
"; - } + // + $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='" . $row['id'] . "' AND user_id=" . $_GET['user'] . ""; + $result2 = mysql_query ($sql2) or die (mysql_error ()); + $row2 = mysql_fetch_assoc ($result2); + + echo "
" . $row['title'] . "(" . $row2['calc'] . ")
"; } - echo"
+ } + echo "
"; - - - // =========== =========== - - $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 + + // =========== =========== + + $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 FROM catalogs_orders as o LEFT JOIN zlo_users as u ON u.id=o.user_id LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE o.id='".$_GET['order']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { + WHERE o.id='" . $_GET['order'] . "'"; + $result = mysql_query ($sql) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { - $order=mysql_fetch_assoc($result); - - echo"
"; - echo"
"; - - echo" + $order = mysql_fetch_assoc ($result); + + echo ""; + echo "
"; + + echo "
-
- #".$order['order_id']." C: ".$order['total']." . +
+ #" . $order['order_id'] . " C: " . $order['total'] . " . -
".date('Y-m-d H:i:s',$order['mktime'])."
+
" . date ('Y-m-d H:i:s', $order['mktime']) . "
-
- +
+
+ for ($i = 0; $i <= 10; $i ++) + { + print ''; + } + ; + echo "
-   - +   +
-   - +   +
-   - +   +
-   - +   +
"; - echo " + echo "
+ viewBookSelectValue ('zlo_book_delivery', 'id', 'title', $order['delivery']); + echo "
"; - - echo " + + echo " -
 
+
 
-
 
+
 
-
+
-
+
"; - - echo" + + echo "
"; - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - echo" + + // + + $sql3 = "SELECT * FROM catalogs_orders_products + WHERE `order_id`='" . $order['order_id'] . "' "; + $result3 = mysql_query ($sql3) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $i = 0; + echo "
@@ -2135,58 +2378,67 @@ $("#sms_msg").keyup(function(){
"; - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - // - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m + + while ($item_id = mysql_fetch_assoc ($result3)) + { + $i ++; + + // + $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m LEFT JOIN catalogs_products as p ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $item=mysql_fetch_assoc($result4); - - // - $sql5 = "SELECT c.name as city, o.count + WHERE m.id='" . $item_id['product_id'] . "' "; + + $result4 = mysql_query ($sql4) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $item = mysql_fetch_assoc ($result4); + + // + $sql5 = "SELECT c.name as city, o.count FROM catalogs_keys_products_cities as o LEFT JOIN catalogs_cities as c ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStock='';} + WHERE o.mod_code='" . $item['code'] . "' AND o.count>0 "; + $result5 = mysql_query ($sql5) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $onStockDesc = ''; + while ($onStock = mysql_fetch_assoc ($result5)) + { + $onStockDesc .= $onStock['city'] . "(" . $onStock['count'] . ") "; + } + } + else + { + $onStock = ''; + } - echo"
+ echo "
$i
- +
-
".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." 
- -
".$item['size']." 
-
".$item['color']." 
-
-
".$item['cine']."
-
".($item['cine']*$item_id['count'])."
+
" . viewBook ('catalogs_brends', $item['brend_id'], 'id', 'name') . " 
+ +
" . $item['size'] . " 
+
" . $item['color'] . " 
+
+
" . $item['cine'] . "
+
" . ($item['cine'] * $item_id['count']) . "
$onStockDesc
- - - - - + + + + +
@@ -2197,282 +2449,305 @@ $("#sms_msg").keyup(function(){
"; - } - - } - - echo"
- -
- : 0 0 . -
- - - - - - + } + } + + echo "
- "; - - echo"
"; +
+ : 0 0 . +
- // XML - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); + + + + "; - // - if ($order['status']!=6) { + echo "
"; + + // XML + $dateFromDate = ExtractDate ((date ('Y-m-d H:i:s', $order['mktime']))); + + // + if ($order['status'] != 6) + { echo "
- + "; - echo" - "; - } - - - echo""; - - echo" -
-
-
"; - - if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { - echo"
"; - } - - - echo"
"; + $sql4 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; + $result4 = mysql_query ($sql4) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + + while ($row4 = mysql_fetch_assoc ($result4)) + { + if ($row4['id'] == $order['status']) + $chek = "SELECTED"; + else + $chek = ""; + echo "\n"; + } + echo ""; + echo " + "; } - echo"
"; - echo"
"; + echo ""; + + echo " +
+
+
"; + + if (is_file ($_SERVER['DOCUMENT_ROOT'] . "/xml/" . $dateFromDate[0] . "/" . $dateFromDate[1] . "/order_" . $order['order_id'] . ".xml")) + { + echo "
"; + } + + echo "
"; + } + echo ""; - } + echo ""; + } + } + else + { + echo "

"; + } + + // ===================== + // ===== javascript ==== + // ===================== + + echo " + "; +} - } else { echo"

";} - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - - "; - +// ============= +// ==== add ==== +// ============= +if (isset ($_GET['action']) && $_GET['action'] == 'add') +{ + + if (isset ($_POST['user'])) + { + } + + $user = array (); + + if (isset ($_GET['user'])) + { - echo" - - - - - - - - - "; + $sql = "SELECT * FROM zlo_users WHERE id='" . $_GET['user'] . "'"; + $result = mysql_query ($sql) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $user = mysql_fetch_assoc ($result); + } } + else + { + if (isset ($_POST)) + { + $user = $_POST['user']; + } + } + echo "
"; + echo "
"; + echo "
"; + echo " +
+
+ +
+ +
" . date ('d-m-Y H:i:s') . "
"; - // ============= - // ==== add ==== - // ============= + echo " +
+ +
+
+ +
+ +
+
"; - if (isset($_GET['action']) && $_GET['action']=='add') { - - if (isset($_POST['user'])) {} + if (! isset ($_GET['user'])) + { + echo "
"; + } - $user=array(); - - if(isset($_GET['user'])) { + if (isset ($_GET['user'])) + { - $sql = "SELECT * FROM zlo_users WHERE id='".$_GET['user']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $user=mysql_fetch_assoc($result); - } + $readonly = 'readonly="readonly"'; + $disabled = 'disabled="disabled"'; + } + else + { + $readonly = ''; + $disabled = ''; + } + + echo " + +
+ +
+
+
+ + + +
+ +
+
+
+ - } else { - - if(isset($_POST)) {$user=$_POST['user'];} + + +
+ + +
"; + + echo " + +
+ +
"; + + echo " + +
"; + + // + echo ""; + + echo ""; + + // hidden + if (isset ($_GET['user'])) + { + echo ""; + } + + echo ""; + + echo "
+ +
+ +
"; + + echo " + +
"; + + echo " + +
"; + + $array_method = array ( + " ", + " ", + " ", + " -", + " ", + " " + ); + echo " +
+ + +
"; + + echo " + +
"; + + echo " + +
"; + $array_method = array ( + "", + "" + ); + + echo " +
+ + - - - -
-
- -
- -
-
"; - - if(!isset($_GET['user'])) { - echo"
"; - } - - if(isset($_GET['user'])) { - - $readonly='readonly="readonly"'; - $disabled='disabled="disabled"'; - - } else {$readonly='';$disabled='';} - - echo" - -
- -
-
-
- - - -
- -
-
-
- - - - -
- - -
"; - - echo" -
- -
"; - - echo " - -
"; - - // - echo" - "; - - echo ""; - - // hidden - if (isset($_GET['user'])) { - echo""; - } - - echo""; + foreach ($array_method as $method) + { + echo ''; + } - echo"
- "; - echo " -
- -
"; - - echo " - -
"; + echo " +
"; - echo " - -
"; - - - $array_method = array(" "," "," "," -"," "," "); - echo" -
- - -
"; - - echo" -
"; - echo" -
"; - $array_method = array("",""); - echo" -
- - -
"; - echo" -
+ echo " + +
- -
+ +
- -
-
- "; - - echo"
+ +
+
+ "; + + echo "
"; - - echo" + + echo "
@@ -2577,277 +2852,269 @@ $("#sms_msg").keyup(function(){
"; - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - "; - - - echo" - - - - - - - - - "; - - } - - // ============= - // === print === - // ============= - - if (isset($_GET['action']) && $_GET['action']=='print') { + // ===================== + // ===== javascript ==== + // ===================== - // =========== =========== + echo " + "; +} - if (!isset($_GET['status'])) {$_GET['status']=1;} +// ============= +// === print === +// ============= - $sql = "SELECT o.*,u.*, o.id as order_id,o.city as city FROM catalogs_orders as o +if (isset ($_GET['action']) && $_GET['action'] == 'print') +{ + + // =========== =========== + + if (! isset ($_GET['status'])) + { + $_GET['status'] = 1; + } + + $sql = "SELECT o.*,u.*, o.id as order_id,o.city as city FROM catalogs_orders as o RIGHT JOIN zlo_users as u on u.id=o.user_id - WHERE o.id='".$_GET['order_id']."' "; - - $sql = "SELECT o.*, o.id as order_id,o.city as city,adm.login as meneger FROM catalogs_orders as o + WHERE o.id='" . $_GET['order_id'] . "' "; + + $sql = "SELECT o.*, o.id as order_id,o.city as city,adm.login as meneger FROM catalogs_orders as o LEFT JOIN zlo_admin adm ON adm.id=o.meneger - WHERE o.id='".$_GET['order_id']."' "; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $view=''; - $view.="
"; - - $order=mysql_fetch_assoc($result); - - $view.="
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
: ".$order['meneger']."
# ".$order['order_id']."
: ".date('Y-m-d H:i:s',$order['mktime'])."
: ".$order['name']."
Email: ".$order['email']."
: ".$order['phone']."
. : ".$order['phonemob']."
: ".$order['cards']."
: ".$order['comment']."
: ".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')."
: ".$order['declaration']."
: ".$order['warehouse']."
: ".$order['payment']."
: ".$order['insurance']."
: ".$order['sumn']."
: ".$order['sends']."
: ".$order['city']."
: ".$order['adress']."
(): ".$order['mcomment']."
-
"; - - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; + WHERE o.id='" . $_GET['order_id'] . "' "; + $result = mysql_query ($sql) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $view = ''; + $view .= "
"; + + $order = mysql_fetch_assoc ($result); + + $view .= " +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
: " . $order['meneger'] . "
# " . $order['order_id'] . "
: " . date ('Y-m-d H:i:s', $order['mktime']) . "
: " . $order['name'] . "
Email: " . $order['email'] . "
: " . $order['phone'] . "
. : " . $order['phonemob'] . "
: " . $order['cards'] . "
: " . $order['comment'] . "
: " . viewBook ('zlo_book_delivery', $order['delivery'], 'id', 'title') . "
: " . $order['declaration'] . "
: " . $order['warehouse'] . "
: " . $order['payment'] . "
: " . $order['insurance'] . "
: " . $order['sumn'] . "
: " . $order['sends'] . "
: " . $order['city'] . "
: " . $order['adress'] . "
(): " . $order['mcomment'] . "
+
"; + + // + + $sql3 = "SELECT * FROM catalogs_orders_products + WHERE `order_id`='" . $order['order_id'] . "' "; + $result3 = mysql_query ($sql3) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $i = 0; + + $view .= "
"; + + $sum = array (); + while ($item_id = mysql_fetch_assoc ($result3)) + { + $i ++; - $view.="
"; - -$sum = array(); - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - $sql4 = "SELECT *,IF(m.cine>0,m.cine,p.cine) as cine FROM catalogs_modifications as m + $sql4 = "SELECT *,IF(m.cine>0,m.cine,p.cine) as cine FROM catalogs_modifications as m LEFT JOIN catalogs_products as p ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()==0111) { - $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m + WHERE m.id='" . $item_id['product_id'] . "' "; + $result4 = mysql_query ($sql4) or die (mysql_error ()); + if (mysql_affected_rows () == 0111) + { + $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m LEFT JOIN catalogs_products as p ON p.id=m.product_id - WHERE m.code='".$item_id['code']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - } - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result4)) { - - $view.=" + WHERE m.code='" . $item_id['code'] . "' "; + $result4 = mysql_query ($sql4) or die (mysql_error ()); + } + if (mysql_affected_rows () != 0) + { + while ($item = mysql_fetch_assoc ($result4)) + { + + $view .= " - + - + - + - + - + - + - + - + - + -
$i .   ".$item['code']."" . $item['code'] . "   ".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."" . viewBook ('catalogs_brends', $item['brend_id'], 'id', 'name') . "   ".$item['name']."" . $item['name'] . "   ".$item['size']."" . $item['size'] . "   ".$item['color']."" . $item['color'] . "   .".$item_id['count']."" . $item_id['count'] . "   "."(".$item_id['product_cine_id'].") ".$item['cine']."" . "(" . $item_id['product_cine_id'] . ") " . $item['cine'] . "   ".($item_id['product_cine_id']*$item_id['count'])."" . ($item_id['product_cine_id'] * $item_id['count']) . "   ".$item_id['reservation']."" . $item_id['reservation'] . "
"; - $sum[] =($item_id['product_cine_id']*$item_id['count']); - - } - - } + "; + $sum[] = ($item_id['product_cine_id'] * $item_id['count']); } - - $view.=" : ".array_sum($sum)." . - : ".$order['cost_delivery']." . -
"; - - } - - $view.="
"; - - // 2 - - echo $view; - echo "
"; - $view2=''; - $view2.="
"; + } + } - - $view2.="
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ".$order['order_id']."
: ".date('Y-m-d H:i:s',$order['mktime'])."
: ".$order['name']."
: ".$order['phone']."
: ".$order['city']."
: ".$order['warehouse']."
: ".$order['insurance']."
: ".$order['sumn']."
: ".$order['sends']."
: ".$order['mcomment']."
-
-
"; - - echo $view2; - - - } - } + $view .= " + : " . array_sum ($sum) . " . + : " . $order['cost_delivery'] . " . +
"; + } + + $view .= "
"; + + // 2 + + echo $view; + echo "
"; + $view2 = ''; + $view2 .= "
"; + + $view2 .= " +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
# " . $order['order_id'] . "
: " . date ('Y-m-d H:i:s', $order['mktime']) . "
: " . $order['name'] . "
: " . $order['phone'] . "
: " . $order['city'] . "
: " . $order['warehouse'] . "
: " . $order['insurance'] . "
: " . $order['sumn'] . "
: " . $order['sends'] . "
: " . $order['mcomment'] . "
+
+
"; + + echo $view2; + } +} ?> diff --git a/account/func/func.php b/account/func/func.php index 0deda6e..f77ba68 100644 --- a/account/func/func.php +++ b/account/func/func.php @@ -492,12 +492,12 @@ function GoBack($back=''){ //print_r($_SESSION['data']['GoBack']); } - function AuthorizationUser($_POST) { + function AuthorizationUser($post) { - if (isset($_POST)) { + if (isset($post)) { $sql = "SELECT u.*, u.id as user_id FROM zlo_users as u - WHERE u.email='".htmlspecialchars($_POST['form']['login'],ENT_QUOTES)."' AND u.pass='".htmlspecialchars($_POST['form']['pass'],ENT_QUOTES)."' "; + WHERE u.email='".htmlspecialchars($post['form']['login'],ENT_QUOTES)."' AND u.pass='".htmlspecialchars($post['form']['pass'],ENT_QUOTES)."' "; $result = mysql_query($sql) or die(mysql_error()); if (mysql_affected_rows()!=0) { diff --git a/css/account.css b/css/account.css index c000b8e..4f094b1 100644 --- a/css/account.css +++ b/css/account.css @@ -1,5 +1,5 @@ div.space-20 {height: 20px;} - + div.personal-account div.title {margin-bottom: 20px;} div.personal-account div.menu-li {margin: 20px;} div.personal-account div.menu-li li {margin: 5px 0;} @@ -445,6 +445,15 @@ font-size: 14px; padding: 5px; } + + #records .red, .red { + background: #ff0000; + background: -moz-linear-gradient(top, #ff0000 0%, #a80000 100%); + background: -webkit-linear-gradient(top, #ff0000 0%,#a80000 100%); + background: linear-gradient(to bottom, #ff0000 0%,#a80000 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff0000', endColorstr='#a80000',GradientType=0 ); + } + .pager-pages { margin: 10px 0; } diff --git a/js/OrderContol.js b/js/OrderContol.js index b7057c9..f810a21 100644 --- a/js/OrderContol.js +++ b/js/OrderContol.js @@ -6,17 +6,28 @@ // ================================ // ==== ==== // ================================ - - var StartCount= document.getElementById('lines').lastChild.id; - if (empty(StartCount)) { - StartCount='line1'; - } - var c = StartCount.substr(4); - - var CleanRow=''; - window.onload = CopyCleanRow(); - window.onload = SumPerRow(); + var c = 0; + var CleanRow = ''; + var StartCount = 0; + + jQuery(document).ready(function() + { + if ($('#lines').length > 0) + { + StartCount = document.getElementById('lines').lastChild.id; + + if (empty(StartCount)) { + StartCount='line1'; + } + + c = StartCount.substr(4); + + CopyCleanRow(); + SumPerRow(); + } + }); + function CopyCleanRow () { // ==== ==== CleanRow = document.getElementById('line0').innerHTML; @@ -105,7 +116,6 @@ document.getElementById(id).style.display = ('' == document.getElementById(id).style.display)? '' : 'none'; } - function selectFirst(key) { // ==== ==== // Mozilla diff --git a/libs/catalogs.class.php b/libs/catalogs.class.php index 4da7312..826550e 100644 --- a/libs/catalogs.class.php +++ b/libs/catalogs.class.php @@ -753,42 +753,94 @@ function deleteModificationPics ($id, $pics = array('pic_big','pic')) function ProductClick($id){ $this->db->query("update catalogs_products set click=click+1 where id='$id'"); } - - function SaveProduct($data,$upload){ - $table_name = "catalogs_products"; - -if(trim(@$data['translit'])=="") $data['translit'] = translit($data['name']); - - $DB_AUTOQUERY = ($data['update_id']>0) ? DB_AUTOQUERY_UPDATE : DB_AUTOQUERY_INSERT; - $id = ($data['update_id']>0) ? $data['update_id'] : $this->db->nextId('mySequence_'.$table_name); - $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']); - if(isset($data['is_cost2']))$fields_values['is_cost2'] = 1;else $fields_values['is_cost2'] = 0; - if(isset($data['cine2']))$fields_values['cine2'] = $data['cine2']; - if(isset($data['params']))$this->saveProductParams($id,$data['params']); - if(isset($data['doc']))$fields_values['doc'] = $data['doc']; - if(isset($data['update_text']))$fields_values['update_text'] = $data['update_text']; - if(isset($data['video_code']))$fields_values['video_code'] = $data['video_code']; - if(isset($data['akcii_id']))$fields_values['akcii_id'] = $data['akcii_id']; - - if(isset($data['translit']))$fields_values['translit'] = $data['translit']; - if($upload['pic']['tmp_name']){ - $delete_pics = (isset($upload['pic']['big']) && $upload['pic']['big']==true)?array('pic','pic2'):array('pic','pic2','pic_big'); - $this->deleteProductPics($id,$delete_pics); - $fields_values['pic'] = upload_ImageResize($upload['pic'],array('width'=>"144",'height'=>"144",'upload_path'=>"./uploaded/pic/catalogs/products/")); - $fields_values['pic2'] = upload_ImageResize($upload['pic'],array('width'=>"244",'height'=>"244",'upload_path'=>"./uploaded/pic/catalogs/products/2/")); - $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/")); - } - - $this->db->autoExecute($table_name,$fields_values,$DB_AUTOQUERY,"id='$id'"); - $this->save_keysProductsFilters($id,$data); - $this->save_keysProductsFilters2($id,$data); - $this->save_keysProductsYears($id,$data); - //$this->save_keysProductsCities($id,$data); - $this->save_keysProductsAkcii($id,$data); - $this->save_keysProductsSex($id,$data); - return $id; - } +function SaveProduct ($data, $upload) +{ + $table_name = "catalogs_products"; + + if (trim (@$data['translit']) == "") + $data['translit'] = translit ($data['name']); + + $DB_AUTOQUERY = ($data['update_id'] > 0) ? DB_AUTOQUERY_UPDATE : DB_AUTOQUERY_INSERT; + $id = ($data['update_id'] > 0) ? $data['update_id'] : $this->db->nextId ('mySequence_' . $table_name); + $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'], + 'update_text' => (int)$data['update_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'] + ); + if (isset ($data['is_cost2'])) + $fields_values['is_cost2'] = 1; + else + $fields_values['is_cost2'] = 0; + if (isset ($data['cine2'])) + $fields_values['cine2'] = $data['cine2']; + if (isset ($data['params'])) + $this->saveProductParams ($id, $data['params']); + if (isset ($data['doc'])) + $fields_values['doc'] = $data['doc']; + if (isset ($data['update_text'])) + $fields_values['update_text'] = $data['update_text']; + if (isset ($data['video_code'])) + $fields_values['video_code'] = $data['video_code']; + if (isset ($data['akcii_id'])) + $fields_values['akcii_id'] = $data['akcii_id']; + + if (isset ($data['translit'])) + $fields_values['translit'] = $data['translit']; + + if ($upload['pic']['tmp_name']) + { + $delete_pics = (isset ($upload['pic']['big']) && $upload['pic']['big'] == true) ? array ( + 'pic', + 'pic2' + ) : array ( + 'pic', + 'pic2', + 'pic_big' + ); + $this->deleteProductPics ($id, $delete_pics); + $fields_values['pic'] = upload_ImageResize ($upload['pic'], array ( + 'width' => "144", + 'height' => "144", + 'upload_path' => "./uploaded/pic/catalogs/products/" + )); + $fields_values['pic2'] = upload_ImageResize ($upload['pic'], array ( + 'width' => "244", + 'height' => "244", + 'upload_path' => "./uploaded/pic/catalogs/products/2/" + )); + $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/" + )); + } + + $this->db->autoExecute ($table_name, $fields_values, $DB_AUTOQUERY, "id='$id'"); + $this->save_keysProductsFilters ($id, $data); + $this->save_keysProductsFilters2 ($id, $data); + $this->save_keysProductsYears ($id, $data); + // $this->save_keysProductsCities($id,$data); + $this->save_keysProductsAkcii ($id, $data); + $this->save_keysProductsSex ($id, $data); + + return $id; +} function save_keysProductsSex($id,$data){ $this->delete_keysProductsSex($id); @@ -2748,10 +2800,15 @@ if(isset($_GET['akciiID']) && $_GET['akciiID']>0)$search[] = sprintf("p.akcii_id return $id; } - function getProductID_R($name,$rubric_parent_id){ - $id = $this->db->getOne("select id from catalogs_products where name=? and rubric_id=?",array($name,$rubric_parent_id)); - return $id; - } +function getProductID_R ($name, $rubric_parent_id) +{ + $id = $this->db->getOne ("select id from catalogs_products where name=? and rubric_id=?", array ( + $name, + $rubric_parent_id + )); + + return $id; +} function getModificationActive($code){ return $this->db->getOne("select active from catalogs_modifications where code=?",array($code)); @@ -3301,7 +3358,7 @@ function viewTmpProducts () break; } } - + $pruduct_date = trim ($row_line [9]); $pruduct_cine = trim ($row_line [10]); $pruduct_cine_last = trim ($row_line [11]); @@ -3324,7 +3381,7 @@ function viewTmpProducts () if ($pruduct_update_id > 0) { $row_product = $this->db->getRow (' - select * + select update_text, about, text from catalogs_products where id=?', array ( $pruduct_update_id @@ -3332,10 +3389,17 @@ function viewTmpProducts () DB_FETCHMODE_ASSOC ); - if ($row_product ['update_text'] == 1) - { - $pruduct_text = $row_product ['text']; - } + // ? + // 0 - + // 1 - + if ($row_product['update_text'] == 1) + { + // about - ukr + $pruduct_about = $row_product['about']; + + // text - ru + $pruduct_text = $row_product['text']; + } } $upload_pruduct = (strlen ($pruduct_pic_tmp) > 0 && is_file ("./uploaded/pic/catalogs/products/big/$pruduct_pic_tmp")) ? array ( @@ -3352,6 +3416,7 @@ function viewTmpProducts () 'brend_id' => $brend_id, 'name' => $pruduct_name, 'about' => $pruduct_about, + 'update_text' => isset ($row_product['update_text']) ? $row_product['update_text'] : 0, 'text' => $pruduct_text, 'video_code' => $pruduct_video, 'sex' => $pruduct_sex, diff --git a/modules/admin/catalogs/product_save.php b/modules/admin/catalogs/product_save.php index 7421461..cf2cb42 100644 --- a/modules/admin/catalogs/product_save.php +++ b/modules/admin/catalogs/product_save.php @@ -1,37 +1,62 @@ trim($_POST); - if(!$objCatalogs->valid($_POST,$_FILES)){ - $saveId = $objCatalogs->SaveProduct($_POST,$_FILES); - if(!$_POST['update_id']){ - $data = array('parent_table'=>"product",'parent_table_id'=>$saveId,'data'=>$_POST); - $objForum->SaveTopic($data,$_FILES); - } - header("location:" . URL . "admin.php?action={$rule['action']}&modAction=products&rubID=" . $_GET['rubID']); - } -}elseif(isset($_GET['updateID']) && $_GET['updateID']>0){ - $objCatalogs->viewProductOne($_GET['updateID'],$row); - $objCatalogs->viewFilterProductID($_GET['updateID']); - $objCatalogs->viewSexProductID($_GET['updateID']); - $objCatalogs->viewFilterProductID2($_GET['updateID']); - $objCatalogs->viewYearsProductID($_GET['updateID']); - $objCatalogs->viewCitiesProductID($_GET['updateID']); - $objCatalogs->viewAkciiProductID($_GET['updateID']); - $objCatalogs->viewProductParams($_GET['updateID']); -} -$objCatalogs->viewRubricsAll(0); -$objCatalogs->viewFiltersAll($_GET['rubID']); -$objCatalogs->viewFilters2($_GET['rubID']); -$objCatalogs->viewYearsAll($_GET['rubID']); -$objCatalogs->viewCities(); -$objCatalogs->viewRubricOne($_GET['rubID'],$row); -$objCatalogs->viewBrends(); - $sex = array(0=>array('id'=>1,'name'=>"",'link'=>'male'), - 1=>array('id'=>2,'name'=>"Ƴ",'link'=>'female'), - 2=>array('id'=>3,'name'=>"",'link'=>'child'), - // 4=>array('name'=>"",'link'=>'unisex') - ); -$objCatalogs->tpl->assign('sex',$sex); -$objCatalogs->displayProduct(); +if (isset ($_POST['save'])) +{ + $objCatalogs->trim ($_POST); + if (! $objCatalogs->valid ($_POST, $_FILES)) + { + $saveId = $objCatalogs->SaveProduct ($_POST, $_FILES); + if (! $_POST['update_id']) + { + $data = array ( + 'parent_table' => "product", + 'parent_table_id' => $saveId, + 'data' => $_POST + ); + $objForum->SaveTopic ($data, $_FILES); + } + header ("location:" . URL . "admin.php?action={$rule['action']}&modAction=products&rubID=" . $_GET['rubID']); + } +} +elseif (isset ($_GET['updateID']) && $_GET['updateID'] > 0) +{ + $objCatalogs->viewProductOne ($_GET['updateID'], $row); + $objCatalogs->viewFilterProductID ($_GET['updateID']); + $objCatalogs->viewSexProductID ($_GET['updateID']); + $objCatalogs->viewFilterProductID2 ($_GET['updateID']); + $objCatalogs->viewYearsProductID ($_GET['updateID']); + $objCatalogs->viewCitiesProductID ($_GET['updateID']); + $objCatalogs->viewAkciiProductID ($_GET['updateID']); + $objCatalogs->viewProductParams ($_GET['updateID']); +} + + $objCatalogs->viewRubricsAll (0); + $objCatalogs->viewFiltersAll ($_GET['rubID']); + $objCatalogs->viewFilters2 ($_GET['rubID']); + $objCatalogs->viewYearsAll ($_GET['rubID']); + $objCatalogs->viewCities (); + $objCatalogs->viewRubricOne ($_GET['rubID'], $row); + $objCatalogs->viewBrends (); + $sex = array ( + 0 => array ( + 'id' => 1, + 'name' => "", + 'link' => 'male' + ), + 1 => array ( + 'id' => 2, + 'name' => "Ƴ", + 'link' => 'female' + ), + 2 => array ( + 'id' => 3, + 'name' => "", + 'link' => 'child' + ) + ) + // 4=>array('name'=>"",'link'=>'unisex') + ; + $objCatalogs->tpl->assign ('sex', $sex); + $objCatalogs->displayProduct (); + ?> -- libgit2 0.21.4