getOne("SELECT srvpam.srvpa_id FROM serviceplzarea AS srvpa, serviceplzareamapping AS srvpam" . " WHERE srvpam.srvp_id = '" . $srvp_id . "' AND srvpa.srvpa_id = srvpam.srvpa_id AND srvpa.hq_id = '" . $hq_id . "'"); if ($srvpa_id2 == "") : // Insert the new association $tmpFields = array("srvp_id",$srvp_id,"srvpa_id",$srvpa_id); insertStmt("serviceplzareamapping",$tmpFields); else : // Get the area the zipcode is associated to // $srvpa_id2 = getFieldValueFromId("serviceplzareamapping","srvp_id",$srvp_id,"srvpa_id"); $srvpa_name = getFieldValueFromId("serviceplzarea","srvpa_id",$srvpa_id2,"srvpa_name"); if ($srvpa_id == $srvpa_id2) : $statusMessage = getLngt("Die PLZ ist bereits diesem Bereich") . " " . $srvpa_name . " zugeordnet!"; else : $statusMessage = getLngt("Die PLZ ist bereits dem Bereich") . " " . $srvpa_name . " zugeordnet! Bitte erst explizit diese Verknüpfung löschen!"; endif; endif; else : $statusMessage = getLngt("Die PLZ ist nicht in der Datenbank verzeichnet!"); endif; else : $statusMessage = getLngt("Die PLZ wurde falsch eingegeben!"); endif; endif; // Remove association between current area and marked zipcode(s) if ($f_act != "" && $f_act == "save_removezipcodeassociation") : // Entries to be deleted? $fieldsLength = count($f_del_zipcode_id); if ($fieldsLength > 0 && $f_del_zipcode_id[0] != "") : // Remove all associations (of the headquarters) according to the zipcode nested in array $f_del_zipcode_id for ($i = 0; $i < $fieldsLength; $i++) : $srvpa_id = $db->getOne("SELECT srvpam.srvpa_id FROM serviceplzarea AS srvpa, serviceplzareamapping AS srvpam" . " WHERE srvpam.srvp_id = '" . $f_del_zipcode_id[$i] . "' AND srvpa.srvpa_id = srvpam.srvpa_id AND srvpa.hq_id = '" . $hq_id . "'"); if ($srvpa_id != "") : deleteStmt("serviceplzareamapping","srvp_id = '" . $f_del_zipcode_id[$i] . "' AND srvpa_id = '" . $srvpa_id . "'"); endif; endfor; else : $statusMessage = getLngt("Bitte markieren Sie zu löschende PLZn durch anklicken der jeweiligen Checkbox hinter der PLZ!"); endif; endif; // Store new association between current area and entered neighbour if ($f_act != "" && $f_act == "save_newneighbourassociation" && $f_area_name2 != "") : // Syntax of the zipcode is correct? if ($f_newneighbourforarea != "") : // Get the internal id of the current area // $srvpa_id = getFieldValueFromId("serviceplzarea","srvpa_name",$f_area_name2,"srvpa_id"); $srvpa_id = getFieldValueFromClause("serviceplzarea","srvpa_id","srvpa_name = '" . $f_area_name2 . "' AND hq_id = '" . $hq_id . "'"); // First make a lookup if neighbour exists and get the internal id of the new neighbour // $srvpa2_id = getFieldValueFromId("serviceplzarea","srvpa_name",$f_newneighbourforarea,"srvpa_id"); $srvpa2_id = getFieldValueFromClause("serviceplzarea","srvpa_id","srvpa_name = '" . $f_newneighbourforarea . "' AND hq_id = '" . $hq_id . "'"); if ($srvpa_id != "" && $srvpa2_id != "") : if ($srvpa_id != $srvpa2_id) : // The relation of the neighbourhood is symmetric but NOT transitive! // Therefore ONLY both relations (aRb AND bRa) have to be inserted into the database TA("B"); $relationOne = existsEntry("serviceplzareaneighbour",array("srvpa_id",$srvpa_id,"srvpa2_id",$srvpa2_id)); $relationTwo = existsEntry("serviceplzareaneighbour",array("srvpa_id",$srvpa2_id,"srvpa2_id",$srvpa_id)); // If neighbour exists then lookup for an existing association between the neighbour and another area if (!$relationOne) : // Insert the new association $tmpFields = array("srvpa_id",$srvpa_id,"srvpa2_id",$srvpa2_id); insertStmt("serviceplzareaneighbour",$tmpFields); endif; if (!$relationTwo) : // Insert the new reverse association $tmpFields = array("srvpa_id",$srvpa2_id,"srvpa2_id",$srvpa_id); insertStmt("serviceplzareaneighbour",$tmpFields); endif; if ($relationOne && $relationTwo) : $statusMessage = getLngt("Diese Nachbarschaft besteht bereits!"); endif; TA("C"); TA("E"); else : $statusMessage = getLngt("Eine Nachbarschaft identischer Bereiche liegt implizit schon vor!"); endif; else : $statusMessage = getLngt("Der Bereich ist nicht in der Datenbank verzeichnet!"); endif; else : $statusMessage = getLngt("Der Bereich wurde falsch eingegeben!"); endif; endif; // Remove association between current area and marked neighbour(s) if ($f_act != "" && $f_act == "save_removeneighbourassociation") : // Entries to be deleted? $fieldsLength = count($f_del_neighbour_id); if ($fieldsLength > 0 && $f_del_neighbour_id[0] != "") : TA("B"); // Remove all associations according to the zipcode nested in array $f_del_zipcode_id for ($i = 0; $i < $fieldsLength; $i++) : // Get the internal id of the current area // $srvpa_id = getFieldValueFromId("serviceplzarea","srvpa_name",$f_area_name2,"srvpa_id"); $srvpa_id = getFieldValueFromClause("serviceplzarea","srvpa_id","srvpa_name = '" . $f_area_name2 . "' AND hq_id = '" . $hq_id . "'"); if ($srvpa_id != "") : deleteStmt("serviceplzareaneighbour","srvpa_id = " . $srvpa_id . " AND srvpa2_id = " . $f_del_neighbour_id[$i]); deleteStmt("serviceplzareaneighbour","srvpa_id = " . $f_del_neighbour_id[$i] . " AND srvpa2_id = " . $srvpa_id); endif; endfor; TA("C"); TA("E"); else : $statusMessage = getLngt("Bitte markieren Sie zu löschenden Nachbarbereiche durch anklicken der jeweiligen Checkbox hinter dem Bereich!"); endif; endif; // *** END *************** // Selection and display from the starting zipcodeareas (row and column) if ($areaRow == "" || $areaCol == "") : $sqlquery = "SELECT MIN(srvpa.srvpa_name) AS name" . " FROM serviceplzarea AS srvpa" . " WHERE srvpa.hq_id = '" . $hq_id . "'"; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); while ($row = $result->fetch_assoc()): if ($areaRow == "") : $areaRow = $row["name"]; endif; if ($areaCol == "") : $areaCol = $row["name"]; endif; endwhile; $result->free(); endif; // Id of the zipcodearea to be selected during the administration-process // If there is no value then get the first area if ($f_area_name == "") : $f_area_name = $areaRow; endif; if ($f_area_name2 == "") : $f_area_name2 = $areaRow; endif; // **************************************************************** // * Selection of all zipcodeareas of the specified submatrix-row * // **************************************************************** $sqlquery = "SELECT srvpa.srvpa_id, srvpa.srvpa_name" . " FROM serviceplzarea AS srvpa" . " WHERE srvpa.srvpa_name >= '" . $areaRow . "' AND" . " srvpa.hq_id = '" . $hq_id . "'" . " ORDER BY " . $orderByServices . " LIMIT " . $offset; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); $services = array(); $count = 0; while ($row = $result->fetch_assoc()): $count++; $services["id"][$count] = $row["srvpa_id"]; $services["name"][$count] = $row["srvpa_name"]; endwhile; $result->free(); // ******************************************************************* // * Selection of all zipcodeareas of the specified submatrix-column * // ******************************************************************* $sqlquery = "SELECT srvpa.srvpa_id, srvpa.srvpa_name" . " FROM serviceplzarea AS srvpa" . " WHERE srvpa.srvpa_name >= '" . $areaCol . "' AND" . " srvpa.hq_id = '" . $hq_id . "'" . " ORDER BY " . $orderByServices . " LIMIT " . $offset; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); $services2 = array(); $count = 0; while ($row = $result->fetch_assoc()): $count++; $services2["id"][$count] = $row["srvpa_id"]; $services2["name"][$count] = $row["srvpa_name"]; endwhile; $result->free(); // ********************************************** // * Selection of serviceplzareacustomer-values * // ********************************************** $sqlquery = "SELECT srvpac.srvpa_id, srvpac.srvpa2_id, srvpac.cs_id, srvpac.srvpac_price, srvpac.srvpac_discount, srvpac.srvpac_cr_price, srvpac.srvpac_cr_discount" . " FROM serviceplzarea AS srvpa, serviceplzarea AS srvpa2, serviceplzareacustomer AS srvpac" . " WHERE srvpac.srvpa_id = srvpa.srvpa_id" . " AND srvpac.srvpa2_id = srvpa2.srvpa_id" . " AND srvpac.cs_id = " . $csId . " AND srvpac.vht_id = " . $vhtId . " AND srvpac.hq_id = " . $hq_id . " ORDER BY " . $orderByServices; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); $servicePrices = array(); $serviceDiscounts = array(); while ($row = $result->fetch_assoc()): $servicePrices[$row["srvpa_id"]][$row["srvpa2_id"]] = $row["srvpac_price"]; $serviceDiscounts[$row["srvpa_id"]][$row["srvpa2_id"]] = $row["srvpac_discount"]; $serviceCrPrices[$row["srvpa_id"]][$row["srvpa2_id"]] = $row["srvpac_cr_price"]; $serviceCrDiscounts[$row["srvpa_id"]][$row["srvpa2_id"]] = $row["srvpac_cr_discount"]; endwhile; $result->free(); // Number of entries $lenServices = count($services["id"]); $lenServices2 = count($services2["id"]); if ($services["id"][1] == "" || $services2["id"][1] == ""): $lenServices = 0; $lenServices2 = 0; endif; // If matrix (generated above) is from a special customer ($csId != "0"), the default prices ($csId == "0") have to be shown to compare the prices // Setup a second request according to the one before with ($csId == "0") if ($csId != "0") : $sqlquery = "SELECT srvpac.srvpa_id, srvpac.srvpa2_id, srvpac.cs_id, srvpac.srvpac_price, srvpac.srvpac_discount, srvpac.srvpac_cr_price, srvpac.srvpac_cr_discount" . " FROM serviceplzarea AS srvpa, serviceplzarea AS srvpa2, serviceplzareacustomer AS srvpac" . " WHERE srvpac.srvpa_id = srvpa.srvpa_id" . " AND srvpac.srvpa2_id = srvpa2.srvpa_id" . " AND srvpac.cs_id = '0'" . " AND srvpac.vht_id = " . $vhtId . " AND srvpac.hq_id = " . $hq_id . " ORDER BY " . $orderByServices; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); $servicePricesDefault = array(); $serviceDiscountsDefault = array(); while ($row = $result->fetch_assoc()): $servicePricesDefault[$row["srvpa_id"]][$row["srvpa2_id"]] = $row["srvpac_price"]; $serviceDiscountsDefault[$row["srvpa_id"]][$row["srvpa2_id"]] = $row["srvpac_discount"]; $serviceCrPricesDefault[$row["srvpa_id"]][$row["srvpa2_id"]] = $row["srvpac_cr_price"]; $serviceCrDiscountsDefault[$row["srvpa_id"]][$row["srvpa2_id"]] = $row["srvpac_cr_discount"]; endwhile; $result->free(); endif; // ************************************************* // * Storing prices and discounts if requested * // * Using the results of the statements before!!! * // ************************************************* if ($f_act != "" && $f_act == "save") : // Set the current timestamp to store the data $currentTime = getDateTime("0"); TA("B"); for ($i = 1; $i <= $lenServices2; $i++) : for ($j = 1; $j <= $lenServices; $j++) : // Define current service-zipcodearea-ids $srvPlzAreaCur = $services["id"][$j]; $srvp2PlzAreaCur = $services2["id"][$i]; // Get current input-type-text-field with price-/dicount-value list ($newValueToBeStored) = getHttpVars(array("service_". $srvPlzAreaCur ."_" . $srvp2PlzAreaCur)); if ($newValueToBeStored == "") : $newValueToBeStored = "0"; endif; list ($newCrValueToBeStored) = getHttpVars(array("service_cr_". $srvPlzAreaCur ."_" . $srvp2PlzAreaCur)); if ($newCrValueToBeStored == "") : $newCrValueToBeStored = "0"; endif; // Allow float data with "." and "," $newValueToBeStored = str_replace (",", ".", $newValueToBeStored); $newCrValueToBeStored = str_replace (",", ".", $newCrValueToBeStored); if ($servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0"; endif; if ($serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0"; endif; if ($serviceCrPrices[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceCrPrices[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0"; endif; if ($serviceCrDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceCrDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0"; endif; if ($mode == "price") : // // Check for necessity to update or insert if ($servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur] != $newValueToBeStored || $serviceCrPrices[$srvPlzAreaCur][$srvp2PlzAreaCur] != $newCrValueToBeStored) : if (existsEntry("serviceplzareacustomer",array("srvpa_id",$srvPlzAreaCur,"srvpa2_id",$srvp2PlzAreaCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId))) : // Update the new price $sqlStmt = "UPDATE serviceplzareacustomer SET srvpac_price = $newValueToBeStored, srvpac_cr_price = $newCrValueToBeStored" . " WHERE srvpa_id = $srvPlzAreaCur AND srvpa2_id = $srvp2PlzAreaCur AND hq_id = $hq_id AND cs_id = $csId AND vht_id = $vhtId"; $res = $db->query($sqlStmt); if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif; else : if ($newValueToBeStored != "0" || $newCrValueToBeStored != "0") : // Insert the new price $tmpFields = array("srvpa_id",$srvPlzAreaCur,"srvpa2_id",$srvp2PlzAreaCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId, "srvpac_price",$newValueToBeStored,"srvpac_discount",$serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur], "srvpac_cr_price",$newCrValueToBeStored,"srvpac_cr_discount",$serviceCrDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur]); insertStmt("serviceplzareacustomer",$tmpFields); endif; endif; // Insert current prices AND (!) discounts into the servicehistory $tmpFields = array("srvpa_id",$srvPlzAreaCur,"srvpa2_id",$srvp2PlzAreaCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId,"usr_id",$currentSessionUsrId,"srvpah_validfrom",$currentTime,"srvpah_price",$newValueToBeStored,"srvpah_discount",$serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur], "srvpah_cr_price",$newCrValueToBeStored,"srvpah_cr_discount",$serviceCrDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur]); insertStmt("serviceplzareahistory",$tmpFields); $servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur] = $newValueToBeStored; $serviceCrPrices[$srvPlzAreaCur][$srvp2PlzAreaCur] = $newCrValueToBeStored; endif; else : // Check for necessity to update or insert if ($serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] != $newValueToBeStored || $serviceCrDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] != $newCrValueToBeStored) : if (existsEntry("serviceplzareacustomer",array("srvpa_id",$srvPlzAreaCur,"srvpa2_id",$srvp2PlzAreaCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId))) : // Update the new discount $sqlStmt = "UPDATE serviceplzareacustomer SET srvpac_discount = $newValueToBeStored, srvpac_cr_discount = $newCrValueToBeStored" . " WHERE srvpa_id = $srvPlzAreaCur AND srvpa2_id = $srvp2PlzAreaCur AND hq_id = $hq_id AND cs_id = $csId AND vht_id = $vhtId"; $res = $db->query($sqlStmt); if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif; else : if ($newValueToBeStored != "0" || $newCrValueToBeStored != "0") : // Insert the new discount $tmpFields = array("srvpa_id",$srvPlzAreaCur,"srvpa2_id",$srvp2PlzAreaCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId, "srvpac_price",$servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur],"srvpac_discount",$newValueToBeStored, "srvpac_cr_price",$serviceCrPrices[$srvPlzAreaCur][$srvp2PlzAreaCur],"srvpac_cr_discount",$newCrValueToBeStored); insertStmt("serviceplzareacustomer",$tmpFields); endif; endif; // Insert current prices AND (!) discounts into the servicehistory $tmpFields = array("srvpa_id",$srvPlzAreaCur,"srvpa2_id",$srvp2PlzAreaCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId,"usr_id",$currentSessionUsrId,"srvpah_validfrom",$currentTime,"srvpah_price",$servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur],"srvpah_discount",$newValueToBeStored, "srvpah_cr_price",$serviceCrPrices[$srvPlzAreaCur][$srvp2PlzAreaCur],"srvpah_cr_discount",$newCrValueToBeStored); insertStmt("serviceplzareahistory",$tmpFields); $serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] = $newValueToBeStored; $serviceCrDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] = $newCrValueToBeStored; endif; endif; endfor; endfor; TA("C"); TA("E"); endif; // ***************************************************** // * Generation of the price-matrix or discount-matrix * // ***************************************************** // Table-header $serviceOutput = "\n"; $serviceOutput .= " \n"; // because of the following row-names for ($j = 1; $j <= $lenServices2; $j++) : $serviceOutput .= "" . $services2["name"][$j] . "\n"; endfor; $serviceOutput .= "\n"; // Table-data for ($j = 1; $j <= $lenServices; $j++) : $serviceOutput .= "\n"; $serviceOutput .= "" . $services["name"][$j] . "\n"; for ($i = 1; $i <= $lenServices2; $i++) : // Define current zipcodearea-ids $srvPlzAreaCur = $services["id"][$j]; $srvp2PlzAreaCur = $services2["id"][$i]; if ($mode == "price") : if ($servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif; $serviceOutput .= ""; $serviceOutput .= "
"; $serviceOutput .= ""; if ($csId != "0") : if ($servicePricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $servicePricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif; $serviceOutput .= "(" . $servicePricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] . ")  "; endif; $serviceOutput .= "
\n"; $serviceOutput .= "
"; $serviceOutput .= ""; if ($csId != "0") : if ($serviceCrPricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceCrPricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif; $serviceOutput .= "(" . $serviceCrPricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] . ")  "; endif; $serviceOutput .= "

