Exemplo n.º 1
0
function order_list()
{
    $filter['sdate'] = empty($_REQUEST['sdate']) ? '' : trim($_REQUEST['sdate']);
    $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
    $filter['turn'] = empty($_REQUEST['turn']) ? 0 : intval($_REQUEST['turn']);
    $filter['station'] = empty($_REQUEST['station']) ? '' : intval($_REQUEST['station']);
    $filter['employee'] = empty($_REQUEST['employee']) ? '' : intval($_REQUEST['employee']);
    $filter['pack_no'] = empty($_REQUEST['pack_no']) ? '' : trim($_REQUEST['pack_no']);
    $filter['print_sn'] = empty($_REQUEST['print_sn']) ? '' : trim($_REQUEST['print_sn']);
    $filter['status'] = empty($_REQUEST['status']) ? '' : intval($_REQUEST['status']);
    $filter['orderstatus'] = empty($_REQUEST['orderstatus']) ? '' : intval($_REQUEST['orderstatus']);
    $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
    $where = " where o.country " . $GLOBALS['city_code'] . " ";
    if ($filter['sdate']) {
        $where .= " and best_time > '" . $filter['sdate'] . "' and best_time < '" . $filter['sdate'] . " 23:30:00'";
    }
    if ($filter['turn']) {
        $where .= " and c.turn = '" . $filter['turn'] . "' ";
    }
    if ($filter['employee']) {
        $where .= " and employee_id = '" . $filter['employee'] . "' ";
    }
    if ($filter['pack_no']) {
        $where .= " and d.route_name = '" . $filter['pack_no'] . "' ";
    }
    if ($filter['status']) {
        $where .= " and a.status = '" . $filter['status'] . "' ";
    }
    if ($filter['orderstatus'] == 0) {
        $where .= " and order_status =0 ";
    }
    if ($filter['orderstatus'] == 1) {
        $where .= " and order_status =1 ";
    }
    if ($filter['orderstatus'] == 2) {
        $where .= " and order_status =2 ";
    }
    if ($filter['orderstatus'] == 3) {
        $where .= " and order_status =3 ";
    }
    if ($filter['orderstatus'] == 4) {
        $where .= " and order_status =4 ";
    }
    if ($filter['order_sn']) {
        if (str_len($filter['order_sn']) == 5) {
            $where .= " and order_sn like '%" . $filter['order_sn'] . "' ";
        } else {
            $where = " where order_sn = '" . $filter['order_sn'] . "' ";
        }
    }
    if ($filter['station'] && $filter['station'] != 100) {
        $where .= " and d.station_id = '" . $filter['station'] . "' ";
    }
    if ($filter['print_sn']) {
        $where .= "and p.print_sn = '" . $filter['print_sn'] . "' ";
    }
    if ($filter['station'] == 100) {
        $where .= " and shipping_station_name is null ";
    }
    if ($filter['sort_by'] == 'shipping_station_name') {
        $orderby = "shipping_pack_no,best_time ";
    } elseif ($filter['sort_by'] == 'shipping_pack_no') {
        $orderby = "shipping_station_name, best_time ";
    } else {
        $orderby = "shipping_station_name, shipping_pack_no ";
    }
    if ($_SESSION['station'] > 0) {
        $where .= " and d.station_id = '" . $_SESSION['station'] . "' ";
    }
    $size = 30;
    $sql = "select count(1) " . "from order_delivery as a " . "left join ecs_order_info as o on a.order_id=o.order_id " . "left join order_dispatch as c on a.order_id=c.order_id " . "left join print_log_x as p on a.order_id=p.order_id " . "left join hr_employees as h on a.employee_id=h.id " . "left join ship_route as d on c.route_id=d.route_id " . "left join ship_station as s on d.station_id=s.station_id " . $where;
    $record_count = $GLOBALS['db_read']->getOne($sql);
    $page_count = $record_count > 0 ? ceil($record_count / $size) : 1;
    $sql = "select a.order_id,p.print_sn,o.order_sn,o.city,o.address,o.best_time,c.*,d.*,s.station_name,s.station_code,a.status,h.name as employee_name " . "from order_delivery as a " . "left join ecs_order_info as o on a.order_id=o.order_id " . "left join order_dispatch as c on a.order_id=c.order_id " . "left join print_log_x as p on a.order_id=p.order_id " . "left join hr_employees as h on a.employee_id=h.id " . "left join ship_route as d on c.route_id=d.route_id " . "left join ship_station as s on d.station_id=s.station_id " . $where . "order by d.route_name,c.turn,best_time " . "LIMIT " . ($filter['page'] - 1) * $size . ",{$size}";
    $res = $GLOBALS['db_read']->GetAll($sql);
    $sql = "SELECT a.sender,b.name FROM delivery_plan as a,hr_employees as b WHERE a.sender=b.id and bdate = '" . $filter['sdate'] . "' \r\n\t\t\tand a.station_id = '" . $filter['station'] . "'";
    $res2 = $GLOBALS['db_read']->GetAll($sql);
    foreach ($res as $key => $val) {
        $res[$key]['i'] = $key + 1;
        $res[$key]['address'] = region_name($val['city']) . ' ' . $val['address'];
    }
    $arr = array('orders' => $res, 'filter' => $filter, 'page_count' => $page_count, 'record_count' => $record_count, 'senders' => $res2);
    return $arr;
}
Exemplo n.º 2
0
function order_list()
{
    $os[0] = '未确认';
    $os[1] = '已确认';
    $os[2] = '已取消';
    $os[3] = '无效';
    $os[4] = '退货';
    $ps[0] = '未付款';
    $ps[1] = '付款中';
    $ps[2] = '已付款';
    $city_arr = $_SESSION['city_arr'];
    $city_code = array_keys($city_arr);
    $filter['station'] = empty($_REQUEST['station']) ? '' : intval($_REQUEST['station']);
    $filter['turn'] = intval($_REQUEST['turn']);
    $filter['city'] = empty($_REQUEST['city']) ? $city_code[0] : intval($_REQUEST['city']);
    $filter['diao'] = trim($_REQUEST['diaodu']);
    $filter['bdate'] = empty($_REQUEST['bdate']) ? date('Y-m-d') : trim($_REQUEST['bdate']);
    $filter['status'] = empty($_REQUEST['order_status']) ? 1 : intval($_REQUEST['order_status']);
    $filter['prints'] = trim($_REQUEST['prints']);
    $filter['ordsn'] = trim($_REQUEST['order_sn']);
    $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
    $size = $filter['psize'] = intval($_REQUEST['psize']);
    $where = "where o.order_status = " . $filter['status'] . " and d.status >0 ";
    if ($filter['turn']) {
        $where .= " and d.turn = " . $filter['turn'];
    }
    if ($filter['prints'] == 1) {
        $where .= " and c.ptime > 0 ";
    }
    if ($filter['prints'] == 2) {
        $where .= " and (c.ptime = '' or c.ptime is null) ";
    }
    if ($filter['city']) {
        $where .= " and o.country = " . $filter['city'];
    }
    if ($filter['bdate']) {
        $where .= " and o.best_time > '" . $filter['bdate'] . "' and o.best_time < '" . $filter['bdate'] . " 23:01:01' ";
    }
    if ($filter['ordsn']) {
        $where = " where o.order_sn = '" . $filter['ordsn'] . "' ";
    }
    if ($filter['station']) {
        $where .= " and s.station_id = '" . $filter['station'] . "' ";
    }
    /* $sql = "SELECT COUNT(*) FROM order_genid as a left join ecs_order_info AS o on a.order_id=o.order_id ".
       "left join order_dispatch as d on o.order_id=d.order_id left join  print_log  as c on o.order_id = c.order_id ". $where;*/
    $sql = "SELECT COUNT(*) FROM order_genid as a left join ecs_order_info AS o on a.order_id=o.order_id left join order_dispatch as d on o.order_id=d.order_id left join print_log_x as c on o.order_id = c.order_id left join ship_route as r on d.route_id=r.route_id left join ship_station as s on r.station_id=s.station_id " . $where;
    $record_count = $GLOBALS['db_read']->getOne($sql);
    $page_count = $record_count > 0 ? ceil($record_count / $size) : 1;
    /*$sql = "select o.order_id,o.order_sn,o.order_status,o.orderman,o.ordertel,o.consignee,o.mobile,o.best_time,o.order_amount,o.kfgh,o.add_time,o.pay_status, "
       . "o.country,o.city,o.district,o.address,c.ptime,c.print_sn,c.pt,c.stime,group_concat(g.goods_name) as goods ".
         "from order_genid as a left join ecs_order_info as o on a.order_id=o.order_id ".
      "left join ecs_order_goods as g on o.order_id=g.order_id ".
      "left join order_dispatch as d on o.order_id=d.order_id ".
      "left join print_log as c on o.order_id = c.order_id ".$where.
         "and g.goods_price>40 group by o.order_id order by o.best_time ".
            "LIMIT " . ($filter['page'] - 1) * $size . ",$size"; */
    $sql = "select o.order_id,o.order_sn,o.order_status,o.orderman,o.ordertel,o.consignee,o.mobile,o.best_time,o.order_amount,o.kfgh,o.add_time,o.pay_status, " . "o.country,o.city,o.district,o.address,c.ptime,c.print_sn,c.pt,c.stime,group_concat(g.goods_name) as goods " . "from order_genid as a left join ecs_order_info as o on a.order_id=o.order_id " . "left join ecs_order_goods as g on o.order_id=g.order_id " . "left join order_dispatch as d on o.order_id=d.order_id " . "left join print_log_x as c on o.order_id = c.order_id " . "left join ship_route as r on d.route_id=r.route_id " . "left join ship_station as s on r.station_id=s.station_id " . $where . "and g.goods_price>40 group by o.order_id order by o.best_time " . "LIMIT " . ($filter['page'] - 1) * $size . ",{$size}";
    //echo $sql;
    $rs = $GLOBALS['db_read']->getAll($sql);
    foreach ($rs as $key => $val) {
        $sql = "select status from order_dispatch where order_id=" . $val['order_id'];
        $rs[$key]['status'] = $GLOBALS['db_read']->getOne($sql);
        $sql = "select b.route_name from order_dispatch as a,ship_route as b where a.route_id=b.route_id and a.order_id=" . $val['order_id'];
        $rs[$key]['route_name'] = $GLOBALS['db_read']->getOne($sql);
        $rs[$key]['add_time'] = date('Y-m-d H:i', $val['add_time']);
        $rs[$key]['best_time'] = substr($val['best_time'], 0, 16);
        $rs[$key]['order_status'] = $os[$val['order_status']] . ',' . $ps[$val['pay_status']];
        $rs[$key]['i'] = $key + 1;
        $rs[$key]['address'] = region_name($val['city']) . region_name($val['district']) . $val['address'];
        if ($filter['ordsn']) {
            $filter['bdate'] = substr($val['best_time'], 0, 10);
        }
    }
    //print_r($filter);
    $arr = array('list' => $rs, 'filter' => $filter, 'page_count' => $page_count, 'record_count' => $record_count, 'cake_count' => $n);
    return $arr;
}
Exemplo n.º 3
0
function order_list()
{
    $filter['status'] = empty($_REQUEST['status']) ? 0 : intval($_REQUEST['status']);
    $filter['otatus'] = intval($_REQUEST['otatus']);
    $filter['sdate'] = empty($_REQUEST['sdate']) ? '' : trim($_REQUEST['sdate']);
    $filter['edate'] = empty($_REQUEST['edate']) ? '' : trim($_REQUEST['edate']);
    $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
    $filter['turn'] = empty($_REQUEST['turn']) ? 0 : intval($_REQUEST['turn']);
    $filter['station'] = empty($_REQUEST['station']) ? '' : intval($_REQUEST['station']);
    $filter['route_id'] = empty($_REQUEST['route_s']) ? '' : intval($_REQUEST['route_s']);
    $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
    $filter['big_goods'] = intval($_REQUEST['big_goods']);
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'best_time' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'ASC' : trim($_REQUEST['sort_order']);
    $filter['city'] = empty($_REQUEST['city']) ? '' : trim($_REQUEST['city']);
    $where = " where country " . $GLOBALS['city_code'] . " ";
    $join = '';
    if ($filter['sdate']) {
        $where .= " and best_time > '" . $filter['sdate'] . "' ";
    }
    if ($filter['edate']) {
        $where .= " and best_time < '" . $filter['edate'] . " 23:30:30' ";
    }
    if ($filter['order_sn']) {
        $where .= " and right(a.order_id,5) ='" . $filter['order_sn'] . "' ";
    }
    if ($filter['status'] == 1) {
        $where .= " and status =0";
    }
    if ($filter['status'] == 2) {
        $where .= " and status =1";
    }
    if ($filter['otatus'] < 9) {
        $where .= " and order_status = {$filter['otatus']}";
    }
    if ($filter['turn']) {
        $where .= " and turn = '" . $filter['turn'] . "' ";
    }
    if ($filter['city']) {
        $where .= " and country = '" . $filter['city'] . "' ";
    }
    if ($filter['station'] && $filter['station'] != 100) {
        $where .= " and s.station_id = '" . $filter['station'] . "' ";
    }
    if ($filter['station'] == 100) {
        $where .= " and c.route_id =0 ";
    }
    if ($filter['route_id']) {
        $where .= " and c.route_id ='" . $filter['route_id'] . "' ";
    }
    if ($filter['sort_by'] == 'shipping_station_name') {
        $orderby = " order by s.station_code desc ";
    } else {
        $orderby = " ";
    }
    if ($filter['big_goods']) {
        $join .= " left join ecs_order_goods as g on g.order_id=a.order_id ";
        $where .= " and g.goods_price > 1000 ";
    }
    $size = 20;
    $sql = "select count(1) " . "from order_genid as a " . "left join ecs_order_info as o on a.order_id=o.order_id " . "left join order_dispatch as c on a.order_id=c.order_id " . "left join ship_route as d on c.route_id=d.route_id " . $join . "left join ship_station as s on d.station_id=s.station_id " . $where;
    $record_count = $GLOBALS['db_read']->getOne($sql);
    $page_count = $record_count > 0 ? ceil($record_count / $size) : 1;
    $sql = "select a.order_id,o.order_sn,o.city,o.address,o.best_time,c.*,d.*,s.station_name,s.station_code " . "from order_genid as a " . "left join ecs_order_info as o on a.order_id=o.order_id " . "left join order_dispatch as c on a.order_id=c.order_id " . "left join ship_route as d on c.route_id=d.route_id " . $join . "left join ship_station as s on d.station_id=s.station_id " . $where . $orderby . " LIMIT " . ($filter['page'] - 1) * $size . ",{$size}";
    $res = $GLOBALS['db_read']->GetAll($sql);
    foreach ($res as $key => $val) {
        $sql = "select count(1) from ecs_order_goods where goods_price>1000 and order_id=" . $val['order_id'];
        $res[$key]['big'] = $GLOBALS['db_read']->getOne($sql) ? 1 : 0;
        $res[$key]['address'] = region_name($val['city']) . ' ' . $val['address'];
        $res[$key]['i'] = $key + 1;
        $res[$key]['sname'] = admin_name($val['admin']);
    }
    $arr = array('orders' => $res, 'filter' => $filter, 'page_count' => $page_count, 'record_count' => $record_count);
    return $arr;
}
Exemplo n.º 4
0
function order_detail($order_id)
{
    $sql = "select * " . "from ecs_order_info as o " . "where o.order_id = '{$order_id}' and o.order_id >0 ";
    $res = $GLOBALS['db_read']->getRow($sql);
    //$res = $GLOBALS['db110']->getRow($sql);
    $res['add_date'] = date('Y-m-d H:i', $res['add_time']);
    $res['btime'] = substr($res['best_time'], 5, 11);
    $res['goods_amount'] = intval($res['goods_amount']);
    $res['fw_fee'] = intval($res['pay_fee'] + $res['shipping_fee']);
    $r = print_goods($order_id);
    $r = $r['fj_fee'];
    $res['fj_fee'] = $r;
    //附件费
    //$res['fj_fee']=$res['pack_fee'];//附件费
    $res['amount'] = floatval($res['order_amount'] + $res['money_paid']);
    $res['money_paid'] = intval($res['money_paid']);
    $res['address'] = region_name($res['country']) . region_name($res['city']) . $res['address'];
    //$res['wsts']=str_replace(chr(13),'',$res['wsts']);
    //$res['wsts']=str_replace(chr(10),'',$res['wsts']);
    $card_name = explode(";", $res['card_name']);
    array_pop($card_name);
    //生日牌标识
    $card_m = explode(";", $res['card_message']);
    array_pop($card_m);
    //生日牌内容
    //print_r($card_m);
    //print_r($card_name);
    $card_message = array();
    //重新定义生日牌内容数组
    foreach ($card_name as $key => $val) {
        if ($val == '中文') {
            //生日牌标识:中文
            array_push($card_message, '生日快乐');
        } elseif ($val == '英文') {
            //生日牌标识:英文
            array_push($card_message, 'Happy Birthday');
        } elseif ($val == '无') {
            //生日牌标识:无
            array_push($card_message, '无');
        } elseif ($val == '其它') {
            //生日牌标识:其他
            foreach ($card_m as $k => $v) {
                if (!empty($v)) {
                    if ($key == $k) {
                        array_push($card_message, $card_m[$key]);
                    }
                }
            }
            // array_push($card_message,$card_m[$key]);
        }
    }
    //print_r($card_message);
    foreach ($card_message as $k => $v) {
        if ($k != count($card_message) - 1) {
            $card_mess .= $v . ',';
        } else {
            $card_mess .= $v;
        }
    }
    //echo $card_mess;
    $res['card_mess'] = $card_mess;
    //生日牌内容字符串
    return $res;
}