<?php

// Javascript-function as template only for categorie depending on date-filter (not status-filter)
$onLoadCall = "displayStatusMessage();";
$js_date = "";

// if ($f_exp_category == "4" || $f_exp_category == "5" || $f_exp_category == "6" || $f_exp_category == "7" || $f_exp_category == "8" || $f_exp_category == "9" || $f_exp_category == "110") :
   $js_date .= "<script src=\"../include/lib_global.js\" type=\"text/javascript\">\n";
   $js_date .= "</script>\n";
   $js_date .= "\n";
   $js_date .= "<script type=\"text/javascript\">\n";
   $js_date .= "<!--\n";
   $js_date .= "function initForm() {\n";
   $js_date .= "  fillDateFields(1,\"".$frameName."\",\"export_form\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
   $js_date .= "  setDateTimeFields(\"".$frameName."\",\"export_form\",".$day_to.",".$month_to.",".$year_to.", \"\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
   $js_date .= "}\n";
   $js_date .= "-->\n";
   $js_date .= "</script>\n";
   
   $onLoadCall .= "initForm();";
// endif;

// Number of input type="hidden" f_parstr_active and f_parstr_nodelimiter
$numOfinputHidden = 30;


// Generate filename
$f_fileName = getDateTime("year") .  getDateTime("month") .  getDateTime("day") .  getDateTime("hour") .  getDateTime("minute") .  "." . EXPORT_HQ_KEY . ".";

// Set parameters according to the export call
$outParameters = "";
$outParameters .= "<input type=\"hidden\" name=\"f_act\" value=\"export\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_delimiter\" value=\"|\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_fileName\" value=\"" . $f_fileName . "\">\n";

$outParameters .= "<input type=\"hidden\" name=\"f_exp_category\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_parname\" value=\"\">\n";   
$outParameters .= "<input type=\"hidden\" name=\"f_expp_id\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_parname_export\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_parname_new\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_fillUpChar\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_exportFileToDelete\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_bolchars\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_eolchars\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_bofchars\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_eofchars\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"day_from\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"month_from\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"year_from\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"cscIdRoot\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"customerId\" value=\"0\">\n";
$outParameters .= "<input type=\"hidden\" name=\"cscIdActual\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_export_mode\" value=\"\">\n";
$outParameters .= "<input type=\"hidden\" name=\"f_headline\" value=\"0\">\n";
$outParameters .= "<input type=\"hidden\" name=\"changeModfyStateDisabled\" value=\"\">\n";

for ($j = 0; $j < $numOfinputHidden; $j++) :
    $outParameters .= "<input id=\"" . $j . "\" type=\"hidden\" name=\"f_parstr_active[]\" value=\"\">\n";
    $outParameters .= "<input id=\"" . ($numOfinputHidden + $j) . "\" type=\"hidden\" name=\"f_parstr_nodelimiter[]\" value=\"\">\n";
endfor;

// Get special customer for the current employee logged in from table "parameter".
// This entry has to exist !!!
$empCsEidSpecialForCategory = "";
$parMaskDispositionCustomer = getParameterValue($emp_id, "MASK_DISPOSITION_INIT_CS", $hq_id);
if ($parMaskDispositionCustomer != "" && is_numeric($parMaskDispositionCustomer) && $parMaskDispositionCustomer != "0") :
   $empCsEidSpecialForCategory = getFieldValueFromId("customer", "cs_id", $parMaskDispositionCustomer, "cs_eid");
endif;
?>

<html>

<head>
<title>EXPORT</title>

