Esempio n. 1
6
 public static function upload($filepath)
 {
     \DB::beginTransaction();
     try {
         $reader = ReaderFactory::create(Type::XLSX);
         // for XLSX files
         $reader->open($filepath);
         $cnt = 0;
         Store::where('active', 1)->update(['active' => 0]);
         foreach ($reader->getSheetIterator() as $sheet) {
             foreach ($sheet->getRowIterator() as $row) {
                 if ($cnt > 0) {
                     // dd($row);
                     $area = Area::firstOrCreate(['area' => strtoupper($row[0])]);
                     $enrollment = Enrollment::firstOrCreate(['enrollment' => strtoupper($row[1])]);
                     $distributor = Distributor::firstOrCreate(['distributor_code' => strtoupper($row[2]), 'distributor' => strtoupper($row[3])]);
                     $client = Client::firstOrCreate(['client_code' => strtoupper($row[8]), 'client_name' => strtoupper($row[9])]);
                     $channel = Channel::firstOrCreate(['channel_code' => strtoupper($row[10]), 'channel_desc' => strtoupper($row[11])]);
                     $agency = Agency::firstOrCreate(['agency_code' => strtoupper($row[19]), 'agency_name' => strtoupper($row[20])]);
                     $region = Region::firstOrCreate(['region_code' => strtoupper($row[16]), 'region' => strtoupper($row[15]), 'region_short' => strtoupper($row[14])]);
                     $customer = Customer::firstOrCreate(['customer_code' => strtoupper($row[12]), 'customer_name' => strtoupper($row[13])]);
                     $user = User::where('username', strtoupper($row[22]))->first();
                     if (empty($user) && !empty($row[22])) {
                         // dd($row);
                         $user = User::firstOrCreate(['username' => strtoupper($row[22]), 'name' => strtoupper($row[22]), 'email' => strtoupper($row[22]) . '@pcount.com', 'password' => \Hash::make($row[22])]);
                         $user->roles()->attach(2);
                     }
                     $storeExist = Store::where('store_code', strtoupper($row[5]))->first();
                     if (empty($storeExist) && !empty($row[22])) {
                         $store = Store::create(['storeid' => strtoupper($row[4]), 'store_code' => strtoupper($row[5]), 'store_code_psup' => strtoupper($row[6]), 'store_name' => strtoupper($row[7]), 'area_id' => $area->id, 'enrollment_id' => $enrollment->id, 'distributor_id' => $distributor->id, 'client_id' => $client->id, 'channel_id' => $channel->id, 'customer_id' => $customer->id, 'region_id' => $region->id, 'agency_id' => $agency->id, 'active' => 1]);
                         if (!empty($row[22])) {
                             StoreUser::insert(['store_id' => $store->id, 'user_id' => $user->id]);
                         }
                     } else {
                         $storeExist->storeid = strtoupper($row[4]);
                         $storeExist->store_code = strtoupper($row[5]);
                         $storeExist->store_code_psup = strtoupper($row[6]);
                         $storeExist->store_name = strtoupper($row[7]);
                         $storeExist->area_id = $area->id;
                         $storeExist->enrollment_id = $enrollment->id;
                         $storeExist->distributor_id = $distributor->id;
                         $storeExist->client_id = $client->id;
                         $storeExist->channel_id = $channel->id;
                         $storeExist->customer_id = $customer->id;
                         $storeExist->region_id = $region->id;
                         $storeExist->agency_id = $agency->id;
                         $storeExist->active = 1;
                         $storeExist->save();
                         StoreUser::where('store_id', $storeExist->id)->delete();
                         StoreUser::insert(['store_id' => $storeExist->id, 'user_id' => $user->id]);
                     }
                 }
                 $cnt++;
             }
         }
         \DB::commit();
     } catch (Exception $e) {
         dd($e);
         \DB::rollback();
     }
 }
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     $folderpath = base_path() . '/database/seeds/seed_files/';
     $folders = File::directories($folderpath);
     $latest = '11232015';
     foreach ($folders as $value) {
         $_dir = explode("/", str_replace('\\', '/', $value));
         $cnt = count($_dir);
         $name = $_dir[$cnt - 1];
         $latest_date = DateTime::createFromFormat('mdY', $latest);
         $now = DateTime::createFromFormat('mdY', $name);
         if ($now > $latest_date) {
             $latest = $name;
         }
     }
     $filePath = $folderpath . $latest . '/Masterfile.xlsx';
     $reader = ReaderFactory::create(Type::XLSX);
     // for XLSX files
     $reader->open($filePath);
     echo 'Seeding ' . $filePath . PHP_EOL;
     // DB::table('other_barcodes')->truncate();
     Item::where('active', 1)->update(['cleared' => 0]);
     foreach ($reader->getSheetIterator() as $sheet) {
         if ($sheet->getName() == 'Other Codes') {
             $cnt = 0;
             foreach ($sheet->getRowIterator() as $row) {
                 if (!is_null($row[0]) && trim($row[0]) != '') {
                     if ($cnt > 0) {
                         $item = Item::where('sku_code', trim($row[0]))->first();
                         if (!empty($item)) {
                             if ($item->cleared == 0) {
                                 OtherBarcode::where('item_id', $item->id)->delete();
                                 $item->cleared = 1;
                                 $item->save();
                             }
                             $area = Area::where('area', strtoupper($row[1]))->first();
                             if (!empty($item) && !empty($area)) {
                                 OtherBarcode::firstOrCreate(['item_id' => $item->id, 'area_id' => $area->id, 'other_barcode' => trim($row[2])]);
                             }
                         } else {
                             // dd($row);
                         }
                     }
                     $cnt++;
                 }
             }
         }
     }
     $reader->close();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     Model::reguard();
 }
