Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace common\models;
  3. use common\components\ActiveRecordCommon;
  4. use Yii;
  5. /**
  6. * This is the model class for table "tax_rate".
  7. *
  8. * @property integer $id
  9. * @property string $name
  10. * @property double $pourcent
  11. */
  12. class TaxRate extends ActiveRecordCommon
  13. {
  14. /**
  15. * @inheritdoc
  16. */
  17. public static function tableName()
  18. {
  19. return 'tax_rate';
  20. }
  21. /**
  22. * @inheritdoc
  23. */
  24. public function rules()
  25. {
  26. return [
  27. [['value'], 'number'],
  28. [['name'], 'string', 'max' => 255],
  29. ];
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function attributeLabels()
  35. {
  36. return [
  37. 'id' => 'ID',
  38. 'name' => 'Nom',
  39. 'value' => 'Valeur (0.2 pour 20%)',
  40. ];
  41. }
  42. /**
  43. * Retourne les options de base nécessaires à la fonction de recherche.
  44. *
  45. * @return array
  46. */
  47. public static function defaultOptionsSearch() {
  48. return [
  49. 'with' => [],
  50. 'join_with' => [],
  51. 'orderby' => 'pourcent ASC',
  52. 'attribute_id_producer' => ''
  53. ] ;
  54. }
  55. public static function getTaxRateArray()
  56. {
  57. $taxRateArrayReturn = [];
  58. $taxRateArray = TaxRate::find()->all();
  59. foreach($taxRateArray as $taxRate) {
  60. $taxRateArrayReturn[$taxRate->id] = $taxRate;
  61. }
  62. return $taxRateArrayReturn;
  63. }
  64. }