コード例 #1
0
ファイル: Until.php プロジェクト: song-yuan/wymenujp
 /**
  * 导出excel表格
  */
 public static function exportFile($data, $type = 'xml', $fileName = 'excel-export')
 {
     if ($type == 'xml') {
         $xls = new Excel('UTF-8', false);
         $xls->addArray($data);
         $xls->generateXML($fileName);
     }
     if ($type == 'pdf') {
     }
     return;
 }
コード例 #2
0
ファイル: stat_member.php プロジェクト: noikiy/cunkou
 /**
  * 区域分析之详细列表
  */
 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
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('区域分析', CHARSET));
         $excel_obj->generateXML($excel_obj->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');
 }
コード例 #3
0
ファイル: member.php プロジェクト: dw250100785/shopnc
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_member'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_name'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_jf'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_yck'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_jbs'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => 'Email');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_sex'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => 'QQ');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_ww'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_dcs'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_rtime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_ltime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mb_storeid'));
     $state_cn = array(Language::get('admin_points_stage_regist'), Language::get('admin_points_stage_login'), Language::get('admin_points_stage_comments'), Language::get('admin_points_stage_order'), Language::get('admin_points_stage_system'), Language::get('admin_points_stage_pointorder'), Language::get('admin_points_stage_app'));
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['member_name']);
         $tmp[] = array('data' => $v['member_truename']);
         $tmp[] = array('format' => 'Number', 'data' => ncPriceFormat($v['pl_points']));
         $tmp[] = array('data' => Language::get('member_index_available') . ':' . $v['available_predeposit'] . Language::get('member_index_frozen') . ':' . $v['freeze_predeposit']);
         $tmp[] = array('data' => $v['member_goldnum']);
         $tmp[] = array('data' => $v['member_email']);
         $tmp[] = array('data' => str_replace(array(1, 2, 0, 3), array(L('exp_mb_nan'), L('exp_mb_nv'), '', ''), $v['member_sex']));
         $tmp[] = array('data' => $v['member_qq']);
         $tmp[] = array('data' => $v['member_ww']);
         $tmp[] = array('data' => $v['member_login_num']);
         $tmp[] = array('data' => $v['member_time']);
         $tmp[] = array('data' => $v['member_login_time']);
         $tmp[] = array('data' => $v['store_id']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_member'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_member'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #4
0
ファイル: order.php プロジェクト: dotku/shopnc_cnnewyork
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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' => ncPriceFormat($v['order_amount']));
         $tmp[] = array('format' => 'Number', 'data' => ncPriceFormat($v['shipping_fee']));
         $tmp[] = array('data' => orderPaymentName($v['payment_code']));
         $tmp[] = array('data' => 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->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_od_order'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #5
0
ファイル: spec.php プロジェクト: Maplecms/shopnc-yhmall
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_spec'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_sp_content'));
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['sp_name']);
         $tmp[] = array('data' => $v['sp_value']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_spec'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_spec'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #6
0
ファイル: stat_goods.php プロジェクト: xuxuecheng/shopnc
 /**
  * 商品销售明细
  */
 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
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('商品销售明细', CHARSET));
         $excel_obj->generateXML($excel_obj->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');
     }
 }
コード例 #7
0
ファイル: stat_marketing.php プロジェクト: noikiy/haifenbao
 /**
  * 团购商品统计
  */
 public function groupgoodsOp()
 {
     $model = Model('stat');
     $where = array();
     $searchtime_arr = explode('|', $_GET['t']);
     $where['add_time'] = array('between', $searchtime_arr);
     $where['goods_type'] = 2;
     $goodsname = trim($_GET['goodsname']);
     if ($goodsname) {
         $where['goods_name'] = array('like', "%{$goodsname}%");
     }
     $field = " goods_id,goods_name";
     $field .= " ,SUM(order_goods.goods_num) as goodsnum";
     $field .= " ,SUM(order_goods.goods_pay_price) as goodsamount";
     $field .= " ,SUM(IF(order.order_state='" . ORDER_STATE_CANCEL . "',goods_num,0)) as cancelgoodsnum";
     $field .= " ,SUM(IF(order.order_state='" . ORDER_STATE_CANCEL . "',goods_pay_price,0)) as cancelgoodsamount";
     $field .= " ,SUM(IF(order.order_state<>'" . ORDER_STATE_CANCEL . "' and order.order_state<>'" . ORDER_STATE_NEW . "',goods_num,0)) as finishgoodsnum";
     $field .= " ,SUM(IF(order.order_state<>'" . ORDER_STATE_CANCEL . "' and order.order_state<>'" . ORDER_STATE_NEW . "',goods_pay_price,0)) as finishgoodsamount";
     if (!trim($this->search_arr['orderby'])) {
         $this->search_arr['orderby'] = 'goodsnum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',goods_id desc';
     //统计记录总条数
     $count_arr = $model->statByOrderGoods($where, 'count(DISTINCT goods_id) as countnum');
     $countnum = intval($count_arr[0]['countnum']);
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist_tmp = $model->statByOrderGoods($where, $field, 0, 0, $orderby, 'goods_id');
     } else {
         $statlist_tmp = $model->statByOrderGoods($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="' . urlShop('goods', 'index', array('goods_id' => $v['goods_id'])) . '" target="_blank">' . $v['goods_name'] . '</a>';
             }
         }
         $statlist[] = $tmp;
     }
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('团购商品统计', CHARSET));
         $excel_obj->generateXML($excel_obj->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');
     }
 }
