function zayav_info() { if (!($zayav_id = _num(@$_GET['id']))) { return _err('Страницы не существует'); } $sql = "SELECT *\n\t\t\tFROM `zayav`\n\t\t\tWHERE `ws_id`=" . WS_ID . "\n\t\t\t AND !`deleted`\n\t\t\t AND `id`=" . $zayav_id; if (!($z = query_assoc($sql))) { return _err('Заявки не существует.'); } $z['pre_cost'] = _cena($z['pre_cost']); $status = _zayavStatus(); unset($status[0]); $history = _history(array('zayav_id' => $zayav_id)); return '<script type="text/javascript">' . 'var ZAYAV={' . 'id:' . $zayav_id . ',' . 'nomer:' . $z['nomer'] . ',' . 'head:"№<b>' . $z['nomer'] . '</b>",' . 'client_id:' . $z['client_id'] . ',' . 'client_link:"' . addslashes(_clientVal($z['client_id'], 'link')) . '",' . 'status:' . $z['status'] . ',' . 'status_sel:' . _selJson($status) . ',' . 'name:"' . addslashes($z['name']) . '",' . 'about:"' . addslashes($z['about']) . '",' . 'count:' . $z['count'] . ',' . 'adres:"' . addslashes($z['adres']) . '",' . 'pre_cost:' . $z['pre_cost'] . '};' . '</script>' . '<div id="zayav-info">' . '<div id="dopLinks">' . '<a class="link a-page sel">Информация</a>' . '<a class="link" id="edit">Редактирование</a>' . '<a class="link _accrual-add">Начислить</a>' . '<a class="link _income-add">Принять платёж</a>' . '<a class="link a-page">История</a>' . '</div>' . '<div class="page">' . '<div class="headName">' . 'Заявка №' . $z['nomer'] . '<input type="hidden" id="zayav-action" />' . '</div>' . '<table id="tab">' . '<tr><td class="label">Клиент:<td>' . _clientVal($z['client_id'], 'go') . '<tr><td class="label">Название:<td><b>' . $z['name'] . '</b>' . '<tr><td class="label">Описание:<td>' . $z['about'] . '<tr><td class="label">Количество:<td><b>' . $z['count'] . '</b> шт.' . ($z['adres'] ? '<tr><td class="label">Адрес:<td>' . $z['adres'] : '') . ($z['pre_cost'] ? '<tr><td class="label">Стоимость:<td><b>' . $z['pre_cost'] . '</b> руб.' : '') . '<tr><td class="label">Дата приёма:' . '<td class="dtime_add' . _tooltip('Заявку ' . _viewerAdded($z['viewer_id_add']), -70) . FullDataTime($z['dtime_add']) . '<tr><td class="label">Статус:<td>' . _zayavStatusButton($z) . '</table>' . _zayavInfoAccrual($zayav_id) . _zayav_expense($zayav_id) . _remind_zayav($zayav_id) . _zayavInfoMoney($zayav_id) . _vkComment('zayav', $zayav_id) . '</div>' . '<div class="page dn">' . '<div class="headName">Заявка №' . $z['nomer'] . ' - история действий</div>' . $history['spisok'] . '</div>' . '</div>'; }
jsonSuccess(); break; case 'zayav_spisok': $_POST['find'] = win1251($_POST['find']); $data = zayav_spisok($_POST); if ($data['filter']['page'] == 1) { $send['all'] = utf8($data['result']); } $send['spisok'] = utf8($data['spisok']); jsonSuccess($send); break; case 'zayav_status': if (!($zayav_id = _num($_POST['zayav_id']))) { jsonError(); } if (!($zayav_status = _num($_POST['status']))) { jsonError(); } $sql = "SELECT * FROM `zayav` WHERE `ws_id`=" . WS_ID . " AND !`deleted` AND `id`=" . $zayav_id; if (!($z = query_assoc($sql))) { jsonError(); } if ($z['status'] == $zayav_status) { jsonError(); } $sql = "UPDATE `zayav`\n\t\t\t\tSET `status`=" . $zayav_status . ",\n\t\t\t\t\t`status_dtime`=CURRENT_TIMESTAMP\n\t\t\t\tWHERE `id`=" . $zayav_id; query($sql); _history(array('type_id' => 71, 'client_id' => $z['client_id'], 'zayav_id' => $zayav_id, 'v1' => $z['status'], 'v2' => $zayav_status)); jsonSuccess(); break; }