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


PHP order_amount_field函数代码示例

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


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

示例1: order_due_field

/**
 * 生成计算应付款金额的字段
 * @param   string  $alias  order表的别名(包括.例如 o.)
 * @return  string
 */
function order_due_field($alias = '')
{
    return order_amount_field($alias) . " - {$alias}money_paid - {$alias}surplus - {$alias}integral_money" . " - {$alias}bonus - {$alias}discount ";
}
开发者ID:dlpc,项目名称:ecshop,代码行数:9,代码来源:lib_order.php

示例2: getBackOrderMoney

function getBackOrderMoney()
{
    global $ecs, $db;
    $rid = isset($_REQUEST['rid']) && intval($_REQUEST['rid']) > 0 ? intval($_REQUEST['rid']) : 0;
    $hpay_id = getPayHoudaofukuan();
    //货到付款支付方式id;
    $sql = "select bo.status_refund,(" . order_amount_field('oi.') . ") AS total_fee,oi.pay_id " . "from " . $ecs->table('order_info') . " as oi," . $ecs->table('back_order') . " as bo where oi.store_rebate_id=" . $rid . " and bo.back_type!=3 and bo.status_back < 5 and oi.order_id=bo.order_id";
    $query = $db->query($sql);
    $ret = array('all' => 0.0, 'finish' => 0.0, 'nofinish' => 0.0, 'online' => 0.0, 'onout' => 0.0);
    while ($row = $db->fetchRow($query)) {
        $ret['all'] += $row['total_fee'];
        if ($row['status_refund'] > 0) {
            //完成退款
            $ret['finish'] += $row['total_fee'];
        } else {
            //申请中
            $ret['nofinish'] += $row['total_fee'];
        }
        if ($row['pay_id'] != $hpay_id) {
            //在线支付
            $ret['online'] += $row['total_fee'];
        } else {
            //货到付款
            $ret['onout'] += $row['total_fee'];
        }
    }
    return $ret;
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:28,代码来源:supplier_store_order_bk.php

示例3: order_list


//.........这里部分代码省略.........
            $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']) . "%'";
        }
        if ($filter['start_time']) {
            $where .= " AND o.add_time >= '{$filter['start_time']}'";
        }
        if ($filter['end_time']) {
            $where .= " AND o.add_time <= '{$filter['end_time']}'";
        }
        //综合状态
        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 ";
                }
                break;
            default:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.order_status = '{$filter['composite_status']}' ";
                }
        }
        /* 团购订单 */
        if ($filter['group_buy_id']) {
            $where .= " AND o.extension_code = 'group_buy' AND o.extension_id = '{$filter['group_buy_id']}' ";
        }
        /* 如果管理员属于某个办事处,只列出这个办事处管辖的订单 */
        $sql = "SELECT agency_id FROM " . $GLOBALS['ecs']->table('admin_user') . " WHERE user_id = '{$_SESSION['admin_id']}'";
        $agency_id = $GLOBALS['db']->getOne($sql);
        if ($agency_id > 0) {
            $where .= " AND o.agency_id = '{$agency_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;
        }
        /* 记录总数 */
        if ($filter['user_name']) {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o ," . $GLOBALS['ecs']->table('users') . " AS u " . $where;
        } else {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . $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 o.order_id, o.order_sn, o.add_time, o.order_status, o.shipping_status, o.order_amount, o.money_paid," . "o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, " . "(" . order_amount_field('o.') . ") AS total_fee, " . "IFNULL(u.user_name, '" . $GLOBALS['_LANG']['anonymous'] . "') AS buyer " . " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON u.user_id=o.user_id " . $where . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        foreach (array('order_sn', 'consignee', 'email', 'address', 'zipcode', 'tel', 'user_name') as $val) {
            $filter[$val] = stripslashes($filter[$val]);
        }
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    /* 格式话数据 */
    foreach ($row as $key => $value) {
        $row[$key]['formated_order_amount'] = price_format($value['order_amount']);
        $row[$key]['formated_money_paid'] = price_format($value['money_paid']);
        $row[$key]['formated_total_fee'] = price_format($value['total_fee']);
        $row[$key]['short_order_time'] = local_date('m-d H:i', $value['add_time']);
        if ($value['order_status'] == OS_INVALID || $value['order_status'] == OS_CANCELED) {
            /* 如果该订单为无效或取消则显示删除链接 */
            $row[$key]['can_remove'] = 1;
        } else {
            $row[$key]['can_remove'] = 0;
        }
    }
    $arr = array('orders' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:norain2050,项目名称:benhu,代码行数:101,代码来源:order.php

示例4: trim

$smarty->assign('lang', $_LANG);
/* act操作项的初始化 */
if (empty($_REQUEST['act'])) {
    $_REQUEST['act'] = 'list';
} else {
    $_REQUEST['act'] = trim($_REQUEST['act']);
}
/*------------------------------------------------------ */
//--订单统计
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list') {
    admin_priv('sale_order_stats');
    /* 随机的颜色数组 */
    $color_array = array('33FF66', 'FF6600', '3399FF', '009966', 'CC3399', 'FFCC33', '6699CC', 'CC3366');
    /* 计算订单各种费用之和的语句 */
    $total_fee = " SUM(" . order_amount_field() . ") AS total_turnover ";
    /* 取得订单转化率数据 */
    $sql = "SELECT COUNT(*) AS total_order_num, " . $total_fee . " FROM " . $ecs->table('order_info') . " WHERE 1 " . order_query_sql('finished');
    $order_general = $db->getRow($sql);
    $order_general['total_turnover'] = floatval($order_general['total_turnover']);
    /* 取得商品总点击数量 */
    $sql = 'SELECT SUM(click_count) FROM ' . $ecs->table('goods') . ' WHERE is_delete = 0';
    $click_count = floatval($db->getOne($sql));
    /* 每千个点击的订单数 */
    $click_ordernum = $click_count > 0 ? round($order_general['total_order_num'] * 1000 / $click_count, 2) : 0;
    /* 每千个点击的购物额 */
    $click_turnover = $click_count > 0 ? round($order_general['total_turnover'] * 1000 / $click_count, 2) : 0;
    /* 时区 */
    $timezone = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : $GLOBALS['_CFG']['timezone'];
    /* 时间参数 */
    $is_multi = empty($_POST['is_multi']) ? false : true;
开发者ID:dw250100785,项目名称:ECShop-1,代码行数:31,代码来源:order_stats.php

示例5: getRebateOrderMoney

function getRebateOrderMoney($rid)
{
    global $ecs, $db;
    $back_and = '';
    if (($back_order_id = getBackOrderByRebate($rid)) != false) {
        //获取退货订单中相关订单
        $back_and = "and order_id not in(" . implode(',', $back_order_id) . ")";
    }
    $pay_id = getPayHoudaofukuan();
    //获取货到付款的id
    $sql = "select (" . order_amount_field() . ") AS total_fee,pay_id,order_id from " . $ecs->table('order_info') . " where store_rebate_id=" . $rid . " {$back_and} and store_rebate_ispay=2";
    $query = $db->query($sql);
    $online = $online_rebate = $onout = $onout_rebate = 0;
    $online_ids = $onout_ids = array();
    while ($row = $db->fetchRow($query)) {
        if ($row['pay_id'] == $pay_id) {
            //货到付款
            $onout += $row['total_fee'];
            $onout_rebate += getGoodsOrderRebatePrice($row['order_id']);
            $onout_ids[] = $row['order_id'];
        } else {
            //在线支付
            $online += $row['total_fee'];
            $online_rebate += getGoodsOrderRebatePrice($row['order_id']);
            $online_ids[] = $row['order_id'];
        }
    }
    if (count($onout_ids) > 0) {
        //货到付款订单当中有商品发生的退货
        $sql = "select (goods_price * is_back) as price_out from " . $ecs->table('order_goods') . " where order_id in(" . implode(',', $onout_ids) . ")";
        $out_price = $db->getOne($sql);
        $onout = $onout - $out_price;
    }
    if (count($online_ids) > 0) {
        //在线支付订单当中有商品发生退货
        $sql = "select (goods_price * is_back) as price_out from " . $ecs->table('order_goods') . " where order_id in(" . implode(',', $online_ids) . ")";
        $line_price = $db->getOne($sql);
        $online = $online - $line_price;
    }
    return array('all' => array('online' => $online, 'onout' => $onout), 'rebate' => array('online' => $online_rebate, 'onout' => $onout_rebate));
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:41,代码来源:lib_rebate_store.php

示例6: order_list


//.........这里部分代码省略.........
                    //查询整站订单
                }
            } 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 ";
                }
                break;
            default:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.order_status = '{$filter['composite_status']}' ";
                }
        }
        /* 团购订单 */
        if ($filter['group_buy_id']) {
            $where .= " AND o.extension_code = 'group_buy' AND o.extension_id = '{$filter['group_buy_id']}' ";
        }
        /* 如果管理员属于某个办事处,只列出这个办事处管辖的订单 */
        $sql = "SELECT agency_id FROM " . $GLOBALS['ecs']->table('admin_user') . " WHERE user_id = '{$_SESSION['admin_id']}'";
        $agency_id = $GLOBALS['db']->getOne($sql);
        if ($agency_id > 0) {
            $where .= " AND o.agency_id = '{$agency_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;
        }
        /* 记录总数 */
        if ($filter['user_name']) {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o ," . $GLOBALS['ecs']->table('users') . " AS u " . $where;
        } else {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . $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 o.order_id, o.order_sn,o.add_time, o.order_status, o.shipping_status, " . "o.order_amount, o.money_paid,IFNULL(a.user_name, '主站') AS admin_user," . "o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, " . "(" . order_amount_field('o.') . ") AS total_fee, " . "IFNULL(u.user_name, '" . $GLOBALS['_LANG']['anonymous'] . "') AS buyer " . " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON u.user_id=o.user_id LEFT JOIN " . $GLOBALS['ecs']->table('admin_user') . " as a ON a.agency_user_id=o.admin_agency_id " . $where . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        foreach (array('order_sn', 'consignee', 'email', 'address', 'zipcode', 'tel', 'user_name') as $val) {
            $filter[$val] = stripslashes($filter[$val]);
        }
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    /* 格式话数据 */
    foreach ($row as $key => $value) {
        $row[$key]['formated_order_amount'] = price_format($value['order_amount']);
        $row[$key]['formated_money_paid'] = price_format($value['money_paid']);
        $row[$key]['formated_total_fee'] = price_format($value['total_fee']);
        $row[$key]['short_order_time'] = local_date('m-d H:i', $value['add_time']);
        if ($value['order_status'] == OS_INVALID || $value['order_status'] == OS_CANCELED) {
            /* 如果该订单为无效或取消则显示删除链接 */
            $row[$key]['can_remove'] = 1;
        } else {
            $row[$key]['can_remove'] = 0;
        }
        /*ccx 2014-12-14 对已经抽奖过的订单,提示该订单不能进行退货和退款 开始 */
        $sql_luck = "SELECT id FROM " . $GLOBALS['ecs']->table('lucky_draw') . " WHERE order_sn = '" . $value['order_sn'] . "'";
        $lucky_draw = $GLOBALS['db']->getOne($sql_luck);
        $row[$key]['lucky_draw'] = $lucky_draw;
        /*ccx 2014-12-14 对已经抽奖过的订单,提示该订单不能进行退货和退款 结束 */
    }
    /*统计总金额和应付金额 by hg for 2014-06-10*/
    $overall_order_amount = overall_order_amount($sql);
    $GLOBALS['smarty']->assign('overall_formated_total_fee', price_format($overall_order_amount['overall_formated_total_fee']));
    $GLOBALS['smarty']->assign('overall_formated_order_amount', price_format($overall_order_amount['overall_formated_order_amount']));
    $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('orders' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:101,代码来源:order.php

示例7: rebate_list

/**
 *  获取供应商列表信息
 *
 * @access  public
 * @param
 *
 * @return void
 */
function rebate_list($act = '')
{
    $result = get_filter();
    if ($result === false) {
        //$aiax = isset($_GET['is_ajax']) ? $_GET['is_ajax'] : 0;
        /* 过滤信息 */
        $filter['rebate_paytime_start'] = !empty($_REQUEST['rebate_paytime_start']) ? local_strtotime($_REQUEST['rebate_paytime_start']) : 0;
        $filter['rebate_paytime_end'] = !empty($_REQUEST['rebate_paytime_end']) ? local_strtotime($_REQUEST['rebate_paytime_end'] . " 23:59:59") : 0;
        $filter['status'] = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : -1;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? ' sr.supplier_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? ' ASC' : trim($_REQUEST['sort_order']);
        $filter['is_pay_ok'] = empty($_REQUEST['is_pay_ok']) ? '0' : intval($_REQUEST['is_pay_ok']);
        $filter['actname'] = empty($act) ? trim($_REQUEST['act']) : $act;
        $where = 'WHERE 1 ';
        $where .= $filter['rebate_paytime_start'] ? " AND sr.rebate_paytime_start >= '" . $filter['rebate_paytime_start'] . "' " : " ";
        $where .= $filter['rebate_paytime_end'] ? " AND sr.rebate_paytime_end <= '" . $filter['rebate_paytime_end'] . "' " : " ";
        $where .= $filter['is_pay_ok'] ? " AND sr.is_pay_ok = '" . $filter['is_pay_ok'] . "' " : " AND sr.is_pay_ok = '0' ";
        $where .= $filter['status'] > -1 ? " AND sr.status = '" . $filter['status'] . "' " : " ";
        /* 分页大小 */
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
            $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
        } else {
            $filter['page_size'] = 15;
        }
        /* 记录总数 */
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('supplier_rebate') . " AS sr  " . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        /* 查询 */
        $sql = "SELECT sr.* , s.supplier_name, s.supplier_rebate " . "FROM " . $GLOBALS['ecs']->table("supplier_rebate") . " AS  sr left join " . $GLOBALS['ecs']->table("supplier") . " AS s on sr.supplier_id=s.supplier_id \n                {$where}\n                ORDER BY " . $filter['sort_by'] . " " . $filter['sort_order'] . "\n                LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ", " . $filter['page_size'] . " ";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = array();
    $res = $GLOBALS['db']->query($sql);
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $row['sign'] = createSign($row['rebate_id'], $row['supplier_id']);
        $row['rebate_paytime_start'] = local_date('Y.m.d', $row['rebate_paytime_start']);
        $endtime = $row['rebate_paytime_end'];
        //+$GLOBALS['_CFG']['tuihuan_days_qianshou']*3600*24;
        $row['rebate_paytime_end'] = local_date('Y.m.d', $endtime);
        //$row['all_money'] = $GLOBALS['db']->getOne("select sum(money_paid + surplus) from ". $GLOBALS['ecs']->table('order_info') ." where rebate_id=". $row['rebate_id'] ." and rebate_ispay=2");
        $row['all_money'] = $GLOBALS['db']->getOne("select sum(" . order_amount_field() . ") from " . $GLOBALS['ecs']->table('order_info') . " where rebate_id=" . $row['rebate_id'] . " and rebate_ispay=2");
        $row['all_money_formated'] = price_format($row['all_money']);
        $row['rebate_money'] = round($row['all_money'] * $row['supplier_rebate'] / 100, 2);
        $row['rebate_money_formated'] = price_format($row['rebate_money']);
        $row['pay_money'] = $row['all_money'] - $row['rebate_money'];
        $row['pay_money_formated'] = price_format($row['pay_money']);
        $row['pay_status'] = $row['is_pay_ok'] ? "已处理,已返佣" : "未处理";
        $row['pay_time'] = local_date('Y.m.d', $row['pay_time']);
        $row['user'] = $_SESSION['user_name'];
        $row['payable_price'] = price_format($row['payable_price']);
        $row['status_name'] = rebateStatus($row['status']);
        $row['caozuo'] = getRebateDo($row['status'], $row['rebate_id'], $filter['actname']);
        $list[] = $row;
    }
    $arr = array('result' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:firsteam,项目名称:falcons,代码行数:72,代码来源:supplier_rebate.php

示例8: order_list


//.........这里部分代码省略.........
            $where .= " AND o.add_time <= '{$filter['end_time']}'";
        }
        /* 代码增加_start   By www.ecshop68.com */
        switch ($filter['order_type']) {
            case 1:
                $where .= " AND o.is_pickup = 0";
                break;
            case 2:
                $where .= " AND o.is_pickup > 0";
                break;
        }
        /* 代码增加_end   By www.ecshop68.com */
        //综合状态
        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 ";
                }
                break;
            default:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.order_status = '{$filter['composite_status']}' ";
                }
        }
        /* 团购订单 */
        if ($filter['group_buy_id']) {
            $where .= " AND o.extension_code = 'group_buy' AND o.extension_id = '{$filter['group_buy_id']}' ";
        }
        /* 如果管理员属于某个办事处,只列出这个办事处管辖的订单 */
        $sql = "SELECT agency_id FROM " . $GLOBALS['ecs']->table('admin_user') . " WHERE user_id = '{$_SESSION['admin_id']}'";
        $agency_id = $GLOBALS['db']->getOne($sql);
        if ($agency_id > 0) {
            $where .= " AND o.agency_id = '{$agency_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;
        }
        /* 记录总数 */
        if ($filter['user_name']) {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o ," . $GLOBALS['ecs']->table('users') . " AS u " . $where;
        } else {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . $where;
        }
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        /* 查询 */
        if ($filter['supp']) {
            $sql = "SELECT o.order_id, o.order_sn, o.add_time, o.order_status, o.shipping_status, o.order_amount, o.money_paid," . "o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, " . "(" . order_amount_field('o.') . ") AS total_fee, " . "IFNULL(u.user_name, '" . $GLOBALS['_LANG']['anonymous'] . "') AS buyer,supplier_name,o.froms,is_pickup  " . " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . " LEFT JOIN " . $GLOBALS['ecs']->table('supplier') . " AS s ON s.supplier_id=o.supplier_id " . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON u.user_id=o.user_id " . $where . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        } else {
            $sql = "SELECT o.order_id, o.order_sn, o.add_time, o.order_status, o.shipping_status, o.order_amount, o.money_paid," . "o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, " . "(" . order_amount_field('o.') . ") AS total_fee, " . "IFNULL(u.user_name, '" . $GLOBALS['_LANG']['anonymous'] . "') AS buyer, o.froms , is_pickup " . " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON u.user_id=o.user_id " . $where . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        }
        foreach (array('order_sn', 'consignee', 'email', 'address', 'zipcode', 'tel', 'user_name') as $val) {
            $filter[$val] = stripslashes($filter[$val]);
        }
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    /* 格式话数据 */
    foreach ($row as $key => $value) {
        $row[$key]['formated_order_amount'] = price_format($value['order_amount']);
        $row[$key]['formated_money_paid'] = price_format($value['money_paid']);
        $row[$key]['formated_total_fee'] = price_format($value['total_fee']);
        $row[$key]['short_order_time'] = local_date('m-d H:i', $value['add_time']);
        if ($value['order_status'] == OS_INVALID || $value['order_status'] == OS_CANCELED) {
            /* 如果该订单为无效或取消则显示删除链接 */
            $row[$key]['can_remove'] = 1;
        } else {
            $row[$key]['can_remove'] = 0;
        }
        $tuihuan_info = $GLOBALS['db']->getOne("select order_sn from " . $GLOBALS['ecs']->table('back_order') . " where order_sn = '" . $row[$key]['order_sn'] . "' AND status_back < 6");
        if (!empty($tuihuan_info)) {
            $row[$key]['tuihuan'] = 1;
        }
    }
    $arr = array('orders' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:101,代码来源:order.php

示例9: order_list

/**
 *  获取订单列表信息
 *
 * @access  public
 * @param
 *
 * @return void
 */
function order_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']);
        }
        $filter['consignee'] = empty($_REQUEST['consignee']) ? '' : trim($_REQUEST['consignee']);
        $filter['composite_status'] = isset($_REQUEST['composite_status']) ? intval($_REQUEST['composite_status']) : -1;
        $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']);
        $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['rebateid'] = isset($_REQUEST['rebateid']) && !empty($_REQUEST['rebateid']) && intval($_REQUEST['rebateid']) > 0 ? intval($_REQUEST['rebateid']) : 0;
        $filter['isreb'] = !isset($_REQUEST['isreb']) ? 1 : intval($_REQUEST['isreb']);
        ishavereb($filter['rebateid']);
        //$where = 'WHERE 1 ';
        $where = $filter['rebateid'] > 0 ? 'WHERE o.rebate_id = ' . $filter['rebateid'] : 'WHERE 1';
        $where .= " AND o.rebate_ispay = " . $filter['isreb'];
        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']) . "%'";
        }
        //综合状态
        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 ";
                }
                break;
            default:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.order_status = '{$filter['composite_status']}' ";
                }
        }
        /* 分页大小 */
        $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('order_info') . " AS o " . $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 o.order_id, o.order_sn, o.add_time, o.order_status, o.shipping_status, o.order_amount, o.money_paid," . "o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, o.shipping_time, " . "(" . order_amount_field('o.') . ") AS total_fee, " . "IFNULL(u.user_name, '" . $GLOBALS['_LANG']['anonymous'] . "') AS buyer " . " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON u.user_id=o.user_id " . $where . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        //echo $sql;
        foreach (array('order_sn', 'consignee', 'email', 'address', 'zipcode', 'tel', 'user_name') as $val) {
            $filter[$val] = stripslashes($filter[$val]);
        }
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    /* 格式话数据 */
    foreach ($row as $key => $value) {
        $is_order = $is_shipping = $is_pay = 0;
        $row[$key]['formated_order_amount'] = price_format($value['order_amount']);
        $row[$key]['formated_money_paid'] = price_format($value['money_paid']);
        $row[$key]['formated_total_fee'] = price_format($value['total_fee']);
        $row[$key]['short_order_time'] = local_date('m-d H:i', $value['add_time']);
        $row[$key]['is_rebeat'] = 0;
        if ($value['order_status'] == OS_INVALID || $value['order_status'] == OS_CANCELED) {
            /* 如果该订单为无效或取消则显示删除链接 */
            $row[$key]['can_remove'] = 1;
        } else {
            $row[$key]['can_remove'] = 0;
//.........这里部分代码省略.........
开发者ID:firsteam,项目名称:falcons,代码行数:101,代码来源:supplier_order_bk.php

示例10: trim

} else {
    $_REQUEST['act'] = trim($_REQUEST['act']);
}
/*------------------------------------------------------ */
//-- 客户统计列表
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list') {
    /* 权限判断 */
    admin_priv('client_flow_stats');
    /* 取得会员总数 */
    $users =& init_users();
    $sql = 'SELECT COUNT(*) FROM ' . $ecs->table('users');
    $res = $db->getCol($sql);
    $user_num = $res[0];
    /* 计算订单各种费用之和的语句 */
    $total_fee = ' SUM(' . order_amount_field() . ') AS turnover ';
    /* 有过订单的会员数 */
    $sql = 'SELECT COUNT(DISTINCT user_id) FROM ' . $ecs->table('order_info') . ' WHERE user_id > 0 ' . order_query_sql('finished');
    $have_order_usernum = $db->getOne($sql);
    /* 会员订单总数和订单总购物额 */
    $user_all_order = array();
    $sql = 'SELECT COUNT(*) AS order_num, ' . $total_fee . 'FROM ' . $ecs->table('order_info') . ' WHERE user_id > 0 ' . order_query_sql('finished');
    $user_all_order = $db->getRow($sql);
    $user_all_order['turnover'] = floatval($user_all_order['turnover']);
    /* 匿名会员订单总数和总购物额 */
    $guest_all_order = array();
    $sql = 'SELECT COUNT(*) AS order_num, ' . $total_fee . 'FROM ' . $ecs->table('order_info') . ' WHERE user_id = 0 ' . order_query_sql('finished');
    $guest_all_order = $db->getRow($sql);
    /* 匿名会员平均订单额: 购物总额/订单数 */
    $guest_order_amount = $guest_all_order['order_num'] > 0 ? floatval($guest_all_order['turnover'] / $guest_all_order['order_num']) : '0.00';
    $_GET['flag'] = isset($_GET['flag']) ? 'download' : '';
开发者ID:netroby,项目名称:ecshop,代码行数:31,代码来源:guest_stats.php

示例11: get_user_orderinfo

function get_user_orderinfo($is_pagination = true)
{
    global $db, $ecs, $start_date, $end_date;
    $filter['start_date'] = empty($_REQUEST['start_date']) ? $start_date : local_strtotime($_REQUEST['start_date']);
    $filter['end_date'] = empty($_REQUEST['end_date']) ? $end_date : local_strtotime($_REQUEST['end_date']);
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'order_num' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
    $where = 'WHERE u.user_id = o.user_id ' . 'AND u.user_id > 0 ' . order_query_sql('finished', 'o.');
    if ($filter['start_date']) {
        $where .= " AND o.add_time >= '" . $filter['start_date'] . "'";
    }
    if ($filter['end_date']) {
        $where .= " AND o.add_time <= '" . $filter['end_date'] . "'";
    }
    $sql = 'SELECT count(distinct(u.user_id)) FROM ' . $ecs->table('users') . ' AS u, ' . $ecs->table('order_info') . ' AS o ' . $where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    /* 分页大小 */
    $filter = page_and_size($filter);
    /* 计算订单各种费用之和的语句 */
    $total_fee = ' SUM(' . order_amount_field() . ') AS turnover ';
    $sql = 'SELECT u.user_id, u.user_name, COUNT(*) AS order_num, ' . $total_fee . 'FROM ' . $ecs->table('users') . ' AS u, ' . $ecs->table('order_info') . ' AS o ' . $where . ' GROUP BY u.user_id' . ' ORDER BY ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
    if ($is_pagination) {
        $sql .= ' LIMIT ' . $filter['start'] . ', ' . $filter['page_size'];
    }
    $user_orderinfo = array();
    $res = $db->query($sql);
    while ($items = $db->fetchRow($res)) {
        $items['turnover'] = price_format($items['turnover']);
        $user_orderinfo[] = $items;
    }
    $arr = array('user_orderinfo' => $user_orderinfo, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:netroby,项目名称:ecshop,代码行数:33,代码来源:users_order.php

示例12: order_list


//.........这里部分代码省略.........
                $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 ";
                }
                break;
            default:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.order_status = '{$filter['composite_status']}' ";
                }
        }
        /* 团购订单 */
        if ($filter['group_buy_id']) {
            $where .= " AND o.extension_code = '" . GROUP_BUY_CODE . "' AND o.extension_id = '{$filter['group_buy_id']}' ";
        }
        /* 预售订单 */
        if ($filter['pre_sale_id']) {
            $where .= " AND o.extension_code = '" . PRE_SALE_CODE . "' AND o.extension_id = '{$filter['pre_sale_id']}' ";
        }
        /* 如果管理员属于某个办事处,只列出这个办事处管辖的订单 */
        $sql = "SELECT agency_id FROM " . $GLOBALS['ecs']->table('admin_user') . " WHERE user_id = '{$_SESSION['admin_id']}'";
        $agency_id = $GLOBALS['db']->getOne($sql);
        if ($agency_id > 0) {
            $where .= " AND o.agency_id = '{$agency_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;
        }
        /* 记录总数 */
        if ($filter['user_name']) {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o ," . $GLOBALS['ecs']->table('users') . " AS u " . $where;
        } else {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . $where;
        }
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        /* 查询 */
        if ($filter['supp']) {
            $sql = "SELECT o.order_id, o.order_sn, o.add_time, o.order_status, o.shipping_status, o.order_amount, o.money_paid," . "o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, " . "(" . order_amount_field('o.') . ") AS total_fee, " . "IFNULL(u.user_name, '" . $GLOBALS['_LANG']['anonymous'] . "') AS buyer,supplier_name,o.froms,is_pickup  " . ',o.mobile,o.inv_payee,o.inv_content,o.inv_type,o.vat_inv_company_name' . ',o.vat_inv_taxpayer_id,o.vat_inv_registration_address,o.vat_inv_registration_phone' . ',o.vat_inv_deposit_bank,o.vat_inv_bank_account' . ',o.inv_consignee_name,o.inv_consignee_phone,o.inv_consignee_country' . ',o.inv_consignee_province,o.inv_consignee_city,o.inv_consignee_district' . ',o.inv_consignee_address,o.inv_status,o.inv_payee_type,o.inv_money' . " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . " LEFT JOIN " . $GLOBALS['ecs']->table('supplier') . " AS s ON s.supplier_id=o.supplier_id " . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON u.user_id=o.user_id " . $where . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        } else {
            $sql = "SELECT o.order_id, o.order_sn, o.add_time, o.order_status, o.shipping_status, o.order_amount, o.money_paid," . "o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, " . "(" . order_amount_field('o.') . ") AS total_fee, " . "IFNULL(u.user_name, '" . $GLOBALS['_LANG']['anonymous'] . "') AS buyer, o.froms , is_pickup " . ',o.mobile,o.inv_payee,o.inv_content,o.inv_type,o.vat_inv_company_name' . ',o.vat_inv_taxpayer_id,o.vat_inv_registration_address,o.vat_inv_registration_phone' . ',o.vat_inv_deposit_bank,o.vat_inv_bank_account' . ',o.inv_consignee_name,o.inv_consignee_phone,o.inv_consignee_country' . ',o.inv_consignee_province,o.inv_consignee_city,o.inv_consignee_district' . ',o.inv_consignee_address,o.inv_status,o.inv_payee_type,o.inv_money' . " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON u.user_id=o.user_id " . $where . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        }
        //echo $sql;
        foreach (array('order_sn', 'consignee', 'email', 'address', 'zipcode', 'tel', 'user_name') as $val) {
            $filter[$val] = stripslashes($filter[$val]);
        }
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    /* 格式话数据 */
    foreach ($row as $key => $value) {
        $row[$key]['formated_order_amount'] = price_format($value['order_amount']);
        $row[$key]['formated_money_paid'] = price_format($value['money_paid']);
        $row[$key]['formated_total_fee'] = price_format($value['total_fee']);
        $row[$key]['short_order_time'] = local_date('m-d H:i', $value['add_time']);
        /*增值税发票_添加_START_www.68ecshop.com*/
        $row[$key]['formatted_add_time'] = local_date('Y-m-d H:i', $value['add_time']);
        $row[$key]['formatted_inv_money'] = price_format($value['inv_money']);
        /*增值税发票_添加_END_www.68ecshop.com*/
        if ($value['order_status'] == OS_INVALID || $value['order_status'] == OS_CANCELED) {
            /* 如果该订单为无效或取消则显示删除链接 */
            $row[$key]['can_remove'] = 1;
        } else {
            $row[$key]['can_remove'] = 0;
        }
        $tuihuan_info = $GLOBALS['db']->getOne("select order_sn from " . $GLOBALS['ecs']->table('back_order') . " where order_sn = '" . $row[$key]['order_sn'] . "' AND status_back < 6");
        if (!empty($tuihuan_info)) {
            $row[$key]['tuihuan'] = 1;
        }
    }
    $arr = array('orders' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    /*增值税发票_添加_START_www.68ecshop.com*/
    if ($filter['inv_type']) {
        global $smarty;
        $smarty->assign('inv_type', $filter['inv_type']);
    }
    /*增值税发票_添加_END_www.68ecshop.com*/
    return $arr;
}
开发者ID:firsteam,项目名称:falcons,代码行数:101,代码来源:order.php

