예제 #1
0
 /**
  * Creates a new UrQuestions model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new UrQuestions();
     $model->user_id = \Yii::$app->user->identity->id;
     $UrRecords = Ur::find()->orderBy('name');
     if (\Yii::$app->user->identity->status == 2) {
         $UrRecords = $UrRecords->Where(['regional_id' => \Yii::$app->user->identity->id]);
     }
     if (\Yii::$app->user->identity->status == 3) {
         //    $UrRecords = $UrRecords->Where(['pi_id' => \Yii::$app->user->identity->id]);
     }
     $UrRecords = $UrRecords->all();
     //->where(['pi_id' => $user])
     if (Yii::$app->request->isPost) {
         // print_r($model->qfile);
         $model->qfile = UploadedFile::getInstances($model, 'qfile');
         if (!empty($model->qfile)) {
             $model->qfiles = "";
             foreach ($model->qfile as $file) {
                 $fileName = 'files/qfile/' . Functions::str2url($file->baseName) . rand(555, 99999) . '.' . $file->extension;
                 $model->qfiles .= $fileName . "|";
                 $file->saveAs($fileName);
             }
             $model->qfiles = substr($model->qfiles, 0, -1);
         }
     }
     if ($model->load(Yii::$app->request->post()) && ($id = $model->save())) {
         $info = UrQuestions::getInfo($model->id);
         Word::ur_questions($info);
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model, 'UrRecords' => $UrRecords]);
     }
 }
예제 #2
0
 public function actionMailvznos()
 {
     $all_name = "";
     $n = 0;
     $kvaratal = Vznos::getKvartal();
     $year = date('Y');
     $vznos = Vznos::find()->select('ur_id')->where(['year' => $year])->andWhere(['kvartal' => $kvaratal])->column();
     //Убрать лиимит
     $ur_array = Ur::find()->where(['not in', 'id', $vznos])->andWhere(['plat' => 1])->orderBy('name')->all();
     //->limit(1)
     print "<h4>" . count($ur_array) . "</h4>";
     foreach ($ur_array as $ur) {
         //     print $ur['id'];
         print $ur['name'];
         //  print "<br>";
         Vznos::greatePDF($ur);
         // $ur['contact_mail']="*****@*****.**";
         $file = \Yii::$app->basePath . '/temp/vznos/' . $ur['id'] . '.pdf';
         $Subject = 'Оплата взносов ' . $kvaratal . " квартал " . $year . ' г.';
         if (strpos($ur['contact_mail'], "@") !== false) {
             \Yii::$app->mail->compose('vznos', ['name' => $ur['name']])->setFrom([\Yii::$app->params['infoEmail'] => 'ААУ "СоюзФарма-ТМ"'])->setTo($ur['contact_mail'])->setSubject($Subject)->attach($file)->send();
             sleep(1);
             $all_name .= $ur['name'] . " " . $ur['contact_mail'] . "\n<br>";
             $n++;
         }
     }
     // $pdf = Vznos::greatePDF('Пукась Анна Андреевич');
     \Yii::$app->mail->compose('infovznos', ['info' => $all_name, 'n' => $n])->setFrom([\Yii::$app->params['infoEmail'] => 'СоюзФарма'])->setTo("*****@*****.**")->setSubject('Рассылка произведена')->send();
     \Yii::$app->mail->compose('infovznos', ['info' => $all_name, 'n' => $n])->setFrom([\Yii::$app->params['infoEmail'] => 'СоюзФарма'])->setTo("*****@*****.**")->setSubject('Рассылка произведена')->send();
 }
예제 #3
0
 public function actionIndex($user = null, $date = null, $trimestr = null, $scroll = null)
 {
     if (\Yii::$app->user->identity->status == 3) {
         $user = \Yii::$app->user->identity->id;
     }
     //$model = Preparats::find()->where(['region_id' => $region])->orderBy('name')->all();
     if ($user) {
         //$apteki = Apteki::find()->where(['pi_id' => $user, 'farmopeka' => '1'])->orderBy('address')->all();
         $query = new Query();
         $query->select(['ur_l.name', 'apteki.address', 'apteki.id']);
         $query->from('apteki');
         $query->LeftJoin('ur_l', 'ur_l.id = apteki.ur_l_id');
         $query->andFilterWhere(['=', 'apteki.farmopeka', '1']);
         $query->andFilterWhere(['=', 'apteki.pi_id', $user]);
         //$query->orderBy('ur_l.name,apteki.address');
         $query->orderBy(['ur_l.name' => SORT_ASC, 'apteki.address' => SORT_ASC]);
         $apteki = $query->all();
     }
     if (!$date) {
         $date = date('Y-m-01');
     }
     //   if (!trimestr) $trimestr = Visitors::getTrimestr($date);
     if ($user) {
         $table = Visitors::getTable($user, $apteki, $date, $trimestr, $scroll);
     }
     // print \Yii::$app->params['infoEmail'];
     //Количество привязвнных ир.лиц и розничных точек
     $count['ur'] = Ur::find()->where(['pi_id' => $user])->andWhere(['farmopeka' => 1])->count();
     $count['apteki'] = Apteki::find()->where(['pi_id' => $user])->andWhere(['farmopeka' => 1])->count();
     return $this->render('index', ['user' => $user, 'table' => $table, 'date' => $date, 'trimestr' => $trimestr, 'count' => $count, 'scroll' => $scroll]);
 }
예제 #4
0
파일: UrSearch.php 프로젝트: pumi11/aau
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Ur::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]);
     return $dataProvider;
 }
예제 #5
0
파일: OtController.php 프로젝트: pumi11/aau
 public function actionEdit($id)
 {
     if (Yii::$app->request->post()) {
         Ot::Update($id);
     }
     $apteka = Ur::find()->where(['id' => $id])->one();
     $regionId = Ur::getRegionId($id);
     $db = new Query();
     $db->from('preparats');
     $db->where(['is_active' => 1, 'region_id' => $regionId]);
     $preparats = $db->all();
     return $this->render('edit', ['preparats' => $preparats, 'id_apteka' => $id, 'apteka' => $apteka]);
 }
예제 #6
0
 public function actionRegion2($id = null)
 {
     //Удаляет лишние регионы
     $ru = RegionUrL::find()->all();
     foreach ($ru as $ru2) {
         $ur = null;
         //print_r($ru2);
         $ur = Ur::find()->where(['id' => $ru2['id_ur']])->all();
         if (!$ur) {
             //   $model = RegionUrL::findOne($ru2['id']);
             //  $model->delete();
             print $ru2['id_ur'];
             print "<br>";
         }
     }
 }
예제 #7
0
 public function actionEdit($id)
 {
     $user = Users::getOne($id);
     $status = $user['status'];
     $eng = Yii::$app->params['status_user_eng'][$status];
     if ($status == '3') {
         $users = Users::find()->select(['id', 'username'])->where(['status' => '2'])->all();
         $items = ArrayHelper::map($users, 'id', 'username');
     }
     if ($status == 2) {
         $count['ur'] = Ur::find()->where(['regional_id' => $id])->count();
         $count['apteki'] = Apteki::find()->where(['regional_id' => $id])->count();
     }
     if ($status == 3) {
         $count['ur'] = Ur::find()->where(['pi_id' => $id])->count();
         $count['apteki'] = Apteki::find()->where(['pi_id' => $id])->count();
     }
     if ($eng == "") {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     if (Yii::$app->request->post('Users')) {
         $user->attributes = Yii::$app->request->post('Users');
         $user->photo = UploadedFile::getInstance($user, 'photo');
         if ($user->validate() && $user->save()) {
             if ($user->photo && $user->photo->tempName) {
                 $imagefile = 'img/user/' . $user->id . '.jpg';
                 $imagefileTh = 'img/user/th/' . $user->id . '.jpg';
                 $user->photo->saveAs('img/user/' . $user->id . '.jpg');
                 $img = Image::getImagine()->open(Yii::getAlias($imagefile));
                 $size = $img->getSize();
                 $ratio = $size->getWidth() / $size->getHeight();
                 $width = 200;
                 $height = round($width / $ratio);
                 Image::thumbnail($imagefile, $width, $height)->save($imagefileTh, ['quality' => 90]);
                 $width = 1600;
                 $height = round($width / $ratio);
                 if ($size->getWidth() > 1600) {
                     Image::thumbnail($imagefile, $width, $height)->save($imagefile, ['quality' => 97]);
                 }
             }
             return $this->render($eng, ['model' => $user, 'items' => $items, 'id' => $id, 'status' => Yii::$app->params['status_user'][$status], 'ok' => 1, 'count' => $count]);
         }
     }
     return $this->render($eng, ['model' => $user, 'items' => $items, 'id' => $id, 'status' => Yii::$app->params['status_user'][$status], 'count' => $count]);
 }
예제 #8
0
파일: Vznos.php 프로젝트: pumi11/aau
 /**
  * Пулечение всех юо.лиц в регионе плательщиков взносов
  * @param null $regional_id
  * @param $region_id
  * @return array
  */
 public static function getUr_l_in_region($regional_id, $region_id)
 {
     $regional_id = (int) $regional_id;
     $region_id = (int) $region_id;
     $db = new Query();
     $db->from(Ur::tableName());
     $db->select(['ur_l.name', 'ur_l.id']);
     $db->innerJoin('region_ur_l', "region_ur_l.id_ur = ur_l.id");
     $db->Where(['=', 'region_ur_l.id_reg', $region_id]);
     $db->andWhere(['=', 'ur_l.plat', '1']);
     $db->andwhere(['=', 'ur_l.regional_id', $regional_id]);
     $db->orderBy('ur_l.name ASC');
     $return = $db->all();
     return $return;
 }
