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


include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// include_once ("../include/html.inc.php");


$httpVarsArray = array("f_act", "crvhId", "orderClause", "statusMessage", "f_crvh_id", "f_csvh_day_times", "csIdUpdate",
                       "f_relationStatus", "f_del_customer_id", "g_cs_id", "f_csvh_description_new", "deactivateMenu");

getSecHttpVars("1", $httpVarsArray);

getLanguage(__FILE__);

$deactivateMenuStatic = "1";
$pageTitel = getLngt("BEZIEHUNG FAHRZEUG-KUNDE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
include_once ("../include/inc_vehicle.inc.php");
getCurrentScript(__FILE__);

// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "1", "1");

// Initializations
if ($f_relationStatus == "") : $f_relationStatus = "0"; endif;     // 0 = bad relation between cs and cr (blocked), 1 = good relation (favoured)
$f_csvh_description_new = trim($f_csvh_description_new);           // Description related to an association between customer and courier
$f_actText = "";


// Only for output
$htmlClass01 = "class=\"smaller\"";                // input,select
$html_td_01  = "valign=\"top\" align=\"left\"";    // input
$html_td_02  = "valign=\"top\" align=\"right\"";   // input


// Get array of weekdays (default, no mt_objtype and no mt_objid)
$weekDays = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'cal_week_days' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$weekDayNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'cal_week_days' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$weekDaysLen = count($weekDays);
// Get array of day times (default, no mt_objtype and no mt_objid)
$dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$dayTimesLen = count($dayTimes);


   // **************************************
   // * Operations for the vehiclecustomer *   
   // **************************************

   // Insert new vehiclecustomer
   if ($f_act == "newVehicleCustomer" && $crvhId != "" && $g_cs_id != "") :

      if (!existsEntry("customervehicle",array("cs_id",$g_cs_id,"crvh_id",$crvhId))) :

            TA("B");

            // Get max sort value of favoured customers and increment
            $maxSortValue = 0;
            if ($f_relationStatus == "1") :
               $maxSortValue = getMaxOfField("customervehicle", "csvh_sort", "cs_id = '" . $g_cs_id . "' AND csvh_relation = '1' ");
               if ($maxSortValue != "" && is_numeric($maxSortValue)) :
                  $maxSortValue++;
               else :
                  $maxSortValue = 1;
               endif;
            endif;

            // Insert customervehicle
            insertStmt("customervehicle", array("cs_id",$g_cs_id,"crvh_id",$crvhId,"csvh_relation",$f_relationStatus,"csvh_sort",$maxSortValue,"csvh_description",$f_csvh_description_new));

            // Insert parameter "FDS_CUSTOMER_ENABLED_<CS>" if does not exist
            if (!existsEntry("parameter",array("par_key", "FDS_CUSTOMER_ENABLED_CS_" . $g_cs_id))) :
               insertStmt("parameter", array("par_key", "FDS_CUSTOMER_ENABLED_CS_" . $g_cs_id, "par_value", "1"));
            endif;

            // Generate new vehicle in the "Fast Disposition Structure" or update (renew) if it does exist
            // generateVehicleFastDispositionStructure($crvhId, "2", $g_cs_id);

            // Write logdata into log database
            $tmpFields = getFieldsValueFromId("couriervehicle", "crvh_id", $crvhId, array("cr_id","crvh_sid"));
            writeToLogDB("126",$hq_id,"",$usr_id,$tmpFields[0],$tmpFields[1],$g_cs_id,"");

            TA("C");
            TA("E");

            // $cmd = "php ../tools/setFDSVehicleAvailability_HTG.php tornado";
            // system($cmd . " > /dev/null &");
            $cmd = "php ../tools/setFDSVehicleAvailability_HTG.php tornado " . $crvhId . " &";
            $cmdOutput = null;
            exec($cmd, $cmdOutput);
      else :
         $statusMessage = getLngt("Es existiert schon ein Eintrag zwischen dem Fahrzeug und diesem Kunden!");
      endif;
   endif;            

   // Compute week day and day times string
   if ($f_act == "updateVehicleCustomer" && $crvhId != "" && $csIdUpdate != "") :

      // Overwrite array  of day times if does exist for this special customer
      if (existsEntry("metatype",array("mt_type", "day_time", "mt_objtype", "cs", "mt_objid", $csIdUpdate))) :
         $dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $csIdUpdate . "'", "", "mt_sort", "");
         $dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $csIdUpdate . "'", "", "mt_sort", "");
         $dayTimesLen = count($dayTimes);
      endif;

      /* 
      // For displaying checkboxes only
      $activatedWeekDays = "";
      if (is_array($f_csvh_day_times)) :
         $f_csvh_day_times_len = count($f_csvh_day_times);  // Values from the checkboxes
         if ($f_csvh_day_times_len > 0) :
            $weekDayArray = array();
            for ($i = 0; $i < $f_csvh_day_times_len; $i++) :
                $tmpArray = spliti("_", $f_csvh_day_times[$i]);  // [0] = cs_id, [1] = weekday, [2] = day time
                if ($tmpArray[0] == $csIdUpdate) :
                    if ($weekDayArray[$tmpArray[1]] == "") : 
                       $weekDayArray[$tmpArray[1]] = $tmpArray[1] . "=" . $tmpArray[2];
                    else :
                       $weekDayArray[$tmpArray[1]] .= "," . $tmpArray[2];   
                    endif;
                endif;
            endfor;
            $activatedWeekDays = implode("|", $weekDayArray);
         endif;
      endif;
      */
      $activatedWeekDays = "";
      $weekDayArray = array();
      for ($k = 0; $k < $dayTimesLen; $k++) :
          for ($l = 0; $l < $weekDaysLen; $l++) :
              list($selVal) = getSecHttpVars("1", array("f_csvh_day_times_zone_" . $csIdUpdate . "_" . $weekDays[$l] . "_" . $dayTimes[$k]));
              if ($selVal != "")  :
                 if ($weekDayArray[$weekDays[$l]] == "") : 
                    $weekDayArray[$weekDays[$l]] = $weekDays[$l] . "=" . $dayTimes[$k] . "-" . $selVal;
                 else :
                    $weekDayArray[$weekDays[$l]] .= "," . $dayTimes[$k] . "-" . $selVal;
                 endif;
              endif;
          endfor;
      endfor;
      $activatedWeekDays = implode("|", $weekDayArray);

      // Insert customervehicle
      updateStmt("customervehicle", "crvh_id", $crvhId, array("csvh_day_times", $activatedWeekDays), "cs_id = '" . $csIdUpdate . "'");

      // Insert parameter "FDS_CUSTOMER_ENABLED_<CS>" if does not exist
      if (!existsEntry("parameter",array("par_key", "FDS_CUSTOMER_ENABLED_CS_" . $csIdUpdate))) :
         insertStmt("parameter", array("par_key", "FDS_CUSTOMER_ENABLED_CS_" . $csIdUpdate, "par_value", "1"));
      endif;

      // Update vehicle in the "Fast Disposition Structure"
      // generateVehicleFastDispositionStructure($crvhId, "2", $csIdUpdate);

      // Write logdata into log database
      $tmpFields = getFieldsValueFromId("couriervehicle", "crvh_id", $crvhId, array("cr_id","crvh_sid"));
      writeToLogDB("128",$hq_id,"",$usr_id,$tmpFields[0],$tmpFields[1],$csIdUpdate,"");

      // $cmd = "php ../tools/setFDSVehicleAvailability_HTG.php tornado";
      // system($cmd . " > /dev/null &");
      $cmd = "php ../tools/setFDSVehicleAvailability_HTG.php tornado " . $crvhId . " &";
      $cmdOutput = null;
      exec($cmd, $cmdOutput);
   endif;

   // Remove vehiclecustomer
   if ($f_act == "removeVehicleCustomer" && $crvhId != "") :

      TA("B");       

      // Entries to be deleted?
      $fieldsLength = count($f_del_customer_id);

      if ($fieldsLength > 0 && $f_del_customer_id[0] != "") :

         for ($i = 0; $i < $fieldsLength; $i++) :
             deleteStmt("customervehicle","crvh_id = " . $crvhId . " AND cs_id = " . $f_del_customer_id[$i]);

             // Resort the sort value of the favoured couriers of the customer
             $sqlquery = "SELECT cs_id, crvh_id FROM customervehicle WHERE cs_id = " . $f_del_customer_id[$i] . " AND csvh_relation = '1' ORDER BY csvh_sort";
             $result = $db->query($sqlquery);
             if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
             $sortCounter = 1;
             while ($row = $result->fetch_assoc()):
                   $tmpCsId   = $row["cs_id"];
                   $tmpCrvhId = $row["crvh_id"];
                   updateStmt("customervehicle", "cs_id", $tmpCsId, array("csvh_sort", $sortCounter),"crvh_id = '" . $tmpCrvhId . "' AND csvh_relation = '1'");
                   $sortCounter++;
             endwhile;
             $result->free();

             // Remove vehicle from the "Fast Disposition Structure" for a special customer only
             generateVehicleFastDispositionStructure($crvhId, "0", $f_del_customer_id[$i]);

             // Remove jobs of this vehicle for the selected customer from FDS
             $vhdJbIdsToRemoveArray = getColVectorFromDB2ArrayByClause("vehicledisposition AS vhd, job AS jb, costcenter AS csc", "vhd.jb_id", "vhd.crvh_id = '" . $crvhId . "' AND vhd.jb_id = jb.jb_id AND jb.csc_id_related = csc.csc_id AND csc.cs_id = '" . $f_del_customer_id[$i] . "'", "", "", "DISTINCT");
             $vhdJbIdsToRemoveArrayLen = count($vhdJbIdsToRemoveArray);
             if ($vhdJbIdsToRemoveArrayLen > 0) :
                updateStmt("vehicledisposition", "", "", array("jb_id", "0"), "jb_id IN (" . implode(",", $vhdJbIdsToRemoveArray) . ")");
             endif;

             // Write logdata into log database
             $tmpFields = getFieldsValueFromId("couriervehicle", "crvh_id", $crvhId, array("cr_id","crvh_sid"));
             writeToLogDB("127",$hq_id,"",$usr_id,$tmpFields[0],$tmpFields[1],$f_del_customer_id[$i],"");
         endfor;
      else :
         $statusMessage = getLngt("Bitte markieren Sie zu löschende Verbindungen durch anklicken der jeweiligen Checkbox hinter dem Eintrag!");
      endif;

       TA("C");
       TA("E");
   endif;
   
   
   // ***************************************************************************
   // * Get the vehicle-customer relations of a specified courier for selection *
   // ***************************************************************************

   $count = 0;
   if ($crvhId != "") :

      $sqlquery = getStmtCustomerVehicleRelation($crvhId, "");
      $result = $db->query($sqlquery);
      if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());

      while ($row = $result->fetch_assoc()): 
               $f_cmp_comp[$count]         = $row["cmp_comp"];
               $f_cmp_comp2[$count]        = $row["cmp_comp2"];
               $f_cs_id[$count]            = $row["cs_id"];
               $f_cs_eid[$count]           = $row["cs_eid"];
               $f_cs_hq_id[$count]         = $row["hq_id"];
               $f_csvh_relation[$count]    = $row["csvh_relation"];
               $f_csvh_day_times[$count]   = $row["csvh_day_times"];
               $f_csvh_description[$count] = $row["csvh_description"];
               $count++;
      endwhile;
      $result->free();      
   endif;


   // Only for output
   $tmpFields = getFieldsValueFromId("couriervehicle", "crvh_id", $crvhId, array("cr_id","crvh_sid"));
   $tmp_cr_id  = $tmpFields[0];
   $tmp_crvh_sid = $tmpFields[1];
   $tmp_usr_id = getFieldValueFromId("courier", "cr_id", $tmp_cr_id, "usr_id");
   $tmpFields = getFieldsValueFromId("user","usr_id",$tmp_usr_id,array("usr_name","usr_firstname"));
   $tmp_usr_name = $tmpFields[0];
   $tmp_usr_firstname = $tmpFields[1];

   $title = getLngt("Einsatzmodalitäten bei Kunden von Fahrzeug:") . "&nbsp;&nbsp;" . $tmp_crvh_sid . "&nbsp;[" . $tmp_usr_firstname . " " . $tmp_usr_name . "]";


   // Output of the existing relations of the current selected area
   $customerOutput = "";
   for ($j = 0; $j < $count; $j++) :

       // Overwrite array of day times if does exist for this special customer
       if (existsEntry("metatype",array("mt_type", "day_time", "mt_objtype", "cs", "mt_objid", $f_cs_id[$j]))) :
          $dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $f_cs_id[$j] . "'", "", "mt_sort", "");
          $dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $f_cs_id[$j] . "'", "", "mt_sort", "");
       else :
          $dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
          $dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
       endif;
       $dayTimesLen = count($dayTimes);

       $customerOutput .= $f_cmp_comp[$j] . "<br>";
       if ($f_cmp_comp2[$j] != "") : $customerOutput .= $f_cmp_comp2[$j] . "<br>"; endif;
       $customerOutput .= $f_cs_eid[$j] . "&nbsp;&nbsp;";

       $imgName = "circle_red.jpg";
       if ($f_csvh_relation[$j] == "1") : $imgName = "circle_green.jpg"; endif;
       $customerOutput .= "<img src=\"../images/" . $imgName . "\" border=\"0\" height=\"10\" width=\"25\">&nbsp;&nbsp;";

       $customerOutput .= "<input type=\"checkbox\" name=\"f_del_customer_id[]\" value=\"" . $f_cs_id[$j] . "\"><br>";
       $customerOutput .= $f_csvh_description[$j];
       $customerOutput .= "<br>\n";
       // Get day time values to be checked for the current customer regarding the current vehicle
       $dayTimesArrayOfTheWeek = getKeyValueArrayFromString($f_csvh_day_times[$j], "|", "=");
       $customerOutput .= "<table>\n";
       // Table header with names of the weekdays
       $customerOutput .= "<tr>\n";
       $customerOutput .= "<td>" . "&nbsp;" . "</td>\n";
       for ($l = 0; $l < $weekDaysLen; $l++) :
           $customerOutput .= "<td>" . $weekDayNames[$l] . "</td>\n";
       endfor;
       // Table body
       $customerOutput .= "</tr>\n";
       for ($k = 0; $k < $dayTimesLen; $k++) :
           $customerOutput .= "<tr>\n";
           $customerOutput .= "<td>" . $dayTimeNames[$k] . "</td>\n";
           for ($l = 0; $l < $weekDaysLen; $l++) :
               $tmpDayTimes = $dayTimesArrayOfTheWeek[$l + 1];
               $tmpDayTimesArray = spliti(",", $tmpDayTimes);
               /*
               // For displaying checkboxes only
               $tmpChecked = "";
               if (!(array_search($dayTimes[$k], $tmpDayTimesArray) === FALSE)) :
                  $tmpChecked = "checked";
               endif;
               $customerOutput .= "<td>" . "<input type=\"checkbox\" name=\"f_csvh_day_times[]\" value=\"" . $f_cs_id[$j] . "_" . $weekDays[$l] . "_" . $dayTimes[$k] . "\" " . $tmpChecked . ">" . "</td>\n";
               */
               // Select special zone for each day time of each week day
               $tmpSelectedValue = "";
               $tmpDayTimesArrayLen = count($tmpDayTimesArray);
               for ($m = 0; $m < $tmpDayTimesArrayLen; $m++) :
                   $tmp2 = spliti("-", $tmpDayTimesArray[$m]);
                   if ($tmp2[0] == $dayTimes[$k]) :
                      $tmpSelectedValue = $tmp2[1];
                   endif;
               endfor;
               $customerOutput .= "<td>\n";
               $customerOutput .= "  <select class=\"f7np1\" name=\"f_csvh_day_times_zone_" . $f_cs_id[$j] . "_" . $weekDays[$l] . "_" . $dayTimes[$k] . "\">";
               $customerOutput .= "  <option value=\"\" " . ($tmpSelectedValue == "" ? "selected" : "") . ">" . getLngt("Alle Zonen") . "</option>";
               $customerOutput .= "  <option value=\"9999\" " . ($tmpSelectedValue == "9999" ? "selected" : "") . ">" . getLngt("Nicht aktiv") . "</option>";
               $customerOutput .=    addOptionsFromTable("servicezone", "srvz_no", "srvz_name", "srvz_no", "hq_id = '" . $f_cs_hq_id[$j] . "' AND cs_id = '" . $f_cs_id[$j] . "'", $tmpSelectedValue , "");
               $customerOutput .= "  </select>";
               $customerOutput .= "</td>\n";
           endfor;
           $customerOutput .= "</tr>\n";
       endfor;
       $customerOutput .= "</table>\n";
       $customerOutput .= defineButtonType08(getLngt("Konfiguration&nbsp;speichern"), "action_update", "finishPage('updateVehicleCustomer', '" . $f_cs_id[$j] . "');", "240");
       $customerOutput .= "<br><br>\n";
   endfor;   
   
   // Button to remove associations between courier and customer(s). Only show if at least one customer is associated to the current area.
   if ($count > 0) :
      $customerOutput .= "<br>\n";
      $customerOutput .= defineButtonType10(getLngt("Markierte&nbsp;Verknüpfungen&nbsp;entfernen"), "action_remove", "finishPage('removeVehicleCustomer', '');", "240");
      $customerOutput .= "<br><br>\n";      
   endif;
   
   if ($customerOutput == "") :
      $customerOutput = getLngt("Zur Zeit sind keine Verknüpfungen eingetragen!");
   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 src="../include/checkFormTags.js" type="text/javascript"></script>
