示例#1
0
            </td>
            <td>
                <?php 
    echo $PurchasesInfo->qty;
    ?>
            </td>
            <td>
                <?php 
    $balance += $PurchasesInfo->qty;
    echo $balance;
    ?>
            </td>
                </tr>
        <?php 
}
$SalesInfos = SalesInfo::model()->findAll(array('condition' => 'item_id=:item', 'params' => array(':item' => $id)));
foreach ($SalesInfos as $SalesInfo) {
    ?>
        <tr>
            <td><?php 
    echo CHtml::link('<button class="btn btn-default btn-sm"><span class="btn-label-style">Edit</span></button>', $this->createAbsoluteUrl('salesInfos/update', array('id' => $SalesInfo->salesInvoice->id)));
    ?>
            </td>
            <td><?php 
    echo CHtml::link('<button class="btn btn-default btn-sm"><span class="btn-label-style">View</span></button>', $this->createAbsoluteUrl('SalesInfos/view', array('id' => $SalesInfo->salesInvoice->id)));
    ?>
            </td>
            <td>
                <?php 
    echo $SalesInfo->salesInvoice->issue_date;
    ?>
 /**
  * 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 SalesInfo the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = SalesInfo::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }