/**
  * 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 = FuelConsumption::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionDeletedetails($id)
 {
     $vehicle = VehicleDetails::model()->findByAttributes(array('id' => $id));
     $vehicle->is_deleted = '1';
     $vehicle->save();
     $driver = DriverDetails::model()->findByAttributes(array('vehicle_id' => $id));
     $driver->status = NULL;
     $driver->save();
     $fuel = FuelConsumption::model()->DeleteAllByAttributes(array('vehicle_id' => $id));
     $bus = BusLog::model()->DeleteAllByAttributes(array('vehicle_id' => $id));
     $this->redirect(array('manage'));
 }
示例#3
0
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td width="247" valign="top">
            <?php 
$this->renderPartial('/transportation/trans_left');
?>
        </td>
        <td valign="top">
            <div class="cont_right">
                <h1>
                    <?php 
echo Yii::t('transport', 'FuelConsumption');
?>
                </h1>
                <?php 
$driver = FuelConsumption::model()->findByAttributes(array('id' => $_REQUEST['id']));
$vehicle = VehicleDetails::model()->findByAttributes(array('id' => $driver->vehicle_id));
?>
              
			<div class="pdtab_Con">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr class="pdtab-h">
                       <td align="center">
                            <?php 
echo Yii::t('transport', 'Vehicle Code');
?>
                        </td>
                        <td align="center">
                            <?php 
echo Yii::t('transport', 'Fuel Consumed');
?>
示例#4
0
?>
</td>
            <td align="center"><?php 
echo Yii::t('transport', 'End Time Reading');
?>
</td>
            <td align="center"><?php 
echo Yii::t('transport', 'Action');
?>
</td>
        </tr>
        <?php 
if ($route != NULL) {
    foreach ($route as $route_1) {
        $vehicle = VehicleDetails::model()->findByAttributes(array('id' => $route_1->vehicle_id));
        $fuel = FuelConsumption::model()->findByAttributes(array('vehicle_id' => $route_1->vehicle_id));
        ?>
                <tr>
                	<td align="center"><?php 
        echo $vehicle->vehicle_code;
        ?>
</td>
                    <td align="center"><?php 
        echo $route_1->start_time_reading;
        ?>
</td>
                    <td align="center"><?php 
        echo $route_1->end_time_reading;
        ?>
</td>
                    <td align="center"><?php