示例13: get_user_orderinfo

function get_user_orderinfo($is_pagination = true)
{
    global $db, $ecs, $start_date, $end_date;
    $filter['start_date'] = empty($_REQUEST['start_date']) ? $start_date : local_strtotime($_REQUEST['start_date']);
    $filter['end_date'] = empty($_REQUEST['end_date']) ? $end_date : local_strtotime($_REQUEST['end_date']);
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'order_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		获取客户统计信息加入条件判定为当前代理商下的客户信息*/
    $user_order_where = agency_where();
    if (!empty($user_order_where)) {
        $whereArr = explode(' ', $user_order_where);
        $user_order_where = $whereArr[0] . $whereArr[1] . ' o.' . $whereArr[2] . $whereArr[3] . $whereArr[4];
    }
    /*end*/
    $where = "WHERE u.user_id = o.user_id " . "AND u.user_id > 0 " . order_query_sql('finished', 'o.');
    if ($filter['start_date']) {
        $where .= " AND o.add_time >= '" . $filter['start_date'] . "'";
    }
    if ($filter['end_date']) {
        $where .= " AND o.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 o.admin_agency_id = '{$admin_agency_id}' ";
        }
    } elseif (if_agency()) {
        $where .= " AND admin_agency_id = '0' ";
    }
    /*end*/
    $sql = "SELECT count(distinct(u.user_id)) FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where . $user_order_where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    /* 分页大小 */
    $filter = page_and_size($filter);
    /* 计算订单各种费用之和的语句 */
    $total_fee = " SUM(" . order_amount_field() . ") AS turnover ";
    $sql = "SELECT u.user_id, u.user_name, COUNT(*) AS order_num, " . $total_fee . "FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where . $user_order_where . " GROUP BY u.user_id" . " ORDER BY " . $filter['sort_by'] . " " . $filter['sort_order'];
    if ($is_pagination) {
        $sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
    }
    $user_orderinfo = array();
    $res = $db->query($sql);
    while ($items = $db->fetchRow($res)) {
        $items['turnover'] = price_format($items['turnover']);
        $user_orderinfo[] = $items;
    }
    $arr = array('user_orderinfo' => $user_orderinfo, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:61,代码来源:users_order.php

示例14: get_user_orderinfo

function get_user_orderinfo($show_num, $order_by, $start_date, $end_date)
{
    global $db, $ecs;
    $where = "WHERE u.user_id = o.user_id " . "AND u.user_id > 0 " . order_query_sql('finished', 'o.');
    $limit = " LIMIT " . $show_num;
    if ($start_date) {
        $where .= "AND o.add_time >= '{$start_date}' ";
    }
    if ($end_date) {
        $where .= "AND o.add_time <= '{$end_date}' ";
    }
    /* 计算订单各种费用之和的语句 */
    $total_fee = " SUM(" . order_amount_field() . ") AS turnover ";
    if ($order_by == 'order_num') {
        /* 按订单数量来排序 */
        $sql = "SELECT u.user_id, u.user_name, COUNT(*) AS order_num, " . $total_fee . "FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where . "GROUP BY u.user_id ORDER BY order_num DESC, turnover DESC" . $limit;
    } else {
        /* 按购物金额来排序 */
        $sql = "SELECT u.user_id, u.user_name, COUNT(*) AS order_num, " . $total_fee . "FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where . "GROUP BY u.user_id ORDER BY turnover DESC, order_num DESC" . $limit;
    }
    $user_orderinfo = array();
    $res = $db->query($sql);
    while ($items = $db->fetchRow($res)) {
        $items['turnover'] = price_format($items['turnover']);
        $user_orderinfo[] = $items;
    }
    return $user_orderinfo;
}
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:28,代码来源:users_order.php

示例15: writelog

function writelog($rid, $inout = 0)
{
    return true;
    //已经不用了
    global $db, $ecs;
    $sql = "select order_sn, (" . order_amount_field() . ") AS total_fee,supplier_id from " . $ecs->table('order_info') . " where rebate_id=" . $rid . " and rebate_ispay=2";
    $query = $db->query($sql);
    $addtime = gmtime();
    $bs_qian = '';
    //前缀内容
    $bs_do = '+';
    //增减
    if ($inout > 0) {
        $bs_qian = '撤销';
        $bs_do = '-';
    }
    $nowmoney = 0;
    $suppid = 0;
    $suppmoney = array();
    while ($row = $db->fetchRow($query)) {
        if ($suppid != $row['supplier_id']) {
            $nowmoney = $db->getOne("select supplier_money from " . $ecs->table('supplier') . " where supplier_id=" . $row['supplier_id']);
        }
        if ($inout > 0) {
            $nowmoney -= $row['total_fee'];
        } else {
            $nowmoney += $row['total_fee'];
        }
        $loginfo = array('rebateid' => $rid, 'addtime' => $addtime, 'reason' => $bs_qian . '订单' . $row['order_sn'] . '分佣:' . $bs_do . $row['total_fee'], 'supplier_money' => $nowmoney, 'doman' => '平台方:' . $_SESSION['user_name'], 'supplier_id' => $row['supplier_id']);
        $db->autoExecute($ecs->table('supplier_money_log'), $loginfo, 'INSERT');
        $suppid = $row['supplier_id'];
        $suppmoney[$suppid] = $nowmoney;
        unset($loginfo);
    }
    //保存目前的资金
    foreach ($suppmoney as $k => $v) {
        $db->query('update ' . $ecs->table('supplier') . " set supplier_money='" . $v . "' where supplier_id=" . $k);
    }
}
开发者ID:firsteam,项目名称:falcons,代码行数:39,代码来源:lib_rebate.php


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