Exemple #1
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();
 }
Exemple #2
0
 public function actionUpdate($year, $kvartal, $ur)
 {
     $url = Ur::find()->where(['id' => $ur])->one();
     $model = Vznos::find()->where(['year' => $year])->andWhere(['kvartal' => $kvartal])->andWhere(['ur_id' => $url['id']])->one();
     if (!$model) {
         $model = new Vznos();
         $model->summa = \Yii::$app->params['summa_vznosa'];
     }
     $model->year = (int) $year;
     $model->kvartal = (int) $kvartal;
     $model->ur_id = (int) $ur;
     if ($model->date_plat) {
         $model->date_plat = date('d.m.Y', strtotime($model->date_plat));
     }
     if ($model->load(\Yii::$app->request->post())) {
         if ($model->date_plat) {
             $model->date_plat = date('Y-m-d', strtotime($model->date_plat));
         }
         if ($model->validate() && $model->save()) {
             return $this->redirect(["/vznos/?scroll={$model->ur_id}"]);
         }
     }
     //$this->layout = 'modal';
     return $this->render('update', ['ur' => $url, 'year' => $year, 'kvartal' => $kvartal, 'model' => $model]);
 }
Exemple #3
0
 public static function Oplatalili($ids)
 {
     return Vznos::find()->where(['ur_id' => $ids])->all();
 }