コード例 #1
0
ファイル: exppoints.php プロジェクト: wangjiang988/ukshop
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '会员名称');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '经验值');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '添加时间');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '操作阶段');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '描述');
     $stage_arr = Model('exppoints')->getStage();
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['exp_membername']);
         $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['exp_points']));
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['exp_addtime']));
         $tmp[] = array('data' => $stage_arr[$v['exp_stage']]);
         $tmp[] = array('data' => $v['exp_desc']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('经验值明细', CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset('经验值明细', CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #2
0
 /**
  * 订单列表
  */
 public function salelistOp()
 {
     $model = Model('stat');
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where = array();
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', $searchtime_arr);
     if (trim($_GET['order_type']) != '') {
         $where['order_state'] = trim($_GET['order_type']);
     }
     if ($_GET['exporttype'] == 'excel') {
         $order_list = $model->statByStatorder($where, '', 0, 0, 'order_id desc');
     } else {
         $order_list = $model->statByStatorder($where, '', 10, 0, 'order_id desc');
     }
     //统计数据标题
     $statlist = array();
     $statheader = array();
     $statheader[] = array('text' => '订单编号', 'key' => 'order_sn');
     $statheader[] = array('text' => '买家', 'key' => 'buyer_name');
     $statheader[] = array('text' => '下单时间', 'key' => 'order_add_time');
     $statheader[] = array('text' => '订单总额', 'key' => 'order_amount');
     $statheader[] = array('text' => '订单状态', 'key' => 'order_statetext');
     foreach ((array) $order_list as $k => $v) {
         $v['order_add_time'] = @date('Y-m-d H:i:s', $v['order_add_time']);
         switch ($v['order_state']) {
             case ORDER_STATE_CANCEL:
                 $v['order_statetext'] = '已取消';
                 break;
             case ORDER_STATE_NEW:
                 $v['order_statetext'] = '待付款';
                 break;
             case ORDER_STATE_PAY:
                 $v['order_statetext'] = '待发货';
                 break;
             case ORDER_STATE_SEND:
                 $v['order_statetext'] = '待收货';
                 break;
             case ORDER_STATE_SUCCESS:
                 $v['order_statetext'] = '交易完成';
                 break;
         }
         $statlist[$k] = $v;
     }
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         uk86_import('libraries.uk86excel');
         $excel_obj = new Uk86Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
         //header
         foreach ($statheader as $k => $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
         }
         //data
         foreach ($statlist as $k => $v) {
             foreach ($statheader as $h_k => $h_v) {
                 $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
             }
         }
         $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
         $excel_obj->uk86_addArray($excel_data);
         $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('订单记录', CHARSET));
         $excel_obj->uk86_generateXML($excel_obj->uk86_charset('订单记录', CHARSET) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('statheader', $statheader);
     Tpl::output('statlist', $statlist);
     Tpl::output('show_page', $model->showpage(2));
     Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&order_type={$this->search_arr['order_type']}&t={$this->search_arr['t']}");
     Tpl::showpage('stat.listandorder', 'null_layout');
 }
コード例 #3
0
ファイル: stat_goods.php プロジェクト: wangjiang988/ukshop
 /**
  * 商品销售明细
  */
 public function goods_saleOp()
 {
     if (!$this->search_arr['search_type']) {
         $this->search_arr['search_type'] = 'day';
     }
     $model = Model('stat');
     //获得搜索的开始时间和结束时间
     $searchtime_arr = $model->getStarttimeAndEndtime($this->search_arr);
     //获取相关数据
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', $searchtime_arr);
     //品牌
     $brand_id = intval($_REQUEST['b_id']);
     if ($brand_id > 0) {
         $where['brand_id'] = $brand_id;
     }
     //商品分类
     if ($this->choose_gcid > 0) {
         //获得分类深度
         $depth = $this->gc_arr[$this->choose_gcid]['depth'];
         $where['gc_parentid_' . $depth] = $this->choose_gcid;
     }
     if (trim($_GET['goods_name'])) {
         $where['goods_name'] = array('like', '%' . trim($_GET['goods_name']) . '%');
     }
     if (trim($_GET['store_name'])) {
         $where['store_name'] = array('like', '%' . trim($_GET['store_name']) . '%');
     }
     $field = 'goods_id,goods_name,store_id,store_name,goods_commonid,SUM(goods_num) as goodsnum,COUNT(DISTINCT order_id) as ordernum,SUM(goods_pay_price) as goodsamount';
     //排序
     $orderby_arr = array('goodsnum asc', 'goodsnum desc', 'ordernum asc', 'ordernum desc', 'goodsamount asc', 'goodsamount desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'goodsnum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',goods_id asc';
     //查询记录总条数
     $count_arr = $model->getoneByStatordergoods($where, 'COUNT(DISTINCT goods_id) as countnum');
     $countnum = intval($count_arr['countnum']);
     if ($_GET['exporttype'] == 'excel') {
         $goods_list = $model->statByStatordergoods($where, $field, 0, 0, $orderby, 'goods_id');
     } else {
         $goods_list = $model->statByStatordergoods($where, $field, array(10, $countnum), 0, $orderby, 'goods_id');
     }
     //导出Excel
     if ($_GET['exporttype'] == 'excel') {
         //导出Excel
         uk86_import('libraries.uk86excel');
         $excel_obj = new Uk86Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
         //header
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '商品名称');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '平台货号');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '店铺名称');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '下单商品件数');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '下单单量');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '下单金额');
         //data
         foreach ($goods_list as $k => $v) {
             $excel_data[$k + 1][] = array('data' => $v['goods_name']);
             $excel_data[$k + 1][] = array('data' => $v['goods_commonid']);
             $excel_data[$k + 1][] = array('data' => $v['store_name']);
             $excel_data[$k + 1][] = array('data' => $v['goodsnum']);
             $excel_data[$k + 1][] = array('data' => $v['ordernum']);
             $excel_data[$k + 1][] = array('data' => $v['goodsamount']);
         }
         $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
         $excel_obj->uk86_addArray($excel_data);
         $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('商品销售明细', CHARSET));
         $excel_obj->uk86_generateXML($excel_obj->uk86_charset('商品销售明细', CHARSET) . date('Y-m-d-H', time()));
         exit;
     } else {
         //查询品牌
         $brand_list = Model('brand')->getBrandList(array('brand_apply' => 1));
         Tpl::output('brand_list', $brand_list);
         Tpl::output('goods_list', $goods_list);
         Tpl::output('show_page', $model->showpage(2));
         Tpl::output('orderby', $this->search_arr['orderby']);
         Tpl::output('top_link', $this->sublink($this->links, 'goods_sale'));
         Tpl::showpage('stat.goodssale');
     }
 }
