public function export() { $map = array(); $voList = array(); $map = $this->searchMap(); $map['post_goods.isCheckOut'] = array('eq', '1'); $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\n"; $ContentStr = ''; /*start of second line*/ foreach ($voList as $vo) { $ContentStr .= $vo['termName'] . "\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 .= $vo['magazineName'] . "\t"; $ContentStr .= $vo['sendNum'] . "\t"; $ContentStr .= get_employee_name($vo['postPeople']) . "\t"; $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t"; if ($vo['isPrintCheckOut']) { $ContentStr .= "是\t"; } else { $ContentStr .= "否\t"; } $ContentStr .= $vo['checkOutNum'] . "\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(); $searchStr = ''; $voList = array(); if (method_exists($this, 'searchMap')) { $this->searchMap($map, $searchStr); } if (method_exists($this, 'listFilter')) { $this->listFilter($map); } $Custom = D('Custom'); if (!empty($Custom)) { $voList = $this->exportList($Custom, $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"; $HeaderStr .= "发货周期" . "\t"; $HeaderStr .= "包装方式" . "\t"; $HeaderStr .= "收货人单位" . "\t"; $HeaderStr .= "是否学校" . "\t"; $HeaderStr .= "班级" . "\t"; $HeaderStr .= "备注" . "\t\n"; $ContentStr = ''; /* start of second line */ foreach ($voList as $vo) { $ContentStr .= $vo['customName'] . "\t"; $ContentStr .= $vo['customUnitName'] . "\t"; $ContentStr .= $vo['telphone1'] . "\t"; $ContentStr .= $vo['fax'] . "\t"; $ContentStr .= $vo['employeeName'] . "\t"; $ContentStr .= $vo['provinceName'] . "\t"; $ContentStr .= $vo['cityName'] . "\t"; if ($vo['isOldCustom']) { $ContentStr .= "是\t"; } else { $ContentStr .= "否\t"; } $ContentStr .= $vo['address'] . "\t"; $ContentStr .= $vo['recName'] . "\t"; $ContentStr .= $vo['phone'] . "\t"; $ContentStr .= $vo['fax'] . "\t"; $ContentStr .= $vo['provinceName'] . "\t"; $ContentStr .= $vo['recCityName'] . "\t"; $ContentStr .= $vo['recAddress'] . "\t"; $ContentStr .= $vo['postCode'] . "\t"; $ContentStr .= $vo['sendGoodsSortName'] . "\t"; $ContentStr .= $vo['sendOrderCyleName'] . "\t"; $ContentStr .= $vo['packetType'] . "\t"; $ContentStr .= get_custom_unit_name($vo['schoolID']) . "\t"; if ($vo['isSchool']) { $ContentStr .= "是\t"; } else { $ContentStr .= "否\t"; } $ContentStr .= $vo['className'] . "\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() { $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('没有数据!'); } } }
function export() { $map = $this->_search(); if (method_exists($this, '_filter')) { $this->_filter($map); } $EmployeeNewspaper = D('EmployeeNewspaper'); $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]); $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId); $MagazinePostCodes; foreach ($MagazineList as $vo) { $MagazinePostCodes .= $vo['postCode'] . ','; } $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1); if ($MagazinePostCodes) { $map['postCode'] = array('in', $MagazinePostCodes); } if (method_exists($this, '_filter')) { $this->_filter($map); } $model = D('OrderBase'); if (!empty($model)) { $count = $model->where($map)->count('id'); if ($count > 0) { import("ORG.Util.Page"); $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]); $EmployeeNewspaper = D('EmployeeNewspaper'); $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId); $MagazinePostCodes; foreach ($MagazineList as $vo) { $MagazinePostCodes .= $vo['postCode'] . ','; } $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1); if ($MagazinePostCodes) { $map['postCode'] = array('in', $MagazinePostCodes); } //创建分页对象 if (!empty($_REQUEST['listRows'])) { $listRows = $_REQUEST['listRows']; } else { $listRows = ''; } $p = new Page($count, $listRows); //分页查询数据 $order = 'insertTime desc, employeeID desc, recPeople desc, postCode 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"; $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 .= $vo['batch'] . "\t"; $ContentStr .= get_employee_name($vo['employeeID']) . "\t"; $ContentStr .= get_custom_name($vo['customID']) . "\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['recFax'] . "\t"; $ContentStr .= $vo['recSpareTel'] . "\t"; $ContentStr .= $vo['recAddress'] . "\t"; $ContentStr .= $vo['zipCode'] . "\t"; $ContentStr .= get_magazine_name($vo['postCode']) . "\t"; $ContentStr .= $vo['orderNum'] . "\t"; $ContentStr .= $vo['beginOrderDate'] . "\t"; $ContentStr .= $vo['endOrderDate'] . "\t"; $ContentStr .= $vo['tapeNum'] . "\t"; $ContentStr .= $vo['answerNum'] . "\t"; $ContentStr .= $vo['weakCity'] . "\t"; $ContentStr .= get_send_goods_sort_name($vo['sendGoodsSortID']) . "\t"; $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t"; $ContentStr .= get_send_order_cyle_name($vo['sendCyleID']) . "\t"; $ContentStr .= $vo['memo'] . "\t"; $ContentStr .= $vo['payPerson'] . "\t"; $ContentStr .= date('Y-m-d H:i:s', $vo['insertTime']) . "\t"; $ContentStr .= date('Y-m-d H:i:s', $vo['commitTime']) . "\t"; if ($vo['isChecked'] == 1) { $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('没有数据!'); } } }
function export() { $BeginDateTemp = ''; $EndDateTemp = ''; $SearchStr; $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']); } $EmployeeNewspaper = D('EmployeeNewspaper'); $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]); $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId); $MagazinePostCodes; foreach ($MagazineList as $vo) { $MagazinePostCodes .= $vo['postCode'] . ','; } $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1); if ($MagazinePostCodes) { $map['postCode'] = array('in', $MagazinePostCodes); } 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); } } } if (method_exists($this, '_filter')) { $this->_filter($map); } $model = D('OrderBase'); if (!empty($model)) { $count = $model->where($map)->count('id'); if ($count > 0) { import("ORG.Util.Page"); $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]); $EmployeeNewspaper = D('EmployeeNewspaper'); $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId); $MagazinePostCodes; foreach ($MagazineList as $vo) { $MagazinePostCodes .= $vo['postCode'] . ','; } $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1); if ($MagazinePostCodes) { $map['postCode'] = array('in', $MagazinePostCodes); } $order = 'insertTime desc, employeeID desc, recPeople desc, postCode 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\n"; $ContentStr = ''; /*start of second line*/ foreach ($voList as $vo) { $ContentStr .= date('Y-m-d', $vo['orderTime']) . "\t"; $ContentStr .= $vo['batch'] . "\t"; $ContentStr .= get_employee_name($vo['employeeID']) . "\t"; $ContentStr .= get_custom_name($vo['customID']) . "\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['orderNum'] . "\t"; $ContentStr .= $vo['beginOrderDate'] . "\t"; $ContentStr .= $vo['endOrderDate'] . "\t"; $ContentStr .= get_send_goods_sort_name($vo['sendGoodsSortID']) . "\t"; $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t"; $ContentStr .= get_send_order_cyle_name($vo['sendCyleID']) . "\t"; $ContentStr .= $vo['payPerson'] . "\t"; if ($vo['isSend']) { $ContentStr .= "是\t"; } else { $ContentStr .= "否\t"; } if ($vo['sendTime']) { $ContentStr .= date('Y-m-d', $vo['sendTime']) . "\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('没有数据!'); } } }