$replace['date'] = sql_to_text_date($replace['date'], 0, 1); if ($admin_config['order_status']) { $arr = explode(",", $admin_config['order_office']); $where_off = '('; foreach ($arr as $k => $v) { if ($k) { $where_off .= " OR "; } $where_off .= "office_id={$v}"; } $where_off .= ')'; $replace['office_select'] = mysql_select('office_id', "SELECT office_id, region FROM " . TABLE_OFFICE . " WHERE {$where_off} ORDER BY office_id", $replace['office_id'], 0, "", $office_count); } $replace['order_status'] = $admin_config['order_status']; $replace['date_pay'] = $date_pay = $replace['date_pay'] && $replace['date_pay'] != '0000-00-00' ? sql_to_text_date($replace['date_pay'], 0, 1) : ($replace['date_prepay'] && $replace['date_prepay'] != '0000-00-00' ? sql_to_text_date($replace['date_prepay'], 0, 1) : ''); $replace['birthdays'] = client_birthdays($replace['clients'], $replace['date_from'], $replace['date_to'], $replace['date'], $replace['date_pay']); /*foreach(explode("\n", $replace['birthday']) as $v) { $v = trim($v); $bd = birthday_search($v, $replace['date_from'], $replace['date_to'], $replace['date'], $replace['date_pay']); if(count($bd) && $bd!=0) { if($replace['birthdays']) $replace['birthdays'] .= "<br>"; $bd_str = join("<br>", $bd); $replace['birthdays'] .= $bd_str; } }*/ $replace['client_table'] = client_table($replace['clients'], $order_id); $sql = mysql_query("SELECT stamp FROM " . TABLE_DOC . " z WHERE order_id={$order_id} AND type='zayavka'") or Error(1, __FILE__, __LINE__);
if ($order_id) { $sql = mysql_query("\n\t\tSELECT \n\t\t\tz.*, ct.country_id, ob.recomm_commission\n\t\tFROM \n\t\t\t{$tables}\n\t\tWHERE\n\t\t\tz.order_id={$order_id} {$where}\n\t\t") or Error(1, __FILE__, __LINE__); if (!mysql_num_rows($sql)) { $content = 'Неверно выбрана заявка'; return; } $replace = mysql_fetch_array($sql); $replace['all_link'] = $all_link; foreach ($data_arr4 as $v) { $replace[$v] = htmlspecialchars($replace[$v], ENT_COMPAT, 'cp1251'); } $date_pay = $replace['date_pay'] && $replace['date_pay'] != '0000-00-00' ? sql_to_text_date($replace['date_pay'], 0, 1) : ($replace['date_prepay'] && $replace['date_prepay'] != '0000-00-00' ? sql_to_text_date($replace['date_prepay'], 0, 1) : ''); $date = sql_to_text_date($replace['date'], 0, 1); $date_from = sql_to_text_date($replace['date_from'], 0, 1); $date_to = sql_to_text_date($replace['date_to'], 0, 1); $replace['birthdays'] = client_birthdays($replace['clients'], $date_from, $date_to, $date, $date_pay); /*foreach(explode("\n", $replace['birthday']) as $v) { $v = trim($v); $bd = birthday_search($v, $date_from, $date_to, $date, $date_pay); if(count($bd)) { if($replace['birthdays']) $replace['birthdays'] .= "<br>"; $bd_str = count($bd) > 1 ? join("<br>", $bd) : $bd[0]; $replace['birthdays'] .= $bd_str; } }*/ $fio_list = split("(\r)?\n", $replace['fio']); $replace['fio_count'] = $replace['fio'] ? count($fio_list) : 0;