Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Contract::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['contr_id' => $this->contr_id, 'is_lock' => $this->is_lock, 'lock_time' => $this->lock_time, 'status' => $this->status, 'audit_status' => $this->audit_status, 'is_submit' => $this->is_submit, 'sub_time' => $this->sub_time, 'sign_time' => $this->sign_time, 'price' => $this->price, 'num' => $this->num, 'createtime' => $this->createtime, 'modified' => $this->modified]);
     $query->andFilterWhere(['like', 'contr_no', $this->contr_no])->andFilterWhere(['like', 'vercode', $this->vercode])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'transactor', $this->transactor])->andFilterWhere(['like', 'oldcontr', $this->oldcontr])->andFilterWhere(['like', 'orgid', $this->orgid])->andFilterWhere(['like', 'userid', $this->userid])->andFilterWhere(['like', 'extra_data', $this->extra_data]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * @更改合同状态[未提交--提交]
  * @author lvkui
  * @param $data
  * @throws \Exception
  * @throws \yii\base\Exception
  */
 function sys_submitStatus($data)
 {
     try {
         if (!isset($data['contr_id']) || $this->isStrEmpty($data['contr_id'])) {
             throw new Exception('an empty string is not allowed for $contr_id');
         }
         if (!isset($data['contr_no']) || $this->isStrEmpty($data['contr_no'])) {
             throw new Exception('an empty string is not allowed for $contr_no');
         }
         $ec = Contract::find()->where(['contr_id' => $data['contr_id'], 'contr_no' => $data['contr_no']])->one();
         if (empty($ec)) {
             throw new Exception('contract does not exist');
         }
         if ($ec->status = Contract::CONTRACT_STATUS_UNCOMMIT) {
             $ec->status = Contract::CONTRACT_STATUS_COMMITIN;
             $ec->update();
         }
     } catch (Exception $e) {
         throw $e;
     }
 }