예제 #9
0
 public function actionUpdate($id)
 {
     $users_pi = Users::find()->select(['id', 'username'])->where(['status' => '3'])->orderBy('username')->all();
     $pi = ArrayHelper::map($users_pi, 'id', 'username');
     $users_regional = Users::find()->select(['id', 'username'])->where(['status' => '2'])->orderBy('username')->all();
     $regional = ArrayHelper::map($users_regional, 'id', 'username');
     $urf = Ur::find()->select(['id', 'name'])->orderBy('name')->all();
     $ur = ArrayHelper::map($urf, 'id', 'name');
     $model = $this->findModel($id);
     $urOne = Ur::findOne($model['ur_l_id']);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // return $this->render(['update', 'id' => $model->id,'ok'=>'1','pi'=>$pi,'regional'=>$regional ,'ur'=>$ur]);
         return $this->render('update', ['model' => $model, 'pi' => $pi, 'regional' => $regional, 'ur' => $ur, 'urOne' => $urOne, 'ok' => '1']);
     } else {
         return $this->render('update', ['model' => $model, 'pi' => $pi, 'regional' => $regional, 'urOne' => $urOne, 'ur' => $ur]);
     }
 }
예제 #10
0
파일: UrRegion.php 프로젝트: pumi11/aau
 public function getUrRecord()
 {
     return $this->hasOne(Ur::className(), ['id' => 'id_ur']);
 }
예제 #11
0
 /**
  * Updates an existing ValidationReport model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $model2 = ValidationReportViolation::find()->select('violation_id')->where(['report_id' => $id])->column();
     $model->user_id = \Yii::$app->user->identity->id;
     $UrRecords = Ur::find()->orderBy('name');
     if (\Yii::$app->user->identity->status == 2) {
         $UrRecords = $UrRecords->Where(['regional_id' => \Yii::$app->user->identity->id]);
     }
     if (\Yii::$app->user->identity->status == 3) {
         $UrRecords = $UrRecords->Where(['pi_id' => \Yii::$app->user->identity->id]);
     }
     $UrRecords = $UrRecords->all();
     if ($model->load(Yii::$app->request->post())) {
         // ValidationReportViolation::deleteAll("report_id = $model->report_id");
     }
     $ur_l = Apteki::findOne($model->apteka_id);
     $ur_l_id = $ur_l['ur_l_id'];
     $apteki = Apteki::find()->where(['ur_l_id' => $ur_l_id])->orderBy(['address' => 'desc'])->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         ValidationReportViolation::deleteAll(['report_id' => $model->id]);
         $post = Yii::$app->request->post();
         if ($post['v']) {
             foreach ($post['v'] as $key => $item) {
                 Yii::$app->db->createCommand()->insert('validation_report_violation', ['report_id' => $model->id, 'violation_id' => (int) $key])->execute();
             }
         }
         return $this->redirect(['index', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model, 'UrRecords' => $UrRecords, 'model2' => $model2, 'ur_l_id' => $ur_l_id, 'apteki' => $apteki]);
     }
 }
예제 #12
0
파일: view.php 프로젝트: pumi11/aau
use app\models\Users;
/* @var $this yii\web\View */
/* @var $model app\models\UrQuestions */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Юридические вопросы', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ur-questions-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <!--
    <p>
        <?php 
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>
    -->

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => [['label' => 'Юридическое лицо', 'value' => ArrayHelper::getValue(Ur::findOne($model->ur_l_id), 'name')], ['label' => 'Отправлен', 'value' => ArrayHelper::getValue(Users::findOne($model->user_id), 'username')], 'question:ntext', 'ansver:ntext', ['label' => 'Файлы', 'format' => 'raw', 'value' => $model->viewFiles($model->qfiles)], 'created_at', 'date_ansver']]);
?>

</div>
예제 #13
0
 public function actionModalneoplatili2($ur_ls)
 {
     $url = explode(",", $ur_ls);
     $ur = Ur::find()->where(['id' => $url])->andWhere(['plat' => 1])->orderBy('name')->all();
     $this->layout = 'modal_400';
     return $this->render('modalneoplatili', compact(['ur']));
     //  return $this->render('index');
 }
예제 #14
0
파일: UrController.php 프로젝트: pumi11/aau
 public function actionExample()
 {
     $UrRecords = Ur::findOne(1);
     $RegionRecords = [Region::findOne(2), Region::findOne(3)];
     $extraColumns = [];
     // extra columns to be saved to the many to many table
     $unlink = true;
     // unlink tags not in the list
     $delete = true;
     // delete unlinked tags
     $UrRecords->linkAll('RegionRecords', $RegionRecords, $extraColumns, $unlink, $delete);
     $UrRecords->save();
     // var_dump($UrRecords);
     // exit;
 }
예제 #15
0
 /**
  * пароль для юр лица
  */
 public function actionUpdate2($id)
 {
     //   $this->layout = 'modal';
     $model = SbSiteUsers::findOne(['ur_l_id' => $id]);
     if ($model == null) {
         $model = new SbSiteUsers();
         $save = 1;
     }
     if (Yii::$app->request->isAjax) {
         $model->load($_POST);
         Yii::$app->response->format = 'json';
         return ActiveForm::validate($model);
     } elseif ($model->load($_POST)) {
         $model->ur_l_id = $id;
         $model->su_domains = "sojuzpharma.ru";
         $model->su_pass = md5($model->password_simple);
         //Получаеи информацию об аптеки
         $apt = Ur::findOne(['id' => $id]);
         $model->su_name = $apt['name'];
         $model->su_email = $apt['contact_mail'];
         if ($_POST['sendMail']) {
             \Yii::$app->mail->compose('ur_l_pass', ['login' => $model->su_id, 'pass' => $model->password_simple, 'name' => $apt['name'], 'contact_face' => $apt['contact_face']])->setFrom([\Yii::$app->params['infoEmail'] => 'СоюзФарма'])->setTo($apt['contact_mail'])->setSubject('Для вашего юр.лица заведена учетная запись')->send();
         }
         if ($model->save()) {
             if ($save) {
                 $model3 = SbSiteUsers::findOne(['ur_l_id' => $id]);
                 $model3->su_login = $model->su_id;
                 $model3->save();
                 $model2 = new SbCatlinks();
                 $model2->link_cat_id = '21';
                 $model2->link_el_id = $model->su_id;
                 $model2->save();
             }
             return $this->redirect(['/ur/update', 'id' => $model->ur_l_id]);
         }
     } else {
         return $this->render('update', ['model' => $model, 'id' => $id]);
     }
 }