|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
-
-
-
- namespace common\models;
-
- use common\components\ActiveRecordCommon;
- use Yii;
-
-
- class DeliveryNote extends Document
- {
-
-
-
- public static function tableName()
- {
- return 'delivery_note';
- }
-
-
-
-
- public function getOrders()
- {
- return $this->relationOrders('id_delivery_note') ;
- }
-
-
-
- public static function defaultOptionsSearch()
- {
- return [
- 'with' => [],
- 'join_with' => ['user AS user_delivery_note', 'orders', 'producer'],
- 'orderby' => 'date ASC',
- 'attribute_id_producer' => 'delivery_note.id_producer'
- ];
- }
-
- public function isInvoiced()
- {
- if($this->orders && count($this->orders) > 0) {
- foreach($this->orders as $order) {
- if($order->id_invoice) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- }
|