コード例 #8
0
ファイル: predeposit.php プロジェクト: flying3615/chuniang
 /**
  * 导出预存款明细excel
  *
  * @param array $data
  */
 private function createmxExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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' => ncPriceFormat($v['lg_av_amount']));
         }
         if (floatval($v['lg_freeze_amount']) == 0) {
             $tmp[] = array('data' => '');
         } else {
             $tmp[] = array('format' => 'Number', 'data' => 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->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_mx_rz'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_mx_rz'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #9
0
ファイル: stat_store.php プロジェクト: norain2050/xingkang
 /**
  * 查看店铺列表
  */
 public function showstoreOp()
 {
     $model = Model('stat');
     $where = array();
     if (in_array($_GET['type'], array('newbyday', 'newbyweek', 'newbymonth'))) {
         $actionurl = 'index.php?act=stat_store&op=showstore&type=newbyday&t=' . $_GET['t'];
         $searchtime_arr = explode('|', $_GET['t']);
         $where['store_time'] = array('between', $searchtime_arr);
     }
     if ($_GET['exporttype'] == 'excel') {
         $store_list = $model->getNewStoreStatList($where);
     } else {
         $store_list = $model->getNewStoreStatList($where, '', 10);
     }
     //店铺等级
     $model_grade = Model('store_grade');
     $grade_list = $model_grade->getGradeList();
     if (!empty($grade_list)) {
         $search_grade_list = array();
         foreach ($grade_list as $k => $v) {
             $search_grade_list[$v['sg_id']] = $v['sg_name'];
         }
     }
     //导出Excel
     if ($_GET['exporttype'] == 'excel') {
         //导出Excel
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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 ($store_list as $k => $v) {
             $excel_data[$k + 1][] = array('data' => $v['store_name']);
             $excel_data[$k + 1][] = array('data' => $v['member_name']);
             $excel_data[$k + 1][] = array('data' => $v['seller_name']);
             $excel_data[$k + 1][] = array('data' => $search_grade_list[$v['grade_id']]);
             $excel_data[$k + 1][] = array('data' => $v['store_end_time'] ? date('Y-m-d', $v['store_end_time']) : '无限制');
             $excel_data[$k + 1][] = array('data' => date('Y-m-d', $v['store_time']));
         }
         $excel_data = $excel_obj->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('新增店铺', CHARSET));
         $excel_obj->generateXML($excel_obj->charset('新增店铺', CHARSET) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('search_grade_list', $search_grade_list);
     Tpl::output('actionurl', $actionurl);
     Tpl::output('store_list', $store_list);
     Tpl::output('show_page', $model->showpage(2));
     $this->links[] = array('url' => 'act=stat_store&op=showstore', 'lang' => 'stat_storelist');
     Tpl::output('top_link', $this->sublink($this->links, 'showstore'));
     Tpl::showpage('stat.info.storelist');
 }
コード例 #10
0
ファイル: statistics_sale.php プロジェクト: noikiy/ejia
	/**
	 * 订单列表
	 */
	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
			import('libraries.excel');
		    $excel_obj = new Excel();
		    $excel_data = array();
		    //设置样式
		    $excel_obj->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->charset($excel_data,CHARSET);
			$excel_obj->addArray($excel_data);
		    $excel_obj->addWorksheet($excel_obj->charset('订单记录',CHARSET));
		    $excel_obj->generateXML($excel_obj->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');
	}
コード例 #11
0
ファイル: gold_buy.php プロジェクト: dw250100785/shopnc
 /**
  * 生成excel,导出金币日志
  *
  * @param array $data
  */
 private function createLogExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_jb_member'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_jb_store'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_jb_jbs'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_jb_type'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_jb_btime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_jb_mshu'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_jb_storeid'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_jb_memberid'));
     $payment_array = $this->getPayment();
     $payment_array_new = array();
     if (is_array($payment_array) && count($payment_array) > 0) {
         foreach ($payment_array as $k => $v) {
             if ($v['payment_code'] != 'predeposit') {
                 $payment_array_new[$v['payment_code']] = $v;
             }
         }
     }
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['glog_membername']);
         $tmp[] = array('data' => $v['glog_storename']);
         $tmp[] = array('data' => $v['glog_goldnum']);
         $tmp[] = array('data' => str_replace(array(1, 2), array(L('exp_jb_add'), L('exp_jb_del')), $v['glog_method']));
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['glog_addtime']));
         $tmp[] = array('data' => $v['glog_desc']);
         $tmp[] = array('data' => $v['glog_storeid']);
         $tmp[] = array('data' => $v['glog_memberid']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_jb_log'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_jb_log'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #12
0
ファイル: user_card.php プロジェクト: nanhuacrab/ecshop
    $xls = new Excel();
    $xls->addArray(array(0 => array('卡名', '会员卡号', '等级', '卡密', '卡内金额', '消费积分', '等级积分', '姓名', '地址', '电话', '邮箱', '发送方式', '会员名', '添加时间', '绑定状态', '绑定时间', '描述')));
    $i = 1;
    $id = $_REQUEST['id'];
    $card_id_list = explode(',', $id);
    foreach ($card_id_list as $id) {
        $card_info = $db->getRow('select c.*,u.user_name from ' . $ecs->table('user_card') . " as c  left join " . $ecs->table('users') . " as u on u.user_id =c.user_id  where c.id='{$id}' ");
        $card_info['ct_name'] = $ct_info['ct_name'];
        $card_info['str_add_time'] = $card_info['add_time'] ? local_date('Y-m-d', $card_info['add_time']) : '';
        $card_info['str_bind'] = $card_info['stauts'] == 1 ? '已绑定' : '未绑定';
        $card_info['str_bind_time'] = $card_info['bind_time'] ? local_date('Y-m-d', $card_info['bind_time']) : '';
        $xls->addArray(array($i => array($card_info['ct_name'], $card_info['card_no'], $card_info['card_level'], $card_info['card_pass'], $card_info['user_money'], $card_info['pay_points'], $card_info['rank_points'], $card_info['true_name'], $card_info['address'], $card_info['mobile'], $card_info['email'], $card_info['send_type'], $card_info['user_name'], $card_info['str_add_time'], $card_info['str_bind'], $card_info['str_bind_time'], $card_info['des'])));
        $i++;
    }
    ob_clean();
    $xls->generateXML("card_" . date('y_m_d') . '_' . rand(1, 99));
    exit;
} elseif ($_REQUEST['act'] == 'edit_card_no') {
    $id = intval($_REQUEST['id']);
    $val = empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val']));
    check_authz_json('user_card');
    if ($exc->is_only('card_no', $val, $id)) {
        if ($exc->edit("card_no = '{$val}'", $id)) {
            /* 管理员日志 */
            admin_log($val, 'edit', 'user_card');
            clear_cache_files();
            make_json_result(stripcslashes($val));
        } else {
            make_json_error($db->error());
        }
    } else {
コード例 #13
0
ファイル: shipping_fee.php プロジェクト: noikiy/haifenbao
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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' => '物流单号');
     //data
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => 'NC' . $v['order_sn']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['add_time']));
         $tmp[] = array('data' => $v['payment_time'] ? date('Y-m-d H:i:s', $v['payment_time']) : '');
         $tmp[] = array('format' => 'Number', 'data' => $v['shipping_fee']);
         $tmp[] = array('data' => $v['shipping_code']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_od_order'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #14
0
ファイル: stat_trade.php プロジェクト: Maplecms/shopnc-yhmall
 /**
  * 订单统计
  */
 public function saleOp()
 {
     $where = array();
     if (trim($_GET['order_type']) != '') {
         $where['order_state'] = trim($_GET['order_type']);
     }
     if (trim($_GET['stat_type']) == 'sale') {
         $field = ' sum(order_amount) as allnum ';
     } else {
         $field = ' count(*) as allnum ';
     }
     if (!$_REQUEST['search_type']) {
         $_REQUEST['search_type'] = 'day';
     }
     if (trim($_GET['store_name']) != '') {
         $where['store_name'] = trim($_GET['store_name']);
         $store_name = trim($_GET['store_name']);
     }
     //初始化时间
     //天
     if (!$_REQUEST['search_time']) {
         $_REQUEST['search_time'] = date('Y-m-d', time());
     }
     $search_time = strtotime($_REQUEST['search_time']);
     //搜索的时间
     Tpl::output('search_time', $_REQUEST['search_time']);
     //周
     if (!$_REQUEST['search_time_year']) {
         $_REQUEST['search_time_year'] = date('Y', time());
     }
     if (!$_REQUEST['search_time_month']) {
         $_REQUEST['search_time_month'] = date('m', time());
     }
     if (!$_REQUEST['search_time_week']) {
         $_REQUEST['search_time_week'] = implode('|', getWeek_SdateAndEdate(time()));
     }
     $current_year = $_REQUEST['search_time_year'];
     $current_month = $_REQUEST['search_time_month'];
     $current_week = $_REQUEST['search_time_week'];
     $year_arr = getSystemYearArr();
     $month_arr = getSystemMonthArr();
     $week_arr = getMonthWeekArr($current_year, $current_month);
     Tpl::output('current_year', $current_year);
     Tpl::output('current_month', $current_month);
     Tpl::output('current_week', $current_week);
     Tpl::output('year_arr', $year_arr);
     Tpl::output('month_arr', $month_arr);
     Tpl::output('week_arr', $week_arr);
     $model = Model('stat');
     $statlist = array();
     //统计数据列表
     $sum_num = 0;
     //总数统计
     if ($_REQUEST['search_type'] == 'day') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //统计图数据
             $curr_arr[$i] = 0;
             //今天
             $up_arr[$i] = 0;
             //昨天
             //统计表数据
             $uplist_arr[$i]['timetext'] = $i;
             $currlist_arr[$i]['timetext'] = $i;
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['xAxis']['categories'][] = "{$i}";
         }
         $stime = $search_time - 86400;
         //昨天0点
         $etime = $search_time + 86400 - 1;
         //今天24点
         $today_day = @date('d', $search_time);
         //今天日期
         $yesterday_day = @date('d', $stime);
         //昨天日期
         $where['add_time'] = array('between', array($stime, $etime));
         $field .= ' ,DAY(FROM_UNIXTIME(add_time)) as dayval,HOUR(FROM_UNIXTIME(add_time)) as hourval ';
         $memberlist = $model->getStoreSaleStatList($where, $field, 0, '', 0, 'dayval,hourval');
         if ($memberlist) {
             foreach ($memberlist as $k => $v) {
                 if ($today_day == $v['dayval']) {
                     $curr_arr[$v['hourval']] = intval($v['allnum']);
                     $currlist_arr[$v['hourval']]['val'] = intval($v['allnum']);
                 }
                 if ($yesterday_day == $v['dayval']) {
                     $up_arr[$v['hourval']] = intval($v['allnum']);
                     $uplist_arr[$v['hourval']]['val'] = intval($v['allnum']);
                 }
             }
         } elseif (trim($_GET['store_name']) != '') {
             Tpl::output('data_null', 'yes');
         }
         $stat_arr['series'][0]['name'] = '昨天';
         $stat_arr['series'][0]['data'] = array_values($up_arr);
         $stat_arr['series'][1]['name'] = '今天';
         $stat_arr['series'][1]['data'] = array_values($curr_arr);
         Tpl::output('actionurl', 'index.php?act=stat_trade&op=sale&search_type=day&search_time=' . date('Y-m-d', $search_time));
     }
     if ($_REQUEST['search_type'] == 'week') {
         $current_weekarr = explode('|', $current_week);
         $stime = strtotime($current_weekarr[0]) - 86400 * 7;
         $etime = strtotime($current_weekarr[1]) + 86400 - 1;
         $up_week = @date('W', $stime);
         //上周
         $curr_week = @date('W', $etime);
         //本周
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             //统计图数据
             $up_arr[$i] = 0;
             $curr_arr[$i] = 0;
             $tmp_weekarr = getSystemWeekArr();
             //统计表数据
             $uplist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
             unset($tmp_weekarr);
         }
         $where['add_time'] = array('between', array($stime, $etime));
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(add_time)) as weekval,DAYOFWEEK(FROM_UNIXTIME(add_time)) as dayofweekval ';
         $memberlist = $model->getStoreSaleStatList($where, $field, 0, '', 0, 'weekval,dayofweekval');
         if ($memberlist) {
             foreach ($memberlist as $k => $v) {
                 if ($up_week == $v['weekval']) {
                     $up_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
                 }
                 if ($curr_week == $v['weekval']) {
                     $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
                 }
             }
         } elseif (trim($_GET['store_name']) != '') {
             Tpl::output('data_null', 'yes');
         }
         $stat_arr['series'][0]['name'] = '上周';
         $stat_arr['series'][0]['data'] = array_values($up_arr);
         $stat_arr['series'][1]['name'] = '本周';
         $stat_arr['series'][1]['data'] = array_values($curr_arr);
         Tpl::output('actionurl', 'index.php?act=stat_trade&op=sale&search_type=week&search_time_year=' . $current_year . '&search_time_month=' . $current_month . '&search_time_week=' . $current_week);
     }
     if ($_REQUEST['search_type'] == 'month') {
         $stime = strtotime($current_year . '-' . $current_month . "-01 -1 month");
         $etime = getMonthLastDay($current_year, $current_month) + 86400 - 1;
         $up_month = date('m', $stime);
         $curr_month = date('m', $etime);
         //计算横轴的最大量(由于每个月的天数不同)
         $up_dayofmonth = date('t', $stime);
         $curr_dayofmonth = date('t', $etime);
         $x_max = $up_dayofmonth > $curr_dayofmonth ? $up_dayofmonth : $curr_dayofmonth;
         //构造横轴数据
         for ($i = 1; $i <= $x_max; $i++) {
             //统计图数据
             $up_arr[$i] = 0;
             $curr_arr[$i] = 0;
             //统计表数据
             $uplist_arr[$i]['timetext'] = $i;
             $currlist_arr[$i]['timetext'] = $i;
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['xAxis']['categories'][] = $i;
         }
         $where['add_time'] = array('between', array($stime, $etime));
         $field .= ',MONTH(FROM_UNIXTIME(add_time)) as monthval,day(FROM_UNIXTIME(add_time)) as dayval ';
         $memberlist = $model->getStoreSaleStatList($where, $field, 0, '', 0, 'monthval,dayval');
         if ($memberlist) {
             foreach ($memberlist as $k => $v) {
                 if ($up_month == $v['monthval']) {
                     $up_arr[$v['dayval']] = intval($v['allnum']);
                     $uplist_arr[$v['dayval']]['val'] = intval($v['allnum']);
                 }
                 if ($curr_month == $v['monthval']) {
                     $curr_arr[$v['dayval']] = intval($v['allnum']);
                     $currlist_arr[$v['dayval']]['val'] = intval($v['allnum']);
                 }
             }
         } elseif (trim($_GET['store_name']) != '') {
             Tpl::output('data_null', 'yes');
         }
         $stat_arr['series'][0]['name'] = '上月';
         $stat_arr['series'][0]['data'] = array_values($up_arr);
         $stat_arr['series'][1]['name'] = '本月';
         $stat_arr['series'][1]['data'] = array_values($curr_arr);
         Tpl::output('actionurl', 'index.php?act=stat_trade&op=sale&search_type=month&search_time_year=' . $current_year . '&search_time_month=' . $current_month);
     }
     //统计数据标题
     $statlist['headertitle'] = array('订单号', '买家', '店铺名称', '下单时间', '订单总额', '订单状态');
     //导出Excel
     if ($_GET['exporttype'] == 'excel') {
         //导出Excel
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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);
         }
         $order_all_list = $model->getStoreOrderList($where, false);
         //data
         foreach ($order_all_list 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['add_time']));
             $excel_data[$k + 1][] = array('data' => number_format($v['order_amount'], 2));
             switch ($v['order_state']) {
                 case ORDER_STATE_CANCEL:
                     $excel_data[$k + 1][] = array('data' => '已取消');
                     break;
                 case ORDER_STATE_NEW:
                     $excel_data[$k + 1][] = array('data' => '待付款');
                     break;
                 case ORDER_STATE_PAY:
                     $excel_data[$k + 1][] = array('data' => '待发货');
                     break;
                 case ORDER_STATE_SEND:
                     $excel_data[$k + 1][] = array('data' => '待收货');
                     break;
                 case ORDER_STATE_SUCCESS:
                     $excel_data[$k + 1][] = array('data' => '交易完成');
                     break;
             }
         }
         $excel_data = $excel_obj->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('订单统计', CHARSET));
         $excel_obj->generateXML($excel_obj->charset('订单统计', CHARSET) . date('Y-m-d-H', time()));
         exit;
     } else {
         $order_list = $model->getStoreOrderList($where);
         //得到统计图数据
         if (trim($_GET['stat_type']) == 'sale') {
             $stat_arr['title'] = '订单销售额统计';
             $stat_arr['yAxis'] = '订单销售额';
         } else {
             $stat_arr['title'] = '订单量统计';
             $stat_arr['yAxis'] = '订单量';
         }
         $stat_json = getStatData_LineLabels($stat_arr);
         //总数统计
         $amount = $model->getStoreSaleStatList($where, ' count(*) as allnum ');
         $sale = $model->getStoreSaleStatList($where, ' sum(order_amount) as allnum ');
         Tpl::output('sum_data', array($amount[0]['allnum'], $sale[0]['allnum']));
         Tpl::output('stat_json', $stat_json);
         Tpl::output('statlist', $statlist);
         Tpl::output('order_list', $order_list);
         Tpl::output('show_page', $model->showpage());
         Tpl::output('top_link', $this->sublink($this->links, 'sale'));
         Tpl::showpage('stat.sale');
     }
 }