Esempio n. 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $areas = [["อำเภอเมือง", 19.1664466, 99.90198880000001, 9], ["อำเภอแม่ใจ", 19.375557200000003, 99.79017810000001, 9], ["อำเภอดอกคำใต้", 19.150464, 100.0359661, 9], ["อำเภอภูกามยาว", 19.318769400000008, 99.96886360000001, 9], ["อำเภอภูซาง", 19.625313999999975, 100.3722477, 9], ["อำเภอเชียงคำ", 19.498743700000006, 100.3251564, 9], ["อำเภอเชียงม่วน", 18.947594699999996, 100.3048897, 9], ["อำเภอจุน", 19.427696400000016, 100.12551639999998, 9], ["อำเภอปง", 19.149037399999983, 100.2745494, 9]];
     foreach ($areas as $area) {
         $a = new Area();
         $a->name_th = $area[0];
         $a->lat = $area[1];
         $a->lon = $area[2];
         $a->zoom = $area[3];
         $a->save();
     }
 }
 public function actionAdd()
 {
     $provinces = Area::findProvinces();
     $provinceNames[] = "请选择省份";
     foreach ($provinces as $province) {
         $provinceNames[$province['id']] = $province['name'];
     }
     $model = new GymInfo();
     $test = \Yii::$app->request->post();
     if ($test) {
         $model->attributes = $test['GymInfo'];
         $model->open_time = "[" . $_POST['begin_time'] . ',' . $_POST['end_time'] . ']';
         echo $test['province'];
         $GymUser_id = \Yii::$app->getUser()->id;
         $manager = GymAdmin::findIdentity($GymUser_id);
         $model->manager = $manager['username'];
         $model->province = $test['province'];
         $model->city = $test['city'];
         $model->county = $test['county'];
         $model->wechat = $test['GymInfo']['wechat'];
         $model->sports = $test['GymInfo']['sports'];
         $model->saveGymInfo($GymUser_id);
         $model->field = $model->getFiled();
         $model->coach = $model->getCoach();
         $gym_id = $model->gym_id;
         return $this->render('index', ['model' => $model, 'gym_id' => $gym_id]);
     } else {
         return $this->render('gym_add', ['model' => $model, 'provinces' => $provinceNames]);
     }
 }
Esempio n. 5
0
 private function linkToArea(Project $project, array $input)
 {
     if (isset($input['area'])) {
         $id = $input['area']['id'];
         $area = Area::find($id);
         $project->area()->associate($area)->save();
     }
     return $project;
 }
