<?php
/*=======================================================================
 *
 * import_ZONE_JOBS.php
 *
 * Autor: Marc Vollmann
 *
 =======================================================================*/


// $doNotIncludeGeocode = true;
include_once ("../import/import.php");
include_once ("../include/inc_vehicle.inc.php");
include_once ("../include/inc_job.inc.php");
include_once ("../locating/xServer.inc.php");


// Execution-Time for script
set_time_limit(0);


// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "statusMessage", "importFile", "executeImportProcess", "deactivateMenu", "objType", "objId"));


getLanguage(__FILE__);

$deactivateMenuStatic = "1";
$pageTitel = getLngt("IMPORT AUFTRÄGE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);

// Check for authentication access
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
if (!(authCheckEmployeeRights($emp_id, "22"))) : gotoReferer("1"); endif;

$empHasAdminRights = false;
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin) : 
   $empHasAdminRights = true;
endif;
$debug = false;
if ($empIdRootAdmin == $emp_id) :
   $debug = false;
endif;

if ($f_act != "executeImport" || $executeImportProcess != "1") : $executeImportProcess = ""; endif;    // Execute import after check run
$showExecutionProcessButton = true;
$outText = "";
$closeWindow = "0";
$delimiter = ";";
$fire = true;  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

$currentDate = getDateTime(3);
$objType = strtolower($objType);


// Import for special customer ONLY !!!!
$csEid = "";
$cscIdPayer = "";
$srvzIdArray = array();
if ($objType == "cs" && $objId != "" && is_numeric($objId)) :
   $csId = $objId;
endif;
if ($objType == "csc" && $objId != "" && is_numeric($objId)) :
   $cscIdPayer = $objId;
   $csId = getFieldValueFromClause("costcenter", "cs_id", "csc_id = '" . $cscIdPayer . "'");   
endif;
if ($csId != "") : 
   $hqId = getFieldValueFromClause("customer", "hq_id", "cs_id = '" . $csId . "'");
   $csEid = getFieldValueFromClause("customer", "cs_eid", "cs_id = '" . $csId . "'");

   // Get root costcenter
   $cscIdPayer = getFieldValueFromClause("costcenter", "csc_id", "cs_id = '" . $csId . "' AND (isnull(csc_pre_id) OR csc_pre_id = '')");

   // Get zone ids (primary key) of the current customer
   $srvzIdArray = getColVectorFromDB2ArrayByClause("phoenix.servicezone", "srvz_id", "hq_id = '" . $hqId . "' AND cs_id = '" . $csId . "'");

   $csAddress = getAddress($csId, "costcenteraddress");
   $adIdFrom = $csAddress["id"];
   $adZipcodeFrom = $csAddress["zipcode"];
   $adCityFrom = $csAddress["city"];
   $adCountryFrom = $csAddress["country"];
   $trHsnoFrom = $csAddress["hsno"];
   if ($trHsnoFrom == "") : $trHsnoFrom = "."; endif;
   $trCompFrom = $csAddress["comp"];
   if ($trCompFrom == "") : $trCompFrom = "IMPORT"; endif;
   $trFloorFrom = "";
endif;
if ($hqId == "") : 
   $hqId = $hq_id;
endif;
$srvzIdArrayLen = count($srvzIdArray);

$cscIdPayerExtern = getParameterValue("0", "CSC_ID_PAYER_EXTERN", $hqId);

$pickUpStationFinishedByDefault = true;


// Current file to be imported
$importFile = urldecode($importFile);
$posLastSlash = strrpos($importFile, "/");
$posLastSlash++;
$pathname = substr($importFile, 0, $posLastSlash);
$filename = substr($importFile, $posLastSlash);
$outText = "<span class=\"f10bp1_blue\">" . getLngt("IMPORTDATEI:") . "</span>&nbsp;" . $filename . "<br><br>";


// Mapping "tour id" to "vehicle SID"
/*
$tourVehicleArray = array();
$tourVehicleArray["294501"] = "E501";
$tourVehicleArray["294502"] = "E502";
$tourVehicleArray["294503"] = "E503";
$tourVehicleArray["294504"] = "E504";
$tourVehicleArray["294505"] = "E505";
$tourVehicleArray["294506"] = "E506";
$tourVehicleArray["294507"] = "E507";
$tourVehicleArray["294508"] = "E508";
$tourVehicleArray["294509"] = "E509";
$tourVehicleArray["294510"] = "E510";
$tourVehicleArray["294511"] = "E511";
$tourVehicleArray["294512"] = "E512";
$tourVehicleArray["294590"] = "E590";
*/

