Ejemplo n.º 1
0
 public function getResudie($id_type, $date1, $date2)
 {
     $query = Order::find()->where(['type_ticket' => $id_type]);
     $query = $query->andWhere(['<=', 'date', $date1]);
     $query = $query->andWhere(['>=', 'date', $date2]);
     $orders = $query->all();
     foreach ($orders as $order) {
         $id_order[] = $order->id;
     }
     if (isset($id_order) and count($id_order) > 0) {
         $RelOrderPeople = RelOrderPeople::find()->where(['id_order' => $id_order]);
         $r = $RelOrderPeople->count();
     } else {
         $r = 0;
     }
     switch ($id_type) {
         case 1:
             $r = $this->individual - $r;
             break;
         case 2:
             $r = $this->sertificate - $r;
             break;
         case 3:
             $r = $this->shool_vizit - $r;
             break;
         case 4:
             $r = $this->meropriyatie - $r;
             break;
         case 5:
             $r = $this->corpototive_vizit - $r;
             break;
         case 6:
             $r = $this->programm - $r;
             break;
         case 7:
             $r = $this->abonement - $r;
             break;
     }
     return $r;
 }
Ejemplo n.º 2
0
 function actionGetKidsParents()
 {
     $mentor = Mentor::findOne(['token' => $this->get["token"]]);
     $kids = Kids::findOne(['qr' => $this->get["qr"]]);
     $parents = array();
     $r = array();
     if (!$mentor) {
         $r = $this->setError(205);
     } else {
         if (!$kids) {
             $kidRelOrderPeople = RelOrderPeople::findOne(["qr" => $this->get["qr"]]);
             if ($kidRelOrderPeople) {
                 $type_people = $kidRelOrderPeople->type_people;
                 if ($type_people == 2) {
                     $kids = Kids::findOne(["id" => $kidRelOrderPeople->id_people]);
                     $RelOrderPeople = RelOrderPeople::find()->where("id_people='" . $kids->id . "' AND type_people=2 ")->asArray()->all();
                     if ($RelOrderPeople) {
                         foreach ($RelOrderPeople as $val) {
                             $mIDOrder = $val["id_order"];
                             $mRelOrderPeople = RelOrderPeople::find()->where("id_order='" . $mIDOrder . "' AND type_people=1 ")->asArray()->all();
                             if ($mRelOrderPeople) {
                                 $i = 0;
                                 foreach ($mRelOrderPeople as $relVal) {
                                     $mIDParent = $relVal["id_people"];
                                     $mParent = Parents::findOne(['id' => $mIDParent]);
                                     if ($mParent) {
                                         $parents[$i]["name"] = $mParent->name;
                                         $parents[$i]["surname"] = $mParent->surname;
                                         $parents[$i]["father_name"] = $mParent->father_name;
                                         $parents[$i]["phone_number"] = $mParent->phone;
                                         $parents[$i]["email"] = $mParent->email;
                                     }
                                     $i++;
                                 }
                             }
                         }
                     }
                     if ($parents) {
                         $r["status"] = "ok";
                         $r["parent_list"] = $parents;
                     } else {
                         $r = $this->setError(205);
                     }
                 } elseif ($type_people == 1) {
                     $r = $this->setError(301);
                 } else {
                     $r = $this->setError(301);
                 }
             } else {
                 $r = $this->setError(301);
             }
         } else {
             $RelOrderPeople = RelOrderPeople::find()->where("id_people='" . $kids->id . "' AND type_people=2 ")->asArray()->all();
             if ($RelOrderPeople) {
                 foreach ($RelOrderPeople as $val) {
                     $mIDOrder = $val["id_order"];
                     $mRelOrderPeople = RelOrderPeople::find()->where("id_order='" . $mIDOrder . "' AND type_people=1 ")->asArray()->all();
                     if ($mRelOrderPeople) {
                         $i = 0;
                         foreach ($mRelOrderPeople as $relVal) {
                             $mIDParent = $relVal["id_people"];
                             $mParent = Parents::findOne(['id' => $mIDParent]);
                             if ($mParent) {
                                 $parents[$i]["name"] = $mParent->name;
                                 $parents[$i]["surname"] = $mParent->surname;
                                 $parents[$i]["father_name"] = $mParent->father_name;
                                 $parents[$i]["phone_number"] = $mParent->phone;
                                 $parents[$i]["email"] = $mParent->email;
                             }
                             $i++;
                         }
                     }
                 }
             }
             if ($parents) {
                 $r["status"] = "ok";
                 $r["parent_list"] = $parents;
             } else {
                 $r = $this->setError(205);
             }
         }
     }
     return json_encode($r);
 }
Ejemplo n.º 3
0
 public function actionReport()
 {
     $get = Yii::$app->request->get();
     $user = Yii::$app->user;
     if (isset($get["id"])) {
         $id = $get["id"];
         $RelOrderPeople = RelOrderPeople::findOne($id);
         $mOrderID = $RelOrderPeople->id_order;
         $order = Order::findOne($RelOrderPeople->id_order);
         if ($order->id_user != $user->id) {
             exit;
         }
         if ($RelOrderPeople->type_people == 2) {
             $people = Kids::findOne($RelOrderPeople->id_people);
         } elseif ($RelOrderPeople->type_people == 1) {
             $people = Parents::findOne($RelOrderPeople->id_people);
         }
         $name = $people->surname . " " . $people->name;
         $old = $this->getyeardiff($people->birthday, $mOrderID);
         $TypeTicket = TypeTicket::findOne($RelOrderPeople->type_tiket);
         $name_tiket = $TypeTicket->name;
         $time = $order->count_hours;
         $date = date("d.m.Y", $order->date);
         $price = $RelOrderPeople->summ / 100;
         $pitanie = $RelOrderPeople->pitanie;
         $qr = $RelOrderPeople->qr;
         $money = 0;
         if ($RelOrderPeople->type_people == "2") {
             $money = 50;
         }
         $d = $order->date;
         $date2 = date("d.m.Y", mktime(0, 0, 0, date("m", $d) + 6, date("d", $d), date("Y", $d)));
     }
     $myview = $this->renderPartial("test_t", ["name" => $name, "old" => $old, "name_tiket" => $name_tiket, "time" => $time, "date" => $date, "price" => $price, "pitanie" => $pitanie, "qr" => $qr, "date2" => $date2, "money" => $money]);
     $d = new mPDF('utf-8', 'A4', '8', '', 0, 0, 0, 0, 0, 0);
     $d->writeHTML($myview);
     $d->charset_in = 'utf-8';
     $d->list_indent_first_level = 0;
     $d->WriteHTML($html, 2);
     $d->Output('mpdf.pdf', 'I');
     $d->output();
 }