<?php
/*=======================================================================
 *
 * statistic_interface_hq.inc.php
 *
 * Autor: Marc Vollmann
 *
 =======================================================================*/
?>

<html>

<head>
<title><?php echo getLngt("STATISTIK"); ?></title>

<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
  <?php include_once ("../css/navigation.css.php"); ?>
</style>

<?php include_once ("../include/js_framework.inc.php"); ?>

<script src="../include/checkFormTags.js" type="text/javascript"></script>

<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>


function finishPage(f_act_value) {  
  document.forms[0].f_act.value=f_act_value;
  document.forms[0].submit();
};

function finishPageSort(col) {
	document.forms[0].f_sort.value=col;
  finishPage('calculate');
};

function searchCsCsc() {
  var f_act = 'search';
  
  var widthPopupWin = 950;
  var heightPopupWin = 600;
  var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
  var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
  var popupWin;
  popupWin = window.open("../admin/cs_csc_list.php?f_act=" + f_act + "&generic=0000000000001",
    "","dependent=yes,width=" + widthPopupWin + ",height=" +
    heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin +
    ",scrollbars=yes");
};

function clearSpecialCustomer() {	
  document.forms[0].g_cs_eid.value='';
};

function searchCourier(mode) {
  var f_act = 'search';

  var widthPopupWin = 850;
  var heightPopupWin = 600;
  var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
  var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
  var popupWin;

  popupWin = window.open("../admin/courier_list.php?f_act=" + f_act + "&f_mode=" + mode, "","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};

function clearCourier() {	
  document.forms[0].g_cr_id.value='';
  document.forms[0].g_cr_eid.value='';
};

function downloadFile() {
  var widthPopupWin = 850;
  var heightPopupWin = 600;
  var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
  var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
  var popupWin;

  popupWin = window.open("../statistic/statistic_data_download.php?f_fileName=<?php echo $f_secretFileName ?>", "","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};

function openChart() {
	// Submit separate form for opening chart page
  document.getElementById("statistic_chart").submit();
};

// Shows/Hides the group list
function groupList(displayState) {
  if (displayState == 'on') {
  	 myshow('groupList');
  	 myhide('groupListReduced');
  };
  if (displayState == 'off') {
  	 myshow('groupListReduced');
  	 myhide('groupList');
  };
}

// Shows/Hides the group list
function staticGroupList(displayState) {
  if (displayState == 'on') {
  	 myshow('staticGroupList');
  	 myhide('staticGroupListReduced');
  };
  if (displayState == 'off') {
  	 myshow('staticGroupListReduced');
  	 myhide('staticGroupList');
  };
}

// Shows/Hides the job service list
function jbServiceList(displayState) {
  if (displayState == 'on') {
  	 myshow('jbServiceList');
  	 myhide('jbServiceListReduced');
  };
  if (displayState == 'off') {
  	 myshow('jbServiceListReduced');
  	 myhide('jbServiceList');
  };
}

// Shows/Hides the services list
function serviceList(displayState) {
  if (displayState == 'on') {
  	 myshow('serviceList');
  };
  if (displayState == 'off') {
     myhide('serviceList');
  };
}

// Shows/Hides the job specifics list
function jbSpecificsList(displayState) {
  if (displayState == 'on') {
  	 myshow('jbSpecificsList');
  	 myhide('jbSpecificsListReduced');
  };
  if (displayState == 'off') {
  	 myshow('jbSpecificsListReduced');
  	 myhide('jbSpecificsList');
  };
}

// This function only calls the function serviceList
function callServiceList () {
	var elem = document.forms[0].f_statistic;
	var optLen = elem.length;
	serviceList('off');
  for (i = 0; i < optLen; ++i)
    if (elem.options[i].selected == true && 
        ( (elem.options[i].value >= 101 && elem.options[i].value <= 103) || 
          (elem.options[i].value >= 201 && elem.options[i].value <= 203) ||
          (elem.options[i].value >= 301 && elem.options[i].value <= 303)
        )
       ) {
    	serviceList('on');
    };
}

function openCustomerFilters () {
  var widthPopupWin = 900;
  var heightPopupWin = 700;
  var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
  var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
  var popupWin;
  var f_crvh_filter_str = document.forms[0].g_crvh_filter.value;
  popupWin = window.open("../admin/filter.php?f_crvh_filter_str=" + f_crvh_filter_str,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};

function checkSelectedChart () {
	var noStatistic = getSelectedValue('f_statistic');
	var typeChart = getSelectedValue('f_type_chart');
	var numOfIntervals = getSelectedValue('f_numOfIntervals');
	if (numOfIntervals == '') {numOfIntervals = 0};
// alert('numOfIntervals : ' + numOfIntervals + ' ---- typeChart : ' + typeChart);
	if (numOfIntervals > 0 || (noStatistic >= 11 && noStatistic <= 13) || (noStatistic >= 61 && noStatistic <= 62)) {
		 if (typeChart == 1 || typeChart == 2) {
		    setSelectedValue('f_type_chart', 10);
		    alert('<?php echo getLngt("Der Diagrammtyp für die Ausgabe wurde angepasst!") ?>');
		 }
  } else {
		 if (typeChart == 10 || typeChart == 11 || typeChart == 12 || typeChart == 13) {
		    setSelectedValue('f_type_chart', 1);
		    alert('<?php echo getLngt("Der Diagrammtyp für die Ausgabe wurde angepasst!") ?>');
		 }
	}
}

function checkSelectedIntervalByChart () {
	var noStatistic = getSelectedValue('f_statistic');
	var typeChart = getSelectedValue('f_type_chart');
	var numOfIntervals = getSelectedValue('f_numOfIntervals');	
	if (numOfIntervals == '') {numOfIntervals = 0};
// alert('numOfIntervals : ' + numOfIntervals + ' ---- typeChart : ' + typeChart);
	if (typeChart > 0) {
	   if (numOfIntervals > 0 || (noStatistic >= 11 && noStatistic <= 13) || (noStatistic >= 61 && noStatistic <= 62)) {
	   	 if (typeChart == 1 || typeChart == 2) {
	   	    setSelectedValue('f_type_chart', 0);
	   	    alert('<?php echo getLngt("Der Diagrammtyp kann nicht selektiert werden und wurde zurückgesetzt!") ?>');
	   	 }
     } else {
	   	 if (typeChart == 10 || typeChart == 11 || typeChart == 12 || typeChart == 13) {
	   	    setSelectedValue('f_type_chart', 0);
	   	    alert('<?php echo getLngt("Der Diagrammtyp kann nicht selektiert werden und wurde zurückgesetzt!") ?>');
	   	 }
	   }
	}
}

function setBaseValueWasChanged (fPriceMode) {
	// INIT
	var fPriceFormular = getSelectedValue('f_price_formular');
	if (fPriceFormular == 99) {
		 setSelectedValue('f_price_formular', 0);
	}
	
	// Servicepreis	
	if (fPriceMode == 4) {
		 setSelectedValue('f_price_formular', 99);
	}
// fPriceFormular = getSelectedValue('f_price_formular');  // TSZ
// alert(fPriceMode + ' ' + fPriceFormular);
}
-->
</script>

<?php echo $js_date ?>


</head>

<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?><?php echo $onLoadCall ?>" >

<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>

<div class="maincontent" name="maincontent" id="maincontent">

  <form name="statistic" action="../statistic/statistic_MC.php" method="post">
    <input type="hidden" name="f_act" value="">
    <input type="hidden" name="dbhistory" value="<?php echo $dbhistory ?>">
    <input type="hidden" name="outputTitle" value="<?php echo $outputTitle ?>">
    <input type="hidden" name="noStatisticMenu" value="<?php echo $noStatisticMenu ?>">
    <?php echo $phpCurrentNavigationInputHidden ?>
    <input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
  
    <?php
      if ($noStatisticMenu != "") :
    ?>     
         <input type="hidden" name="f_category" value="<?php echo $f_category ?>">
         <input type="hidden" name="f_statistic" value="<?php echo $f_statistic ?>">
         <input type="hidden" name="f_sort" value="<?php echo $f_sort ?>">
         <input type="hidden" name="outputColumnMode" value="<?php echo $outputColumnMode ?>">
         <input type="hidden" name="specialAligns" value="<?php echo $specialAligns ?>">
         <input type="hidden" name="g_cs_eid" value="<?php echo $g_cs_eid ?>">
         
         <input type="hidden" name="day_from" value="<?php echo $day_from ?>">
         <input type="hidden" name="month_from" value="<?php echo $month_from ?>">
         <input type="hidden" name="year_from" value="<?php echo $year_from ?>">
         <input type="hidden" name="day_to" value="<?php echo $day_to ?>">
         <input type="hidden" name="month_to" value="<?php echo $month_to ?>">
         <input type="hidden" name="year_to" value="<?php echo $year_to ?>">
    <?php
      else :
    ?>
  
    <input type="hidden" name="f_sort" value="<?php echo $f_sort ?>">
    <?php echo htmlDivLineSpacer("20px"); ?>
  
    <!-- Output of the calculated values -->  
    <div>
      <div class="f12bp1_blue"><?php echo getLngt("Optionen"); ?></div>
    </div>
  
    <?php echo htmlDivLineSpacer("15px"); ?>

    <?php if (true || $constDisplayPriceMode == "1") : ?>
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Betragsgrundlage"); ?>:</div>
        <div>          
          <select id="f_priceMode" name="f_priceMode" class="f8np1" onChange="submit();">
          <?php           
          // <select id="f_priceMode" name="f_priceMode" class="f8np1" onChange="setBaseValueWasChanged($(this).val());">
          $priceModeOutArrLen = count($priceModeOutArr);
          for ($o = 0; $o < $priceModeOutArrLen; $o++) :
              if ($priceModeOutArr[$o] != "") :
                 echo "  <option value=\"" . $o . "\"" . ($f_priceMode == $o ? " selected" : "") . ">" . $priceModeOutArr[$o] . "</option>\n";
              endif;
          endfor;
          ?>
          </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px"); ?>
    <?php endif; ?>

    <div>
      <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Kategorie"); ?>:</div>
      <div>
         <select class="f8np1" id="f_category" name="f_category" onChange="submit();">
           <option value="0" <?php if ($f_category == "0") : echo "selected"; endif; ?>><?php echo getLngt("BITTE AUSWÄHLEN"); ?></option>
           <option value="1" <?php if ($f_category == "1") : echo "selected"; endif; ?>><?php echo getLngt("Aufträge"); ?></option>
           <option value="2" <?php if ($f_category == "2") : echo "selected"; endif; ?>><?php echo getLngt("Transporteure"); ?></option>
           <option value="3" <?php if ($f_category == "3") : echo "selected"; endif; ?>><?php echo getLngt("Kunden"); ?></option>
         </select>
      </div>
    </div>
    
    <?php echo htmlDivLineSpacer("10px"); ?>

    <div>
      <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Statistik-Format"); ?>:</div>
      <div>
        <select class="f8np1" id="f_statistic" name="f_statistic" onChange="callServiceList(); checkSelectedChart();">
          <!-- ?php echo $parameterNamesOptions ? -->
          <option value="0" <?php if ($f_statistic == "0") : echo "selected"; endif; ?>><?php echo getLngt("BITTE AUSWÄHLEN"); ?></option>
          <?php if ($f_category == "1") : ?>
             <option value="0">-------</option>
             <option value="30" <?php if ($f_statistic == "30") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " aller erledigten Aufträge"); ?></option>
             <option value="31" <?php if ($f_statistic == "31") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Monat"); ?></option>
             <option value="32" <?php if ($f_statistic == "32") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Tag"); ?></option>
             <option value="33" <?php if ($f_statistic == "33") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Kalenderwoche"); ?></option>
             <option value="34" <?php if ($f_statistic == "34") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro halbem Monat"); ?></option>
             <?php if ($parGlobalUseRelatedCustomer != "1" && $f_priceMode == "0") : ?>
               <option value="0">-------</option>
               <option value="101" <?php if ($f_statistic == "101") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze aller erledigten Aufträge"); ?></option>
               <option value="102" <?php if ($f_statistic == "102") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Monat"); ?></option>
               <option value="103" <?php if ($f_statistic == "103") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Tag"); ?></option>
               <option value="104" <?php if ($f_statistic == "104") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Kalenderwoche"); ?></option>
               <option value="105" <?php if ($f_statistic == "105") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro halbem Monat"); ?></option>
             <?php endif; ?>
             <?php if (false && $constMaskStationsSurvey == "1") : ?>
               <option value="0">-------</option>
               <option value="3000" <?php if ($f_statistic == "3000") : echo "selected"; endif; ?>><?php echo getLngt("Bewertung der Transporte"); ?></option>
               <option value="3001" <?php if ($f_statistic == "3001") : echo "selected"; endif; ?>><?php echo getLngt("Bewertung der Transporte pro Monat"); ?></option>
               <option value="3002" <?php if ($f_statistic == "3002") : echo "selected"; endif; ?>><?php echo getLngt("Bewertung der Transporte pro Tag"); ?></option>
             <?php endif; ?>
          <?php endif; ?>
          <?php if ($f_category == "2") : ?>
             <option value="0">-------</option>
             <option value="10" <?php if ($f_statistic == "10") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " aller erledigter Aufträge pro Transporteur"); ?></option>
             <option value="11" <?php if ($f_statistic == "11") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Transporteur pro Monat"); ?></option>
             <option value="12" <?php if ($f_statistic == "12") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Transporteur pro Tag"); ?></option>
             <option value="13" <?php if ($f_statistic == "13") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Transporteur pro Kalenderwoche"); ?></option>
             <option value="14" <?php if ($f_statistic == "14") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Transporteur pro halbem Monat"); ?></option>
             <?php if ($parGlobalUseRelatedCustomer != "1" && $f_priceMode == "0") : ?>
               <option value="0">-------</option>
               <option value="201" <?php if ($f_statistic == "201") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze aller erledigten Aufträge"); ?></option>
               <option value="202" <?php if ($f_statistic == "202") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Monat"); ?></option>
               <option value="203" <?php if ($f_statistic == "203") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Tag"); ?></option>
               <option value="204" <?php if ($f_statistic == "204") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Kalenderwoche"); ?></option>
               <option value="205" <?php if ($f_statistic == "205") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro halbem Monat"); ?></option>
             <?php endif; ?>
             <option value="0">-------</option>
             <option value="15" <?php if ($f_statistic == "15") : echo "selected"; endif; ?>><?php echo getLngt("Annahmeverhalten: Zeit zw. Annahme und Abholung"); ?></option>
<?php if (false) : ?>
             <option value="2000" <?php if ($f_statistic == "2000") : echo "selected"; endif; ?>><?php echo getLngt("Endgerätenutzungsverhalten bzgl. Stationenanzahl"); ?></option>
             <option value="2010" <?php if ($f_statistic == "2010") : echo "selected"; endif; ?>><?php echo getLngt("Endgerätenutzungsverhalten in Prozent"); ?></option>
<?php endif; ?>
             <option value="0">-------</option>
<?php if (false) : ?>
             <option value="16" <?php if ($f_statistic == "16") : echo "selected"; endif; ?>><?php echo getLngt("Gesamte Onlinezeit (im angegebenen Uhrzeitintervall)"); ?></option>
             <option value="17" <?php if ($f_statistic == "17") : echo "selected"; endif; ?>><?php echo getLngt("Onlinezeit pro Monat (im angegebenen Uhrzeitintervall)"); ?></option>
             <option value="18" <?php if ($f_statistic == "18") : echo "selected"; endif; ?>><?php echo getLngt("Onlinezeit pro Tag (im angegebenen Uhrzeitintervall)"); ?></option>
             <option value="0">-------</option>
<?php endif; ?>
             <option value="1006" <?php if ($f_statistic == "1006") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl automatischer Auftragsvermittlungsveruche pro Transporteur"); ?></option>
             <option value="1007" <?php if ($f_statistic == "1007") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl manueller Auftragsvermittlungsveruche pro Transporteur"); ?></option>
             <option value="1003" <?php if ($f_statistic == "1003") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl angenommener Aufträge pro Transporteur"); ?></option>
             <option value="1011" <?php if ($f_statistic == "1011") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl abgelehnter Aufträge pro Transporteur"); ?></option>
             <option value="1008" <?php if ($f_statistic == "1008") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl automatisch entzogener Aufträge pro Transporteur"); ?></option>
           <!--  <option value="1009" <?php if ($f_statistic == "1009") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl manuell entzogener Aufträge pro Transporteur"); ?></option> -->
             <?php if (false && $constMaskStationsSurvey == "1") : ?>
               <option value="0">-------</option>
               <option value="3010" <?php if ($f_statistic == "3010") : echo "selected"; endif; ?>><?php echo getLngt("Bewertung der Transporte"); ?></option>
               <option value="3011" <?php if ($f_statistic == "3011") : echo "selected"; endif; ?>><?php echo getLngt("Bewertung der Transporte pro Monat"); ?></option>
               <option value="3012" <?php if ($f_statistic == "3012") : echo "selected"; endif; ?>><?php echo getLngt("Bewertung der Transporte pro Tag"); ?></option>
             <?php endif; ?>
          <?php endif; ?>
          <?php if ($f_category == "3") : ?>
             <option value="0">-------</option>
             <option value="60" <?php if ($f_statistic == "60") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " aller erledigten Aufträge pro Kunde"); ?></option>
             <option value="61" <?php if ($f_statistic == "61") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Monat pro Kunde"); ?></option>
             <option value="64" <?php if ($f_statistic == "64") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Tag pro Kunde"); ?></option>
             <option value="62" <?php if ($f_statistic == "62") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro Kalenderwoche pro Kunde"); ?></option>
             <option value="63" <?php if ($f_statistic == "63") : echo "selected"; endif; ?>><?php echo getLngt("Anzahl und " . $titleFieldNewValue . " erledigter Aufträge pro halbem Monat pro Kunde"); ?></option>
             <?php if ($parGlobalUseRelatedCustomer != "1" && $f_priceMode == "0") : ?>
               <option value="0">-------</option>
               <option value="301" <?php if ($f_statistic == "301") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze aller erledigten Aufträge"); ?></option>
               <option value="302" <?php if ($f_statistic == "302") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Monat"); ?></option>
               <option value="305" <?php if ($f_statistic == "305") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Tag"); ?></option>
               <option value="303" <?php if ($f_statistic == "303") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro Kalenderwoche"); ?></option>
               <option value="304" <?php if ($f_statistic == "304") : echo "selected"; endif; ?>><?php echo getLngt("Menge und Calculatorumsätze erledigter Aufträge pro halbem Monat"); ?></option>
             <?php endif; ?>
             <?php if (false && $constMaskStationsSurvey == "1") : ?>
               <option value="0">-------</option>
               <option value="3020" <?php if ($f_statistic == "3020") : echo "selected"; endif; ?>><?php echo getLngt("Bewertung der Transporte"); ?></option>
               <option value="3021" <?php if ($f_statistic == "3021") : echo "selected"; endif; ?>><?php echo getLngt("Bewertung der Transporte pro Monat"); ?></option>
             <?php endif; ?>
          <?php endif; ?>
        </select>
      </div>
    </div>
    <?php echo htmlDivLineSpacer("10px"); ?>

    <?php if (true) : ?>
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Datensicht/Rolle"); ?>:</div>
        <div>          
          <select id="f_roleView" name="f_roleView" class="f8np1" onChange="submit();">
          <?php           
          $roleViewOutArrLen = count($roleViewOutArr);
          for ($r = 0; $r < $roleViewOutArrLen; $r++) :
              if ($roleViewOutArr[$r] != "") :
                 echo "  <option value=\"" . $r . "\"" . ($f_roleView == $r ? " selected" : "") . ">" . $roleViewOutArr[$r] . "</option>\n";
              endif;
          endfor;
          ?>
          </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px"); ?>
    <?php endif; ?>

    <!-- Services -->
    <?php if ($parGlobalUseRelatedCustomer != "1") :  ?>
      <div id="serviceList" name="serviceList">
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Leistung"); ?>:</div>
        <div>    	
            <?php echo "Leistungstyp: "; ?>
            <select class="f8np1" name="f_servicetype">
            	<option value="0" <?php if ($f_servicetype == "0") : echo "selected"; endif; ?>>---</option>
              <?php echo addOptionsFromTable("servicetype","srvt_name","srvt_name","srvt_name","srvt_mode = '1' AND hq_id = '" . $hq_id . "'",$f_servicetype); ?>
            </select>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <?php echo "Preistyp: "; ?>
            <select class="f8np1" name="f_service">
            	<option value="0" <?php if ($f_service == "0") : echo "selected"; endif; ?>>---</option>
              <?php echo addOptionsFromTable("service","srv_name","srv_name","srv_name","srv_mode = '1' AND hq_id = '" . $hq_id . "'",$f_service); ?>
            </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px"); ?>
    <?php endif; ?>
  
    <!-- Headquarters checkboxes -->
    <?php if (authCheckEmployeeRights($emp_id, "10")) : ?>
      <?php echo getHeadquartersCheckboxes($f_hq_id, "200px"); ?>
      <?php echo htmlDivLineSpacer("10px", "", "left"); ?>
    <?php endif; ?>
  
    <div>
      <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Datums-Filter"); ?>:</div>
      <div>
        <?php 
        // Date ranges
        $categoryFilter  = "von:\n";      
        $categoryFilter .= "<select name=\"day_from\" class=\"f8np1\" onchange=\"fillDateFieldsCheck(0, 'maincontent', 'statistic', 'day_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
        $categoryFilter .= "<select name=\"month_from\" class=\"f8np1\" onchange=\"fillDateFieldsCheck(0, 'maincontent', 'statistic', 'month_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
        $categoryFilter .= "<select name=\"year_from\" class=\"f8np1\" onchange=\"fillDateFieldsCheck(0, 'maincontent', 'statistic', 'year_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";      
        $categoryFilter .= "&nbsp;&nbsp;bis:\n";     
        $categoryFilter .= "<select name=\"day_to\" class=\"f8np1\" onchange=\"fillDateFieldsCheck(0, 'maincontent', 'statistic', 'day_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
        $categoryFilter .= "<select name=\"month_to\" class=\"f8np1\" onchange=\"fillDateFieldsCheck(0, 'maincontent', 'statistic', 'month_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
        $categoryFilter .= "<select name=\"year_to\" class=\"f8np1\" onchange=\"fillDateFieldsCheck(0, 'maincontent', 'statistic', 'year_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
        $categoryFilter .= "&nbsp;<br>";
        echo $categoryFilter;
        ?>
        <?php echo htmlDivLineSpacer("5px"); ?>
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
        <?php 
        // Time ranges
        $categoryFilter  = "[";
        $categoryFilter .= "Ohne<input class=\"smaller\" type=\"radio\" name=\"f_showDateAndTime\" value=\"0\" " . ($f_showDateAndTime == "0" ? "checked" : "") . ">|";
        $categoryFilter .= "Mit<input class=\"smaller\" type=\"radio\" name=\"f_showDateAndTime\" value=\"1\" " . ($f_showDateAndTime == "1" ? "checked" : "") . ">";
        $categoryFilter .= "Einschränkung auf Zeitintervall von:\n";
        $categoryFilter .= "<select name=\"hour_from\" class=\"f8np1\">" . addOptionsFromRange("0","23",$hour_from,"1") . "</select>\n";
        $categoryFilter .= "<select name=\"minute_from\" class=\"f8np1\">" . addOptionsFromRange("0","59",$minute_from,"1") . "</select>\n";
        $categoryFilter .= "Uhr&nbsp;&nbsp;bis:\n";      
        $categoryFilter .= "<select name=\"hour_to\" class=\"f8np1\">" . addOptionsFromRange("0","23",$hour_to,"1") . "</select>\n";
        $categoryFilter .= "<select name=\"minute_to\" class=\"f8np1\">" . addOptionsFromRange("0","59",$minute_to,"1") . "</select>\n";
        $categoryFilter .= "Uhr]\n";
        echo $categoryFilter;
        ?>
      </div>
    </div>
  
    <?php echo htmlDivLineSpacer("10px"); ?>
  
    <?php if ($constIntervalsEnabled == "1") : ?>
    <div>
      <div <?php echo $htmlDivFixedWidth; ?>>Vergleichszeiträume:</div>
      <div>
        <select class="f8np1" name="f_numOfIntervals" onChange="checkSelectedChart();">
          <?php echo addOptionsFromRange("1",$constIntervalsNumOf,$f_numOfIntervals,"1"); ?>
        </select>
      </div>
    </div>
    <?php endif; ?>
  
    <?php echo htmlDivLineSpacer("10px"); ?>
  
    <div>
      <div <?php echo $htmlDivFixedWidth; ?>>Weitere Filter:</div>
      <div>
        <!-- Aufteilung nach Zeitintervallen: -->
        <div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Uhrzeitliche Aufteilung") ?>:</div>
        <div>
          <select class="f8np1" name="f_filter_interval">
            <option value="0" <?php if ($f_filter_interval == "0") : echo "selected"; endif; ?>><?php echo getLngt("KEINE AUSWAHL") ?></option>
            <option value="1" <?php if ($f_filter_interval == "1") : echo "selected"; endif; ?>><?php echo getLngt("halbstündlich") ?></option>
            <option value="2" <?php if ($f_filter_interval == "2") : echo "selected"; endif; ?>><?php echo getLngt("stündlich") ?></option>
            <option value="3" <?php if ($f_filter_interval == "3") : echo "selected"; endif; ?>><?php echo getLngt("zweistündlich") ?></option>
          </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
      
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
        <!-- Aufteilung nach Fahrzeugtyp: -->
        <div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung Fahrzeug/PLZ") ?>:</div>
        <div>
          <select class="f8np1" name="f_filter">
            <option value="0" <?php if ($f_filter == "0") : echo "selected"; endif; ?>><?php echo getLngt("KEINE AUSWAHL") ?></option>
            <option value="1" <?php if ($f_filter == "1") : echo "selected"; endif; ?>><?php echo getLngt("Fahrzeugtyp") ?></option>
            <option value="2" <?php if ($f_filter == "2") : echo "selected"; endif; ?>><?php echo getLngt("Start-PLZ") ?></option>
            <option value="3" <?php if ($f_filter == "3") : echo "selected"; endif; ?>><?php echo getLngt("Ziel-PLZ") ?></option>
            <option value="4" <?php if ($f_filter == "4") : echo "selected"; endif; ?>><?php echo getLngt("Fahrzeug und Start-PLZ") ?></option>
            <option value="5" <?php if ($f_filter == "5") : echo "selected"; endif; ?>><?php echo getLngt("Fahrzeug und Ziel-PLZ") ?></option>
            <option value="6" <?php if ($f_filter == "6") : echo "selected"; endif; ?>><?php echo getLngt("Startadresse und Adresse 2. Station") ?></option>
            <option value="7" <?php if ($f_filter == "7") : echo "selected"; endif; ?>><?php echo getLngt("Alle Ziel-PLZn") ?></option>
          </select>
        </div>    
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Fahrzeugtyp") ?>:</div>
      	<div>
          <select class="f8np1" name="f_filter_a">
            <option value="0" <?php if ($f_filter_a == "0") : echo "selected"; endif; ?>><?php echo getLngt("Angeforderter Fahrzeugtyp") ?></option>
            <option value="1" <?php if ($f_filter_a == "1") : echo "selected"; endif; ?>><?php echo getLngt("Gefahrener Fahrzeugtyp") ?></option>
          </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Mitarbeitern") ?>:</div>
      	<div>
      	 <input type="checkbox" name="f_filter8[]" value="1" <?php if ($f_filter8 == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <?php if (authCheckEmployeeRights($emp_id, "10")) : ?>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
          <div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Niederlassungen") ?>:</div>
          <div>
           <input type="checkbox" name="f_filter4[]" value="1" <?php if ($f_filter4 == "1") : echo "checked"; endif; ?>>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px"); ?>
      <?php endif; ?>
  
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Branchen") ?>:</div>
      	<div>
      	  <input type="checkbox" name="f_filter5[]" value="1" <?php if ($f_filter5 == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

      <?php if ($f_category == "2") : ?>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Kunden") ?>:</div>
      	  <div>
      	    <input type="checkbox" name="f_filter11[]" value="1" <?php if ($f_filter11 == "1") : echo "checked"; endif; ?>>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px"); ?>
      <?php endif; ?>

      <?php if ($f_category == "3") : ?>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Transporteuren") ?>:</div>
      	  <div>
      	    <input type="checkbox" name="f_filter6[]" value="1" <?php if ($f_filter6 == "1") : echo "checked"; endif; ?>>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px"); ?>
      <?php endif; ?>
      
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Fahrzeug-Nrn.") ?>:</div>
      	<div>
      	  <input type="checkbox" name="f_filter7[]" value="1" <?php if ($f_filter7 == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Partnerprovision") ?>:</div>
      	<div>
      	  <input type="checkbox" name="f_filter12[]" value="1" <?php if ($f_filter12 == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

<?php if (false) : ?>
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Anzeige der aktuellen Systemgebühr") ?>:</div>
      	<div>
      	  <input type="checkbox" name="f_filter13[]" value="1" <?php if (($f_category == "2" && $f_priceMode == "19") || $f_filter13 == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Anzeige der aktuellen Werbevergütung") ?>:</div>
      	<div>
      	  <input type="checkbox" name="f_filter14[]" value="1" <?php if (($f_category == "2" && $f_priceMode == "19") || $f_filter14 == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
<?php endif; ?>

      <?php if (false && $parGlobalUseRelatedCustomer == "1") : ?>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Zusatzmontage") ?>:</div>
        	<div>
            <select class="f8np1" name="f_price_formular">
              <option value="0" <?php if ($f_price_formular == "0") : echo "selected"; endif; ?>><?php echo getLngt("Mit Zusatzmontagestunden") ?></option>
              <option value="1" <?php if ($f_price_formular == "1") : echo "selected"; endif; ?>><?php echo getLngt("Ohne Zusatzmontagestunden") ?></option>
            </select>
          </div>
        </div>
      <?php else : ?>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<?php if ($f_priceMode == "0" || $f_priceMode == "2" || $f_priceMode == "3") : ?>
        	  <div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Zuschläge") ?>:</div>
        	  <div>
              <select class="f8np1" id="f_price_formular" name="f_price_formular">
                <option value="0" <?php if ($f_price_formular == "0") : echo "selected"; endif; ?>><?php echo getLngt("Mit TSZ, mit Servicepreis") ?></option>
                <option value="1" <?php if ($f_price_formular == "1") : echo "selected"; endif; ?>><?php echo getLngt("Ohne TSZ, ohne Servicepreis") ?></option>
                <?php if ($f_priceMode == "0") : ?>
                  <option value="2" <?php if ($f_price_formular == "2") : echo "selected"; endif; ?>><?php echo getLngt("Nur TSZ") ?></option>
                  <option value="3" <?php if ($f_price_formular == "3") : echo "selected"; endif; ?>><?php echo getLngt("TSZ gesondert") ?></option>
                <?php endif; ?>
              </select>
            </div>
          <?php elseif ($f_priceMode == "1") : ?>
        	  <div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Zuschläge") ?>:</div>
        	  <div>
              <select class="f8np1" id="f_price_formular" name="f_price_formular">
                <option value="0" <?php if ($f_price_formular == "0") : echo "selected"; endif; ?>><?php echo getLngt("Mit TSZ-FV, mit Servicevergütung") ?></option>
                <option value="1" <?php if ($f_price_formular == "1") : echo "selected"; endif; ?>><?php echo getLngt("Ohne TSZ-FV, ohne Servicevergütung") ?></option>
              </select>
            </div>
          <?php else : ?>
        	  <div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Zuschläge") ?>:</div>
        	  <div>
              <select class="f8np1" id="f_price_formular" name="f_price_formular">
                <option value="99" <?php if (true) : echo "selected"; endif; ?>><?php echo getLngt("KEINE RELEVANZ") ?></option>
              </select>
            </div>
          <?php endif; ?>
        </div>
      <?php endif; ?>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufträge") ?>:</div>
      	<div>
          <select class="f8np1" name="f_filter2">
            <option value="0" <?php if ($f_filter2 == "0") : echo "selected"; endif; ?>><?php echo getLngt("KEINE EINSCHRÄNKUNG") ?></option>
            <option value="1" <?php if ($f_filter2 == "1") : echo "selected"; endif; ?>><?php echo getLngt("Nur Aufträge (Betrag > 0)") ?></option>
            <option value="2" <?php if ($f_filter2 == "2") : echo "selected"; endif; ?>><?php echo getLngt("Nur Gutschriften") ?></option>
          </select>
        </div>    
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Einschränkung nach Auftragstyp") ?>:</div>
      	<div>
          <select name="f_filter3">
         	  <option value="0" <?php if ($f_filter3 == "0") : echo "selected"; endif; ?>>Alle</option>
            <?php echo addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'vht_product' AND mt_sort >= '2'",$f_filter3); ?>
          </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Nacherfassungen") ?>:</div>
      	<div>
          <select class="f8np1" name="f_bookedJobsOnly">
            <option value="0" <?php if ($f_bookedJobsOnly == "0") : echo "selected"; endif; ?>><?php echo getLngt("KEINE EINSCHRÄNKUNG") ?></option>
            <option value="1" <?php if ($f_bookedJobsOnly == "1") : echo "selected"; endif; ?>><?php echo getLngt("Nur Nacherfassungen") ?></option>
            <option value="2" <?php if ($f_bookedJobsOnly == "2") : echo "selected"; endif; ?>><?php echo getLngt("Ohne Nacherfassungen") ?></option>
          </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Daueraufträge") ?>:</div>
      	<div>
          <select class="f8np1" name="f_permanentJobsOnly">
            <option value="0" <?php if ($f_permanentJobsOnly == "0") : echo "selected"; endif; ?>><?php echo getLngt("KEINE EINSCHRÄNKUNG") ?></option>
            <option value="1" <?php if ($f_permanentJobsOnly == "1") : echo "selected"; endif; ?>><?php echo getLngt("Nur Daueraufträge") ?></option>
            <option value="2" <?php if ($f_permanentJobsOnly == "2") : echo "selected"; endif; ?>><?php echo getLngt("Ohne Daueraufträge") ?></option>
          </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Auftragstyp") ?>:</div>
      	<div>    	    	
      	 <input type="checkbox" name="f_filter9[]" value="1" <?php if ($f_filter9 == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Leistung") ?>:</div>
      	<div>    	    	
      	 <input type="checkbox" name="f_filter_calc[]" value="1" <?php if ($f_filter_calc == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <?php if ($parGlobalUseRelatedCustomer == "1") : ?>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Spezielle Leistung") ?>:</div>
        	<div>    	    	
            <select class="f8np1" name="f_service">
            	<option value="0" <?php if ($f_service == "0") : echo "selected"; endif; ?>>---</option>
              <?php echo addOptionsFromTable("jobcalculator","srv_name","srv_name","srv_name","",$f_service, "DISTINCT"); ?>
            </select>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px"); ?>
      <?php endif; ?>
  
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Kostenstellenaufteilung") ?>:</div>
      	<div>    	    	
          <select class="f8np1" name="f_filter10">
            <option value="0" <?php if ($f_filter10 == "0") : echo "selected"; endif; ?>><?php echo getLngt("KEINE AUSWAHL") ?></option>
            <option value="1" <?php if ($f_filter10 == "1") : echo "selected"; endif; ?>><?php echo getLngt("Bezahlende Kostenstelle") ?></option>
            <?php if ($parGlobalUseRelatedCustomer == "1") : ?>
              <option value="2" <?php if ($f_filter10 == "2") : echo "selected"; endif; ?>><?php echo getLngt("Bezugskostenstelle") ?></option>
            <?php endif; ?>
          </select>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Gewicht, Maße und Stellplätze") ?>:</div>
      	<div>
          <div>
            <span style="display: inline-block; width: 50px;"><?php echo getLngt("von") ?>&nbsp;</span>
            <?php echo getLngt("G:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_weight_from" value="<?php echo $f_filter_jb_weight_from ?>" size="3">
            <?php echo getLngt("L:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_length_from" value="<?php echo $f_filter_jb_length_from ?>" size="3">
            <?php echo getLngt("B:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_width_from" value="<?php echo $f_filter_jb_width_from ?>" size="3">
            <?php echo getLngt("H:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_height_from" value="<?php echo $f_filter_jb_height_from ?>" size="3">
            <?php echo getLngt("S:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_position_from" value="<?php echo $f_filter_jb_position_from ?>" size="3">
          </div>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
      <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
      <div>
      	<div <?php echo $htmlDivFixedWidth_0300; ?>>&nbsp;</div>
      	<div>
          <div>
            <span style="display: inline-block; width: 50px;"><?php echo getLngt("bis") ?>&nbsp;</span>
            <?php echo getLngt("G:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_weight_to" value="<?php echo $f_filter_jb_weight_to ?>" size="3">
            <?php echo getLngt("L:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_length_to" value="<?php echo $f_filter_jb_length_to ?>" size="3">
            <?php echo getLngt("B:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_width_to" value="<?php echo $f_filter_jb_width_to ?>" size="3">
            <?php echo getLngt("H:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_height_to" value="<?php echo $f_filter_jb_height_to ?>" size="3">
            <?php echo getLngt("S:") ?>&nbsp;<input type="text" class="smaller" name="f_filter_jb_position_to" value="<?php echo $f_filter_jb_position_to ?>" size="3">
          </div>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>

      <?php if ($f_category == "2" || $f_category == "3") : ?>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Anzeige der Rechnungsadresse") ?>:</div>
        	<div>    	    	
        	 <input type="checkbox" name="f_show_invoice_address[]" value="1" <?php if ($f_show_invoice_address == "1") : echo "checked"; endif; ?>>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px"); ?>
  
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Anzeige der Lieferadresse") ?>:</div>
        	<div>    	    	
        	 <input type="checkbox" name="f_show_delivery_address[]" value="1" <?php if ($f_show_delivery_address == "1") : echo "checked"; endif; ?>>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px"); ?>

        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Anzeige Stammblattdaten") ?>:</div>
        	<div>    	    	
        	 <input type="checkbox" name="f_show_master_data[]" value="1" <?php if ($f_show_master_data == "1") : echo "checked"; endif; ?>>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px"); ?>
      <?php endif; ?>
  
      <?php if ($parGlobalUseRelatedCustomer == "1") : ?>
  
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Auswahl Kundenservice") ?>:</div>
        	<div>
            <div id="jbServiceListReduced" name="jbServiceListReduced">
              <?php echo defineButtonType08("+", "action_lock", "jbServiceList('on');", "10", "left", "3") ?>
            </div>
            <div id="jbServiceList" name="jbServiceList">
              <?php echo defineButtonType08("-", "action_lock", "jbServiceList('off');", "10", "left", "3") ?>
              <div>
                <table border="0">
                  <tr>
                    <td>
                      <?php echo addCheckboxesFromTable("f_jb_service", "metatype", "mt_sort", "mt_value", "mt_sort", "mt_type = 'service' AND mt_sort != '1'", $f_jb_service, "</td></tr><tr><td>"); ?>
                    </td>
                  </tr>
                </table>
              </div>
            </div>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px", "", "left"); ?>
  
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Auswahl Auftragsmerkmale") ?>:</div>
        	<div>
            <div id="jbSpecificsListReduced" name="jbSpecificsListReduced">
              <?php echo defineButtonType08("+", "action_lock", "jbSpecificsList('on');", "10", "left", "3") ?>
            </div>
            <div id="jbSpecificsList" name="jbSpecificsList">
              <?php echo defineButtonType08("-", "action_lock", "jbSpecificsList('off');", "10", "left", "3") ?>
              <div>
                <table border="0">
                  <tr>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="1001" <?php if (in_array("1001", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Nur Serviceaufträge") ?>&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="2001" <?php if (in_array("2001", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Keine Serviceaufträge") ?>
                    </td>
                  </tr>
                  <tr>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="1002" <?php if (in_array("1002", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Nur Zusatzmontagebeträge") ?>&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="2002" <?php if (in_array("2002", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Ohne Zusatzmontagebeträge") ?>
                    </td>
                  </tr>
                  <tr>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="1003" <?php if (in_array("1003", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Nur zu Lasten der Spedition") ?>&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="2003" <?php if (in_array("2003", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Nicht zu Lasten der Spedition") ?>
                    </td>
                  </tr>
                  <?php if (false) : ?>
                  <tr>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="1003" <?php if (in_array("1003", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Nur Business-Card-Aufträge") ?>&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="2003" <?php if (in_array("2003", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Keine Business-Card-Aufträge") ?>
                    </td>
                  </tr>
                  <tr>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="1004" <?php if (in_array("1004", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Nur Family-Card-Aufträge") ?>&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td>
                      <input type="checkbox" name="f_jb_specifics[]" value="2004" <?php if (in_array("2004", $f_jb_specifics)) : echo "checked"; endif; ?>>&nbsp;<?php echo getLngt("Keine Family-Card-Aufträge") ?>
                    </td>
                  </tr>
                  <?php endif; ?>
                </table>
              </div>
            </div>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("5px", "", "left"); ?>
  
        <?php if (false) : ?>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
        	<div <?php echo $htmlDivFixedWidth_0300; ?>><?php echo getLngt("Aufteilung nach Kundenservices") ?>:</div>
        	<div>    	    	
        	 <input type="checkbox" name="f_split_jb_services[]" value="1" <?php if ($f_split_jb_services == "1") : echo "checked"; endif; ?>>
          </div>
        </div>
        <?php endif; ?>
  
      <?php endif; ?>
    </div>
    <?php echo htmlDivLineSpacer("10px"); ?>    
  
    <div>
      <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Fahrzeug (SID)"); ?>:</div>
      <div>
        <input type="text" name="f_crvh_sid" value="<?php echo $f_crvh_sid ?>" size="10">
      </div>
    </div>
    <?php echo htmlDivLineSpacer("10px"); ?>
  
    <div>
      <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Filter"); ?>:</div>
      <div style="float:left">
        <input class="f8np1" type="text" name="g_crvh_filter" value="<?php echo $g_crvh_filter ?>" size="20" readonly >&nbsp;
      </div>
      <?php echo defineButtonType08("...", "action_filter", "openCustomerFilters();", "20", "", "2"); ?>
    </div>
    <?php echo htmlDivLineSpacer("10px"); ?>
  
    <?php if ($parGlobalUseRelatedCustomer == "1") : ?>
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Statische Gruppen"); ?>:</div>
        <div>
          <div id="staticGroupListReduced" name="staticGroupListReduced">
            <?php echo defineButtonType08("+", "action_lock", "staticGroupList('on');", "10", "left", "3") ?>
          </div>
          <div id="staticGroupList" name="staticGroupList">
            <?php echo defineButtonType08("-", "action_lock", "staticGroupList('off');", "10", "left", "3") ?>
            <div>
              <table border="0">
                <tr>
                  <td>
                    <?php echo addCheckboxesFromTable("f_staticGroup", "groups", "grp_id", "grp_name", "grp_name", "md_id = '" . $md_id . "' AND hq_id = '0' AND grp_readonly = '1'", $f_staticGroup, "</td></tr><tr><td>"); ?>
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px", "", "left"); ?>
    <?php else : ?>
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Gruppen"); ?>:</div>
        <div>
          <div id="groupListReduced" name="groupListReduced">
            <?php echo defineButtonType08("+", "action_lock", "groupList('on');", "10", "left", "3") ?>
          </div>
          <div id="groupList" name="groupList">
            <?php echo defineButtonType08("-", "action_lock", "groupList('off');", "10", "left", "3") ?>
            <div>
              <table border="0">
                <tr>
                  <td>
                    <?php echo addCheckboxesFromTable("f_group", "groups", "grp_id", "grp_name", "grp_name", "md_id = '" . $md_id . "' AND hq_id =" . $hq_id, $f_group, "</td></tr><tr><td>"); ?>
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px", "", "left"); ?>
    <?php endif; ?>
  
  
  
    <?php if ($constDisplayDateMode == "1") : ?>
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Bezug Datums-Filter"); ?>:</div>
        <div>
        	<input type="radio" name="f_dateMode" value="0" <?php if ($f_dateMode == "0") : echo "checked"; endif; ?>> <?php echo getLngt("Auftragserstellungsdatum"); ?>
          <input type="radio" name="f_dateMode" value="1" <?php if ($f_dateMode == "1") : echo "checked"; endif; ?>> <?php echo getLngt("Buchungsdatum"); ?> &nbsp;
          <input type="radio" name="f_dateMode" value="2" <?php if ($f_dateMode == "2") : echo "checked"; endif; ?>> <?php echo getLngt("Erledigungsdatum"); ?> &nbsp;
          <input type="radio" name="f_dateMode" value="3" <?php if ($f_dateMode == "3") : echo "checked"; endif; ?>> <?php echo getLngt("Exportdatum"); ?> &nbsp;
          <input type="radio" name="f_dateMode" value="4" <?php if ($f_dateMode == "4") : echo "checked"; endif; ?>> <?php echo getLngt("Ausführungsdatum"); ?>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px"); ?>
  
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Auftragsstatus"); ?>:</div>
        <div>
        	<input type="radio" name="f_statusMode" value="0" <?php if ($f_statusMode == "0") : echo "checked"; endif; ?>> <?php echo getLngt("Alle"); ?> &nbsp;
          <input type="radio" name="f_statusMode" value="1" <?php if ($f_statusMode == "1") : echo "checked"; endif; ?>> <?php echo getLngt("Nur erledigte Aufträge"); ?> &nbsp;
          <input type="radio" name="f_statusMode" value="2" <?php if ($f_statusMode == "2") : echo "checked"; endif; ?>> <?php echo getLngt("Nur exportierte Aufträge"); ?>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px"); ?>
  
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Zentrale/Kunde"); ?>:</div>
        <div>
        	<input type="radio" name="f_editCsMode" value="0" <?php if ($f_editCsMode == "0") : echo "checked"; endif; ?>> <?php echo getLngt("Alle"); ?> &nbsp;
          <input type="radio" name="f_editCsMode" value="1" <?php if ($f_editCsMode == "1") : echo "checked"; endif; ?>> <?php echo getLngt("Nur zentralenseitig erstellte Aufträge"); ?> &nbsp;
          <input type="radio" name="f_editCsMode" value="2" <?php if ($f_editCsMode == "2") : echo "checked"; endif; ?>> <?php echo getLngt("Nur kundenseitig manuell erstellte Aufträge"); ?>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px"); ?>
    <?php endif; ?>

    <div>
      <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Sortierung"); ?>:</div>
      <div>
        <input type="radio" name="f_direction_sort" value="0" <?php if ($f_direction_sort == "0") : echo "checked"; endif; ?>> <?php echo getLngt("Aufsteigend"); ?> &nbsp;
        <input type="radio" name="f_direction_sort" value="1" <?php if ($f_direction_sort == "1") : echo "checked"; endif; ?>> <?php echo getLngt("Absteigend"); ?> &nbsp;
      </div>
    </div>
    <?php echo htmlDivLineSpacer("10px"); ?>
  
    <?php if ($f_category == "2") : ?>
    <?php 
      $constCrEidEdit = getParameterValue("0", "MASK_STATISTIC_CR_EID_EDIT", $hq_id);
      if ($constCrEidEdit == "") : $constCrEidEdit = getParameterValue("0", "MASK_STATISTIC_CR_EID_EDIT", "0"); endif;
    ?>
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Transporteurnummer"); ?>:</div>
        <div>            
          <input type="hidden" name="g_cr_id" value="">
          <input type="text" name="g_cr_eid" value="<?php echo $g_cr_eid ?>" size="10" <?php if ($constCrEidEdit != "1") : echo "readonly"; endif; ?>>
          <input type="button" value="..." onClick="searchCourier('3');" tabindex="5">
          <a href="javascript:clearCourier();"><img src="../images/waste.png" border="0" height="25" width="20" tabindex="6"></a>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          Nur selektierter Transporteur
          <input type="radio" name="f_cr_meta" value="0" <?php if ($f_cr_meta == "0") : echo "checked"; endif; ?>>
          &nbsp;&nbsp;&nbsp;&nbsp;Aufteilung nach zugeordneten Fahrern
          <input type="radio" name="f_cr_meta" value="1" <?php if ($f_cr_meta == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <?php if ($parGlobalUseRelatedCustomer == "1") : ?>
        <div>
          <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Unternehmer / Fahrzeuge"); ?>:</div>
          <div>
              <input type="radio" name="f_cr_parent" value="0" <?php if ($f_cr_parent == "0") : echo "checked"; endif; ?>>
              &nbsp;<?php echo getLngt("Alle (Unternehmer und Fahrzeuge) einzeln"); ?>
              <input type="radio" name="f_cr_parent" value="1" <?php if ($f_cr_parent == "1") : echo "checked"; endif; ?>>
              &nbsp;<?php echo getLngt("Nur Fahrzeuge zusammengefasst zu Unternehmern"); ?>
              <input type="radio" name="f_cr_parent" value="2" <?php if ($f_cr_parent == "2") : echo "checked"; endif; ?>>
              &nbsp;<?php echo getLngt("Alle zusammengefasst zu Unternehmern"); ?>
          </div>
        </div>
      <?php else : ?>
        <div>
          <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Unternehmer / Fahrer"); ?>:</div>
          <div>
              <input type="radio" name="f_cr_parent" value="0" <?php if ($f_cr_parent == "0") : echo "checked"; endif; ?>>
              &nbsp;<?php echo getLngt("Alle (Unternehmer und Fahrer) einzeln"); ?>
              <input type="radio" name="f_cr_parent" value="1" <?php if ($f_cr_parent == "1") : echo "checked"; endif; ?>>
              &nbsp;<?php echo getLngt("Nur Fahrer zusammengefasst zu Unternehmern"); ?>
              <input type="radio" name="f_cr_parent" value="2" <?php if ($f_cr_parent == "2") : echo "checked"; endif; ?>>
              &nbsp;<?php echo getLngt("Alle zusammengefasst zu Unternehmern"); ?>
          </div>
        </div>
      <?php endif; ?>
      <?php echo htmlDivLineSpacer("5px"); ?>
  
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Filter Transporteurverhalten"); ?>:</div>
        <div>
          <input type="radio" name="f_cr_pda_actions" value="0" <?php if ($f_cr_pda_actions == "0") : echo "checked"; endif; ?>>
          &nbsp;<?php echo getLngt("Mehrfachaktionen pro Auftrag nicht beachten"); ?>
          &nbsp;&nbsp;&nbsp;&nbsp;
          <input type="radio" name="f_cr_pda_actions" value="1" <?php if ($f_cr_pda_actions == "1") : echo "checked"; endif; ?>>
          &nbsp;<?php echo getLngt("Mehrfachaktionen pro Auftrag einbeziehen"); ?>
        </div>
      </div>
      
      <?php echo htmlDivLineSpacer("10px"); ?>
    <?php endif; ?>
  
  
    <?php if ($f_category == "3") : ?>
    <?php 
      $constCsEidEdit = getParameterValue("0", "MASK_STATISTIC_CS_EID_EDIT", $hq_id);
      if ($constCsEidEdit == "") : $constCsEidEdit = getParameterValue("0", "MASK_STATISTIC_CS_EID_EDIT", "0"); endif;
    ?>
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Kundennummer"); ?>:</div>
        <div>
          <input type="text" name="g_cs_eid" value="<?php echo $g_cs_eid ?>" size="10" <?php if ($constCsEidEdit != "1") : echo "readonly"; endif; ?>>
          <input class="smaller" type="button" value="..." onClick="searchCsCsc();">
          <a href="javascript:clearSpecialCustomer();" tabindex="340"><img src="../images/waste.png" border="0" height="15" width="12"></a>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <?php echo getLngt("Ohne Gruppenkunden"); ?>
          <input type="radio" name="f_cs_meta" value="0" <?php if ($f_cs_meta == "0") : echo "checked"; endif; ?>>
          &nbsp;&nbsp;&nbsp;&nbsp;<?php echo getLngt("Aufteilung nach zugeordneten Kunden"); ?>
          <input type="radio" name="f_cs_meta" value="1" <?php if ($f_cs_meta == "1") : echo "checked"; endif; ?>>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px"); ?>
  
      <?php if ($constDisplayCreationDateDisabled != "1") : ?>
        <div>
          <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
          <div>
            <?php echo getLngt("Datensatz angelegt seit"); ?>: 
            <select name="f_cmp_new_date_month" class="f8np1">
              <?php echo addOptionsFromRange("1","12",$f_cmp_new_date_month,"1") ?>
            </select> <?php echo getLngt("(Monat)"); ?>
            <select name="f_cmp_new_date_year" class="f8np1">
              <?php echo addOptionsFromRange("2000",getDateTime("year"),$f_cmp_new_date_year,"1") ?>
            </select> <?php echo getLngt("((Jahr)"); ?>
          </div>
        </div>
        <?php echo htmlDivLineSpacer("10px"); ?>
      <?php endif; ?>
  
      <div>
        <div <?php echo $htmlDivFixedWidth; ?>>&nbsp;</div>
        <div>
          <?php echo getLngt("Nur Neukunden seit"); ?>: 
          <select name="f_cs_become_cs_date_month" class="f8np1">
            <?php echo addOptionsFromRange("1","12",$f_cs_become_cs_date_month,"1") ?>
          </select> <?php echo getLngt("(Monat)"); ?>
          <select name="f_cs_become_cs_date_year" class="f8np1">
            <?php echo addOptionsFromRange("2000",getDateTime("year"),$f_cs_become_cs_date_year,"1") ?>
          </select> <?php echo getLngt("((Jahr)"); ?>
        </div>
      </div>
      <?php echo htmlDivLineSpacer("10px"); ?>
    <?php endif; ?>
  
    <div>
      <div <?php echo $htmlDivFixedWidth; ?>><?php echo getLngt("Statistik berechnen"); ?>:</div>
      <div>
        <?php echo defineButton("Berechnen", "action_statistic", "finishPage('calculate');", "left", "", "", "", "100px"); ?>
        <?php if (authCheckEmployeeRights($emp_id, "23")) : ?>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <input type="checkbox" name="fileOutput" value="1" <?php /* if ($fileOutput) : echo "checked"; endif; */ ?>>&nbsp;<?php echo getLngt("Zusätzlicher&nbsp;Download&nbsp;der&nbsp;Daten"); ?>
  
           <?php if ($parGlobalUseRelatedCustomer == "1") : ?>
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                 <input type="radio" name="f_net_gross" value="0" <?php if ($f_net_gross == "0") : echo "checked"; endif; ?>>
                 &nbsp;<?php echo getLngt("Netto"); ?>
                 &nbsp;&nbsp;
                 <input type="radio" name="f_net_gross" value="1" <?php if ($f_net_gross == "1") : echo "checked"; endif; ?>>
                 &nbsp;<?php echo getLngt("Brutto"); ?>
           <?php endif; ?>
        <?php endif; ?>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <select class="f8np1" name="f_type_chart" onChange="checkSelectedIntervalByChart();">
          <option value="0" <?php if ($f_type_chart == "0") : echo "selected"; endif; ?>><?php echo getLngt("Keine Diagrammausgabe") ?></option>
          <option value="1" <?php if ($f_type_chart == "1") : echo "selected"; endif; ?>><?php echo getLngt("Tortendiagramm") ?></option>
          <option value="2" <?php if ($f_type_chart == "2") : echo "selected"; endif; ?>><?php echo getLngt("Balkendiagramm") ?></option>
          <option value="10" <?php if ($f_type_chart == "10") : echo "selected"; endif; ?>><?php echo getLngt("Normierter Stapel auf 100%") ?></option>
          <option value="11" <?php if ($f_type_chart == "11") : echo "selected"; endif; ?>><?php echo getLngt("Multi-Balkendiagramm") ?></option>
          <option value="12" <?php if ($f_type_chart == "12") : echo "selected"; endif; ?>><?php echo getLngt("Flächenstapeldiagramm") ?></option>
          <option value="13" <?php if ($f_type_chart == "13") : echo "selected"; endif; ?>><?php echo getLngt("Flächendiagramm") ?></option>
        </select>
      </div>
    </div>
    
    <?php echo htmlDivLineSpacer("30px"); ?>
   
    <?php
      endif;
    ?> 
  
  </form>


  <?php if ($f_type_chart > 0) : ?>
    <form id="statistic_chart" name="statistic_chart" action="../tools/ej_all.php" method="post" target="_blank" on_>

      <input type="hidden" name="type" value="<?php echo $f_type_chart ?>">
      <input type="hidden" name="json" value="<?php echo $json ?>">
      <input type="hidden" name="interval_from" value="<?php echo $interval_from ?>">
      <input type="hidden" name="interval_to" value="<?php echo $interval_to ?>">
      <input type="hidden" name="range_min" value="<?php echo $range_min ?>">
      <input type="hidden" name="range_max" value="<?php echo $range_max ?>">
      <input type="hidden" name="range_step" value="<?php echo $range_step ?>">
      <input type="hidden" name="scale_factor_height" value="<?php echo $scale_factor_height ?>">
      <input type="hidden" name="title" value="<?php echo $chartTitle ?>">

    </form>
  <?php endif; ?>
  
  <?php echo htmlDivLineSpacer("30px"); ?>


  <!-- Display calculated values -->
  <div>
    <div class="f12bp1_blue"><?php if ($outputTitle != "") : echo $outputTitle; else : echo getLngt("Aufstellung") . " " . $priceModeOutArr[$f_priceMode]; endif; ?></div>
  </div>

  <?php echo htmlDivLineSpacer("15px"); ?>

  <div>
    <table>
      <?php echo $tableHeader ?>
      <?php echo $tableBody ?>
      <?php 
         if (mcIsSet($rowCounter, 0) > 1) :
            echo "<tr>";
            for ($i = 1; $i < ($posOfLastSummationField + 1); $i++) :
                echo "<td>&nbsp;</td>";
            endfor;
            echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField . "&nbsp;&nbsp;</td>";
            if ($numOfSummationCols > 1) :
               // Special handling for BSG
               if ($f_priceMode == "3") :
                  // $sumOfSummationField2 = round(($sumOfSummationField2 / $rowCounter), 2);
                  $sumOfSummationField2 = "";
               endif;
               echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField2 . "&nbsp;&nbsp;</td>";
               if ($statisticAllValues) :
                  // Special handling for BSG
                  $sumOfSummationField5 = "";
                  $tmpSumOfSummationField2 = str_replace(",", ".", str_replace(".", "", $sumOfSummationField2));
                  $tmpSumOfSummationField3 = str_replace(",", ".", str_replace(".", "", $sumOfSummationField3));
                  if ($tmpSumOfSummationField2 != 0 && $tmpSumOfSummationField3 != 0) :                      
                     $sumOfSummationField5 = round(((($tmpSumOfSummationField2 - $tmpSumOfSummationField3) / $tmpSumOfSummationField2) * 100), 2);
                  endif;
                  echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField3 . "&nbsp;&nbsp;</td>";
                  echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField4 . "&nbsp;&nbsp;</td>";
                  echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField5 . "&nbsp;&nbsp;</td>";
                  echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField6 . "&nbsp;&nbsp;</td>";
                  echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField7 . "&nbsp;&nbsp;</td>";
                  echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField8 . "&nbsp;&nbsp;</td>";
                  echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField9 . "&nbsp;&nbsp;</td>";
               else :            
                  if ($numOfSummationCols == 3) :
                     echo "<td align=\"right\" class=\"f8np1_red\">" . $sumOfSummationField3 . "&nbsp;&nbsp;</td>";
                  endif;
               endif;
            endif;
            
            if ($summationFieldArrayLen > 0) :
               for ($i = 0; $i < $summationFieldArrayLen; $i++) :
                   echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray[$i] . "&nbsp;&nbsp;</td>";
                   if ($numOfSummationCols > 1) :
                      echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray2[$i] . "&nbsp;&nbsp;</td>";
                      if ($statisticAllValues) :
                         echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray3[$i] . "&nbsp;&nbsp;</td>";
                         echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray4[$i] . "&nbsp;&nbsp;</td>";
                         echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray5[$i] . "&nbsp;&nbsp;</td>";
                         echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray6[$i] . "&nbsp;&nbsp;</td>";
                         echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray7[$i] . "&nbsp;&nbsp;</td>";
                         echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray8[$i] . "&nbsp;&nbsp;</td>";
                         echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray9[$i] . "&nbsp;&nbsp;</td>";
                      else :
                         if ($numOfSummationCols == 3) :
                            echo "<td align=\"right\" class=\"f8np1_red\">&nbsp;" . $sumOfSummationFieldArray3[$i] . "&nbsp;&nbsp;</td>";
                         endif;
                      endif;
                   endif;                
               endfor;
            endif;
            echo "</tr>";
         endif;
         
         // Special output regarding to the statistic category
         if ($f_statistic == "2000") :
            echo "<tr>";
            echo "  <td colspan=\"10\" class=\"f12np1_red\">&nbsp;";
            echo getLngt("Nutzungsgrad der Endgeräte im selektierten Zeitraum insgesamt") . "&nbsp:&nbsp&nbsp" . round((($sumOfSummationField / $sumOfSummationField2) * 100), 2) . "&nbsp;%";
            echo "  </td>";
            echo "</tr>";
         endif;
      ?> 
    </table>
  </div>

</div>

</body>
</html>     