Esempio n. 6
0
 public function deleteArea($id)
 {
     $model = Area::findOne($id);
     $model->eliminado = 1;
     if ($model->save()) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 7
0
 public function update(array $input)
 {
     if (array_has($input, 'id')) {
         $id = $input['id'];
         $area = Area::find($id);
         $area->fill($input);
         $area->save();
         return $area;
     }
 }
 public function actionCounties()
 {
     $c = Yii::$app->request->post('city');
     if (empty($c) || $c <= 0) {
         throw new BadRequestHttpException();
     }
     $counties = Area::findByParent($c);
     foreach ($counties as $county) {
         echo '<option value="' . $county['id'] . '">' . $county['name'] . '</option>' . PHP_EOL;
     }
 }
Esempio n. 9
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Area::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Esempio n. 10
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Area::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(['id' => $this->id, 'active' => $this->active]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Esempio n. 11
0
 public function run()
 {
     ini_set('max_execution_time', 0);
     //300 seconds = 5 minutes
     DB::table('areas')->delete();
     DB::table('towns')->delete();
     $regions = $this->api('database.getRegions', ['country_id' => 2]);
     foreach ($regions['response'] as $region) {
         $towns = $this->api('database.getCities', ['country_id' => 2, 'region_id' => $region['region_id'], 'count' => 1000]);
         foreach ($towns['response'] as $town) {
             $area = Area::firstOrCreate(['name' => isset($town['area']) ? $town['area'] : $town['title'], 'region_id' => isset(Region::where('name', '=', $town['region'])->first()->id) ? Region::where('name', '=', $town['region'])->first()->id : 0]);
             Town::create(['name' => $town['title'], 'area_id' => $area->id]);
         }
         sleep(10);
     }
 }
Esempio n. 12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Area::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->joinWith(['idResponsable']);
     $dataProvider->sort->attributes['responsable_name'] = ['asc' => ['users.first_name' => SORT_ASC], 'desc' => ['users.first_name' => SORT_DESC]];
     /*
             $dataProvider->sort->attributes['father_area'] = [
                 'asc' => ['areas.name' => SORT_ASC],
                 'desc' => ['areas.name' => SORT_DESC],
             ];*/
     $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(['id' => $this->id, 'area_id' => $this->area_id, 'id_responsable' => $this->id_responsable]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'users.first_name', $this->responsable_name]);
     return $dataProvider;
 }
Esempio n. 13
0
 public function getPlaces($id)
 {
     $area = Area::find($id);
     if ($area) {
         return $area->hasPlaces;
     } else {
         return $this->notFoundResponse();
     }
 }
Esempio n. 14
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $types = Problem::lists('problem_types', 'problem_types');
     $area = Area::lists('area', 'area');
     $complaint = Complaint::findOrFail($id);
     $disable = 1;
     return view('complaints.edit', compact('complaint', 'types', 'area', 'disable'));
 }
Esempio n. 15
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAreas()
 {
     return $this->hasMany(Area::className(), ['area_id' => 'id']);
 }
Esempio n. 16
0
</div>

   
   <div class="col-md-4"><?php 
