</div> <div class="portlet-body"> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead> <tr> <th>#</th> <th>Nama Barang</th> <th>Kategori</th> <th>Jumlah</th> <th>Harga</th> </tr> </thead> <tbody> <?php $cek = OrderDetail::model()->findAllByAttributes(array('KODE_ORDER' => $model->KODE_ORDER)); foreach ($cek as $dex => $row) { ?> <tr> <td><?php echo $dex + 1; ?> </td> <td><?php echo $row->item->NAMA_ITEM; ?> </td> <td><?php echo $row->item->kategori->KATEGORI; ?> </td>
/** * 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 loadOrderDetailByOrder($orderID, $storeID) { $models = OrderDetail::model()->findAll('s_order_id = :s_order_id and s_store_id = :s_store_id', array(':s_order_id' => $orderID, ':s_store_id' => $storeID)); return $models; }
public static function getJumlahItem($kdorder) { $criteria = new CDbCriteria(); $criteria->condition = 'KODE_ORDER=:kdorder'; $criteria->params = array(':kdorder' => $kdorder); $jumlah = OrderDetail::model()->count($criteria); return $jumlah; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = OrderDetail::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Return de Details about an Order **/ public function actionGetDetail($id) { $return = array(); if ($id != '') { $request = Request::model()->findByPk($id); $models = OrderDetail::model()->findAll('request_id=:request_id', array(':request_id' => $id)); foreach ($models as $item) { $temp['StockTime'] = $item->StockTime; $temp['ShipTime'] = $item->ShipTime; $temp['ManualQty'] = $item->ManualQty; $Items[] = Item::model()->findByPk($item->item_id); $params[] = $temp; } $reqDet = RequestDetail::getItemDetails($Items, $request->P1Start, $request->P1End, $request->P2Start, $request->P2End, $params); $return['success'] = true; // Agregar aca los mismos criterios de busqueda que se apliquen a findAll $return['totalCount'] = count($reqDet); //$models["totalCount"]; //Item::model()->count();//$criteria $return['orderDetails'] = $reqDet; } else { $return['success'] = false; $return['totalCount'] = 0; //$models["totalCount"]; //Item::model()->count();//$criteria $return['orderDetails'] = array(); } echo CJSON::encode($return); }