
<!-- Component Default begin -->
<script language="JavaScript" src="modules/reporting/javascript/reporting.js" type="text/JavaScript"></script>

    <script type="text/javascript" src="includes/js/jquery.dataTables.min.js"></script>
    <link rel="stylesheet" type="text/css" href="styles/default/css/jquery.dataTables.css" media="screen" />
    
    <!-- ###CONTENT### begin -->
    <form  action="index.php?module=reporting&event=TicketReports" 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="" />
        <input type="hidden" name="utf8" id="utf8" value="0" />
        <input type="hidden" name="renewCache" id="renewCache" value="0" />

        <div class="card panel-fcs-border shadow-sm">
            <div class="card-header">
                <span class="fcs-card-title h2">[%$user->gettext('Aktivitäten')%]</span>
            </div>
            <div class="card-body">
                <div class="card panel-info shadow-sm rounded">
                    <div class="card-body">
                        <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" onkeyup="keyEvent(event)" />
                        </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" onkeyup="keyEvent(event)" />
                        </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>

                        <input type="button" value="[% $user->gettext('Anzeigen') %]" class="btn btn-outline-primary" onclick="setAction('');
                                                        $('#HM-Form-Report').submit();"/>
                    </div>
                </div>

                <div class="card panel-info shadow-sm rounded">
                    <div class="card-header">
                        <div class="row">
                            <div class="col-lg-6">
                                <span class="fcs-card-title h3">[%$user->gettext('Supporter - Aktivitäten')%]</span>
                            </div>
                            <div class="col-lg-6 text-end">
                                <div class="btn-group">
                                    <input type="submit" name="SupporterReport" class="btn btn-outline-primary" value="Export" />        
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-striped" id="SupporterTable" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        <td>[%$user->gettext('Datum')%]</td>

                                        <td>[%$user->gettext('Supporter')%]</td>
                                        <td>[%$user->gettext('Bearbeitete Tickets')%]</td>
                                        <td>[%$user->gettext('Erstellt für')%]</td>

                                        <td>[%$user->gettext('Erstellt von')%]</td>
                                        <td>[%$user->gettext('Geschlossen für')%]</td>
                                        <td>[%$user->gettext('Geschlossen von')%]</td>

                                        <td>[%$user->gettext('Liegezeit der an diesem Tag erstellten Tickets')%]</td>
                                        <td>[%$user->gettext('durchschnittliche Liegezeit')%]</td>
                                        <td>[%$user->gettext('Aufwand')%]</td>
                                        <td>[%$user->gettext('durchschnittlicher Aufwand')%]</td>

                                        <td>[%$user->gettext('Aufwand eingetragen')%]</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    [% foreach from=$SupporterReport item=SupporterDays key=Datum %]
                                        [% foreach from=$SupporterDays item=SupporterData key=Supporter %]
                                            <tr>
                                                <td>[% $Datum %]</td>
                                                <td>[% $SupporterArray[$Supporter] %]</td>
                                                <td>[% $SupporterData.cntTuochedTickets|default:"0" %]</td>
                                                <td>[% $SupporterData.cntCreatedFor|default:"0"  %]</td>

                                                <td>[% $SupporterData.cntCreatedFrom|default:"0" %]</td>
                                                <td>[% $SupporterData.cntClosedBy|default:"0" %]</td>
                                                <td>[% $SupporterData.cntClosedfor|default:"0" %]</td>

                                                <td>[% $SupporterData.processtime_ra|default:"0" %]</td>
                                                <td>[% $SupporterData.avgprocesstime_ra|default:"0" %]</td>
                                                <td>[% $SupporterData.expense_ra|default:"0" %]</td>
                                                <td>[% $SupporterData.avgexpense_ra|default:"0" %]</td>

                                                <td>[% $SupporterData.SupporterExpense_ra|default:"0" %]</td>
                                            </tr>
                                        [% /foreach %]
                                    [% /foreach %]
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <div class="card panel-info shadow-sm rounded">
                    <div class="card-header">
                        <div class="row">
                            <div class="col-lg-6">
                                <span class="fcs-card-title h3">[%$user->gettext('Supporter - Gesamter Zeitraum')%]</span>
                            </div>
                            <div class="col-lg-6 text-end">
                                <div class="btn-group">
                                    <input type="submit" name="SupporterReportComplete" class="btn btn-outline-primary" value="Export" />        
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-striped" id="SupporterTable" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        <td>_____</td>

                                        <td>[%$user->gettext('Supporter')%]</td>
                                        <td>[%$user->gettext('Bearbeitete Tickets')%]</td>
                                        <td>[%$user->gettext('Erstellt für')%]</td>

                                        <td>[%$user->gettext('Erstellt von')%]</td>
                                        <td>[%$user->gettext('Geschlossen für')%]</td>
                                        <td>[%$user->gettext('Geschlossen von')%]</td>

                                        <td>[%$user->gettext('Liegezeit der an diesem Tag erstellten Tickets')%]</td>
                                        <td>[%$user->gettext('durchschnittliche Liegezeit')%]</td>
                                        <td>[%$user->gettext('Aufwand')%]</td>
                                        <td>[%$user->gettext('durchschnittlicher Aufwand')%]</td>

                                        <td>[%$user->gettext('Aufwand eingetragen')%]</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    [% foreach from=$SupporterReportComplete item=SupporterData key=Supporter %]
                                        <tr>
                                            <td>_____</td>
                                            <td>[% $SupporterArray[$Supporter] %]</td>
                                            <td>[% $SupporterData.cntTuochedTickets|default:"0" %]</td>
                                            <td>[% $SupporterData.cntCreatedFor|default:"0"  %]</td>

                                            <td>[% $SupporterData.cntCreatedFrom|default:"0" %]</td>
                                            <td>[% $SupporterData.cntClosedBy|default:"0" %]</td>
                                            <td>[% $SupporterData.cntClosedfor|default:"0" %]</td>

                                            [%*<td>[% $SupporterData.anzahlticketsimzeitraum|default:"0" %]</td>*%]
                                            <td>[% $SupporterData.processtime_ra|default:"0" %]</td>
                                            <td>[% $SupporterData.avgprocesstime_ra|default:"0" %]</td>
                                            <td>[% $SupporterData.expense_ra|default:"0" %]</td>
                                            <td>[% $SupporterData.avgexpense_ra|default:"0" %]</td>

                                            <td>[% $SupporterData.SupporterExpense_ra|default:"0" %]</td>
                                        </tr>
                                    [% /foreach %]
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <div class="card panel-info shadow-sm rounded">
                    <div class="card-header">
                        <div class="row">
                            <div class="col-lg-6">
                                <span class="fcs-card-title h3">[%$user->gettext('Supporter - Anzahl aktuell offener Tickets')%]</span>
                            </div>
                            <div class="col-lg-6 text-end">
                                <div class="btn-group">
                                    <input type="submit" name="AktuellOffeneTicketsJeSupporter" class="btn btn-outline-primary" value="Export" />        
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-striped" id="SupporterTable" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        <td>[%$user->gettext('Datum')%]</td>
                                        <td>[%$user->gettext('Supporter')%]</td>
                                        <td>[%$user->gettext('Derzeit offene Tickets')%]</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    [% foreach from=$AktuellOffeneTicketsJeSupporter item=SupporterDays key=Datum %]
                                        [% foreach from=$SupporterDays item=SupporterData key=Supporter %]
                                            <tr>
                                                <td>[% $Datum %]</td>
                                                <td>[% $SupporterArray[$Supporter] %]</td>
                                                <td>[% $SupporterData.cntOpenTickets|default:"0" %]</td>
                                            </tr>
                                        [% /foreach %]
                                    [% /foreach %]
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <div class="card panel-info shadow-sm rounded">
                    <div class="card-header">
                        <div class="row">
                            <div class="col-lg-6">
                                <span class="fcs-card-title h3">[%$user->gettext('Gruppen - Aktivitäten')%]</span>
                            </div>
                            <div class="col-lg-6 text-end">
                                <div class="btn-group">
                                    <input type="submit" name="GroupReport" class="btn btn-outline-primary" value="Export" />        
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-striped" id="SupporterTable" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        <td>[%$user->gettext('Datum')%]</td>
                                        <td>[%$user->gettext('Gruppe')%]</td>
                                        <td>[%$user->gettext('Erstellte')%]</td>
                                        <td>[%$user->gettext('Geschlossene')%]</td>
                                        <td>[%$user->gettext('Liegezeit der an diesem Tag erstellten Tickets')%]</td>
                                        <td>[%$user->gettext('durchschnittliche Liegezeit')%]</td>
                                        <td>[%$user->gettext('Aufwand')%]</td>
                                        <td>[%$user->gettext('durchschnittlicher Aufwand')%]</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    [% foreach from=$GroupReport item=GroupDays key=Datum %]
                                        [% foreach from=$GroupDays item=GroupData key=Group %]
                                            <tr>
                                                <td>[% $Datum %]</td>
                                                <td>[% $GroupArray[$Group] %]</td>
                                                <td>[% $GroupData.cntCreatedFor|default:"0" %]</td>

                                                <td>[% $GroupData.cntClosed|default:"0" %]</td>

                                                <td>[% $GroupData.processtime_ra|default:"0" %]</td>
                                                <td>[% $GroupData.avgprocesstime_ra|default:"0" %]</td>
                                                <td>[% $GroupData.expense_ra|default:"0" %]</td>
                                                <td>[% $GroupData.avgexpense_ra|default:"0" %]</td>
                                            </tr>
                                        [% /foreach %]
                                    [% /foreach %]
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <div class="card panel-info shadow-sm rounded">
                    <div class="card-header">
                        <div class="row">
                            <div class="col-lg-6">
                                <span class="fcs-card-title h3">[%$user->gettext('Gruppen - Gesamter Zeitraum')%]</span>
                            </div>
                            <div class="col-lg-6 text-end">
                                <div class="btn-group">
                                    <input type="submit" name="GroupReportComplete" class="btn btn-outline-primary" value="Export" />        
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-striped" id="SupporterTable" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        <td>_____</td>
                                        <td>[%$user->gettext('Gruppe')%]</td>
                                        <td>[%$user->gettext('Erstellte')%]</td>
                                        <td>[%$user->gettext('Geschlossene')%]</td>
                                        <td>[%$user->gettext('Liegezeit der an diesem Tag erstellten Tickets')%]</td>
                                        <td>[%$user->gettext('durchschnittliche Liegezeit')%]</td>
                                        <td>[%$user->gettext('Aufwand')%]</td>
                                        <td>[%$user->gettext('durchschnittlicher Aufwand')%]</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    [% foreach from=$GroupReport item=GroupDays key=Datum %]
                                        [% foreach from=$GroupDays item=GroupData key=Group %]
                                            <tr>
                                                <td>_____</td>
                                                <td>[% $GroupArray[$Group] %]</td>
                                                <td>[% $GroupData.cntCreatedFor|default:"0" %]</td>

                                                <td>[% $GroupData.cntClosed|default:"0" %]</td>

                                                <td>[% $GroupData.processtime_ra|default:"0" %]</td>
                                                <td>[% $GroupData.avgprocesstime_ra|default:"0" %]</td>
                                                <td>[% $GroupData.expense_ra|default:"0" %]</td>
                                                <td>[% $GroupData.avgexpense_ra|default:"0" %]</td>
                                            </tr>
                                        [% /foreach %]
                                    [% /foreach %]
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <div class="card panel-info shadow-sm rounded">
                    <div class="card-header">
                        <div class="row">
                            <div class="col-lg-6">
                                <span class="fcs-card-title h3">[%$user->gettext('Gruppen - Anzahl aktuell offener Tickets')%]</span>
                            </div>
                            <div class="col-lg-6 text-end">
                                <div class="btn-group">
                                    <input type="submit" name="AktuellOffeneTicketsJeGruppe" class="btn btn-outline-primary" value="Export" />        
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-striped" id="SupporterTable" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        <td>[%$user->gettext('Datum')%]</td>
                                        <td>[%$user->gettext('Gruppe')%]</td>
                                        <td>[%$user->gettext('Derzeit offene Tickets')%]</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    [% foreach from=$AktuellOffeneTicketsJeGruppe item=SupporterDays key=Datum %]
                                        [% foreach from=$SupporterDays item=SupporterData key=Supporter %]
                                            <tr>
                                                <td>[% $Datum %]</td>
                                                <td>[% $GroupArray[$Supporter] %]</td>
                                                <td>[% $SupporterData.cntOpenTickets|default:"0" %]</td>
                                            </tr>
                                        [% /foreach %]
                                    [% /foreach %]
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
<!-- ###CONTENT### end -->


<script language="JavaScript" type="text/JavaScript">

    [% 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;
    })


        $('.datatable').dataTable({
        "sPaginationType": "full_numbers",
        "bLengthChange": true,
        "paging": false,
        "aLengthMenu": [
            [10, 50,-1],
            [25, 50,"All"]
        ],
        "iDisplayLength": -1                            
        });
    
</script>


<!-- Component Default end -->
</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 %]" />
</form>

