<div class="ui-report-header ui-widget-header ui-corner-all noprint" style="pd4ml-display:none; margin-bottom:5mm;">
    <a class="dialog_make_text_btn ui-corner-all" style="pd4ml-display:none;"
       onclick="evaluation.open_file(this, 'pdf', '{site_url url="reportportlet/`$reports_xjxcookie`/s_projectmatrix/result_pdf4/`$s_projectmatrix_file_id`"}', 'XNOX')">
        <span class="dialog_make_btn16 pdf"></span>
        PDF A4
    </a>
    <a class="dialog_make_text_btn ui-corner-all" style="pd4ml-display:none;"
       onclick="evaluation.open_file(this, 'pdf', '{site_url url="reportportlet/`$reports_xjxcookie`/s_projectmatrix/result_pdf3/`$s_projectmatrix_file_id`"}', 'XNOX')">
        <span class="dialog_make_btn16 pdf"></span>
        PDF A3
    </a>
    <a class="dialog_make_text_btn ui-corner-all" style="pd4ml-display:none;"
    onclick="evaluation.open_file(this, 'csv', '{site_url url="reportportlet/`$reports_xjxcookie`/s_projectmatrix/result_csv/`$s_projectmatrix_file_id`_csv"}', 'XNOX')">
        <span class="dialog_make_btn16 csv"></span>
        CSV
    </a>        
    
    {portlet file='report_designs_list'}
    
    {if $filter_project_manager}<span style="margin-left:40px; display:inline-block;" class="warningsmall ui-corner-all">{$i.reporting_only_project_manager}</span>{/if}
    {if $filter_division_manager}<span style="margin-left:40px; display:inline-block;" class="warningsmall ui-corner-all">{$i.reporting_only_division_manager}</span>{/if}
</div>

<!-- ------------------------------------- Zeitraum ------------------------------------- -->

<table class="editablepop" style="margin-bottom:5mm; display:none; pd4ml-display:block; ">
    <tbody>
        {if isset($request_vars->date__from)}
        <tr>
            <td style="vertical-align:top; width:350px; background: none;"><h3 style="line-height:20px;">{$i.reporting_time_period}: {$request_vars->date__from->us_date()} - {$request_vars->date__to->us_date()}</h3></td>
            <td style="vertical-align:bottom; width:500px; background: none;"><textarea style="display:none; pd4ml-display:block; width:500px; height:28px; font-size:20px; border:0 none; margin:0; padding:0;" rows="1" cols="50"></textarea></td>
        </tr>
        {/if}
        {if isset($request_vars->staff__staff)}
        <tr>
            <td style="vertical-align:top; width:350px; background: none;"><h3 style="line-height:20px;">{$i.filter_staff}: {$staff_info->staff_name}</h3></td>
            <td style="vertical-align:bottom; width:500px; background: none;"><textarea style="display:none; pd4ml-display:block; width:500px; height:28px; font-size:20px; border:0 none; margin:0; padding:0;" rows="1" cols="50"></textarea></td>
        </tr>
        {/if}
        {if isset($request_vars->staff__staff_group)}
        <tr>
            <td style="vertical-align:top; width:350px; background: none;"><h3 style="line-height:20px;">{$i.filter_staff_group}: {$staff_group_info->name}</h3></td>
            <td style="vertical-align:bottom; width:500px; background: none;"><textarea style="display:none; pd4ml-display:block; width:500px; height:28px; font-size:20px; border:0 none; margin:0; padding:0;" rows="1" cols="50"></textarea></td>
        </tr>
        {/if}
        {if isset($request_vars->project)}
        <tr>
            <td style="vertical-align:top; width:350px; background: none;"><h3 style="line-height:20px;">{$i.filter_project}: {$project_info->project}</h3></td>
            <td style="vertical-align:bottom; width:500px; background: none;"><textarea style="display:none; pd4ml-display:block; width:500px; height:28px; font-size:20px; border:0 none; margin:0; padding:0;" rows="1" cols="50"></textarea></td>
        </tr>
        {/if}
        {if isset($request_vars->project_group)}
        <tr>
            <td style="vertical-align:top; width:350px; background: none;"><h3 style="line-height:20px;">{$i.filter_project_group}: {$project_group_info->name}</h3></td>
            <td style="vertical-align:bottom; width:500px; background: none;"><textarea style="display:none; pd4ml-display:block; width:500px; height:28px; font-size:20px; border:0 none; margin:0; padding:0;" rows="1" cols="50"></textarea></td>
        </tr>
        {/if}
    </tbody>
</table>

<!-- ------------------------------------- Summen berechnen ------------------------------------- -->
{$sums_staff=array()}{$sums_projects=array()}
{foreach item=total from=$totals}
    {assign var="totalproject" value="total`$total->project_id`"}
    {if !isset($sums_projects.$totalproject)}{$sums_projects.$totalproject=0}{/if}
    
    {foreach item=staff from=$staff_list}
        {assign var="totalstaff" value="total`$staff->id`"}
        {if !isset($sums_staff.$totalstaff)}{$sums_staff.$totalstaff=0}{/if}
        {if isset($total->$totalstaff)}
            {$sums_staff.$totalstaff=$sums_staff.$totalstaff+$total->$totalstaff}
            {$sums_projects.$totalproject=$sums_projects.$totalproject+$total->$totalstaff}
        {/if}
    {/foreach}
{/foreach}
{if count($staff_list)>15}
    {$staff_class='rota'}
{elseif count($staff_list)>5}
    {$staff_class='rotc'}
{else}
    {$staff_class=''}
{/if}
<!-- ------------------------------------- Hauptliste ------------------------------------- -->
<table class="editablepop" style="margin-top: 2mm;">
    <thead>
        <tr>
            <th>{$i.reporting_rep_project}</th>
            {foreach item=staff from=$staff_list}
                {assign var="totalstaff" value="total`$staff->id`"}
                {if isset($sums_staff.$totalstaff) && !empty($sums_staff.$totalstaff)}<!-- Hide empty staff -->
                    <th class="{$staff_class}" title="{$staff->staff_name|truncate:100|escape:'html'}"><span>{$staff->staff_name|truncate:40|escape:'html'}</span></th>
                {/if}
            {/foreach}
            <th>{$i.reporting_rep_x_total}</th>
        </tr>
    </thead>
    <tbody>
        {foreach item=total from=$totals}
            {assign var="totalproject" value="total`$total->project_id`"}
            {if isset($sums_projects.$totalproject) && !empty($sums_projects.$totalproject)}<!-- Hide empty projects -->
            <tr>
                <th style="text-align:left;">{$total->project}</th>
                {foreach item=staff from=$staff_list}
                    {assign var="totalstaff" value="total`$staff->id`"}
                    {if isset($sums_staff.$totalstaff) && !empty($sums_staff.$totalstaff)}<!-- Hide empty staff -->
                        <td style="text-align:right; white-space:nowrap;">
                            {if isset($total->$totalstaff) && !empty($total->$totalstaff)}{isfloat value=$total->$totalstaff}{/if}
                        </td>
                    {/if}
                {/foreach}
                <th style="text-align:right; white-space:nowrap;">
                    {isfloat value=$sums_projects.$totalproject}
                </th>
            </tr>
            {/if}
        {/foreach}
        <tr>
            <th>{$i.reporting_rep_x_total}</th>
            {$sum_all=0}
            {foreach item=staff from=$staff_list}
                {assign var="totalstaff" value="total`$staff->id`"}
                {if isset($sums_staff.$totalstaff) && !empty($sums_staff.$totalstaff)}<!-- Hide empty staff -->
                    {$sum_all=$sum_all+$sums_staff.$totalstaff}
                    <th style="text-align:right; white-space:nowrap;">
                        {isfloat value=$sums_staff.$totalstaff}
                    </th>
                {/if}
            {/foreach}
            <th style="text-align:right; white-space:nowrap;">
                {isfloat value=$sum_all}
            </th>
        </tr>
    </tbody>
</table>

<!-- ------------------------------------- Mitarbeiter ohne Stunden ------------------------------------- -->

<p style="margin:1mm;">
    {$i.reporting_staff_no_hours}:
    {assign var="comma" value=""}
    {foreach item=staff from=$staff_list}{*
        *}{assign var="totalstaff" value="total`$staff->id`"}{*
        *}{if !isset($sums_staff.$totalstaff) || empty($sums_staff.$totalstaff)}{*
            *}{$comma} {$staff->staff_name}{*
            *}{assign var="comma" value=','}{*
        *}{/if}{*
    *}{/foreach}
    {if $comma neq ','}{$i.basic_no}{/if}
</p>