Exemplo n.º 1
0
 public function search($params)
 {
     $query = BranchModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_branch' => $this->id_branch, 'id_orgn' => $this->id_orgn, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'cd_branch', $this->cd_branch])->andFilterWhere(['like', 'nm_branch', $this->nm_branch])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="warehouse-form col-lg-6" style="padding-left: 0px;">

    <?php 
$form = ActiveForm::begin();
?>
    <div class="panel panel-primary">
        <div class="panel-heading">
            Warehouse
        </div>
        <div class="panel-body">
            <?php 
echo $form->field($model, 'id_branch')->dropDownList(ArrayHelper::map(Branch::find()->all(), 'id_branch', 'nm_branch'), ['style' => 'width:200px;']);
?>

            <?php 
echo $form->field($model, 'cd_whse')->textInput(['maxlength' => 4, 'style' => 'width:120px;']);
?>

            <?php 
echo $form->field($model, 'nm_whse')->textInput(['maxlength' => 32]);
?>
        </div>
    </div>
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdBranch()
 {
     return $this->hasOne(Branch::className(), ['id_branch' => 'id_branch']);
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBranches()
 {
     return $this->hasMany(Branch::className(), ['id_orgn' => 'id_orgn']);
 }
Exemplo n.º 5
0
 public static function getBranchList($id_user = null)
 {
     if ($id_user === null) {
         return ArrayHelper::map(Branch::find()->all(), 'id_branch', 'nm_branch');
     } else {
         $query = UserToBranch::find()->with('idBranch')->where(['user_id' => $id_user]);
         return ArrayHelper::map($query->all(), 'id_branch', 'idBranch.nm_branch');
     }
 }
Exemplo n.º 6
0
 /**
  * Finds the Branch model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Branch the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Branch::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }