public function actionPaper($id) { $model = PaperApproval::model()->find(array('condition' => 'paper_approval_id = :paper_id', 'params' => array(':paper_id' => $id))); if (empty($model)) { throw new CHttpException(403, 'ไม่มีข้อมูข กรุณาลองใหม่อีกครั้ง'); } $this->render('paper', array('model' => $model)); }
protected function loadModel($id) { $model = PaperApproval::model()->findByPk($id); if (empty($model)) { throw new CHttpException(404, 'ผิดพลาดในการดึงข้อมูล ออกมาแสดงผล ลองใหม่อีกครั้ง'); } return $model; }
protected function loadModel($id) { $model = PaperApproval::model()->findByPk($id); if (empty($model)) { throw new CHttpException('403', 'ไม่มีข้อมูลที่คุณต้องการ กรุณาลองใหม่อีกครั้ง'); } return $model; }
public static function paper() { $now = strtotime(date('Y-m-d H:i:s')); $model = PaperApproval::model()->findAll(array('condition' => 'status < 4')); if (!empty($model)) { foreach ($model as $paper) { if ($now >= strtotime($paper->departure_time . ' ' . $paper->time_start)) { $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(); $statusPaperList = ''; if (isset($_POST['SearchMonth'])) { $model->attributes = $_POST['SearchMonth']; $criteria = new CDbCriteria(); $criteria->with = array('member', 'place'); // $criteria->scopes = array('desc'); 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 = PaperApproval::model()->findAll($criteria); $this->renderPartial('excel', array('model' => $paper, 'modelSearch' => $model, 'statusPaperList' => $statusPaperList)); } }
protected function getPaperNo() { $sString = 'C' . date('Ymd'); $sql = 'select paper_no from tbl_paper_approval order by paper_approval_id desc limit 1'; $model = PaperApproval::model()->findBySql($sql); if (!empty($model)) { $_data = substr($model->paper_no, 10, 3); return $sString . '-' . $this->get0($_data); } else { return $sString . '-001'; } }