<style type="text/css">
  <?php include_once ("../css/phoenix.css.php"); ?>
  <?php include_once ("../css/navigation.css.php"); ?>
  <?php include_once ("../css/mc.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(export_mode) {
  var export_yn = '1';
  var confirm_export = '0';
  var numOfinputHidden = <?php echo $numOfinputHidden ?>;
  var df = document.forms[0];

  // Set export mode for hidden document parameter, e.g. = "abr_kred_bv" using the same category like "abr" making needed changes for export process
  df.f_export_mode.value = export_mode;
  if (export_mode == 'abr' || export_mode == 'gut' || export_mode == 'abr_kred_bv' || export_mode == 'special') {
     if (df.day_to.value == '' || df.month_to.value == '' || df.year_to.value == '') {
     	export_yn = '0';
     	alert('Geben Sie bitte das Datum an, bis zu dem exportiert werden soll!');
     } else {
     	if (!confirm('Ist das bis-Datum ' + df.day_to.value + '.' + df.month_to.value + '.' + df.year_to.value + ' richtig?')) {
     	    export_yn = '0';
     	}
     }
  }
  if (export_mode == 'abr_kred_bv') {
  	  // Check for special customer has to be set !!!!
  	  var empCsEidSpecialForCategory = '<?php echo $empCsEidSpecialForCategory ?>';
  	  if (df.f_cs_eid_filter.value == '') {     // df.f_cs_eid_filter.value != empCsEidSpecialForCategory
  	  	 export_yn = '0';
  	  	 if (empCsEidSpecialForCategory != '') {
  	  	 	  df.f_cs_eid_filter.value = empCsEidSpecialForCategory;
  	  	 	  <?php
  	  	 	  if ($globalParUseRelatedCustomer == "1") :
  	  	 	     echo "setSelectedValue('f_csId', empCsEidSpecialForCategory);";
  	  	 	  endif;
  	  	 	  ?>
  	  	    alert('Die EID wurde automatisch eingetragen! Betätigen Sie bitte nochmals den Button oder löschen Sie ggfs. den Kunden wieder aus der Auswahl, wenn Sie eine andere Exportart gemäß Ihrer Berechtigungen ausführen möchten!');
  	  	 } else {
  	  	 	  alert('Stellen Sie bitte im Mitarbeiterstammblatt Ihren Default-Kunden ein!');
  	  	 }
  	  }      
  }
  if (export_mode == 'ums') {
  	  // Check for special customer has to be set !!!!
  	  var empCsEidSpecialForCategory = '<?php echo $empCsEidSpecialForCategory ?>';
  	  if (df.f_cs_eid_filter.value == '') {     // df.f_cs_eid_filter.value != empCsEidSpecialForCategory
  	  	 export_yn = '0';
  	  	 if (empCsEidSpecialForCategory != '') {
  	  	 	  df.f_cs_eid_filter.value = empCsEidSpecialForCategory;
  	  	 	  <?php
  	  	 	  if ($globalParUseRelatedCustomer == "1") :
  	  	 	     echo "setSelectedValue('f_csId', empCsEidSpecialForCategory);";
  	  	 	  endif;
  	  	 	  ?>
  	  	 	  // Get cs_id
  	  	 	  ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=customer&db_id_field=cs_eid&search_value=' + empCsEidSpecialForCategory + '&db_return_field=cs_id');
  	  	 	  if (retValue != '') {
  	  	 	  	 var cs_id_curr = retValue;
  	  	 	  	 var cs_grp_id_curr = 0;
  	  	 	  	 var tmpCsOrGrp = 'cs';
               for(var i = 1; i <= 10; i++) {
  	  	 	        // Set filter for payment modes regarding to definition by DB parameter
  	  	 	        ajaxRequestGet('../include/ajaxReqLib.php', 'mode=5&search_value=EXPORT_CAT_09_JBPMODE_NAMES_' + padl(i.toString(),2,'0') + '_CS&id_01=' + cs_id_curr);
  	  	 	        // If empty check for group parameter the customer belongs to
  	  	 	        if (retValue == '') {
  	  	 	        	 // Get grp_id from the current cs_id
  	  	 	           ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=customer&db_id_field=cs_id&search_value=' + cs_id_curr + '&db_return_field=cs_group');
  	  	 	           if (retValue != '') {
  	  	 	           	  var tmpGroupArray = retValue.split(",");
  	  	 	           	  cs_grp_id_curr = tmpGroupArray[1]  // .... because of the leading comma sign in group notation
  	  	 	        	    ajaxRequestGet('../include/ajaxReqLib.php', 'mode=5&search_value=EXPORT_CAT_09_JBPMODE_NAMES_' + padl(i.toString(),2,'0') + '_GRP&id_01=' + cs_grp_id_curr);
  	  	 	        	    tmpCsOrGrp = 'grp';
  	  	 	           }
  	  	 	        }
  	  	 	        if (retValue != '') {
  	  	 	        	  insertNewOption('f_jbp_filter', i, retValue, true, true);
  	  	 	        }
               }
               setSelectedValue('f_jbp_filter', 1);
  	  	 	  }
  	  	    alert('Die EID wurde automatisch eingetragen! Betätigen Sie bitte nochmals den Button oder löschen Sie ggfs. den Kunden wieder aus der Auswahl, wenn Sie eine andere Exportart gemäß Ihrer Berechtigungen ausführen möchten!');
  	  	 } else {
  	  	 	  alert('Stellen Sie bitte im Mitarbeiterstammblatt Ihren Default-Kunden ein!');
  	  	 }
  	  }      
  }

  if (export_yn == '1') {
     if (export_mode == 'deb') {
     	if (confirm('Export der Debitoren jetzt ausführen?')) {
     	   confirm_export = '1';
           df.f_fileName.value = df.f_fileName.value + 'deb';
           df.f_exp_category.value = '1';
           df.f_parname.value = 'RETRANS Debitorenstammsatz';                
           df.f_expp_id.value = '101';
           df.f_parname_export.value = 'RETRANS Debitorenstammsatz';         
        
           var f_parstr_active_tmp = new Array(2,3,7,8,10,11,12,13,15,23,24,26,27,29,31,40,42,43,44,45);
           for(var i = 0; i < f_parstr_active_tmp.length; i++) {
              document.getElementById(i).value = f_parstr_active_tmp[i];
           }
           var f_parstr_nodelimiter_tmp = new Array(11,42);
           for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
              document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];
           }
        }
     }
     if (export_mode == 'kred') {
     	if (confirm('Export der Kreditoren jetzt ausführen?')) {
     	   confirm_export = '1';
           df.f_fileName.value = df.f_fileName.value + 'kred';
           df.f_exp_category.value = '2';
           df.f_parname.value = 'RETRANS Kreditorenstammsatz';
           df.f_expp_id.value = '201';
           df.f_parname_export.value = 'RETRANS Kreditorenstammsatz';
        
           var f_parstr_active_tmp = new Array(1010,1020,1030,1040,1060,1070,1090,1160,1280,1290,1300,1310,1320,1360);
           for(var i = 0; i < f_parstr_active_tmp.length; i++) {
              document.getElementById(i).value = f_parstr_active_tmp[i];
           }
           var f_parstr_nodelimiter_tmp = new Array(1290,'');
           for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
              document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];           
           }
        }
     }
     if (export_mode == 'fzg') {
     	if (confirm('Export der Fahrzeuge jetzt ausführen?')) {
     	   confirm_export = '1';
           df.f_fileName.value = df.f_fileName.value + 'fzg';
           df.f_exp_category.value = '3';
           df.f_parname.value = 'RETRANS Fahrzeugstammsatz';
           df.f_expp_id.value = '301';
           df.f_parname_export.value = 'RETRANS Fahrzeugstammsatz';
        
           var f_parstr_active_tmp = new Array(2030,2040,2060,2080,2090,2100,2110,2120,2130,2150,2300,2350);
           for(var i = 0; i < f_parstr_active_tmp.length; i++) {
              document.getElementById(i).value = f_parstr_active_tmp[i];
           }
           var f_parstr_nodelimiter_tmp = new Array();
           for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
              document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];
           }
        }

        df.f_bolchars.value = '00';
     }
     if (export_mode == 'abr') {
     	if (confirm('Export der Aufträge jetzt ausführen?')) {
     	   confirm_export = '1';
           df.f_fileName.value = df.f_fileName.value + 'abr';
           df.f_exp_category.value = '5';
           df.f_parname.value = 'RETRANS Abrechnungen';
           df.f_expp_id.value = '501';
           df.f_parname_export.value = 'RETRANS Abrechnungen';

           var f_parstr_active_tmp = new Array(3300,3320,3325,3330,3340,3350,3360,3370,3390,3400,3410,3420,3430,3440,3460,3480,3500,3510,3520,3530,3570);
           for(var i = 0; i < f_parstr_active_tmp.length; i++) {
              document.getElementById(i).value = f_parstr_active_tmp[i];
           }
           var f_parstr_nodelimiter_tmp = new Array();
           for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
              document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];
           }

           df.day_from.value = '01';
           df.month_from.value = '01';
           df.year_from.value = '2004';
        }
     }
     if (export_mode == 'gut') {
     	if (confirm('Export der Gutschriften jetzt ausführen?')) {
     	   confirm_export = '1';
           df.f_fileName.value = df.f_fileName.value + 'gut';
           df.f_exp_category.value = '6';
           df.f_parname.value = 'RETRANS Abrechnungen';
           df.f_expp_id.value = '601';
           df.f_parname_export.value = 'RETRANS Abrechnungen';

           var f_parstr_active_tmp = new Array(3700,3720,3725,3730,3740,3750,3760,3770,3790,3800,3810,3820,3830,3840,3860,3880,3910,3920,3930,3970);
           for(var i = 0; i < f_parstr_active_tmp.length; i++) {
              document.getElementById(i).value = f_parstr_active_tmp[i];
           }
           var f_parstr_nodelimiter_tmp = new Array();
           for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
              document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];
           }

           df.day_from.value = '01';
           df.month_from.value = '01';
           df.year_from.value = '2004';
        }
     }
     if (export_mode == 'abr_kred_bv') {
     	if (confirm('Export der Aufträge jetzt ausführen?')) {
     	   confirm_export = '1';
           df.f_fileName.value = df.f_fileName.value + 'abr';
           df.f_exp_category.value = '8';
           df.f_parname.value = 'RETRANS Fuhrlohn';
           df.f_expp_id.value = '803';
           df.f_parname_export.value = 'RETRANS Fuhrlohn';

           var f_parstr_active_tmp = new Array(10100,10110,10120,10130,10140,10150,10160,10170,10180,10200,10210,10240,10250,10270,10310,10320,10330,10340,10380,10430,10460,10480,10500,10510,10520);
           for(var i = 0; i < f_parstr_active_tmp.length; i++) {
              document.getElementById(i).value = f_parstr_active_tmp[i];
           }
           var f_parstr_nodelimiter_tmp = new Array();
           for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
              document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];
           }

           df.day_from.value = '01';
           df.month_from.value = '01';
           df.year_from.value = '2004';
        }
     }
     if (export_mode == 'ums') {
     	if (confirm('Export der Einnahmen jetzt ausführen?')) {
     	   confirm_export = '1';
           df.f_fileName.value = df.f_fileName.value + 'ums';
           df.f_exp_category.value = '9';           
           df.f_parname.value = 'RETRANS Umsatz';
           df.f_expp_id.value = '903';
           df.f_parname_export.value = 'RETRANS Umsatz';

           var f_parstr_active_tmp = new Array(11010,11020,11040,11060,11080,11090,11100,11140,11160,11170,11180,11190,11210,11220,11230);
           for(var i = 0; i < f_parstr_active_tmp.length; i++) {
              document.getElementById(i).value = f_parstr_active_tmp[i];
           }
           var f_parstr_nodelimiter_tmp = new Array();
           for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
              document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];
           }

           df.day_from.value = '01';
           df.month_from.value = '01';
           df.year_from.value = '2004';
        }
     }
     
     if (export_mode == 'sales_deb') {
     	if (confirm('Export der Debitoren für Vertriebsaktivitäten jetzt ausführen?')) {
     	   confirm_export = '1';
           df.f_fileName.value = df.f_fileName.value + 'sales_deb';
           df.f_exp_category.value = '1';
           df.f_parname.value = 'Debitoren Vertrieb';
           df.f_expp_id.value = '701';
           df.f_parname_export.value = 'Debitoren Vertrieb';
           df.f_delimiter.value = ';';
           df.f_headline.value = '1';
           df.changeModfyStateDisabled.value = '1';  // Disable change of modification state of the db row
           /*
           var f_parstr_active_tmp = new Array(2,3,7,8,10,11,12,13,15,23,24,26,27,29,31,40,42,43,44,45);
           for(var i = 0; i < f_parstr_active_tmp.length; i++) {
              document.getElementById(i).value = f_parstr_active_tmp[i];
           }
           var f_parstr_nodelimiter_tmp = new Array(11,42);
           for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
              document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];
           }
           */
        }
     }
     
     if (export_mode == 'special') {
       if (df.f_cs_eid_filter.value == '') {
       	  confirm_export = '0';
       	  alert('Geben Sie bitte den Kunden an, dessen Daten exportiert werden sollen!');
       } else {
     	   if (confirm('Speziellen Export jetzt ausführen?')) {
     	      confirm_export = '1';
              df.f_fileName.value = df.f_fileName.value + 'abr';
              df.f_exp_category.value = '5';
              df.f_parname.value = 'RETRANS Abrechnungen';
              df.f_expp_id.value = '501';
              df.f_parname_export.value = 'RETRANS Abrechnungen';
         
              var f_parstr_active_tmp = new Array(3300,3320,3325,3330,3340,3350,3360,3370,3390,3400,3410,3420,3430,3440,3460,3480,3500,3510,3520,3530,3570);
              for(var i = 0; i < f_parstr_active_tmp.length; i++) {
                 document.getElementById(i).value = f_parstr_active_tmp[i];
              }
              var f_parstr_nodelimiter_tmp = new Array();
              for(var i = 0; i < f_parstr_nodelimiter_tmp.length; i++) {
                 document.getElementById(numOfinputHidden + i).value = f_parstr_nodelimiter_tmp[i];
              }
         
              df.day_from.value = '01';
              df.month_from.value = '01';
              df.year_from.value = '2004';
         }
       }     	
     }

     if (confirm_export == '1') {
        df.f_act.value='export';
        disabledButtons = new Array('action_cs','action_cr','action_vh','action_jb','action_jb2','action_jb3','action_jbp','action_special','action_sales_cs');
        df.submit();
     }
  }
};

