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


PHP Excel::addArray方法代码示例

本文整理汇总了PHP中Excel::addArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Excel::addArray方法的具体用法?PHP Excel::addArray怎么用?PHP Excel::addArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Excel的用法示例。


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

示例1: exportFile

 /**
  * 导出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;
 }
开发者ID:song-yuan,项目名称:wymenujp,代码行数:14,代码来源:Until.php

示例2: area_listOp

 /**
  * 区域分析之详细列表
  */
 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');
 }
开发者ID:noikiy,项目名称:cunkou,代码行数:76,代码来源:stat_member.php

示例3: createExcel

 /**
  * 生成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()));
 }
开发者ID:dw250100785,项目名称:shopnc,代码行数:50,代码来源:member.php

示例4: createExcel

 /**
  * 生成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()));
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:46,代码来源:order.php

示例5: createExcel

 /**
  * 生成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()));
 }
开发者ID:Maplecms,项目名称:shopnc-yhmall,代码行数:27,代码来源:spec.php

示例6: goods_saleOp

 /**
  * 商品销售明细
  */
 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');
     }
 }
开发者ID:xuxuecheng,项目名称:shopnc,代码行数:88,代码来源:stat_goods.php

示例7: groupgoodsOp

 /**
  * 团购商品统计
  */
 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');
     }
 }
开发者ID:noikiy,项目名称:haifenbao,代码行数:83,代码来源:stat_marketing.php

示例8: createmxExcel

 /**
  * 导出预存款明细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()));
 }
开发者ID:flying3615,项目名称:chuniang,代码行数:43,代码来源:predeposit.php

示例9: showstoreOp

 /**
  * 查看店铺列表
  */
 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');
 }
开发者ID:norain2050,项目名称:xingkang,代码行数:64,代码来源:stat_store.php

示例10: salelistOp

	/**
	 * 订单列表
	 */
	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');
	}
开发者ID:noikiy,项目名称:ejia,代码行数:80,代码来源:statistics_sale.php

示例11: createLogExcel

 /**
  * 生成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()));
 }
开发者ID:dw250100785,项目名称:shopnc,代码行数:48,代码来源:gold_buy.php

示例12: elseif

        sys_msg($_LANG['batch_upload_ok'], 0, $link);
    }
    // 记录日志
    $smarty->assign('ct_id', $ct_id);
    $smarty->display('user_card_batch_add.htm');
} elseif ($_REQUEST['act'] == 'export') {
    set_time_limit(0);
    $ct_id = intval($_REQUEST['ct_id']);
    if (empty($ct_id)) {
        sys_msg('请选择发卡的卡类型', 1);
    }
    $ct_info = $db->getRow("select * from " . $ecs->table('user_card_type') . " where ct_id='{$ct_id}' ");
    $smarty->assign('ct_info', $ct_info);
    require_once ROOT_PATH . 'includes/cls_excel.php';
    $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;
开发者ID:nanhuacrab,项目名称:ecshop,代码行数:31,代码来源:user_card.php

示例13: createExcel

 /**
  * 生成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()));
 }
开发者ID:noikiy,项目名称:haifenbao,代码行数:34,代码来源:shipping_fee.php

示例14: saleOp


//.........这里部分代码省略.........
             $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');
     }
 }
开发者ID:Maplecms,项目名称:shopnc-yhmall,代码行数:101,代码来源:stat_trade.php

示例15: saleOp


//.........这里部分代码省略.........
     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');
     }
 }
开发者ID:ff00x0,项目名称:shopnc,代码行数:101,代码来源:stat_trade.php


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