当前位置: 首页>>代码示例>>PHP>>正文


PHP agency_where函数代码示例

本文整理汇总了PHP中agency_where函数的典型用法代码示例。如果您正苦于以下问题:PHP agency_where函数的具体用法?PHP agency_where怎么用?PHP agency_where使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了agency_where函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: agency_pay_log_list

function agency_pay_log_list()
{
    $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
    $filter['status'] = empty($_REQUEST['status']) ? '' : trim($_REQUEST['status']);
    $filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'id' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
    $where = '';
    $where .= agency_where();
    $where = preg_replace('|admin_agency_id|', 'ag.agency_id', $where);
    //dump($where);
    /* 订单号 */
    if (!empty($filter['order_sn'])) {
        $where .= " AND oi.order_sn = {$filter['order_sn']}";
    }
    /*状态*/
    if (!empty($filter['status'])) {
        $where .= " AND ag.status = {$filter['status']}";
    }
    /*代理商*/
    if (!empty($filter['admin_agency_id'])) {
        $where .= " AND ag.agency_id = {$filter['admin_agency_id']}";
    }
    $sql = "SELECT COUNT(*) FROM  " . $GLOBALS['ecs']->table('agency_pay_log') . "as ag left join " . $GLOBALS['ecs']->table('users') . " as u on u.user_id = ag.user_id left join " . $GLOBALS['ecs']->table('admin_user') . " as au on au.agency_user_id = ag.agency_id left join " . $GLOBALS['ecs']->table('order_info') . " as oi on oi.order_id = ag.order_id WHERE 1 {$where} order by {$filter['sort_by']} {$filter['sort_order']} ";
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter = page_and_size($filter);
    $sql = "SELECT ag.id,oi.order_sn,ag.order_id,au.user_name as admin_name,u.user_name,ag.order_amount,ag.time,ag.status FROM  " . $GLOBALS['ecs']->table('agency_pay_log') . "as ag left join " . $GLOBALS['ecs']->table('users') . " as u on u.user_id = ag.user_id left join " . $GLOBALS['ecs']->table('admin_user') . " as au on au.agency_user_id = ag.agency_id left join " . $GLOBALS['ecs']->table('order_info') . " as oi on oi.order_id = ag.order_id WHERE 1 {$where} order by {$filter['sort_by']} {$filter['sort_order']}  LIMIT " . $filter['start'] . ", " . $filter['page_size'] . "";
    $filter['keywords'] = stripslashes($filter['keywords']);
    set_filter($filter, $sql);
    $res = $GLOBALS['db']->getAll($sql);
    //dump($res);
    $arr = array('res' => $res, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:34,代码来源:agency_pay_log.php

示例2: get_stock_control_log

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']);
}
开发者ID:dlpc,项目名称:ecshop,代码行数:60,代码来源:stock_control_log.php

示例3: get_settings

/**
 * 获得设置信息
 *
 * @param   array   $groups     需要获得的设置组
 * @param   array   $excludes   不需要获得的设置组
 *
 * @return  array
 */
function get_settings($groups = null, $excludes = null)
{
    global $db, $ecs, $_LANG;
    $config_groups = '';
    $excludes_groups = '';
    if (!empty($groups)) {
        foreach ($groups as $key => $val) {
            $config_groups .= " AND (id='{$val}' OR parent_id='{$val}')";
        }
    }
    if (!empty($excludes)) {
        foreach ($excludes as $key => $val) {
            $excludes_groups .= " AND (parent_id<>'{$val}' AND id<>'{$val}')";
        }
    }
    /*add by hg for date 2014-05-04筛选代理商 begin*/
    $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '';
    $GLOBALS['smarty']->assign('agency_list', agency_list());
    $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
    /*end*/
    /* 隐藏skype msn ym licence */
    $hide = " code not in('ym','msn','skype','licensed') AND ";
    /* 取出全部数据:分组和变量 */
    if (if_agency() && empty($admin_agency_id)) {
        $sql = "SELECT * FROM " . $ecs->table('shop_config') . " WHERE {$hide} type<>'hidden' {$config_groups} {$excludes_groups} ORDER BY parent_id, sort_order, id";
    } else {
        // add by hg for date 2014-05-04 代理商
        $sql = "SELECT * FROM " . $ecs->table('shop_config') . " WHERE {$hide} type<>'hidden' AND parent_id <> 1 {$config_groups} {$excludes_groups} ORDER BY parent_id, sort_order, id";
    }
    $item_list = $db->getAll($sql);
    /*add by hg for date 2014-05-04 代理商商店设置信息*/
    if (!if_agency() || !empty($admin_agency_id)) {
        $agency_where = agency_where($admin_agency_id);
        $agency_list = $db->getAll("SELECT * FROM " . $ecs->table('agency_shop_config') . " WHERE {$hide} type<>'hidden' {$agency_where} {$config_groups} {$excludes_groups} ORDER BY parent_id, sort_order, id");
        $item_list = array_merge($item_list, $agency_list);
    }
    /* 整理数据 */
    $group_list = array();
    foreach ($item_list as $key => $item) {
        $pid = $item['parent_id'];
        $item['name'] = isset($_LANG['cfg_name'][$item['code']]) ? $_LANG['cfg_name'][$item['code']] : $item['code'];
        $item['desc'] = isset($_LANG['cfg_desc'][$item['code']]) ? $_LANG['cfg_desc'][$item['code']] : '';
        if ($item['code'] == 'sms_shop_mobile') {
            $item['url'] = 1;
        }
        if ($pid == 0) {
            /* 分组 */
            if ($item['type'] == 'group') {
                $group_list[$item['id']] = $item;
            }
        } else {
            //dump($group_list[$pid]);
            /* 变量 */
            if (isset($group_list[$pid])) {
                if ($item['store_range']) {
                    $item['store_options'] = explode(',', $item['store_range']);
                    foreach ($item['store_options'] as $k => $v) {
                        $item['display_options'][$k] = isset($_LANG['cfg_range'][$item['code']][$v]) ? $_LANG['cfg_range'][$item['code']][$v] : $v;
                    }
                }
                $group_list[$pid]['vars'][] = $item;
            }
        }
    }
    return $group_list;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:74,代码来源:shop_config.php

示例4: goods_list

/**
 * 获得商品列表
 *
 * @access  public
 * @params  integer $isdelete
 * @params  integer $real_goods
 * @params  integer $conditions
 * @return  array
 */
function goods_list($is_delete, $real_goods = 1, $conditions = '')
{
    /* 过滤条件 */
    $param_str = '-' . $is_delete . '-' . $real_goods;
    $result = get_filter($param_str);
    if ($result === false) {
        $day = getdate();
        $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']);
        $filter['cat_id'] = empty($_REQUEST['cat_id']) ? 0 : intval($_REQUEST['cat_id']);
        $filter['intro_type'] = empty($_REQUEST['intro_type']) ? '' : trim($_REQUEST['intro_type']);
        $filter['is_promote'] = empty($_REQUEST['is_promote']) ? 0 : intval($_REQUEST['is_promote']);
        $filter['stock_warning'] = empty($_REQUEST['stock_warning']) ? 0 : intval($_REQUEST['stock_warning']);
        $filter['brand_id'] = empty($_REQUEST['brand_id']) ? 0 : intval($_REQUEST['brand_id']);
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        $filter['suppliers_id'] = isset($_REQUEST['suppliers_id']) ? empty($_REQUEST['suppliers_id']) ? '' : trim($_REQUEST['suppliers_id']) : '';
        $filter['is_on_sale'] = isset($_REQUEST['is_on_sale']) ? empty($_REQUEST['is_on_sale']) && $_REQUEST['is_on_sale'] === 0 ? '' : trim($_REQUEST['is_on_sale']) : '';
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'goods_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $filter['extension_code'] = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']);
        $filter['is_delete'] = $is_delete;
        $filter['real_goods'] = $real_goods;
        /*代理商*/
        $filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
        /*add by hg for date 2014-04-22		只显示代理商本身的产品*/
        $where = agency_where();
        /*end*/
        $where .= $filter['cat_id'] > 0 ? " AND " . get_children($filter['cat_id']) : '';
        //print_r($where);die;
        /* 推荐类型 */
        switch ($filter['intro_type']) {
            case 'is_best':
                $where .= " AND is_best=1";
                break;
            case 'is_hot':
                $where .= ' AND is_hot=1';
                break;
            case 'is_new':
                $where .= ' AND is_new=1';
                break;
            case 'is_promote':
                $where .= " AND is_promote = 1 AND promote_price > 0 AND promote_start_date <= '{$today}' AND promote_end_date >= '{$today}'";
                break;
            case 'all_type':
                $where .= " AND (is_best=1 OR is_hot=1 OR is_new=1 OR (is_promote = 1 AND promote_price > 0 AND promote_start_date <= '" . $today . "' AND promote_end_date >= '" . $today . "'))";
        }
        /* 库存警告 */
        if ($filter['stock_warning']) {
            $where .= ' AND goods_number <= warn_number ';
        }
        /* 品牌 */
        if ($filter['brand_id']) {
            $where .= " AND brand_id='{$filter['brand_id']}'";
        }
        /* 扩展 */
        if ($filter['extension_code']) {
            $where .= " AND extension_code='{$filter['extension_code']}'";
        }
        /* 关键字 */
        if (!empty($filter['keyword'])) {
            $where .= " AND (goods_sn LIKE '%" . mysql_like_quote($filter['keyword']) . "%' OR goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%')";
        }
        if ($real_goods > -1) {
            $where .= " AND is_real='{$real_goods}'";
        }
        /* 上架 */
        if ($filter['is_on_sale'] !== '') {
            $where .= " AND (is_on_sale = '" . $filter['is_on_sale'] . "')";
        }
        /* 供货商 */
        if (!empty($filter['suppliers_id'])) {
            $where .= " AND (suppliers_id = '" . $filter['suppliers_id'] . "')";
        }
        /*add by hg for date 2014-04-21 可选商品*/
        if (if_agency()) {
            if (!empty($filter['admin_agency_id'])) {
                $where .= " AND (admin_agency_id = {$filter['admin_agency_id']} )";
            } else {
                $where .= " AND (admin_agency_id = 0 )";
            }
        }
        //dump($where);
        $where .= $conditions;
        /* 记录总数 */
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='{$is_delete}' {$where}";
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT cat_id,start_num,host_goods_id,goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number,costing_price, integral,admin_agency_id, province_name,city_name,area_name, " . " (promote_price > 0 AND promote_start_date <= '{$today}' AND promote_end_date >= '{$today}') AS is_promote " . " FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='{$is_delete}' {$where}" . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ",{$filter['page_size']}";
//.........这里部分代码省略.........
开发者ID:dlpc,项目名称:ecshop,代码行数:101,代码来源:lib_goods.php

示例5: auction_list

function auction_list()
{
    $result = get_filter();
    if ($result === false) {
        /*add by hg for date 2014-05-08 获取代理商信息 begin*/
        $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
        //dump($admin_agency_id);
        $agency_list = agency_list();
        $GLOBALS['smarty']->assign('agency_list', $agency_list);
        $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
        $action_list = if_agency() ? 'all' : '';
        $GLOBALS['smarty']->assign('all', $action_list);
        /*end*/
        $where = "";
        //根据代理商过滤信息
        $where .= agency_where();
        /*add by hg for date 2014-05-08 根据代理商筛选  begin*/
        if (if_agency() && !empty($admin_agency_id)) {
            $where .= " AND admin_agency_id = '{$admin_agency_id}' ";
        } elseif (if_agency()) {
            $where .= " AND admin_agency_id = '0' ";
        }
        /*end*
          /* 过滤条件 */
        $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']);
        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;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:62,代码来源:auction.php

示例6: agency_shop_config

/**
* 获取代理商商店配置信息
* add by hg for date 2014-04-22 
* $agency_id 指定代理商id
**/
function agency_shop_config($agency_user_id = '')
{
    if (!$agency_user_id) {
        $agency_user_id = agency_id();
    }
    $where = agency_where($agency_user_id);
    $agency_shop_config = array();
    if ($where) {
        $agency_shop_config = $GLOBALS['db']->getAll("select code,value from " . $GLOBALS['ecs']->table('agency_shop_config') . "where 1 {$where}");
    }
    foreach ($agency_shop_config as $k => $v) {
        $GLOBALS['_CFG'][$v['code']] = $v['value'];
    }
    /* 特殊处理大学城地址不开放注册 
    	if(agency_url() == 'dxc.txd168.com')
    	{
    		$GLOBALS['_CFG']['anonymous_buy'] = '0';
    	}*/
}
开发者ID:dlpc,项目名称:ecshop,代码行数:24,代码来源:lib_common.php

示例7: get_stock_control_log

function get_stock_control_log()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        $filter['delete'] = empty($_REQUEST['delete']) ? '' : trim($_REQUEST['delete']);
        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['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
        /*add by ccx  for date 2014-11-27		只显示代理商本身*/
        $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_info_sn LIKE '%" . mysql_like_quote($filter['keyword']) . "%' )";
        }
        if (empty($filter['delete'])) {
            $where .= ' AND stock_status !=3 ';
        }
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('stock_goods') . ' 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_goods') . ' 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'];
    }
    //echo $sql;
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $arr[] = $rows;
    }
    $overall_order_amount = overall_order_amount($sql);
    //总的计算
    $GLOBALS['smarty']->assign('costing_price_amount', price_format($overall_order_amount['costing_price_amount']));
    $GLOBALS['smarty']->assign('goods_number_amount', $overall_order_amount['goods_number_amount']);
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
开发者ID:dlpc,项目名称:ecshop,代码行数:52,代码来源:goods_stock_list.php

