예제 #1
0
파일: order.php 프로젝트: nikuha/rs
            $disabled = $suite['status'] && $suite['ncount'] == 1 ? 'disabled' : '';
            $suite['count_select'] = array_select("suite_list[{$suite['suite_id']}]", $arr, $val, 0, $disabled);
            //$suite['value'] = (int)@$suite_data_list[$suite['suite_id']] ? (int)@$suite_data_list[$suite['suite_id']] : 0;
            $suite_list[] = $suite;
        }
        $replace['suite_list'] = $suite_list;
        $sql = mysql_query("SELECT recomm FROM " . TABLE_OBJECT . " where object_id={$object_id}") or Error(1, __FILE__, __LINE__);
        $info = @mysql_fetch_array($sql);
        $info['recomm'] = htmlspecialchars(@$info['recomm'], ENT_QUOTES, 'cp1251');
        $info['recomm'] = preg_replace("/(\r\n)/", "; ", $info['recomm']);
        $replace['confirm'] = $info['recomm'] ? "Пожалуйста, предложите туристу дополнительные услуги: " . $info['recomm'] : '';
    }
    $content = get_template('templ/order_add.htm', $replace);
    return;
}
$where = ' AND !z.basket' . get_order_cond($admin_config);
$tables = TABLE_ORDER . " z \n\t\tLEFT JOIN " . TABLE_OBJECT . " ob on (ob.object_id=z.object_id) \n\t\tLEFT JOIN " . TABLE_CITY . " ct ON (ob.city_id=ct.city_id)";
$object_recomm = "ob.recomm, ob.recomm_provider, ob.recomm_commission";
if ($step == 2) {
    $sql = mysql_query("\n\t\tSELECT \n\t\t\tz.*, ct.name as city, {$object_recomm}, ag.status as agency_status\n\t\tFROM \n\t\t\t{$tables}\n\t\t\tLEFT JOIN " . TABLE_AGENCY . " ag ON (ag.agency_id=z.agency_id)\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);
    foreach ($data_arr2 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);
예제 #2
0
파일: func_admin.php 프로젝트: nikuha/rs
function attention_list($limit = 0)
{
    global $settings, $attention_win;
    global $admin_config;
    $where = "!z.basket AND z.status!=0 AND !z.noatten" . get_order_cond($admin_config, 'attention');
    $where_tr = array();
    $where_tr[] = "(z.inall+z.debt < z.provider_sum AND z.provider_sum>0 AND z.inall>0)";
    $where_tr[] = "(z.inall+z.debt>z.provider_sum AND z.provider_sum>0 AND (z.inall+z.debt-z.provider_sum)>z.inall*" . ATTENTION_PERCENT . ")";
    $where_tr[] = "z.provider_id=0";
    //$where_tr[] = "((cl.birthday_city='' OR cl.birthday_city IS NULL) AND !cl.city_id AND !z.porder_id)";
    $where_tr[] = "(!cl.city_id AND !z.porder_id)";
    $where_tr1 = " (" . implode(' OR ', $where_tr) . " ) AND z.date > CURDATE() - INTERVAL " . (int) $settings['attention_days'] . " DAY ";
    $where_tr = array();
    $where_tr[] = "(!z.paid AND !z.prepaid)";
    $where_tr[] = "( (!z.paid AND z.prepaid AND z.inall>z.prepayment) AND !z.nameste)";
    $where_tr[] = " (!z.paytoprovider AND !z.paid_provider)";
    $where_tr2 = " (" . implode(' OR ', $where_tr) . " ) AND z.date_from < CURDATE() + INTERVAL " . (int) $settings['nopay_days'] . " DAY \n\t\t  AND z.date_from > CURDATE() - INTERVAL 3 MONTH ";
    $where .= " AND ( ({$where_tr1}) OR ({$where_tr2}) )";
    $provider_sum = get_sql_provider_sum();
    if (!$limit) {
        $limit = ATTENTION_LIMIT;
    }
    $sql = mysql_query("\n\t\tSELECT \n\t\t\tz.order_id, z.paid, z.prepaid, z.user_id,\n\t\t\tz.provider_id, z.inall, z.provider_sum, z.debt,\n\t\t\tob.name as object_name, u.name as user_name, cl.city_id,\n\t\t\t({$where_tr2}) as nopaid\n\t\tFROM \n\t\t\t" . TABLE_ORDER . " z \n\t\t\tLEFT JOIN " . TABLE_OFFICE . " r on (r.office_id=z.office_id) \n\t\t\tLEFT JOIN " . TABLE_OBJECT . " ob on (ob.object_id=z.object_id) \n\t\t\tLEFT JOIN " . TABLE_USER . " u on (u.user_id=z.user_id) \n\t\t\tLEFT JOIN " . TABLE_CLIENT . " cl on (cl.client_id=SUBSTRING_INDEX( z.clients, ',', 1 )) \n\t\tWHERE\n\t\t\t{$where}\n\t\tGROUP BY\n\t\t\tz.order_id\n\t\tORDER BY \n\t\t\tz.date desc, z.porder_id, z.order_id desc\n\t\tLIMIT " . $limit) or Error(1, __FILE__, __LINE__);
    $list = array();
    while ($info = @mysql_fetch_array($sql)) {
        $info['object_name'] = htmlspecialchars($info['object_name'], ENT_COMPAT, 'cp1251');
        $info['problem'] = '';
        if ($info['inall'] + $info['debt'] < $info['provider_sum'] && $info['inall'] > 0) {
            $info['problem'] = 'отриц. баланс';
        } elseif ($info['inall'] + $info['debt'] > $info['provider_sum'] && $info['provider_sum'] > 0 && $info['inall'] + $info['debt'] - $info['provider_sum'] > $info['inall'] * ATTENTION_PERCENT) {
            $pr = (int) (($info['inall'] + $info['debt'] - $info['provider_sum']) * 100 / $info['inall']);
            $info['problem'] = 'сверхпр.' . " {$pr}% ";
        } elseif ($info['provider_id'] == 0) {
            $info['problem'] = 'без постав.';
        } elseif ($info['nopaid']) {
            $info['problem'] = 'неоплачена';
        } elseif (!$info['city_id']) {
            $info['problem'] = 'не указан город';
        }
        if ($admin_config['attention_status']) {
            $info['edit'] = "?p=search&noatten={$info['order_id']}";
        }
        if ($info['user_id'] == $_SESSION['admin_id']) {
            $attention_win[$info['order_id']] = "<a href=\"?p=order&order_id={$info['order_id']}\">{$info['order_id']}</a>  {$info['problem']}";
        }
        $list[] = $info;
    }
    return $list;
}
예제 #3
0
파일: print.php 프로젝트: nikuha/rs
    $sql = mysql_query("\n\t\tSELECT \n\t\t\td.text\n\t\tFROM \n\t\t\t" . TABLE_DOC_A . " d \n\t\tLIMIT\n\t\t\t1\n\t\t") or Error(1, __FILE__, __LINE__);
    if (!($arr = @mysql_fetch_array($sql))) {
        echo "Нет найдены данные по указанному id";
        exit;
    }
    $text = $arr['text'];
    if ($part == 'print') {
        echo $text;
    } else {
        $filename = "{$type}_{$agency_id}.doc";
        header("Content-Type: application/msword; charset=\"windows-1251\"");
        header("Content-Disposition: attachment; filename=\"{$filename}\"");
        echo $text;
    }
} else {
    $where = get_order_cond($admin_config);
    $sql = mysql_query("\n\t\tSELECT \n\t\t\td.doc_id\n\t\tFROM \n\t\t\t" . TABLE_DOC . " d \n\t\t\tLEFT JOIN " . TABLE_ORDER . " z ON (z.order_id=d.order_id)\n\t\t\tLEFT JOIN " . TABLE_OBJECT . " ob on (ob.object_id=z.object_id) \n\t\t\tLEFT JOIN " . TABLE_CITY . " ct ON (ob.city_id=ct.city_id)\n\t\tWHERE\n\t\t\tz.order_id={$order_id} AND d.type='{$type}' {$where}\n\t\tLIMIT\n\t\t\t1\n\t\t") or Error(1, __FILE__, __LINE__);
    if (!($arr = @mysql_fetch_array($sql))) {
        echo "Нет прав доступа к указанной заявке";
        exit;
    }
    $doc_id = $arr['doc_id'];
    $fn = "doc/{$doc_id}.htm";
    $f = fopen($fn, 'r');
    $text = fread($f, filesize($fn));
    fclose($f);
    if ($part == 'print') {
        echo $text;
    } elseif ($part == 'word') {
        if ($type == 'dogovor2') {
            $type = 'dogovor';