\n"; $serviceOutput .= "\n"; else : if ($serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif; $serviceOutput .= ""; $serviceOutput .= "
"; $serviceOutput .= ""; if ($csId != "0") : if ($serviceDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif; $serviceOutput .= "(" . $serviceDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] . ")  "; endif; $serviceOutput .= "
\n"; $serviceOutput .= "
"; $serviceOutput .= ""; if ($csId != "0") : if ($serviceCrDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceCrDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif; $serviceOutput .= "(" . $serviceCrDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] . ")  "; endif; $serviceOutput .= "

\n"; $serviceOutput .= "\n"; endif; endfor; $serviceOutput .= "\n"; endfor; // Output if ($mode == "price") : $title = getLngt("Allgemeine Preise für zusammengefasste PLZ-Vermittlungsbereiche"); else : $title = getLngt("Allgemeine Rabatte für zusammengefasste PLZ-Vermittlungsbereiche [in %]"); endif; if ($csId != "0") : if ($mode == "price") : $title = getLngt("Bereichspreise zusammengefasster PLZ-Vermittlungsbereiche speziell für den Kunden") . " " . $cmpComp . " " . $cmpComp2; else : $title = getLngt("Bereichsrabatte zusammengefasster PLZ-Vermittlungsbereiche speziell für den Kunden") . " " . $cmpComp . " " . $cmpComp2; endif; endif; $title2 = getLngt("Verwaltung der Vermittlungsbereiche"); $title3 = getLngt("Verwaltung der Bereichsnachbarschaft"); $title4 = getLngt("Verwaltung der Bereichsaddressen"); // BEGINNING OF ADMINISTRATION OF ZIPCODE-MAPPING // ************************************************ // * Get all zipcodes for the current zipcodearea * // ************************************************ $sqlquery = "SELECT srvp.srvp_id, srvp.srvp_plz " . " FROM serviceplzareamapping AS srvpam, serviceplzarea AS srvpa, serviceplz AS srvp" . " WHERE srvpa.srvpa_name = '" . $f_area_name . "' AND" . " srvpa.hq_id = '" . $hq_id . "' AND" . " srvpa.srvpa_id = srvpam.srvpa_id AND" . " srvpam.srvp_id = srvp.srvp_id" . " ORDER BY srvp.srvp_plz"; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); $services2 = ""; $count = 0; while ($row = $result->fetch_assoc()): $count++; $areazipcodes["id"][$count] = $row["srvp_id"]; $areazipcodes["plz"][$count] = $row["srvp_plz"]; endwhile; $result->free(); // Length of the array containing the zipcodes according to the current selected area $lenAreazipcodes = count($areazipcodes["id"]); // ***************************************************************** // * Display all zipcodeareas based on the filter set in $areaRow. * // * It is the same filter like for the matrix above! * // ***************************************************************** // Select-Box $serviceOutput2 = "
        \n"; // Change name of the selected area $serviceOutput2 .= "  \n"; $serviceOutput2 .= "
