|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
-
- namespace common\models;
-
- use common\components\ActiveRecordCommon;
- use Yii;
-
- /**
- * This is the model class for table "tax_rate".
- *
- * @property integer $id
- * @property string $name
- * @property double $pourcent
- */
- class TaxRate extends ActiveRecordCommon
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'tax_rate';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['value'], 'number'],
- [['name'], 'string', 'max' => 255],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'name' => 'Nom',
- 'value' => 'Valeur (0.2 pour 20%)',
- ];
- }
-
- /**
- * Retourne les options de base nécessaires à la fonction de recherche.
- *
- * @return array
- */
- public static function defaultOptionsSearch() {
- return [
- 'with' => [],
- 'join_with' => [],
- 'orderby' => 'pourcent ASC',
- 'attribute_id_producer' => ''
- ] ;
- }
-
- public static function getTaxRateArray()
- {
- $taxRateArrayReturn = [];
- $taxRateArray = TaxRate::find()->all();
-
- foreach($taxRateArray as $taxRate) {
- $taxRateArrayReturn[$taxRate->id] = $taxRate;
- }
-
- return $taxRateArrayReturn;
- }
- }
|