Exemplo n.º 1
0
/**
 *  返回短信列表数据
 */
function sms_list($class_code, $phone)
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['keywords'] = empty($_REQUEST['search_keyword']) ? '' : trim($_REQUEST['search_keyword']);
        //关键字
        $filter['phones'] = empty($_REQUEST['search_phones']) ? '' : trim($_REQUEST['search_phones']);
        //学校code
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keywords'] = json_str_iconv($filter['keywords']);
        }
        $filter['sort'] = empty($_REQUEST['sort']) ? 'sms_id' : trim($_REQUEST['sort']);
        $filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
        $filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
        $filter['page_size'] = empty($_REQUEST['rows']) ? '20' : trim($_REQUEST['rows']);
        $ex_where = " WHERE class_code='" . $class_code . "' and phones like '%{$phone}%'";
        if ($filter['keywords']) {
            $ex_where .= " AND content LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
        }
        $filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS["ecs"]->table("sms") . $ex_where);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT * " . " FROM " . $GLOBALS["ecs"]->table("sms") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
        $filter['keywords'] = stripslashes($filter['keywords']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $sms_list = $GLOBALS['db']->getAll($sql);
    $arr = array('rows' => $sms_list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 2
0
function get_stock_control_log()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        $filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'a.id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $filter['start_date'] = empty($_REQUEST['start_date']) ? local_strtotime('-30 days') : $_REQUEST['start_date'];
        $filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : $_REQUEST['end_date'];
        if (strpos($filter['start_date'], '-') !== false) {
            $filter['start_date'] = local_strtotime($filter['start_date']);
            $filter['end_date'] = local_strtotime($filter['end_date']);
        }
        $where = agency_where();
        /*add by hg for date 2014-04-21 可选商品*/
        if (if_agency()) {
            if (!empty($filter['admin_agency_id'])) {
                $where .= " AND (a.admin_agency_id = {$filter['admin_agency_id']} ) ";
            } else {
                $where .= " AND (a.admin_agency_id = 0 ) ";
            }
        }
        if (!empty($filter['keyword'])) {
            $where .= " AND (a.goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'  or a.stock_number LIKE '%" . mysql_like_quote($filter['keyword']) . "%' )";
        }
        if ($filter['start_date']) {
            $where = $where . " AND a.log_time >= '{$filter['start_date']}'";
        }
        if ($filter['end_date']) {
            $where = $where . " AND a.log_time <= '" . ($filter['end_date'] + 86400) . "'";
        }
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('stock_control_log') . ' AS a ' . 'WHERE 1 ' . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获取库存日志管理数据 */
        $sql = 'SELECT a.*  ' . 'FROM ' . $GLOBALS['ecs']->table('stock_control_log') . ' AS a ' . 'WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['date'] = local_date($GLOBALS['_CFG']['time_format'], $rows['log_time']);
        $rows['out_type_remarks'] = $GLOBALS['db']->getOne("SELECT remarks FROM " . $GLOBALS['ecs']->table('stock_out_type') . " WHERE id = '" . $rows['out_type_id'] . "' ");
        $arr[] = $rows;
    }
    $GLOBALS['smarty']->assign('start_date', local_date('Y-m-d', $filter['start_date']));
    $GLOBALS['smarty']->assign('end_date', local_date('Y-m-d', $filter['end_date']));
    $filter['start_date'] = local_date('Y-m-d', $filter['start_date']);
    $filter['end_date'] = local_date('Y-m-d', $filter['end_date']);
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Exemplo n.º 3
0
/**
 *  返回班级管理员列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function exam_prj_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['name'] = empty($_REQUEST['search_name']) ? '' : trim($_REQUEST['search_name']);
        //名称
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['name'] = json_str_iconv($filter['name']);
        }
        $filter['sort'] = empty($_REQUEST['sort']) ? 'prj_id' : trim($_REQUEST['sort']);
        $filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
        $filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
        $filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
        $ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
        if ($filter['name']) {
            $ex_where .= " AND name like '" . mysql_like_quote($filter['name']) . "%'";
        }
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("exam_prj") . $ex_where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("exam_prj") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
        // 		echo $sql; echo '<br>';
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db']->getAll($sql);
    $arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 4
0
function get_temp_list()
{
    // Obtaion to the temp list
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $where = "WHERE 1";
        $filter['bdate'] = empty($_REQUEST['bdate']) ? date('Y-m-d') : trim($_REQUEST['bdate']);
        if (!empty($_REQUEST['city'])) {
            $where .= " AND ";
        } else {
            $where .= " AND a.country" . db_create_in(array_keys($_SESSION['city_arr']));
        }
        $where .= " AND a.order_status=1 AND b.goods_price>100";
        if ($filter['bdate']) {
            $where .= " AND a.best_time BETWEEN '" . $filter['bdate'] . " 00:00:00' AND '" . $filter['bdate'] . " 23:59:59'";
        }
        $query = "SELECT DISTINCT COUNT(*) FROM  ecs_order_info AS a \r\n\t\t\tLEFT JOIN ecs_order_goods AS b ON a.order_id=b.order_id \r\n\t\t\tLEFT JOIN order_dispatch AS c ON c.order_id=a.order_id \r\n\t\t\tLEFT JOIN ship_route AS d ON d.route_id=c.route_id {$where}";
        $filter['record_count'] = $GLOBALS['db_read']->getOne($query);
        $filter = page_and_size($filter);
        $limit = "LIMIT " . $filter['start'] . "," . $filter['page_size'] . "";
        $sql = "SELECT SUM(b.goods_number) AS gnum,c.turn,d.station_id \r\n\t\t\tFROM ecs_order_info AS a \r\n\t\t\tLEFT JOIN ecs_order_goods AS b ON a.order_id=b.order_id \r\n\t\t\tLEFT JOIN order_dispatch AS c ON c.order_id=a.order_id \r\n\t\t\tLEFT JOIN ship_route AS d ON d.route_id=c.route_id {$where} \r\n\t\t\tGROUP BY c.turn,d.station_id {$limit}";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db_read']->getAll($sql);
    return array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Exemplo n.º 5
0
/**
 *  返回班级管理员列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function course_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['semster'] = empty($_REQUEST['search_semster']) ? '' : trim($_REQUEST['search_semster']);
        //名称
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['semster'] = json_str_iconv($filter['semster']);
        }
        $ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
        if ($filter['semster']) {
            $ex_where .= " AND semster = '" . mysql_like_quote($filter['semster']) . "'";
        }
        $sql = "SELECT * FROM " . $GLOBALS['ecs']->table("course") . $ex_where;
        // 		echo $sql; echo '<br>';
        $filter['semster'] = stripslashes($filter['semster']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db']->getRow($sql);
    return $list;
}
Exemplo n.º 6
0
function get_stat_list()
{
    // Obtaion to the statistics list
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $city_group = $_SESSION['city_group'];
        $where = "WHERE 1 ";
        $bdate = date('Y-m-d', strtotime(date('Y-m-d')) - 3600 * 24 * 2);
        $sdate = date('Y-m-d', strtotime(date('Y-m-d')) - 3600 * 24 * 1);
        $filter['turn'] = empty($_REQUEST['turn']) ? '' : intval($_REQUEST['turn']);
        $filter['bdate'] = empty($_REQUEST['bdate']) ? $bdate : trim($_REQUEST['bdate']);
        $filter['sdate'] = empty($_REQUEST['sdate']) ? $sdate : trim($_REQUEST['sdate']);
        $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
        $filter['print_sn'] = empty($_REQUEST['print_sn']) ? '' : trim($_REQUEST['print_sn']);
        $filter['stan'] = empty($_REQUEST['city']) ? $_SESSION['city_arr'] : intval($_REQUEST['city']);
        $join = "";
        if (!empty($filter['turn'])) {
            $join .= " LEFT JOIN order_dispatch AS d ON d.order_id=b.order_id";
        }
        if (!empty($filter['print_sn'])) {
            $join .= " LEFT JOIN print_log_x AS p ON p.order_id=b.order_id";
        }
        $term = "WHERE 1 AND b.order_status='1' AND c.goods_price>40";
        if ($filter['bdate'] && $filter['sdate']) {
            $term .= " and b.best_time>='" . $filter['bdate'] . " 00:00:00' AND b.best_time<='" . $filter['sdate'] . " 23:59:59'";
        }
        if ($filter['turn']) {
            $term .= " AND d.turn='" . $filter['turn'] . "'";
        }
        if ($filter['print_sn']) {
            $term .= " and p.print_sn='" . $filter['print_sn'] . "'and p.city_group=" . $city_group;
        }
        if ($filter['order_sn']) {
            $term .= " and b.order_sn like '%" . $filter['order_sn'] . "'";
        }
        $query = "select count(*) from \r\n\t\t\t(SELECT b.best_time,c.goods_id,c.goods_attr,SUM(c.goods_number) AS gnum,GROUP_CONCAT(c.order_id) AS order_group \r\n\t\t\tFROM order_genid AS a \r\n\t\t\tLEFT JOIN ecs_order_info AS b ON b.order_id=a.order_id \r\n\t\t\tLEFT JOIN ecs_order_goods AS c ON c.order_id=b.order_id " . $join . " {$term} \r\n\t\t\tGROUP BY c.goods_id,c.goods_attr )as a  ";
        $filter['record_count'] = $GLOBALS['db_read']->getOne($query);
        $filter = page_and_size($filter);
        $limit = "LIMIT " . $filter['start'] . "," . $filter['page_size'];
        $sql = "SELECT b.best_time,c.goods_id,c.goods_attr,SUM(c.goods_number) AS gnum,GROUP_CONCAT(c.order_id) AS order_group \r\n\t\t\tFROM order_genid AS a \r\n\t\t\tLEFT JOIN ecs_order_info AS b ON b.order_id=a.order_id \r\n\t\t\tLEFT JOIN ecs_order_goods AS c ON c.order_id=b.order_id " . $join . " {$term} \r\n\t\t\tGROUP BY c.goods_id,c.goods_attr ASC " . $limit;
        //print_r($sql);exit;
        $goods = $GLOBALS['db_read']->getAll($sql);
        foreach ($goods as $key => $val) {
            $list['stat'][$key]['goods_id'] = $val['goods_id'];
            $list['stat'][$key]['goods_name'] = get_goods_name($val['goods_id']);
            $list['stat'][$key]['bdate'] = $filter['bdate'];
            $list['stat'][$key]['goods_attr'] = empty($val['goods_attr']) ? '0.25' : floatval($val['goods_attr']);
            $list['stat'][$key]['goods_sum'] = $val['gnum'];
            $list['stat'][$key]['order_group'] = $val['order_group'];
            $list['weight_total'] += $val['gnum'] * floatval($val['goods_attr']);
            $list['num_total'] += $val['gnum'];
            set_filter($filter, $sql);
        }
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    return array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count'], 'sql' => $sql);
}
Exemplo n.º 7
0
function goods_stock()
{
    global $ecs, $db;
    $result = get_filter($param_str);
    if ($result === false) {
        $filter['goods_name'] = empty($_REQUEST['goods_name']) ? '' : trim($_REQUEST['goods_name']);
        $filter['goods_sn'] = empty($_REQUEST['goods_sn']) ? '' : trim($_REQUEST['goods_sn']);
        $where = ' WHERE supplier_id=' . $_SESSION['supplier_id'];
        if (!empty($filter['goods_name'])) {
            $where .= ' AND goods_name LIKE "%' . $filter['goods_name'] . '%" ';
        }
        if (!empty($filter['goods_sn'])) {
            $where .= ' AND goods_sn LIKE "%' . $filter['goods_sn'] . '%" ';
        }
        $sql = 'SELECT COUNT(*) FROM ' . $ecs->table('goods') . $where;
        $filter['record_count'] = $db->getOne($sql);
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
            $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
        } else {
            $filter['page_size'] = 15;
        }
        $filter = page_and_size($filter);
        $limit = ' LIMIT ' . $filter['start'] . ',' . $filter['page_size'];
        $sql = 'SELECT goods_id,goods_sn,goods_name,goods_number FROM ' . $ecs->table('goods') . $where . $limit;
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $goods = $db->getAll($sql);
    foreach ($goods as $goods_key => $goods_val) {
        $sql = 'SELECT goods_attr AS goods_attr_id,product_number FROM ' . $ecs->table('products') . ' WHERE goods_id=' . $goods_val['goods_id'];
        $attr = $db->getAll($sql);
        foreach ($attr as $attr_key => $attr_val) {
            $goods_attr_arr = explode('|', $attr_val['goods_attr_id']);
            $attr_sql = implode(' OR goods_attr_id= ', $goods_attr_arr);
            $sql = 'SELECT attr_value FROM ' . $ecs->table('goods_attr') . ' WHERE goods_attr_id=' . $attr_sql;
            $attr_name_arr = $db->getAll($sql);
            $attr_name = '';
            foreach ($attr_name_arr as $name_key => $name_val) {
                $attr_name .= implode(' ', $name_val);
            }
            $attr_val['goods_attr_name'] = $attr_name;
            $attr[$attr_key] = $attr_val;
        }
        $goods_val['goods_attr'] = $attr;
        $goods[$goods_key] = $goods_val;
    }
    $arr = array('goods' => $goods, 'filter' => $filter);
    return $arr;
}
Exemplo n.º 8
0
/**
 *  返回班级管理员列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function resource_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['resource_type'] = empty($_REQUEST['search_resource_type']) ? '' : trim($_REQUEST['search_resource_type']);
        //编号
        $filter['name'] = empty($_REQUEST['search_name']) ? '' : trim($_REQUEST['search_name']);
        //名称
        $filter['sdate'] = empty($_REQUEST['search_sdate']) ? '' : trim($_REQUEST['search_sdate']);
        //起始日期
        $filter['edate'] = empty($_REQUEST['search_edate']) ? '' : trim($_REQUEST['search_edate']);
        //截止日期
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['name'] = json_str_iconv($filter['name']);
        }
        $filter['sort'] = empty($_REQUEST['sort']) ? 'resource_id' : trim($_REQUEST['sort']);
        $filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
        $filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
        $filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
        $ex_where = " WHERE d.class_code='" . $_SESSION["class_code"] . "' ";
        if ($filter['resource_type']) {
            $ex_where .= " AND d.type = '" . mysql_like_quote($filter['resource_type']) . "'";
        }
        if ($filter['name']) {
            $ex_where .= " AND d.name like '" . mysql_like_quote($filter['name']) . "%'";
        }
        if ($filter['sdate']) {
            $ex_where .= " AND d.created >='" . mysql_like_quote($filter['sdate']) . "'";
        }
        if ($filter['edate']) {
            $ex_where .= " AND d.created <='" . mysql_like_quote($filter['edate']) . "'";
        }
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("resource") . " d " . $ex_where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT d.*, s.name as resource_type " . " FROM " . $GLOBALS['ecs']->table("resource") . " d left join " . $GLOBALS['ecs']->table("resource_type") . " s on d.type=s.rtype_id " . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
        // 		echo $sql; echo '<br>';
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db']->getAll($sql);
    foreach ($list as $k => $v) {
        $list[$k]['creator_name'] = get_user_name($v["creator"], 'admin');
    }
    $arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
    return $arr;
}
function show_notes($_POST)
{
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($from_day, "num", 1, 2, "Invalid Invoice From Date day.");
    $v->isOk($from_month, "num", 1, 2, "Invalid Invoice From Date month.");
    $v->isOk($from_year, "num", 1, 5, "Invalid Invoice From Date year.");
    $v->isOk($to_day, "num", 1, 2, "Invalid Invoice To Date day.");
    $v->isOk($to_month, "num", 1, 2, "Invalid Invoice To Date month.");
    $v->isOk($to_year, "num", 1, 5, "Invalid Invoice To Date year.");
    $fromdate = mkdate($from_year, $from_month, $from_day);
    $todate = mkdate($to_year, $to_month, $to_day);
    $v->isOk($fromdate, "date", 1, 1, "Invalid From Date.");
    $v->isOk($todate, "date", 1, 1, "Invalid To Date.");
    # display errors, if any
    if ($v->isError()) {
        $err = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $err .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return get_filter($_POST, $err);
    }
    $listing = "\n\t\t<tr>\n\t\t\t<th>Customer</th>\n\t\t\t<th>Credit Note No.</th>\n\t\t\t<th>Ref.</th>\n\t\t\t<th>Date</th>\n\t\t\t<th>Amount</th>\n\t\t\t<th>Stock Returned</th>\n\t\t\t<th>Options</th>\n\t\t</tr>";
    db_connect();
    $get_sql = "SELECT * FROM credit_notes WHERE tdate >= '{$fromdate}' AND tdate <= '{$todate}'";
    $run_get = db_exec($get_sql) or errDie("Unable to get credit note information.");
    if (pg_numrows($run_get) < 1) {
        $listing .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='7'>No Credit Notes Found.</td>\n\t\t\t</tr>";
    } else {
        while ($carr = pg_fetch_array($run_get)) {
            $get_cust = "SELECT surname FROM customers WHERE cusnum = '{$carr['cusnum']}'";
            $run_cust = db_exec($get_cust) or errDie("Unable to get customer information.");
            if (pg_numrows($run_cust) < 1) {
                $cusname = "";
            } else {
                $cusname = pg_fetch_result($run_cust, 0, 0);
            }
            if (isset($carr['used_stock']) and $carr['used_stock'] == "1") {
                $showstockused = "Yes";
            } else {
                $showstockused = "No";
            }
            $listing .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>{$cusname}</td>\n\t\t\t\t\t<td>g{$carr['creditnote_num']}</td>\n\t\t\t\t\t<td>{$carr['refnum']}</td>\n\t\t\t\t\t<td>{$carr['tdate']}</td>\n\t\t\t\t\t<td>" . CUR . " {$carr['totamt']}</td>\n\t\t\t\t\t<td>{$showstockused}</td>\n\t\t\t\t\t<td><a href='credit-note-print.php?id={$carr['id']}'>Print</a></td>\n\t\t\t\t</tr>";
        }
    }
    $display = "\n\t\t<h2>Listing Of Credit Notes</h2>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t{$listing}\n\t\t</table>";
    return $display;
}
Exemplo n.º 10
0
/**
 *  返回班级管理员列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function person_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']);
        //名称
        $filter['tel'] = empty($_REQUEST['tel']) ? '' : trim($_REQUEST['tel']);
        //电话
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keywords'] = json_str_iconv($filter['keywords']);
        }
        $filter['sort'] = empty($_REQUEST['sort']) ? 'person_id' : trim($_REQUEST['sort']);
        $filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
        $filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
        $filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
        $ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
        if ($filter['keywords']) {
            $ex_where .= " AND name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
        }
        if ($filter['tel']) {
            $ex_where .= " AND tel = '" . mysql_like_quote($filter['tel']) . "'";
        }
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("person") . $ex_where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("person") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
        // 		echo $sql; echo '<br>';
        $filter['keywords'] = stripslashes($filter['keywords']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db']->getAll($sql);
    // 	foreach ($list AS $key=>$val)
    // 	{
    // 		$list[$key]['created']     = local_date($GLOBALS['_CFG']['time_format'], $val['created']);
    // 	}
    $arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 11
0
 public function auction_list($offset = '0, 12')
 {
     $result = get_filter();
     if ($result === false) {
         /* 过滤条件 */
         $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
         if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
             $filter['keyword'] = json_str_iconv($filter['keyword']);
         }
         $filter['is_going'] = empty($_REQUEST['is_going']) ? 0 : 1;
         $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'act_id' : trim($_REQUEST['sort_by']);
         $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
         $where = "";
         if (!empty($filter['keyword'])) {
             $where .= " AND goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
         }
         if ($filter['is_going']) {
             $now = gmtime();
             $where .= " AND is_finished = 0 AND start_time <= '{$now}' AND end_time >= '{$now}' ";
         }
         /* 分页大小 */
         //            $filter = page_and_size($filter);
         /* 查询 */
         $sql = "SELECT * " . "FROM " . $this->model->pre . "goods_activity WHERE act_type = '" . GAT_AUCTION . "' {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT {$offset}";
         $filter['keyword'] = stripslashes($filter['keyword']);
         set_filter($filter, $sql);
     } else {
         $sql = $result['sql'];
         $filter = $result['filter'];
     }
     $res = $this->model->query($sql);
     $list = array();
     foreach ($res as $row) {
         $ext_info = unserialize($row['ext_info']);
         $arr = array_merge($row, $ext_info);
         $arr['start_time'] = local_date('Y-m-d H:i', $arr['start_time']);
         $arr['end_time'] = local_date('Y-m-d H:i', $arr['end_time']);
         $list[] = $arr;
     }
     $arr = array('item' => $list, 'filter' => $filter);
     return $arr;
 }
