protected function get_row_query_Html_temp()
 {
     $html = '<td class="show_hide" ' . $this->open_close_rowspan . '="' . $this->rowspan . '"><span class="cabinett_row_hide ' . $this->open_close_class . '"></span></td>';
     // маркер не прикрепленного клиента
     // $js_message = 'Чтобы перейти в РТ необходимо прикрепить клиента!!!';
     $the_client_is_not_attached = 'onClick="return false;"';
     $href_RT = '#';
     if ($this->Query['client_id'] > 0) {
         $the_client_is_not_attached = '';
         $href_RT = './?page=client_folder&client_id=' . $this->Query['client_id'] . '&query_num=' . $this->Query['query_num'];
     }
     $html .= '<td class="rt_href_click"><a ' . $the_client_is_not_attached . ' href="' . $href_RT . '">' . $this->Query['query_num'] . '</a> </td>';
     $no_edit = 1;
     if ($this->Query['client_id'] == 0) {
         $no_edit = 0;
         if ($this->user_access != 1) {
             $no_edit = 1;
         }
     }
     $html .= $this->get_client_name_for_query_Database($this->Query['client_id'], $no_edit);
     $html .= '<td class="show_main_menu query_theme_and_comment">';
     $html .= '<div class="table" style="width:100%">';
     $html .= '<div class="row">';
     $html .= '<div clas="cell">';
     // тема
     $html .= $this->Query['theme'];
     $html .= '</div>';
     $html .= '<div class="cell">';
     // комментарии
     $html .= '<span data-rt_list_query_num="' . $this->Query['query_num'] . '" class="icon_comment_show white ' . Comments_for_query_class::check_the_empty_query_coment_Database($this->Query['query_num']) . '"></span>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</td>';
     $html .= '<td class="show_main_menu">';
     if ($this->user_access == 1) {
         $no_edit = 0;
     }
     // if($this->user_access != 1 && $this->Query['client_id'] == 0){
     if ($this->user_access != 1) {
         $no_edit = 1;
     } else {
         $no_edit = 0;
     }
     $html .= '<div>' . $this->get_all_manager_name_Database_Html($this->Query, $no_edit) . '</div>';
     // если не история - считаем сколько времени назад взяли заказ в работу
     if ($_GET['subsection'] != 'query_history') {
         $html .= '<div style="padding-top: 5px;"><span class="greyText" data-sec="' . $this->Query['time_attach_manager_sec'] * -1 . '" ' . $this->overdue . '>' . $this->Query['time_attach_manager'] . '</span></div>';
     }
     $html .= '</td>';
     $html .= '<td class="show_main_menu">' . $this->Query['create_time'] . '</td>';
     $html .= '<td class="show_main_menu"></td>';
     $html .= '<td class="show_main_menu"></td>';
     // $rrr = RT::calcualte_query_summ($this->Query['query_num']);
     $rrr = $this->price_for_the_position_ITOGO;
     $html .= '<td class="show_main_menu" td="' . $rrr . '">' . $rrr . '</td>';
     $html .= '<td class="' . $this->Query['status'] . '_' . $this->user_access . ' show_main_menu query_status">' . $this->status_or_button . '</td>';
     return $html;
 }
