/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { $this->loadModel($id)->delete(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { Yii::app()->user->setFlash('info', MyFormatter::alertError('<strong>Selamat!</strong> Data telah berhasil dihapus.')); $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index')); } }
public function actionGagang() { $model = new FormRekap(); if (isset($_POST['FormRekap'])) { $model->attributes = $_POST['FormRekap']; $datestart = date('Y-m-d', strtotime($model->TAHUN . '-' . $model->BULAN . '-01')); $dateend = date('Y-m-t', strtotime($model->TAHUN . '-' . $model->BULAN . '-01')); $criteria = new CDbCriteria(); $criteria->addBetweenCondition('TANGGAL_ORDER', $datestart, $dateend); $order = Order::model()->findAll($criteria); if ($order != null) { $filename = 'REKAP_' . $model->BULAN . '-' . $model->TAHUN; header("Cache-Control: no-cache, no-store, must-revalidate"); header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=" . $filename . ".xls"); $this->renderPartial('_rekap_bulanan', array('order' => $order, 'model' => $model)); exit; } else { Yii::app()->user->setFlash('info', MyFormatter::alertError('Rekap belum tersedia untuk bulan tersebut.')); } } $this->render('gagang/index', array('model' => $model)); }
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { // $this->loadModel($id)->delete(); $order = $this->loadModel($id); $criteria = new CDbCriteria(); $criteria->condition = 'KODE_ORDER = :order'; $criteria->params = array(':order' => $id); $orderdetail = OrderDetail::model()->deleteAll($criteria); //$orderdetail->delete(); $order->delete(); // var_dump(); die(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { Yii::app()->user->setFlash('info', MyFormatter::alertError('<strong>Selamat!</strong> Data telah berhasil dihapus.')); $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index')); } }
public function actionHapus($id) { Item::model()->updateByPk($id, array('STATUS' => 2)); Yii::app()->user->setFlash('info', MyFormatter::alertError('<strong>Sukses!</strong> Data telah berhasil dihapus.')); $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index')); }