Exemplo n.º 12
0
function get_email_list()
{
    $result = get_filter();
    if ($result === false) {
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'stat' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'ASC' : trim($_REQUEST['sort_order']);
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('email_list');
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        /* 查询 */
        $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('email_list') . " ORDER BY " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ",{$filter['page_size']}";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $emaildb = $GLOBALS['db']->getAll($sql);
    $arr = array('emaildb' => $emaildb, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 13
0
/**
 *  返回班级管理员列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function forum_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['keyword'] = empty($_REQUEST['search_keyword']) ? '' : trim($_REQUEST['search_keyword']);
        //主体
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['sort'] = empty($_REQUEST['sort']) ? 'forum_id' : trim($_REQUEST['sort']);
        $filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
        $filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
        $filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
        $ex_where = " WHERE parent_id=0 and class_code='" . $_SESSION["class_code"] . "' ";
        if ($filter['keyword']) {
            $ex_where .= " AND (title like '%" . mysql_like_quote($filter['keyword']) . "%'";
            $ex_where .= " OR content like '%" . mysql_like_quote($filter['keyword']) . "%')";
        }
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("forum") . $ex_where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("forum") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
        // 		echo $sql; echo '<br>';
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db']->getAll($sql);
    foreach ($list as $key => $val) {
        $list[$key]['setime'] = $val['stime'] . "-" . $val['etime'];
    }
    $arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 14
0
/**
 * This function returns the featured image url of a post
 *  
 * @since    1.0.0
 * @link     http://mintplugins.com/doc/mp_core_the_featured_image/
 * @see      has_filter()
 * @see      get_filter()
 * @see      get_post_thumbnail_id()
 * @see      wp_get_attachment_image_src()
 * @see      mp_aq_resize()
 * @param    string $post_id The ID of the post who's featured image we want
 * @param    int $width The width of the image we want in pixels. Defaults to 600
 * @param    int $height The height of the image we want in pixels. Defaults to 600
 * @param    string $before Optional. A string to output directly before the image URL
 * @param    string $after Optional. A string to output directly after the image URL
 * @return   string The featured image's URL with $before and $after before and after respectively.
 */
function mp_core_the_featured_image($post_id = NULL, $width = NULL, $height = NULL, $before = NULL, $after = NULL)
{
    if (empty($post_id)) {
        return false;
    }
    //Default width if blank
    $width = isset($width) ? $width : 600;
    //Set crop if there is a height. If not, don't crop
    $crop = isset($height) ? true : false;
    //Set default for featured image
    $image_url = has_filter('mp_featured_image_default') ? get_filter('mp_featured_image_default', '') : NULL;
    //get the post thumbnail for this post
    $image_id = get_post_thumbnail_id($post_id);
    if ($image_id != "") {
        $image_url = wp_get_attachment_image_src($image_id, 'full');
        $image_url = $image_url[0];
        if (is_ssl()) {
            //action to take for page using SSL
            $image_url = str_replace('http://', 'https://', $image_url);
        }
        return $before . mp_aq_resize($image_url, $width, $height, $crop) . $after;
    }
}
Exemplo n.º 15
0
/**
 *  返回班级管理员列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function exam_subject_list($table)
{
    $result = get_filter();
    if ($result === false) {
        $filter['sort'] = empty($_REQUEST['sort']) ? 'subject_id' : trim($_REQUEST['sort']);
        $filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
        $filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
        $filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
        $where = " WHERE class_code='" . $_SESSION['class_code'] . "' ";
        $sql = "SELECT COUNT(*) FROM " . $table . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT * " . " FROM " . $table . $where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
        // 		echo $sql; echo '<br>';
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db']->getAll($sql);
    $arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 16
0
function get_links_list()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'link_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        /* 获得总记录数据 */
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('friend_link');
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获取数据 */
        $sql = 'SELECT link_id, link_name, link_url, link_logo, show_order' . ' FROM ' . $GLOBALS['ecs']->table('friend_link') . " ORDER by {$filter['sort_by']} {$filter['sort_order']}";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    $list = array();
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        if (empty($rows['link_logo'])) {
            $rows['link_logo'] = '';
        } else {
            if (strpos($rows['link_logo'], 'http://') === false && strpos($rows['link_logo'], 'https://') === false) {
                $rows['link_logo'] = "<img src='" . '../' . $rows['link_logo'] . "' width=88 height=31 />";
            } else {
                $rows['link_logo'] = "<img src='" . $rows['link_logo'] . "' width=88 height=31 />";
            }
        }
        $list[] = $rows;
    }
    return array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Exemplo n.º 17
0
function auction_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['is_going'] = empty($_REQUEST['is_going']) ? 0 : 1;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'act_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = "";
        if (!empty($filter['keyword'])) {
            $where .= " AND goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
        }
        if ($filter['is_going']) {
            $now = gmtime();
            $where .= " AND is_finished = 0 AND start_time <= '{$now}' AND end_time >= '{$now}' ";
        }
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_AUCTION . "' {$where}";
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        /* 查询 */
        $sql = "SELECT * " . "FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_AUCTION . "' {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ", {$filter['page_size']}";
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $res = $GLOBALS['db']->query($sql);
    $list = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $ext_info = unserialize($row['ext_info']);
        $arr = array_merge($row, $ext_info);
        $arr['start_time'] = local_date('Y-m-d H:i', $arr['start_time']);
        $arr['end_time'] = local_date('Y-m-d H:i', $arr['end_time']);
        $list[] = $arr;
    }
    $arr = array('item' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 18
0
/**
 *  获取退货单列表信息
 *
 * @access  public
 * @param
 *
 * @return void
 */
function back_list()
{
    $result = get_filter();
    if ($result === false) {
        $aiax = isset($_GET['is_ajax']) ? $_GET['is_ajax'] : 0;
        /* 过滤信息 */
        $filter['delivery_sn'] = empty($_REQUEST['delivery_sn']) ? '' : trim($_REQUEST['delivery_sn']);
        $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
        $filter['order_id'] = empty($_REQUEST['order_id']) ? 0 : intval($_REQUEST['order_id']);
        if ($aiax == 1 && !empty($_REQUEST['consignee'])) {
            $_REQUEST['consignee'] = json_str_iconv($_REQUEST['consignee']);
        }
        $filter['consignee'] = empty($_REQUEST['consignee']) ? '' : trim($_REQUEST['consignee']);
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'update_time' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        // $where = 'WHERE 1 ';
        $where = 'WHERE is_cancled = 0 ';
        //修改where条件 chen 0901
        if ($filter['order_sn']) {
            $where .= " AND order_sn LIKE '%" . mysql_like_quote($filter['order_sn']) . "%'";
        }
        if ($filter['consignee']) {
            $where .= " AND consignee LIKE '%" . mysql_like_quote($filter['consignee']) . "%'";
        }
        if ($filter['delivery_sn']) {
            $where .= " AND delivery_sn LIKE '%" . mysql_like_quote($filter['delivery_sn']) . "%'";
        }
        /* 获取管理员信息 */
        $admin_info = admin_info();
        /* 如果管理员属于某个办事处,只列出这个办事处管辖的发货单 */
        if ($admin_info['agency_id'] > 0) {
            $where .= " AND agency_id = '" . $admin_info['agency_id'] . "' ";
        }
        /* 如果管理员属于某个供货商,只列出这个供货商的发货单 */
        if ($admin_info['suppliers_id'] > 0) {
            $where .= " AND suppliers_id = '" . $admin_info['suppliers_id'] . "' ";
        }
        /* 分页大小 */
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
            $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
        } else {
            $filter['page_size'] = 15;
        }
        /* 记录总数 */
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('back_order') . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        /* 查询 chen  修改sql语句 0901*/
        $sql = "SELECT back_id, delivery_sn,back_type,back_reason,pro_descrip,return_money, order_sn, order_id, add_time, action_user, consignee, country,\n                       province, city, district, tel, status, update_time, email, return_time\n                FROM " . $GLOBALS['ecs']->table("back_order") . "\n                {$where}\n                ORDER BY " . $filter['sort_by'] . " " . $filter['sort_order'] . "\n                LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ", " . $filter['page_size'] . " ";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    /* 格式化数据 */
    foreach ($row as $key => $value) {
        $row[$key]['return_time'] = local_date($GLOBALS['_CFG']['time_format'], $value['return_time']);
        $row[$key]['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $value['add_time']);
        $row[$key]['update_time'] = local_date($GLOBALS['_CFG']['time_format'], $value['update_time']);
        if ($value['status'] == 1) {
            $row[$key]['status_name'] = $GLOBALS['_LANG']['delivery_status'][1];
        } else {
            $row[$key]['status_name'] = $GLOBALS['_LANG']['delivery_status'][0];
        }
    }
    $arr = array('back' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 19
0
        
            fwd.value as forward,
            fwd_busy.value as forward_busy,
\t    fwd_no_answ.value as forward_noanswer,
\t    no_answ_to.value as noanswer_timeout  
FROM 
   extensions ex 
    left join pbx_settings fwd 
    on fwd.extension_id = ex.extension_id and fwd.param = "forward"
        left join pbx_settings fwd_busy \t\t\t\t\t
            on fwd_busy.extension_id = ex.extension_id and fwd_busy.param = "forward_busy"
                left join pbx_settings fwd_no_answ 
                    on fwd_no_answ.extension_id = ex.extension_id and fwd_no_answ.param = "forward_noanswer"
                        left join pbx_settings no_answ_to 
                            on no_answ_to.extension_id = ex.extension_id and no_answ_to.param = "noanswer_timeout"

WHERE extension = {$number}
\t) a  
EOD;
$data = compact_array(query_to_array($sql . get_filter()));
if (!is_array($data["data"])) {
    echo out(array("success" => false, "message" => $data));
}
$ras = $data['data'][0];
$rak = $data['header'];
$new_array = array();
foreach ($rak as $key => $value) {
    $new_array[$value] = $ras[$key];
}
echo out(array("success" => true, "data" => $new_array));
exit;
Exemplo n.º 20
0
function get_inoutlist()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['sid'] = empty($_REQUEST['sid']) ? '0' : intval($_REQUEST['sid']);
        $filter['ssid'] = empty($_REQUEST['ssid']) ? '0' : intval($_REQUEST['ssid']);
        $filter['inout_status'] = empty($_REQUEST['inout_status']) ? '0' : intval($_REQUEST['inout_status']);
        $filter['inout_type'] = empty($_REQUEST['inout_type']) ? '0' : intval($_REQUEST['inout_type']);
        $filter['add_time1'] = empty($_REQUEST['add_time1']) ? '' : (strpos($_REQUEST['add_time1'], '-') > 0 ? local_strtotime($_REQUEST['add_time1']) : $_REQUEST['add_time1']);
        $filter['add_time2'] = empty($_REQUEST['add_time2']) ? '' : (strpos($_REQUEST['add_time2'], '-') > 0 ? local_strtotime($_REQUEST['add_time2']) : $_REQUEST['add_time2']);
        $filter['inout_sn'] = empty($_REQUEST['inout_sn']) ? '' : trim($_REQUEST['inout_sn']);
        $filter['takegoods_man'] = empty($_REQUEST['takegoods_man']) ? '' : trim($_REQUEST['takegoods_man']);
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'rec_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = 'AND store_type_id=0 ';
        if ($filter['ssid']) {
            $where .= " AND store_id = '" . $filter['ssid'] . "' ";
        } else {
            if ($filter['sid']) {
                $where .= " AND store_id in " . get_ssid_list($filter['sid']);
            }
        }
        if ($filter['inout_status']) {
            $where .= " AND inout_status = '" . $filter['inout_status'] . "' ";
        }
        if ($filter['inout_type']) {
            $where .= " AND inout_type = '" . $filter['inout_type'] . "' ";
        }
        if ($filter['add_time1']) {
            $where .= " AND add_time>=  '" . $filter['add_time1'] . "' ";
        }
        if ($filter['add_time2']) {
            $where .= " AND add_time<=  '" . $filter['add_time2'] . "' ";
        }
        if ($filter['inout_sn']) {
            $where .= " AND inout_sn = '" . $filter['inout_sn'] . "' ";
        }
        if ($filter['takegoods_man']) {
            $where .= " AND takegoods_man like '%" . $filter['takegoods_man'] . "%' ";
        }
        //获取当前管理员负责的store_id列表
        $storeid_list = "";
        $sql1 = "select store_id from " . $GLOBALS['ecs']->table('store_adminer') . " where admin_id = '{$_SESSION['admin_id']}' ";
        $res1 = $GLOBALS['db']->query($sql1);
        while ($row1 = $GLOBALS['db']->fetchRow($res1)) {
            $storeid_list .= $storeid_list ? "," : "";
            $storeid_list .= $row1['store_id'];
            $sql2 = "select store_id from " . $GLOBALS['ecs']->table('store_main') . " where parent_id = '{$row1['store_id']}' ";
            $res2 = $GLOBALS['db']->query($sql2);
            while ($row2 = $GLOBALS['db']->fetchRow($res2)) {
                $storeid_list .= $storeid_list ? "," : "";
                $storeid_list .= $row2['store_id'];
            }
        }
        if ($storeid_list) {
            $where .= " AND store_id in ({$storeid_list}) ";
        }
        /* 记录总数 */
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('store_inout_list') . 'WHERE inout_mode=2 ' . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获取入库单数据 */
        $sql = 'SELECT *  ' . 'FROM ' . $GLOBALS['ecs']->table('store_inout_list') . 'WHERE inout_mode=2 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['store_name'] = get_store_fullname($rows['store_id']);
        $rows['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']);
        $rows['inout_status_name'] = $GLOBALS['_LANG']['inout_status'][$rows['inout_status']];
        $rows['inout_type_name'] = get_inout_type_name($rows['inout_type']);
        $rows['admin_name'] = $GLOBALS['db']->getOne("select admin_name from " . $GLOBALS['ecs']->table('store_adminer') . " where store_id='{$rows['store_id']}' ");
        if ($rows['inout_status'] == 1) {
            //是否有提交申请的权利
            $sql_sh = "select rec_id from " . $GLOBALS['ecs']->table('store_adminer') . " where store_id='{$rows['store_id']}' and admin_id='{$_SESSION['admin_id']}' ";
            $rec_id_sh = $GLOBALS['db']->getOne($sql_sh);
            if (!$rec_id_sh) {
                $rows['tjsq'] = 0;
            } else {
                $rows['tjsq'] = 1;
            }
        }
        $arr[] = $rows;
    }
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Exemplo n.º 21
0
 /**
  * 获取专题列表
  * @access  public
  * @return void
  */
 function get_topic_list($offset = '0, 12')
 {
     $result = get_filter();
     if ($result === false) {
         /* 查询条件 */
         $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'topic_id' : trim($_REQUEST['sort_by']);
         $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
         $filter['record_count'] = $this->model->table('topic')->where()->count();
         /* 分页大小 */
         $filter = page_and_size($filter);
         $sql = "SELECT * FROM " . $this->model->pre . "touch_topic ORDER BY {$filter['sort_by']} {$filter['sort_order']} limit {$offset}";
         set_filter($filter, $sql);
     } else {
         $sql = $result['sql'];
         $filter = $result['filter'];
     }
     $query = $this->model->query($sql);
     $res = array();
     foreach ($query as $topic) {
         $topic['start_time'] = local_date('Y-m-d', $topic['start_time']);
         $topic['end_time'] = local_date('Y-m-d', $topic['end_time']);
         $topic['url'] = url('index', array('id' => $topic['topic_id']));
         $res[] = $topic;
     }
     $arr = array('item' => $res, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
     return $res;
 }
function getBackHuanOrder()
{
    global $ecs, $db, $rebate;
    $result = get_filter();
    if ($result === false) {
        $filter['rid'] = $rid = isset($_REQUEST['rid']) && intval($_REQUEST['rid']) > 0 ? intval($_REQUEST['rid']) : 0;
        $filter['add_time_start'] = !empty($_REQUEST['add_time_start']) ? local_strtotime($_REQUEST['add_time_start']) : 0;
        $filter['add_time_end'] = !empty($_REQUEST['add_time_end']) ? local_strtotime($_REQUEST['add_time_end'] . " 23:59:59") : 0;
        $filter['order_sn'] = isset($_REQUEST['order_sn']) ? trim($_REQUEST['order_sn']) : '';
        //$and = ' rebate_id='.$rid.' and shipping_status in ('.SS_SHIPPED.','.SS_RECEIVED.')';
        $and = ' oi.store_rebate_id=' . $rid . ' and bo.back_type!=3 and bo.status_back<5 and oi.order_id=bo.order_id ';
        $and .= $filter['add_time_start'] ? " AND oi.add_time >= '" . $filter['add_time_start'] . "' " : " ";
        $and .= $filter['add_time_end'] ? " AND oi.add_time <= '" . $filter['add_time_end'] . "' " : " ";
        $and .= $filter['order_sn'] ? " AND oi.order_sn = '" . $filter['order_sn'] . "' " : " ";
        /* 分页大小 */
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
            $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
        } else {
            $filter['page_size'] = 15;
        }
        //总数
        $sql = "select count(oi.order_id) " . "from " . $ecs->table('order_info') . " as oi," . $ecs->table('back_order') . " as bo where " . $and;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        //记录
        $sql = "select oi.order_id, oi.order_sn, oi.add_time, oi.order_status, oi.shipping_status, oi.order_amount, oi.money_paid," . "oi.pay_status, oi.consignee, oi.address, oi.email, oi.tel, oi.extension_code, oi.extension_id, oi.shipping_time, bo.add_time as back_add_time,bo.status_back,bo.status_refund, " . "(" . order_amount_field('oi.') . ") AS total_fee " . "from " . $ecs->table('order_info') . " as oi," . $ecs->table('back_order') . " as bo where " . $and . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        //echo $sql;
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $query = $db->query($sql);
    $ret = array();
    while ($row = $db->fetchRow($query)) {
        $is_order = $is_shipping = $is_pay = 0;
        $row['formated_order_amount'] = price_format($row['order_amount']);
        $row['formated_money_paid'] = price_format($row['money_paid']);
        //$row['formated_rebate_fee'] = 0-price_format($row['total_fee']*$rebate['supplier_rebate']/100);
        $row['formated_rebate_fee'] = getGoodsOrderRebatePrice($row['order_id']);
        $row['formated_rebate_fee'] = 0 - price_format($row['formated_rebate_fee'] * $rebate['rebate'] / 100);
        $row['formated_total_fee'] = price_format($row['total_fee']);
        $row['short_order_time'] = local_date('Y-m-d H:i', $row['add_time']);
        $row['short_back_add_time'] = local_date('Y-m-d H:i', $row['back_add_time']);
        $row['is_rebeat'] = $row['datas'] = 0;
        $ret[$row['order_id']] = $row;
    }
    //echo "<pre>";
    //print_r($ret);
    $arr = array('orders' => $ret, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 23
0
function group_buy_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        if ($_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'act_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = !empty($filter['keyword']) ? " AND goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'" : '';
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_GROUP_BUY . "' {$where}";
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        /* 查询 */
        $sql = "SELECT * " . "FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_GROUP_BUY . "' {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ", {$filter['page_size']}";
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $res = $GLOBALS['db']->query($sql);
    $list = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $ext_info = unserialize($row['ext_info']);
        $stat = group_buy_stat($row['act_id'], $ext_info['deposit']);
        $arr = array_merge($row, $stat, $ext_info);
        /* 处理价格阶梯 */
        $price_ladder = $arr['price_ladder'];
        if (!is_array($price_ladder) || empty($price_ladder)) {
            $price_ladder = array(array('amount' => 0, 'price' => 0));
        } else {
            foreach ($price_ladder as $key => $amount_price) {
                $price_ladder[$key]['formated_price'] = price_format($amount_price['price']);
            }
        }
        /* 计算当前价 */
        $cur_price = $price_ladder[0]['price'];
        // 初始化
        $cur_amount = $stat['valid_goods'];
        // 当前数量
        foreach ($price_ladder as $amount_price) {
            if ($cur_amount >= $amount_price['amount']) {
                $cur_price = $amount_price['price'];
            } else {
                break;
            }
        }
        $arr['cur_price'] = $cur_price;
        $status = group_buy_status($arr);
        $arr['start_time'] = local_date($GLOBALS['_CFG']['date_format'], $arr['start_time']);
        $arr['end_time'] = local_date($GLOBALS['_CFG']['date_format'], $arr['end_time']);
        $arr['cur_status'] = $GLOBALS['_LANG']['gbs'][$status];
        $list[] = $arr;
    }
    $arr = array('item' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 24
0
function get_typelist()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        $filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'a.add_time' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = '';
        if (!empty($filter['keyword'])) {
            $where = " AND a.remarks LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
        }
        /*加入代理商条件*/
        if (!$filter['admin_agency_id']) {
            $agency_where = agency_where();
            if (!$agency_where) {
                $agency_where = "AND a.admin_agency_id = 0";
            } else {
                $agency_where = "AND a.admin_agency_id = " . admin_agency_id();
            }
        } else {
            $agency_where = " AND a.admin_agency_id = {$filter['admin_agency_id']}";
        }
        //dump($agency_where);
        /* 出库类型总数 */
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('stock_out_type') . ' AS a ' . 'WHERE 1 ' . $where . $agency_where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获取出库类型数据 */
        $sql = 'SELECT a.* , u.user_name ' . 'FROM ' . $GLOBALS['ecs']->table('stock_out_type') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('admin_user') . ' AS u ON u.user_id = a.user_id ' . 'WHERE 1 ' . $where . $agency_where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['date'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']);
        $arr[] = $rows;
    }
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Exemplo n.º 25
0
        $c = $v[1] == 'Closing connection' ? $c == $color1 ? $color2 : $color1 : $c;
        $r++;
        $sql_debug[] = array('type' => $v[1], 'content' => $v[2], 'time' => $v[3], 'colored' => $c);
        if ($r > 50 && $v[1] == 'Connected') {
            break;
        }
    }
    unset($sql_debug_c);
}
# is there copyrights for translator ?
$translator_copyrights = isset($lang['S_TRANSLATED_BY']) ? $lang['S_TRANSLATED_BY'] : false;
# secondary menu
$go_menu = array('general' => array('name' => $lang['GENERAL_STAT'], 'link' => ADMIN_PATH . '?cp=start&amp;smt=general', 'goto' => 'general', 'current' => $current_smt == 'general'), 'other' => array('name' => $lang['OTHER_INFO'], 'link' => ADMIN_PATH . '?cp=start&amp;smt=other', 'goto' => 'other', 'current' => $current_smt == 'other'), 'team' => array('name' => $lang['KLEEJA_TEAM'], 'link' => ADMIN_PATH . '?cp=start&amp;smt=team', 'goto' => 'team', 'current' => $current_smt == 'team'));
# is there a last visit of images and files ?
$files_last_visit = filter_exists('f_lastvisit', 'filter_uid') ? get_filter('f_lastvisit', 'filter_uid', true) : time() - 3600 * 24;
$image_last_visit = filter_exists('i_lastvisit', 'filter_uid') ? get_filter('i_lastvisit', 'filter_uid', true) : time() - 3600 * 24;
# hurry, hurry section, get styles
$hurry_style_link = ADMIN_PATH . '?cp=m_styles&amp;sty_t=st&amp;method=2&amp;home=1&amp;smt=curstyle&amp;' . $GET_FORM_KEY . '&amp;style_choose=';
$hurry_styles_list = array();
if ($dh = @opendir(PATH . 'styles')) {
    while (($file = @readdir($dh)) !== false) {
        if (strpos($file, '.') === false && $file != '..' && $file != '.') {
            $hurry_styles_list[] = $file;
        }
    }
    @closedir($dh);
}
# hurry, hurry section, get languages
$hurry_lang_link = ADMIN_PATH . '?cp=g_users&smt=general&amp;smt=group_data&' . $GET_FORM_KEY . '&amp;lang_change=';
$hurry_langs_list = array();
if ($dh = @opendir(PATH . 'lang')) {
Exemplo n.º 26
0
function get_articleslist()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['cat_id'] = empty($_REQUEST['cat_id']) ? 0 : intval($_REQUEST['cat_id']);
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'a.article_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = '';
        if (!empty($filter['keyword'])) {
            $where = " AND a.title LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
        }
        if ($filter['cat_id']) {
            $where .= " AND a." . get_article_children($filter['cat_id']);
        }
        /* 文章总数 */
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('article') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac ON ac.cat_id = a.cat_id ' . 'WHERE 1 ' . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获取文章数据 */
        $sql = 'SELECT a.* , ac.cat_name ' . 'FROM ' . $GLOBALS['ecs']->table('article') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac ON ac.cat_id = a.cat_id ' . 'WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['date'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']);
        $arr[] = $rows;
    }
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Exemplo n.º 27
0
/**
 *  返回用户订单列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function order_list()
{
    global $start_date, $end_date;
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keywords'] = json_str_iconv($filter['keywords']);
        }
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'order_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $filter['start_date'] = local_date('Y-m-d', $start_date);
        $filter['end_date'] = local_date('Y-m-d', $end_date);
        $ex_where = ' WHERE 1 ';
        if ($filter['keywords']) {
            $ex_where .= " AND user_name LIKE '%" . mysqli_real_escape_string($GLOBALS['db']->link_id, $filter['keywords']) . "%'";
        }
        $ex_where .= " AND o.user_id = u.user_id AND (o.surplus != 0 OR integral_money != 0) AND `add_time` >= " . $start_date . " AND `add_time` < " . ($end_date + 86400);
        $filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o, " . $GLOBALS['ecs']->table('users') . " AS u " . $ex_where);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT o.order_id, o.order_sn, u.user_name, o.surplus, o.integral_money, o.add_time FROM " . $GLOBALS['ecs']->table('order_info') . " AS o," . $GLOBALS['ecs']->table('users') . " AS u " . $ex_where . " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
        $filter['keywords'] = stripslashes($filter['keywords']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $order_list = $GLOBALS['db']->getAll($sql);
    $count = count($order_list);
    for ($i = 0; $i < $count; $i++) {
        $order_list[$i]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $order_list[$i]['add_time']);
    }
    $arr = array('order_list' => $order_list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 28
0
/**
 * 分页获取客服列表
 *
 * @return array
 */
function customer_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'user_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = !empty($filter['keyword']) ? " AND cus_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'" : '';
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('chat_customer') . " WHERE 1=1 {$where}";
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        /* 查询 */
        $sql = "SELECT a.*, b.user_name " . "FROM " . $GLOBALS['ecs']->table('chat_customer') . " AS a LEFT JOIN " . $GLOBALS['ecs']->table('admin_user') . " AS b ON (a.user_id = b.user_id) WHERE 1=1 {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ", {$filter['page_size']}";
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db']->getAll($sql);
    foreach ($list as &$item) {
        $item['formated_add_time'] = local_date('Y-m-d H:m', $item['add_time']);
    }
    unset($item);
    $arr = array('item' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 29
0
/**
 * 获取专题列表.
 */
function get_topic_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 查询条件 */
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'topic_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('topic');
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('topic') . " ORDER BY {$filter['sort_by']} {$filter['sort_order']}";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $query = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    $res = array();
    while ($topic = $GLOBALS['db']->fetch_array($query)) {
        $topic['start_time'] = local_date('Y-m-d', $topic['start_time']);
        $topic['end_time'] = local_date('Y-m-d', $topic['end_time']);
        $topic['url'] = $GLOBALS['ecs']->url() . 'topic.php?topic_id=' . $topic['topic_id'];
        $res[] = $topic;
    }
    $arr = array('item' => $res, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 30
0
/**
 *  获取供应商列表信息
 *
 * @access  public
 * @param
 *
 * @return void
 */
function rebate_list()
{
    $result = get_filter();
    if ($result === false) {
        $aiax = isset($_GET['is_ajax']) ? $_GET['is_ajax'] : 0;
        /* 过滤信息 */
        $filter['rebate_paytime_start'] = !empty($_REQUEST['rebate_paytime_start']) ? local_strtotime($_REQUEST['rebate_paytime_start']) : 0;
        $filter['rebate_paytime_end'] = !empty($_REQUEST['rebate_paytime_end']) ? local_strtotime($_REQUEST['rebate_paytime_end'] . " 23:59:59") : 0;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? ' sr.supplier_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? ' ASC' : trim($_REQUEST['sort_order']);
        $filter['is_pay_ok'] = empty($_REQUEST['is_pay_ok']) ? '0' : intval($_REQUEST['is_pay_ok']);
        $where = 'WHERE 1 ';
        $where .= $filter['rebate_paytime_start'] ? " AND sr.rebate_paytime_start >= '" . $filter['rebate_paytime_start'] . "' " : " ";
        $where .= $filter['rebate_paytime_end'] ? " AND sr.rebate_paytime_end <= '" . $filter['rebate_paytime_end'] . "' " : " ";
        $where .= $filter['is_pay_ok'] ? " AND sr.is_pay_ok = '" . $filter['is_pay_ok'] . "' " : " AND sr.is_pay_ok = '0' ";
        /* 分页大小 */
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
            $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
        } else {
            $filter['page_size'] = 15;
        }
        /* 记录总数 */
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('supplier_rebate') . " AS sr  " . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        /* 查询 */
        $sql = "SELECT sr.* , s.supplier_name, s.supplier_rebate " . "FROM " . $GLOBALS['ecs']->table("supplier_rebate") . " AS  sr left join " . $GLOBALS['ecs']->table("supplier") . " AS s on sr.supplier_id=s.supplier_id \r\n                {$where}\r\n                ORDER BY " . $filter['sort_by'] . " " . $filter['sort_order'] . "\r\n                LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ", " . $filter['page_size'] . " ";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = array();
    $res = $GLOBALS['db']->query($sql);
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $row['rebate_paytime_start'] = local_date('Y.m.d', $row['rebate_paytime_start']);
        $endtime = $row['rebate_paytime_end'] + $GLOBALS['_CFG']['tuihuan_days_qianshou'] * 3600 * 24;
        $row['rebate_paytime_end'] = local_date('Y.m.d', $endtime);
        $row['all_money'] = $GLOBALS['db']->getOne("select sum(money_paid + surplus) from " . $GLOBALS['ecs']->table('order_info') . " where rebate_id=" . $row['rebate_id'] . " and rebate_ispay=2");
        $row['all_money_formated'] = price_format($row['all_money']);
        $row['rebate_money'] = round($row['all_money'] * $row['supplier_rebate'] / 100, 2);
        $row['rebate_money_formated'] = price_format($row['rebate_money']);
        $row['pay_money'] = $row['all_money'] - $row['rebate_money'];
        $row['pay_money_formated'] = price_format($row['pay_money']);
        $row['pay_status'] = $row['is_pay_ok'] ? "已处理,已返佣" : "未处理";
        $row['pay_time'] = local_date('Y.m.d', $row['pay_time']);
        $list[] = $row;
    }
    $arr = array('result' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}