
<style type="text/css" media="print">
    @page { size: landscape; }
</style>


<!-- Component Default begin -->
<script language="JavaScript" src="modules/reporting/javascript/reporting.js" type="text/JavaScript"></script>
[% if $list_field == 'deffield' %]
    <link rel="stylesheet" type="text/css" href="includes/js/select2/css/select2.min.css"/>
    <script type="text/javascript" src="includes/js/select2/js/select2.full.min.js"></script>
    <script type="text/javascript" src="includes/js/select2/js/i18n/de.js"></script>
[% /if %]

<!-- ###CONTENT### begin -->
<form  action="index.php?module=reporting&event=[% $ReportingSubpage %]" method="post" name="HM-Form-Report" id="HM-Form-Report" enctype="multipart/form-data" class="form-inline">
    <input type="hidden" name="pos" id="pos" value="[% $pos %]" />
    <input type="hidden" name="sorting" id="sorting" value="[% $sorting %]" />
    <input type="hidden" name="sortOrder" id="sortOrder" value="[% $sortOrder %]" />
    <input type="hidden" name="action" id="action" value="" />
    <div class="card panel-fcs-border shadow-sm hidden-print">
        <div class="card-header">
            <span class="fcs-card-title h2">
                [% $ReportingHeader %]
            </span>
        </div>
        <div class="card-body">

            <div class="card panel-info shadow-sm rounded">
                <div class="card-body">
                    <div class="col-sm-12">
                        [% if $list_field == 'deffield' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Felder')%]:</label>
                                <select class="form-control" name="FieldID" id="FieldID" onchange="$('#HM-Form-Report').submit();">
                                    <option value="" [% if $NoField %]selected="selected"[% /if %]>[% $user->gettext('Feld wählen') %]</option>
                                    [% foreach from=$DefFieldList item=$Field %]
                                        <option value="[% $Field.id %]" [% if $Field.id == $fieldValue %]selected="selected"[% /if %]>[% $Field.name %]</option>
                                    [% /foreach %]
                                </select>
                            </div>
                        [% /if %]

                        <div class="form-group">
                            <label class="control-label">[% $user->gettext('Filter')%]:</label>
                            <input type="text" class="form-control" name="filter" id="filter" value="[% $smarty.session.Reporting.filter %]" >
                        </div>
                        [% if $ReportingUsedTicketDate %]
                            <div class="form-group">             
                                <select name='TicketDateType' class='form-control' onchange="setAction(''); $('#HM-Form-Report').submit();">
                                    <option value='EditDate' [% if $TicketDateType != 'UpdateDate' %]selected[% /if %]>[% $user->gettext('Erstelldatum') %]</option>
                                    <option value='UpdateDate' [% if $TicketDateType == 'UpdateDate' %]selected[% /if %]>[% $user->gettext('Bearbeitungsdatum') %]</option>
                                </select>
                            </div>     
                        [% /if %]

                        <div class="form-group">
                            <label class="control-label">[% $user->gettext('Von')%]:</label>
                            <input type="text" class="form-control datepicker" value="[% $smarty.session.Reporting.startdate %]" name="startdate" id="startdate" onchange="setAction(''); $('#HM-Form-Report').submit();" style="width: 6em;"/>
                        </div>

                        <div class="form-group">
                            <label class="control-label">[% $user->gettext('Bis')%]:</label>
                            <input type="text" class="form-control datepicker" value="[% $smarty.session.Reporting.enddate %]" name="enddate" id="enddate" onchange="setAction(''); $('#HM-Form-Report').submit();" style="width: 6em;"/>
                        </div>

                        <div class="form-group">
                            <select class="form-control" name="period" onchange="changePeriod(this);">
                                <option value="0" selected="selected">[% $user->gettext('Zeitraum') %]</option>
                                <option value="99" >[% $user->gettext('Heute') %]</option>
                                <option value="1" >[% $user->gettext('Gestern') %]</option>
                                <option value="2" >[% $user->gettext('Letzte Woche') %]</option>
                                <option value="3" >[% $user->gettext('Letzten Monat') %]</option>
                                <option value="4" >[% $user->gettext('Letztes Jahr') %]</option>
                                <option value="5" >[% $user->gettext('Aktuelles Jahr') %]</option>
                                [% if $timing_add %]
                                    [% foreach from=$timing_add key=k item=v %]
                                        <option value="[% $v.id %]">[% $k %]</option>
                                    [% /foreach %]
                                [% /if %]
                            </select>
                        </div>

                        [% if $ReportingSubpage == 'tcat' ||  $ReportingSubpage == 'tcatkumu' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Kategorie')%]:</label>
                                <select name="category_id" onchange="$('#HM-Form-Report').submit();" class="form-control multiple">
                                    <option value="0">-- [% $user->gettext('-- Alle --') %] --</option>
                                    [% html_options options=$categories selected=$category_id %]
                                </select>
                            </div>
                        [% /if %]

                        [% if $ReportingSubpage == 'tsupporter' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Supporter')%]:</label>
                                <select  name="supporter_id[]" id="SupporterIDs"  data-title="[% $user->gettext("Supporter wählen") %]" multiple class="form-control multiple2">
                                    <option value="0">[% $user->gettext('-- Alle --') %]</option>
                                    [% html_options options=$SupporterList selected=$supporter_id %]
                                </select>
                            </div>
                        [% /if %]
                        [% if $ReportingSubpage == 'tsupporter' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Supporter')%]:</label>
                                <select  name="supporter_id[]" id="SupporterIDs"  data-title="[% $user->gettext("Supporter wählen") %]" multiple class="form-control multiple2">
                                    <option value="0">[% $user->gettext('-- Alle --') %]</option>
                                    [% html_options options=$SupporterList selected=$supporter_id %]
                                </select>
                            </div>
                        [% /if %]
                        [% if $ReportingSubpage == 'tsupporter' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Ehemals zugewiesene Tickets mit anzeigen')%]:</label>
                                <input type="checkbox" [% if $DisplayPastSupporter %]checked="checked"[% /if %]name="DisplayPastSupporter"  onchange="$('#HM-Form-Report').submit();">
                            </div>
                        [% /if %]

                        [% if $ReportingSubpage == 'tdevice' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Asset')%]:</label>
                                <select size="1" name="device_id[]" multiple="multiple" data-title="[% $user->gettext("Asset wählen") %]" class="form-control multiple2" >
                                    <option value="0">[% $user->gettext('-- Alle --') %] </option>
                                    [% html_options options=$DeviceList selected=$device_id %]
                                </select>
                            </div>
                        [% /if %]

                        [% if $ReportingSubpage == 'ttags' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Schlagworte')%]:</label>
                                <select size="1" name="TagIDs[]" multiple="multiple" data-title="[% $user->gettext("Schlagworte wählen") %]" class="form-control multiple2" >
                                    [% html_options options=$TagList selected=$TagIDs %]
                                </select>
                            </div>
                        [% /if %]

                        [% if $ReportingSubpage == 'tprio' && $hmcompany == "HOLIDAY AUTOS" && $user->hasRight(26) %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('User-Prio.')%]:</label>
                                <input type="checkbox" name="UserPrio" value="Y" [% if $UserPrio == "Y" %]checked="checked"[% /if %] onclick="$('#HM-Form-Report').submit();" />
                            </div>
                        [% /if %]

                        [% if $ReportingSubpage == 'tstruct' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Struktur')%]:</label>
                                <select class="form-control" name="structure_id" onchange="$('#HM-Form-Report').submit();" class="form-control multiple">
                                    <option value="0">[% $user->gettext('-- Alle --') %]</option>
                                    [% html_options options=$categories selected=$category_id %]
                                </select>
                            </div>
                        [% /if %]

                        [% if $ReportingSubpage == 'ttemplate' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Vorlage')%]:</label>
                                <select  name="template_id[]" data-title="[% $user->gettext("Vorlage wählen") %]" class="form-control multiple2" multiple="multiple" size="1" >                                    
                                    [% html_options options=$templates selected=$template_id %]
                                </select>
                            </div>
                        [% /if %]

                        [% if $devtypes %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Ger&auml;tetyp')%]:</label>
                                <select class="form-control" name="devtype" onchange="$('#HM-Form-Report').submit();" class="form-control multiple" >
                                    <option value="">[% $user->gettext('-- Alle --') %]</option>
                                    [% foreach from=$devtypes item=dev %]
                                        <option value="[% if $dev.typeid > 0 %][% $dev.typeid %][% else %][% $dev.devicetypeid %][% /if %]" [% if ($devtype == $dev.typeid && $dev.typeid > 0) || ($devtype == $dev.devicetypeid && $dev.devicetypeid > 0 ) %]selected="selected"[% /if %]>[% $dev.typename %]</option>
                                    [% /foreach %]
                                </select>
                            </div>
                        [% /if %]
                        [% if $ReportingSubpage == 'tldapdev' %]
                            <div class="form-group">
                                <label class="control-label">[% $user->gettext('Ger&auml;te')%]:</label>
                                <select size="1" name="DeviceIDs[]" multiple="multiple" data-title="[% $user->gettext("Geräte wählen") %]" class="form-control multiple2" >
                                    [% html_options options=$LDAPDevList selected=$DeviceIDs %]
                                </select>
                            </div>
                            <lable for="DeviceIDs[]">[%  $user->gettext('') %] :</lable>

                            &nbsp;&nbsp;
                        [% /if %]



                        [% if $user->hasRight(221) %]
                            <div class="form-group">
                                <select name="showArchived" id="showArchived" class="form-control multiple" onchange="setAction(''); $('#HM-Form-Report').submit();">
                                    <option value="0" [% if !$showArchived %]selected="selected"[% /if %]>[% $user->gettext('Ohne archivierte Tickets') %]</option>
                                    <option value="1" [% if $showArchived == 1 %]selected="selected"[% /if %]>[% $user->gettext('Mit archivierten Tickets') %]</option>
                                    <option value="2" [% if $showArchived == 2 %]selected="selected"[% /if %]>[% $user->gettext('Nur archivierte Tickets anzeigen') %]</option>
                                </select>
                            </div>
                        [% /if %]

                        <div class="form-group">
                            <select name="IncidentProblem" id="IncidentProblem" class="form-control multiple" onchange="setAction(''); $('#HM-Form-Report').submit();">
                                <option value="0" [% if !$IncidentProblem %]selected="selected"[% /if %]>[% $user->gettext('Alle Tickets') %]</option>
                                <option value="1" [% if $IncidentProblem == 1 %]selected="selected"[% /if %]>[% $user->gettext('Tickets ohne Problem-Einstufung') %]</option>
                                <option value="2" [% if $IncidentProblem == 2 %]selected="selected"[% /if %]>[% $user->gettext('Nur Probleme') %]</option>
                            </select>
                        </div>

                        [% if $Tools->FCS_Count($TicketTypes) > 1 %]    
                            <div class="form-group">
                                <select name="TicketType" id="TicketType" class="form-control" onchange="setAction(''); $('#HM-Form-Report').submit();">
                                    [% html_options options=$TicketTypes selected=$selectedTicketType %]
                                </select>
                            </div>
                        [% /if %]

                        <div class="form-group">
                            <label class="control-label">[% $user->gettext('Eintr&auml;ge / Seite')%]:</label>
                            <select class="form-control" id="EntriesPerPage" name="EntriesPerPage" class="textbox" onchange="setAction(''); $('#HM-Form-Report').submit();">
                                <option value="5" [% if $EntriesPerPage == 5 %]selected="selected"[% /if %]>5</option>
                                <option value="10" [% if $EntriesPerPage == 10 %]selected="selected"[% /if %]>10</option>
                                <option value="20" [% if $EntriesPerPage == 20 || !$EntriesPerPage %]selected="selected"[% /if %]>20</option>
                                <option value="50" [% if $EntriesPerPage == 50 %]selected="selected"[% /if %]>50</option>
                                <option value="100" [% if $EntriesPerPage == 100 %]selected="selected"[% /if %]>100</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <div class="btn-group">
                                <a onclick="setAction(''); $('#HM-Form-Report').submit();" class="btn btn-outline-primary" ><span class="fa fa-search" title="[% $user->gettext('Suchen')%]"></span></a>
                                <a href="#" onclick="setAction('xls'); $('#HM-Form-Report').submit(); return false;" class="btn btn-outline-primary"><span>EXPORT</span></a>
                                <a href="index.php?module=reporting&amp;event=[% $report_type %]&amp;action=print&amp;sorting=[% $sorting %]&amp;sortOrder=[% $sortOrder %]"  class="btn btn-primary openInLargeModal"><span>[% $user->gettext('DRUCKEN') %]</span></a>

                                [%* <a href="#" id="PrintButton" data-fancybox-type="iframe" class="dialog btn btn-primary"><span class="fa fa-print"></span> [% $user->gettext('DRUCKEN') %]</a>*%]
                            </div>

                        </div>


                    </div>


                </div>
            </div>

            <div class="card panel-info shadow-sm rounded">

                <div class="card-header">
                    [% if $NoField %]
                        <span class="fcs-card-title h3">[%$user->gettext('Bitte wählen Sie ein Feld')%]</span>
                    [% else %]
                        <span class="fcs-card-title h3">[% $entries %] [%$user->gettext('Eintr&auml;ge gefunden')%]</span>
                    [% /if%]
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th onclick="[% if $sorting == "Name" %]toggleSortOrder();[% else %]sortList('Name')[% /if %];" style="cursor:pointer">
                                        [% $GridHeader %]
                                        [% if $sorting == "Name" %]
                                            <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                        [% /if %]
                                    </th>

                                    [% if $report_type == "tdev"  || $report_type == "tldapdev" %]
                                        <th onclick="[% if $sorting == "Type" %]toggleSortOrder();[% else %]sortList('Type')[% /if %];" style="cursor:pointer;">
                                            [% $user->gettext('Ger&auml;tetyp') %]
                                            [% if $sorting == "Type" %]
                                                <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                            [% /if %]
                                        </th>
                                    [% /if %]

                                    <th onclick="[% if $sorting == "Count" %]toggleSortOrder();[% else %]sortList('Count')[% /if %];" style="cursor:pointer;" class="text-end">
                                        [% $user->gettext('Anzahl Tickets') %]
                                        [% if $sorting == "Count" %]
                                            <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                        [% /if %]
                                    </th>
                                    [% if $user->hasRight(48) %]

                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' && $ReportingSubpage == 'tgroup' %]
                                            <th onclick="[% if $sorting == "ExpExpense" %]toggleSortOrder();[% else %]sortList('ExpExpense');[% /if %]" style="cursor:pointer;"  class="text-end" >
                                                [% $user->gettext('Erwarteter Aufwand') %][m]
                                                [% if $sorting == "ExpExpense" %]
                                                    <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                                [% /if %]
                                            </th>
                                        [% /if %]

                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                            <th onclick="[% if $sorting == "Expense" %]toggleSortOrder();[% else %]sortList('Expense');[% /if %]" style="cursor:pointer;"  class="text-end" >
                                                [% $user->gettext('Zeitaufwand') %]
                                                [% if $sorting == "Expense" %]
                                                    <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                                [% /if %]
                                            </th>
                                        [% /if %]

                                        <th onclick="[% if $sorting == "Expense" %]toggleSortOrder();[% else %]sortList('Expense');[% /if %]" style=""  class="text-end">
                                            [% $user->gettext('Zeitaufwand [m]') %]
                                            [% if $sorting == "Expense" %]
                                                <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                            [% /if %]
                                        </th>

                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                            <th onclick="[% if $sorting == "Expense" %]toggleSortOrder();[% else %]sortList('Expense');[% /if %]" style=""  class="text-end">
                                                [% $user->gettext('Zeitaufwand [h]') %]
                                                [% if $sorting == "Expense" %]
                                                    <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                                [% /if %]
                                            </th>
                                        [% /if %]
                                        <th onclick="[% if $sorting == "Costs" %]toggleSortOrder();[% else %]sortList('Costs');[% /if %]" style="" class="text-end">
                                            [% $user->gettext('Kosten') %]
                                            [% if $sorting == "Costs" %]
                                                <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                            [% /if %]
                                        </th>

                                        <th onclick="[% if $sorting == "ExpExpense" %]toggleSortOrder();[% else %]sortList('ExpExpense');[% /if %]" style="cursor:pointer;" class="text-end">
                                            [% $user->gettext('Erwarteter Aufwand') %]
                                            [% if $sorting == "ExpExpense" %]
                                                <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                            [% /if %]
                                        </th>

                                    [% /if %]
                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                        <th onclick="[% if $sorting == "ProcessTime" %]toggleSortOrder();[% else %]sortList('ProcessTime');[% /if %]" style="" class="text-end">
                                            [% $user->gettext('Liegezeit [h]') %]
                                            [% if $sorting == "ProcessTime" %]
                                                <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                            [% /if %]
                                        </th>
                                        <th onclick="[% if $sorting == "AvgProcessTime" %]toggleSortOrder();[% else %]sortList('AvgProcessTime');[% /if %]" style="" class="text-end">
                                            &Oslash;  [% $user->gettext('Liegezeit [h]') %]
                                            [% if $sorting == "AvgProcessTime" %]
                                                <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                            [% /if %]
                                        </th>
                                    [% else %]
                                        <th onclick="[% if $sorting == "ProcessTime" %]toggleSortOrder();[% else %]sortList('ProcessTime');[% /if %]" style="" class="text-end">
                                            [% $user->gettext('Liegezeit [m]') %]
                                            [% if $sorting == "ProcessTime" %]
                                                <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                            [% /if %]
                                        </th>
                                        <th onclick="[% if $sorting == "AvgProcessTime" %]toggleSortOrder();[% else %]sortList('AvgProcessTime');[% /if %]" style="" class="text-end">
                                            &Oslash;  [% $user->gettext('Liegezeit [m]') %]
                                            [% if $sorting == "AvgProcessTime" %]
                                                <span class="fa fa-chevron-[% if $sortOrder == "DESC" %]down[% else %]up[% /if %]"></span>
                                            [% /if %]
                                        </th>
                                    [% /if %]
                                </tr>
                            </thead>
                            <tbody>
                                [% if $reload %]
                                    <tr>
                                        <td colspan="20" align="center">
                                            <div id="progressbar" style="width: 40%"></div>
                                            <strong>Berechne Kategoriedaten: [% $Counter %] / [% $CountKats %]</strong>
                                        </td>
                                    </tr>
                                [% else %]
                                    [% foreach from=$tickets item=ticket %]
                                        [% if $ReportingSubpage == 'tcatkumu' && $ticket.levelno == 1 %]
                                            <tr class="ReportTopLevel">
                                                <td >[% $ticket.name %] (gesamt)</td>
                                                <td style="" class="text-end">[% $ticket.anzahl %]</td>
                                                [% if $user->hasRight(48) %]
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td  style="" class="text-end">[% $ticket.aufwand %]</td>
                                                    [% /if %]
                                                    <td style="" class="text-end">[% if $ticket.expense %][% $ticket.expense %][% else %]0[% /if %]</td>
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td style="" class="text-end">[% $ticket.zeitaufwandstunden %]</td>
                                                    [% /if %]
                                                    <td style="white-space: nowrap;" class="text-end">[% $ticket.kosten %] [% if $hmcompany == 'OTTO FISCHER AG' %]CHF[% else %][% $user->getCurrencyDescr() %][% /if %]</td>
                                                    <td class="text-end">[% $ticket.expexpense %]</td>
                                                [% /if %]
                                                <td style="" class="text-end">[% $ticket.processtime %]</td>
                                                <td style="" class="text-end">[% $ticket.avgprocesstime %]</td>
                                            </tr>
                                            <tr onclick="document.getElementById('listuid').value =[% $ticket.id %]; document.lform.submit();" style="cursor:pointer;">
                                                <td title="[% $ticket.fullname %]">[% $ticket.name %]</td>
                                                <td class="text-end">[% $ticket.notKumu.anzahl %]</td>
                                                [% if $user->hasRight(48) %]
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td  class="Show ShowDays text-end">[% $ticket.notKumu.aufwand %]</td>
                                                    [% /if %]
                                                    <td style="" class="Show ShowMinutes text-end">[% $ticket.notKumu.expense %]</td>
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td class="Show ShowHours text-end">[% $ticket.notKumu.zeitaufwandstunden %]</td>
                                                    [% /if %]
                                                    <td style="" class="text-end">[% $ticket.notKumu.kosten %] [% if $hmcompany == 'OTTO FISCHER AG' %]CHF[% else %][% $user->getCurrencyDescr() %][% /if %]</td>
                                                    <td class="text-end">[% $ticket.notKumu.expexpense %]</td>
                                                [% /if %]
                                                <td class="text-end">[% $ticket.notKumu.processtime %]</td>
                                                <td class="text-end">[% $ticket.notKumu.avgprocesstime %]</td>
                                            </tr>
                                        [% elseif  $ReportingSubpage == 'tgroup' %]
                                            <tr onclick="document.getElementById('listuid').value =[% $ticket.id %]; document.lform.submit();" style="cursor:pointer;">
                                                <td title="[% $ticket.fullname %]">[% $ticket.name %]</td>
                                                [% if $report_type == "tdev" || $report_type == "tldapdev" %]
                                                    <td>[% $ticket.typename %]&nbsp;</td>
                                                [% /if %]
                                                <td class="text-end">[% $ticket.anzahl %]</td>
                                                [% if $user->hasRight(48) %]
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td class="text-end">[% $ticket.expexpense %]</td>
                                                    [% /if %]
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td class="text-end">[% $ticket.aufwand %]</td>
                                                    [% /if %]
                                                    <td class="text-end">[% $ticket.expense %]</td>
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td class="text-end">[% $ticket.zeitaufwandstunden %]</td>
                                                    [% /if %]
                                                    <td class="text-end">[% $ticket.kosten %] [% if $hmcompany == 'OTTO FISCHER AG' %]CHF[% else %][% $user->getCurrencyDescr() %][% /if %]</td>
                                                [% /if %]
                                                <td class="text-end">[% $ticket.processtime %]</td>
                                                <td class="text-end">[% $ticket.avgprocesstime %]</td>
                                            </tr>
                                        [% else %]
                                            <tr onclick="[% if !$field_report %]document.getElementById('listuid').value =[% $ticket.id %][% else %][% if $ticket.name %]document.getElementById('listuid').value = String.raw`[% $ticket.name %]`[% else %]document.getElementById('listuid').value = '[% $smarty.const.RANDOMSTRING %]'[% /if %]; [% /if %]; document.lform.submit();"  style="cursor:pointer;">
                                                <td title="[% $ticket.fullname %]">[% if $ticket.name %][% $ticket.name %][% else %][% $user->gettext('Ohne') %][% /if %]</td>
                                                [% if $report_type == "tdev" || $report_type == "tldapdev" %]
                                                    <td>[% $ticket.typename %]&nbsp;</td>
                                                [% /if %]
                                                <td class="text-end">[% $ticket.anzahl %]</td>
                                                [% if $user->hasRight(48) %]
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td  class="Show ShowDays text-end">[% $ticket.aufwand %]</td>
                                                    [% /if %]
                                                    <td class="Show ShowMinutes text-end">[% $ticket.expense %]</td>
                                                    [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                                        <td class="Show ShowHours text-end">[% $ticket.zeitaufwandstunden %]</td>
                                                    [% /if %]
                                                    <td class="text-end">[% $ticket.kosten %] [% if $hmcompany == 'OTTO FISCHER AG' %]CHF[% else %][% $user->getCurrencyDescr() %][% /if %]</td>
                                                    <td class="text-end">[% $ticket.expexpense|default:0 %] [% $user->gettext('Min.') %]</td>
                                                [% /if %]
                                                <td class="text-end">[% $ticket.processtime %]</td>
                                                <td class="text-end">[% $ticket.avgprocesstime %]</td>
                                            </tr>
                                        [% /if %]
                                    [% foreachelse %]
                                        <tr>
                                            [% if $NoField %]
                                                <td colspan="[% if $hmcompany != 'LANDKREIS SCHAUMBURG' %][% if $report_type == "tdev" || $report_type == "tldapdev" %]10[% else %]9[% /if %][% else %][% if $report_type == "tdev" || $report_type == "tldapdev" %]10[% else %]9[% /if %][% /if %]" >[% $user->gettext('Reporting über benutzerdefinierte Felder. Bitte wählen Sie ein Feld.') %]</td>
                                            [% else %]
                                                <td colspan="[% if $hmcompany != 'LANDKREIS SCHAUMBURG' %][% if $report_type == "tdev" || $report_type == "tldapdev" %]10[% else %]9[% /if %][% else %][% if $report_type == "tdev" || $report_type == "tldapdev" %]10[% else %]9[% /if %][% /if %]" >[% $user->gettext('Keine Tickets im Zeitraum gefunden') %]</td>
                                            [% /if %]
                                        </tr>
                                    [% /foreach %]
                                [% /if %]
                            </tbody>


                        </table>
                        <div class="text-center">
                            [% $Paging %]
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</form>


<form action="index.php?module=reporting&event=showTickets" method="post" name="lform" target="_blank" />
<input type="hidden" name="[% $list_field %]" id="listuid" value="" />
<input type="hidden" name="Sorting" value="[% $sorting %]" />
<input type="hidden" name="SortOrder" value="[% $sortOrder %]" />
[% if $field_report %]
    <input type="hidden" name="fieldid" value="[% $field_id %]" />
[% else %]
    <input type="hidden" name="deffieldid" value="[% $def_field_id %]" />    
[% /if %]
</form>


<script>
    function addslashes(string) {
    console.log(String.raw`\platon`);
    return String.raw`` + string + ``;
    }
    [% if $reload %]
    $("#progressbar").progressbar({ max: [% $CountKats %], value: [% $Counter %] });
    $('#HM-Form-Report').submit();
    [% /if %]


    function changePeriod(element) {

    var value = element.options[element.selectedIndex].value;
    var startdate = document.forms['HM-Form-Report'].elements['startdate'];
    var enddate = document.forms['HM-Form-Report'].elements['enddate'];
    var now = new Date();
    var Tag = now.getDate();
    var Monat = now.getMonth();
    if (value == 99) {
    startdate.value = "[% $today %]";
    enddate.value = startdate.value;
    } else if (value == 1) {
    startdate.value = "[% $yesterday %]";
    enddate.value = startdate.value;
    } else if (value == 2) {
    startdate.value = "[% $lastweek %]";
    enddate.value = "[% $today %]";
    } else if (value == 3) {
    startdate.value = "[% $lastmonth_start %]";
    enddate.value = "[% $lastmonth_end %]";
    } else if (value == 4) {
    startdate.value = "[% $lastyear_start %]";
    enddate.value = "[% $lastyear_end %]";
    } else if (value == 5) {
    startdate.value = "[% $currentyear_start %]";
    enddate.value = "[% $currentyear_end %]";
    }
    [% if $timing_add %]
        [% foreach from=$timing_add item=timing2 %]
    else if (value == [% $timing2.id %]){

    startdate.value = "[% $timing2.start %]";
    enddate.value = "[% $timing2.end %]";
    }
        [% /foreach %]
    [% /if %]

    }

    $('#PrintButton').on("click", function() {
    setAction('print');
    $form = $("#HM-Form-Report");
    $.fancybox({
    'title': 'Druckansicht',
            'href': $form.attr("action") + "&" + $form.serialize(),
            'type': 'iframe'
    });
    return false;
    })


            $(".multiple2,.multiple").multiselect({
    buttonClass: 'form-select',
            templates: {
            button: '<button type="button" class="multiselect dropdown-toggle" data-bs-toggle="dropdown"><span class="multiselect-selected-text"></span></button>',
            },
            enableFiltering: true,
            enableCaseInsensitiveFiltering: true,
            numberDisplayed: 2,
            nSelectedText: ' [% $user->gettext(" gewählt") %]',
            buttonTitle: function(options, select) {return select.attr('data-title')},
            buttonText: function(options, select) {

            // First consider the simple cases, i.e. disabled and empty.
            if (this.disabledText.length > 0
                    && (this.disableIfEmpty || select.prop('disabled'))
                    && options.length == 0) {

            return this.disabledText;
            }
            else if (options.length === 0) {
            return select.attr('data-title');
            }

            var $select = $(select);
            var $optgroups = $('optgroup', $select);
            var delimiter = this.delimiterText;
            var text = '';
            // Go through groups.
            $optgroups.each(function() {
            var $selectedOptions = $('option:selected', this);
            var $options = $('option', this);
            if ($selectedOptions.length == $options.length) {
            text += $(this).attr('label') + delimiter;
            }
            else {
            $selectedOptions.each(function() {
            text += $(this).text() + delimiter;
            });
            }
            });
            var $remainingOptions = $('option:selected', $select).not('optgroup option');
            $remainingOptions.each(function() {
            text += $(this).text() + delimiter;
            });
            return text.substr(0, text.length - 2);
            },
            onDropdownHide: function(event) {
            setAction('');
            $('#HM-Form-Report').submit();
            }
    });
    function setAction(value) {
    $('#action').val(value);
    }

    function switchPage(page) {
    document.getElementById('pos').value = page;
    $('#HM-Form-Report').submit();
    }


    $("#FieldID").select2({theme: 'bootstrap-5'});
</script>
