protected function parent4process_task() { $query = Pilotplan::find(); $ctg = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 200]]); $arr = []; foreach ($ctg->getModels() as $t) { if ($t->PLAN_DATE1 != '' and $t->PLAN_DATE2 != '') { $arr[] = $t; if ($t->ACTUAL_DATE1 != '' and $t->ACTUAL_DATE2 != '') { $querySub1 = Pilotactual::find()->Where('ID=' . $t->ID); $sub1 = new ActiveDataProvider(['query' => $querySub1, 'pagination' => ['pageSize' => 200]]); foreach ($sub1->getModels() as $su1) { $arr[] = $su1; if ($t->ACTUAL_DATE2 != '' and $su1->ACTUAL_DATE2 != '' and $su1->ACTUAL_DATE2 > $t->PLAN_DATE2) { $querySub2 = Pilotdelay::find()->Where('ID=' . $t->ID); $sub2 = new ActiveDataProvider(['query' => $querySub2, 'pagination' => ['pageSize' => 200]]); foreach ($sub2->getModels() as $su2) { $arr[] = $su2; } } } } } } //return $arr; return Json::encode($arr); }
protected function parent4process_task() { $request = Yii::$app->request; $userid = $request->get('id_user'); $query = Pilotplan::find()->Where('CREATED_BY=' . $userid); $ctg = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 200]]); $arr = []; foreach ($ctg->getModels() as $t) { /*PLAN RUN*/ if ($t->PLAN_DATE1 != '' and $t->PLAN_DATE2 != '') { $arr[] = $t; /*ACTUAL RUN*/ if ($t->ACTUAL_DATE1 != '' and $t->ACTUAL_DATE2 != '') { $querySub1 = Pilotactual::find()->Where('ID=' . $t->ID); $sub1 = new ActiveDataProvider(['query' => $querySub1, 'pagination' => ['pageSize' => 200]]); foreach ($sub1->getModels() as $su1) { $arr[] = $su1; $querySub2 = Pilotdelay::find()->Where('ID=' . $t->ID); $sub2 = new ActiveDataProvider(['query' => $querySub2, 'pagination' => ['pageSize' => 200]]); /*RUN DELAY*/ foreach ($sub2->getModels() as $su2) { $arr[] = $su2; } } } } } //return $arr; return Json::encode($arr); }