1008 lines
45 KiB
PHP
1008 lines
45 KiB
PHP
<?php
|
|
/*=======================================================================
|
|
*
|
|
* services_plz_area.php
|
|
*
|
|
* Autor: Marc Vollmann
|
|
*
|
|
=======================================================================*/
|
|
|
|
include_once ("../include/global.inc.php");
|
|
include_once ("../include/auth.inc.php");
|
|
|
|
|
|
// Check HTTP-Parameters
|
|
getSecHttpVars("1",array("f_act","mode","csId","vhtId","opener","orderByServices","statusMessage","areaRow","areaCol",
|
|
"f_area_name", "f_newzipcodeforarea", "f_del_zipcode_id", "f_area_change", "f_area_new",
|
|
"f_area_name2", "f_del_neighbour_id", "f_newneighbourforarea", "deactivateMenu", "f_vehicletype",
|
|
"pageFirstCall", "f_chkbx_toggle", "f_chkbx_toggle_cr"));
|
|
|
|
getLanguage(__FILE__);
|
|
|
|
$pageTitel = getLngt("BEREICHSPREISE");
|
|
if ($mode == "discount") : $pageTitel = getLngt("BEREICHSRABATTE"); endif;
|
|
include_once ("../admin/menu.php");
|
|
include_once ("../include/html.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, "2", "1");
|
|
|
|
// Get usr_id of the current employee (session)
|
|
$currentSessionUsrId = getFieldValueFromId("employee", "emp_id", $emp_id, "usr_id");
|
|
|
|
|
|
if ($pageFirstCall == "" || ($f_chkbx_toggle == "" && $f_chkbx_toggle_cr == "")) :
|
|
$pageFirstCall = 1;
|
|
$f_chkbx_toggle = "service";
|
|
$f_chkbx_toggle_cr = "";
|
|
endif;
|
|
$f_chkbx_toggle_checked = "";
|
|
$f_chkbx_toggle_cr_checked = "";
|
|
if ($f_chkbx_toggle == "service") : $f_chkbx_toggle_checked = "checked"; endif;
|
|
if ($f_chkbx_toggle_cr == "service_cr") : $f_chkbx_toggle_cr_checked = "checked"; endif;
|
|
|
|
// Price-mode or discount-mode
|
|
if ($mode == "") : $mode = "price"; endif;
|
|
|
|
// General price/discount for all customers
|
|
if ($csId == "") : $csId = "0"; endif;
|
|
|
|
// General price/discount for all vehicle types
|
|
if ($vhtId == "") : $vhtId = "0"; endif;
|
|
if ($f_vehicletype != "" && is_numeric($f_vehicletype)) : $vhtId = $f_vehicletype; endif;
|
|
if (!existsEntry("metatype",array("mt_type","vehicletype","mt_sort",$vhtId))) : $vhtId = "0"; endif; // Check for existence in "metatype"
|
|
|
|
// Check opener ONLY for output in target
|
|
$htmlFormTarget = "target=\"\"";
|
|
if ($opener == "1") : $htmlFormTarget = ""; endif;
|
|
|
|
// Get parameters
|
|
$parServiceVehicleTypeEnabled = getParameterValue("0", "SERVICE_VEHICLE_TYPE_ENABLED", $hq_id);
|
|
|
|
// Get mapped vehicle type id if a mapping does exist
|
|
$vhtId = getServiceVehicleTypeMappingId($vhtId);
|
|
|
|
// Init
|
|
$areazipcodes = array();
|
|
$areazipcodes["id"] = array();
|
|
$areazipcodes["plz"] = array();
|
|
$areaneighbours = array();
|
|
$areaneighbours["id"] = array();
|
|
$areaneighbours["name"] = array();
|
|
$areaneighbours["sort"] = array();
|
|
|
|
|
|
$cmpComp = "";
|
|
$cmpComp2 = "";
|
|
if ($csId != "0") :
|
|
$cmpId = getFieldValueFromId("customer","cs_id",$csId,"cmp_id");
|
|
$tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2"));
|
|
$cmpComp = $tmpFields[0];
|
|
$cmpComp2 = $tmpFields[1];
|
|
endif;
|
|
|
|
$vhtName = "";
|
|
if ($vhtId != "0") :
|
|
$vhtName = getFieldValueFromClause("metatype","mt_value","mt_type = 'vehicletype' AND mt_sort = '" . $vhtId . "'");
|
|
endif;
|
|
|
|
// Sorting of the services to be displayed
|
|
if ($orderByServices == "") : $orderByServices = "srvpa.srvpa_name" ; endif;
|
|
|
|
// Offset for output
|
|
$offset = NUM_ROWS_ZIPCODEAREA_MATRIX;
|
|
|
|
|
|
// Check the syntax of the new zipcode to be associated with the area
|
|
// If the number entered has less than x digits the (german) zipcode normaly has, padl to x digits
|
|
if ($f_newzipcodeforarea != "" && is_numeric($f_newzipcodeforarea)) :
|
|
if (strlen($f_newzipcodeforarea) < ZIPCODE_LENGTH) :
|
|
$f_newzipcodeforarea = pad($f_newzipcodeforarea, ZIPCODE_LENGTH, "0", "left");
|
|
endif;
|
|
endif;
|
|
|
|
|
|
// *** Storing-processes ***
|
|
// *** BEGIN ***************
|
|
|
|
// Store new area
|
|
if ($f_act != "" && $f_act == "save_area_new") :
|
|
|
|
// Check consistency of the parameter
|
|
if (trim($f_area_new) != "") :
|
|
|
|
// Check existence of the name
|
|
if (!existsEntry("serviceplzarea",array("hq_id",$hq_id,"srvpa_name",$f_area_new))) :
|
|
|
|
// Insert the new area
|
|
$tmpFields = array("hq_id",$hq_id,"srvpa_name",$f_area_new);
|
|
insertStmt("serviceplzarea",$tmpFields);
|
|
else :
|
|
$statusMessage = getLngt("Der gewünschte Name existiert leider schon!");
|
|
endif;
|
|
|
|
else :
|
|
$statusMessage = getLngt("Es muss ein gültiger Bezeichner eingegeben werden!");
|
|
endif;
|
|
endif;
|
|
|
|
// Change name of existing area
|
|
if ($f_act != "" && $f_act == "save_area_change") :
|
|
|
|
// Check consistency of the parameter
|
|
if (trim($f_area_change) != "") :
|
|
|
|
// Check existence for the new name
|
|
if (!existsEntry("serviceplzarea",array("hq_id",$hq_id,"srvpa_name",$f_area_change))) :
|
|
|
|
// Update the name of the area
|
|
updateStmt("serviceplzarea", "srvpa_name", $f_area_name, array("srvpa_name", $f_area_change), "hq_id = '" . $hq_id . "'");
|
|
else :
|
|
$statusMessage = getLngt("Der gewünschte Name existiert leider schon!");
|
|
endif;
|
|
|
|
else :
|
|
$statusMessage = getLngt("Es muss ein gültiger Bezeichner eingegeben werden!");
|
|
endif;
|
|
endif;
|
|
|
|
|
|
// Store new association between current area and entered zipcode
|
|
if ($f_act != "" && $f_act == "save_newzipcodeassociation" && $f_area_name != "") :
|
|
|
|
// Syntax of the zipcode is correct?
|
|
if ($f_newzipcodeforarea != "") :
|
|
|
|
// First make a lookup if zipcode exists and get the internal id of the new zipcode
|
|
$srvp_id = getFieldValueFromId("serviceplz","srvp_plz",$f_newzipcodeforarea,"srvp_id");
|
|
if ($srvp_id != "") :
|
|
|
|
// Get the internal id of the current area
|
|
// $srvpa_id = getFieldValueFromId("serviceplzarea","srvpa_name",$f_area_name,"srvpa_id");
|
|
$srvpa_id = getFieldValueFromClause("serviceplzarea","srvpa_id","srvpa_name = '" . $f_area_name . "' AND hq_id = '" . $hq_id . "'");
|
|
|
|
// If zipcode does exist then look up for an existing association between the zipcode and another area
|
|
// if (!existsEntry("serviceplzareamapping",array("srvp_id",$srvp_id))) :
|
|
$srvpa_id2 = $db->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 = "<tr>\n";
|
|
$serviceOutput .= "<td> </td>\n"; // because of the following row-names
|
|
for ($j = 1; $j <= $lenServices2; $j++) :
|
|
$serviceOutput .= "<td>" . $services2["name"][$j] . "</td>\n";
|
|
endfor;
|
|
$serviceOutput .= "</tr>\n";
|
|
|
|
// Table-data
|
|
for ($j = 1; $j <= $lenServices; $j++) :
|
|
$serviceOutput .= "<tr>\n";
|
|
$serviceOutput .= "<td>" . $services["name"][$j] . "</td>\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 .= "<td>";
|
|
$serviceOutput .= "<div class=\"service\">";
|
|
$serviceOutput .= "<input type=\"text\" class=\"cell_attr\" name=\"service_" . $srvPlzAreaCur . "_" . $srvp2PlzAreaCur . "\" value=\"" . $servicePrices[$srvPlzAreaCur][$srvp2PlzAreaCur] . "\" size=\"7\" align=\"right\">";
|
|
if ($csId != "0") :
|
|
if ($servicePricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $servicePricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif;
|
|
$serviceOutput .= "(" . $servicePricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] . ") ";
|
|
endif;
|
|
$serviceOutput .= "</div>\n";
|
|
$serviceOutput .= "<div class=\"service_cr\">";
|
|
$serviceOutput .= "<input type=\"text\" class=\"cell_attr_cr\" name=\"service_cr_" . $srvPlzAreaCur . "_" . $srvp2PlzAreaCur . "\" value=\"" . $serviceCrPrices[$srvPlzAreaCur][$srvp2PlzAreaCur] . "\" size=\"7\" align=\"right\">";
|
|
if ($csId != "0") :
|
|
if ($serviceCrPricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceCrPricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif;
|
|
$serviceOutput .= "(" . $serviceCrPricesDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] . ") ";
|
|
endif;
|
|
$serviceOutput .= "</div></br>\n";
|
|
$serviceOutput .= "</td>\n";
|
|
else :
|
|
if ($serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif;
|
|
$serviceOutput .= "<td>";
|
|
$serviceOutput .= "<div class=\"service\">";
|
|
$serviceOutput .= "<input type=\"text\" class=\"cell_attr\" name=\"service_" . $srvPlzAreaCur . "_" . $srvp2PlzAreaCur . "\" value=\"" . $serviceDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] . "\" size=\"7\" align=\"right\">";
|
|
if ($csId != "0") :
|
|
if ($serviceDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif;
|
|
$serviceOutput .= "(" . $serviceDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] . ") ";
|
|
endif;
|
|
$serviceOutput .= "</div>\n";
|
|
$serviceOutput .= "<div class=\"service_cr\">";
|
|
$serviceOutput .= "<input type=\"text\" class=\"cell_attr_cr\" name=\"service_cr_" . $srvPlzAreaCur . "_" . $srvp2PlzAreaCur . "\" value=\"" . $serviceCrDiscounts[$srvPlzAreaCur][$srvp2PlzAreaCur] . "\" size=\"7\" align=\"right\">";
|
|
if ($csId != "0") :
|
|
if ($serviceCrDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] == "") : $serviceCrDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] = "0.00"; endif;
|
|
$serviceOutput .= "(" . $serviceCrDiscountsDefault[$srvPlzAreaCur][$srvp2PlzAreaCur] . ") ";
|
|
endif;
|
|
$serviceOutput .= "</div></br>\n";
|
|
$serviceOutput .= "</td>\n";
|
|
endif;
|
|
endfor;
|
|
$serviceOutput .= "</tr>\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 = "<div style=\"float:left\"><select name=\"f_area_name\" onChange=\"document.forms[0].submit();\">\n";
|
|
for ($j = 1; $j <= $lenServices; $j++) :
|
|
$is_selected = "";
|
|
if ($f_area_name == $services["name"][$j]) : $is_selected = " selected"; endif;
|
|
$serviceOutput2 .= "<option value=\"" . $services["name"][$j] . "\" " . $is_selected . ">" . $services["name"][$j] . "</option>\n";
|
|
endfor;
|
|
$serviceOutput2 .= "</select> \n";
|
|
|
|
// Change name of the selected area
|
|
$serviceOutput2 .= "<input type=\"text\" name=\"f_area_change\" value=\"\" size=\"10\" maxlength=\"10\"> \n";
|
|
$serviceOutput2 .= "</div>\n";
|
|
$serviceOutput2 .= defineButtonType10(getLngt("Bereich umbenennen"), "action_rename", "finishPageAreaChange('save_area_change');", "170");
|
|
|
|
|
|
// Output of the existing zipcodes of the current selected area
|
|
$serviceOutput2 .= "<br><br>" . getLngt("Zugehörige PLZen des selektierten Bereichs:") . "<br>\n";
|
|
for ($j = 1; $j <= $lenAreazipcodes; $j++) :
|
|
$serviceOutput2 .= "<div>\n";
|
|
$serviceOutput2 .= $areazipcodes["plz"][$j];
|
|
$serviceOutput2 .= "<input type=\"checkbox\" name=\"f_del_zipcode_id[]\" value=\"" . $areazipcodes["id"][$j] . "\">";
|
|
$serviceOutput2 .= "</div>\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 = "<div><select name=\"f_area_name2\" onChange=\"document.forms[0].submit();\">\n";
|
|
for ($j = 1; $j <= $lenServices; $j++) :
|
|
$is_selected = "";
|
|
if ($f_area_name2 == $services["name"][$j]) : $is_selected = " selected"; endif;
|
|
$serviceOutput3 .= "<option value=\"" . $services["name"][$j] . "\" " . $is_selected . ">" . $services["name"][$j] . "</option>\n";
|
|
endfor;
|
|
$serviceOutput3 .= "</select><br><br></div>\n";
|
|
|
|
// Output of the existing neighbours of the current selected area
|
|
$serviceOutput3 .= "<table><tr><td>\n";
|
|
for ($j = 1; $j <= $lenAreaNeighbours; $j++) :
|
|
$serviceOutput3 .= "<div>\n";
|
|
$serviceOutput3 .= $areaneighbours["name"][$j];
|
|
$serviceOutput3 .= "<input type=\"checkbox\" name=\"f_del_neighbour_id[]\" value=\"" . $areaneighbours["id"][$j] . "\">";
|
|
$serviceOutput3 .= "</div>\n";
|
|
endfor;
|
|
$serviceOutput3 .= "<br>";
|
|
|
|
// 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;
|
|
?>
|
|
|
|
|
|
<html lang="de">
|
|
<head>
|
|
<title><?php echo $pageTitel; ?></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 src="../include/lib_global.js" type="text/javascript"></script>
|
|
|
|
<script type="text/javascript">
|
|
<!--
|
|
// NAVIGATION
|
|
<?php echo $jsMenuOut; ?>
|
|
|
|
function searchCustomerPopup() {
|
|
var widthPopupWin = 800;
|
|
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/impressum.html", "","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin);
|
|
};
|
|
|
|
function finishPage(f_act) {
|
|
// for(i=0;i<document.forms[0].jb_costcenter_select.length;++i) {
|
|
// if (document.forms[0].jb_costcenter_select.options[i].selected == true) {
|
|
// document.forms[0].jb_costcenter.value=document.forms[0].jb_costcenter_select.options[i].value;
|
|
// }
|
|
// };
|
|
if (f_act == 'save') {
|
|
if (!confirm('<?php echo getLngt("Preisbereichsmatrix speichern?") ?>')) {
|
|
return false;
|
|
}
|
|
}
|
|
document.forms[0].f_act.value = f_act;
|
|
document.forms[0].submit();
|
|
};
|
|
|
|
function finishPageAddZipcode(f_act) {
|
|
var zipcode = document.forms[0].f_newzipcodeforarea.value;
|
|
if (zipcode != '') {
|
|
if (checkIsNaN(zipcode, '<?php echo getLngt("Der eingegebene Wert kann keine PLZ sein! Bitte ändern!") ?>')) {
|
|
finishPage(f_act);
|
|
}
|
|
} else {
|
|
alert('<?php echo getLngt("Bitte geben Sie ein PLZ ein!") ?>');
|
|
}
|
|
};
|
|
|
|
function finishPageRemoveZipcode(f_act) {
|
|
finishPage(f_act);
|
|
};
|
|
|
|
function finishPageAreaNew(f_act) {
|
|
var area_new = document.forms[0].f_area_new.value;
|
|
if (area_new != '') {
|
|
if (confirm('<?php echo getLngt("Neuen Bereich anlegen?") ?>')) {
|
|
finishPage(f_act);
|
|
};
|
|
} else {
|
|
alert('<?php echo getLngt("Bitte geben Sie einen Bezeichner ein!") ?>');
|
|
}
|
|
};
|
|
|
|
function finishPageAreaChange(f_act) {
|
|
var area_change = document.forms[0].f_area_change.value;
|
|
if (area_change != '') {
|
|
if (confirm('<?php echo getLngt("Bereich wirklich umbenennen?") ?>')) {
|
|
finishPage(f_act);
|
|
};
|
|
} else {
|
|
alert('<?php echo getLngt("Bitte geben Sie einen Bezeichner ein!") ?>');
|
|
}
|
|
};
|
|
|
|
function initCells() {
|
|
// Show or hide cells
|
|
if ('<?php echo $f_chkbx_toggle_checked ?>' == 'checked') { $(".service").show(); } else { $(".service").hide(); };
|
|
if ('<?php echo $f_chkbx_toggle_cr_checked ?>' == 'checked') { $(".service_cr").show(); } else { $(".service_cr").hide(); };
|
|
// Common checkbox attributes
|
|
$(".chkbox_attr").css("display", "inline-block");
|
|
$(".chkbox_attr").css("height", "20px");
|
|
<?php if ($mode == "discount") : ?>
|
|
$(".chkbox_attr").css("width", "200px");
|
|
<?php else : ?>
|
|
$(".chkbox_attr").css("width", "160px");
|
|
<?php endif; ?>
|
|
// Special checkbox attributes
|
|
$(".chkbox_attr_special").css("background-color", "#FFFFFF");
|
|
$(".chkbox_attr_special_cr").css("background-color", "#F7F8E0");
|
|
// Special cell attributes
|
|
$(".cell_attr").css("background-color", "#FFFFFF");
|
|
$(".cell_attr_cr").css("background-color", "#F7F8E0");
|
|
}
|
|
|
|
function toggleCells() {
|
|
// Check at least one checkbox has to be set
|
|
if (!$('#f_chkbx_toggle').prop('checked') && !$('#f_chkbx_toggle_cr').prop('checked')) {
|
|
$('#f_chkbx_toggle').val('service');
|
|
$('#f_chkbx_toggle').prop('checked',true);
|
|
alert('<?php echo getLngt("Mindestens eine der Checkboxen muss gesetzt sein!") ?>');
|
|
}
|
|
if ($('#f_chkbx_toggle').prop('checked')) { $(".service").show(); } else { $(".service").hide(); };
|
|
if ($('#f_chkbx_toggle_cr').prop('checked')) { $(".service_cr").show(); } else { $(".service_cr").hide(); };
|
|
}
|
|
|
|
-->
|
|
</script>
|
|
<noscript>
|
|
<center>
|
|
<b><br>JavaScript ist nicht verfügbar. Bitte aktivieren Sie JavaScript<br><br>
|
|
in Ihrem Browser, damit diese Seite ordnungsgemäß funktioniert!</b><br><br>
|
|
</center>
|
|
</noscript>
|
|
</head>
|
|
|
|
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>initCells();displayStatusMessage();">
|
|
|
|
<?php echo $phpMenuOut ?>
|
|
<?php echo $phpReducedMenuOut ?>
|
|
<?php echo $phpPageTitelOut ?>
|
|
|
|
<div class="mc_page-header">
|
|
<?php echo $title ?>
|
|
</div>
|
|
|
|
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
|
|
|
|
<form name="services" action="../admin/services_plz_area.php" method="post" <?php echo $htmlFormTarget ?>>
|
|
|
|
<input type="hidden" name="f_act" value="">
|
|
<input type="hidden" name="mode" value="<?php echo ec($mode) ?>">
|
|
<input type="hidden" name="orderByServices" value="<?php echo $orderByServices ?>">
|
|
<input type="hidden" name="csId" value="<?php echo ec($csId) ?>">
|
|
<input type="hidden" name="opener" value="<?php echo $opener ?>">
|
|
<?php echo $phpCurrentNavigationInputHidden ?>
|
|
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
|
|
<input type="hidden" name="pageFirstCall" value="<?php echo $pageFirstCall ?>">
|
|
|
|
|
|
<?php echo htmlDivLineSpacer("30px"); ?>
|
|
|
|
<div>
|
|
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Zeile") ?>:</div>
|
|
<div>
|
|
<input type="text" name="areaRow" value="<?php echo $areaRow ?>" size="6"> <?php echo getLngt("(VON)") ?>
|
|
</div>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("5px"); ?>
|
|
<div>
|
|
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Spalte") ?>:</div>
|
|
<div>
|
|
<input type="text" name="areaCol" value="<?php echo $areaCol ?>" size="6"> <?php echo getLngt("(NACH)") ?>
|
|
</div>
|
|
</div>
|
|
<?php if ($parServiceVehicleTypeEnabled == "1") : ?>
|
|
<?php echo htmlDivLineSpacer("10px"); ?>
|
|
<div>
|
|
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Fahrzeugtyp") ?>:</div>
|
|
<div>
|
|
<select name="f_vehicletype" class="f8np1" onChange="finishPage('');">
|
|
<?php
|
|
// Check excludes vehicle type IDs
|
|
$mask_exclude_vht_ids = getParameterValue("0", "MASK_EXCLUDE_VHT_IDS", $hq_id);
|
|
if ($mask_exclude_vht_ids != "") $mask_exclude_vht_ids = " AND NOT mt_sort IN (" . $mask_exclude_vht_ids . ")";
|
|
echo addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'vehicletype'" . $mask_exclude_vht_ids, $vhtId);
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
|
|
|
|
<?php echo defineButtonType10(getLngt("Tabelle anzeigen"), "action_display", "document.forms[0].submit();", "150","left",3); ?>
|
|
|
|
<span class="chkbox_attr chkbox_attr_special"><input type="checkbox" id="f_chkbx_toggle" name="f_chkbx_toggle" value="service" onChange="toggleCells();" <?php echo $f_chkbx_toggle_checked ?>> <?php echo ($mode == "price" ? getLngt("Preise") : getLngt("Rabatte")); ?></span>
|
|
|
|
<span class="chkbox_attr chkbox_attr_special_cr"><input type="checkbox" id="f_chkbx_toggle_cr" name="f_chkbx_toggle_cr" value="service_cr" onChange="toggleCells();" <?php echo $f_chkbx_toggle_cr_checked ?>> <?php echo ($mode == "price" ? getLngt("Frachtvergütungen") : getLngt("Frachtvergütungsrabatte")); ?></span>
|
|
<?php echo htmlDivLineSpacer("30px"); ?>
|
|
|
|
<div>
|
|
<table width="100%" align="left" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
|
|
<?php echo $serviceOutput ?>
|
|
</table>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
|
|
|
|
<?php echo defineButtonType10(getLngt("Speichern"), "action_save", "finishPage('save');", "100"); ?>
|
|
<?php echo htmlDivLineSpacer("50px"); ?>
|
|
|
|
|
|
<!-- Verwaltung der Bereichsadressen -->
|
|
<!--
|
|
<div class="f10bp1_blue">
|
|
<?php echo $title4 ?>: <span class="f10bp1"><a href="../admin/srvpaa_list.php" target="_blank"><?php echo getLngt("Zuordnungen bearbeiten") ?></a></span>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("40px"); ?>
|
|
-->
|
|
|
|
|
|
<!-- Verwaltung der Vermittlungsbereiche -->
|
|
<div class="f12bp1_blue">
|
|
<?php echo $title2 ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("20px"); ?>
|
|
|
|
<div>
|
|
<?php echo $serviceOutput2 ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("50px", "", "left"); ?>
|
|
|
|
<div>
|
|
<div style="float:left">
|
|
<?php echo getLngt("PLZ für Verknüpfung eingeben") ?>:
|
|
<input type="text" name="f_newzipcodeforarea" value="">
|
|
</div>
|
|
<?php echo defineButtonType10(getLngt("PLZ verknüpfen"), "action_assoc", "finishPageAddZipcode('save_newzipcodeassociation');", "180"); ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
|
|
|
|
<div>
|
|
<div style="float:left">
|
|
<?php echo getLngt("Namen für den neuen Bereich eingeben") ?>:
|
|
<input type="text" name="f_area_new" value="" size="10" maxlength="10">
|
|
</div>
|
|
<?php echo defineButtonType10("Neuen Bereich anlegen", "action_new", "finishPageAreaNew('save_area_new');", "180"); ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("50px", "", "left"); ?>
|
|
|
|
|
|
<!-- Verwaltung der Bereichsnachbarschaft -->
|
|
<div class="f10bp1_blue">
|
|
<?php echo $title3 ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("20px"); ?>
|
|
|
|
<div>
|
|
<?php echo $serviceOutput3 ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
|
|
|
|
<div>
|
|
<div style="float:left">
|
|
<?php echo getLngt("Bereich für Nachbarschaftsverknüpfung eingeben") ?>:
|
|
<input type="text" name="f_newneighbourforarea" value="">
|
|
</div>
|
|
<?php echo defineButtonType10(getLngt("Nachbar anlegen"), "action_new", "finishPage('save_newneighbourassociation');", "150", "left"); ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
|
|
|
|
</form>
|
|
</div>
|
|
</body>
|
|
</html>
|