$tourCourierArray = array();
/*
$tourCourierArray["294501"] = "e8020201";
$tourCourierArray["294502"] = "e8020202";
$tourCourierArray["294503"] = "e8020203";
$tourCourierArray["294504"] = "e8020204";
$tourCourierArray["294505"] = "e8020205";
$tourCourierArray["294506"] = "e8020206";
$tourCourierArray["294507"] = "e8020207";
$tourCourierArray["294508"] = "e8020208";
$tourCourierArray["294509"] = "e8020209";
$tourCourierArray["294510"] = "e8020210";
$tourCourierArray["294511"] = "e8020211";
$tourCourierArray["294512"] = "e8020212";
$tourCourierArray["294590"] = "e8020213";
*/

function mcStrWrap ($aStr)
{
	$aStr = str_replace("'", "", $aStr);
	$aStr = removeFieldSigns($aStr);
  // $aStr = str_replace("'", "\'", $aStr);
  $aStr = str_replace("\"", '', $aStr);
  return $aStr;
}

function eregPhoneNo_MC ($phoneNo) {
  $phoneNo = str_replace("'", "", $phoneNo);
  $phoneNo = preg_replace ("/ /", "", $phoneNo);  // Remove blanks
  $phoneNo = preg_replace ("/-/", "", $phoneNo);  // Remove sign "-"
  $phoneNo = str_replace("/", "", $phoneNo);      // Remove sign "/"
  // $phoneNo = preg_replace ("/^\+/", "00", $phoneNo);  // Remove country prefix sign "+" with "00"
  // $phoneNo = preg_replace ("/^00" . $parCountryPhonePrefix . "/", "0", $phoneNo);  // Remove country prefix with "0"
  // $phoneNo = preg_replace ("/^00/", "", $phoneNo);  // Remove leading "00"
  // $phoneNo = preg_replace ("/^0/", "", $phoneNo);  // Remove leading "0"
  return $phoneNo;
}

/*
echo "importFile: " . $importFile . "<br>";
echo "hqId: " . $hqId . "<br>";
echo "csId: " . $csId . "<br>";
*/

if ($importFile != "" && $hqId != "" && is_numeric($hqId) && $csId != "" && is_numeric($csId)) :

   if (file_exists($importFile)) :

      $currentTime = getDateTime("0");


      // ***********************
      // * IMPORT FILE article *
      // ***********************
      if (!(strpos($filename, $csEid . "_import_ZONE_JOBS_") === false)) :

         if ($srvzIdArrayLen > 0) :

            $executionCount = 0;
            $insertCount = 0;
            $updateCount = 0;
            $failedCount = 0;

            $txValue = "4";
            $txSign = "V";

            $jbZoneIdArray = array();   // Associative array ($jbZoneIdArray[zone] = jbId)
            $jbTrSortArray = array();   // Associative array ($jbTrSortArray[jbId] = trSort)
            $jbTrIdArray = array();     // Associative array ($jbTrIdArray[jbId][trSort] = trId)

            $jbTourdataZipcodeArray = array();  // Associative array ($jbTourdataZipcodeArray[jbId] = "....")
            $jbTourdataCityArray = array();     // Associative array ($jbTourdataCityArray[jbId] = "....")
            $jbTourdataCountryArray = array();  // Associative array ($jbTourdataCountryArray[jbId] = "....")


            $rowToImport = array();

            $parImportFieldsGroup == "";
            if ($groupId != "") :
               $parImportFieldsGroup = getParameterValue("0", "IMPORT_ZONE_JOBS_JOB_FIELDS", "0");
            endif;
            if ($parImportFieldsGroup != "") :
               $rowToImport = spliti(",", $parImportFieldsGroup);
            else :
               /*
               Debitor	Name 1	Straße	Postleitz.	Ort	Telefon-1	Bar
               */

               $rowToImport[0]  = "f_tr_commission_no";    // A : Kommissionsnummer
               $rowToImport[1]  = "f_tr_comp";             // B : Bezeichnung
               $rowToImport[2]  = "f_ad_street";           // C : Straße und Hausnummer
               // $rowToImport[3]  = "f_tr_hsno";          //   : Hausnummer
               $rowToImport[3]  = "f_ad_zipcode";          // D : PLZ
               $rowToImport[4]  = "f_ad_city";             // E : Ort
               $rowToImport[5]  = "f_tr_phone";            // F : Telefon
               $rowToImport[6]  = "f_cash";                // G : "Bar"
               $rowToImport[7]  = "f_dummy_01";            // H : ?
            endif;

            $rowToImportLen = count($rowToImport);

            // Read file to import
            $data = importCSV($importFile, $delimiter, "1");
            $dataLen = count($data);

            // Loop all rows (EXCEPT header row [$j = 1])
            for ($j = 0; $j < $dataLen; $j++) {

               // Loop for all fields of $fields of the row
               for ($i = 0; $i < $rowToImportLen; $i++) {
                   ${$rowToImport[$i]} = $data[$j][$i];
               }

               // Check for existing headline
               if ($j > 0) :

                  $f_tr_commission_no = mcStrWrap($f_tr_commission_no);
                  $f_tr_comp = mcStrWrap($f_tr_comp);
                  $f_ad_street = mcStrWrap($f_ad_street);
                  $f_tr_hsno = "";
                  $f_ad_zipcode = mcStrWrap($f_ad_zipcode);
                  $f_ad_city = mcStrWrap($f_ad_city);
                  // $f_tr_phone = mcStrWrap($f_tr_phone);
                  $f_cash = mcStrWrap($f_cash);

                  if ($f_tr_hsno == "") : $f_tr_hsno = "."; endif;
                  $f_tr_phone = eregPhoneNo_MC($f_tr_phone);
                  
                  $f_ad_country = "DE";

                  $clockTime = "11:00:00";
                  $f_jb_ordertime = $currentDate . " " . $clockTime;


                  // **** Check zone of given zipcode for the customer ****

                  $srvzNo = "";
                  $srvzName = "";

                  // Get srvp_id from serviceplz
                  $srvpId = getFieldValueFromId("phoenix.serviceplz", "srvp_plz", $f_ad_zipcode, "srvp_id");
                  if ($srvpId != "") :

                     // If country "Germany" then fill zipcode with "0" up to 5 chars
                     if ($f_ad_country == "DE") :
                        $f_ad_zipcode = pad($f_ad_zipcode, 5);
                     endif;

                     // Get zone ids (primary key) of the current customer
                     // $srvzIdArray = getColVectorFromDB2ArrayByClause("phoenix.servicezone", "srvz_id", "hq_id = '" . $hqId . "' AND cs_id = '" . $csId . "'");
                     // $srvzIdArrayLen = count($srvzIdArray);
                     // => Zones got for customer before entering the loops (!!!!)
                     // if ($srvzIdArrayLen > 0) :

                        // Get zone id from mapping
                        $srvz_id = getFieldValueFromClause("phoenix.servicezonemapping", "srvz_id", "srvp_id = '" . $srvpId . "' AND srvz_id IN (" . implode(",", $srvzIdArray) . ")"); 
                        if ($srvz_id != "") :

                           $srvzNo = getFieldValueFromId("phoenix.servicezone", "srvz_id", $srvz_id, "srvz_no");
                           $srvzName = getFieldValueFromId("phoenix.servicezone", "srvz_id", $srvz_id, "srvz_name");
                        else :
                           $outText .= getLngt("Die PLZ " . $f_ad_zipcode . " ist keiner Zone des Kunden zugeordnet! Wurden PLZn den Zonendaten assoziiert?") . "<br>";
                        endif;
                     // else :
                     //    $outText .= getLngt("Für den Kunden " . $csEid . " werden derzeit keine Zonen im Datenbestand geführt!") . "<br>";
                     // endif;
                  else :
                     $outText .= getLngt("PLZ " . $f_ad_zipcode . " wird im Basisdatenbestand nicht geführt!") . "<br>";
                  endif;

                  if ($srvzNo != "") :

                     // **** Courier ****
                     
                     // Set vehicle and courier
                     $crId = "";
                     /*
                     $crSid = $tourVehicleArray[$f_jb_tourname];
                     if ($crSid != "") :
                        $crId = getFieldValueFromId("courier","cr_sid",$crSid,"cr_id");
                     endif;
                     */
                     $crEid = $tourCourierArray[$f_jb_tourname];
                     if ($crEid != "") :
                        $crId = getFieldValueFromId("courier","cr_eid",$crEid,"cr_id");
                     endif;
                     
                     $jbStatus = "9";
                     $jbTaketime = "";
                     if ($crId != "" && is_numeric($crId)) :
                        $jbStatus = "1";
                        $jbTaketime = $currentTime;
                     endif;
                     $jbType = "";
                     $jbFinishtime = "";
                     $jbRemark = "";
                     $vhtId = "";
                     $jbCrFilter = "";
                     $sum_totalprice = 0;
                     $f_jb_cr_price = 0;
                     $jbCrvhWeight = 0;
                     $jbCrvhLength = 0;
                     $jbCrvhWidth = 0;
                     $jbCrvhHeight = 0;
                     $jbCrvhPosition = 0;
                     $f_tr_ware_from_to = 0;
                     // $f_jb_tourname = $csEid . ": Zone " . $srvzNo;
                     $f_jb_tourname = "";


                     $f_tr_remark = "";
                     if ($f_cash != "") :
                        $f_tr_remark = "**** BARZAHLUNG ****";
                     endif;

                     echo $f_tr_commission_no . ";" . $f_tr_comp . ";" . $f_ad_street . ";" . $f_tr_hsno . ";" . $f_ad_zipcode . ";" . $f_ad_city . ";";
                     echo $f_tr_phone . ";" . $f_cash . ";";
                     echo "<br>";

                     // Check for existence of the imported "tour name" AND "station number" (unique for station)
                     $gdcEntryExists = false;
                     if (existsEntry("genericdatacontainer",array("gdc_obj_type","tr","gdc_gen_fieldname","check_exist","gdc_content",$csId . "_" . $currentDate . "_" . $j . "_" . $f_tr_commission_no,"gdc_context","ZONE_JOBS"))) :
                        $gdcEntryExists = true;
                     endif;

                     // Do NOT import if ZONE_JOBS number does exist !!!!
                     if (!$gdcEntryExists) :

                        // Insert new article
                        if ($executeImportProcess == "1") :

                           TA("B");

/*                   
                           $crId = "";
                           $crSid = "";
                           if ($crvhId != "") :
                              $crId = getFieldValueFromId("couriervehicle","crvh_id",$crvhId,"cr_id");
                              if ($crId != "") :
                                 $crSid = $vhtPrefix . $f_crvh_sid;
                              endif;
                           endif;
*/                   

                           // Insert address
                           $noValidationOfAddress = true;
                           $tmpArray = insertAddress($f_ad_street, $f_ad_zipcode, $f_ad_city, "", $f_ad_country, $noValidationOfAddress);
                           $ad_id_new = $tmpArray[0];

                           $outText .= "AD_ID : " . $ad_id_new . " | ";


                           if ($fire) :

                              // Insert new job because new cartage note does begin
                              if ($jbZoneIdArray[$srvzNo] == "") :

                                 // Insert job
                                 insertStmt("job", array("hq_id", $hqId, "csc_id", "", "vht_id", $vhtId, "csc_id_payer", $cscIdPayer, "csc_id_related", "0", "jb_payment", "0",
                                                         "jb_ordertime", $f_jb_ordertime, "jb_reserv", "1", "cr_id", $crId, "cr_sid", $crSid, "cr_id_order", $crId,
                                                         "jb_cr_filter", $jbCrFilter, "jb_cr_filter_opt", "", "jb_waitstorno", "0", 
                                                         "jb_taketime", $jbTaketime, "jb_status", $jbStatus, "jb_autoranking", "0", "jb_type", $jbType, 
                                                         "jb_incomplete", "0", "jb_globaljob", "0", "jb_tourname", $f_jb_tourname,
                                                         "jb_finishtime", $jbFinishtime, "emp_id", $usr_id, 
                                                         "jb_serviceprice", "0", "jb_fixprice", $sum_totalprice, "jb_totalprice", $sum_totalprice, "jb_subtotalprice", $sum_totalprice, 
                                                         "jb_cr_price", $f_jb_cr_price, "jb_cr_subprice", $f_jb_cr_price,
                                                         "jb_postage", "0", "jb_freetext_1", $jbRemark,
                                                         "jb_weight", $jbCrvhWeight, "jb_crvh_length", $jbCrvhLength, "jb_crvh_width", $jbCrvhWidth, 
                                                         "jb_crvh_height", $jbCrvhHeight, "jb_crvh_position", $jbCrvhPosition, 
                                                         "jb_tourdata", "", "jb_lockuser", "0", "jb_id_parent", "0", "jb_dispoinfo", "",
                                                         "jb_sales_tax_rate", $txValue, "jb_sales_tax_rate_sign", $txSign, "jb_timeunits", "0", 
                                                         "jb_service", "", "jb_booktime", ""));

                                 $jbZoneIdArray[$srvzNo] = getLastInsertId();
                                 $jbTrSortArray[$jbZoneIdArray[$srvzNo]] = 1;

                                 // Insert pick up station after job is generated
                                 if ($jbZoneIdArray[$srvzNo] != "") :
                                    insertStmt("tour", array("jb_id", $jbZoneIdArray[$srvzNo], "ad_id", $adIdFrom, "tr_sort", "1", "tr_comp", $trCompFrom, "tr_comp2", "",
                                                             "tr_hsno", $trHsnoFrom, "tr_floor", $trFloorFrom, "csc_id", $cscIdPayer, "tr_status", $trStatus, "tr_finishtime", $trFinishtime,
                                                             "tr_commission_no", "", "tr_ware_from_to", $f_tr_ware_from_to, "tr_person", "", "tr_phone", "", "tr_remark", ""));

                                    $jbTrIdArray[$jbZoneIdArray[$srvzNo]][1] = getLastInsertID();

                                    $jbTourdataZipcodeArray[$jbZoneIdArray[$srvzNo]][] = $adZipcodeFrom;
                                    $jbTourdataCityArray[$jbZoneIdArray[$srvzNo]][] = $adCityFrom;
                                    $jbTourdataCountryArray[$jbZoneIdArray[$srvzNo]][] = $adCountryFrom;
                                 endif;
                              endif;


                              // Check for inserted job
                              if ($jbZoneIdArray[$srvzNo] != "") :

                                 $jbTrSortArray[$jbZoneIdArray[$srvzNo]]++;
                     
                                 insertStmt("tour", array("jb_id", $jbZoneIdArray[$srvzNo], "ad_id", $ad_id_new, "tr_sort", $jbTrSortArray[$jbZoneIdArray[$srvzNo]], "tr_comp", $f_tr_comp, "tr_comp2", "",
                                                          "tr_hsno", $f_tr_hsno, "csc_id", $cscIdPayerExtern, "tr_status", "0", 
                                                          "tr_commission_no", $f_tr_commission_no, "tr_ware_from_to", "", 
                                                          "tr_person", $f_tr_person, "tr_phone", $f_tr_phone, "tr_remark", $f_tr_remark, "tr_cs_freetext", $f_tr_cs_freetext));

                                 $jbTrIdArray[$jbZoneIdArray[$srvzNo]][$jbTrSortArray[$jbZoneIdArray[$srvzNo]]] = getLastInsertID();


                                 // Insert tourservice data
                                 insertStmt("tourservice", array("jb_id", $jbZoneIdArray[$srvzNo], "csc_id", $cscIdPayer, "tr_sort", $jbTrSortArray[$jbZoneIdArray[$srvzNo]], "srv_id", "0", "trs_srv_name", "Fixpreis", "srvt_id", "0", "trs_srvt_name", "", "trs_price", $sum_totalprice));

                                 // Generate invoice text
                                 // mk_jb_invtext($jbIdNew, false);


                                 // Tourname
                                 insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $jbTrIdArray[$jbZoneIdArray[$srvzNo]][$jbTrSortArray[$jbZoneIdArray[$srvzNo]]], "gdc_gen_fieldname", "check_exist", "gdc_content", $csId . "_" . $currentDate . "_" . $j . "_" . $f_tr_commission_no, "gdc_context", "ZONE_JOBS"));

                                 $jbTourdataZipcodeArray[$jbZoneIdArray[$srvzNo]][] = $f_ad_zipcode;
                                 $jbTourdataCityArray[$jbZoneIdArray[$srvzNo]][] = $f_ad_city;
                                 $jbTourdataCountryArray[$jbZoneIdArray[$srvzNo]][] = $f_ad_country;

                                 $executionCount++;
                              endif;
                     
                              TA("C");
                              TA("E");
                           endif;
                        endif;
                     else :
                        $outText .= getLngt("Der Datensatz existiert schon! Es erfolgte kein Import!") . " [" . $currentDate . " " . $f_tr_commission_no .  "]<br>";
                     endif;    
                  else :
                     $outText .= getLngt("Eine gültige Zonen-ID liegt nicht vor! Es erfolgte kein Import!") . " [" . $f_tr_commission_no .  "]<br>";
                  endif;
               endif;  // Check for headline
            }

            // If at least one imported job does exist ($jbIdNew > 0) then finalize last imported job
            // Write "jb_tourdata" of the job currently imported and write log regarding B2B-Import
            if ($fire && $executeImportProcess == "1") :
               $jbTourdataZipcodeKeysArray = array_keys($jbTourdataZipcodeArray);  // The keys are job IDs
               $jbTourdataZipcodeKeysArrayLen = count($jbTourdataZipcodeKeysArray);
               if ($jbTourdataZipcodeKeysArrayLen > 0) :
                  for ($k = 0; $k < $jbTourdataZipcodeKeysArrayLen; $k++) :
                  	  $jbId = $jbTourdataZipcodeKeysArray[$k];
                      if ($jbId != "") :
                         $jbTourdata = implode(";", $jbTourdataZipcodeArray[$jbId]) . "|" . implode(";", $jbTourdataCityArray[$jbId]) . "|" . implode(";", $jbTourdataCountryArray[$jbId]);
                         updateStmt("job","jb_id",$jbId,array("jb_tourdata",$jbTourdata));
                         writeToLogDB("102",$hqId,$jbId,$usr_id,"","",$csId,"B2B_IMPORT=1");  // Success!
                      endif;
                  endfor;
               endif;
            endif;

            // Sort jobs after all operations are done well (same loop !!!!)
            if ($fire && $executeImportProcess == "1") :
               $jbTourdataZipcodeKeysArray = array_keys($jbTourdataZipcodeArray);  // The keys are job IDs
               $jbTourdataZipcodeKeysArrayLen = count($jbTourdataZipcodeKeysArray);
               if ($jbTourdataZipcodeKeysArrayLen > 0) :
                  for ($k = 0; $k < $jbTourdataZipcodeKeysArrayLen; $k++) :
                  	  $jbId = $jbTourdataZipcodeKeysArray[$k];
                      if ($jbId != "") :
                         $optResult = XSplanTourJob($jbId);
                         if ($optResult) :
                            $outText .= getLngt("Der Auftrag " . $jbId . " konnte optimiert werden!<br>");
                         else :
                            $outText .= getLngt("Der Auftrag " . $jbId . " konnte NICHT optimiert werden!<br>");
                         endif;
                      endif;
                  endfor;
               endif;
            endif;

            $outText .= getLngt("Einträge in der Importdatei: " . $dataLen . "<br>");
            $outText .= getLngt("Verarbeitete Einträge: " . $executionCount . "<br>");
         else :
            $statusMessage .= getLngt("Für den Kunden " . $csEid . " sind keine Zonen angelegt!");
         endif;
      else :
         $statusMessage .= getLngt("Die angegebene Datei scheint nicht kompatibel zur angeforderten Importfunktionalität!");
      endif;
   else :
      $statusMessage .= getLngt("Die angegebene Datei existiert nicht!");
   endif;
