本文整理汇总了PHP中if_agency函数的典型用法代码示例。如果您正苦于以下问题:PHP if_agency函数的具体用法?PHP if_agency怎么用?PHP if_agency使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了if_agency函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
示例2: get_comment_list
/**
* 获取评论列表
* @access public
* @return array
*/
function get_comment_list()
{
/*add by hg for date 2014-04-30 代理商筛选 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 ($admin_agency_id) {
$agency_user_id = $admin_agency_id;
} else {
$agency_user_id = $GLOBALS['db']->getOne("select agency_user_id from " . $GLOBALS['ecs']->table('admin_user') . " where user_id = {$_SESSION['admin_id']}");
}
if (!empty($agency_user_id)) {
if ($agency_user_id != '-') {
$join = "left join " . $GLOBALS['ecs']->table('goods') . " as g on g.goods_id = c.id_value";
$join_where = "AND g.admin_agency_id = {$agency_user_id}";
}
} elseif (empty($agency_user_id) && if_agency()) {
$join = "left join " . $GLOBALS['ecs']->table('goods') . " as g on g.goods_id = c.id_value";
$join_where = "AND g.admin_agency_id = 0";
}
/*end*/
/* 查询条件 */
$filter['keywords'] = empty($_REQUEST['keywords']) ? 0 : trim($_REQUEST['keywords']);
//print_r($filter['keywords']);die;
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$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']);
$where = !empty($filter['keywords']) ? " AND content LIKE '%" . mysql_like_quote($filter['keywords']) . "%' " : '';
$sql = "SELECT count(*) FROM " . $GLOBALS['ecs']->table('comment') . " WHERE parent_id = 0 {$where}";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
//print_r($filter);die;
/* 获取评论数据 */
$arr = array();
$sql = "SELECT c.* FROM " . $GLOBALS['ecs']->table('comment') . " as c {$join} WHERE parent_id = 0 {$join_where} {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ", {$filter['page_size']}";
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res)) {
$sql = $row['comment_type'] == 0 ? "SELECT goods_name FROM " . $GLOBALS['ecs']->table('goods') . " WHERE goods_id='{$row['id_value']}'" : "SELECT title FROM " . $GLOBALS['ecs']->table('article') . " WHERE article_id='{$row['id_value']}'";
$row['title'] = $GLOBALS['db']->getOne($sql);
/* 标记是否回复过 */
// $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('comment'). " WHERE parent_id = '$row[comment_id]'";
// $row['is_reply'] = ($GLOBALS['db']->getOne($sql) > 0) ?
// $GLOBALS['_LANG']['yes_reply'] : $GLOBALS['_LANG']['no_reply'];
$row['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
$arr[] = $row;
}
$filter['keywords'] = stripslashes($filter['keywords']);
$arr = array('item' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例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;
}
示例4: 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;
}
示例5: empty
$code = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']);
if ($_REQUEST['act'] == 'query') {
$goods_list = goods_list($is_delete, $code == '' ? 1 : 0);
$tpl = $is_delete ? 'goods_trash.htm' : 'goods_list.htm';
} elseif ($_REQUEST['act'] == 'special_query') {
$goods_list = goods_list(0, 1, ' AND is_special=1 ');
$tpl = $is_delete ? 'goods_trash.htm' : 'goods_special_list.htm';
}
$handler_list = array();
$handler_list['virtual_card'][] = array('url' => 'virtual_card.php?act=card', 'title' => $_LANG['card'], 'img' => 'icon_send_bonus.gif');
$handler_list['virtual_card'][] = array('url' => 'virtual_card.php?act=replenish', 'title' => $_LANG['replenish'], 'img' => 'icon_add.gif');
$handler_list['virtual_card'][] = array('url' => 'virtual_card.php?act=batch_card_add', 'title' => $_LANG['batch_card_add'], 'img' => 'icon_output.gif');
if (isset($handler_list[$code])) {
$smarty->assign('add_handler', $handler_list[$code]);
}
$action_list = if_agency() ? 'all' : '';
$smarty->assign('all', $action_list);
$smarty->assign('code', $code);
$smarty->assign('goods_list', $goods_list['goods']);
$smarty->assign('filter', $goods_list['filter']);
$smarty->assign('record_count', $goods_list['record_count']);
$smarty->assign('page_count', $goods_list['page_count']);
$smarty->assign('list_type', $is_delete ? 'trash' : 'goods');
$smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1);
/* 排序标记 */
$sort_flag = sort_flag($goods_list['filter']);
$smarty->assign($sort_flag['tag'], $sort_flag['img']);
/* 获取商品类型存在规格的类型 */
$specifications = get_goods_type_specifications();
$smarty->assign('specifications', $specifications);
make_json_result($smarty->fetch($tpl), '', array('filter' => $goods_list['filter'], 'page_count' => $goods_list['page_count']));
示例6: back_list
/**
* 获取退货单列表信息
*
* @access public
* @param
*
* @return void
*/
function back_list()
{
$result = get_filter();
if ($result === false) {
$aiax = isset($_GET['is_ajax']) ? $_GET['is_ajax'] : 0;
/*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*/
/* 过滤信息 */
$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 ';
/*add by hg for date 2014-04-22 只显示代理商本身所属订单 begin*/
$where .= agency_where();
/*end*/
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']) . "%'";
}
/*add by hg for date 2014-04-23 根据代理商筛选 begin*/
if (if_agency()) {
if (!empty($filter['admin_agency_id'])) {
if ($filter['admin_agency_id'] != '-') {
$where .= " AND admin_agency_id = {$filter['admin_agency_id']}";
}
} else {
$where .= " AND admin_agency_id = 0";
}
}
/*end*/
/* 获取管理员信息 */
$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;
/* 查询 */
$sql = "SELECT back_id, delivery_sn, order_sn, order_id, add_time, action_user, consignee, country,\r\n province, city, district, tel, status, update_time, email, return_time\r\n FROM " . $GLOBALS['ecs']->table("back_order") . "\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'];
}
$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;
}
示例7: get_sales_order
/**
* 取得销售排行数据信息
* @param bool $is_pagination 是否分页
* @return array 销售排行数据
*/
function get_sales_order($is_pagination = true)
{
$filter['start_date'] = empty($_REQUEST['start_date']) ? '' : local_strtotime($_REQUEST['start_date']);
$filter['end_date'] = empty($_REQUEST['end_date']) ? '' : local_strtotime($_REQUEST['end_date']);
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'goods_num' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
/*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);
/*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.');
if ($filter['start_date']) {
$where .= " AND oi.add_time >= '" . $filter['start_date'] . "'";
}
if ($filter['end_date']) {
$where .= " AND oi.add_time <= '" . $filter['end_date'] . "'";
}
/*add by hg for date 2014-04-23 根据代理商筛选 begin*/
if (!empty($admin_agency_id) && if_agency()) {
if ($admin_agency_id != '-') {
$where .= " AND oi.admin_agency_id = '{$admin_agency_id}' ";
}
} elseif (if_agency()) {
$where .= " AND oi.admin_agency_id = '0' ";
}
/*end*/
$sql = "SELECT COUNT(distinct(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);
$sql = "SELECT og.goods_id, og.goods_sn, og.goods_name, oi.order_status, " . "SUM(og.goods_number) AS goods_num, SUM(og.goods_number * og.goods_price) AS turnover " . "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . $GLOBALS['ecs']->table('order_info') . " AS oi " . $where . $sale_where . " GROUP BY og.goods_id " . ' ORDER BY ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
if ($is_pagination) {
$sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
}
$sales_order_data = $GLOBALS['db']->getAll($sql);
foreach ($sales_order_data as $key => $item) {
$sales_order_data[$key]['wvera_price'] = price_format($item['goods_num'] ? $item['turnover'] / $item['goods_num'] : 0);
$sales_order_data[$key]['short_name'] = sub_str($item['goods_name'], 30, true);
$sales_order_data[$key]['turnover'] = price_format($item['turnover']);
$sales_order_data[$key]['taxis'] = $key + 1;
}
$arr = array('sales_order_data' => $sales_order_data, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: delivery_list
//.........这里部分代码省略.........
}
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']}'";
}
if ($filter['shipping_status'] != -1) {
$where .= " AND o.shipping_status = '{$filter['shipping_status']}'";
}
if ($filter['pay_status'] != -1) {
$where .= " AND o.pay_status = '{$filter['pay_status']}'";
}
if ($filter['user_id']) {
$where .= " AND o.user_id = '{$filter['user_id']}'";
}
if ($filter['user_name']) {
$where .= " AND u.user_name LIKE '%" . mysql_like_quote($filter['user_name']) . "%'";
}
//对已进行收费确认的订单进行分润处理
$where .= " AND o.order_status =5 AND o.shipping_status = 2 AND o.pay_status = 2 ";
/*add by hg for date 2014-04-23 根据代理商筛选 begin*/
if (if_agency()) {
if (!empty($filter['admin_agency_id'])) {
if ($filter['admin_agency_id'] != '-') {
$where .= " AND o.admin_agency_id = {$filter['admin_agency_id']}";
} else {
$GLOBALS['smarty']->assign('show_agency', true);
//查询整站订单
}
} else {
$where .= " AND o.admin_agency_id != 0";
}
}
/*end*/
//综合状态
switch ($filter['composite_status']) {
case CS_AWAIT_PAY:
$where .= order_query_sql('await_pay');
break;
case CS_AWAIT_SHIP:
$where .= order_query_sql('await_ship');
break;
case CS_FINISHED:
$where .= order_query_sql('finished');
break;
case PS_PAYING:
if ($filter['composite_status'] != -1) {
$where .= " AND o.pay_status = '{$filter['composite_status']}' ";
}
break;
case OS_SHIPPED_PART:
if ($filter['composite_status'] != -1) {
$where .= " AND o.shipping_status = '{$filter['composite_status']}'-2 ";
}
示例13: get_total_amount
/**
* 获得账户变动金额
* @param string $type 0,充值 1,提现
* @return array
*/
function get_total_amount($start_date, $end_date, $type = 0, $admin_agency_id)
{
//过滤代理商信息
if (!empty($admin_agency_id) && if_agency()) {
if ($admin_agency_id != '-') {
$where .= " AND a.admin_agency_id = '{$admin_agency_id}' ";
}
} elseif (if_agency()) {
$where .= " AND a.admin_agency_id = '0' ";
}
$sql = " SELECT IFNULL(SUM(amount), 0) AS total_amount FROM " . $GLOBALS['ecs']->table('user_account') . " AS a, " . $GLOBALS['ecs']->table('users') . " AS u " . " WHERE process_type = {$type} AND is_paid = 1 AND a.user_id = u.user_id AND paid_time >= '{$start_date}' AND paid_time < '" . ($end_date + 86400) . "' {$where}";
$amount = $GLOBALS['db']->getone($sql);
$amount = $type ? price_format(abs($amount)) : price_format($amount);
return $amount;
}
示例14: user_list
/**
* 返回用户列表数据
*
* @access public
* @param
*
* @return void
*/
function user_list()
{
$result = get_filter();
if ($result === false) {
/*add by hg for date 2014-03-25 bagein*/
$admin_id = isset($_SESSION['admin_id']) ? $_SESSION['admin_id'] : 0;
$admin_user_id = $GLOBALS['db']->getRow("select agency_user_id from " . $GLOBALS['ecs']->table('admin_user') . "where user_id = {$admin_id}");
/*end*/
/*add by hg for date 2014-04-23 获取代理商信息 begin*/
$filter['admin_agency_id'] = !empty($_REQUEST['admin_agency_id']) ? trim($_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*/
/* 过滤条件 */
$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['rank'] = empty($_REQUEST['rank']) ? 0 : intval($_REQUEST['rank']);
$filter['pay_points_gt'] = empty($_REQUEST['pay_points_gt']) ? 0 : intval($_REQUEST['pay_points_gt']);
$filter['pay_points_lt'] = empty($_REQUEST['pay_points_lt']) ? 0 : intval($_REQUEST['pay_points_lt']);
$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']);
/*add by hg for date 2014-03-25 bagein*/
if ($admin_user_id['agency_user_id'] != null) {
$ex_where = ' WHERE top_rank = ' . $admin_user_id['agency_user_id'] . '';
} else {
$ex_where = ' WHERE 1 = 1';
}
/*end*/
if ($filter['keywords']) {
$ex_where .= " AND user_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
}
if ($filter['rank']) {
$sql = "SELECT min_points, max_points, special_rank FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '{$filter['rank']}'";
$row = $GLOBALS['db']->getRow($sql);
if ($row['special_rank'] > 0) {
/* 特殊等级 */
$ex_where .= " AND user_rank = '{$filter['rank']}' ";
} else {
$ex_where .= " AND rank_points >= " . intval($row['min_points']) . " AND rank_points < " . intval($row['max_points']);
}
}
if ($filter['pay_points_gt']) {
$ex_where .= " AND pay_points >= '{$filter['pay_points_gt']}' ";
}
if ($filter['pay_points_lt']) {
$ex_where .= " AND pay_points < '{$filter['pay_points_lt']}' ";
}
/*add by hg for date 2014-04-23 根据代理商筛选 begin*/
if (!empty($filter['admin_agency_id']) && if_agency()) {
if ($filter['admin_agency_id'] == 'top') {
$ex_where .= ' AND user_id IN (' . implode(',', agency_list('1')) . ')';
} else {
$ex_where .= " AND top_rank = '{$filter['admin_agency_id']}'";
}
} elseif (if_agency()) {
$ex_where .= ' AND user_id not in (' . implode(',', agency_list('1')) . ') AND top_rank = 0';
}
/*end*/
//dump($ex_where);
$filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('users') . $ex_where);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT user_id, user_name, email, is_validated, user_money, frozen_money, rank_points, pay_points, reg_time " . " FROM " . $GLOBALS['ecs']->table('users') . $ex_where . " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
//print_r($sql);die;
$filter['keywords'] = stripslashes($filter['keywords']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$user_list = $GLOBALS['db']->getAll($sql);
//print_r($sql);
//dump($user_list);
$count = count($user_list);
for ($i = 0; $i < $count; $i++) {
$user_list[$i]['reg_time'] = local_date($GLOBALS['_CFG']['date_format'], $user_list[$i]['reg_time']);
}
$arr = array('user_list' => $user_list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例15: 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']);
}