コード例 #15
0
ファイル: stat_trade.php プロジェクト: ff00x0/shopnc
 /**
  * 订单统计
  */
 public function saleOp()
 {
     $model = Model('stat');
     //存储参数
     $this->search_arr = $_REQUEST;
     //处理搜索时间
     $this->search_arr = $model->dealwithSearchTime($this->search_arr);
     //获得系统年份
     $year_arr = getSystemYearArr();
     //获得系统月份
     $month_arr = getSystemMonthArr();
     //获得本月的周时间段
     $week_arr = 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 = 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
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('订单统计', CHARSET));
         $excel_obj->generateXML($excel_obj->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');
     }
 }
コード例 #16
0
ファイル: stat_member.php プロジェクト: norain2050/xingkang
 /**
  * 区域分析之详细列表
  */
 public function area_listOp()
 {
     $model = Model('stat');
     $where = array();
     $searchtime_arr = explode('|', $this->search_arr['t']);
     $where['add_time'] = array('between', $searchtime_arr);
     //$where['order_state'] = array(array('neq',ORDER_STATE_CANCEL),array('neq',ORDER_STATE_NEW),'and');
     $where['order_state'] = array('neq', ORDER_STATE_NEW);
     //去除未支付订单
     $where['refund_state'] = array('exp', "!(order_state = '" . ORDER_STATE_CANCEL . "' and refund_state = 0)");
     //没有参与退款的取消订单,不记录到统计中
     $where['payment_code'] = array('exp', "!([order].payment_code='offline' and order_state <> '" . ORDER_STATE_SUCCESS . "')");
     //货到付款订单,订单成功之后才计入统计
     $field = ' order_common.reciver_province_id, count(*) as ordernum,sum([order].order_amount) as orderamount, count(DISTINCT [order].buyer_id) as membernum ';
     if (!trim($this->search_arr['orderby'])) {
         $this->search_arr['orderby'] = 'membernum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',order_common.reciver_province_id';
     $count_arr = $model->statByOrderCommon($where, 'count(DISTINCT order_common.reciver_province_id) as countnum');
     $countnum = intval($count_arr[0]['countnum']);
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist_tmp = $model->statByOrderCommon($where, $field, 0, 0, $orderby, 'order_common.reciver_province_id');
     } else {
         $statlist_tmp = $model->statByOrderCommon($where, $field, array(10, $countnum), 0, $orderby, 'order_common.reciver_province_id');
     }
     // 地区
     require_once BASE_DATA_PATH . '/area/area.php';
     $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 = $area_array[$province_id]['area_name']) ? $t : '其他';
         $tmp['membernum'] = $v['membernum'];
         $tmp['orderamount'] = $v['orderamount'];
         $tmp['ordernum'] = $v['ordernum'];
         $statlist[] = $tmp;
     }
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('区域分析', CHARSET));
         $excel_obj->generateXML($excel_obj->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');
 }
