示例#1
0
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>';
}
示例#2
0
     if (!($z = query_assoc($sql))) {
         jsonError();
     }
     $sql = "UPDATE `zayav` SET\n\t\t\t\t\t`client_id`=" . $client_id . ",\n\t\t\t\t\t`count`=" . $count . ",\n\t\t\t\t\t`name`='" . addslashes($name) . "',\n\t\t\t\t\t`about`='" . addslashes($about) . "',\n\t\t\t\t\t`adres`='" . addslashes($adres) . "',\n\t\t\t\t\t`pre_cost`=" . $pre_cost . ",\n\t\t\t\t\t`find`='" . addslashes($name) . "'\n\t\t\t\tWHERE `id`=" . $zayav_id;
     query($sql);
     if ($z['client_id'] != $client_id) {
         $sql = "UPDATE `_money_accrual`\n\t\t\t\t\tSET `client_id`=" . $client_id . "\n\t\t\t\t\tWHERE `app_id`=" . APP_ID . "\n\t\t\t\t\t  AND `ws_id`=" . WS_ID . "\n\t\t\t\t\t  AND `zayav_id`=" . $zayav_id . "\n\t\t\t\t\t  AND `client_id`=" . $z['client_id'];
         query($sql, GLOBAL_MYSQL_CONNECT);
         $sql = "UPDATE `_money_income`\n\t\t\t\t\tSET `client_id`=" . $client_id . "\n\t\t\t\t\tWHERE `app_id`=" . APP_ID . "\n\t\t\t\t\t  AND `ws_id`=" . WS_ID . "\n\t\t\t\t\t  AND `zayav_id`=" . $zayav_id . "\n\t\t\t\t\t  AND `client_id`=" . $z['client_id'];
         query($sql, GLOBAL_MYSQL_CONNECT);
         $sql = "UPDATE `_money_refund`\n\t\t\t\t\tSET `client_id`=" . $client_id . "\n\t\t\t\t\tWHERE `app_id`=" . APP_ID . "\n\t\t\t\t\t  AND `ws_id`=" . WS_ID . "\n\t\t\t\t\t  AND `zayav_id`=" . $zayav_id . "\n\t\t\t\t\t  AND `client_id`=" . $z['client_id'];
         query($sql, GLOBAL_MYSQL_CONNECT);
         clientBalansUpdate($z['client_id']);
         clientBalansUpdate($client_id);
     }
     $changes = _historyChange('Клиент', $z['client_id'], $client_id, _clientVal($z['client_id'], 'go'), _clientVal($client_id, 'go')) . _historyChange('Название', $z['name'], $name) . _historyChange('Описание', $z['about'], $about) . _historyChange('Количество', $z['count'], $count) . _historyChange('Адрес', $z['adres'], $adres) . _historyChange('Стоимость', _cena($z['pre_cost']), $pre_cost);
     if ($changes) {
         _history(array('type_id' => 72, 'client_id' => $z['client_id'], 'zayav_id' => $zayav_id, 'v1' => '<table>' . $changes . '</table>'));
     }
     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':