コード例 #4
0
ファイル: stat_store.php プロジェクト: wangjiang988/ukshop
 /**
  * 店铺销售统计列表
  */
 public function storesales_listOp()
 {
     $model = Model('stat');
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', $searchtime_arr);
     //店铺分类
     $search_sclass = intval($_REQUEST['search_sclass']);
     if ($search_sclass) {
         $where['sc_id'] = $search_sclass;
     }
     //店铺名称
     $where['store_name'] = array('like', "%{$_GET['search_sname']}%");
     //查询总条数
     $count_arr = $model->getoneByStatorder($where, 'COUNT(DISTINCT store_id) as countnum');
     $countnum = intval($count_arr['countnum']);
     //列表字段
     $field = " store_id,store_name,SUM(order_amount) as orderamount, COUNT(*) as ordernum, COUNT(DISTINCT buyer_id) as membernum";
     //排序
     $orderby_arr = array('membernum asc', 'membernum desc', 'ordernum asc', 'ordernum desc', 'orderamount asc', 'orderamount desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'membernum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',store_id asc';
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist = $model->statByStatorder($where, $field, 0, 0, $orderby, 'store_id');
     } else {
         $statlist = $model->statByStatorder($where, $field, array(20, $countnum), 0, $orderby, 'store_id');
         foreach ((array) $statlist as $k => $v) {
             $v['view'] = "<a href='javascript:void(0);' nc_type='showtrends' data-param='{\"storeid\":\"{$v['store_id']}\"}'>走势图</a>";
             $statlist[$k] = $v;
         }
     }
     //列表header
     $statheader = array();
     $statheader[] = array('text' => '店铺名称', 'key' => 'store_name');
     $statheader[] = array('text' => '下单会员数', 'key' => 'membernum', 'isorder' => 1);
     $statheader[] = array('text' => '下单量', 'key' => 'ordernum', 'isorder' => 1);
     $statheader[] = array('text' => '下单金额', 'key' => 'orderamount', 'isorder' => 1);
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         uk86_import('libraries.uk86excel');
         $excel_obj = new Uk86Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
         //header
         foreach ($statheader as $k => $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
         }
         //data
         foreach ($statlist as $k => $v) {
             foreach ($statheader as $h_k => $h_v) {
                 $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
             }
         }
         $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
         $excel_obj->uk86_addArray($excel_data);
         $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('店铺销售统计', CHARSET));
         $excel_obj->uk86_generateXML($excel_obj->uk86_charset('店铺销售统计', CHARSET) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('statlist', $statlist);
     Tpl::output('statheader', $statheader);
     Tpl::output('orderby', $this->search_arr['orderby']);
     Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&t={$this->search_arr['t']}&search_sclass={$search_sclass}&search_sname={$_GET['search_sname']}");
     Tpl::output('show_page', $model->showpage(2));
     Tpl::showpage('stat.listandorder', 'null_layout');
 }