示例8: get_bookinglist

/**
 * 获取订购信息
 *
 * @access  public
 *
 * @return array
 */
function get_bookinglist()
{
    /* 查询条件 */
    $filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']);
    $filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
    if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
        $filter['keywords'] = json_str_iconv($filter['keywords']);
    }
    $filter['dispose'] = empty($_REQUEST['dispose']) ? 0 : intval($_REQUEST['dispose']);
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'sort_order' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
    $where = !empty($_REQUEST['keywords']) ? " AND g.goods_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%' " : '';
    $where .= !empty($_REQUEST['dispose']) ? " AND bg.is_dispose = '{$filter['dispose']}' " : '';
    /*加入代理商条件*/
    if (!$filter['admin_agency_id']) {
        $agency_where = agency_where();
        if (!$agency_where) {
            $agency_where = "AND bg.admin_agency_id = 0";
        } else {
            $arr = explode(' ', $agency_where);
            $arr[2] = 'bg.' . $arr[2];
            $agency_where = implode(' ', $arr);
        }
    } else {
        $agency_where = " AND bg.admin_agency_id = {$filter['admin_agency_id']}";
    }
    $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('booking_goods') . ' AS bg, ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "WHERE bg.goods_id = g.goods_id {$where} {$agency_where}";
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    /* 分页大小 */
    $filter = page_and_size($filter);
    /* 获取活动数据 */
    $sql = 'SELECT bg.rec_id, bg.link_man, g.goods_id, g.goods_name, bg.goods_number, bg.booking_time, bg.is_dispose ' . 'FROM ' . $GLOBALS['ecs']->table('booking_goods') . ' AS bg, ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "WHERE bg.goods_id = g.goods_id {$where} {$agency_where} " . "ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . "LIMIT " . $filter['start'] . ", {$filter['page_size']}";
    $row = $GLOBALS['db']->getAll($sql);
    foreach ($row as $key => $val) {
        $row[$key]['booking_time'] = local_date($GLOBALS['_CFG']['time_format'], $val['booking_time']);
    }
    $filter['keywords'] = stripslashes($filter['keywords']);
    $arr = array('item' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:47,代码来源:goods_booking.php

示例9: account_list

/**
 *
 *
 * @access  public
 * @param
 *
 * @return void
 */
function account_list()
{
    $result = get_filter();
    if ($result === false) {
        /*add by hg for date 2014-04-23 获取代理商信息 begin*/
        $filter['admin_agency_id'] = !empty($_REQUEST['admin_agency_id']) ? intval($_REQUEST['admin_agency_id']) : 0;
        $GLOBALS['smarty']->assign('agency_list', agency_list());
        $GLOBALS['smarty']->assign('admin_agency_id', $filter['admin_agency_id']);
        $action_list = if_agency() ? 'all' : '';
        $GLOBALS['smarty']->assign('all', $action_list);
        /*end*/
        /*时间*/
        //dump($filter);
        /* 过滤列表 */
        $filter['user_id'] = !empty($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0;
        $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['process_type'] = isset($_REQUEST['process_type']) ? intval($_REQUEST['process_type']) : -1;
        $filter['payment'] = empty($_REQUEST['payment']) ? '' : trim($_REQUEST['payment']);
        $filter['is_paid'] = isset($_REQUEST['is_paid']) ? intval($_REQUEST['is_paid']) : -1;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : 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('-7 days') : $_REQUEST['start_date'];
        $filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : $_REQUEST['end_date'];
        if (strpos($filter['start_date'], '-')) {
            $filter['start_date'] = local_strtotime($filter['start_date']);
            $filter['end_date'] = local_strtotime($filter['end_date']);
        }
        $where = " WHERE 1 ";
        /*add by hg for date 2014-04-22 只显示代理商本身所属信息 begin*/
        $where .= agency_where();
        /*end*/
        if ($filter['user_id'] > 0) {
            $where .= " AND ua.user_id = '{$filter['user_id']}' ";
        }
        if ($filter['process_type'] != -1) {
            $where .= " AND ua.process_type = '{$filter['process_type']}' ";
        } else {
            $where .= " AND ua.process_type " . db_create_in(array(SURPLUS_SAVE, SURPLUS_RETURN));
        }
        if ($filter['payment']) {
            $where .= " AND ua.payment = '{$filter['payment']}' ";
        }
        if ($filter['is_paid'] != -1) {
            $where .= " AND ua.is_paid = '{$filter['is_paid']}' ";
        }
        if ($filter['keywords']) {
            $where .= " AND u.user_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('user_account') . " AS ua, " . $GLOBALS['ecs']->table('users') . " AS u " . $where;
        }
        /* 时间过滤 */
        if (!empty($filter['start_date']) && !empty($filter['end_date'])) {
            $where .= "AND add_time >= " . $filter['start_date'] . " AND add_time < '" . $filter['end_date'] . "'";
        }
        /*add by hg for date 2014-04-23 根据代理商筛选 begin*/
        if ($filter['admin_agency_id'] > 0 && if_agency()) {
            $where .= " AND ua.admin_agency_id  = '{$filter['admin_agency_id']}' ";
        }
        /*end*/
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('user_account') . " AS ua LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u on ua.user_id = u.user_id" . $where;
        //dump($sql);
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        /* 查询数据 */
        $sql = 'SELECT ua.*, u.user_name FROM ' . $GLOBALS['ecs']->table('user_account') . ' AS ua LEFT JOIN ' . $GLOBALS['ecs']->table('users') . ' AS u ON ua.user_id = u.user_id' . $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'];
    }
    $list = $GLOBALS['db']->getAll($sql);
    tongji($sql);
    foreach ($list as $key => $value) {
        $list[$key]['surplus_amount'] = price_format(abs($value['amount']), false);
        $list[$key]['add_date'] = local_date($GLOBALS['_CFG']['time_format'], $value['add_time']);
        $list[$key]['process_type_name'] = $GLOBALS['_LANG']['surplus_type_' . $value['process_type']];
    }
    $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']);
    $arr = array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:96,代码来源:user_account.php

示例10: group_buy_list

function group_buy_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $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']) ? 'act_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        /*加入代理商条件*/
        if (!$filter['admin_agency_id']) {
            $agency_where = agency_where();
            if (!$agency_where) {
                $agency_where = "AND admin_agency_id = 0";
            }
        } else {
            $agency_where = " AND admin_agency_id = {$filter['admin_agency_id']}";
        }
        $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}  {$agency_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} {$agency_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;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:71,代码来源:group_buy.php

示例11: get_snatchlist

/**
 * 获取活动列表
 *
 * @access  public
 *
 * @return void
 */
function get_snatchlist()
{
    $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']) ? 'act_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        /*add by hg for date 2014-05-08 获取代理商信息 begin*/
        $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
        //dump($admin_agency_id);
        $agency_list = agency_list();
        $GLOBALS['smarty']->assign('agency_list', $agency_list);
        $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
        $action_list = if_agency() ? 'all' : '';
        $GLOBALS['smarty']->assign('all', $action_list);
        /*end*/
        //根据代理商过滤信息
        $where = agency_where();
        $where .= !empty($filter['keywords']) ? " AND act_name like '%" . mysql_like_quote($filter['keywords']) . "%'" : '';
        /*add by hg for date 2014-05-08 根据代理商筛选  begin*/
        if (if_agency() && !empty($admin_agency_id)) {
            $where .= " AND admin_agency_id = '{$admin_agency_id}' ";
        } elseif (if_agency()) {
            $where .= " AND admin_agency_id = '0' ";
        }
        /*end*/
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type =" . GAT_SNATCH . $where;
        //dump($sql);
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获活动数据 */
        $sql = "SELECT act_id, act_name AS snatch_name, goods_name, start_time, end_time, is_finished, ext_info, product_id " . " FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = " . GAT_SNATCH . $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'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    foreach ($row as $key => $val) {
        $row[$key]['start_time'] = local_date($GLOBALS['_CFG']['time_format'], $val['start_time']);
        $row[$key]['end_time'] = local_date($GLOBALS['_CFG']['time_format'], $val['end_time']);
        $info = unserialize($row[$key]['ext_info']);
        unset($row[$key]['ext_info']);
        if ($info) {
            foreach ($info as $info_key => $info_val) {
                $row[$key][$info_key] = $info_val;
            }
        }
    }
    $arr = array('snatchs' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:64,代码来源:snatch.php

示例12: get_sale_list

/**
 * 取得销售明细数据信息
 * @param   bool  $is_pagination  是否分页
 * @return  array   销售明细数据
 */
function get_sale_list($is_pagination = true)
{
    /* 时间参数 */
    $filter['start_date'] = empty($_REQUEST['start_date']) ? local_strtotime('-7 days') : local_strtotime($_REQUEST['start_date']);
    $filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : local_strtotime($_REQUEST['end_date']);
    /*add by hg for date 2014-04-23 获取代理商信息 begin*/
    $filter['admin_agency_id'] = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
    /*add by ccx for date 2014-11-12 获取支付类型payment_method*/
    $filter['payment_method'] = empty($_REQUEST['payment_method']) ? '' : trim($_REQUEST['payment_method']);
    /*end*/
    $res = agency_list();
    $agency_list = array('-' => '全站');
    foreach ($res as $re_k => $res_v) {
        $agency_list[$re_k] = $res_v;
    }
    $GLOBALS['smarty']->assign('agency_list', $agency_list);
    $GLOBALS['smarty']->assign('admin_agency_id', $filter['admin_agency_id']);
    $action_list = if_agency() ? 'all' : '';
    $GLOBALS['smarty']->assign('all', $action_list);
    /*end*/
    /*add by hg for date 2014-04-22		加入代理商条件*/
    $agency_where = agency_where();
    if (!empty($agency_where)) {
        $whereArr = explode(' ', $agency_where);
        $sale_where = $whereArr[0] . $whereArr[1] . ' oi.' . $whereArr[2] . $whereArr[3] . $whereArr[4];
    }
    /*end*/
    /* 查询数据的条件 */
    $where = " WHERE og.order_id = oi.order_id" . order_query_sql('finished', 'oi.') . " AND oi.add_time >= '" . $filter['start_date'] . "' \r\n               AND oi.add_time < '" . ($filter['end_date'] + 86400) . "'{$sale_where}";
    /*add by hg for date 2014-04-23 根据代理商筛选  begin*/
    if (!empty($filter['admin_agency_id']) && if_agency()) {
        if ($filter['admin_agency_id'] != '-') {
            $where .= " AND oi.admin_agency_id = " . $filter['admin_agency_id'];
        }
    } elseif (if_agency()) {
        $where .= " AND admin_agency_id = '0' ";
    }
    /*en
    	/*end*/
    /*add by ccx for date 2014-11-12  根据选择支付类型(余额支付,货到付款,在线支付三种)筛选  begin*/
    if ($filter['payment_method']) {
        //$where .= " AND o.pay_id  = '$filter[payment_method]'";
        if ($filter['payment_method'] == 3) {
            $where .= " AND ( oi.pay_id !=1 AND oi.pay_id !=2 AND oi.pay_id !=0)";
        } elseif ($filter['payment_method'] == 1) {
            $where .= " AND oi.pay_id  = 1";
        } elseif ($filter['payment_method'] == 2) {
            $where .= " AND oi.pay_id  = 2";
        }
    }
    /*end*/
    $sql = "SELECT COUNT(og.goods_id) FROM " . $GLOBALS['ecs']->table('order_info') . ' AS oi,' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' . $where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    /* 分页大小 */
    $filter = page_and_size($filter);
    /* modify by SouthBear 2014-12-04 16:13:04
     * 增加 oi.order_amount, oi.goods_amount order_amount 字段用途不明,TABLE中无数据
     */
    $sql = 'SELECT og.goods_id, og.costing_price,og.goods_sn, og.goods_name, og.goods_number AS goods_num, 
    		og.goods_price AS sales_price, oi.add_time AS sales_time, oi.order_id, oi.order_sn,oi.order_amount,
    		oi.goods_amount , og.stock_costing_price ' . "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . $GLOBALS['ecs']->table('order_info') . " AS oi " . $where . " ORDER BY sales_time DESC, goods_num DESC";
    $statistics_sql = $sql;
    if ($is_pagination) {
        $sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
    }
    $sale_list_data = $GLOBALS['db']->getAll($sql);
    /* modify by SouthBear 2014-12-04 16:13:04
     * 将订单成本和订单金额重新计算
     */
    //if (count($sale_list_data) > 0) {
    foreach ($sale_list_data as $key => $item) {
        //$sale_list_data[$key]['profit_total'] = price_format(($sale_list_data[$key]['sales_price'] - $sale_list_data[$key]['costing_price'])*$sale_list_data[$key]['goods_num']); //利润
        /*ccx 2014-12-10 订单商品的利润*/
        $sale_list_data[$key]['profit_total'] = price_format($sale_list_data[$key]['sales_price'] * $sale_list_data[$key]['goods_num'] - $sale_list_data[$key]['stock_costing_price']);
        //利润
        $sale_list_data[$key]['unit_sales_price'] = price_format($sale_list_data[$key]['sales_price']);
        //订单单价
        //成本
        $sale_list_data[$key]['unit_costing_price'] = price_format($sale_list_data[$key]['costing_price']);
        //成本单价
        //$sale_list_data[$key]['order_costing_price'] = price_format($sale_list_data[$key]['costing_price'] * $sale_list_data[$key]['goods_num']); //订单成本
        /*ccx 2014-12-10 ccx 读取订单商品表新建的库存商品成本总价*/
        $sale_list_data[$key]['order_costing_price'] = $sale_list_data[$key]['stock_costing_price'];
        //订单成本总价
        //订单总金额
        $sale_list_data[$key]['goods_amount'] = price_format($sale_list_data[$key]['sales_price'] * $sale_list_data[$key]['goods_num']);
        $sale_list_data[$key]['sales_time'] = local_date($GLOBALS['_CFG']['time_format'], $sale_list_data[$key]['sales_time']);
    }
    $statistics = statistics($statistics_sql);
    $arr = array('sale_list_data' => $sale_list_data, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count'], 'statistics' => $statistics);
    //} else {
    //	$arr = false;
    //}
    return $arr;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:100,代码来源:sale_list.php

示例13: delivery_list

/**
 *  获取发货单列表信息
 *
 * @access  public
 * @param
 *
 * @return void
 */
function delivery_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤信息 */
        $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
        if (!empty($_GET['is_ajax']) && $_GET['is_ajax'] == 1) {
            $_REQUEST['consignee'] = json_str_iconv($_REQUEST['consignee']);
            //$_REQUEST['address'] = json_str_iconv($_REQUEST['address']);
        }
        /*add by hg for date 2014-04-23 获取代理商id begin*/
        $filter['admin_agency_id'] = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : 0;
        /*end*/
        /*add by ccx for date 2014-11-12 获取支付类型payment_method*/
        $filter['payment_method'] = empty($_REQUEST['payment_method']) ? '' : trim($_REQUEST['payment_method']);
        /*end*/
        $filter['start_date'] = empty($_REQUEST['start_date']) ? local_strtotime('-360 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']);
        }
        //dump(date('Y-m-d H-i-s',$filter['end_date']));
        $filter['pay_id'] = empty($_REQUEST['pay_id']) ? 0 : intval($_REQUEST['pay_id']);
        $filter['order_status'] = isset($_REQUEST['order_status']) ? intval($_REQUEST['order_status']) : -1;
        $filter['shipping_status'] = isset($_REQUEST['shipping_status']) ? intval($_REQUEST['shipping_status']) : -1;
        $filter['pay_status'] = isset($_REQUEST['pay_status']) ? intval($_REQUEST['pay_status']) : -1;
        $filter['user_id'] = empty($_REQUEST['user_id']) ? 0 : intval($_REQUEST['user_id']);
        $filter['user_name'] = empty($_REQUEST['user_name']) ? '' : trim($_REQUEST['user_name']);
        $filter['composite_status'] = isset($_REQUEST['composite_status']) ? intval($_REQUEST['composite_status']) : -1;
        $filter['group_buy_id'] = isset($_REQUEST['group_buy_id']) ? intval($_REQUEST['group_buy_id']) : 0;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $filter['start_time'] = empty($_REQUEST['start_time']) ? '' : (strpos($_REQUEST['start_time'], '-') > 0 ? local_strtotime($_REQUEST['start_time']) : $_REQUEST['start_time']);
        $filter['end_time'] = empty($_REQUEST['end_time']) ? '' : (strpos($_REQUEST['end_time'], '-') > 0 ? local_strtotime($_REQUEST['end_time']) : $_REQUEST['end_time']);
        $where = 'WHERE 1 ';
        /*add by hg for date 2014-04-22 只显示代理商本身所属订单 begin*/
        $where .= agency_where();
        /*end*/
        if ($filter['order_sn']) {
            $where .= " AND o.order_sn LIKE '%" . mysql_like_quote($filter['order_sn']) . "%'";
        }
        if ($filter['consignee']) {
            $where .= " AND o.consignee LIKE '%" . mysql_like_quote($filter['consignee']) . "%'";
        }
        if ($filter['email']) {
            $where .= " AND o.email LIKE '%" . mysql_like_quote($filter['email']) . "%'";
        }
        if ($filter['address']) {
            $where .= " AND o.address LIKE '%" . mysql_like_quote($filter['address']) . "%'";
        }
        if ($filter['zipcode']) {
            $where .= " AND o.zipcode LIKE '%" . mysql_like_quote($filter['zipcode']) . "%'";
        }
        if ($filter['tel']) {
            $where .= " AND o.tel LIKE '%" . mysql_like_quote($filter['tel']) . "%'";
        }
        if ($filter['mobile']) {
            $where .= " AND o.mobile LIKE '%" . mysql_like_quote($filter['mobile']) . "%'";
        }
        if ($filter['country']) {
            $where .= " AND o.country = '{$filter['country']}'";
        }
        if ($filter['province']) {
            $where .= " AND o.province = '{$filter['province']}'";
        }
        if ($filter['city']) {
            $where .= " AND o.city = '{$filter['city']}'";
        }
        if ($filter['district']) {
            $where .= " AND o.district = '{$filter['district']}'";
        }
        if ($filter['shipping_id']) {
            $where .= " AND o.shipping_id  = '{$filter['shipping_id']}'";
        }
        if ($filter['pay_id']) {
            $where .= " AND o.pay_id  = '{$filter['pay_id']}'";
        }
        /* ccx 2014-11-12  增加了对支付类型的搜索功能*/
        if ($filter['payment_method']) {
            //$where .= " AND o.pay_id  = '$filter[payment_method]'";
            if ($filter['payment_method'] == 3) {
                $where .= " AND ( o.pay_id !=1 AND o.pay_id !=2 AND o.pay_id !=0)";
            } elseif ($filter['payment_method'] == 1) {
                $where .= " AND o.pay_id  = 1";
            } elseif ($filter['payment_method'] == 2) {
                $where .= " AND o.pay_id  = 2";
            }
        }
        if ($filter['order_status'] != -1) {
            $where .= " AND o.order_status  = '{$filter['order_status']}'";
        }
//.........这里部分代码省略.........
开发者ID:dlpc,项目名称:ecshop,代码行数:101,代码来源:split_share.php

示例14: get_goods_stock_info

function get_goods_stock_info()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        $filter['status'] = strval(trim($_REQUEST['status']));
        //m1
        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']);
        $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 ) ";
            }
        }
        //m1 增加采购订单查询条件
        if (strlen(trim($_REQUEST['status'])) > 0) {
            $where .= " AND (a.stock_status = " . $filter['status'] . " ) ";
        }
        if (!empty($filter['keyword'])) {
            $where .= " AND (a.stock_info_sn LIKE '%" . mysql_like_quote($filter['keyword']) . "%' )";
        }
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('stock_info') . ' 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_info') . ' 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'];
    }
    //echo $sql.'<br/>';
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $arr[] = $rows;
    }
    //显示采购订单的相关信息:包括库存数量,以及采购总价,当页的采购价格等等
    $sql_limit = $sql . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
    $overall_order_amount = overall_order_amount($sql);
    //总的计算
    $current_order_amount = current_order_amount($sql_limit);
    // 当前页的计算
    $GLOBALS['smarty']->assign('costing_price_amount', price_format($overall_order_amount['costing_price_amount']));
    $GLOBALS['smarty']->assign('goods_number_amount', $overall_order_amount['goods_number_amount']);
    $GLOBALS['smarty']->assign('current_costing_price_amount', price_format($current_order_amount['current_costing_price_amount']));
    $GLOBALS['smarty']->assign('current_goods_number_amount', $current_order_amount['current_goods_number_amount']);
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
开发者ID:dlpc,项目名称:ecshop,代码行数:59,代码来源:goods_stock_info.php