Exemple #2
0
 static function add_data_from_basket($client_id, $manager_id_arr, $customer_data = FALSE, $dop_info = FALSE)
 {
     global $mysqli;
     // print_r($manager_id_arr); echo '--'; exit;
     $user_id = $_SESSION['access']['user_id'];
     //
     $date = date('Y-m-d H:i:s');
     // содержимое корзины
     $basket_arr = $_SESSION['basket'];
     //print_r($dop_info_arr);
     //exit;
     foreach ($basket_arr as $key => $basket_data) {
         $id = $basket_data['article'];
         $characteristics = array();
         // выбираем из базы каталога данные об артикуле
         $query = "SELECT*FROM `" . BASE_TBL . "` WHERE id = '" . $id . "'";
         $result = $mysqli->query($query) or die($mysqli->error);
         $art_data = $result->fetch_assoc();
         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
         //                                         получаем цвета артикула                                           //
         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
         $query = "SELECT color FROM `" . BASE_COLORS_TBL . "` WHERE  art_id ='" . $id . "' AND color<>''";
         $result = $mysqli->query($query) or die($mysqli->error);
         while ($item = $result->fetch_assoc()) {
             $characteristics['colors'][] = $item['color'];
         }
         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
         //                                      получаем материалы артикула                                          //
         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
         $query = "SELECT*FROM `" . BASE_MATERIALS_TBL . "` WHERE  art_id ='" . $id . "'";
         $result = $mysqli->query($query) or die($mysqli->error);
         while ($item = $result->fetch_assoc()) {
             $characteristics['materials'][] = $item['material'];
         }
         require_once ROOT . "/libs/php/classes/rt_calculators_class.php";
         $characteristics = count($characteristics) > 0 ? rtCalculators::json_fix_cyr(json_encode($characteristics)) : '';
         //print_r($dop_info);
         if ($dop_info) {
             $data_arr[$key]['dop_info'] = $dop_info[$key];
         }
         $data_arr[$key]['art_id'] = $basket_data['article'];
         $data_arr[$key]['art'] = $art_data['art'];
         $data_arr[$key]['type'] = 'cat';
         $data_arr[$key]['name'] = $art_data['name'];
         $data_arr[$key]['description'] = $art_data['description'];
         $data_arr[$key]['characteristics'] = $characteristics;
         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
         //                                      формируем  tirage_json                                               //
         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
         if (!empty($basket_data['size_id']) && $basket_data['size_id'] != 'undefined') {
             // если id размера( id строки из BASE_DOP_PARAMS_TBL) указано в корзине используем эту информацию
             $tirage_json = array();
             $tirage_json[$basket_data['size_id']] = array("dop" => "0", "tir" => $basket_data['quantity']);
             $tirage_json = json_encode($tirage_json);
         } else {
             // иначе обращаемся к BASE_DOP_PARAMS_TBL и считываем данные
             $query = "SELECT*FROM `" . BASE_DOP_PARAMS_TBL . "` WHERE  art_id ='" . $id . "'";
             $result = $mysqli->query($query) or die($mysqli->error);
             if ($result->num_rows > 0) {
                 $item = $result->fetch_assoc();
                 $tirage_json = array();
                 $tirage_json[$item['id']] = array("dop" => "0", "tir" => $basket_data['quantity']);
                 $tirage_json = json_encode($tirage_json);
             } else {
                 $tirage_json = '{}';
             }
         }
         $data_arr[$key]['dop_data'][0]['quantity'] = $basket_data['quantity'];
         $data_arr[$key]['dop_data'][0]['price_out'] = $basket_data['price'];
         $data_arr[$key]['dop_data'][0]['tirage_json'] = $tirage_json;
         unset($tirage_json);
         /*
         				// пока нет калькуляторов это не востребованно 
         				
         				
         			    // это просто пример
         				$data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['glob_type'] = 'print';
         				$data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['type'] = '';
         				$data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['quantity'] = $basket_data['quantity'];
         				$data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['price_in'] = 1;
         				$data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['price_out'] = 10;
         */
     }
     $query_num = RT::create_new_query($client_id, $manager_id_arr, $data_arr);
     /**
      *	сохраняем данные введённые в форму 
      *  отправки заказа из корзины в комментарии по запросу	
      *
      *	@author  Алексей Капитонов
      *	@version 15:60 30.10.2015
      */
     // ini_set('error_reporting', E_ALL);
     // ini_set('display_errors', 1);
     // ini_set('display_startup_errors', 1);
     // -->  START  <-- //
     if ($customer_data) {
         include_once ROOT . "/libs/php/classes/comments_class.php";
         $COMMENTS = new Comments_for_query_class();
         $text = trim($customer_data['name']) != '' ? 'Имя: ' . $customer_data['name'] . '<br>' : '';
         $text .= trim($customer_data['reg_phone']) != '' ? 'Телефон: ' . $customer_data['reg_phone'] . '<br>' : '';
         $text .= trim($customer_data['email']) != '' ? 'E-mail: ' . $customer_data['email'] . '<br>' : '';
         $text .= trim(cor_data_for_SQL($customer_data['coment'])) != '' ? 'Пожелания: ' . cor_data_for_SQL($customer_data['coment']) . '<br>' : '';
         $COMMENTS->save_query_comment_Pub(0, $query_num, 'Клиент', $text);
         // -->   END   <-- //
     }
     return $query_num;
 }