| @@ -202,9 +202,22 @@ class UserController extends AbstractController | |||
| throw new \Exception('not allowed or not exists'); | |||
| } | |||
| $sortedWorksheetTasks = $worksheet->getUserWorkSheetTasks()->toArray(); | |||
| usort($sortedWorksheetTasks, function($a, $b) { | |||
| $delimComparison = strcmp($a->getDelimitation(), $b->getDelimitation()); | |||
| if ($delimComparison === 0) { | |||
| return strcmp($a->getTask(), $b->getTask()); | |||
| } | |||
| return $delimComparison; | |||
| }); | |||
| return $this->render('pages/worksheet.html.twig', | |||
| [ | |||
| 'worksheet' => $worksheet, | |||
| 'sortedWorksheetTasks' => $sortedWorksheetTasks, | |||
| 'isPdf' => false | |||
| ] | |||
| ); | |||
| @@ -52,8 +52,21 @@ class CalculatorService | |||
| $res[self::KEY_REC_CYCLE_MAINTENANCE] = $recCycleMaintenance; | |||
| $res[self::KEY_REC_CYCLE_INSPECTION] = $recCycleInspection; | |||
| $res[self::KEY_COST_DIFF_CUR_REC_PERCENTAGE] = round($costDiffCurRecPercentage, 2); | |||
| $res[self::KEY_COST_DIFF_CUR_REC_CYCLE] = round($costDiffCurCycleRecCycle, 2); | |||
| $res[self::KEY_COST_DIFF_CUR_REC_CYCLE] = $this->customRounding($costDiffCurCycleRecCycle); | |||
| return $res; | |||
| } | |||
| private function customRounding($number) | |||
| { | |||
| $roundedNumber = round($number); | |||
| $roundedNumberStr = (string)$roundedNumber; | |||
| $numDigitsBeforeComma = strlen($roundedNumberStr); | |||
| if ($numDigitsBeforeComma <= 2) { | |||
| return $roundedNumber; | |||
| } else { | |||
| return round($number, ($numDigitsBeforeComma - 2) * -1); | |||
| } | |||
| } | |||
| } | |||
| @@ -65,7 +65,7 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <h2>Zyklus und Bandbreite</h2> | |||
| <h2>Zyklus und Größencluster</h2> | |||
| <div class="row-box"> | |||
| <div class="col-box"> | |||
| <div class="form-fields"> | |||
| @@ -79,7 +79,7 @@ | |||
| </div> | |||
| <div class="col-box"> | |||
| <div class="form-fields"> | |||
| <label for="benchmark">Bandbreite Anlage</label> | |||
| <label for="benchmark">Größencluster</label> | |||
| <select name="benchmark" id="benchmark"> | |||
| {% for key, benchmarkValue in benchmarkValues %} | |||
| <option value="{{ key }}">{{ benchmarkValue }}</option> | |||
| @@ -88,13 +88,13 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <span class="btn" id="calculate">Berechnen</span> | |||
| <span class="btn" id="calculate">Potenzial ermitteln</span> | |||
| </div> | |||
| </div> | |||
| <div class="col-box"> | |||
| <div class="result-box" id="result-box"> | |||
| <h3>Ergebnis</h3> | |||
| <p class="result-not-existing">Bitte erst berechnen!</p> | |||
| <p class="result-not-existing">Bitte erst Potenzial ermitteln!</p> | |||
| <div class="result-existing"> | |||
| <dl> | |||
| <dt>Inspektion<br /> | |||
| @@ -24,14 +24,14 @@ | |||
| </tr> | |||
| </table> | |||
| <h3>Zyklus und Bandbreite</h3> | |||
| <h3>Zyklus und Größencluster</h3> | |||
| <table class="mini-table"> | |||
| <tr> | |||
| <td><span>Aktueller Zyklus (in Monaten)</span></td> | |||
| <td>{{ worksheet.userCycleMonths }}</td> | |||
| </tr> | |||
| <tr> | |||
| <td><span>Bandbreite Anlage</span></td> | |||
| <td><span>Größencluster</span></td> | |||
| <td>{% if worksheet.bandwidth is not null %}{{ worksheet.bandwidth }}{% else %}-{% endif %}</td> | |||
| </tr> | |||
| </table> | |||
| @@ -64,9 +64,9 @@ | |||
| <tr> | |||
| <th></th> | |||
| <th><span>Aufgabe</span></th> | |||
| <th><span>Abgrenzung</span></th> | |||
| <th><span>Baugruppen</span></th> | |||
| <th class="ins-2"><span>Inspektion</span></th> | |||
| <th class="ins-2"><span>Wartung</span></thins-2> | |||
| <th class="ins-2"><span>Wartung</span></th> | |||
| <th class="ins-2"><span>Instandsetzung</span></th> | |||
| <th><span>Sachverständiger</span></th> | |||
| <th><span>Sachkundige</span></th> | |||
| @@ -75,7 +75,7 @@ | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| {% for index, task in worksheet.userWorkSheetTasks %} | |||
| {% for index, task in sortedWorksheetTasks %} | |||
| <tr> | |||
| <td>{{ index + 1 }}. </td> | |||
| <td>{{ task.task }}</td> | |||
| @@ -133,7 +133,7 @@ | |||
| <h4>{{ index + 1 }}. {{ task.task }}</h4> | |||
| <table class="mini-table fifty-fifty"> | |||
| <tr> | |||
| <td>Abgrenzung</td> | |||
| <td>Baugruppen</td> | |||
| <td>{% if task.delimitation is not null %}{{ task.delimitation }}{% else %}-{% endif %}</td> | |||
| </tr> | |||
| {% if task.inspection == 1 %} | |||