コード例 #1
0
 public function doUpdate()
 {
     $projectService = new ProjectService();
     $projectlist = $projectService->getList(new ProjectValue());
     $projectId = intval(Request::get("update_project_id"));
     $projectVo = $projectService->getByPrimary($projectId);
     View::set("Projectlist", $projectlist);
     View::set("ProjectUpdateValue", $projectVo);
     View::display("Update");
 }
コード例 #2
0
 public function doExport()
 {
     // create a simple 2-dimensional array
     if (Request::get('type') == 'time') {
         $ordersService = new OrdersService();
         $userCondition = new UserValue();
         $userService = new UserService();
         $ordersCondition = new OrdersValue();
         $userlist = $userService->getlist($userCondition);
         //get project
         $projectCondition = new ProjectValue();
         $projectService = new ProjectService();
         $projectlist = $projectService->getList($projectCondition);
         //按时间范围搜索
         $start = Request::get('start');
         $end = Request::get('end');
         $orderListModel = '所有派单';
         if ($start != '' and $end != '') {
             $ordersCondition->addAddtimeCondition($start, Value::GREATER_EQUAL);
             $ordersCondition->addAddtimeCondition($end, Value::LESS_EQUAL);
             $orderListModel = '从' . $start . ' 到 ' . $end . '的派单';
         } elseif ($end == '' and $start != '') {
             $ordersCondition->addAddtimeCondition($end, Value::LESS_EQUAL);
             $orderListModel = '从' . $start . ' 到 今天 的派单';
         }
         $ordersCondition->addCondition('1=1 ORDER BY `order_id` DESC');
         $ordersList = $ordersService->getList($ordersCondition, $listPageHelper);
         $areaService = new AreaService();
         $arealist = $areaService->getList(new AreaValue());
         $array_top = array();
         $array_top = array(Language::get("ORDERS.ADDTIME.LABEL"), Language::get("ORDERS.CUSTOMER_NAME.LABEL"), Language::get("ORDERS.CUSTOMER_ADDRESS.LABEL"), Language::get("ORDERS.PROJECT_ID.LABEL"), Language::get("ORDERS.HIS.LABEL"), Language::get("ORDERS.OPERATE_STATUS.LABEL"), Language::get("ORDERS.CONTACT_STATUS.LABEL"), Language::get("ORDERS.USER_ID.LABEL"), Language::get("ORDERS.INFO.LABEL"));
         $data[] = $array_top;
         if (count($ordersList) > 0) {
             foreach ($ordersList as $k => $v) {
                 if (count($projectlist) > 0) {
                     foreach ($projectlist as $project) {
                         if ($v->project_id == $project->project_id) {
                             $project = $project->project_name;
                             break;
                         }
                     }
                 }
                 switch ($v->operate_status) {
                     case Value::OPERATE_STATUS_NOT_OPERATE:
                         $operate_status = '未成交';
                         break;
                     case Value::OPERATE_STATUS_OPERATED:
                         $operate_status = '已成交';
                         break;
                 }
                 switch ($v->contact_status) {
                     case Value::CONTACT_STATUS_CANNOT_CONTACT:
                         $contact_status = '无法联系';
                         break;
                     case Value::CONTACT_STATUS_CONTACTED:
                         $contact_status = '已联系';
                         break;
                     case Value::CONTACT_STATUS_NOT_CONTACT:
                         $contact_status = '未联系';
                         break;
                 }
                 if (count($userlist) > 0) {
                     foreach ($userlist as $outUser) {
                         if ($v->user_id == $outUser->user_id) {
                             $user = $outUser->realname;
                             break;
                         }
                     }
                 }
                 $data[] = array($v->addtime, $v->customer_name, $v->customer_address, $project, $v->HIS, $operate_status, $contact_status, $user, $v->info);
             }
         }
         // generate file (constructor parameters are optional)
         $xls = new Excel_XML('UTF-8', false, $orderListModel);
         $xls->addArray($data);
         $xls->generateXML('paidan');
     } else {
         View::display('Export');
     }
 }