コード例 #17
0
ファイル: points.php プロジェクト: noikiy/shopnc-minion
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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(Language::get('admin_points_stage_regist'), Language::get('admin_points_stage_login'), Language::get('admin_points_stage_comments'), Language::get('admin_points_stage_order'), Language::get('admin_points_stage_system'), Language::get('admin_points_stage_pointorder'), Language::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' => 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->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_pi_jfmx'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_pi_jfmx'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #18
0
 /**
  * 店铺动态评分统计
  */
 public function evalstoreOp()
 {
     //店铺分类
     Tpl::output('class_list', 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
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('店铺动态评分统计', CHARSET));
         $excel_obj->generateXML($excel_obj->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');
 }
コード例 #19
0
ファイル: predeposit.php プロジェクト: dw250100785/shopnc
 /**
  * 导出预存款明细excel
  *
  * @param array $data
  */
 private function createmxExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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_money'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_type'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_system'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_stype'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_mshu'));
     $state_cn = array(Language::get('admin_predeposit_log_stage_recharge'), Language::get('admin_predeposit_log_stage_cash'), Language::get('admin_predeposit_log_stage_order'), Language::get('admin_predeposit_log_stage_artificial'), Language::get('admin_predeposit_log_stage_system'));
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['pdlog_membername']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['pdlog_addtime']));
         $tmp[] = array('format' => 'Number', 'data' => ncPriceFormat($v['pdlog_price']));
         $tmp[] = array('data' => $v['pdlog_type'] == 1 ? Language::get('admin_predeposit_pricetype_freeze') : Language::get('admin_predeposit_pricetype_available'));
         $tmp[] = array('data' => $v['pdlog_adminname']);
         $tmp[] = array('data' => str_replace(array('recharge', 'cash', 'order', 'admin', 'system'), $state_cn, $v['pdlog_stage']));
         $tmp[] = array('data' => $v['pdlog_desc']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_mx_rz'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_mx_rz'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #20
0
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset('充值卡', CHARSET));
     $excel_obj->generateXML($excel_obj->charset('充值卡', CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #21
0
ファイル: exppoints.php プロジェクト: noikiy/cunkou
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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' => 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->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset('经验值明细', CHARSET));
     $excel_obj->generateXML($excel_obj->charset('经验值明细', CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #22
0
ファイル: trade.php プロジェクト: noikiy/ecmall
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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_selerid'));
     $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
     $cn_state = array(L('exp_od_sta_qx'), L('exp_od_sta_dfk'), L('exp_od_sta_dqr'), L('exp_od_sta_yfk'), L('exp_od_sta_yfh'), L('exp_od_sta_yjs'), L('exp_od_sta_dsh'), L('exp_od_sta_yqr'));
     foreach ((array) $data as $k => $v) {
         if ($v['order_state'] == 0) {
             $v['order_state'] = '00';
         }
         $v['order_state'] = str_replace(array('00', 10, 11, 20, 30, 40, 50, 60), $cn_state, $v['order_state']);
         $tmp = array();
         $tmp[] = array('data' => $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' => ncPriceFormat($v['order_amount']));
         $tmp[] = array('format' => 'Number', 'data' => ncPriceFormat($v['shipping_fee']));
         $tmp[] = array('data' => $v['payment_name']);
         $tmp[] = array('data' => $v['order_state']);
         $tmp[] = array('data' => $v['store_id']);
         $tmp[] = array('data' => $v['seller_id']);
         $tmp[] = array('data' => $v['buyer_id']);
         $tmp[] = array('data' => $v['buyer_email']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_od_order'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #23
0
ファイル: store.php プロジェクト: noikiy/ecmall
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     $lang = Language::getLangContent();
     Language::read('export');
     $model_grade = Model('store_grade');
     $grade_list = $model_grade->getGradeList();
     if (!empty($grade_list)) {
         $search_grade_list = array();
         foreach ($grade_list as $k => $v) {
             $search_grade_list[$v['sg_id']] = $v['sg_name'];
         }
     }
     //整理内容
     if (!empty($data)) {
         foreach ($data as $k => $v) {
             /**
              * 店铺等级
              */
             $data[$k]['grade_name'] = $search_grade_list[$v['grade_id']];
             /**
              * 店铺状态
              */
             $data[$k]['state'] = $v['store_state'] == 1 ? $lang['open'] : $lang['close'];
             /**
              * 结束时间
              */
             $data[$k]['store_end_time'] = $v['store_end_time'] ? date('Y-m-d', $v['store_end_time']) : $lang['no_limit'];
         }
     }
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_store'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_name'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_sarea'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_grade'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_adtime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_yxq'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_state'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_xarea'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_post'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_st_tel'));
     $state_cn = array(Language::get('admin_points_stage_regist'), Language::get('admin_points_stage_login'), Language::get('admin_points_stage_comments'), Language::get('admin_points_stage_order'), Language::get('admin_points_stage_system'), Language::get('admin_points_stage_pointorder'), Language::get('admin_points_stage_app'));
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['store_name']);
         $tmp[] = array('data' => $v['member_name']);
         $tmp[] = array('data' => $v['area_info']);
         $tmp[] = array('data' => $v['grade_name']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['store_time']));
         $tmp[] = array('data' => $v['store_end_time']);
         $tmp[] = array('data' => str_replace(array(1, 2, 0), array(L('exp_st_kq'), L('exp_st_shz'), L('exp_st_close')), $v['store_state']));
         $tmp[] = array('data' => $v['store_address']);
         $tmp[] = array('data' => $v['store_zip']);
         $tmp[] = array('data' => $v['store_tel']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_store'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_store'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #24
0
ファイル: stat_industry.php プロジェクト: ff00x0/shopnc
 /**
  * 概况总览
  */
 public function general_listOp()
 {
     //获得子分类ID
     $gc_childid = $gc_childarr = array();
     if ($this->choose_gcid > 0) {
         //如果进行了分类搜索,则统计该分类下的子分类
         $gc_childdepth = $this->gc_arr[$this->choose_gcid]['depth'] + 1;
         $gc_childid = explode(',', $this->gc_arr[$this->choose_gcid]['child']);
         if ($gc_childid) {
             foreach ((array) $this->gc_arr as $k => $v) {
                 if (in_array($v['gc_id'], $gc_childid)) {
                     $gc_childarr[$v['gc_id']] = $v;
                 }
             }
         }
     } else {
         //如果没有搜索分类,则默认统计一级分类
         $gc_childdepth = 1;
         foreach ((array) $this->gc_arr as $k => $v) {
             if ($v['depth'] == 1) {
                 $gc_childarr[$v['gc_id']] = $v;
             }
         }
     }
     $statlist = array();
     if ($gc_childarr) {
         $model = Model('stat');
         //查询订单商品信息
         $where = array();
         $where['order_isvalid'] = 1;
         //计入统计的有效订单
         //计算开始时间和结束时间
         $searchtime_arr[1] = strtotime(date('Y-m-d', time())) - 1;
         //昨天23:59点
         $searchtime_arr[0] = $searchtime_arr[1] - 86400 * 30 + 1;
         //从昨天开始30天前
         $where['order_add_time'] = array('between', $searchtime_arr);
         if ($this->choose_gcid > 0) {
             $where['gc_parentid_' . ($gc_childdepth - 1)] = $this->choose_gcid;
         }
         $field = 'gc_parentid_' . $gc_childdepth . ' as statgc_id,COUNT(DISTINCT goods_id) as ordergcount,SUM(goods_num) as ordergnum,SUM(goods_pay_price) as orderamount';
         $ordergoods_list_tmp = $model->statByStatordergoods($where, $field, 0, 0, '', 'statgc_id');
         foreach ((array) $ordergoods_list_tmp as $k => $v) {
             $ordergoods_list[$v['statgc_id']] = $v;
         }
         //查询商品信息
         $field = 'gc_id_' . $gc_childdepth . ' as statgc_id,COUNT(*) as goodscount,AVG(goods_price) as priceavg';
         $goods_list_tmp = $model->statByGoods(array('is_virtual' => 0), $field, 0, 0, '', 'statgc_id');
         foreach ((array) $goods_list_tmp as $k => $v) {
             $goods_list[$v['statgc_id']] = $v;
         }
         //将订单和商品数组合并
         $statlist_tmp = array();
         foreach ($gc_childarr as $k => $v) {
             $tmp = array();
             $tmp['statgc_id'] = $v['gc_id'];
             $tmp['gc_name'] = $v['gc_name'];
             $tmp['ordergcount'] = ($t = $ordergoods_list[$v['gc_id']]['ordergcount']) ? $t : 0;
             $tmp['ordergnum'] = ($t = $ordergoods_list[$v['gc_id']]['ordergnum']) ? $t : 0;
             $tmp['orderamount'] = ($t = $ordergoods_list[$v['gc_id']]['orderamount']) ? $t : 0;
             $tmp['goodscount'] = ($t = $goods_list[$v['gc_id']]['goodscount']) ? $t : 0;
             $tmp['priceavg'] = ncPriceFormat(($t = $goods_list[$v['gc_id']]['priceavg']) ? $t : 0);
             $tmp['unordergcount'] = intval($goods_list[$v['gc_id']]['goodscount']) - intval($ordergoods_list[$v['gc_id']]['ordergcount']);
             //计算无销量商品数
             $statlist_tmp[] = $tmp;
         }
         $statlist = array();
         //整理排序
         $orderby = trim($this->search_arr['orderby']);
         if (!$orderby) {
             $orderby = 'orderamount desc';
         }
         $orderkeys = explode(' ', $orderby);
         $keysvalue = $new_array = array();
         foreach ($statlist_tmp as $k => $v) {
             $keysvalue[$k] = $v[$orderkeys[0]];
         }
         if ($orderkeys[1] == 'asc') {
             asort($keysvalue);
         } else {
             arsort($keysvalue);
         }
         reset($keysvalue);
         foreach ($keysvalue as $k => $v) {
             $statlist[$k] = $statlist_tmp[$k];
         }
         //导出Excel
         if ($this->search_arr['exporttype'] == 'excel') {
             //列表header
             $statheader = array();
             $statheader[] = array('text' => '类目名称', 'key' => 'gc_name');
             $statheader[] = array('text' => '平均价格(元)', 'key' => 'priceavg', 'isorder' => 1);
             $statheader[] = array('text' => '有销量商品数', 'key' => 'ordergcount', 'isorder' => 1);
             $statheader[] = array('text' => '销量', 'key' => 'ordergnum', 'isorder' => 1);
             $statheader[] = array('text' => '销售额(元)', 'key' => 'orderamount', 'isorder' => 1);
             $statheader[] = array('text' => '商品总数', 'key' => 'goodscount', 'isorder' => 1);
             $statheader[] = array('text' => '无销量商品数', 'key' => 'unordergcount', 'isorder' => 1);
             //导出Excel
             import('libraries.excel');
             $excel_obj = new Excel();
             $excel_data = array();
             //设置样式
             $excel_obj->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->charset($excel_data, CHARSET);
             $excel_obj->addArray($excel_data);
             $excel_obj->addWorksheet($excel_obj->charset('行业概况总览', CHARSET));
             $excel_obj->generateXML($excel_obj->charset('行业概况总览', CHARSET) . date('Y-m-d-H', time()));
             exit;
         }
     }
     //列表header
     $statheader = array();
     $statheader[] = array('text' => '类目名称', 'key' => 'gc_name');
     $statheader[] = array('text' => '<span title="类目下所有商品的平均单价" class="tip icon-question-sign"></span>&nbsp;平均价格(元)', 'key' => 'priceavg', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下从昨天开始最近30天有效订单中有销量的商品总数" class="tip icon-question-sign"></span>&nbsp;有销量商品数', 'key' => 'ordergcount', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下从昨天开始最近30天有效订单中商品总售出件数" class="tip icon-question-sign"></span>&nbsp;销量', 'key' => 'ordergnum', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下从昨天开始最近30天有效订单中商品总销售额" class="tip icon-question-sign"></span>&nbsp;销售额(元)', 'key' => 'orderamount', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下所有商品的数量" class="tip icon-question-sign"></span>&nbsp;商品总数', 'key' => 'goodscount', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下从昨天开始最近30天无销量的商品总数" class="tip icon-question-sign"></span>&nbsp;无销量商品数', 'key' => 'unordergcount', 'isorder' => 1);
     Tpl::output('statheader', $statheader);
     Tpl::output('statlist', $statlist);
     Tpl::output('orderby', $orderby);
     Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&choose_gcid=" . $this->choose_gcid);
     Tpl::showpage('stat.listandorder', 'null_layout');
 }
コード例 #25
0
ファイル: stat_store.php プロジェクト: noikiy/ejia
 /**
  * 店铺销售统计列表
  */
 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
         import('libraries.excel');
         $excel_obj = new Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->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->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset('店铺销售统计', CHARSET));
         $excel_obj->generateXML($excel_obj->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');
 }
コード例 #26
0
 /**
  * 下载F码
  */
 public function download_f_code_excelOp()
 {
     $common_id = $_GET['commonid'];
     if ($common_id <= 0) {
         showMessage(L('wrong_argument'), '', '', 'error');
     }
     $common_info = Model('goods')->getGoodeCommonInfoByID($common_id);
     if (empty($common_info) || $common_info['store_id'] != $_SESSION['store_id']) {
         showMessage(L('wrong_argument'), '', '', 'error');
     }
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->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->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset($common_info['goods_name'], CHARSET));
     $excel_obj->generateXML($excel_obj->charset($common_info['goods_name'], CHARSET) . '-' . date('Y-m-d-H', time()));
 }
コード例 #27
0
ファイル: goods.php プロジェクト: dw250100785/shopnc
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Language::read('export');
     import('libraries.excel');
     $excel_obj = new Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_product'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_brand'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_cate'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_price'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_serial'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_state'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_type'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_addtime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_store'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pr_storeid'));
     foreach ((array) $data as $k => $v) {
         if ($v['goods_state'] == 1) {
             $v['goods_show'] = L('exp_pr_wgxj');
         }
         $tmp = array();
         $tmp[] = array('data' => $v['goods_name']);
         $tmp[] = array('data' => $v['brand_name']);
         $tmp[] = array('data' => str_replace('&gt;', '', $v['gc_name']));
         $tmp[] = array('format' => 'Number', 'data' => ncPriceFormat($v['goods_store_price']));
         $tmp[] = array('data' => $v['goods_serial']);
         $tmp[] = array('data' => str_replace(array(1, 0), array(L('exp_pr_sj'), L('exp_pr_xj')), $v['goods_show']));
         $tmp[] = array('data' => str_replace(array(1, 2), array(L('exp_pr_new'), L('exp_pr_old')), $v['goods_form']));
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['goods_add_time']));
         $tmp[] = array('data' => $v['store_name']);
         $tmp[] = array('data' => $v['store_id']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->charset($excel_data, CHARSET);
     $excel_obj->addArray($excel_data);
     $excel_obj->addWorksheet($excel_obj->charset(L('exp_product'), CHARSET));
     $excel_obj->generateXML($excel_obj->charset(L('exp_product'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }