<style>
 @media print {
  .modal {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    padding: 0;
    visibility: visible;
    /**Remove scrollbar for printing.**/
    overflow-x: visible !important;
    overflow-y: visible !important;
  }
  .modal-dialog {
    visibility: visible !important;
    /**Remove scrollbar for printing.**/
    overflow-x: visible !important;
    overflow-y: visible !important;
  }
  
  /*
    *{
        float:none!important;
        position:static!important;
    }
   */
}


</style>
<form>
    <div class="card panel-info shadow-sm rounded" id="ModalToPrint" style="margin-bottom:0;">
        
        <div class="card-header">
            <div class="row">
                <div class="col-lg-10">
                    <span id="ReportTitle" class="fcs-card-title h3">
                        [% $user->gettext($ReportingHeader) %]
                    </span>
                    <br>
                    [% $user->gettext('Der Report enthält die Tickets aus dem Zeitraum vom') %] <strong>[% $startdate %]</strong>
                    [% $user->gettext('bis zum') %]<strong> [% $enddate %]</strong>

                    <br />
                    [% if $user->hasRight(221) %]
                        [% if $showArchived == 1 %]
                            [% $user->gettext('Archivierte Tickets wurden mit ausgewertet.') %]
                        [% elseif $showArchived == 2 %]
                            [% $user->gettext('Es wurden nur archivierte Tickets ausgewertet.') %]
                        [% /if %]
                        <br />
                    [% /if %]

                    [% if $IncidentProblem == 1 %]
                        [% $user->gettext('Auswertung von Tickets ohne Problem-Einstufung') %]<br />
                    [% elseif $IncidentProblem == 2 %]
                        [% $user->gettext('Auswertung von Problem-Tickets') %]<br />
                    [% /if %]
                </div>
                <div class="col-lg-2 text-end">
                    <input type="button" class="btn btn-outline-primary hidden-print" onclick="print();" value="[% $user->gettext('Drucken') %]" />
                </div>
            </div>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-striped" id="mytable">
                    <thead>
                        <tr>
                            <th >
                                [% $GridHeader %]
                                [% if FALSE && $sorting == "Name" %]
                                    <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                [% /if %]

                            </th>
                            [% if $report_type == 'tcon' %]
                                <th >
                                    [% $user->gettext('Firma') %]
                                    [% if FALSE && $sorting == "Company" %]
                                        <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                    [% /if %]
                                    <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                </th>
                            [% /if %]

                            [% if $report_type == "tdev" %]
                                <th >
                                    [% $user->gettext('Ger&auml;tetyp') %]
                                    [% if FALSE && $sorting == "Type" %]
                                        <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                    [% /if %]
                                    <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                </th>
                            [% /if %]

                            <th  style="text-align:center !important;">
                                [% $user->gettext('Tickets') %]
                                [% if FALSE && $sorting == "Count" %]
                                    <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                [% /if %]
                                <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                            </th>
                            [% if $user->hasRight(48) %]
                                [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                    <th  style="text-align:center !important;">
                                        [% $user->gettext('Zeitaufwand') %]
                                        [% if FALSE && $sorting == "Expense" %]
                                            <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                        [% /if %]
                                        <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                    </th>
                                [% /if %]

                                <th  style="text-align:center !important;">
                                    [% $user->gettext('Zeitaufwand [m]') %]
                                    [% if FALSE && $sorting == "Expense" %]
                                        <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                    [% /if %]
                                    <input type='checkbox' class="hidden-print"  checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                </th>

                                [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                    <th style="text-align:center !important;">
                                        [% $user->gettext('Zeitaufwand [h]') %]
                                        [% if FALSE && $sorting == "Expense" %]
                                            <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                        [% /if %]
                                        <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                    </th>
                                [% /if %]

                                <th  style="text-align:center !important;">
                                    [% $user->gettext('Kosten') %]
                                    [% if FALSE && $sorting == "Costs" %]
                                        <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                    [% /if %]
                                    <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                </th>
                            [% /if %]
                            [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]

                                <th  style="text-align:center !important;">
                                    [% $user->gettext('Liegezeit [h]') %]
                                    [% if FALSE && $sorting == "ProcessTime" %]
                                        <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                    [% /if %]
                                    <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                </th>
                                <th style="text-align:center !important;">
                                    &Oslash;  [% $user->gettext('Liegezeit [h]') %]
                                    [% if FALSE && $sorting == "AvgProcessTime" %]
                                        <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                    [% /if %]
                                    <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                </th>

                            [% else %]

                                <th style="text-align:center !important;">
                                    [% $user->gettext('Liegezeit [m]') %]
                                    [% if FALSE && $sorting == "ProcessTime" %]
                                        <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                    [% /if %]
                                    <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                </th>
                                <th  style="text-align:center !important;">
                                    &Oslash;  [% $user->gettext('Liegezeit [m]') %]
                                    [% if FALSE && $sorting == "AvgProcessTime" %]
                                        <img src="images/sort[% if $sortOrder == "DESC" %]desc[% else %]asc[% /if %].gif"  alt="" title="" border="0" />
                                    [% /if %]
                                    <input type='checkbox' class="hidden-print" checked='checked' title="[% $user->gettext('Spalte Drucken') %]" style="cursor:help;" />
                                </th>
                            [% /if %]
                        </tr>
                    </thead>
                    <tbody>
                        [% foreach from=$tickets item=ticket %]

                            [% if $ReportingSubpage == 'tcatkumu' && $ticket.levelno == 1 %]
                                <tr class="ReportTopLevel">
                                    <td >[% $ticket.name %] (gesamt)</td>
                                    [% if $report_type == 'tcon' %]
                                        <td >[% $ticket.company %]</td>
                                    [% /if %]
                                    [% if $report_type == "tdev" %]
                                        <td >[% $ticket.typename %]&nbsp;</td>
                                    [% /if %]

                                    <td style="text-align:center !important;">[% $ticket.anzahl %]</td>
                                    [% if $user->hasRight(48) %]
                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                            <td style="text-align:center !important;">[% $ticket.aufwand %]</td>
                                        [% /if %]

                                        <td style="text-align:center !important;">[% if $ticket.expense %][% $ticket.expense %][% else %]0[% /if %]</td>

                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                            <td style="text-align:center !important;">[% $ticket.zeitaufwandstunden %]</td>
                                        [% /if %]

                                        <td style="text-align:center !important; white-space: nowrap;">[% $ticket.kosten %] [% if $hmcompany == 'OTTO FISCHER AG' %]CHF[% else %][% $user->getCurrencyDescr() %][% /if %]</td>
                                    [% /if %]
                                    <td style="text-align:center !important;">[% $ticket.processtime %]</td>
                                    <td style="text-align:center !important;">[% $ticket.avgprocesstime %]</td>                                        
                                </tr>

                                <tr>

                                    <td >[% $ticket.name %]</td>
                                    [% if $report_type == 'tcon' %]
                                        <td >[% $ticket.notKumu.company %]</td>
                                    [% /if %]
                                    [% if $report_type == "tdev" %]
                                        <td >[% $ticket.notKumu.typename %]&nbsp;</td>
                                    [% /if %]

                                    <td style="text-align:center !important;">[% $ticket.notKumu.anzahl %]</td>
                                    [% if $user->hasRight(48) %]
                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                            <td style="text-align:center !important;">[% $ticket.notKumu.aufwand %]</td>
                                        [% /if %]

                                        <td style="text-align:center !important;">[% if $ticket.notKumu.expense %][% $ticket.notKumu.expense %][% else %]0[% /if %]</td>

                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                            <td style="text-align:center !important;">[% $ticket.notKumu.zeitaufwandstunden %]</td>
                                        [% /if %]

                                        <td style="text-align:center !important; white-space: nowrap;">[% $ticket.notKumu.kosten %] [% if $hmcompany == 'OTTO FISCHER AG' %]CHF[% else %][% $user->getCurrencyDescr() %][% /if %]</td>
                                    [% /if %]
                                    <td style="text-align:center !important;">[% $ticket.notKumu.processtime %]</td>
                                    <td style="text-align:center !important;">[% $ticket.notKumu.avgprocesstime %]</td>
                                </tr>      

                            [% else %]
                                <tr>

                                    <td >[% $ticket.name %]</td>
                                    [% if $report_type == 'tcon' %]
                                        <td >[% $ticket.company %]</td>
                                    [% /if %]
                                    [% if $report_type == "tdev" %]
                                        <td >[% $ticket.typename %]&nbsp;</td>
                                    [% /if %]

                                    <td style="text-align:center !important;">[% $ticket.anzahl %]</td>
                                    [% if $user->hasRight(48) %]
                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                            <td style="text-align:center !important;">[% $ticket.aufwand %]</td>
                                        [% /if %]

                                        <td style="text-align:center !important;">[% if $ticket.expense %][% $ticket.expense %][% else %]0[% /if %]</td>

                                        [% if $hmcompany != 'LANDKREIS SCHAUMBURG' %]
                                            <td style="text-align:center !important;">[% $ticket.zeitaufwandstunden %]</td>
                                        [% /if %]

                                        <td style="text-align:center !important; white-space: nowrap;">[% $ticket.kosten %] [% if $hmcompany == 'OTTO FISCHER AG' %]CHF[% else %][% $user->getCurrencyDescr() %][% /if %]</td>
                                    [% /if %]
                                    <td style="text-align:center !important;" >[% $ticket.processtime %]</td>
                                    <td style="text-align:center !important;" >[% $ticket.avgprocesstime %]</td>
                                </tr>                                        
                            [% /if %]

                        [% /foreach %]
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</form>
<script>

document.title = '[% $user->gettext($ReportingHeader) %]';

    $('input ').on("click", function(e){

    })

    function hideColumn(columnIndex) {
    $('#mytable td:nth-child('+(columnIndex+1)+'), #mytable th:nth-child('+(columnIndex+1)+')').hide();
    }


    $(document).on('change', 'table thead input', function() {
        var checked = $(this).is(":checked");

        var index = $(this).parent().index();
        $('table tbody tr').each(function() {
            if(checked) {
                $(this).find("td").eq(index).removeClass('hidden-print');   
                $('#mytable thead tr').find("th").eq(index).removeClass('hidden-print');  
            } else {
                $(this).find("td").eq(index).addClass('hidden-print');  
                $('#mytable thead tr').find("th").eq(index).addClass('hidden-print');  
            }
        });
    });

</script>
