예제 #1
0
 private function search($doc)
 {
     $query = \app\models\Docs::find();
     $query->where("(`doctype`=:typeA) OR (`doctype`=:typeB)", [':typeA' => 1, ':typeB' => 3]);
     $query->andFilterWhere(['<=', 'due_date', date("Y-m-d") . " 23:59:59"]);
     $query->andFilterWhere(['=', 'refstatus', 0]);
     // $sort = new CSort();
     //$sort->defaultOrder = 'due_date DESC';
     return new \yii\data\ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['due_date' => SORT_ASC]], 'pagination' => array('pageSize' => 4)]);
 }
예제 #2
0
 private function getDocs($account_id)
 {
     $sum = 0;
     //1=Proforma
     $doctype = 1;
     $openDocs = Docs::find()->where(['account_id' => $account_id, 'doctype' => $doctype, 'refstatus' => Docs::STATUS_OPEN])->all();
     foreach ($openDocs as $doc) {
         $sum += $doc->total;
     }
     return $sum;
 }
예제 #3
0
 private function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $query = \app\models\Docs::find();
     //$query->where("(`doctype`=:typeA)", [':typeA' => 7]);
     $query->andFilterWhere(['<=', 'due_date', date("Y-m-d") . " 23:59:59"]);
     $query->andFilterWhere(['=', 'refstatus', 0]);
     // $sort = new CSort();
     //$sort->defaultOrder = 'due_date DESC';
     return new \yii\data\ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['due_date' => SORT_ASC]], 'pagination' => array('pageSize' => 4)]);
 }
예제 #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Docs::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, "sort" => ['defaultOrder' => ['reg_date' => SORT_DESC, 'docnum' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'doctype' => $this->doctype, 'docnum' => $this->docnum, 'account_id' => $this->account_id, 'total' => $this->total, 'status' => $this->status, 'printed' => $this->printed, 'refstatus' => $this->refstatus]);
     $query->andFilterWhere(['like', 'company', $this->company])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'zip', $this->zip])->andFilterWhere(['like', 'vatnum', $this->vatnum])->andFilterWhere(['like', 'refnum', $this->refnum])->andFilterWhere(['like', 'refnum_ext', $this->refnum_ext])->andFilterWhere(['like', 'currency_id', $this->currency_id])->andFilterWhere(['like', 'comments', $this->comments])->andFilterWhere(['like', 'description', $this->description]);
     if (!is_null($this->issue_date)) {
         $tmp = explode(" to ", $this->issue_date);
         //var_dump($tmp);
         if (isset($tmp[0]) && isset($tmp[1])) {
             $query->andFilterWhere(['between', 'issue_date', $tmp[0], $tmp[1]]);
         }
         //
         //$query->andFilterWhere(['>=', 'issue_from', $tmp[1]]);
     }
     return $dataProvider;
 }