else :
   $statusMessage .= getLngt("Es wurde keine Datei spezifiziert!");
endif;
?>

<html>
<head>
<title><?php echo $pageTitel ?></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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>

function finishPageExecuteImportProcess(f_act) {  
  document.forms[0].f_act.value=f_act;
  document.forms[0].executeImportProcess.value = '1';
  document.forms[0].submit();
};

function onBodyLoad() {
	displayStatusMessage();
	var closeWindow = '<?php echo $closeWindow ?>';
	if (closeWindow == '1') {
     opener.document.forms[0].submit();
     window.close();
  };
};
-->
</script>

</head>

<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>onBodyLoad();">

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

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

  <div>
    <form name="import_form" action="../import/import_ZONE_JOBS.php" method="post">
      <input type="hidden" name="f_act" value="">
      <?php echo $phpCurrentNavigationInputHidden ?>
      <input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
      <input type="hidden" name="importFile" value="<?php echo $importFile; ?>">
      <input type="hidden" name="executeImportProcess" value="<?php echo $executeImportProcess; ?>">
      <input type="hidden" name="objType" value="<?php echo $objType; ?>">
      <input type="hidden" name="objId" value="<?php echo $objId; ?>">

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

      <?php
        if ($showExecutionProcessButton && $executeImportProcess != "1") :
           echo defineButtonType10(getLngt("Import starten"), "action_import", "finishPageExecuteImportProcess('executeImport');", "200");
           echo htmlDivLineSpacer("5px");
           echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "200");
           echo htmlDivLineSpacer("5px");
        endif;
      ?>

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

      <div>
        <table border="1" margin="10" padding="10">
        	<tr>
        		<td style="vertical-align:top;">
              <?php echo $outText; ?>
            </td>
          </tr>
        </table>    
      </div>
    </form>
  </div>

</div>

</body>

</html>