/** * Manages all models. */ public function actionAdmin() { $model = new InboundItemsHistory('search'); $model->unsetAttributes(); // clear any default values /* for exceel * */ if (isset($_GET['export'])) { header("Content-Type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: inline; filename=\"Inbound Items History " . date("F j, Y") . ".xls\""); $dataProvider = $model->search(); $dataProvider->pagination = False; ?> <table border="1"> <tr> <th>history_id_item</th> <th>Part Number</th> <th>Item name</th> <th>quantity_moved</th> <th>current_quantity_in_stock</th> <th>User Name</th> <th>created</th> </tr> <?php //echo "history_id_item \t main_item_id \t quantity_moved \t current_quantity_in_stock \t created \n"; foreach ($dataProvider->data as $data) { echo "<tr>"; echo "<td>" . $data->history_id_item . "</td>"; echo "<td>" . $data->mainItem->part_number . "</td>"; echo "<td>" . $data->mainItem->name . "</td>"; echo "<td>" . $data->quantity_moved . "</td>"; echo "<td>" . $data->current_quantity_in_stock . "</td>"; echo "<td>" . $data->user->username . "</td>"; echo "<td>" . $data->created . "</td>"; echo "</tr>"; //echo $data->history_id_item, "\t",$data->mainItem->name, "\t", $data->quantity_moved, "\t", $data->current_quantity_in_stock, "\t", $data->created, "\n"; } //end of foreach(). ?> </table> <?php Yii::app()->end(); } if (isset($_GET['InboundItemsHistory'])) { $model->attributes = $_GET['InboundItemsHistory']; } $this->render('admin', array('model' => $model)); }