- <?php
-
- namespace common\models;
-
- use Yii;
-
- /**
- * This is the model class for table "facture".
- *
- * @property integer $id
- * @property integer $id_etablissement
- * @property string $date
- * @property string $reference
- * @property string $libelle
- * @property string $texte
- * @property double $montant_ht
- * @property integer $paye
- * @property string $date_paiement
- * @property string $methode_paiement
- */
- class Facture extends \yii\db\ActiveRecord {
-
- /**
- * @inheritdoc
- */
- public static function tableName() {
- return 'facture';
- }
-
- /**
- * @inheritdoc
- */
- public function rules() {
- return [
- [['id_etablissement', 'paye'], 'integer'],
- [['date', 'date_paiement'], 'safe'],
- [['texte'], 'string'],
- [['montant_ht', 'ca'], 'number'],
- [['reference', 'libelle', 'methode_paiement'], 'string', 'max' => 255],
- ];
- }
-
- public function getEtablissement() {
- return $this->hasOne(Etablissement::className(), ['id' => 'id_etablissement']);
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels() {
- return [
- 'id' => 'ID',
- 'id_etablissement' => 'Id Etablissement',
- 'date' => 'Date',
- 'reference' => 'Reference',
- 'libelle' => 'Libelle',
- 'texte' => 'Texte',
- 'montant_ht' => 'Montant Ht',
- 'paye' => 'Paye',
- 'date_paiement' => 'Date Paiement',
- 'methode_paiement' => 'Methode Paiement',
- 'ca' => 'CA'
- ];
- }
-
- public static function getLastFacture() {
- return Facture::find()
- ->orderBy('reference DESC')
- ->one();
- }
-
- }
|