<script src="../include/searchLists.js" type="text/javascript"></script>

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

function finishPage(mode, csId) {
  var ok = true;
  if (mode == 'newVehicleCustomer') {
     if (document.forms[0].g_cs_id.value != '') {
        document.forms[0].f_act.value = mode;
        document.forms[0].submit();
     } else {
     	alert('<?php echo getLngt("Wählen Sie bitte einen Kunden aus!") ?>');
     }
  }

  if (mode == 'removeVehicleCustomer') {
     if (confirm('<?php echo getLngt("Möchten Sie die bestehende(n) Beziehung(en) wirklich löschen?") ?>')) {
     	  if (confirm('<?php echo getLngt("ACHTUNG: Alle Aufträge in der Disposition werden vom Fahrzeug entfernt und müssen neu disponiert werden!") ?>')) {
     	     document.forms[0].f_act.value = mode;
           document.forms[0].submit();
        }
     }
  }
  
  if (mode == 'updateVehicleCustomer') {
     if (confirm('<?php echo getLngt("Möchten Sie die Wochentage und Tageszeiten des Kunden speichern?") ?>')) {
     	  document.forms[0].f_act.value = mode;
     	  document.forms[0].csIdUpdate.value = csId;
        document.forms[0].submit();
     }
  }  
};

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=100111111000",
    "","dependent=yes,width=" + widthPopupWin + ",height=" +
    heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin +
    ",scrollbars=yes");
};
-->
</script>

