示例#1
0
 public function export()
 {
     $map = array();
     $searchStr = '';
     $voList = array();
     $this->indexSearch($map, $searchStr);
     if (method_exists($this, 'listFilter')) {
         $this->listFilter($map);
     }
     $OrderBase = D('OrderBase');
     if (!empty($OrderBase)) {
         $voList = $this->exportList($OrderBase, $map);
     }
     if ($voList) {
         $FileName = date('Y-m-d') . "缺货登记.xls";
         $FileName = iconv("UTF-8", "GBK", $FileName);
         header("Content-Type: application/vnd.ms-execl");
         header("Content-Disposition: attachment; filename= {$FileName}");
         header("Pragma: no-cache");
         header("Expires: 0");
         /*first line*/
         $HeaderStr = "期数" . "\t";
         $HeaderStr .= "收货人" . "\t";
         $HeaderStr .= "电话" . "\t";
         $HeaderStr .= "地址" . "\t";
         $HeaderStr .= "省份" . "\t";
         $HeaderStr .= "城市" . "\t";
         $HeaderStr .= "报刊名称" . "\t";
         $HeaderStr .= "份数" . "\t";
         $HeaderStr .= "起期" . "\t";
         $HeaderStr .= "止期" . "\t";
         $HeaderStr .= "发行人" . "\t";
         $HeaderStr .= "发货方式" . "\t";
         $HeaderStr .= "单号" . "\t";
         $HeaderStr .= "缺货份数" . "\t";
         $HeaderStr .= "登记人" . "\t";
         $HeaderStr .= "登记日期" . "\t";
         $HeaderStr .= "备注" . "\t\n";
         $ContentStr = '';
         /*start of second line*/
         foreach ($voList as $vo) {
             $ContentStr .= get_magazine_terrm_name($vo['termID']) . "\t";
             $ContentStr .= $vo['recPeople'] . "\t";
             $ContentStr .= $vo['recTelphone'] . "\t";
             $ContentStr .= $vo['recAddress'] . "\t";
             $ContentStr .= get_province_name($vo['provinceID']) . "\t";
             $ContentStr .= $vo['cityName'] . "\t";
             $ContentStr .= get_magazine_name($vo['postCode']) . "\t";
             $ContentStr .= $vo['quantity'] . "\t";
             $ContentStr .= get_magazine_terrm_name($vo['beginTermID']) . "\t";
             $ContentStr .= get_magazine_terrm_name($vo['endTermID']) . "\t";
             $ContentStr .= get_employee_name($vo['postPeople']) . "\t";
             $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
             $ContentStr .= $vo['sendGoodsID'] . "\t";
             $ContentStr .= $vo['renewQuantity'] . "\t";
             $ContentStr .= get_employee_name($vo['employeeID']) . "\t";
             $ContentStr .= date('Y-m-d', $vo['insertDate']) . "\t";
             $ContentStr .= $vo['memo'] . "\t\n";
         }
         $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
         $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
         echo $HeaderStr . $ContentStr;
         exit;
     } else {
         $this->error('没有数据!');
     }
 }
示例#2
0
 public function export()
 {
     $BeginDateTemp = '';
     $EndDateTemp = '';
     $map = $this->_search();
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     if ($_REQUEST['beginTime']) {
         $BeginDateTemp = strtotime($_REQUEST['beginTime']);
     }
     if ($_REQUEST['endTime']) {
         $EndDateTemp = strtotime($_REQUEST['endTime']);
     }
     if ($BeginDateTemp || $EndDateTemp) {
         if ($BeginDateTemp && $EndDateTemp) {
             $map['orderTime'] = array('between', "{$BeginDateTemp}, {$EndDateTemp}");
         } else {
             if ($BeginDateTemp) {
                 $map['orderTime'] = array('egt', $BeginDateTemp);
             } else {
                 $map['orderTime'] = array('elt', $EndDateTemp);
             }
         }
     }
     $model = D('OrderBase');
     if (!empty($model)) {
         /* 查询自己的信息 */
         $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
         $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]);
         if ($roleEname != 'admin') {
             $map['employeeID'] = $EmployeeId;
         }
         $count = $model->where($map)->count('id');
         if ($count > 0) {
             import("ORG.Util.Page");
             $order = 'isChecked asc, insertTime desc';
             $voList = $model->where($map)->order($order)->select();
             $FileName = date('Y-m-d') . "订单数据.xls";
             $FileName = iconv("UTF-8", "GBK", $FileName);
             header("Content-Type: application/vnd.ms-execl");
             header("Content-Disposition: attachment; filename= {$FileName}");
             header("Pragma: no-cache");
             header("Expires: 0");
             /*first line*/
             $HeaderStr = "日期" . "\t";
             $HeaderStr .= "客户" . "\t";
             $HeaderStr .= "批次" . "\t";
             $HeaderStr .= "收货人" . "\t";
             $HeaderStr .= "手机" . "\t";
             $HeaderStr .= "地址" . "\t";
             $HeaderStr .= "报刊分类" . "\t";
             $HeaderStr .= "报刊" . "\t";
             $HeaderStr .= "份数" . "\t";
             $HeaderStr .= "起月" . "\t";
             $HeaderStr .= "止月" . "\t";
             $HeaderStr .= "付款方式" . "\t";
             $HeaderStr .= "发货周期" . "\t";
             $HeaderStr .= "发货类型" . "\t";
             $HeaderStr .= "发货方式" . "\t";
             $HeaderStr .= "邮编" . "\t";
             $HeaderStr .= "省份" . "\t";
             $HeaderStr .= "城市" . "\t";
             $HeaderStr .= "单位" . "\t";
             $HeaderStr .= "班级" . "\t";
             $HeaderStr .= "付款人" . "\t";
             $HeaderStr .= "是否单期" . "\t";
             $HeaderStr .= "期数名称" . "\t";
             $HeaderStr .= "是否审核" . "\t";
             $HeaderStr .= "备注" . "\t\n";
             $ContentStr = '';
             /*start of second line*/
             foreach ($voList as $vo) {
                 $ContentStr .= date('Y-m-d', $vo['orderTime']) . "\t";
                 $ContentStr .= get_custom_name($vo['customID']) . "\t";
                 $ContentStr .= $vo['batch'] . "\t";
                 $ContentStr .= $vo['recPeople'] . "\t";
                 $ContentStr .= $vo['recTelphone'] . "\t";
                 $ContentStr .= $vo['recAddress'] . "\t";
                 $ContentStr .= get_magazine_type_name_by_postcode($vo['postCode']) . "\t";
                 $ContentStr .= get_magazine_name($vo['postCode']) . "\t";
                 $ContentStr .= $vo['orderNum'] . "\t";
                 $ContentStr .= $vo['beginOrderDate'] . "\t";
                 $ContentStr .= $vo['endOrderDate'] . "\t";
                 $ContentStr .= get_pay_type_name($vo['payType']) . "\t";
                 $ContentStr .= get_pay_type_name($vo['payType']) . "\t";
                 $ContentStr .= get_send_order_cyle_name($vo['sendCyleID']) . "\t";
                 $ContentStr .= get_send_goods_sort_name($vo['sendGoodsSortID']) . "\t";
                 $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
                 $ContentStr .= $vo['zipCode'] . "\t";
                 $ContentStr .= $vo['cityName'] . "\t";
                 $ContentStr .= get_custom_unit_name($vo['schoolID']) . "\t";
                 $ContentStr .= $vo['class'] . "\t";
                 $ContentStr .= $vo['payPerson'] . "\t";
                 if ($vo['isSingle'] == 1) {
                     $ContentStr .= "是\t";
                 } else {
                     $ContentStr .= "否\t";
                 }
                 if ($vo['isSingle'] == 1) {
                     $ContentStr .= get_magazine_terrm_name($vo['termID']) . "\t";
                 } else {
                     $ContentStr .= "\t";
                 }
                 if ($vo['isChecked'] == 2) {
                     $ContentStr .= "未提交\t";
                 } else {
                     if ($vo['isChecked'] == 1) {
                         $ContentStr .= "已审核\t";
                     } else {
                         if ($vo['isChecked'] == 0) {
                             $ContentStr .= "未审核\t";
                         }
                     }
                 }
                 $ContentStr .= $vo['memo'] . "\t\n";
             }
             $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
             $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
             echo $HeaderStr . $ContentStr;
             exit;
         } else {
             //错误提示
             $this->error('没有数据!');
         }
     }
 }
 public function export()
 {
     $map = array();
     $voList = array();
     $map = $this->searchMap();
     $model = D('OrderBase');
     if (!empty($model)) {
         $voList = $this->exportList($model, $map);
     }
     if ($voList) {
         $FileName = date('Y-m-d') . "订单分配.xls";
         $FileName = iconv("UTF-8", "GBK", $FileName);
         header("Content-Type: application/vnd.ms-execl");
         header("Content-Disposition: attachment; filename= {$FileName}");
         header("Pragma: no-cache");
         header("Expires: 0");
         /*first line*/
         $HeaderStr = "期数" . "\t";
         $HeaderStr .= "批次" . "\t";
         $HeaderStr .= "月份" . "\t";
         $HeaderStr .= "收货人" . "\t";
         $HeaderStr .= "省份" . "\t";
         $HeaderStr .= "城市" . "\t";
         $HeaderStr .= "单位" . "\t";
         $HeaderStr .= "班级" . "\t";
         $HeaderStr .= "电话" . "\t";
         $HeaderStr .= "地址" . "\t";
         $HeaderStr .= "报刊名称" . "\t";
         $HeaderStr .= "份数" . "\t";
         $HeaderStr .= "起期" . "\t";
         $HeaderStr .= "止期" . "\t";
         $HeaderStr .= "发行人" . "\t";
         $HeaderStr .= "发货方式" . "\t";
         $HeaderStr .= "是否分配" . "\t\n";
         $ContentStr = '';
         /*start of second line*/
         foreach ($voList as $vo) {
             $ContentStr .= get_magazine_terrm_name($vo['termID']) . "\t";
             $ContentStr .= $vo['batch'] . "\t";
             $ContentStr .= $vo['termMonth'] . "\t";
             $ContentStr .= $vo['recPeople'] . "\t";
             $ContentStr .= get_province_name($vo['provinceID']) . "\t";
             $ContentStr .= $vo['cityName'] . "\t";
             $ContentStr .= get_custom_unit_name($vo['schoolID']) . "\t";
             $ContentStr .= $vo['class'] . "\t";
             $ContentStr .= $vo['recTelphone'] . "\t";
             $ContentStr .= $vo['recAddress'] . "\t";
             $ContentStr .= get_magazine_name($vo['postCode']) . "\t";
             $ContentStr .= $vo['quantity'] . "\t";
             $ContentStr .= get_magazine_terrm_name($vo['beginTermID']) . "\t";
             $ContentStr .= get_magazine_terrm_name($vo['endTermID']) . "\t";
             $ContentStr .= get_employee_name($vo['postPeople']) . "\t";
             $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
             if ($vo['isCheckOut']) {
                 $ContentStr .= "是\t\n";
             } else {
                 $ContentStr .= "否\t\n";
             }
         }
         $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
         $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
         echo $HeaderStr . $ContentStr;
         exit;
     } else {
         $this->error('没有数据!');
     }
 }