コード例 #5
0
ファイル: order.php プロジェクト: wangjiang988/ukshop
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Uk86Language::uk86_read('export');
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_no'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_store'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_buyer'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_xtimd'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_count'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_yfei'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_paytype'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_state'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_storeid'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_buyerid'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_bemail'));
     //data
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => 'NC' . $v['order_sn']);
         $tmp[] = array('data' => $v['store_name']);
         $tmp[] = array('data' => $v['buyer_name']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['add_time']));
         $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['order_amount']));
         $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['shipping_fee']));
         $tmp[] = array('data' => uk86_orderPaymentName($v['payment_code']));
         $tmp[] = array('data' => uk86_orderState($v));
         $tmp[] = array('data' => $v['store_id']);
         $tmp[] = array('data' => $v['buyer_id']);
         $tmp[] = array('data' => $v['buyer_email']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset(L('exp_od_order'), CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset(L('exp_od_order'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #6
0
ファイル: stat_trade.php プロジェクト: wangjiang988/ukshop
 /**
  * 订单统计
  */
 public function saleOp()
 {
     $model = Model('stat');
     //存储参数
     $this->search_arr = $_REQUEST;
     //处理搜索时间
     $this->search_arr = $model->dealwithSearchTime($this->search_arr);
     //获得系统年份
     $year_arr = uk86_getSystemYearArr();
     //获得系统月份
     $month_arr = uk86_getSystemMonthArr();
     //获得本月的周时间段
     $week_arr = uk86_getMonthWeekArr($this->search_arr['week']['current_year'], $this->search_arr['week']['current_month']);
     Tpl::output('year_arr', $year_arr);
     Tpl::output('month_arr', $month_arr);
     Tpl::output('week_arr', $week_arr);
     Tpl::output('search_arr', $this->search_arr);
     //默认统计当前数据
     if (!$this->search_arr['search_type']) {
         $this->search_arr['search_type'] = 'day';
     }
     //计算昨天和今天时间
     if ($this->search_arr['search_type'] == 'day') {
         $stime = $this->search_arr['day']['search_time'] - 86400;
         //昨天0点
         $etime = $this->search_arr['day']['search_time'] + 86400 - 1;
         //今天24点
         $curr_stime = $this->search_arr['day']['search_time'];
         //今天0点
     } elseif ($this->search_arr['search_type'] == 'week') {
         $current_weekarr = explode('|', $this->search_arr['week']['current_week']);
         $stime = strtotime($current_weekarr[0]) - 86400 * 7;
         $etime = strtotime($current_weekarr[1]) + 86400 - 1;
         $curr_stime = strtotime($current_weekarr[0]);
         //本周0点
     } elseif ($this->search_arr['search_type'] == 'month') {
         $stime = strtotime($this->search_arr['month']['current_year'] . '-' . $this->search_arr['month']['current_month'] . "-01 -1 month");
         $etime = uk86_getMonthLastDay($this->search_arr['month']['current_year'], $this->search_arr['month']['current_month']) + 86400 - 1;
         $curr_stime = strtotime($this->search_arr['month']['current_year'] . '-' . $this->search_arr['month']['current_month'] . "-01");
         //本月0点
     }
     $where = array();
     $where['order_add_time'] = array('between', array($curr_stime, $etime));
     if (trim($_GET['order_type']) != '') {
         $where['order_state'] = trim($_GET['order_type']);
     }
     if (trim($_GET['store_name']) != '') {
         $where['store_name'] = array('like', '%' . trim($_GET['store_name']) . '%');
     }
     if ($_GET['exporttype'] == 'excel') {
         $order_list = $model->statByStatorder($where, '', 0, 0, 'order_id desc', '');
     } else {
         $order_list = $model->statByStatorder($where, '', 10, 0, 'order_id desc', '');
     }
     //统计数据标题
     $statlist = array();
     $statlist['headertitle'] = array('订单号', '买家', '店铺名称', '下单时间', '订单总额', '订单状态');
     foreach ((array) $order_list as $k => $v) {
         switch ($v['order_state']) {
             case ORDER_STATE_CANCEL:
                 $v['order_statetext'] = '已取消';
                 break;
             case ORDER_STATE_NEW:
                 $v['order_statetext'] = '待付款';
                 break;
             case ORDER_STATE_PAY:
                 $v['order_statetext'] = '待发货';
                 break;
             case ORDER_STATE_SEND:
                 $v['order_statetext'] = '待收货';
                 break;
             case ORDER_STATE_SUCCESS:
                 $v['order_statetext'] = '交易完成';
                 break;
         }
         $statlist['data'][$k] = $v;
     }
     //导出Excel
     if ($_GET['exporttype'] == 'excel') {
         //导出Excel
         uk86_import('libraries.uk86excel');
         $excel_obj = new Uk86Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
         //header
         foreach ($statlist['headertitle'] as $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v);
         }
         //data
         foreach ((array) $statlist['data'] as $k => $v) {
             $excel_data[$k + 1][] = array('data' => $v['order_sn']);
             $excel_data[$k + 1][] = array('data' => $v['buyer_name']);
             $excel_data[$k + 1][] = array('data' => $v['store_name']);
             $excel_data[$k + 1][] = array('data' => date('Y-m-d H:i:s', $v['order_add_time']));
             $excel_data[$k + 1][] = array('data' => number_format($v['order_amount'], 2));
             $excel_data[$k + 1][] = array('data' => $v['order_statetext']);
         }
         $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
         $excel_obj->uk86_addArray($excel_data);
         $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('订单统计', CHARSET));
         $excel_obj->uk86_generateXML($excel_obj->uk86_charset('订单统计', CHARSET) . date('Y-m-d-H', time()));
         exit;
     } else {
         //总数统计
         $statcount_arr = $model->getoneByStatorder($where, ' COUNT(*) as ordernum, SUM(order_amount) as orderamount');
         Tpl::output('statcount_arr', $statcount_arr);
         Tpl::output('searchtime', implode('|', array($stime, $etime)));
         Tpl::output('statlist', $statlist);
         Tpl::output('show_page', $model->showpage());
         Tpl::output('top_link', $this->sublink($this->links, 'sale'));
         Tpl::showpage('stat.sale');
     }
 }
コード例 #7
0
ファイル: rechargecard.php プロジェクト: wangjiang988/ukshop
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Uk86Language::uk86_read('export');
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '充值卡卡号');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '批次标识');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '面额(元)');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '发布管理员');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '发布时间');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '领取人');
     //data
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => "\t" . $v['sn']);
         $tmp[] = array('data' => "\t" . $v['batchflag']);
         $tmp[] = array('data' => "\t" . $v['denomination']);
         $tmp[] = array('data' => "\t" . $v['admin_name']);
         $tmp[] = array('data' => "\t" . date('Y-m-d H:i:s', $v['tscreated']));
         if ($v['state'] == 1 && $v['member_id'] > 0 && $v['tsused'] > 0) {
             $tmp[] = array('data' => "\t" . $v['member_name']);
         } else {
             $tmp[] = array('data' => "\t-");
         }
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('充值卡', CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset('充值卡', CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #8
0
ファイル: admin_log.php プロジェクト: wangjiang988/ukshop
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Uk86Language::uk86_read('export');
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('admin_log_man'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('admin_log_do'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('admin_log_dotime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => 'IP');
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['admin_name']);
         $tmp[] = array('data' => $v['content']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['createtime']));
         $tmp[] = array('data' => $v['ip']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset(L('nc_admin_log'), CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset(L('nc_admin_log'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #9
0
ファイル: predeposit.php プロジェクト: wangjiang988/ukshop
 /**
  * 导出预存款明细excel
  *
  * @param array $data
  */
 private function createmxExcel($data = array())
 {
     Uk86Language::uk86_read('export');
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_member'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_ctime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_av_money'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_freeze_money'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_system'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_mshu'));
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['lg_member_name']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['lg_add_time']));
         if (floatval($v['lg_av_amount']) == 0) {
             $tmp[] = array('data' => '');
         } else {
             $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['lg_av_amount']));
         }
         if (floatval($v['lg_freeze_amount']) == 0) {
             $tmp[] = array('data' => '');
         } else {
             $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['lg_freeze_amount']));
         }
         $tmp[] = array('data' => $v['lg_admin_name']);
         $tmp[] = array('data' => $v['lg_desc']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset(L('exp_mx_rz'), CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset(L('exp_mx_rz'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #10
0
 /**
  * 店铺动态评分统计
  */
 public function evalstoreOp()
 {
     //店铺分类
     Tpl::output('class_list', uk86_rkcache('store_class', true));
     $model = Model('stat');
     $where = array();
     if (intval($_GET['store_class']) > 0) {
         $where['sc_id'] = intval($_GET['store_class']);
     }
     if (trim($this->search_arr['storename'])) {
         $where['seval_storename'] = array('like', "%" . trim($this->search_arr['storename']) . "%");
     }
     $field = ' seval_storeid, seval_storename';
     $field .= ' ,(SUM(seval_desccredit)/COUNT(*)) as avgdesccredit';
     $field .= ' ,(SUM(seval_servicecredit)/COUNT(*)) as avgservicecredit';
     $field .= ' ,(SUM(seval_deliverycredit)/COUNT(*)) as avgdeliverycredit';
     $orderby_arr = array('avgdesccredit asc', 'avgdesccredit desc', 'avgservicecredit asc', 'avgservicecredit desc', 'avgdeliverycredit asc', 'avgdeliverycredit desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'avgdesccredit desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',seval_storeid';
     //查询评论的店铺总数
     $count_arr = $model->statByStoreAndEvaluatestore($where, 'count(DISTINCT evaluate_store.seval_storeid) as countnum');
     $countnum = intval($count_arr[0]['countnum']);
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist_tmp = $model->statByStoreAndEvaluatestore($where, $field, 0, 0, $orderby, 'seval_storeid');
     } else {
         $statlist_tmp = $model->statByStoreAndEvaluatestore($where, $field, array(10, $countnum), 0, $orderby, 'seval_storeid');
     }
     foreach ((array) $statlist_tmp as $k => $v) {
         $tmp = $v;
         $tmp['avgdesccredit'] = round($v['avgdesccredit'], 2);
         $tmp['avgservicecredit'] = round($v['avgservicecredit'], 2);
         $tmp['avgdeliverycredit'] = round($v['avgdeliverycredit'], 2);
         $statlist[] = $tmp;
     }
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         uk86_import('libraries.uk86excel');
         $excel_obj = new Uk86Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
         //header
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '店铺名称');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '描述相符度');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '服务态度');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '发货速度');
         //data
         foreach ((array) $statlist as $k => $v) {
             $excel_data[$k + 1][] = array('data' => $v['seval_storename']);
             $excel_data[$k + 1][] = array('data' => $v['avgdesccredit']);
             $excel_data[$k + 1][] = array('data' => $v['avgservicecredit']);
             $excel_data[$k + 1][] = array('data' => $v['avgdeliverycredit']);
         }
         $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
         $excel_obj->uk86_addArray($excel_data);
         $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('店铺动态评分统计', CHARSET));
         $excel_obj->uk86_generateXML($excel_obj->uk86_charset('店铺动态评分统计', CHARSET) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('statlist', $statlist);
     Tpl::output('orderby', $this->search_arr['orderby']);
     Tpl::output('show_page', $model->showpage(2));
     Tpl::output('top_link', $this->sublink($this->links, 'evalstore'));
     Tpl::showpage('stat.aftersale.evalstore');
 }
コード例 #11
0
ファイル: stat_member.php プロジェクト: wangjiang988/ukshop
 /**
  * 区域分析之详细列表
  */
 public function area_listOp()
 {
     $model = Model('stat');
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where['order_add_time'] = array('between', $searchtime_arr);
     $field = ' reciver_province_id, COUNT(*) as ordernum,SUM(order_amount) as orderamount, COUNT(DISTINCT buyer_id) as membernum ';
     $orderby_arr = array('membernum asc', 'membernum desc', 'orderamount asc', 'orderamount desc', 'ordernum asc', 'ordernum desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'membernum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',reciver_province_id';
     $count_arr = $model->getoneByStatorder($where, 'COUNT(DISTINCT reciver_province_id) as countnum');
     $countnum = intval($count_arr['countnum']);
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist_tmp = $model->statByStatorder($where, $field, 0, 0, $orderby, 'reciver_province_id');
     } else {
         $statlist_tmp = $model->statByStatorder($where, $field, array(10, $countnum), 0, $orderby, 'reciver_province_id');
     }
     // 地区
     $province_array = Model('area')->getTopLevelAreas();
     $statheader = array();
     $statheader[] = array('text' => '省份', 'key' => 'provincename');
     $statheader[] = array('text' => '下单会员数', 'key' => 'membernum', 'isorder' => 1);
     $statheader[] = array('text' => '下单金额', 'key' => 'orderamount', 'isorder' => 1);
     $statheader[] = array('text' => '下单量', 'key' => 'ordernum', 'isorder' => 1);
     $statlist = array();
     foreach ((array) $statlist_tmp as $k => $v) {
         $province_id = intval($v['reciver_province_id']);
         $tmp = array();
         $tmp['provincename'] = ($t = $province_array[$province_id]) ? $t : '其他';
         $tmp['membernum'] = $v['membernum'];
         $tmp['orderamount'] = $v['orderamount'];
         $tmp['ordernum'] = $v['ordernum'];
         $statlist[] = $tmp;
     }
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         uk86_import('libraries.uk86excel');
         $excel_obj = new Uk86Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
         //header
         foreach ($statheader as $k => $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
         }
         //data
         foreach ($statlist as $k => $v) {
             foreach ($statheader as $h_k => $h_v) {
                 $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
             }
         }
         $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
         $excel_obj->uk86_addArray($excel_data);
         $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('区域分析', CHARSET));
         $excel_obj->uk86_generateXML($excel_obj->uk86_charset('区域分析', CHARSET) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('statlist', $statlist);
     Tpl::output('statheader', $statheader);
     Tpl::output('orderby', $this->search_arr['orderby']);
     Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&t={$this->search_arr['t']}");
     Tpl::output('show_page', $model->showpage(2));
     Tpl::output('top_link', $this->sublink($this->links, 'area'));
     Tpl::showpage('stat.listandorder', 'null_layout');
 }
コード例 #12
0
ファイル: points.php プロジェクト: wangjiang988/ukshop
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Uk86Language::uk86_read('export');
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_member'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_system'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_point'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_time'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_jd'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_ms'));
     $state_cn = array(Uk86Language::uk86_get('admin_points_stage_regist'), Uk86Language::uk86_get('admin_points_stage_login'), Uk86Language::uk86_get('admin_points_stage_comments'), Uk86Language::uk86_get('admin_points_stage_order'), Uk86Language::uk86_get('admin_points_stage_system'), Uk86Language::uk86_get('admin_points_stage_pointorder'), Uk86Language::uk86_get('admin_points_stage_app'));
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['pl_membername']);
         $tmp[] = array('data' => $v['pl_adminname']);
         $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['pl_points']));
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['pl_addtime']));
         $tmp[] = array('data' => str_replace(array('regist', 'login', 'comments', 'order', 'system', 'pointorder', 'app'), $state_cn, $v['pl_stage']));
         $tmp[] = array('data' => $v['pl_desc']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset(L('exp_pi_jfmx'), CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset(L('exp_pi_jfmx'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #13
0
 /**
  * 下载F码
  */
 public function download_f_code_excelOp()
 {
     $common_id = $_GET['commonid'];
     if ($common_id <= 0) {
         uk86_showMessage(L('wrong_argument'), '', '', 'error');
     }
     $common_info = Model('goods')->getGoodeCommonInfoByID($common_id);
     if (empty($common_info) || $common_info['store_id'] != $_SESSION['store_id']) {
         uk86_showMessage(L('wrong_argument'), '', '', 'error');
     }
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '号码');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '使用状态');
     $data = Model('goods_fcode')->getGoodsFCodeList(array('goods_commonid' => $common_id));
     foreach ($data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['fc_code']);
         $tmp[] = array('data' => $v['fc_state'] ? '已使用' : '未使用');
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset($common_info['goods_name'], CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset($common_info['goods_name'], CHARSET) . '-' . date('Y-m-d-H', time()));
 }
コード例 #14
0
 /**
  * 抢购商品统计
  */
 public function groupgoodsOp()
 {
     $model = Model('stat');
     $where = array();
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where['order_add_time'] = array('between', $searchtime_arr);
     $where['goods_type'] = 2;
     //抢购
     $field = " goods_id,goods_name";
     $field .= " ,SUM(goods_num) as goodsnum";
     $field .= " ,SUM(goods_pay_price) as goodsamount";
     $field .= " ,SUM(IF(order_state='" . ORDER_STATE_CANCEL . "',goods_num,0)) as cancelgoodsnum";
     $field .= " ,SUM(IF(order_state='" . ORDER_STATE_CANCEL . "',goods_pay_price,0)) as cancelgoodsamount";
     $field .= " ,SUM(IF(order_state<>'" . ORDER_STATE_CANCEL . "' and order_state<>'" . ORDER_STATE_NEW . "',goods_num,0)) as finishgoodsnum";
     $field .= " ,SUM(IF(order_state<>'" . ORDER_STATE_CANCEL . "' and order_state<>'" . ORDER_STATE_NEW . "',goods_pay_price,0)) as finishgoodsamount";
     $orderby_arr = array('goodsnum asc', 'goodsnum desc', 'goodsamount asc', 'goodsamount desc', 'cancelgoodsnum asc', 'cancelgoodsnum desc', 'cancelgoodsamount asc', 'cancelgoodsamount desc', 'finishgoodsnum asc', 'finishgoodsnum desc', 'finishgoodsamount asc', 'finishgoodsamount desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'goodsnum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',goods_id desc';
     //统计记录总条数
     $count_arr = $model->getoneByStatordergoods($where, 'count(DISTINCT goods_id) as countnum');
     $countnum = intval($count_arr['countnum']);
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist_tmp = $model->statByStatordergoods($where, $field, 0, 0, $orderby, 'goods_id');
     } else {
         $statlist_tmp = $model->statByStatordergoods($where, $field, array(10, $countnum), 0, $orderby, 'goods_id');
     }
     $statheader = array();
     $statheader[] = array('text' => '商品名称', 'key' => 'goods_name', 'class' => 'alignleft');
     $statheader[] = array('text' => '下单商品数', 'key' => 'goodsnum', 'isorder' => 1);
     $statheader[] = array('text' => '下单金额', 'key' => 'goodsamount', 'isorder' => 1);
     $statheader[] = array('text' => '取消商品数', 'key' => 'cancelgoodsnum', 'isorder' => 1);
     $statheader[] = array('text' => '取消金额', 'key' => 'cancelgoodsamount', 'isorder' => 1);
     $statheader[] = array('text' => '完成商品数', 'key' => 'finishgoodsnum', 'isorder' => 1);
     $statheader[] = array('text' => '完成金额', 'key' => 'finishgoodsamount', 'isorder' => 1);
     foreach ((array) $statlist_tmp as $k => $v) {
         $tmp = $v;
         foreach ($statheader as $h_k => $h_v) {
             $tmp[$h_v['key']] = $v[$h_v['key']];
             if ($h_v['key'] == 'goods_name') {
                 $tmp[$h_v['key']] = '<a href="' . uk86_urlShop('goods', 'index', array('goods_id' => $v['goods_id'])) . '" target="_blank">' . $v['goods_name'] . '</a>';
             }
         }
         $statlist[] = $tmp;
     }
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         uk86_import('libraries.uk86excel');
         $excel_obj = new Uk86Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
         //header
         foreach ($statheader as $k => $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
         }
         //data
         foreach ((array) $statlist as $k => $v) {
             foreach ($statheader as $h_k => $h_v) {
                 $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
             }
         }
         $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
         $excel_obj->uk86_addArray($excel_data);
         $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('抢购商品统计', CHARSET));
         $excel_obj->uk86_generateXML($excel_obj->uk86_charset('抢购商品统计', CHARSET) . date('Y-m-d-H', time()));
         exit;
     } else {
         Tpl::output('statheader', $statheader);
         Tpl::output('statlist', $statlist);
         Tpl::output('show_page', $model->showpage(2));
         Tpl::output('searchtime', $_GET['t']);
         Tpl::output('orderby', $this->search_arr['orderby']);
         Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&t={$this->search_arr['t']}");
         Tpl::showpage('stat.listandorder', 'null_layout');
     }
 }