/** * 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 $id the ID of the model to be loaded * @return PurchasesInfo the loaded model * @throws CHttpException */ public function loadModel($id) { $model = PurchasesInfo::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<table class="table table-bordered"> <tr> <th>Edit</th> <th>View</th> <th>Date</th> <th>Transacation</th> <th>#</th> <th>Description</th> <th>Contact</th> <th>Amount</th> <th>Balance</th> </tr> <?php $balance = 0; $PurchasesInfos = PurchasesInfo::model()->findAll(array('condition' => 'item_id=:item', 'params' => array(':item' => $id))); foreach ($PurchasesInfos as $PurchasesInfo) { ?> <tr> <td><?php echo CHtml::link('<button class="btn btn-default btn-sm"><span class="btn-label-style">Edit</span></button>', $this->createAbsoluteUrl('purchasesInfos/update', array('id' => $PurchasesInfo->purchasesInvoice->id))); ?> </td> <td><?php echo CHtml::link('<button class="btn btn-default btn-sm"><span class="btn-label-style">View</span></button>', $this->createAbsoluteUrl('purchasesInfos/view', array('id' => $PurchasesInfo->purchasesInvoice->id))); ?> </td> <td> <?php echo $PurchasesInfo->purchasesInvoice->issue_date; ?>