示例#1
0
 public function actionPaperBus($id)
 {
     $model = PaperApprovalBus::model()->find(array('condition' => 'paper_approval_bus_id = :paper_id', 'params' => array(':paper_id' => $id)));
     if (empty($model)) {
         throw new CHttpException(403, 'ไม่มีข้อมูข กรุณาลองใหม่อีกครั้ง');
     }
     $this->render('paper_bus', array('model' => $model));
 }
示例#2
0
 protected function loadModel($id)
 {
     $model = PaperApprovalBus::model()->findByPk($id);
     if (empty($model)) {
         throw new CHttpException(404, 'ผิดพลาดในการดึงข้อมูล ออกมาแสดงผล ลองใหม่อีกครั้ง');
     }
     return $model;
 }
 protected function loadModel($id)
 {
     $model = PaperApprovalBus::model()->findByPk($id);
     if (empty($model)) {
         throw new CHttpException('403', 'ไม่มีข้อมูลที่คุณต้องการ กรุณาลองใหม่อีกครั้ง');
     }
     return $model;
 }
示例#4
0
 public static function paperBus()
 {
     $now = strtotime(date('Y-m-d H:i:s'));
     $model = PaperApprovalBus::model()->findAll(array('condition' => 'status < 4'));
     if (!empty($model)) {
         foreach ($model as $paper) {
             if ($now >= strtotime($paper->date_start . ' ' . $paper->date_end)) {
                 $paper->status = 7;
                 $accept = $paper->accept;
                 $accept->status = 5;
                 if ($accept->save()) {
                     $paper->save();
                 }
             }
         }
     }
 }
 public function actionIndex()
 {
     $evens = array();
     $model = PaperApproval::model()->acceptPaper()->findAll();
     foreach ($model as $m) {
         if ($m->paperDetailAccept->car != null) {
             array_push($evens, array('title' => 'ทะเบียนรถ : ' . $m->paperDetailAccept->car->license_no, 'start' => $m->departure_time, 'end' => $m->back_time));
         }
     }
     $modelBus = PaperApprovalBus::model()->acceptPaper()->findAll();
     foreach ($modelBus as $ms) {
         if ($ms->paperDetailBusAccept->car != null) {
             array_push($evens, array('title' => 'ทะเบียนรถ : ' . $ms->paperDetailBusAccept->car->license_no, 'start' => $ms->date_start, 'end' => $ms->date_end));
         }
     }
     //        echo '<pre>';
     //        print_r($evens);die;
     $this->calendar_evens = json_encode($evens);
     $this->render('index', array());
 }
 public function actionExcel()
 {
     $model = new SearchMonth('search');
     $statusPaperList = '';
     if (isset($_POST['SearchMonth'])) {
         $criteria = new CDbCriteria();
         $criteria->with = array('member', 'place');
         $criteria->scopes = array('get_desc');
         $model->attributes = $_POST['SearchMonth'];
         if ($model->month != null) {
             $dateStart = 1;
             $dateEnd = cal_days_in_month(CAL_GREGORIAN, $model->month, $model->year);
             // จำนวนวันของเดือน นั้นของปี
             $timeStart = '00:00:00';
             $timeEnd = '23:59:59';
             $start = "{$model->year}-{$model->month}-{$dateStart} {$timeStart}";
             $end = "{$model->year}-{$model->month}-{$dateEnd} {$timeEnd}";
             $criteria->addBetweenCondition('t.create_at', $start, $end);
         } else {
             $timeStart = '00:00:00';
             $timeEnd = '23:59:59';
             $start = "{$model->year}-1-1 {$timeStart}";
             $end = "{$model->year}-12-31} {$timeEnd}";
             $criteria->addBetweenCondition('t.create_at', $start, $end);
         }
         if ($model->status == null) {
             $criteria->addCondition('t.status = 4 or t.status = 5');
         } else {
             $criteria->addCondition("t.status = {$model->status}");
         }
         $paper = PaperApprovalBus::model()->findAll($criteria);
         $this->renderPartial('excel', array('model' => $paper, 'modelSearch' => $model, 'statusPaperList' => $statusPaperList));
     }
 }
 protected function getPaperNo()
 {
     $sString = 'B' . date('Ymd');
     $sql = 'select paper_no  from tbl_paper_approval_bus order by paper_approval_bus_id desc limit 1';
     $model = PaperApprovalBus::model()->findBySql($sql);
     if (!empty($model)) {
         $_data = substr($model->paper_no, 10, 3);
         return $sString . '-' . $this->get0($_data);
     } else {
         return $sString . '-001';
     }
 }