function removeExportfile(f_exportFileToDeleteValue) {
  if (confirm('Exportdatei ' + f_exportFileToDeleteValue + ' entfernen?')) {
     document.forms[0].f_exportFileToDelete.value=f_exportFileToDeleteValue;
     // finishPage('removeExportfile');
     document.forms[0].f_act.value='removeExportfile';
     document.forms[0].submit();
  };
};

function finishPageWithDisabledCheck(export_mode, name) {
  notDisabled = checkButtonIsDisabled(name);
  if (notDisabled) {
  	 finishPage(export_mode);
  }
}

function finishPageConfig() {
	// document.forms[0].currentNavigationItem.value='datenexport';
	document.forms[0].f_act='';
  document.forms[0].submit();
}

function setRelatedCustomerValue() {
	document.forms[0].f_cs_eid_filter.value = getSelectedValue('f_csId');
}
-->
</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="mc_page-header" id="mc_page-header">
  <?php echo getLngt("Export ausführen") ?>
</div>

<div>
  <?php 
    if ($userTypeName == "hq" && $empHasAccess_06) :
       $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_DEBITOR_DISABLED", $hq_id);
       if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_DEBITOR_DISABLED", "0"); endif;
       if ($parButtonDisabled != "1") :
          echo defineButtonType10("Debitoren", "action_cs", "finishPageWithDisabledCheck('deb','action_cs');", "120", "left", "0");
       endif;

       $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_CREDITOR_DISABLED", $hq_id);
       if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_CREDITOR_DISABLED", "0"); endif;
       if ($parButtonDisabled != "1") :
          echo defineButtonType10("Kreditoren", "action_cr", "finishPageWithDisabledCheck('kred','action_cr');", "120", "left", "0");
       endif;

       $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_VEHICLE_DISABLED", $hq_id);
       if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_VEHICLE_DISABLED", "0"); endif;
       if ($parButtonDisabled != "1") :
          echo defineButtonType10("Fahrzeuge", "action_vh", "finishPageWithDisabledCheck('fzg','action_vh');", "120", "left", "0");
       endif;

       $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_DEBITNOTE_DISABLED", $hq_id);
       if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_DEBITNOTE_DISABLED", "0"); endif;
       if ($parButtonDisabled != "1") :
          echo defineButtonType10("Aufträge", "action_jb", "finishPageWithDisabledCheck('abr','action_jb');", "120", "left", "0");
       endif;

       $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_CREDITNOTE_DISABLED", $hq_id);
       if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_CREDITNOTE_DISABLED", "0"); endif;
       if ($parButtonDisabled != "1") :
          echo defineButtonType10("Gutschriften", "action_jb2", "finishPageWithDisabledCheck('gut','action_jb2');", "120", "left", "0");
       endif;

       $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_CARRIER_DISABLED", $hq_id);
       if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_CARRIER_DISABLED", "0"); endif;
       if ($parButtonDisabled != "1") :
          echo defineButtonType10("Fuhrlöhne", "action_jb3", "finishPageWithDisabledCheck('abr_kred_bv','action_crbv');", "120", "left", "0");
       endif;
    endif;

    if ($userTypeName == "hq" && $empHasAccess_26) :
       $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_COLLECTED_VOLUME_DISABLED", $hq_id);
       if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_COLLECTED_VOLUME_DISABLED", "0"); endif;
       if ($parButtonDisabled != "1") :
          echo defineButtonType10("Einnahmen", "action_jbp", "finishPageWithDisabledCheck('ums','action_jbp');", "120", "left", "0");
       endif;
    endif;
  ?>  
</div>

<?php if (false) : ?>
  <?php echo htmlDivLineSpacer("20px", "", "left"); ?>
  <div>
    <?php 
      if ($userTypeName == "hq" && $empHasAccess_06) :
         $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_DEBITOR_SALES_DISABLED", $hq_id);
         if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_DEBITOR_SALES_DISABLED", "0"); endif;
         if ($parButtonDisabled != "1") :
            echo defineButtonType10("Debitoren Vertrieb", "action_sales_cs", "finishPageWithDisabledCheck('sales_deb','action_sales_cs');", "200", "left", "3");
         endif;
      endif;
    ?>
  </div>  
<?php endif; ?>

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

<?php 
  if ($globalParUseRelatedCustomer == "1") : 
     $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_SPECIAL_DISABLED", $hq_id);
     if ($parButtonDisabled == "") : $parButtonDisabled = getParameterValue("0", "EXPORT_MASK_SPECIAL_DISABLED", "0"); endif;
     if ($parButtonDisabled != "1") :
        // Start pre-processor für special exports
        if ($userTypeName == "hq" && $empHasAccess_06 && $empHasAccess_05) :
           echo "<div>";
           echo defineButtonType10("Spezial", "action_special", "finishPageWithDisabledCheck('special','action_special');", "120", "left", "3");
           echo "</div>";
           echo htmlDivLineSpacer("70px");
        endif;
     endif;
  endif;
?>


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

<form name="export_form" action="../export/export.php" method="post">

<?php echo $phpCurrentNavigationInputHidden ?>
<?php echo $outParameters; ?>

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

<div class="mc_page-header" id="mc_page-header">
  <?php echo getLngt("Filter für Aufträge und Gutschriften") ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>

<div>
  <div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Export bis inklusive") ?>:</div>
  <div>
  <?php
   // To-Date
   $categoryFilter  = "<select name=\"day_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '".$frameName."', 'export_form', 'day_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
   $categoryFilter .= "<select name=\"month_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '".$frameName."', 'export_form', 'month_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
   $categoryFilter .= "<select name=\"year_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '".$frameName."', 'export_form', 'year_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
   echo $categoryFilter;
  ?>
  </div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>

<div>
  <div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Nur spezieller Kunde (EID)") ?>:</div>
  <div>
  <?php
   // Special customer
   if ($globalParUseRelatedCustomer != "1") :
      $categoryFilter = "<input type=\"text\" name=\"f_cs_eid_filter\" value=\"" . ($f_exp_category != "8" && $f_exp_category != "9" ? $f_cs_eid_filter : "") . "\" size=\"15\">\n";
   else :
      $categoryFilter = "<input type=\"text\" name=\"f_cs_eid_filter\" value=\"" . ($f_exp_category != "8" && $f_exp_category != "9" ? $f_cs_eid_filter : "") . "\" size=\"15\" readonly>\n";
      // Group selection (all groups with state "read only" will be displayed)
      // $categoryFilter .= "&nbsp;&nbsp;" . getLngt("Gruppe") . ":&nbsp;";
      // $categoryFilter .= "<select class=\"f8np1\" name=\"f_grpId\" id=\"f_grpId\" onChange=\"finishPage('');\">\n";
      // $categoryFilter .= "  <option value=\"\"" . ($f_grpId == "" ? "selected" : "") . ">" . getLngt("----") . "</option>\n";
      // $categoryFilter .=    addOptionsFromTable("groups AS grp","grp.grp_id","grp.grp_name","grp.grp_id","grp.md_id = '" . $md_id . "' AND grp.grp_readonly = '1'",$f_grpId);
      // $categoryFilter .= "</select>\n";
      // Customer selection
      $categoryFilter .= "&nbsp;&nbsp;" . getLngt("Kunde") . ":&nbsp;";
      $categoryFilter .= "<select class=\"f8np1\" name=\"f_csId\" id=\"f_csId\" onChange=\"setRelatedCustomerValue();\">\n";
      $categoryFilter .= "  <option value=\"\"" . ($f_csId == "" ? "selected" : "") . ">" . getLngt("----") . "</option>\n";
      $categoryFilter .=    addOptionsFromTable("customer AS cs, company AS cmp","cs.cs_eid","cmp.cmp_comp","cmp.cmp_comp","cs.hq_id = ('" . $hq_id . "') AND cmp.cmp_id = cs.cmp_id AND cmp.cmp_comp != 'EXTERN' AND cs.cs_id_parent != '0' AND NOT isnull(cs.cs_id_parent) AND cs.cs_group LIKE '%," . $f_grpId . ",%'",$f_csId);
      $categoryFilter .= "</select>\n";
   endif;
   echo $categoryFilter;
  ?>
  </div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>

<?php if ($userTypeName == "hq" && $empHasAccess_26) : ?>
  <div>
    <div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Auswahlfilter für Zahlarten") ?>:</div>
    <div>
    <?php
     // Special payment modes         
     $jbpModeFilter =  "<select name=\"f_jbp_filter\">\n";
     $jbpModeFilter .= "  <option value=\"\">----</option>\n";
     $jbpModeFilter .= "</select>\n";
     echo $jbpModeFilter;
    ?>
    </div>
  </div>
  <?php echo htmlDivLineSpacer("20px"); ?>
<?php endif; ?>

<?php if ($empHasAccess_06) : ?>
  <div>
    <div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Fahrzeug-Filter") ?>:</div>
    <div>
    <?php echo addCheckboxesFromTable("f_vht_filter","metatype","mt_sort","mt_value","mt_sort","mt_type = 'vehicletype' AND mt_sort > '0' AND mt_sort < '8'","", "&nbsp;&nbsp;&nbsp;&nbsp;"); ?>
    </div>
  </div>
  <?php echo htmlDivLineSpacer("50px"); ?>
<?php endif; ?>

<?php if ($empHasAccess_06) : ?>
  <div>
    <div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Passwort für Konfigurationen") ?>:</div>
    <div>
      <div style="float:left;">  
        <input type="password" name="adminInterfacePassword" value="" size="15">&nbsp;&nbsp;&nbsp;
      </div>
      <?php echo defineButtonType10("Konfiguration", "action_config", "finishPageConfig();", "120", "left"); ?>
    </div>
  </div>
<?php endif; ?>

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


<div class="mc_page-header" id="mc_page-header">
  <?php echo getLngt("Lokale Exportdateien (alle Kategorien)") ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
  <?php echo $storedExportFiles ?>
</div>

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

<div class="mc_page-header" id="mc_page-header">
  <?php echo getLngt("Exportdateien auf FTP-Server") ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
  <?php echo $storedRemoteExportFiles ?>
</div>


</form>
</div>
</body>
</html>     

