$sum1 = $accountData[$year][4574] + $accountData[$year][4340] + $accountData[$year][4573] + $accountData[$year][4575] + $accountData[$year][4572] + $accountData[$year][4580]; $sum2 = $accountData[$year - 1][4574] + $accountData[$year - 1][4340] + $accountData[$year - 1][4573] + $accountData[$year - 1][4575] + $accountData[$year - 1][4572] + $accountData[$year - 1][4580]; $sum3 = $accountData[$year - 2][4574] + $accountData[$year - 2][4340] + $accountData[$year - 2][4573] + $accountData[$year - 2][4575] + $accountData[$year - 2][4572] + $accountData[$year - 2][4580]; $diff1 = $sum2 != 0 ? ($sum1 - $sum2) / $sum2 : 'NA'; $diff2 = $sum3 != 0 ? ($sum2 - $sum3) / $sum3 : 'NA'; $historyList->addElements(['SUM', number_format($accountData[$year][4574], 2), number_format($accountData[$year][4340], 2), number_format($accountData[$year][4573], 2), number_format($accountData[$year][4575], 2), number_format($accountData[$year][4572], 2), number_format($accountData[$year][4580], 2), number_format($sum1, 2), number_format(number_format($diff1 * 100, 2), 2) . '%', number_format($accountData[$year - 1][4574], 2), number_format($accountData[$year - 1][4340], 2), number_format($accountData[$year - 1][4573], 2), number_format($accountData[$year - 1][4575], 2), number_format($accountData[$year - 1][4572], 2), number_format($accountData[$year - 1][4580], 2), number_format($sum2, 2), number_format(number_format($diff2 * 100, 2), 2) . '%', number_format($accountData[$year - 2][4574], 2), number_format($accountData[$year - 2][4340], 2), number_format($accountData[$year - 2][4573], 2), number_format($accountData[$year - 2][4575], 2), number_format($accountData[$year - 2][4572], 2), number_format($accountData[$year - 2][4580], 2), number_format($sum3, 2)]); foreach ($cars as $key => $car) { $sum1 = $carData[$key][$year][4574] + $carData[$key][$year][4340] + $carData[$key][$year][4573] + $carData[$key][$year][4575] + $carData[$key][$year][4572] + $carData[$key][$year][4580]; $sum2 = $carData[$key][$year - 1][4574] + $carData[$key][$year - 1][4340] + $carData[$key][$year - 1][4573] + $carData[$key][$year - 1][4575] + $carData[$key][$year - 1][4572] + $carData[$key][$year - 1][4580]; $sum3 = $carData[$key][$year - 2][4574] + $carData[$key][$year - 2][4340] + $carData[$key][$year - 2][4573] + $carData[$key][$year - 2][4575] + $carData[$key][$year - 2][4572] + $carData[$key][$year - 2][4580]; $diff1 = $sum2 != 0 ? ($sum1 - $sum2) / $sum2 : 'NA'; $diff2 = $sum3 != 0 ? ($sum2 - $sum3) / $sum3 : 'NA'; $historyList->addElements([$key, number_format($carData[$key][$year][4574], 2), number_format($carData[$key][$year][4340], 2), number_format($carData[$key][$year][4573], 2), number_format($carData[$key][$year][4575], 2), number_format($carData[$key][$year][4572], 2), number_format($carData[$key][$year][4580], 2), number_format($sum1, 2), number_format($diff1 * 100, 2) . '%', number_format($carData[$key][$year - 1][4574], 2), number_format($carData[$key][$year - 1][4340], 2), number_format($carData[$key][$year - 1][4573], 2), number_format($carData[$key][$year - 1][4575], 2), number_format($carData[$key][$year - 1][4572], 2), number_format($carData[$key][$year - 1][4580], 2), number_format($sum2, 2), number_format($diff2 * 100, 2) . '%', number_format($carData[$key][$year - 2][4574], 2), number_format($carData[$key][$year - 2][4340], 2), number_format($carData[$key][$year - 2][4573], 2), number_format($carData[$key][$year - 2][4575], 2), number_format($carData[$key][$year - 2][4572], 2), number_format($carData[$key][$year - 2][4580], 2), number_format($sum3, 2)]); } $tabView->addTab($lang['History'], $historyList->getOutput(), 'history'); /* * UI Logic */ $planningList = new \Web\Views\Lists\ListView($this->l11n, $this->request, $this->response); $planningListHeaderView = new \Web\Views\Lists\HeaderView($this->l11n, $this->request, $this->response); $planningList->setTemplate('/Web/Templates/Lists/ListFull'); $planningListHeaderView->setTemplate('/Web/Templates/Lists/Header/HeaderTable'); /* * Header */ $planningListHeaderView->setTitle($lang['Plan']); $planningListHeaderView->setHeader([['title' => $lang['ID'], 'sortable' => true], ['title' => $lang['Owner'], 'sortable' => true, 'full' => true], ['title' => $lang['Leasing'], 'sortable' => true], ['title' => $lang['Tax'], 'sortable' => true], ['title' => $lang['Rep./Insp.'], 'sortable' => true], ['title' => $lang['Wheels'], 'sortable' => true], ['title' => $lang['Gas'], 'sortable' => true], ['title' => $lang['Misc'], 'sortable' => true], ['title' => $lang['Sum'], 'sortable' => true], ['title' => $lang['Diff'], 'sortable' => true], ['title' => $lang['Leasing'], 'sortable' => true], ['title' => $lang['Tax'], 'sortable' => true], ['title' => $lang['Rep./Insp.'], 'sortable' => true], ['title' => $lang['Wheels'], 'sortable' => true], ['title' => $lang['Gas'], 'sortable' => true], ['title' => $lang['Misc'], 'sortable' => true], ['title' => $lang['Sum'], 'sortable' => true], ['title' => $lang['Diff'], 'sortable' => true], ['title' => $lang['Leasing'], 'sortable' => true], ['title' => $lang['Tax'], 'sortable' => true], ['title' => $lang['Rep./Insp.'], 'sortable' => true], ['title' => $lang['Wheels'], 'sortable' => true], ['title' => $lang['Gas'], 'sortable' => true], ['title' => $lang['Misc'], 'sortable' => true], ['title' => $lang['Sum'], 'sortable' => true]]); $planningList->setFreeze(3, 2); $planningList->addView('header', $planningListHeaderView); $tabView->addTab($lang['Planning'], $planningList->getOutput(), 'planning'); echo $tabView->render();
$permissionListView->addView('header', $headerView); $this->addView('permissionList', $permissionListView); $tabView->addTab($this->l11n->lang[27]['Overview'], $overviwPanel->getOutput() . $permissionPanel->getOutput() . $permissionListView->render(), 'overview'); /* * UI Logic */ $sourceList = new \Web\Views\Lists\ListView($this->l11n, $this->request, $this->response); $sourceListHeaderView = new \Web\Views\Lists\HeaderView($this->l11n, $this->request, $this->response); $sourceList->setTemplate('/Web/Templates/Lists/ListFull'); $sourceListHeaderView->setTemplate('/Web/Templates/Lists/Header/HeaderTable'); /* * Header */ $sourceListHeaderView->setTitle($this->l11n->lang[27]['Sources']); $sourceListHeaderView->setHeader([['title' => $this->l11n->lang[0]['ID'], 'sortable' => true], ['title' => $this->l11n->lang[27]['Name'], 'sortable' => true, 'full' => true], ['title' => $this->l11n->lang[27]['Created'], 'sortable' => true], ['title' => $this->l11n->lang[27]['CreatedBy'], 'sortable' => true]]); $sourceList->setFreeze(3, 2); $sourceList->addView('header', $sourceListHeaderView); $tabView->addTab($this->l11n->lang[27]['Sources'], $sourceList->getOutput(), 'sources'); /* * Create */ $createPanel = new \Web\Views\Panel\PanelView($this->l11n, $this->request, $this->response); $mediaPanel = clone $createPanel; $createPanel->setTitle($this->l11n->lang[0]['Create']); $mediaPanel->setTitle($this->l11n->lang[27]['Media']); $this->addView('createFormPanel', $createPanel); $this->getView('createFormPanel')->setTemplate('/Web/Templates/Panel/BoxHalf'); $this->addView('permissionFormPanel', $mediaPanel); $this->getView('permissionFormPanel')->setTemplate('/Web/Templates/Panel/BoxHalf'); $formCreateForm = new \Web\Views\Form\FormView($this->l11n, $this->request, $this->response); $formCreateForm->setTemplate('/Web/Templates/Forms/FormFull');