示例15: get_orderinfo

/**
 * 取得订单概况数据(包括订单的几种状态)
 * @param       $start_date    开始查询的日期
 * @param       $end_date      查询的结束日期
 * @return      $order_info    订单概况数据
 */
function get_orderinfo($start_date, $end_date)
{
    /*add by hg for date 2014-04-23 获取代理商信息与根据代理商筛选 begin*/
    $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
    $res = agency_list();
    $agency_list = array('-' => '全站订单统计');
    foreach ($res as $re_k => $res_v) {
        $agency_list[$re_k] = $res_v;
    }
    $GLOBALS['smarty']->assign('agency_list', $agency_list);
    $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
    $action_list = if_agency() ? 'all' : '';
    $GLOBALS['smarty']->assign('all', $action_list);
    if (!empty($admin_agency_id) && if_agency()) {
        if ($admin_agency_id != '-') {
            $agency_where = " AND admin_agency_id = '{$admin_agency_id}' ";
        }
    } elseif (if_agency()) {
        $agency_where = " AND admin_agency_id = '0' ";
    }
    /*end*
    	
        $order_info = array();
    	/*add by hg for date 2014-04-22		获取客户统计信息加入条件判定为当前代理商下的客户信息*/
    $where = agency_where();
    /*end*/
    /* 未确认订单数 */
    $sql = 'SELECT COUNT(*) AS unconfirmed_num FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_status = '" . OS_UNCONFIRMED . "' AND add_time >= '{$start_date}'" . " AND add_time < '" . ($end_date + 86400) . "' {$where} {$agency_where}";
    $order_info['unconfirmed_num'] = $GLOBALS['db']->getOne($sql);
    /* 已确认订单数 */
    $sql = 'SELECT COUNT(*) AS confirmed_num FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_status IN (1,5) AND shipping_status IN (0,5) AND pay_status IN (2,0) AND add_time >= '{$start_date}'" . " AND add_time < '" . ($end_date + 86400) . "' {$where} {$agency_where}";
    // dump($sql);
    $order_info['confirmed_num'] = $GLOBALS['db']->getOne($sql);
    /* 已成交订单数 */
    $sql = 'SELECT COUNT(*) AS succeed_num FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE 1 " . order_query_sql('finished') . " AND add_time >= '{$start_date}' AND add_time < '" . ($end_date + 86400) . "' {$where} {$agency_where}";
    $order_info['succeed_num'] = $GLOBALS['db']->getOne($sql);
    /* 无效或已取消订单数 */
    $sql = "SELECT COUNT(*) AS invalid_num FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_status IN ('2','4','3') {$where} {$agency_where}" . " AND add_time >= '{$start_date}' AND add_time < '" . ($end_date + 86400) . "'";
    $order_info['invalid_num'] = $GLOBALS['db']->getOne($sql);
    return $order_info;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:47,代码来源:order_stats.php


注:本文中的agency_where函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。