public function getData() { # Получили всех инструкторов $instructors = Driver::findAll('instructor'); $payments = array(); # Получить все патежи клиентов foreach ($instructors as $i) { $payments[$i->getId()] = Driver::payment('Instructor', $i->getId(), new \DateTime()); } # Получить стоимость аренды помещения $roomPrices = new RoomPrices(); # Получить ЗП инструктора $instructorPrices = new InstructorPrices(); return array('instructors' => $instructors, 'payments' => $payments, 'roomPrices' => $roomPrices, 'instructorPrices' => $instructorPrices); }
foreach ($room->getGroups() as $id) { $roomRent = \Model\Driver::roomRent($id); } $tmp3 = 0; for ($i = 1; $i <= 12; $i++) { echo '<td class="text-center">' . $roomRent[$i] . '</td>'; $tmp3 += $roomRent[$i]; } echo '<td class="text-center">' . $tmp3 . '</td>'; echo '</tr>'; echo '<tr class="group-' . $key . '">'; echo '<td>Зарплата</td>'; $userSalary['plan'] = array(); $userSalary['fact'] = array(); foreach ($room->getGroups() as $id) { $userSalaryTmp = \Model\Driver::userSalary($id); // $userSalary['plan'] = mergeArray($userSalary['plan'],$userSalaryTmp['plan']); $userSalary = mergeArray($userSalary, $userSalaryTmp); } $tmp4['plan'] = 0; $tmp4['fact'] = 0; for ($i = 1; $i <= 12; $i++) { echo '<td class="text-center">' . $userSalary[$i]['plan'] . ' <br /> ' . $userSalary[$i]['fact'] . '</td>'; $tmp4['plan'] += $userSalary[$i]['plan']; $tmp4['fact'] += $userSalary[$i]['fact']; } echo '<td class="text-center">' . $tmp4['plan'] . ' <br /> ' . $tmp4['fact'] . '</td>'; echo '</tr>'; echo '<tr class="group-' . $key . '">'; echo '<td>Опер. прибыль</td>'; $tmp5 = 0;
} echo '<td class="text-center">' . $tmp2['plan'] . ' <br /> ' . $tmp2['fact'] . '</td>'; echo '</tr>'; echo '<tr class="group-' . $key . '">'; echo '<td>Аренда</td>'; $roomRent = \Model\Driver::roomRent($group->getId()); $tmp3 = 0; for ($i = 1; $i <= 12; $i++) { echo '<td class="text-center">' . $roomRent[$i] . '</td>'; $tmp3 += $roomRent[$i]; } echo '<td class="text-center">' . $tmp3 . '</td>'; echo '</tr>'; echo '<tr class="group-' . $key . '">'; echo '<td>Зарплата</td>'; $userSalary = \Model\Driver::userSalary($group->getId()); $tmp4['plan'] = 0; $tmp4['fact'] = 0; for ($i = 1; $i <= 12; $i++) { echo '<td class="text-center">' . $userSalary[$i]['plan'] . ' <br /> ' . $userSalary[$i]['fact'] . '</td>'; $tmp2['plan'] += $userSalary[$i]['plan']; $tmp2['fact'] += $userSalary[$i]['fact']; } echo '<td class="text-center">' . $tmp4['plan'] . ' <br /> ' . $tmp4['fact'] . '</td>'; echo '</tr>'; echo '<tr class="group-' . $key . '">'; echo '<td>Опер. прибыль</td>'; $tmp5 = 0; for ($i = 1; $i <= 12; $i++) { $s = $userSale[$i] - $roomRent[$i] - $userSalary[$i]['fact']; echo '<td class="text-center">' . $s . '</td>';
$namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; require $fileName; } spl_autoload_register('autoload'); if ($_GET['pdf'] == 1) { $htmlOut = file_get_contents('http://aik.loc/index.php?type=' . $_GET['type']); $mpdf = new mPDF('utf-8', 'A4-L', '', '', 22, 14, 12, 23, 9, 9); // $mpdf->charset_in = 'utf-8'; $mpdf->SetDisplayMode('fullpage'); $mpdf->list_indent_first_level = 0; $mpdf->WriteHTML($htmlOut); $mpdf->Output("filename.pdf", 'I'); } else { # Далее код $db = new Driver(); $db->connect(); if ($_GET['type'] == 'group') { $groups = $db->findAll('group'); include 'Views/main.php'; } elseif ($_GET['type'] == 'instructor') { $instructors = $db->findAll('instructor'); include 'Views/instructor.php'; } elseif ($_GET['type'] == 'room') { $rooms = $db->findAll('room'); include 'Views/room.php'; } }