public function actionShowlist($id)
 {
     $count = Customer::find()->where(['Cus_id' => $id])->count();
     $model = Customer::find()->where(['Cus_id' => $id])->all();
     if ($count > 0) {
         foreach ($model as $value) {
             $xcount = \backend\models\Saledata::find()->where(['Sale_Code' => $value->Cus_Customeras])->count();
             $sales = \backend\models\Saledata::find()->where(['Sale_Code' => $value->Cus_Customeras])->all();
             $fullname = '';
             foreach ($sales as $data) {
                 $fullname = $data->Sale_Name . " " . $data->Sale_Lastname;
             }
             $session = new Session();
             $session->open();
             if ($xcount > 0) {
                 $session['salecode'] = $value->Cus_Customeras;
             } else {
                 $session['salecode'] = null;
             }
             echo "<option value='" . $value->Cus_Customeras . "'>{$fullname}</option>";
             //echo "<option value='100'>$fullname</option>";
         }
     } else {
         echo "<option>-</option>";
     }
 }
Beispiel #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Saledata::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([
     //            'Sale_Province' => $this->Sale_Province,
     //            'ts_create' => $this->ts_create,
     //            'ts_update' => $this->ts_update,
     //            'IsDelete' => $this->IsDelete,
     //        ]);
     $query->orFilterWhere(['like', 'Sale_Code', $this->globalSearch])->orFilterWhere(['like', 'Sale_Name', $this->globalSearch])->orFilterWhere(['like', 'Sale_Lastname', $this->globalSearch])->orFilterWhere(['like', 'Sale_Address', $this->globalSearch])->orFilterWhere(['like', 'Sale_Contact', $this->globalSearch])->orFilterWhere(['like', 'Sale_Email', $this->globalSearch])->orFilterWhere(['like', 'Sale_Branch', $this->globalSearch])->orFilterWhere(['like', 'Sale_Description', $this->globalSearch])->orFilterWhere(['like', 'ts_name', $this->globalSearch]);
     return $dataProvider;
 }