public function action_pinlun() { $orderid = $this->params['orderid']; $model = new Model_Member_Order(); $order = $model->getOrderDetail($orderid); $this->assign('order', $order); $this->display('user/order_writepl'); }
public function action_genexcel() { $typeid = $this->params['typeid']; $timetype = $this->params['timetype']; $starttime = strtotime(Arr::get($_GET, 'starttime')); $endtime = strtotime(Arr::get($_GET, 'endtime')); $status = $_GET['status']; switch ($timetype) { case 1: $time_arr = $this->getTimeRange(1); break; case 2: $time_arr = $this->getTimeRange(2); break; case 3: $time_arr = $this->getTimeRange(3); break; case 5: $time_arr = $this->getTimeRange(5); break; case 6: $time_arr = array($starttime, $endtime); break; } $stime = date('Y-m-d', $time_arr[0]); $etime = date('Y-m-d', $time_arr[1]); $w = "addtime>={$time_arr['0']} and addtime<={$time_arr['1']} and typeid='{$typeid}'"; if ($status !== null && $status !== '') { $w .= " and status={$status}"; } $arr = ORM::factory('member_order')->where($w)->get_all(); $table = "<table><tr>"; $table .= "<td>订单号</td>"; $table .= "<td>产品名称</td>"; $table .= "<td>预订日期</td>"; $table .= "<td>使用日期</td>"; $table .= "<td>成人数量</td>"; $table .= "<td>成人价格</td>"; if ($typeid == 1) { $table .= "<td>儿童数量</td>"; $table .= "<td>儿童价格</td>"; $table .= "<td>老人数量</td>"; $table .= "<td>老人价格</td>"; $table .= "<td>保险</td>"; } $table .= "<td>应付总额</td>"; $table .= "<td>交易状态</td>"; $table .= "<td>预订人</td>"; $table .= "<td>联系电话</td>"; $table .= "<td>使用日期</td>"; $table .= "</tr>"; foreach ($arr as $row) { $order = $row; $price = 0; $insurancePrice = 0; if ($order['typeid'] != 2) { $price = intval($order['dingnum']) * $order['price'] + intval($order['childnum']) * $order['childprice'] + intval($order['oldnum']) * $order['oldprice']; if (!empty($order['usejifen']) && !empty($order['jifentprice'])) { $price = $price - intval($order['jifentprice']); //减去积分抵现的价格. } } else { $orderlist = ORM::factory('member_order')->where('pid', '=', $row['id'])->get_all(); $price = 0; $totalnum = 0; foreach ($orderlist as $subrow) { $price += intval($subrow['dingnum']) * intval($subrow['price']); $totalnum += $subrow['dingnum']; } } if ($order['typeid'] == 1) { $insInfo = ORM::factory('insurance_booking')->where("bookordersn", '=', $order['ordersn'])->find()->as_array(); if ($insInfo['payprice']) { $price += $insInfo['payprice']; $insurancePrice = $insInfo['payprice']; } } $childOrderLabel = $row['pid'] == 0 ? '' : "[子订单]"; $table .= "<tr>"; $table .= "<td>" . $childOrderLabel . "{$row['ordersn']}</td>"; $table .= "<td>{$row['productname']}</td>"; $table .= "<td>" . Common::myDate('Y-m-d H:i:s', $row['addtime']) . "</td>"; $table .= "<td>{$row['usedate']}</td>"; $table .= "<td>{$row['dingnum']}</td>"; $table .= "<td>{$row['price']}</td>"; if ($typeid == 1) { $table .= "<td>{$row['childnum']}</td>"; $table .= "<td>{$row['childprice']}</td>"; $table .= "<td>{$row['oldnum']}</td>"; $table .= "<td>{$row['oldprice']}</td>"; $table .= "<td>{$insurancePrice}</td>"; } $table .= "<td>{$price}</td>"; $table .= "<td>" . Model_Member_Order::getStatusName($row['status']) . "</td>"; $table .= "<td>{$row['linkman']}</td>"; $table .= "<td>{$row['linktel']}</td>"; $table .= "<td>{$row['usedate']}</td>"; $table .= "</tr>"; } $table .= "</table>"; $filename = date('Ymdhis'); header('Pragma:public'); header('Expires:0'); header('Content-Type:charset=utf-8'); header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); header('Content-Type:application/force-download'); header('Content-Type:application/vnd.ms-excel'); header('Content-Type:application/octet-stream'); header('Content-Type:application/download'); header('Content-Disposition:attachment;filename=' . $filename . ".xls"); header('Content-Transfer-Encoding:binary'); //define("FILETYPE","xls"); //header("Content-type:application/vnd.ms-excel"); //header('Content-type: charset=GBK'); //header('Pragma: no-cache'); //header('Expires: 0'); //header("Content-Disposition:filename=".$info['name'].".xls"); //$str = iconv("UTF-8//IGNORE","GBK//IGNORE",$str); if (empty($arr)) { echo iconv('utf-8', 'gbk', $table); } else { echo $table; } exit; }
public function action_queryorder() { $mobile = Common::pregReplace(Arr::get($_POST, 'mobile'), 2); if (empty($mobile)) { Common::showMsg('请填写手机号进行查询', -1); } $model = new Model_Member_Order(); $order = $model->getOrderListByMobile($mobile); $this->assign('orderlist', $order); $this->display('public/query_order'); }