echo $form->field($model, 'comunas_comuna_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Comunas::find()->all(), 'comuna_id', 'comuna_nombre'), 'language' => 'en', 'hideSearch' => false, 'options' => ['placeholder' => 'Seleccionar Comuna'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>


    <div class="col-md-4"><?php 
echo $form->field($model, 'estadoTaller_estado')->widget(Select2::classname(), ['data' => ArrayHelper::map(Estadotaller::find()->all(), 'estado', 'estado'), 'language' => 'en', 'hideSearch' => false, 'options' => ['placeholder' => 'Seleccionar Estado del Taller'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>

      <div class="col-md-4"><?php 
echo $form->field($model, 'area_area')->widget(Select2::classname(), ['data' => ArrayHelper::map(Area::find()->all(), 'area', 'area'), 'language' => 'en', 'hideSearch' => false, 'options' => ['placeholder' => 'A que área pertenece'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>

    <div class="col-md-4"><?php 
echo $form->field($model, 'fechaInicio')->widget(DatePicker::className(), ['inline' => false, 'language' => 'es', 'options' => ['placeholder' => 'AÑO - MES - DIA'], 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'startView' => 0]]);
?>
</div>

     <div class="col-md-4"><?php 
echo $form->field($model, 'totalParticipantes')->textInput(['maxlength' => true]);
?>
 </div>

    <div class="col-md-4"> <?php 
echo $form->field($model, 'lugarDireccion')->textInput(['maxlength' => true]);
Esempio n. 17
0
 /**
  * Remove the specified resource from storage.
  *
  * @return \Illuminate\Http\Response
  */
 public function postDestroy()
 {
     if ($this->request->ajax()) {
         $id = $this->request['id'] ?: '';
         $data = Area::find($id);
         if ($data) {
             $data->delete();
         }
         $response = array('url' => route('area.index'));
         return $response;
     }
 }
Esempio n. 18
0
?>
    <?php 
echo $form->field($model, 'descripcion_pregunta')->textarea(['rows' => 6]);
?>
    

    <?php 
echo $form->field($model, 'id_examen')->dropDownList(ArrayHelper::map(Examen::find()->where(['eliminado' => 0])->all(), 'id', 'nombre'), ['prompt' => 'seleccione el examen']);
?>

    <?php 
echo $form->field($model, 'file')->fileInput();
?>

    <?php 
echo $form->field($model, 'id_area')->dropDownList(ArrayHelper::map(Area::find()->where(['eliminado' => 0])->all(), 'id', 'nombre'), ['prompt' => 'Seleccione el area']);
?>
    <?php 
echo $form->field($model, 'id_tipo')->radioList(ArrayHelper::map(\app\models\Tipo::find()->all(), 'id', 'nombre'))->label(false);
?>
    
    
    <div class="row">
           <div class="panel panel-default">
        <div class="panel-heading">
            <h4><i class="glyphicon glyphicon-question-sign"></i> Respuestas</h4></div>
        <div class="panel-body">
             <?php 
DynamicFormWidget::begin(['widgetContainer' => 'dynamicform_wrapper', 'widgetBody' => '.container-items', 'widgetItem' => '.item', 'limit' => 4, 'min' => 0, 'insertButton' => '.add-item', 'deleteButton' => '.remove-item', 'model' => $modelRespuestaExamen[0], 'formId' => 'dynamic-form', 'formFields' => ['nombre_opcion', 'descripcion_respuesta', 'puntos_otorgados', 'imgfile']]);
?>
Esempio n. 19
0
 public function calificarIpp($respuesta = array())
 {
     $categorias = \app\models\Area::find()->all();
 }
Esempio n. 20
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getArea()
 {
     return $this->hasOne(Area::className(), ['id' => 'area_id']);
 }
Esempio n. 21
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     //
     $this->validate($request, ['area_id' => 'required', 'enrollment_id' => 'required', 'distributor_id' => 'required', 'client_id' => 'required', 'channel_id' => 'required', 'customer_id' => 'required', 'region_id' => 'required', 'agency_id' => 'required', 'store_name' => 'required', 'store_id' => 'required']);
     // $diff_items      = array_diff( $channel_items, $store_items );
     // $same_items      = array_intersect( $channel_items, $store_items );
     // $add_store_items = ChannelItem::select('item_id',
     //                                        'item_type_id',
     //                                        'ig',
     //                                        'fso_multiplier',
     //                                        'min_stock',
     //                                        'ig_updated',
     //                                        'osa_tagged',
     //                                        'npi_tagged' )
     //                                         ->whereIn('item_id',$diff_items)
     //                                         ->where('channel_id',$request->channel_id)
     //                                         ->get();
     // foreach ($add_store_items as &$data) {
     //    $data->store_id = $id;
     // }
     // $delete      = StoreItem::where('store_id',$id)->whereNotIn('item_id',$same_items)->delete();
     // foreach ($add_store_items as $data) {
     //     $check[] = StoreItem::firstOrCreate([
     //                             'store_id'       => $data->store_id,
     //                             'item_id'        => $data->item_id,
     //                             'item_type_id'   => $data->item_type_id,
     //                             'ig'             => $data->ig,
     //                             'fso_multiplier' => $data->fso_multiplier,
     //                             'min_stock'      => $data->min_stock,
     //                             'ig_updated'     => $data->ig_updated,
     //                             'osa_tagged'     => $data->npi_tagged ]);
     // }
     $store = Store::findOrFail($id);
     //for mkl
     $mkl_store_items = StoreItem::where('store_id', $id)->where('item_type_id', 1)->get()->pluck('item_id')->toArray();
     //get all the item from store mkl
     $mkl_channel_items = ChannelItem::where('channel_id', $request->channel_id)->where('item_type_id', 1)->get()->pluck('item_id')->toArray();
     //for assortment
     $assortment_store_items = StoreItem::where('store_id', $id)->where('item_type_id', 2)->get()->pluck('item_id')->toArray();
     //get all the item from store assortment
     $assortment_channel_items = ChannelItem::where('channel_id', $request->channel_id)->where('item_type_id', 2)->get()->pluck('item_id')->toArray();
     //for mkl
     foreach ($mkl_store_items as $value) {
         if (!in_array($value, $mkl_channel_items)) {
             $delete = StoreItem::where('store_id', $id)->where('item_type_id', 1)->where('item_id', $value)->delete();
         }
     }
     $mkl_remaining_items = StoreItem::where('store_id', $id)->where('item_type_id', 1)->get()->pluck('item_id')->toArray();
     foreach ($mkl_channel_items as $value) {
         if (!in_array($value, $mkl_remaining_items)) {
             $data = ChannelItem::where('item_id', $value)->where('channel_id', $request->channel_id)->where('item_type_id', 1)->first();
             StoreItem::firstOrCreate(['store_id' => $id, 'item_id' => $data->item_id, 'item_type_id' => $data->item_type_id, 'ig' => $data->ig, 'fso_multiplier' => $data->fso_multiplier, 'min_stock' => $data->min_stock, 'ig_updated' => $data->ig_updated, 'osa_tagged' => $data->npi_tagged]);
         }
     }
     //for assortment
     foreach ($assortment_store_items as $value) {
         if (!in_array($value, $assortment_channel_items)) {
             $delete = StoreItem::where('store_id', $id)->where('item_type_id', 2)->where('item_id', $value)->delete();
         }
     }
     $assortment_remaining_items = StoreItem::where('store_id', $id)->where('item_type_id', 2)->get()->pluck('item_id')->toArray();
     foreach ($assortment_channel_items as $value) {
         if (!in_array($value, $assortment_remaining_items)) {
             $data = ChannelItem::where('item_id', $value)->where('channel_id', $request->channel_id)->where('item_type_id', 2)->first();
             $w_mkl = StoreItem::where('store_id', $id)->where('item_id', $value)->get();
             if (count($w_mkl) == 0) {
                 StoreItem::firstOrCreate(['store_id' => $id, 'item_id' => $data->item_id, 'item_type_id' => $data->item_type_id, 'ig' => $data->ig, 'fso_multiplier' => $data->fso_multiplier, 'min_stock' => $data->min_stock, 'ig_updated' => $data->ig_updated, 'osa_tagged' => $data->npi_tagged]);
             }
         }
     }
     //end
     $store->area_id = $request->area_id;
     $store->enrollment_id = $request->enrollment_id;
     $store->distributor_id = $request->distributor_id;
     $store->client_id = $request->client_id;
     $store->channel_id = $request->channel_id;
     $store->customer_id = $request->customer_id;
     $store->region_id = $request->region_id;
     $store->agency_id = $request->agency_id;
     $store->store_name = $request->store_name;
     $store->storeid = $request->store_id;
     $store->store_code = $request->store_code;
     $store->store_code_psup = $request->store_code_psup;
     $store->active = $request->status;
     $store->update();
     \DB::table('store_users')->where('user_id', $request->userid)->where('store_id', $id)->update(['user_id' => $request->user_id]);
     $store = Store::findOrFail($id);
     $area = Area::orderBy('area', 'ASC')->lists('area', 'id');
     $enrollment = Enrollment::orderBy('enrollment', 'ASC')->lists('enrollment', 'id');
     $distributor = Distributor::orderBy('distributor', 'ASC')->lists('distributor', 'id');
     $client = Client::orderBy('client_name', 'ASC')->lists('client_name', 'id');
     $channel = channel::orderBY('channel_desc', 'ASC')->lists('channel_desc', 'id');
     $customer = Customer::orderBy('customer_name', 'ASC')->lists('customer_name', 'id');
     $region = Region::orderBy('region_short', 'ASC')->lists('region_short', 'id');
     $agency = Agency::orderBy('agency_name', 'ASC')->lists('agency_name', 'id');
     $status = ['0' => 'In-active', '1' => 'Active'];
     $user = StoreUser::where('store_id', $id)->first();
     $alluser = User::all()->lists('username', 'id');
     $hash = UpdateHash::find(1);
     if (empty($hash)) {
         UpdateHash::create(['hash' => \Hash::make(date('Y-m-d H:i:s'))]);
     } else {
         $hash->hash = md5(date('Y-m-d H:i:s'));
         $hash->update();
     }
     Session::flash('flash_class', 'alert-success');
     Session::flash('flash_message', 'Store successfully updated.');
     return view('store.edit', ['store' => $store, 'area' => $area, 'enrollment' => $enrollment, 'distributor' => $distributor, 'client' => $client, 'channel' => $channel, 'customer' => $customer, 'region' => $region, 'agency' => $agency, 'status' => $status, 'user' => $user, 'alluser' => $alluser]);
 }
Esempio n. 22
0
/* @var $model app\models\Category */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="category-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(Category::find()->all(), 'id', 'name'), array('prompt' => ''));
?>

    <?php 
echo $form->field($model, 'id_area')->dropDownList(ArrayHelper::map(Area::find()->all(), 'id', 'name'), array('prompt' => ''));
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'description')->textInput(['maxlength' => true, 'required' => true]);
?>

    <?php 
echo $form->field($model, 'service_level_agreement_asignment')->dropDownList(['1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5']);
?>

    <?php 
Esempio n. 23
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdArea()
 {
     return $this->hasOne(Area::className(), ['id' => 'id_area']);
 }
 public function actionTab($tab)
 {
     $searchModel = new RequestSearch();
     $html = null;
     switch ($tab) {
         case 1:
             $query = Request::find()->where(['user_id' => Yii::$app->user->id]);
             $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $query);
             $html = $this->renderPartial('GridViewMyRequest', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
             break;
         case 2:
             $query = Request::find()->joinWith('usersRequests')->where(['users_request.user_id' => Yii::$app->user->id]);
             $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $query);
             $html = $this->renderPartial('GridViewRequestAssigned', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
             break;
         case 3:
             $area = Area::find()->where(['id_responsable' => Yii::$app->user->id])->one();
             $query = Request::find()->joinWith('areasRequests')->where(['areas_request.area_id' => $area->id]);
             $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $query);
             $html = $this->renderPartial('GridViewRequestForArea', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
             break;
         case 4:
             $dataProvider = $searchModel->search(Yii::$app->request->queryParams, null);
             $html = $this->renderPartial('GridViewAllRequest', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
             break;
         case 5:
             $query = Request::find()->where(['status' => 'Calendarizada']);
             $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $query);
             $html = $this->renderPartial('GridViewRequestScheduled', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
             break;
     }
     return JSON::encode($html);
 }
Esempio n. 25
0
 public function getPlacesByArea($id)
 {
     $area = Area::find($id);
     if ($area) {
         $places = $area->hasPlaces;
         $json_result = array();
         foreach ($places as $place) {
             $place = $this->show($place['id']);
             array_push($json_result, $place);
         }
         return $json_result;
     } else {
         return $this->notFoundResponse();
     }
 }
Esempio n. 26
0
    <?php 
$form = ActiveForm::begin();
?>



    <?php 
echo $form->field($model, 'puntiacion_directa')->textInput();
?>

    <?php 
echo $form->field($model, 'percentil')->textInput();
?>

    <?php 
echo $form->field($model, 'id_area')->dropDownList(ArrayHelper::map(Area::findAll(['eliminado' => '0']), 'id', 'nombre'), ['prompt' => 'Area']);
?>
    <?php 
echo $form->field($model, 'id_tipo')->radioList(ArrayHelper::map(Tipo::find()->all(), 'id', 'nombre'))->label(false);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Esempio n. 27
0
 public function __construct(Request $request)
 {
     $this->areas = Area::all('id', 'name');
     $this->streets = Street::all('id', 'name');
     $this->request = $request;
 }
Esempio n. 28
0
 public function actionAgency()
 {
     exit;
     $old = new Buy6Old();
     $offset = isset($_GET['offset']) ? $_GET['offset'] : '384036';
     $rs = $old->find()->offset($offset)->limit(500)->orderBy('ID ASC')->all();
     if ($rs) {
         foreach ($rs as $v) {
             $buy = new Buy6();
             $buydata = new BuyData6();
             if ($v->Vip == 1) {
                 $buy->groupid = 7;
             } else {
                 $buy->groupid = 6;
             }
             if (!empty($v->City)) {
                 $areaid = Area::find()->select(['areaid'])->where('areaname = "' . $v->City . '"')->one();
             } else {
                 $areaid = Area::find()->select(['areaid'])->where('areaname = "' . $v->Province . '"')->one();
             }
             if ($areaid['areaid']) {
                 $buy->areaid = addslashes($areaid['areaid']);
             }
             $buy->itemid = $v->ID;
             $buy->typeid = 1;
             $buy->level = 0;
             $buy->title = $v->IntentDrug;
             $buy->username = $v->FromUserName;
             $buy->company = $v->Company;
             $buy->vip = $v->Vip;
             $buy->truename = $v->LinkMan;
             $buy->telephone = $v->Tel;
             $buy->mobile = $v->Pho;
             $buy->address = $v->ADDR;
             $buy->email = $v->EMail;
             $buy->qq = $v->QQ;
             $buy->totime = 0;
             $buy->addtime = strtotime($v->PostDTime);
             $buy->edittime = $buy->addtime;
             $buy->editdate = date('Y-m-d', $buy->addtime);
             $buy->adddate = date('Y-m-d', $buy->addtime);
             $buy->status = 3;
             $buy->zs_tousername = $v->ToUserName;
             $buy->drugid = $v->DrugID;
             $buy->zs_class_lv1 = $v->Class_LV1;
             $buy->zs_class_lv2 = $v->Class_LV2;
             $buy->zs_class_lV3 = $v->Class_LV3;
             $buy->zs_company = $v->Company;
             $buy->zs_status = $v->Status;
             $buy->zs_province = $v->Province;
             $buy->zs_city = $v->City;
             $buy->zs_postcode = $v->PostCode;
             $buy->zs_linkman = $v->LinkMan;
             $buy->zs_tel = $v->Tel;
             $buy->zs_pho = $v->Pho;
             $buy->zs_fax = $v->Fax;
             $buy->zs_qq = $v->QQ;
             $buy->zs_email = $v->EMail;
             $buy->zs_website = $v->WebSite;
             $buy->zs_address = $v->ADDR;
             $buy->zs_intentdrug = $v->IntentDrug;
             $buy->zs_durghistory = $v->DurgHistory;
             $buy->zs_dtime = $v->DTime;
             $buy->zs_postdtime = $v->PostDTime;
             $buy->zs_checked = $v->Checked;
             $buy->zs_jiam = $v->JiaM;
             $buy->zs_jiamtime = $v->JiaMTime;
             $buy->zs_state = $v->State;
             $buy->zs_refreshnum = $v->RefreshNum;
             $buy->zs_sitename = $v->SiteName;
             $buy->zs_letter = $v->Letter;
             $buy->zs_vip = $v->Vip;
             $buy->zs_channel = $v->Channel;
             $buy->history = $v->DurgHistory;
             $buy->is_zs = 1;
             $buydata->itemid = $v->ID;
             if ($v->Intro == null) {
                 $v->Intro = '';
             }
             $buydata->content = $v->Intro;
             $buy->save(false);
             $buydata->save(false);
         }
         $num = $offset + 500;
         return $this->render('agency', ['num' => $num]);
     } else {
         echo '0k!!!!!!!!!!';
     }
 }
Esempio n. 29
0
 /**
  * Finds the Area model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Area the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Area::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 30
0
<div class="discipline-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 175]);
?>

    <?php 
echo $form->field($model, 'short_name')->textInput(['maxlength' => 20]);
?>

    <?php 
echo $form->field($model, 'area_id')->dropDownList(ArrayHelper::map(Area::find()->orderBy('name ASC')->all(), 'id', 'name'));
?>
	
	<?php 
echo $form->field($model, 'school_id')->dropDownList(ArrayHelper::map(School::find()->orderBy('name ASC')->all(), 'id', 'name'));
?>
	
	<?php 
echo $form->field($model, 'active')->checkbox([], false);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
		<?php