\n"; $serviceOutput2 .= defineButtonType10(getLngt("Bereich umbenennen"), "action_rename", "finishPageAreaChange('save_area_change');", "170"); // Output of the existing zipcodes of the current selected area $serviceOutput2 .= "

" . getLngt("Zugehörige PLZen des selektierten Bereichs:") . "
\n"; for ($j = 1; $j <= $lenAreazipcodes; $j++) : $serviceOutput2 .= "
\n"; $serviceOutput2 .= $areazipcodes["plz"][$j]; $serviceOutput2 .= ""; $serviceOutput2 .= "
\n"; endfor; // Button to remove associations between area and zipcode(s). Only show if at least one zipcode is associated to the current area. if ($lenAreazipcodes > 0) : $serviceOutput2 .= defineButtonType10(getLngt("Markierte Verknüpfungen entfernen"), "action_rename", "finishPageRemoveZipcode('save_removezipcodeassociation');", "250"); endif; // BEGINNING OF ADMINISTRATION OF NEIGHBOURS // ************************************************** // * Get all neighbours for the current zipcodearea * // ************************************************** $sqlquery = "SELECT srvpa2.srvpa_id, srvpa2.srvpa_name, srvpan.srvpan_sort" . " FROM serviceplzareaneighbour AS srvpan, serviceplzarea AS srvpa, serviceplzarea AS srvpa2" . " WHERE srvpa.srvpa_name = '" . $f_area_name2 . "' AND" . " srvpa.hq_id = '" . $hq_id . "' AND" . " srvpa.srvpa_id = srvpan.srvpa_id AND" . " srvpan.srvpa2_id = srvpa2.srvpa_id" . " ORDER BY srvpan.srvpan_sort"; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); $services2 = ""; $count = 0; while ($row = $result->fetch_assoc()): $count++; $areaneighbours["id"][$count] = $row["srvpa_id"]; $areaneighbours["name"][$count] = $row["srvpa_name"]; $areaneighbours["sort"][$count] = $row["srvpan_sort"]; endwhile; $result->free(); // Length of the array containing the zipcodes according to the current selected area $lenAreaNeighbours = count($areaneighbours["id"]); // *************************************************************** // * Display all neighbours based on the filter set in $areaRow. * // * It is the same filter like for the matrix above! * // *************************************************************** // Select-Box $serviceOutput3 = "


\n"; // Output of the existing neighbours of the current selected area $serviceOutput3 .= "
\n"; for ($j = 1; $j <= $lenAreaNeighbours; $j++) : $serviceOutput3 .= "
\n"; $serviceOutput3 .= $areaneighbours["name"][$j]; $serviceOutput3 .= ""; $serviceOutput3 .= "
\n"; endfor; $serviceOutput3 .= "
"; // Button to remove associations between area and zipcode(s). Only show if at least one zipcode is associated to the current area. if ($lenAreaNeighbours > 0) : $serviceOutput3 .= defineButtonType10(getLngt("Markierte Nachbarbereiche entfernen"), "action_remove", "finishPage('save_removeneighbourassociation');", "250"); endif; ?> <?php echo $pageTitel; ?>
>
>:
>:
>:
   >    >
:      
:      
: