123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\modules\car\models;
- use Yii;
- /**
- * This is the model class for table "{{%f_stats_cost_hkm}}".
- *
- * @property int $id 序号
- * @property int $car_id 外键关联f_car_infor(car_id)
- * @property float|null $opt_cost_hkm 百公里运行费
- * @property float|null $sum_costs_per_km 百公里费用
- * @property int|null $year 年
- * @property int|null $month 月
- */
- class FStatsCostHkm extends \app\common\models\EActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%f_stats_cost_hkm}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['car_id'], 'required'],
- [['car_id', 'year', 'month'], 'integer'],
- [['opt_cost_hkm', 'sum_costs_per_km'], 'number'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => '序号',
- 'car_id' => '外键关联f_car_infor(car_id)',
- 'opt_cost_hkm' => '百公里运行费',
- 'sum_costs_per_km' => '百公里费用',
- 'year' => '年',
- 'month' => '月',
- ];
- }
- public function getCarinfo()
- {
- return FCarInfo::find()->where("car_id=$this->car_id")->limit(1)->one();
- }
- }
|