</head>

<body class="menu_bgcol" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">

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

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

<form action="../admin/vehicle_customer.php" method="post">
  <input type="hidden" name="f_act" value="">
  <input type="hidden" name="crvhId" value="<?php echo ec($crvhId) ?>">
  <input type="hidden" name="g_cs_id" value="">
  <input type="hidden" name="csIdUpdate" value="">
  <?php echo $phpCurrentNavigationInputHidden ?>
  <input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">

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

  <div class="f12bp1_blue">
    <?php echo $title ?>
  </div>

  <?php echo htmlDivLineSpacer("10px"); ?>
    
  <div class="f10bp1">
    <?php echo getLngt("Kunden:") ?>
  </div>

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

  <div class="f10bp1">
    <?php echo $customerOutput; ?>
  </div>

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

  <?php echo defineButtonType10(getLngt("Kunde&nbsp;suchen"), "action_search", "searchCsCsc();", "100"); ?>

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

  <div>
    <div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Firma:") ?></div>
    <div>
      <input type="text" name="g_cscad_comp" value="" size="36" disabled >
    </div>
  </div>
  <?php echo htmlDivLineSpacer("5px"); ?>
  <div>
    <div <?php echo setStyleHtmlDiv("100px","left"); ?>>&nbsp;</div>
    <div>
      <input type="text" name="g_cscad_comp2" value="" size="36" disabled >
    </div>
  </div>
  <?php echo htmlDivLineSpacer("10px"); ?>
  <div>
    <div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Adresse:") ?></div>
    <div>
      <input type="text" name="g_ad_street" value="" size="30" disabled >&nbsp;
      <input type="text" name="g_cscad_hsno" value="" size="5" disabled >
    </div>
  </div>
  <?php echo htmlDivLineSpacer("5px"); ?>
  <div>
    <div <?php echo setStyleHtmlDiv("100px","left"); ?>>&nbsp;</div>
    <div>
      <input type="text" name="g_ad_zipcode" value="" size="5" disabled >&nbsp;
      <input type="text" name="g_ad_city" value="" size="30" disabled >
    </div>
  </div>
  <?php echo htmlDivLineSpacer("10px"); ?>
  <div>
    <div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Bemerkung:") ?></div>
    <div>
      <input type="text" name="f_csvh_description_new" value="" size="50" maxlength="255">
    </div>
  </div>

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

  <div>
    <div>
      <input type="radio" <?php echo $htmlClass01 ?> name="f_relationStatus" value="0"> <?php echo getLngt("Gesperrt") ?><br>
      <input type="radio" <?php echo $htmlClass01 ?> name="f_relationStatus" value="1" checked> <?php echo getLngt("Freigegeben") ?><br>
      <br>
    </div>
    <?php echo defineButtonType10(getLngt("Kunde&nbsp;dem&nbsp;Fahrzeug&nbsp;zuordnen"), "action_assoc", "document.forms[0].f_act.value='" . ec($f_actText) . "';finishPage('newVehicleCustomer', '');", "230"); ?>
    <?php echo htmlDivLineSpacer("50px"); ?>
    <?php echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "80", "left", "3"); ?>
  </div>

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

</html>