Example #1
0
File: card.php Project: nikuha/rs
 $ord = "{$sort} {$sortdirect}";
 //$ord = "$sort $sortdirect";
 $replace['sort'] = $sort;
 $replace['sortdirect'] = $sortdirect;
 $where = 'c.active!=0';
 $extra_table = '';
 $extra_table_cond = 'z.card_id=c.card_id AND z.card_vip=c.vip';
 $extra_fields = '';
 if ($mindate) {
     $extra_table_cond .= " AND z.date>='{$mindate}'";
 }
 if ($maxdate) {
     $extra_table_cond .= " AND z.date<='{$maxdate}'";
 }
 $replace['mindate'] = $mindate ? sql_to_text_date($mindate, 0, 1) : '';
 $replace['maxdate'] = $maxdate ? sql_to_text_date($maxdate, 0, 1) : '';
 if ($mindate || $maxdate) {
     $extra_table .= "LEFT JOIN " . TABLE_ORDER . " z ON (z.status=1 AND {$extra_table_cond})";
     $where .= " AND !z.card_first";
     $extra_fields .= ", count(z.order_id) as o_count, SUM(z.inall) as o_summa";
 }
 $sql = mysql_query("SELECT count(*) FROM " . TABLE_CARD . " c {$extra_table} WHERE {$where} ") or Error(1, __FILE__, __LINE__);
 $arr = mysql_fetch_array($sql);
 $replace['all'] = $all = $arr[0];
 list($limit, $replace['pages']) = pages($all, ADMIN_URL . "?p={$part}&");
 $sql = mysql_query("SELECT c.* {$extra_fields} FROM " . TABLE_CARD . " c\n\t\t\t{$extra_table}\n\t\t\tWHERE {$where}  \n\t\t\tGROUP BY c.card_id\n\t\t\tORDER BY {$ord} LIMIT {$limit}") or Error(1, __FILE__, __LINE__);
 $cards = array();
 $card_name = "";
 while ($info = @mysql_fetch_array($sql)) {
     $info['fio'] = htmlspecialchars($info['fio'], ENT_COMPAT, 'cp1251');
     $info['o_count'] = (int) @$info['o_count'];
Example #2
0
File: tz.php Project: nikuha/rs
    $info['pages'] = $pages;
    $info['tztype_list'] = $type_list;
    $content = get_template('templ/tz.htm', $info);
    return;
}
$sql = mysql_query("SELECT COUNT(*) FROM " . TABLE_TZ . " t WHERE t.type={$type} ") or Error(1, __FILE__, __LINE__);
$arr1 = mysql_fetch_array($sql);
$replace['all'] = $all = $arr1[0];
list($limit, $replace['pages']) = pages($all, $url_m . "&type={$type}&");
$sql1 = mysql_query("SELECT t.*, u.name as uname, count(distinct o.opinion_id) as ocount FROM " . TABLE_TZ . " t  \n\t\tLEFT JOIN " . TABLE_USER . " u ON (u.user_id=t.user_id)\n\t\tLEFT JOIN " . TABLE_OPINION . " o ON (o.news_id=t.tz_id AND o.type=2)\n\tWHERE t.type={$type}  \n\tGROUP BY t.tz_id\n\tORDER BY ord\n\tLIMIT {$limit}") or Error(1, __FILE__, __LINE__);
$tzs = array();
//$i = $_SESSION['on_page'] * ($current_page - 1);
while ($info = @mysql_fetch_array($sql1)) {
    /*$i++;
    	$info['i'] = $i;*/
    $info['name'] = htmlspecialchars($info['name'], ENT_COMPAT, 'cp1251');
    if (strlen($info['description']) > 150 && $type != 1) {
        $info['description'] = substr($info['description'], 0, 150) . "...";
    }
    $info['description'] = nl2br(htmlspecialchars($info['description'], ENT_COMPAT, 'cp1251'));
    $info['uname'] = htmlspecialchars($info['uname'], ENT_COMPAT, 'cp1251');
    $info['edit_link'] = "?p={$part}&tz_id={$info['tz_id']}";
    $info['date'] = sql_to_text_date($info['date']);
    $info['date_start'] = sql_to_text_date($info['date_start']);
    $info['date_end'] = sql_to_text_date($info['date_end']);
    $tzs[] = $info;
}
$replace['tzs'] = $tzs;
$replace['part'] = $part;
$replace['addlink'] = "{$url_m}&addtz={$type}";
$content = get_template('templ/tz_list.htm', $replace);
Example #3
0
function event_list()
{
    global $admin_config, $attention_win;
    $where = "( (e.type=3 AND concat(e.date, ' ', e.time)>=NOW()) OR (e.type!=3 AND concat(e.date, ' ', e.time)<=NOW()) )\n\t\tAND (e.public OR e.user_id={$_SESSION['admin_id']}) AND !e.status";
    $list = array();
    $sql = mysql_query("\n\t\tSELECT \n\t\t\te.event_id, e.name, e.date, e.time, e.public, e.type, e.user_id, n.link\n\t\tFROM \n\t\t\t" . TABLE_EVENT . "  e\n\t\t\tLEFT JOIN " . TABLE_NEWS . " n ON (n.news_id=e.o_id)\n\t\tWHERE\n\t\t\t{$where}\n\t\tORDER BY \n\t\t\te.date, e.time") or Error(1, __FILE__, __LINE__);
    while ($info = @mysql_fetch_array($sql)) {
        $info['name'] = htmlspecialchars($info['name'], ENT_COMPAT, 'cp1251');
        $info['date'] = sql_to_text_date($info['date']);
        $info['time'] = substr($info['time'], 0, 5);
        if (!$info['public']) {
            $info['name'] .= " " . $info['date'] . " " . $info['time'];
        }
        $info['link'] = $info['type'] == 3 && $info['link'] ? $info['link'] . "\" target=\"_blank" : "?p=event&event_id={$info['event_id']}";
        if ($info['user_id'] == $_SESSION['admin_id']) {
            $attention_win['event' . $info['event_id']] = "<a href=\"?p=event&event_id={$info['event_id']}\">{$info['name']}</a>";
        }
        $list[] = $info;
    }
    return $list;
}
Example #4
0
File: quest.php Project: nikuha/rs
        if ($where_obj && $where_city) {
            $where .= " AND (({$where_obj}) OR ({$where_city}))";
        } elseif ($where_obj) {
            $where .= " AND ({$where_obj})";
        } elseif ($where_city) {
            $where .= " AND ({$where_city})";
        }
        if ($where_user) {
            $z = " AND (" . str_replace('u.', 'z.', $where_user) . ")";
        }
        $sql = mysql_query("\n\t\t\tSELECT \n\t\t\t\tcount(*) \n\t\t\tFROM \n\t\t\t\t" . TABLE_QUESTDATA . " a\n\t\t\t\t{$city_table}\n\t\t\tWHERE\n\t\t\t\t{$where}") or Error(1, __FILE__, __LINE__);
        $arr = mysql_fetch_array($sql);
        $replace['all'] = $all = $arr[0];
        list($limit, $replace['pages']) = pages($all, ADMIN_URL . "?p={$part}&data&");
        $replace['current_page'] = $current_page;
        $replace['data'] = array();
        $sql = mysql_query("\n\t\t\tSELECT \n\t\t\t\ta.*,\n\t\t\t\tob.name as object_name, ct.name as city_name, u.name as username\n\t\t\tFROM \n\t\t\t\t" . TABLE_QUESTDATA . " a\n\t\t\t\t{$city_table}\n\t\t\tWHERE\n\t\t\t\t{$where}\n\t\t\tGROUP BY\n\t\t\t\ta.questdata_id\n\t\t\tORDER BY \n\t\t\t\t{$ord}\n\t\t\tLIMIT {$limit}") or Error(1, __FILE__, __LINE__);
        $list = array();
        while ($info = @mysql_fetch_array($sql)) {
            $info['object_name'] .= "<br>" . $info['city_name'];
            $info['date'] = sql_to_text_date($info['date']);
            $info['edit_link'] = "?p={$part}&data&questdata_id={$info['questdata_id']}&page={$current_page}";
            if ($questdata_id == $info['questdata_id']) {
                $replace['data'] = @unserialize($info['data']) or array();
            }
            $list[] = $info;
        }
        $replace['list'] = $list;
    }
    $content = get_template('templ/questdata_list.htm', $replace);
}
Example #5
0
    $sql = mysql_query("SELECT c.*, concat(g.name, ' / ', r.name) as city FROM " . TABLE_CLIENT . " c \n\t\tLEFT JOIN " . TABLE_CLIENT_CITIES . " g ON (g.city_id=c.city_id)\n\t\tLEFT JOIN " . TABLE_CLIENT_REGIONS . " r ON (r.region_id=g.region_id)\n\t\tWHERE client_id={$client_id}") or Error(1, __FILE__, __LINE__);
    if ($client = @mysql_fetch_array($sql)) {
        $client['birthday'] = sql_to_text_date($client['birthday'], 0, 1);
        $title = $client['name'] = htmlspecialchars($client['name'], ENT_COMPAT, 'cp1251');
        $client['pasport'] = htmlspecialchars($client['pasport'], ENT_COMPAT, 'cp1251');
        $client['text'] = htmlspecialchars($client['text'], ENT_COMPAT, 'cp1251');
        $client['email'] = htmlspecialchars($client['email'], ENT_COMPAT, 'cp1251');
        $client['phone'] = htmlspecialchars($client['phone'], ENT_COMPAT, 'cp1251');
        $client['birthday_city'] = htmlspecialchars($client['birthday_city'], ENT_COMPAT, 'cp1251');
        $client['card_id'] = $client['card_id'] ? $client['card_id'] : '';
        $client['vip_select'] = array_select('vip', array(0 => '', 1 => 'Vip'), $client['vip']);
        $client['order_list'] = array();
        $sql = mysql_query("SELECT z.order_id, z.status, z.date, u.name as user\n\t\t\tFROM " . TABLE_ORDER . " z\n\t\t\tLEFT JOIN " . TABLE_USER . " u ON (u.user_id=z.user_id)\n\t\t\tWHERE FIND_IN_SET({$client_id}, z.clients) \n\t\t\tORDER BY z.date desc") or Error(1, __FILE__, __LINE__);
        while ($order = @mysql_fetch_array($sql)) {
            $class = $order['status'] ? '' : "class=\"hid\"";
            $order['date'] = sql_to_text_date($order['date']);
            $order['link'] = "<a href=\"" . ADMIN_URL . "?p=order&order_id={$order['order_id']}\" target=\"_blank\" {$class}>{$order['order_id']}</a>";
            $client['order_list'][] = $order;
        }
    } else {
        $client_id = 0;
    }
}
if (!$client_id) {
    $client = array();
    $client['birthday'] = '';
    $client['birthday_city'] = '';
    $client['name'] = '';
    $client['pasport'] = '';
    $client['text'] = '';
    $client['sex'] = '';
Example #6
0
    if ($innernews['link'] && isset($away)) {
        Header("Location: " . $innernews['link']);
        exit;
    }
    list($y, $m, $d) = @split("-", $innernews['date']);
    $innernews['date'] = (int) $d . ".{$m}." . substr($y, -2, 2);
    $innernews['time'] = substr($innernews['time'], 0, 5);
    $where = "g.news_id={$news_id} AND g.type={$commenttype}";
    $sql = mysql_query("SELECT COUNT(*) FROM " . TABLE_OPINION . " g WHERE {$where}") or Error(1, __FILE__, __LINE__);
    $arr1 = mysql_fetch_array($sql);
    $innernews['all'] = $all = $arr1[0];
    list($limit, $pages) = pages($all, $url . "&");
    $opinion_list = array();
    $sql = mysql_query("\n\t\tSELECT \n\t\t\tg.* , u.name as uname\n\t\tFROM \n\t\t\t" . TABLE_OPINION . " g \n\t\t\tLEFT JOIN " . TABLE_USER . " u ON (u.user_id=g.user_id)\n\t\tWHERE\n\t\t\t{$where}\n\t\tORDER BY \n\t\t\tg.datetime, g.opinion_id \n\t\tLIMIT {$limit}") or Error(1, __FILE__, __LINE__);
    while ($arr1 = @mysql_fetch_array($sql)) {
        $arr1['uname'] = HtmlSpecialChars($arr1['uname'], ENT_COMPAT, 'cp1251');
        $arr1['text'] = comment_text($arr1['text']);
        list($date, $time) = explode(" ", $arr1['datetime']);
        $arr1['datetime'] = sql_to_text_date($date) . " " . substr($time, 0, 5);
        $arr1['del_link'] = $url . "&delopinion={$arr1['opinion_id']}";
        $opinion_list[] = $arr1;
    }
    if (@$_SESSION['message']) {
        $_SESSION['message'] = "\n\t<script language=\"JavaScript\">\n\talert('{$_SESSION['message']}');\n\t</script>";
    }
    require 'templ/shownews.htm';
    $_SESSION['message'] = '';
} else {
    $innernews = get_innernews(1);
    require 'templ/shownews_list.htm';
}
Example #7
0
File: basket.php Project: nikuha/rs
    if (!$maxdate) {
        $maxdate = @$arr['maxdate'];
    }
}
$replace['mindate'] = sql_to_text_date($mindate);
$replace['maxdate'] = sql_to_text_date($maxdate);
$sql = mysql_query("\n\tSELECT \n\t\tcount(distinct order_id) as allcount\n\tFROM \n\t\t" . TABLE_ORDER . " z \n\t\tLEFT JOIN " . TABLE_OFFICE . " r on (r.office_id=z.office_id) \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)\n\t\tLEFT JOIN " . TABLE_PROVIDER . " pr on (pr.provider_id=z.provider_id)\n\t\tLEFT JOIN " . TABLE_USER . " u on (u.user_id=z.user_id) \n\tWHERE\n\t\t1 {$where}") or Error(1, __FILE__, __LINE__);
$arr = mysql_fetch_array($sql);
$replace['all'] = $all = $arr['allcount'];
list($limit, $replace['pages']) = pages($all, ADMIN_URL . "?p={$part}&all=1&");
$replace['current_page'] = $current_page;
$sql = mysql_query("\n\tSELECT \n\t\tz.order_id, z.date, z.status as orderstatus, z.date_from, z.note,\n\t\tz.client, z.cash, z.fio,\n\t\tz.annul, \n\t\tr.region,\n\t\tob.name as object_name, \n\t\tct.city_id, ct.name as city_name, c.name as country_name, u.name as user_name,\n\t\tpr.name as provider\n\tFROM \n\t\t" . TABLE_ORDER . " z \n\t\tLEFT JOIN " . TABLE_OFFICE . " r on (r.office_id=z.office_id) \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)\n\t\tLEFT JOIN " . TABLE_COUNTRY . " c ON (ct.country_id=c.country_id)\n\t\tLEFT JOIN " . TABLE_USER . " u on (u.user_id=z.user_id) \n\t\tLEFT JOIN " . TABLE_PROVIDER . " pr on (pr.provider_id=z.provider_id) \n\tWHERE\n\t\t1 {$where}\n\tGROUP BY\n\t\tz.order_id\n\tORDER BY \n\t\t{$ord}\n\tLIMIT {$limit}") or Error(1, __FILE__, __LINE__);
$list = array();
$i = ($current_page - 1) * $_SESSION['on_page'];
$j = 0;
while ($info = @mysql_fetch_array($sql)) {
    $i++;
    $j++;
    $info['i'] = $i;
    $info['j'] = $j;
    $info['object_name'] = htmlspecialchars($info['object_name'], ENT_COMPAT, 'cp1251');
    $info['fio'] = nl2br($info['fio']);
    $info['edit_link'] = ADMIN_URL . "?p=basket&restore={$info['order_id']}";
    $info['del_link'] = ADMIN_URL . "?p=basket&del_order={$info['order_id']}&page={$current_page}";
    $info['office'] = htmlspecialchars($info['region'], ENT_COMPAT, 'cp1251');
    $info['date'] = sql_to_text_date($info['date']);
    $info['date_from'] = sql_to_text_date($info['date_from']);
    $list[] = $info;
}
$replace['list'] = $list;
$content = get_template('templ/basket.htm', $replace);
Example #8
0
File: func.php Project: nikuha/rs
function client_table($clients, $order_id, $mode=0)
{
	$client_arr = $clients ? explode(",", $clients) : array();
		
	$client_list = array();
	if(count($client_arr))
	{
		foreach($client_arr as $k=>$v) 
		{
			$sql = mysql_query("SELECT cl.*, ct.name as city 
				FROM ".TABLE_CLIENT." cl 
				LEFT JOIN ".TABLE_CLIENT_CITIES." ct ON (ct.city_id=cl.city_id)
				WHERE cl.client_id='$v'") or Error(1, __FILE__, __LINE__);
			if($client = @mysql_fetch_array($sql)) 
			{
				$client['birthday'] = sql_to_text_date($client['birthday'], 0, 1);
				//$client['del_link'] = "?p=order&order_id=$order_id&delclient=$client[client_id]";
				$client_list[] = $client;
			}
		}
	}
	
	if($mode) return $client_list;
	if(!$order_id) $order_id=0;
	
	if(!count($client_list)) return '';		
	return get_template('templ/client_table.htm', array('client_list'=>$client_list, 'order_id'=>$order_id));
}
Example #9
0
File: cron.php Project: nikuha/rs
mysql_query("DELETE FROM " . TABLE_NEWS . " WHERE date + INTERVAL 2 MONTH < CURDATE() AND type=1") or Error(1, __FILE__, __LINE__, 1);
mysql_query("DELETE FROM " . TABLE_SITEORDER . " WHERE datetime + INTERVAL 6 MONTH < NOW()") or Error(1, __FILE__, __LINE__, 1);
mysql_query("DELETE FROM " . TABLE_SITEORDER_STAT . " WHERE date + INTERVAL 6 MONTH < CURDATE()") or Error(1, __FILE__, __LINE__, 1);
mysql_query("DELETE FROM " . TABLE_ANNUL_STAT . " WHERE date + INTERVAL 6 MONTH < CURDATE()") or Error(1, __FILE__, __LINE__, 1);
mysql_query("UPDATE " . TABLE_SITEORDER_STAT_CRON . " SET end=0, date = CURDATE() - INTERVAL 31 DAY") or Error(1, __FILE__, __LINE__, 1);
mysql_query("DELETE FROM " . TABLE_DISTRIBUTION . " WHERE status=1 AND datestart + INTERVAL 2 MONTH < NOW()") or Error(1, __FILE__, __LINE__, 1);
mysql_query("DELETE FROM " . TABLE_RESERVATION . " WHERE date + INTERVAL 6 MONTH < CURDATE()") or Error(1, __FILE__, __LINE__, 1);
mysql_query("DELETE FROM " . TABLE_BRON . " WHERE date + INTERVAL 6 MONTH < CURDATE()") or Error(1, __FILE__, __LINE__, 1);
$annul_text = "автоматически аннулирована по прошествии месяца";
$sql = mysql_query("SELECT siteorder_id, datetime, site_id, user_id FROM " . TABLE_SITEORDER . " \n\tWHERE status=1 AND TO_DAYS(datetime) <= TO_DAYS(curdate() - INTERVAL 1 MONTH)") or Error(1, __FILE__, __LINE__, 1);
while ($info = @mysql_fetch_array($sql)) {
    mysql_query("UPDATE " . TABLE_SITEORDER . " SET annul='{$annul_text}', status=-1 \n\t\tWHERE siteorder_id={$info['siteorder_id']}") or Error(1, __FILE__, __LINE__);
    $info['date'] = substr($info['datetime'], 0, 10);
    mysql_query("UPDATE " . TABLE_SITEORDER_STAT . " SET annul_count=annul_count+1, proc_count=if(proc_count>0,proc_count-1,0)\n\t\tWHERE date='{$info['date']}' AND user_id={$info['user_id']} AND site_id={$info['site_id']}") or Error(1, __FILE__, __LINE__);
}
$sql = mysql_query("SELECT doc_id FROM " . TABLE_DOC . " WHERE date + INTERVAL 12 MONTH < CURDATE()") or Error(1, __FILE__, __LINE__, 1);
while ($info = @mysql_fetch_array($sql)) {
    @unlink($root_dir . "/doc/{$info['doc_id']}.htm");
}
mysql_query("DELETE FROM " . TABLE_DOC . " WHERE date + INTERVAL 12 MONTH < CURDATE()") or Error(1, __FILE__, __LINE__, 1);
$sql = mysql_query("SELECT client_id, phone, name, birthday FROM " . TABLE_CLIENT . " WHERE \n\tDAYOFMONTH(birthday)=DAYOFMONTH(CURDATE()) AND MONTH(birthday)=MONTH(CURDATE()) AND phone!=''") or Error(1, __FILE__, __LINE__, 1);
while ($info = @mysql_fetch_array($sql)) {
    $sql1 = mysql_query("SELECT user_id FROM " . TABLE_ORDER . " WHERE FIND_IN_SET({$info['client_id']}, clients)") or Error(1, __FILE__, __LINE__, 1);
    if ($info1 = @mysql_fetch_array($sql1)) {
        //echo "$info[client_id] $info[birthday] $info1[user_id]<br>";
        $info['birthday'] = sql_to_text_date($info['birthday']);
        $name = "ДР клиента";
        $description = "Поздравить клиента <a href=\"javascript:OpenClientWin({$info['client_id']}, 0)\">{$info['name']}</a>" . " с днем рождения ({$info['birthday']})";
        mysql_query("INSERT INTO " . TABLE_EVENT . " SET date=CURDATE(), user_id={$info1['user_id']}, time='9:0:0', description='{$description}',\n\t\t\tname='{$name}', type=0") or Error(1, __FILE__, __LINE__);
    }
}
Example #10
0
if ($news_id) {
    $sql = mysql_query("SELECT * FROM " . TABLE_NEWS . " WHERE news_id='{$news_id}'") or Error(1, __FILE__, __LINE__);
    if ($news = @mysql_fetch_array($sql)) {
        $news['name'] = htmlspecialchars($news['name'], ENT_COMPAT, 'cp1251');
        $news['link'] = htmlspecialchars($news['link'], ENT_COMPAT, 'cp1251');
        if (!$news['name'] && !$news['description'] && !$news['descr']) {
            $news['public'] = 1;
        }
        $news['public_select'] = array_select('public', array(0 => 'Нет', 1 => 'Да'), $news['public'], 0);
        $news['date_select'] = date_select($news['date'], 'd', 'm', 'y', 2, 2);
        $tinymce_elements = 'description';
        $tinymce_head = get_template('templ/tinymce_head.htm', array('tinymce_elements' => $tinymce_elements));
        $news['description'] = htmlspecialchars($news['description'], ENT_COMPAT, 'cp1251');
        $news['descr'] = htmlspecialchars($news['descr'], ENT_COMPAT, 'cp1251');
        $sql = mysql_query("SELECT event_id, name, date, time FROM " . TABLE_EVENT . " WHERE o_id='{$news_id}' AND type=3") or Error(1, __FILE__, __LINE__);
        if ($info = @mysql_fetch_array($sql)) {
            $news['event_id'] = $info['event_id'];
            $news['name'] = $info['name'] ? htmlspecialchars($info['name'], ENT_COMPAT, 'cp1251') : NONAME;
            $news['datetime'] = sql_to_text_date($info['date']) . " " . substr($info['time'], 0, 5);
        } else {
            $news['event_id'] = 0;
            $news['event_date'] = sql_to_text_date($news['date'], 0, 1);
            $news['event_hour'] = date("H");
            $news['event_minute'] = date("i");
        }
        $news['date'] = $date;
        $news['sy'] = $sy;
        $news['sm'] = $sm;
        $content = get_template('templ/innernews.htm', $news);
    }
}
Example #11
0
     $mt = mktime(0, 0, 0, $m_today + $i, 1, $y_today);
     $k = date("Y", $mt) . "-" . date("m", $mt);
     if ($mt == $mt_cur) {
         $ch = $k;
     }
     $month_array[$k] = $rus_month[(int) date("m", $mt)] . " " . date("Y", $mt);
 }
 $hotel['select_month'] = array_select('month', $month_array, $ch);
 $hotel['month_select'] = array_select('m', $rus_month_1, (int) date("m"));
 $year_array = array();
 for ($i = $year - 2; $i <= $year; $i++) {
     $year_array[$i] = $i;
 }
 $hotel['year_select'] = array_select('y', $year_array, (int) date("Y"));
 $hotel['date_from'] = sql_to_text_date("{$year}-{$month}-01", 0, 1);
 $hotel['date_to'] = sql_to_text_date(date("Y-m-d", mktime(0, 0, 0, $month + 1, 0, $year)), 0, 1);
 $hotel['status_select'] = array_select('status', $reserv_rus_array, 0, 0);
 if ($hotel['tour']) {
     $select = "<select name=\"nomer\" onchange=ShowNomer(this.value) style=\"width:200px\">";
     $select1 = "<select name=\"suite_id\">";
     foreach ($nomera as $v) {
         $select .= "<option value={$v['suite_id']}>{$v['name']}</option>";
         $select1 .= "<option value={$v['suite_id']}>{$v['name']}</option>";
     }
     $select .= "</select>";
     $select1 .= "</select>";
     $hotel['nomer_select'] = $select;
     $hotel['suite_select'] = $select1;
     $hotel['nomera'] = $nomera;
 }
 /*$hotel['orders'] = array();
Example #12
0
$replace['current_page'] = $current_page;
$sql = mysql_query("\n\tSELECT \n\t\tz.order_id, z.date, z.status as orderstatus, z.date_from, z.note, z.date_pay, z.suite, if(z.net>0, z.net, z.inall) as net,\n\t\tz.client, z.inall, {$sql_provider_sum} as provider_sum, z.cash, z.provider_bill,\n\t\tz.annul, z.debt, z.tphone, z.card_id, z.card_vip, z.paid_debt, z.suite_count*z.day_count as nomeronochi,\n\t\tif(z.status!=0, {$sql_balance}, 0) as balance,\n\t\tr.region,\n\t\tob.name as object_name, \n\t\tct.city_id, ct.name as city_name, c.name as country_name, u.name as user_name,\n\t\tpr.name as provider\n\tFROM \n\t\t" . TABLE_ORDER . " z \n\t\tLEFT JOIN " . TABLE_OFFICE . " r on (r.office_id=z.office_id) \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)\n\t\tLEFT JOIN " . TABLE_COUNTRY . " c ON (ct.country_id=c.country_id)\n\t\tLEFT JOIN " . TABLE_USER . " u on (u.user_id=z.user_id) \n\t\tLEFT JOIN " . TABLE_PROVIDER . " pr on (pr.provider_id=z.provider_id)  \n\t\tLEFT JOIN " . TABLE_AGENCY . " ag on (ag.agency_id=z.agency_id)\n\t\tLEFT JOIN " . TABLE_CORPORATE . " corp on (corp.corporate_id=z.corporate_id)\n\tWHERE\n\t\t1 {$where}\n\tGROUP BY\n\t\tz.order_id\n\tORDER BY \n\t\t{$ord}\n\tLIMIT {$limit}") or Error(1, __FILE__, __LINE__);
$list = array();
$i = ($current_page - 1) * $_SESSION['on_page'];
$j = 0;
while ($info = @mysql_fetch_array($sql)) {
    $i++;
    $j++;
    $info['i'] = $i;
    $info['j'] = $j;
    $info['edit_link'] = ADMIN_URL . "?p=order&order_id={$info['order_id']}&page={$current_page}";
    $info['del_link'] = ADMIN_URL . "?p=order&del_order={$info['order_id']}&account=1&page={$current_page}";
    $info['office'] = $info['region'];
    $info['date'] = sql_to_text_date($info['date']);
    $info['date_from'] = sql_to_text_date($info['date_from']);
    $info['date_pay'] = sql_to_text_date($info['date_pay']);
    if ($info['debt'] && $info['paid_debt']) {
        $info['debt'] = 0;
    }
    $list[] = $info;
}
$replace['list'] = $list;
$replace['current_page'] = $current_page;
if (@$print) {
    echo get_template('templ/account_print.htm', $replace);
    exit;
} elseif (@$word) {
    $filename = 'account_' . date("d-m-y") . '.doc';
    header("Content-Type: application/msword; charset=\"windows-1251\"");
    header("Content-Disposition: attachment; filename=\"{$filename}\"");
    echo get_template('templ/account_doc.htm', $replace);
Example #13
0
             if ($count == $all && $count > 1) {
                 $count--;
             }
             $replace['distribution'] .= "<br><br>Отправлено писем: {$count} из {$all}";
         } else {
             $group_box = array();
             $sql = mysql_query("SELECT deliverygroup_id, name FROM " . TABLE_DELIVERYGROUP . " ORDER BY deliverygroup_id") or Error(1, __FILE__, __LINE__);
             $i = 0;
             while ($info = @mysql_fetch_array($sql)) {
                 $i++;
                 $ch = ereg("(^|,){$info['deliverygroup_id']}(,|\$)", $arr['deliverygroups']) ? 'checked' : '';
                 $group_box[] = array('i' => $i, 'deliverygroup_id' => $info['deliverygroup_id'], 'checked' => $ch, 'name' => htmlspecialchars($info['name'], ENT_COMPAT, 'cp1251'));
             }
             $replace['group_box'] = $group_box;
             $arr['datestart'] = substr($arr['datestart'], 0, strpos($arr['datestart'], " "));
             $replace['date_plan'] = sql_to_text_date($arr['datestart']);
             $tinymce_elements = 'html';
             $tinymce_head = get_template('templ/tinymce_head.htm', array('tinymce_elements' => $tinymce_elements));
             $replace['html'] = htmlspecialchars($arr['html'], ENT_COMPAT, 'cp1251');
             $replace['name'] = htmlspecialchars($arr['name'], ENT_COMPAT, 'cp1251');
             $replace['distribution_id'] = $distribution_id;
             $replace['status'] = $arr['status'];
         }
     } else {
         $content = 'Не найдена рассылка';
         return;
     }
 } else {
     $group_box = array();
     $sql = mysql_query("SELECT deliverygroup_id, name FROM " . TABLE_DELIVERYGROUP . " ORDER BY deliverygroup_id") or Error(1, __FILE__, __LINE__);
     $i = 0;
Example #14
0
File: doc.php Project: nikuha/rs
         }
         @unlink($fn);
     }
 } elseif ($type == 1) {
     $i_count++;
     //if(!$office_id) $office_id = $arr['office_id'];
     if (!@$replace['date_lastday']) {
         list($y_ld, $m_ld, $d_ld) = explode("-", $arr['date_from']);
         $i = -1;
         do {
             $i++;
             $ts = mktime(0, 0, 0, $m_ld, 31 - $i, $y_ld);
         } while (!checkdate($m_ld, 31 - $i, $y_ld));
         $replace['date_lastday'] = sql_to_text_date(date("Y-m-d", $ts));
     }
     $arr['date_from'] = sql_to_text_date($arr['date_from']);
     if ($arr['fio']) {
         $arr['fio_list'] = preg_split("/[\r\n]+/", $arr['fio']);
     } else {
         $client_arr = $arr['clients'] ? explode(",", $arr['clients']) : array();
         $arr['fio_list'] = array();
         $plus = preg_split("/[\r\n]/", $arr['plus']);
         foreach ($client_arr as $k => $v) {
             $sql1 = mysql_query("SELECT * FROM " . TABLE_CLIENT . " WHERE client_id='{$v}'") or Error(1, __FILE__, __LINE__);
             if ($client = @mysql_fetch_array($sql1)) {
                 $name = $client['name'];
                 if ($arr['plus'] && isset($plus[$k])) {
                     $name .= ' ' . $plus[$k];
                 }
                 $arr['fio_list'][] = $name;
             }