"; stationRequestLogFile($currentTime); stationRequestLogFile($orderReq); if ($selectedLanguage == "" || !is_numeric($selectedLanguage)) : $selectedLanguage = "1"; endif; // Default in English $languageSelected = $selectedLanguage; getLanguage(__FILE__); getCurrentScript(__FILE__); $err = array(); $outResponse = ""; $acceptOrder = true; // --------------------------------------------------------------------------- // GLOBAL MODE OF USAGE $globalParUseRelatedCustomer = getParameterValue("0", "GLOBAL_USE_RELATED_CUSTOMER", "0"); // *** Init *** $maxNumOfStationsPerDay = 300; $maxNumOfRunningStations = 500; $hqId = ""; $usr_id = ""; $jbStatus = "9"; $jbType = ""; $jbTourname = ""; $fixprice = 0; $cmpPostage = 0; $csInvmode = ""; $jbService = 1; $jbTimeUnits = 2; $txId = "4"; $txValue = getFieldValueFromId("tax","tx_id",$txId,"tx_value"); $txSign = getFieldValueFromId("tax","tx_id",$txId,"tx_sign"); if ($globalParUseRelatedCustomer == "1") : $txValue = $txId; $txSign = ""; endif; $trServicesArray = array(); // All station services and prices of all tour stations for calling price function $trArticleArray = array(); // All articles (per station) $trCalcFunctionsArray = array(); // All calculator functions (per station) $trCalcFunctionsResultArray = array(); // All calculator function results (per station) $gHqId = true; // Needed for calculator functions // *** Parse request *** $orderArray = xml2array($orderReq); if ($debug) : // print_r($orderArray); echo "


"; endif; // *** Convert result array to usable parameters *** // Authentication data $csEid = convertSpecial($orderArray["xml"]["order"]["auth"]["customer"]); $csId = getFieldValueFromId("customer","cs_eid",$csEid,"cs_id"); $usrAccount = convertSpecial($orderArray["xml"]["order"]["auth"]["account"]); $usrPassword = convertSpecial($orderArray["xml"]["order"]["auth"]["password"]); $sessionId = convertSpecial($orderArray["xml"]["order"]["auth"]["session_id"]); // Optional customer group data (needed to find e.g. an article price automatically). Has to be set explicitly, because a customer could belong to more groups !!!! $csGroupId = convertSpecial($orderArray["xml"]["order"]["auth"]["group_no"]); $csGroupName = convertSpecial($orderArray["xml"]["order"]["auth"]["group_name"]); if ($csGroupId != "" && is_numeric($csGroupId)) : $csGroupName = getFieldValueFromId("groups","grp_id",$csGroupId,"grp_name"); elseif ($csGroupName != "") : $csGroupId = getFieldValueFromId("groups","grp_name",$csGroupName,"grp_id"); endif; // Reset customer group data if it could not be identified if ($csGroupId == "" || $csGroupName == "") : $csGroupId = ""; $csGroupName = ""; endif; $debugOut .= "usrAccount: " . $usrAccount . "
\n"; $debugOut .= "usrPassword: " . $usrPassword . "
\n"; $debugOut .= "sessionId: " . $sessionId . "
\n"; if (checkRequestAuthenticationData($usrAccount, $usrPassword, $sessionId, $csId)) : $debugOut .= "Authentication okay!

\n"; // Data $hqId = getFieldValueFromId("customer","cs_id",$csId,"hq_id"); $cscName = convertSpecial($orderArray["xml"]["order"]["auth"]["costcenter_name"]); $cscId = ""; if ($cscName != "") : $cscId = getFieldValueFromClause("costcenter","csc_id","cs_id = '" . $csId . "' AND csc_name = '" . $cscName . "'"); endif; if ($cscId == "" || !is_numeric($cscId)) : $cscId = getFieldValueFromClause("costcenter","csc_id","cs_id = '" . $csId . "' AND isnull(csc_pre_id)"); // Root costcenter endif; // Get current headquarters instance // $parHqInstance = getParameterValue("0", "HQ_INSTANCE", $hqId); // Check disposition mode related to the vehicle state. If enabled then "jb_status" will be set to "0" if vehicle is blocked for the vehicle for the day. // $dispositionJbStatusMode = getParameterValue("0", "DISPOSITION_JB_STATUS_MODE", $hqId); // if ($dispositionJbStatusMode == "") : $dispositionJbStatusMode = getParameterValue("0", "DISPOSITION_JB_STATUS_MODE", "0"); endif; // if ($dispositionJbStatusMode == "") : $dispositionJbStatusMode = "0"; endif; // Payer versus related $cscIdPayer = $cscId; $cscIdRelated = "0"; $csIdRelated = "0"; $jbRelevantCostcenterField = "csc_id_payer"; /* if ($globalParUseRelatedCustomer == "1") : $cscIdPayer = "0"; // Set below by inserting the new customer costcenter $cscIdRelated = $cscId; // The authenticated customer will be the related customer and the end customer will be the payer (look below) !!!! $csIdRelated = getFieldValueFromId("costcenter","csc_id",$cscIdRelated,"cs_id"); $jbRelevantCostcenterField = "csc_id_related"; endif; */ // Get (customer based) parameter for global error handling $errHandlerDisabled = false; $tmpErrHandlerDisabled = getParameterValue("0", "STATION_REQUEST_ERROR_HANDLER_DISABLED_" . $csId, "0"); if ($tmpErrHandlerDisabled == "") : $tmpErrHandlerDisabled = getParameterValue("0", "STATION_REQUEST_ERROR_HANDLER_DISABLED", $hqId); endif; if ($tmpErrHandlerDisabled == "1") : $errHandlerDisabled = true; endif; $operationMode = convertSpecial($orderArray["xml"]["order"]["operation"]); // "UPD" = UPDATE, "DEL" = DELETE, "INS" (or empty or any value) = INSERT $debugOn = convertSpecial($orderArray["xml"]["order"]["debug_on"]); $commissionNo = convertSpecial($orderArray["xml"]["order"]["no"]); // Check commission number regarding existence $checkExistenceCommissionNo = getParameterValue("0", "STATION_REQUEST_CHECK_EXISTENCE_COMMISSION_NO", $hqId); if ($checkExistenceCommissionNo == "") : $checkExistenceCommissionNo = getParameterValue("0", "STATION_REQUEST_CHECK_EXISTENCE_COMMISSION_NO", "0"); endif; if (!$debug && $debugOn == "ON" || $debugOn == "YES") : $debug = true; endif; // Check existence of commission number if ($checkExistenceCommissionNo == "1") : // Get num of stations the commission number is associated to $numOfRows = getCountOfTable("tour", "tr_commission_no = '" . $commissionNo . "'"); // If the sender does not know the order is an "INS" or "UPD" operation then always "UPD" will be sent. // If the (unique) commission number check for existence is activated then the decision will be made here for the order to be an "UPD" or "INS" $checkOperationForExistingCommissionNo = getParameterValue("0", "STATION_REQUEST_CHECK_OPERATION_EXISTENCE_COMMISSION_NO", $hqId); if ($checkOperationForExistingCommissionNo == "") : $checkOperationForExistingCommissionNo = getParameterValue("0", "STATION_REQUEST_CHECK_OPERATION_EXISTENCE_COMMISSION_NO", "0"); endif; if ($checkOperationForExistingCommissionNo == "1") : // The commission number does exist, wrap "UPD" to "INS" if ($operationMode == "UPD" || $operationMode == "UPDATE") : if ($numOfRows == "0") : $operationMode = "INS"; endif; endif; else : // Standard check for existing commission number if ($operationMode == "" || $operationMode == "INS" || $operationMode == "INSERT") : if ($numOfRows != "" && $numOfRows > 0) : $err[] = array("100", getLngt("Die eindeutige Kommissionsnummer existiert schon. Die neue Station kann nicht geschrieben werden.")); $acceptOrder = false; endif; endif; endif; endif; $jbType = convertSpecial($orderArray["xml"]["order"]["type"]); $hqMnemonic = convertSpecial($orderArray["xml"]["order"]["hq"]); $hqId_XML = getFieldValueFromId("headquarters","hq_mnemonic",$hqMnemonic,"hq_id"); if ($hqMnemonic == "" && $hqId != "" && is_numeric($hqId) && $hqId > "0") : $hqMnemonic = getFieldValueFromId("headquarters","hq_id",$hqId,"hq_mnemonic"); endif; $vhtId = convertSpecial($orderArray["xml"]["order"]["vehicle"]["type_no"]); $vhtType = convertSpecial($orderArray["xml"]["order"]["vehicle"]["type_name"]); if ($vhtId != "" && is_numeric($vhtId)) : $vhtType = getFieldValueFromClause("metatype","mt_value","mt_type = 'vehicletype' AND mt_sort = '" . $vhtId . "'"); elseif ($vhtType != "") : $vhtId = getFieldValueFromClause("metatype","mt_sort","mt_type = 'vehicletype' AND mt_value = '" . $vhtType . "'"); endif; $jbCrvhWeight = convertSpecial($orderArray["xml"]["order"]["vehicle"]["weight"],"intval"); $jbCrvhLength = convertSpecial($orderArray["xml"]["order"]["vehicle"]["length"],"intval"); $jbCrvhWidth = convertSpecial($orderArray["xml"]["order"]["vehicle"]["width"],"intval"); $jbCrvhHeight = convertSpecial($orderArray["xml"]["order"]["vehicle"]["height"],"intval"); $jbCrvhPosition = convertSpecial($orderArray["xml"]["order"]["vehicle"]["position"],"intval"); $jbOrdertime = convertSpecial($orderArray["xml"]["order"]["ordertime"]); $jbOrdertimeUTC = convertSpecial($orderArray["xml"]["order"]["ordertimeUTC"]); $jbWarningtime = convertSpecial($orderArray["xml"]["order"]["warningtime"]); $jbWarningtimeUTC = convertSpecial($orderArray["xml"]["order"]["warningtimeUTC"]); $jbAcquisitiontime = convertSpecial($orderArray["xml"]["order"]["acquisition_time"]); $jbReserv = 0; // Order time if ($jbOrdertime == "" || $jbOrdertime == "0000-00-00 00:00:00") : // Check for UTC if ($jbOrdertimeUTC == "" || $jbOrdertimeUTC == "0000-00-00 00:00:00") : $jbOrdertime = $currentTime; else : $gmtDT = substr($jbOrdertimeUTC, 0,19); $checkGmtdatetimeIsValid = strtotime($gmtDT); if ($checkGmtdatetimeIsValid != "" && is_int($checkGmtdatetimeIsValid)): $jbOrdertime = date("Y-m-d H:i:s", gmmktime(substr($gmtDT,11,2), substr($gmtDT,14,2), substr($gmtDT,17,2), substr($gmtDT,5,2), substr($gmtDT,8,2), substr($gmtDT,0,4))); else : $err[] = array("112", getLngt("Das Datum wurde nicht erwartungsgemäß übergeben.")); $acceptOrder = false; endif; $jbReserv = 1; endif; else : // $jbOrdertime = checkDateTimeFormat($jbOrdertime); // DISABLED BECAUSE OF PHP VERSION ONLY !!! ACTIVATE AFTER MIGRATION !!! $checkGmtdatetimeIsValid = strtotime($jbOrdertime); if ($checkGmtdatetimeIsValid != "" && is_int($checkGmtdatetimeIsValid)): $jbReserv = 1; else : $err[] = array("113", getLngt("Die Auftragszeit wurde nicht erwartungsgemäß übergeben.")); $acceptOrder = false; endif; endif; // Check ordertime being in the future if ($operationMode != "DEL" && $operationMode != "DELETE" && $operationMode != "UPD" && $operationMode != "UPDATE") : if ($executeOperationsBecauseNoEvent) : $parCheckOrdertime = getObjectBasedParameterValue("STATION_REQUEST_CHECK_ORDERTIME", $csId, $hqId); if ($parCheckOrdertime == "1") : $errTime = $currentDate . " 00:00:00"; if ($jbOrdertime < $errTime) : $err[] = array("116", getLngt("Die Auftragszeit liegt in der Vergangenheit.")); $acceptOrder = false; endif; endif; endif; endif; // Warning time if ($jbWarningtime == "" || $jbWarningtime == "0000-00-00 00:00:00") : // Check for UTC if ($jbWarningtimeUTC != "" && $jbWarningtimeUTC != "0000-00-00 00:00:00") : $gmtDT = substr($jbWarningtimeUTC, 0,19); $checkGmtdatetimeIsValid = strtotime($gmtDT); if ($checkGmtdatetimeIsValid != "" && is_int($checkGmtdatetimeIsValid)): $jbWarningtime = date("Y-m-d H:i:s", gmmktime(substr($gmtDT,11,2), substr($gmtDT,14,2), substr($gmtDT,17,2), substr($gmtDT,5,2), substr($gmtDT,8,2), substr($gmtDT,0,4))); else : $err[] = array("114", getLngt("Die späteste Erledigungszeit wurde nicht erwartungsgemäß übergeben.")); $acceptOrder = false; endif; endif; else : // $jbWarningtime = checkDateTimeFormat($jbWarningtime); // DISABLED BECAUSE OF PHP VERSION ONLY !!! ACTIVATE AFTER MIGRATION !!! $checkGmtdatetimeIsValid = strtotime($jbWarningtime); if ($checkGmtdatetimeIsValid == "" || !is_int($checkGmtdatetimeIsValid)): $err[] = array("114", getLngt("Die späteste Erledigungszeit wurde nicht erwartungsgemäß übergeben.")); $acceptOrder = false; endif; endif; $crSid = convertSpecial($orderArray["xml"]["order"]["courier"]); $crIdOrder = ""; if ($crSid != "") : $crIdOrder = getFieldValueFromId("couriervehicle","crvh_sid",$crSid,"cr_id"); if ($crIdOrder == "") : $crSid = ""; endif; endif; $jbCrFilter = convertSpecial($orderArray["xml"]["order"]["filter"]); $jbRemark = convertSpecial($orderArray["xml"]["order"]["remark"]); $parJbRemarkMode = getObjectBasedParameterValue("STATION_REQUEST_JB_REMARK_MODE", $csId, $hqId); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if ($parJbRemarkMode == "1") : // Overrule invoice text with customer date and daytime $jbRemark = ""; // <= !!!!!!!!!!!! HERE !!!!!!!!!!!!!!!!!!! endif; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $jbCrRemark = convertSpecial($orderArray["xml"]["order"]["courier_remark"]); // Check for existing job for the customer for the specified day in "ordertime" $jbIdCurrent = ""; if ($acceptOrder) : $jbIdCurrent = getOneStmt("SELECT jb.jb_id AS jb_id FROM job AS jb, costcenter AS csc, genericdatacontainer AS gdc WHERE LEFT(jb.jb_ordertime,10) = '" . substr($jbOrdertime,0,10) . "' AND jb." . $jbRelevantCostcenterField . " = csc.csc_id AND csc.cs_id = '" . $csId . "' AND gdc.gdc_obj_id = jb.jb_id AND gdc.gdc_obj_type = 'jb' AND gdc.gdc_gen_fieldname = 'station_request'", "jb_id"); endif; if ($operationMode == "UPD" || $operationMode == "UPDATE" || $operationMode == "DEL" || $operationMode == "DELETE") : $checkOperationForJbStatus = true; $tmpCheckJbStatus = getParameterValue("0", "STATION_REQUEST_CHECK_OPERATION_JOB_STATUS_DISABLED", $hqId); if ($tmpCheckJbStatus == "1") : $checkOperationForJbStatus = false; endif; if ($checkOperationForJbStatus) : if ($jbIdCurrent != "") : $jbStatusCurrent = getFieldValueFromId("job","jb_id",$jbIdCurrent,"jb_status"); if ($jbStatusCurrent != "0" && $jbStatusCurrent != "9") : $err[] = array("118", getLngt("Die angeforderte Operation wird zurückgewiesen, weil sich der Auftrag in Bearbeitung befindet oder erledigt ist.")); $acceptOrder = false; endif; endif; endif; endif; // Special informations inserted into GDC structure $jbGdcArray = array(); $numOfGdcEntries = count($orderArray["xml"]["order"]["gdc"]["val"]); if ($numOfGdcEntries > 0) : for ($k = 0; $k < $numOfGdcEntries; $k++) : if ($numOfGdcEntries == 1) : $jbGdcArray[0] = convertSpecial($orderArray["xml"]["order"]["gdc"]["val"]); else : $jbGdcArray[$k] = convertSpecial($orderArray["xml"]["order"]["gdc"]["val"][$k]); endif; endfor; endif; // Init $jbTourdata = ""; $jbTourdataZipcode = ""; $jbTourdataCity = ""; $jbTourdataCountry = ""; // "TOUR" data $numOfStations = count($orderArray["xml"]["order"]["stations"]["station"]); if ($debug) : echo "numOfStations: " . $numOfStations . "

"; endif; if ($numOfStations > 0) : // Station arrays $trWareFromTo = array(); $trCommissionNo = array(); $trCostcenter = array(); $trCompany = array(); $trCompany2 = array(); $trScanCodeMandatory = array(); $trDeliveryOutcomeMode = array(); $trDeliveryOutcomeStates = array(); $trStreet = array(); $trHouseno = array(); $trFloor = array(); $trZipcode = array(); $trCity = array(); $trAdId = array(); $trSpecialRemark = array(); $trPerson = array(); $trPhone = array(); $trEmail = array(); $trAdSupplement_1 = array(); $trAdSupplement_2 = array(); $trAdSupplement_3 = array(); $trAdSupplement_4 = array(); $trAdSupplement_5 = array(); $trInvCompany = array(); $trInvCompany2 = array(); $trInvStreet = array(); $trInvHouseno = array(); $trInvFloor = array(); $trInvZipcode = array(); $trInvCity = array(); $trInvAdId = array(); $trInvSpecialRemark = array(); $trInvPerson = array(); $trInvPhone = array(); $trInvEmail = array(); $trInvAdSupplement_1 = array(); $trInvAdSupplement_2 = array(); $trInvAdSupplement_3 = array(); $trInvAdSupplement_4 = array(); $trInvAdSupplement_5 = array(); $trInvPaymentMethod = array(); $trInvVoucher = array(); $trInvpartialPayment = array(); $trInvPriceMode = array(); $trGdcArray = array(); // Station services $trServices = array(); $trTimeslots = array(); $trTimesunits = array(); $trShipmentMode = array(); $trOrderType = array(); $trDeliveryInfo = array(); $trFlagServiceDoc = array(); $trDocumentsURL = array(); // Arrays for summarized article fields OR maximum values $trSumWeight = array(); $trSumPositions = array(); $trSumPieces = array(); $trSumPrices = array(); $trSumVolume = array(); $trMaxHeight = array(); $trMaxLength = array(); $trMaxWidth = array(); $trMaxDimension = array(); $trSumHoursEstimated = array(); // for ($i = 0; $i < $numOfStations; $i++) : // First station has to be empty for ($i = 1; $i < $numOfStations; $i++) : $trSort = $i + 1; $trWareFromTo[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["ware_from_to"]); $trCommissionNo[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["commission_no"]); $trCostcenter[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["costcenter"]); $trCscId[$i] = ""; if ($trCostcenter[$i] != "") : $trCscId[$i] = getFieldValueFromClause("costcenter","csc_id","cs_id = '" . $csId . "' AND csc_name = '" . $trCostcenter[$i] . "'"); endif; $debugOut .= "trCostcenter[$i]: " . $trCostcenter[$i] . "
\n"; $debugOut .= "trCscId[$i]: " . $trCscId[$i] . "
\n"; $debugOut .= "
\n"; // Mandatory scan (bar)code $trScanCodeMandatory[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["scan_code_mandatory"]); // Delivery outcome $trDeliveryOutcomeMode[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["delivery_outcome_mode"]); $trDeliveryOutcomeStates[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["delivery_outcome_states"]); // Invoice address $trInvCompany[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["company"]); $trInvCompany2[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["company2"]); $trInvStreet[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["street"]); $trInvHouseno[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["houseno"]); $trInvZipcode[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["zipcode"]); $trInvCity[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["city"]); $trInvSpecialRemark[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["special_remark"]); $trInvPerson[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["person"]); $trInvPhone[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["phone"]); $trInvEmail[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["email"]); $trInvAdSupplement_1[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["ad_supplement_1"]); $trInvAdSupplement_2[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["ad_supplement_2"]); $trInvAdSupplement_3[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["ad_supplement_3"]); $trInvAdSupplement_4[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["ad_supplement_4"]); $trInvAdSupplement_5[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["ad_supplement_5"]); $debugOut .= "INVOICE ADDRESS BY XML-TAGS
\n"; $debugOut .= "trInvCompany[$i]: " . $trInvCompany[$i] . "
\n"; $debugOut .= "trInvCompany2[$i]: " . $trInvCompany2[$i] . "
\n"; $debugOut .= "trInvAdId[$i]: " . $trInvAdId[$i] . "
\n"; $debugOut .= "trInvStreet[$i]: " . $trInvStreet[$i] . "
\n"; $debugOut .= "trInvHouseno[$i]: " . $trInvHouseno[$i] . "
\n"; $debugOut .= "trInvFloor[$i]: " . $trInvFloor[$i] . "
\n"; $debugOut .= "trInvZipcode[$i]: " . $trInvZipcode[$i] . "
\n"; $debugOut .= "trInvCity[$i]: " . $trInvCity[$i] . "
\n"; $debugOut .= "trInvSpecialRemark[$i]: " . $trInvSpecialRemark[$i] . "
\n"; $debugOut .= "trInvPerson[$i]: " . $trInvPerson[$i] . "
\n"; $debugOut .= "trInvPhone[$i]: " . $trInvPhone[$i] . "
\n"; $debugOut .= "trInvEmail[$i]: " . $trInvEmail[$i] . "
\n"; $debugOut .= "trInvAdSupplement_1[$i]: " . $trInvAdSupplement_1[$i] . "
\n"; $debugOut .= "trInvAdSupplement_2[$i]: " . $trInvAdSupplement_2[$i] . "
\n"; $debugOut .= "trInvAdSupplement_3[$i]: " . $trInvAdSupplement_3[$i] . "
\n"; $debugOut .= "trInvAdSupplement_4[$i]: " . $trInvAdSupplement_4[$i] . "
\n"; $debugOut .= "trInvAdSupplement_5[$i]: " . $trInvAdSupplement_5[$i] . "
\n"; $debugOut .= "
\n"; $trInvAdId[$i] = ""; if ($trInvStreet[$i] != "" && $trInvZipcode[$i] != "" && $trInvCity[$i] != "") : $sqlStmt = "SELECT ad_id FROM address WHERE ad_street = '" . $trInvStreet[$i] . "' AND ad_zipcode = '" . $trInvZipcode[$i] . "' AND ad_city = '" . $trInvCity[$i] . "' AND ad_country = 'DE'"; $trInvAdId[$i] = $db->getOne($sqlStmt); if (DB::isError($ad_id)) die ("$PHP_SELF:
$sqlStmt
" . $ad_id->getMessage()); if ($trInvAdId[$i] == ""): insertStmt("address", array("ad_street", $trInvStreet[$i], "ad_zipcode", $trInvZipcode[$i], "ad_city", $trInvCity[$i], "ad_country", "DE")); $trInvAdId[$i] = getLastInsertID(); endif; // $tmpArray = insertAddress($trInvStreet[$i], $trInvZipcode[$i], $trInvCity[$i], "", "DE", true); // $trAdId[$i] = $tmpArray[0]; endif; if ($trCscId[$i] != "" && $trCscId[$i] != "0") : $debugOut .= "trCostcenter[$i] does exist: YES

\n"; // Delivery address $trCompany[$i] = getFieldValueFromClause("costcenteraddress","cscad_comp","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $trCompany2[$i] = getFieldValueFromClause("costcenteraddress","cscad_comp2","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $trAdId[$i] = getFieldValueFromClause("costcenteraddress","ad_id","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $trStreet[$i] = getFieldValueFromId("address","ad_id",$trAdId[$i],"ad_street"); $trHouseno[$i] = getFieldValueFromClause("costcenteraddress","cscad_hsno","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $trFloor[$i] = getFieldValueFromClause("costcenteraddress","cscad_floor","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $trZipcode[$i] = getFieldValueFromId("address","ad_id",$trAdId[$i],"ad_zipcode"); $trCity[$i] = getFieldValueFromId("address","ad_id",$trAdId[$i],"ad_city"); $trSpecialRemark[$i] = getFieldValueFromClause("costcenteraddress","cscad_remark","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $trPerson[$i] = getFieldValueFromClause("costcenteraddress","cscad_person","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $trPhone[$i] = getFieldValueFromClause("costcenteraddress","cscad_phone","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $trEmail[$i] = getFieldValueFromClause("costcenteraddress","cscad_email","adt_id = '4' AND csc_id = '" . $trCscId[$i] . "'"); $tmpAddressSupplement = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'csc' AND gdc_gen_fieldname = 'ad_supplement' AND gdc_context = '" . $trSort . "' AND gdc_obj_id = '" . $trCscId[$i] . "'"); $tmpAddressSupplement = str_replace("|", "-,-", $tmpAddressSupplement); $tmpAddressSupplementArray = spliti("-,-",$tmpAddressSupplement); $trAdSupplement_1[$i] = $tmpAddressSupplementArray[0]; $trAdSupplement_2[$i] = $tmpAddressSupplementArray[1]; $trAdSupplement_3[$i] = $tmpAddressSupplementArray[2]; $trAdSupplement_4[$i] = $tmpAddressSupplementArray[3]; $trAdSupplement_5[$i] = $tmpAddressSupplementArray[4]; $debugOut .= "PICKUP/DELIVERY ADDRESS BY EXISTING COSTCENTER
\n"; $debugOut .= "trCompany[$i]: " . $trCompany[$i] . "
\n"; $debugOut .= "trCompany2[$i]: " . $trCompany2[$i] . "
\n"; $debugOut .= "trAdId[$i]: " . $trAdId[$i] . "
\n"; $debugOut .= "trStreet[$i]: " . $trStreet[$i] . "
\n"; $debugOut .= "trHouseno[$i]: " . $trHouseno[$i] . "
\n"; $debugOut .= "trFloor[$i]: " . $trFloor[$i] . "
\n"; $debugOut .= "trZipcode[$i]: " . $trZipcode[$i] . "
\n"; $debugOut .= "trCity[$i]: " . $trCity[$i] . "
\n"; $debugOut .= "trSpecialRemark[$i]: " . $trSpecialRemark[$i] . "
\n"; $debugOut .= "trPerson[$i]: " . $trPerson[$i] . "
\n"; $debugOut .= "trPhone[$i]: " . $trPhone[$i] . "
\n"; $debugOut .= "trEmail[$i]: " . $trEmail[$i] . "
\n"; $debugOut .= "trAdSupplement_1[$i]: " . $trAdSupplement_1[$i] . "
\n"; $debugOut .= "trAdSupplement_2[$i]: " . $trAdSupplement_2[$i] . "
\n"; $debugOut .= "trAdSupplement_3[$i]: " . $trAdSupplement_3[$i] . "
\n"; $debugOut .= "trAdSupplement_4[$i]: " . $trAdSupplement_4[$i] . "
\n"; $debugOut .= "trAdSupplement_5[$i]: " . $trAdSupplement_5[$i] . "
\n"; $debugOut .= "
\n"; // Invoice address if ($trInvAdId[$i] == "") : $trInvCompany[$i] = getFieldValueFromClause("costcenteraddress","cscad_comp","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $trInvCompany2[$i] = getFieldValueFromClause("costcenteraddress","cscad_comp2","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $trInvAdId[$i] = getFieldValueFromClause("costcenteraddress","ad_id","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $trInvStreet[$i] = getFieldValueFromId("address","ad_id",$trInvAdId[$i],"ad_street"); $trInvHouseno[$i] = getFieldValueFromClause("costcenteraddress","cscad_hsno","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $trInvFloor[$i] = getFieldValueFromClause("costcenteraddress","cscad_floor","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $trInvZipcode[$i] = getFieldValueFromId("address","ad_id",$trInvAdId[$i],"ad_zipcode"); $trInvCity[$i] = getFieldValueFromId("address","ad_id",$trInvAdId[$i],"ad_city"); $trInvSpecialRemark[$i] = getFieldValueFromClause("costcenteraddress","cscad_remark","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $trInvPerson[$i] = getFieldValueFromClause("costcenteraddress","cscad_person","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $trInvPhone[$i] = getFieldValueFromClause("costcenteraddress","cscad_phone","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $trInvEmail[$i] = getFieldValueFromClause("costcenteraddress","cscad_email","adt_id = '2' AND csc_id = '" . $trCscId[$i] . "'"); $tmpInvAddressSupplement = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'csc' AND gdc_gen_fieldname = 'ad_inv_supplement' AND gdc_context = '" . $trSort . "' AND gdc_obj_id = '" . $trCscId[$i] . "'"); $tmpInvAddressSupplement = str_replace("|", "-,-", $tmpInvAddressSupplement); $tmpInvAddressSupplementArray = spliti("-,-",$tmpInvAddressSupplement); $trInvAdSupplement_1[$i] = $tmpInvAddressSupplementArray[0]; $trInvAdSupplement_2[$i] = $tmpInvAddressSupplementArray[1]; $trInvAdSupplement_3[$i] = $tmpInvAddressSupplementArray[2]; $trInvAdSupplement_4[$i] = $tmpInvAddressSupplementArray[3]; $trInvAdSupplement_5[$i] = $tmpInvAddressSupplementArray[4]; $debugOut .= "INVOICE ADDRESS BY EXISTING COSTCENTER
\n"; $debugOut .= "trInvCompany[$i]: " . $trInvCompany[$i] . "
\n"; $debugOut .= "trInvCompany2[$i]: " . $trInvCompany2[$i] . "
\n"; $debugOut .= "trInvAdId[$i]: " . $trInvAdId[$i] . "
\n"; $debugOut .= "trInvStreet[$i]: " . $trInvStreet[$i] . "
\n"; $debugOut .= "trInvHouseno[$i]: " . $trInvHouseno[$i] . "
\n"; $debugOut .= "trInvFloor[$i]: " . $trInvFloor[$i] . "
\n"; $debugOut .= "trInvZipcode[$i]: " . $trInvZipcode[$i] . "
\n"; $debugOut .= "trInvCity[$i]: " . $trInvCity[$i] . "
\n"; $debugOut .= "trInvSpecialRemark[$i]: " . $trInvSpecialRemark[$i] . "
\n"; $debugOut .= "trInvPerson[$i]: " . $trInvPerson[$i] . "
\n"; $debugOut .= "trInvPhone[$i]: " . $trInvPhone[$i] . "
\n"; $debugOut .= "trInvEmail[$i]: " . $trInvEmail[$i] . "
\n"; $debugOut .= "trInvAdSupplement_1[$i]: " . $trInvAdSupplement_1[$i] . "
\n"; $debugOut .= "trInvAdSupplement_2[$i]: " . $trInvAdSupplement_2[$i] . "
\n"; $debugOut .= "trInvAdSupplement_3[$i]: " . $trInvAdSupplement_3[$i] . "
\n"; $debugOut .= "trInvAdSupplement_4[$i]: " . $trInvAdSupplement_4[$i] . "
\n"; $debugOut .= "trInvAdSupplement_5[$i]: " . $trInvAdSupplement_5[$i] . "
\n"; $debugOut .= "
\n"; endif; else : $debugOut .= "trCostcenter[$i] does exist: NO

\n"; // Delivery address $trCompany[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["company"]); $trCompany2[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["company2"]); $trStreet[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["street"]); $trHouseno[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["houseno"]); $trFloor[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["floorno"]); $trZipcode[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["zipcode"]); $trCity[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["city"]); $trSpecialRemark[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["special_remark"]); $trPerson[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["person"]); $trPhone[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["phone"]); $trEmail[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["email"]); $trAdSupplement_1[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["ad_supplement_1"]); $trAdSupplement_2[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["ad_supplement_2"]); $trAdSupplement_3[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["ad_supplement_3"]); $trAdSupplement_4[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["ad_supplement_4"]); $trAdSupplement_5[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["ad_supplement_5"]); $trAdId[$i] = ""; if ($trStreet[$i] != "" && $trZipcode[$i] != "" && $trCity[$i] != "") : $sqlStmt = "SELECT ad_id FROM address WHERE ad_street = '" . $trStreet[$i] . "' AND ad_zipcode = '" . $trZipcode[$i] . "' AND ad_city = '" . $trCity[$i] . "' AND ad_country = 'DE'"; $trAdId[$i] = $db->getOne($sqlStmt); if (DB::isError($ad_id)) die ("$PHP_SELF:
$sqlStmt
" . $ad_id->getMessage()); if ($trAdId[$i] == ""): insertStmt("address", array("ad_street", $trStreet[$i], "ad_zipcode", $trZipcode[$i], "ad_city", $trCity[$i], "ad_country", "DE")); $trAdId[$i] = getLastInsertID(); endif; // $tmpArray = insertAddress($trStreet[$i], $trZipcode[$i], $trCity[$i], "", "DE", true); // $trAdId[$i] = $tmpArray[0]; endif; // Get "EXTERN" costcenter of the current headquarters if ($globalParUseRelatedCustomer != "1") : $trCscId[$i] = getParameterValue("0", "CSC_ID_PAYER_EXTERN", $hqId); endif; $debugOut .= "PICKUP/DELIVERY ADDRESS BY XML-TAGS
\n"; $debugOut .= "trCompany[$i]: " . $trCompany[$i] . "
\n"; $debugOut .= "trCompany2[$i]: " . $trCompany2[$i] . "
\n"; $debugOut .= "trAdId[$i]: " . $trAdId[$i] . "
\n"; $debugOut .= "trStreet[$i]: " . $trStreet[$i] . "
\n"; $debugOut .= "trHouseno[$i]: " . $trHouseno[$i] . "
\n"; $debugOut .= "trFloor[$i]: " . $trFloor[$i] . "
\n"; $debugOut .= "trZipcode[$i]: " . $trZipcode[$i] . "
\n"; $debugOut .= "trCity[$i]: " . $trCity[$i] . "
\n"; $debugOut .= "trSpecialRemark[$i]: " . $trSpecialRemark[$i] . "
\n"; $debugOut .= "trPerson[$i]: " . $trPerson[$i] . "
\n"; $debugOut .= "trPhone[$i]: " . $trPhone[$i] . "
\n"; $debugOut .= "trEmail[$i]: " . $trEmail[$i] . "
\n"; $debugOut .= "trAdSupplement_1[$i]: " . $trAdSupplement_1[$i] . "
\n"; $debugOut .= "trAdSupplement_2[$i]: " . $trAdSupplement_2[$i] . "
\n"; $debugOut .= "trAdSupplement_3[$i]: " . $trAdSupplement_3[$i] . "
\n"; $debugOut .= "trAdSupplement_4[$i]: " . $trAdSupplement_4[$i] . "
\n"; $debugOut .= "trAdSupplement_5[$i]: " . $trAdSupplement_5[$i] . "
\n"; $debugOut .= "
\n"; endif; // Invoice data // Presently store data into "tr_remark" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /* $trInvPaymentMethod[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["payment_method"]); // Payment method if ($trSpecialRemark[$i] != "") : $trSpecialRemark[$i] .= "
" . "------------------------"; endif; if ($trInvPaymentMethod[$i] != "") : $trSpecialRemark[$i] .= "
" . getLngt("Bezahlart") . ":" . $trInvPaymentMethod[$i]; endif; $trInvPriceMode[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["price_mode"]); // Price mode (e.g. "family card") if ($trInvPriceMode[$i] != "") : $trSpecialRemark[$i] .= "
" . getLngt("Spezialpreis") . ":" . $trInvPriceMode[$i]; endif; $trInvPartialPayment[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["partial_payment"]); // Partial payment if ($trInvPartialPayment[$i] != "") : $trSpecialRemark[$i] .= "
" . getLngt("Bereits bezahlt") . ":" . $trInvPartialPayment[$i]; endif; $trInvVoucher[$i] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["invoice"]["voucher_no"]); // Voucher if ($trInvVoucher[$i] != "") : $trSpecialRemark[$i] .= "
" . getLngt("Voucher") . ":" . $trInvVoucher[$i]; endif; // if ($trInvAdId[$i] == "") : $trInvAdId[$i] = $trAdId[$i]; endif; // No invoice address specified => take delivery address if ($trInvAdId[$i] != "") : $trSpecialRemark[$i] .= "
" . "------------------------"; if ($trInvCompany[$i] != "") : $trSpecialRemark[$i] .= "
" . $trInvCompany[$i] . "
" . $trInvCompany2[$i]; endif; $trSpecialRemark[$i] .= "
" . $trInvCompany[$i] . "
" . $trInvCompany2[$i]; $trSpecialRemark[$i] .= "
" . getLngt("Adresse") . ":" . "
" . $trInvStreet[$i] . " " . $trInvHouseno[$i] . "
" . $trInvZipcode[$i] . " " . $trInvCity[$i]; endif; if ($trInvPerson[$i] != "") : $trSpecialRemark[$i] .= "
" . $trInvPerson[$i]; endif; if ($trInvPhone[$i] != "") : $trSpecialRemark[$i] .= "
" . $trInvPhone[$i]; endif; if ($trInvEmail[$i] != "") : $trSpecialRemark[$i] .= "
" . $trInvEmail[$i]; endif; if ($trInvSpecialRemark[$i] != "") : $trSpecialRemark[$i] .= "
" . $trInvSpecialRemark[$i]; endif; */ // Articles $numOfArticles = 0; if ($orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["article"]["no"] != "" || $orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["article"]["description"] != "") : $numOfArticles = 1; else : $numOfArticles = count($orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["article"]); endif; // Mode of tour article service to be handled per station $tratModeArray = array(); // Init $tratModeTratSortArray = array(); // Init if ($numOfArticles > 0) : for ($j = 0; $j < $numOfArticles; $j++) : if ($numOfArticles == 1) : $trArticleArray[$i][0] = $orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["article"]; else : $trArticleArray[$i][$j] = $orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["article"][$j]; endif; // if ($trSpecialRemark[$i] != "") : $trSpecialRemark[$i] .= "\n" . "------------------------"; endif; $trArticleArray[$i][$j]["mode"] = convertSpecial($trArticleArray[$i][$j]["mode"]); // $csAddedServiceReverseInfosArray1[$tmpValArray[$languageSelected]] = $csAddSrvKeysArray[$l]; // $csAddedServiceReverseInfosArray1["ADDITIONAL_INSTALL_SERVICE"] = 100; // $csAddedServiceReverseInfosArray2[$tmpValArray[$languageSelected]] = $tmpValArray[0]; // $csAddedServiceReverseInfosArray2["ADDITIONAL_INSTALL_SERVICE"] = "Montage aller Art/Montagezusatzkosten"; $tmpTratModeArray = spliti(",", $trArticleArray[$i][$j]["mode"]); // E.g. "FURNITURE_ASSEMBLY,ADDITIONAL_INSTALL_SERVICE,...." => array("FURNITURE_ASSEMBLY","ADDITIONAL_INSTALL_SERVICE",....) $tmpTratModeArrayLen = count($tmpTratModeArray); for ($t = 0; $t < $tmpTratModeArrayLen; $t++) : // if ($csAddedServiceReverseInfosArray1[$trArticleArray[$i][$j]["mode"]] != "") : if ($csAddedServiceReverseInfosArray1[$tmpTratModeArray[$t]] != "") : // array_push($tratModeArray, $csAddedServiceReverseInfosArray1[$trArticleArray[$i][$j]["mode"]]); array_push($tratModeArray, $csAddedServiceReverseInfosArray1[$tmpTratModeArray[$t]]); array_push($tratModeTratSortArray, ($j + 1)); // ($j + 1) equals content later stored in "trat_sort". Used to write string of corresponding "trat_id"s in GDC.gdc_contxt endif; endfor; /* if ($trArticleArray[$i][$j]["mode"] == "1") : $trSpecialRemark[$i] .= "\n" . getLngt("WARE RETOURE"); elseif ($trArticleArray[$i][$j]["mode"] == "2") : $trSpecialRemark[$i] .= "\n" . getLngt("WARE MONTIEREN"); elseif ($trArticleArray[$i][$j]["mode"] == "3") : $trSpecialRemark[$i] .= "\n" . getLngt("WARE DEMONTIEREN"); elseif ($trArticleArray[$i][$j]["mode"] == "4") : $trSpecialRemark[$i] .= "\n" . getLngt("WARE ENTSORGEN"); else : $trSpecialRemark[$i] .= "\n" . getLngt("WARE AUSLIEFERN"); endif; */ $trArticleArray[$i][$j]["no"] = convertSpecial($trArticleArray[$i][$j]["no"]); $trArticleArray[$i][$j]["serialno"] = convertSpecial($trArticleArray[$i][$j]["serialno"]); $trArticleArray[$i][$j]["description"] = convertSpecial($trArticleArray[$i][$j]["description"]); $trArticleArray[$i][$j]["quantity"] = convertSpecial($trArticleArray[$i][$j]["quantity"]); if ($trArticleArray[$i][$j]["quantity"] == "" || !is_numeric($trArticleArray[$i][$j]["quantity"])) : // Default quantity "= 1" $trArticleArray[$i][$j]["quantity"] = 1; endif; $trArticleArray[$i][$j]["price"] = convertNumSpecial($trArticleArray[$i][$j]["price"]); $trArticleArray[$i][$j]["articlegroup_no"] = convertSpecial($trArticleArray[$i][$j]["articlegroup_no"]); $trArticleArray[$i][$j]["weight"] = convertNumSpecial($trArticleArray[$i][$j]["weight"]); $trArticleArray[$i][$j]["positions"] = convertNumSpecial($trArticleArray[$i][$j]["positions"]); $trArticleArray[$i][$j]["pieces"] = convertNumSpecial($trArticleArray[$i][$j]["pieces"]); if ($trArticleArray[$i][$j]["pieces"] == "" || !is_numeric($trArticleArray[$i][$j]["pieces"])) : // Default number of pieces "= 1" $trArticleArray[$i][$j]["pieces"] = 1; $trArticleArray[$i][$j]["pieces"] = "1"; endif; $trArticleArray[$i][$j]["length"] = convertNumSpecial($trArticleArray[$i][$j]["length"]); $trArticleArray[$i][$j]["width"] = convertNumSpecial($trArticleArray[$i][$j]["width"]); $$trArticleArray[$i][$j]["height"] = convertNumSpecial($trArticleArray[$i][$j]["height"]); if ($trArticleArray[$i][$j]["length"] != "" || $trArticleArray[$i][$j]["width"] != "" || $$trArticleArray[$i][$j]["height"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("LxBxH") . ": " . $trArticleArray[$i][$j]["length"] . "x" . $trArticleArray[$i][$j]["width"] . "x" . $$trArticleArray[$i][$j]["height"]; endif; $trArticleArray[$i][$j]["volume"] = convertNumSpecial($trArticleArray[$i][$j]["volume"]); // Try to get an existing article ID from table "article" $tmpAtId = getFieldValueFromId("article", "at_name", $trArticleArray[$i][$j]["no"], "at_id"); // Store data into "tr_remark" /* if ($trArticleArray[$i][$j]["no"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("NR.") . ": " . $trArticleArray[$i][$j]["no"]; endif; if ($trArticleArray[$i][$j]["serialno"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("SN") . ": " . $trArticleArray[$i][$j]["serialno"]; endif; if ($trArticleArray[$i][$j]["description"] != "") : $trSpecialRemark[$i] .= "\n" . $trArticleArray[$i][$j]["description"]; endif; if ($trArticleArray[$i][$j]["quantity"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("STK.") . ": " . $trArticleArray[$i][$j]["quantity"]; endif; if ($trArticleArray[$i][$j]["price"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("PREIS") . ": " . $trArticleArray[$i][$j]["price"]; endif; if ($trArticleArray[$i][$j]["articlegroup_no"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("WGRP") . ": " . $trArticleArray[$i][$j]["articlegroup_no"]; endif; if ($trArticleArray[$i][$j]["weight"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("GEWICHT") . ": " . $trArticleArray[$i][$j]["weight"]; endif; if ($trArticleArray[$i][$j]["positions"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("STELLPL.") . ": " . $trArticleArray[$i][$j]["positions"]; endif; if ($trArticleArray[$i][$j]["pieces"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("PACKSTK.") . ": " . $trArticleArray[$i][$j]["pieces"]; endif; if ($trArticleArray[$i][$j]["volume"] != "") : $trSpecialRemark[$i] .= "\n" . getLngt("VOLUMEN") . ": " . $trArticleArray[$i][$j]["volume"]; endif; */ // * Cumulated fields * // Weight if ($trSumWeight[$i] == "") : $trSumWeight[$i] = 0; endif; if ($trArticleArray[$i][$j]["weight"] != "" && is_numeric($trArticleArray[$i][$j]["weight"])) : $trSumWeight[$i] += ($trArticleArray[$i][$j]["quantity"] * $trArticleArray[$i][$j]["weight"]); endif; // Positions if ($trSumPositions[$i] == "") : $trSumPositions[$i] = 0; endif; if ($trArticleArray[$i][$j]["positions"] != "" && is_numeric($trArticleArray[$i][$j]["positions"])) : $trSumPositions[$i] += $trArticleArray[$i][$j]["positions"]; endif; // Pieces if ($trSumPieces[$i] == "") : $trSumPieces[$i] = 0; endif; if ($trArticleArray[$i][$j]["pieces"] != "" && is_numeric($trArticleArray[$i][$j]["pieces"])) : $trSumPieces[$i] += $trArticleArray[$i][$j]["pieces"]; endif; // Volume if ($trSumVolume[$i] == "") : $trSumVolume[$i] = 0; endif; if ($trArticleArray[$i][$j]["volume"] != "" && is_numeric($trArticleArray[$i][$j]["volume"])) : $trSumVolume[$i] += $trArticleArray[$i][$j]["volume"]; endif; // Total price if ($trSumPrices[$i] == "") : $trSumPrices[$i] = 0; endif; if ($tmpAtId != "" && ($trArticleArray[$i][$j]["price"] == "" || !is_numeric($trArticleArray[$i][$j]["price"]))) : // Try to get price from "articleprice" for this article // Check for special customer price ($trInvPriceMode[$i] <=> "mt_sort" ("disposition_mode")) $trArticleArray[$i][$j]["price"] = getArticleServiceValues($tmpAtId, $currentTime, "", $csId, $trInvPriceMode[$i], 0); // Check for article SPECIAL price of the SPECIAL customer if ($trArticleArray[$i][$j]["price"] == "" && $csGroupId == "" && $csGroupName == "") : $trArticleArray[$i][$j]["price"] = getArticleServiceValues($tmpAtId, $currentTime, $csGroupId, "", $trInvPriceMode[$i], 0); // Check for article SPECIAL group price endif; if ($trArticleArray[$i][$j]["price"] == "") : $trArticleArray[$i][$j]["price"] = getArticleServiceValues($tmpAtId, $currentTime, "", $csId, "", 0); // Check for article STANDARD price of the SPECIAL customer endif; if ($trArticleArray[$i][$j]["price"] == "" && $csGroupId == "" && $csGroupName == "") : $trArticleArray[$i][$j]["price"] = getArticleServiceValues($tmpAtId, $currentTime, $csGroupId, "", $csId, "", 0); // Check for article STANDARD group price endif; endif; if ($trArticleArray[$i][$j]["price"] != "" && is_numeric($trArticleArray[$i][$j]["price"])) : $trSumPrices[$i] += ($trArticleArray[$i][$j]["quantity"] * $trArticleArray[$i][$j]["price"]); endif; // Maximum of height if ($trMaxHeight[$i] == "") : $trMaxHeight[$i] = 0; endif; if ($$trArticleArray[$i][$j]["height"] != "" && is_numeric($$trArticleArray[$i][$j]["height"])) : $trMaxHeight[$i] = max($trMaxHeight[$i], $$trArticleArray[$i][$j]["height"]); endif; // Maximum of length if ($trMaxLength[$i] == "") : $trMaxLength[$i] = 0; endif; if ($trArticleArray[$i][$j]["length"] != "" && is_numeric($trArticleArray[$i][$j]["length"])) : $trMaxLength[$i] = max($trMaxLength[$i], $trArticleArray[$i][$j]["length"]); endif; // Maximum of width if ($trMaxWidth[$i] == "") : $trMaxWidth[$i] = 0; endif; if ($trArticleArray[$i][$j]["width"] != "" && is_numeric($trArticleArray[$i][$j]["width"])) : $trMaxWidth[$i] = max($trMaxWidth[$i], $trArticleArray[$i][$j]["width"]); endif; // Maximum of any dimension if ($trMaxDimension[$i] == "") : $trMaxDimension[$i] = 0; endif; $trMaxDimension[$i] = max($trMaxHeight[$i], $trMaxLength[$i], $trMaxWidth[$i]); // Hours estimated if ($trSumHoursEstimated[$i] == "") : $trSumHoursEstimated[$i] = 0; endif; if ($trArticleArray[$i][$j]["hours_estimated"] != "" && is_numeric($trArticleArray[$i][$j]["hours_estimated"])) : $trSumHoursEstimated[$i] += $trArticleArray[$i][$j]["hours_estimated"]; endif; endfor; endif; // If ARTICLE TOTAL VALUES are sent within the request overwrite existing conputed values $tmpTotalWeight = convertNumSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["total_weight"]); if ($tmpTotalWeight != "" && is_numeric($tmpTotalWeight) && $tmpTotalWeight > 0) : $trSumWeight = $tmpTotalWeight; endif; $tmpTotalPieces = convertNumSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["total_pieces"]); if ($tmpTotalPieces != "" && is_numeric($tmpTotalPieces) && $tmpTotalPieces > 0) : $trSumPieces = $tmpTotalPieces; endif; $tmpTotalVolume = convertNumSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["total_volume"]); if ($tmpTotalVolume != "" && is_numeric($tmpTotalVolume) && $tmpTotalVolume > 0) : $trSumVolume = $tmpTotalVolume; endif; $tmpTotalMeters = convertNumSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["total_meter"]); // if ($tmpTotalMeters != "" && is_numeric($tmpTotalMeters) && $tmpTotalMeters > 0) : $trSumMeters = $tmpTotalMeters; // endif; $tmpTotalMetersDeassembly = convertNumSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["total_meter_deassembly"]); // if ($tmpTotalMetersDeassembly != "" && is_numeric($tmpTotalMetersDeassembly) && $tmpTotalMetersDeassembly > 0) : $trSumMetersDeassembly = $tmpTotalMetersDeassembly; // endif; $tmpTotalHoursEstimated = convertNumSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["articles"]["total_hours_estimated"]); if ($tmpTotalHoursEstimated != "" && is_numeric($tmpTotalHoursEstimated) && $tmpTotalHoursEstimated > 0) : $trSumHoursEstimated[$i] = $tmpTotalHoursEstimated; endif; // Station services $trServices[$i] = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]; $trTimeslots[$i] = $trServices[$i]["timeslots"]; $trTimesunits[$i] = $trServices[$i]["timeunits"]; $trShipmentMode[$i] = $trServices[$i]["shipment_mode"]; $trOrderType[$i] = $trServices[$i]["order_type"]; $trDeliveryInfo[$i] = $trServices[$i]["delivery_info"]; $trFlagServiceDoc[$i] = $trServices[$i]["flag_service_doc"]; $trDocumentsURL[$i] = $trServices[$i]["documents_URL"]; // Write some service infos into "tr_remark" // if ($trTimeslots[$i] != "") : $trSpecialRemark[$i] .= "\nTageszeit: " . $trTimeslots[$i] . "\n----------"; endif; if ($trOrderType[$i] != "") : $trSpecialRemark[$i] .= "\nOrder-Typ: " . $trOrderType[$i] . "\n----------"; endif; if ($trDeliveryInfo[$i] != "") : $trSpecialRemark[$i] .= "\nAuslieferinformationen: " . $trDeliveryInfo[$i] . "\n----------"; endif; if ($trFlagServiceDoc[$i] == "1") : $trSpecialRemark[$i] .= "\nINSTRUKTIONEN EXISTIEREN! " . "\n----------"; endif; if ($trDocumentsURL[$i] != "") : $trSpecialRemark[$i] .= "\nOrder-Typ: " . $trDocumentsURL[$i] . "\n----------"; endif; $debugOut .= "STATION SERVICES
\n"; $debugOut .= "trTimeslots[$i]: " . $trTimeslots[$i] . "
\n"; $debugOut .= "trTimesunits[$i]: " . $trTimesunits[$i] . "
\n"; $debugOut .= "trShipmentMode[$i]: " . $trShipmentMode[$i] . "
\n"; $debugOut .= "trOrderType[$i]: " . $trOrderType[$i] . "
\n"; $debugOut .= "trDeliveryInfo[$i]: " . $trDeliveryInfo[$i] . "
\n"; $debugOut .= "trFlagServiceDoc[$i]: " . $trFlagServiceDoc[$i] . "
\n"; $debugOut .= "trDocumentsURL[$i]: " . $trDocumentsURL[$i] . "
\n"; $debugOut .= "
\n"; // Calculator prices per functions $numOfCalcFunctions = count($orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"]); if ($numOfCalcFunctions > 0) : for ($j = 0; $j < $numOfCalcFunctions; $j++) : $trCalcFunctionsArray[$i][$j] = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"][$j]; $trCalcFunctionsResultArray[$i][$j] = 0; $tmpFuncNo = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"][$j]["no"]; if ($tmpFuncNo != "" && is_numeric($tmpFuncNo)) : if (substr($tmpFuncNo, 0, 1) == "2") : $tmpFuncNo = "ident_" . substr($tmpFuncNo, 1); else : $tmpFuncNo = substr($tmpFuncNo, 1); endif; $tmpPar1 = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"][$j]["par_1"]; $tmpPar2 = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"][$j]["par_2"]; $tmpPar3 = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"][$j]["par_3"]; $tmpPar4 = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"][$j]["par_4"]; $tmpPar5 = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"][$j]["par_5"]; $tmpQuantity = $orderArray["xml"]["order"]["stations"]["station"][$i]["services"]["calculator"]["func_item"][$j]["quantity"]; if ($tmpQuantity == "" || !is_numeric($tmpQuantity)) : $tmpQuantity = 1; endif; $trCalcFunctionsResultArray[$i][$j] = getMtfFunctionResult($hqId, $csId, "20", $tmpFuncNo, $tmpPar1, $tmpPar2, $tmpPar3, $tmpPar4, $tmpPar5); if ($trCalcFunctionsResultArray[$i][$j] == "" || !is_numeric($trCalcFunctionsResultArray[$i][$j])) : $trCalcFunctionsResultArray[$i][$j] = 0; endif; $trCalcFunctionsResultArray[$i][$j] = $tmpQuantity * $trCalcFunctionsResultArray[$i][$j]; // Totalprice of the job $fixprice += $trCalcFunctionsResultArray[$i][$j]; endif; endfor; endif; // Special informations inserted into GDC structure $numOfGdcEntries = count($orderArray["xml"]["order"]["stations"]["station"][$i]["gdc"]["val"]); if ($numOfGdcEntries > 0) : for ($k = 0; $k < $numOfGdcEntries; $k++) : if ($numOfGdcEntries == 1) : $trGdcArray[$i][$k] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["gdc"]["val"]); else : $trGdcArray[$i][$k] = convertSpecial($orderArray["xml"]["order"]["stations"]["station"][$i]["gdc"]["val"][$k]); endif; endfor; endif; // Generation parts of the field "jb_tourdata" (e.g.: "04109;04316|Leipzig;Leipzig/Mölkau|DE;DE") /* if ($i > 0) : $jbTourdataZipcode .= ";"; $jbTourdataCity .= ";"; $jbTourdataCountry .= ";"; endif; $jbTourdataZipcode .= $trZipcode[$i]; $jbTourdataCity .= $trCity[$i]; $jbTourdataCountry .= "DE"; */ // Error handling /* if ($jbRemark == "" && $parJbRemarkMode == "") : if (!$errHandlerDisabled) : $err[] = array("117", getLngt("Es wurde kein Rechnungstext übergeben.")); $acceptOrder = false; endif; endif; */ if ($trAdId[$i] == "") : if ($operationMode != "DEL" && $operationMode != "DELETE") : $err[] = array("110", getLngt("Die Adressdaten sind nicht vollständig.")); $acceptOrder = false; endif; endif; endfor; // Generation of the field "jb_tourdata" (e.g.: "04109;04316|Leipzig;Leipzig/Mölkau|DE;DE") // $jbTourdata = $jbTourdataZipcode . "|" . $jbTourdataCity . "|" . $jbTourdataCountry; else : if ($operationMode != "DEL" && $operationMode != "DELETE") : $err[] = array("111", getLngt("Es konnten keine Stationen generiert werden.")); $acceptOrder = false; endif; endif; // Store into the database if ($debug) : echo "jbIdCurrent:" . $jbIdCurrent . "
"; echo "csEid:" . $csEid . "
"; echo "csId:" . $csId . "
"; echo "usrAccount:" . $usrAccount . "
"; echo "usrPassword:" . $usrPassword . "
"; echo "cscName:" . $cscName . "
"; echo "cscId:" . $cscId . "
"; echo "hqMnemonic:" . $hqMnemonic . "
"; echo "hqId:" . $hqId . "
"; echo "hqId_XML:" . $hqId_XML . "
"; echo "vhtId:" . $vhtId . "
"; echo "vhtType:" . $vhtType . "
"; echo "jbCrvhWeight:" . $jbCrvhWeight . "
"; echo "jbCrvhLength:" . $jbCrvhLength . "
"; echo "jbCrvhWidth:" . $jbCrvhWidth . "
"; echo "jbCrvhHeight:" . $jbCrvhHeight . "
"; echo "jbCrvhPosition:" . $jbCrvhPosition . "
"; echo "jbOrdertime:" . $jbOrdertime . "
"; echo "jbOrdertimeUTC:" . $jbOrdertimeUTC . "
"; echo "jbWarningtime:" . $jbWarningtime . "
"; echo "jbWarningtimeUTC:" . $jbWarningtimeUTC . "
"; echo "crSid:" . $crSid . "
"; echo "crIdOrder:" . $crIdOrder . "
"; echo "jbCrFilter:" . $jbCrFilter . "
"; echo "jbCrRemark:" . $jbCrRemark . "
"; echo "jbTourdata:" . $jbTourdata . "
"; echo "numOfStations:" . $numOfStations . "
"; for ($i = 0; $i < $numOfStations; $i++) : echo "
"; echo "* STATION " . $i . " * :
"; echo "DELIVERY:" . "
"; echo $trWareFromTo[$i] . "
"; echo $trCostcenter[$i] . "
"; echo $trCscId[$i] . "
"; echo $trCompany[$i] . "
"; echo $trCompany2[$i] . "
"; echo $trAdId[$i] . "
"; echo $trStreet[$i] . "
"; echo $trHouseno[$i] . "
"; echo $trFloor[$i] . "
"; echo $trZipcode[$i] . "
"; echo $trCity[$i] . "
"; echo $trSpecialRemark[$i] . "
"; echo $trPerson[$i] . "
"; echo $trPhone[$i] . "
"; echo $trEmail[$i] . "
"; echo "INVOICE:" . "
"; echo $trInvCompany[$i] . "
"; echo $trInvCompany2[$i] . "
"; echo $trInvAdId[$i] . "
"; echo $trInvStreet[$i] . "
"; echo $trInvHouseno[$i] . "
"; echo $trInvZipcode[$i] . "
"; echo $trInvCity[$i] . "
"; echo $trInvSpecialRemark[$i]. "
"; echo $trInvPerson[$i] . "
"; echo $trInvPhone[$i] . "
"; echo $trInvEmail[$i] . "
"; print_r($trServices[$i]); echo "
"; echo "trInvVoucher:" . $trInvVoucher[$i] . "
"; echo "trInvPaymentMethod:" . $trInvPaymentMethod[$i] . "
"; echo "trArticleArray:"; print_r($trArticleArray[$i]); echo "
"; print_r($trCalcFunctionsArray[$i]); echo "
"; print_r($trCalcFunctionsResultArray[$i]); echo "
"; endfor; echo "

ERR: "; print_r($err); echo "
"; echo "acceptOrder: " . $acceptOrder . "
"; endif; if (!$errHandlerDisabled) : $cscIdList = array(); if ($csId != "" && $csId > "0") : $sqlquery = "SELECT csc.csc_id FROM costcenter AS csc WHERE csc.cs_id = '" . $csId . "'"; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); while ($row = $result->fetch_assoc()): $cscIdList[] = $row["csc_id"]; endwhile; $result->free(); endif; if (count($cscIdList) > 0) : // Check for maximum number of jobs per day $numOfOrdersOfTheCurrentDay = getCountOfTable("job", "jb_modify >= '" . $currentDate . " 00:00:00' AND csc_id_payer IN (" . implode(",", $cscIdList) . ")"); if ($numOfOrdersOfTheCurrentDay == "" || (is_numeric($numOfOrdersOfTheCurrentDay) && $numOfOrdersOfTheCurrentDay > $maxNumOfStationsPerDay)) : $acceptOrder = false; $err[] = array("102", getLngt("Das Limit der Stationen pro Tag wurde überschritten. Derzeit sind dies") . " " . $maxNumOfStationsPerDay . " " . getLngt("Stationen")); endif; // Check for maximum number of running jobs $numOfRunningOrders = getCountOfTable("job", "jb_status != '2' AND csc_id_payer IN (" . implode(",", $cscIdList) . ")"); if ($numOfRunningOrders > $maxNumOfRunningStations) : $acceptOrder = false; $err[] = array("103", getLngt("Das Limit insgesamt laufender Stationen wurde überschritten. Derzeit sind dies") . " " . $maxNumOfRunningStations . " " . getLngt("Stationen")); endif; endif; endif; // Check existence of at least one error $errLen = count($err); if ($errLen == 0 && $acceptOrder) : // For UPDATE and DELETE identify station by specified commission no (of the specified day!) // $jbIdCurrent has to exist because an existing station has to belong to en existing order (no "tr" without "jb") $trIdCurrent = ""; if ($jbIdCurrent != "" && $commissionNo != "") : $trIdCurrent = getOneStmt("SELECT tr.tr_id AS tr_id FROM tour AS tr WHERE tr.tr_commission_no = '" . $commissionNo . "' AND tr.jb_id = '" . $jbIdCurrent . "'", "tr_id"); endif; // ********** // * UPDATE * // ********** if ($operationMode == "UPD" || $operationMode == "UPDATE") : if ($trIdCurrent != "" && is_numeric($trIdCurrent) && $trIdCurrent > "0") : // Update the identified station // ................................................... else : $acceptOrder = false; $err[] = array("105", getLngt("Es wurde keine Station für ein Update gefunden! Bitte Kommissionsnummer überprüfen!")); endif; endif; // ********** // * DELETE * // ********** $opCancellationExecuted = false; if ($operationMode == "DEL" || $operationMode == "DELETE" || $updateMode == "1") : if ($trIdCurrent != "" && is_numeric($trIdCurrent) && $trIdCurrent > "0") : // Delete the identified station // ................................................... else : $acceptOrder = false; $err[] = array("107", getLngt("Der Stornovorgang konnte nicht abgeschlossen werden, weil die Station nicht gefunden wurde!")); endif; endif; // ********** // * INSERT * // ********** if ($operationMode == "" || $operationMode == "INS" || $operationMode == "INSERT") : // Order TA("B"); // Init $jbIdNew = $jbIdCurrent; $trIdNewArray = array(); if ($jbIdNew == "") : insertStmt("job", array("hq_id", $hqId, "csc_id", $cscIdPayer, "vht_id", $vhtId, "csc_id_payer", $cscIdPayer, "csc_id_related", $cscIdRelated, "jb_payment", "0", "jb_ordertime", $jbOrdertime, "jb_reserv", $jbReserv, "cr_id", "", "cr_sid", $crSid, "cr_id_order", $crIdOrder, "jb_cr_filter", $jbCrFilter, "jb_cr_filter_opt", "", "jb_waitstorno", "0", "jb_taketime", "", "jb_status", $jbStatus, "jb_autoranking", "0", "jb_type", $jbType, "jb_incomplete", "0", "jb_globaljob", "0", "jb_tourname", $jbTourname, "jb_finishtime", "", "jb_warningtime", $jbWarningtime, "emp_id", $usr_id, "jb_fixprice", $fixprice, "jb_totalprice", $fixprice, "jb_postage", $cmpPostage, "jb_invmode", $csInvmode, "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", $jbTourdata, "jb_lockuser", "0", "jb_id_parent", $jbIdParent, "jb_dispoinfo", "", "jb_sales_tax_rate", $txValue, "jb_sales_tax_rate_sign", $txSign, "jb_createtime", $currentTime, "jb_timeunits", $jbTimeUnits, "jb_service", $jbService, "jb_booktime", "")); $jbIdNew = getLastInsertId(); if ($jbIdNew != "" && is_numeric($jbIdNew)) : $csAddress = getAddress($csId, "costcenteraddress"); $trStatusFrom = "0"; $trFinishtimeFrom = ""; // Insert pick up station during first iteration insertStmt("tour", array("jb_id", $jbIdNew, "ad_id", $csAddress["id"], "tr_sort", "1", "tr_comp", $csAddress["comp"], "tr_comp2", "", "tr_hsno", $csAddress["hsno"], "tr_floor", "", "csc_id", $cscIdPayer, "tr_status", $trStatusFrom, "tr_finishtime", $trFinishtimeFrom, "tr_commission_no", "", "tr_ware_from_to", "", "tr_person", "", "tr_phone", "", "tr_remark", "")); $trIdPickUpNew = getLastInsertID(); // Special informations inserted into GDC structure $numOfGdcEntries = count($jbGdcArray); if ($numOfGdcEntries > 0) : for ($k = 0; $k < $numOfGdcEntries; $k++) : if ($jbGdcArray[$k] != "") : insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jbIdNew, "gdc_gen_fieldname", "info_" . $k, "gdc_content", $jbGdcArray[$k], "gdc_context", "")); // Add ALL gdc_gen_fieldname = 'info_' to station remark if ($globalParUseRelatedCustomer == 1) : if ($trSpecialRemark[$tmpStation] != "") : $trSpecialRemark[$tmpStation] .= "\n" . "------------------------"; endif; $trSpecialRemark[$tmpStation] .= "\n" . $jbGdcArray[$k]; endif; endif; endfor; endif; // Write predicate for the job insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jbIdNew, "gdc_gen_fieldname", "station_request", "gdc_content", "1", "gdc_context", $csId)); $trSort = 1; else : $acceptOrder = false; $err[] = array("199", getLngt("Der Station konnte nicht eingefügt werden, weil die Anlage des Basisauftrags fehlschlug!")); endif; else : // Get last existing station no ("tr_sort") $trSort = getMaxOfField("tour", "tr_sort", "jb_id = '" . $jbIdNew . "'"); endif; // Stations if ($acceptOrder) : // for ($i = 0; $i < $numOfStations; $i++) : // First station has to be empty for ($i = 1; $i < $numOfStations; $i++) : $trSort++; // $trServicesArray[] = $trServices[$i]; // Services and prices for calling price function // Insert tour data for station insertStmt("tour", array("jb_id", $jbIdNew, "ad_id", $trAdId[$i], "tr_sort", $trSort, "tr_comp", $trCompany[$i], "tr_comp2", $trCompany2[$i], "tr_hsno", $trHouseno[$i], "tr_floor", $trFloor[$i], "csc_id", $trCscId[$i], "tr_status", "0", "tr_commission_no", $commissionNo, "tr_ware_from_to", $trWareFromTo[$i], "tr_person", $trPerson[$i], "tr_phone", $trPhone[$i], "tr_remark", $trSpecialRemark[$i])); $trIdNewArray[] = getLastInsertId(); // Insert tourservice data /* INSERTED BY FUNCTION mk_price() insertStmt("tourservice", array("jb_id", $jbIdNew, "csc_id", $trCscId[$i], "tr_sort", "0", "srv_id", "0", "trs_srv_name", "Fixpreis", "srvt_id", "0", "trs_srvt_name", "")); */ /* if ($globalParUseRelatedCustomer != 1) : $commissionNo = ""; // Reset commission number because associated to the first station only endif; */ // Special informations inserted into GDC structure $numOfGdcEntries = count($trGdcArray[$i]); if ($numOfGdcEntries > 0) : for ($k = 0; $k < $numOfGdcEntries; $k++) : if ($trGdcArray[$i][$k] != "") : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "info_" . $k, "gdc_content", $trGdcArray[$i][$k], "gdc_context", $jbIdNew . "," . $trSort)); endif; endfor; endif; // Mandatory scan (bar)code if ($trScanCodeMandatory[$i] != "") : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "scan_code_mandatory", "gdc_content", $trScanCodeMandatory[$i], "gdc_context", "")); endif; // Delivery outcome (mode and states) if ($trDeliveryOutcomeMode[$i] != "" && $trDeliveryOutcomeStates[$i] != "") : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "delivery_outcome", "gdc_content", $trDeliveryOutcomeStates[$i], "gdc_context", $trDeliveryOutcomeMode[$i])); endif; // Insert the station based order type into the GDC if ($trOrderType[$i] != "") : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "order_type", "gdc_content", $trOrderType[$i], "gdc_context", $jbIdNew)); endif; // Insert (or update existing) (invoice) address supplement entries in GDC $tmpAddressSupplement = $trAdSupplement_1[$i] . "|" . $trAdSupplement_2[$i] . "|" . $trAdSupplement_3[$i] . "|" . $trAdSupplement_4[$i] . "|" . $trAdSupplement_5[$i]; if ($tmpAddressSupplement != "||||") : if (existsEntry("genericdatacontainer",array("gdc_obj_type","jb","gdc_gen_fieldname","ad_supplement","gdc_obj_id",$jbIdNew,"gdc_context",$trSort))) : updateStmt("genericdatacontainer","gdc_obj_type","jb",array("gdc_content", $tmpAddressSupplement),"gdc_obj_id = '" . $jbIdNew . "' AND gdc_gen_fieldname = 'ad_supplement' AND gdc_context = '" . $trSort . "'"); else : insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jbIdNew, "gdc_gen_fieldname", "ad_supplement", "gdc_content", $tmpAddressSupplement, "gdc_context", $trSort)); endif; endif; $tmpInvAddressSupplement = $trInvAdSupplement_1[$i] . "|" . $trInvAdSupplement_2[$i] . "|" . $trInvAdSupplement_3[$i] . "|" . $trInvAdSupplement_4[$i] . "|" . $trInvAdSupplement_5[$i]; if ($tmpInvAddressSupplement != "||||") : if (existsEntry("genericdatacontainer",array("gdc_obj_type","jb","gdc_gen_fieldname","ad_inv_supplement","gdc_obj_id",$jbIdNew,"gdc_context",$trSort))) : updateStmt("genericdatacontainer","gdc_obj_type","jb",array("gdc_content", $tmpInvAddressSupplement),"gdc_obj_id = '" . $jbIdNew . "' AND gdc_gen_fieldname = 'ad_inv_supplement' AND gdc_context = '" . $trSort . "'"); else : insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jbIdNew, "gdc_gen_fieldname", "ad_inv_supplement", "gdc_content", $tmpInvAddressSupplement, "gdc_context", $trSort)); endif; endif; // Insert tourarticle data $numOfArticles = count($trArticleArray[$i]); if ($numOfArticles > 0) : for ($j = 0; $j < $numOfArticles; $j++) : $tratSort = $j + 1; insertStmt("tourarticle", array("jb_id", $jbIdNew, "tr_sort", $trSort, "trat_sort", $tratSort, "at_id", "", "trat_name", $trArticleArray[$i][$j]["no"], "trat_quantity", $trArticleArray[$i][$j]["quantity"], "trat_weight", ($trArticleArray[$i][$j]["weight"] * $trArticleArray[$i][$j]["quantity"]), "trat_price", $trArticleArray[$i][$j]["price"], "trat_packingpieces", $trArticleArray[$i][$j]["pieces"], "trat_serialno", $trArticleArray[$i][$j]["serialno"], "trat_remark", $trArticleArray[$i][$j]["description"], "trat_createtime", $currentTime)); endfor; // If total sum of tourarticle weight had been sent and overruled the computed sum value then store it in the GDC if ($trSumWeight != "" && is_numeric($trSumWeight) && $trSumWeight > 0 && $tmpTotalWeight != "" && is_numeric($tmpTotalWeight) && $tmpTotalWeight > 0) : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "trat_sum_weight", "gdc_content", $trSumWeight, "gdc_context", $trSort)); endif; // If total sum of tourarticle weight had been sent and overruled the computed sum value then store it in the GDC if ($trSumPieces != "" && is_numeric($trSumPieces) && $trSumPieces > 0 && $tmpTotalPieces != "" && is_numeric($tmpTotalPieces) && $tmpTotalPieces > 0) : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "trat_sum_pieces", "gdc_content", $trSumPieces, "gdc_context", $trSort)); endif; // If total sum of tourarticle weight had been sent and overruled the computed sum value then store it in the GDC if ($trSumVolume != "" && is_numeric($trSumVolume) && $trSumVolume > 0 && $tmpTotalVolume != "" && is_numeric($tmpTotalVolume) && $tmpTotalVolume > 0) : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "trat_sum_volume", "gdc_content", $trSumVolume, "gdc_context", $trSort)); endif; // If total sum of meters had been sent and overruled the computed sum value then store it in the GDC if ($trSumMeters != "" && is_numeric($trSumMeters) && $trSumMeters > 0 && $tmpTotalMeters != "" && is_numeric($tmpTotalMeters) && $tmpTotalMeters > 0) : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "trat_sum_meters", "gdc_content", $trSumMeters, "gdc_context", $trSort)); endif; // If total sum of deinstallation meters had been sent and overruled the computed sum value then store it in the GDC if ($trSumMetersDeassembly != "" && is_numeric($trSumMetersDeassembly) && $trSumMetersDeassembly > 0 && $tmpTotalMetersDeassembly != "" && is_numeric($tmpTotalMetersDeassembly) && $tmpTotalMetersDeassembly > 0) : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "trat_sum_meters_deassembly", "gdc_content", $trSumMetersDeassembly, "gdc_context", $trSort)); endif; // If total sum of estimated hours had been sent and overruled the computed sum value then store it in the GDC if ($trSumHoursEstimated[$i] != "" && is_numeric($trSumHoursEstimated[$i]) && $trSumHoursEstimated[$i] > 0) : insertStmt("genericdatacontainer", array("gdc_obj_type", "tr", "gdc_obj_id", $trIdNew, "gdc_gen_fieldname", "trat_sum_hours_estimated", "gdc_content", $trSumHoursEstimated[$i], "gdc_context", $trSort)); $jbTotalHoursEstimated += $trSumHoursEstimated[$i]; endif; endif; endfor; // Write tour article services for the job if (count($tratModeArray) > 0) : insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jbIdNew, "gdc_gen_fieldname", "jb_add_service_info", "gdc_content", implode(",",$tratModeArray), "gdc_context", "")); // Update gdc_context with corresponding "trat_id"s $tratModeTratSortArrayLen = count($tratModeTratSortArray); $tmpTratIdString = ""; for ($t = 0; $t < $tratModeTratSortArrayLen; $t++) : if ($tmpTratIdString != "") : $tmpTratIdString .= ","; endif; $tmpTratIdString .= getFieldValueFromClause("tourarticle","trat_id","jb_id = '" . $jbIdNew . "' AND trat_sort = '" . $tratModeTratSortArray[$t] . "'"); endfor; updateStmt("genericdatacontainer","gdc_obj_type","jb",array("gdc_context", $tmpTratIdString),"gdc_obj_type = 'jb' AND gdc_obj_id = '" . $jbIdNew . "' AND gdc_gen_fieldname = 'jb_add_service_info'"); endif; // Write EVENT "PLANNED" (presently for installation only) if (((int)$jbService & 2) == 2) : if ($trIdPickup != "" && $trIdPickup > 0) : insertStmt("phoenix_log.b2b_objects", array("bo_ver", "0", "bo_type", "300", "bo_state", "1", "bo_ext_id0", $jbIdNew, "bo_ext_id1", $trIdPickup, "bo_ext_id2", $usr_id, "bo_obj_data", $commissionNo . "|501", "bo_createtime", $currentTime)); endif; endif; // Write relation to new job after cancellation if ($opCancellationExecuted && $jbIdCancellation != "") : // Reference to cancelled job by update // if ($executeCancellationByEvent) : // Write reference to old copied job in jb_storno although previous job is NOT cancelled !!!! insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jbIdNew, "gdc_gen_fieldname", "jb_storno", "gdc_content", $jbIdCancellation, "gdc_context", "")); // endif; if ($updateMode == "1") : // Reference to new job after update insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jbIdCancellation, "gdc_gen_fieldname", "jb_update", "gdc_content", $jbIdNew, "gdc_context", "")); endif; endif; // Write estimated hours for the whole job if ($jbTotalHoursEstimated != "" && is_numeric($jbTotalHoursEstimated)) : if (existsEntry("genericdatacontainer",array("gdc_obj_type","jb","gdc_gen_fieldname","addmont","gdc_obj_id",$jbIdNew))) : updateStmt("genericdatacontainer","gdc_obj_type","jb",array("gdc_context", $jbTotalHoursEstimated),"gdc_obj_id = '" . $jbIdNew . "' AND gdc_gen_fieldname = 'addmont'"); else : insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jbIdNew, "gdc_gen_fieldname", "addmont", "gdc_content", "", "gdc_context", $jbTotalHoursEstimated)); endif; endif; // SET jb_freetext_1 // Get daytimes of the customer associated to the current vehicle $dayTimeSlots = metatypeGetMappedValues("day_time", "", $csId, "cs", "1"); $dayTimeSlotsLen = count($dayTimeSlots); $csDaytimeStart = substr($dayTimeSlots[0][0],0,5); $csDaytimeEnd = substr($dayTimeSlots[($dayTimeSlotsLen - 1)][1],0,5); // Endcustomer time window $tmpJbFreetext1 = substr($jbOrdertime,8,2) . "." . substr($jbOrdertime,5,2) . "." . substr($jbOrdertime,0,4) . " "; $tmpDaytime = "ganztägig"; if ($csDaytimeStart != "" && $csDaytimeEnd != "" && ($csDaytimeStart != substr($jbOrdertime,11,5) || $csDaytimeEnd != substr($jbWarningtime,11,5))) : $tmpDaytime = substr($jbOrdertime,11,5) . " - " . substr($jbWarningtime,11,5); endif; $tmpJbFreetext1 .= $tmpDaytime; updateStmt("job","jb_id",$jbIdNew,array("jb_freetext_1", $tmpJbFreetext1)); // Finish transaction here because all order data have been written TA("C"); TA("E"); // -------------------------------------------------------- // Call specific job function. All data transactions heve to be finished here !!!! // Preparation... $hq_id = $hqId; // Generate prices /* $makePrice = true; $parOrderRequestJobNoPrice = getParameterValue("0", "STATION_REQUEST_NO_PRICE_CS_" . $csId, "0"); if ($parOrderRequestJobNoPrice == "1") : $makePrice = false; endif; if ($makePrice) : mk_jb_price($jbIdNew); endif; */ // Generate invoice text if ($globalParUseRelatedCustomer == "1") : // ............. else : // mk_jb_invtext($jbIdNew, false); endif; // **** // Special patch because of "bug" in function "mk_jb_invtext()" if ($jbIdNew != "" && is_numeric($jbIdNew)) : updateStmt("job","jb_id",$jbIdNew,array("jb_tourdata",$jbTourdata)); endif; // **** writeToLogDB("102",$hq_id,$jbIdNew,$usr_id,"","",$csId,"B2B_IMPORT=1|MODE=STATION"); // Success! else : TA("R"); TA("E"); endif; // ($acceptOrder == true) endif; // Operation mode endif; else : // Authentication data not ok $err[] = array("101", getLngt("Die Authentifizierungsdaten sind nicht in Ordnung.")); endif; // print_r($err); // Check existence of at least one error $errLen = count($err); // echo "errLen: " . $errLen . "
"; // Output $outResponse .= ""; if ($errLen > 0) : stationRequestLogFile("ERRORS", 1); $outResponse .= "NOT OK"; $outResponse .= ""; for ($i = 0; $i < $errLen; $i++) : $outResponse .= ""; $outResponse .= "" . $err[$i][0] . ""; $outResponse .= ""; $outResponse .= ""; if ($debug) : $outResponse .= "" . $debugOut . ""; endif; stationRequestLogFile($err[$i][0] . " : " . mcEncode($err[$i][1]), 1); endfor; $outResponse .= ""; else : $trIdNewArrayLen = count($trIdNewArray); $xmlStations = ""; if ($trIdNewArrayLen > 0) : $xmlStations .= ""; for ($i = 0; $i < $trIdNewArrayLen; $i++) : $xmlStations .= "" . $trIdNewArray[$i] . ""; endfor; $xmlStations .= ""; endif; $outResponse .= "OK" . $jbIdNew . "" . $xmlStations . ""; if ($debug) : $outResponse .= "" . $debugOut . ""; endif; endif; $outResponse .= ""; // Log entries stationRequestLogFile($outResponse); // Write response into log stationRequestLogFile("___________________________________________________________________________________"); // Return output echo $outResponse; /* // ERROR CODES 100 : Commission number does still exit. Insert of new order not possible. 101 : Authentication Data not correct. 102 : Maximum limit of orders per day reached. Presently xxxx orders. 103 : Maximum limit of orders in progress reached. Presently xxxx orders. 104 : Customer data could not be inserted. 105 : No order number for update! 106 : No order number for cancellation or order number not found! 107 : Cancellation failed because order is canceled or is in progress! 108 : Zipcode did not match zone 109 : Zone error. 110 : Address data are not complete. 111 : Generation of stations failed. 112 : Datetime format not correct. 113 : Start time of the order is not correct. 114 : Latest finish time of the order is not correct. 115 : No vehicle available 116 : Start time has to be in the future 117 : No invoice text 118 : Order is in progress or finished // FELDER UND IHRE BEDEUTUNG // Fuhrauftrag // Identifikation des Kunden ... // Kundennummer (EID) {"STBxxxxxx", ...} => csc_id_payer ... // Eingetragener Benutzer für den Kunden => cs.cs_admin => emp.emp_id => emp.usr_id => usr.usr_id => usr.usr_account ... // Passwort für den Benutzer => usr.usr_password ... // Zusätzliche Session-ID, die mit dem Kunden ausgehandelt wurde [mandatory] ... // Kostenstellenname {"abcd", "efgh", ...} => Mapping csc_id [optional] ... // Nummer der Kundengruppe (Bei einer automatischen Preisfindung muss entweder oder gesetzt sein) ... // Name der Kundengruppe (Bei einer automatischen Preisfindung muss entweder oder gesetzt sein) ... // Operation (INS, UPD, DEL) ... // Activates debug output ("ON" or "YES") // Manuelle EVENTS [optional] [optional] [optional] ... ... // Order no of the customer => tr_commission_no ... // Type of the job => jb_type ... // {HB, HH, ...} => hq_mnemonic => hq_id // Angefordertes Fahrzeug ... // {1,2,3...} => Mapping "metatype" => vht_id (entweder oder ist mandatory) ... // {"bus", ...} => Mapping "metatype" => vht_id (entweder oder ist mandatory) ... // Gewicht des Transportguts ... // Angeforderte Mindestlänge des Fahrzeugs ... // Angeforderte Mindestbreite des Fahrzeugs ... // Angeforderte Mindesthöhe des Fahrzeugs ... // Angeforderte Mindestanzahl an Stellplätzen im Fahrzeug ... // Startzeit des Auftrags (wenn leer, dann "adhoc"-Auftrag mit aktuellem Zeitstempel) => jb_ordertime und jb_reserv ... // Startzeit des Auftrags in UTC (erst wird nach der Inhalt in geschaut, dann ich ) ... // Späteste Erledigungszeit des Auftrags (Bsp: 2014-10-22 09:00:00) // Späteste Erledigungszeit des Auftrags in UTC (erst wird nach der Inhalt in geschaut, dann ich ) ... // Erfassungszeit des Auftrags bei asynchroner Übertragung ... // {HH1000, HH1420, ...} Wunschfahrer => jb.cr_sid => Abgleich mit cr.cr_sid => cr.cr_id => jb.cr_id_order [optional] CK,DE,EN // Fahrzeug-Filter zur Einschränkung der Fahrzeugvermittlung (Aufstellung siehe Anhang) ... // Bemerkung zum Auftrag ... // Bemerkung zum Auftrag für den Fahrer // Zusätzliche Informationen pro Auftrag, die gesondert behandelt und bei Rückgaben herangezogen werden können [optional] [optional] [optional] ... // Stationen // Station 1 (Abholung) ... // Abholung [optional] {leer, 0 = weder Abholung noch Anlieferung, 1 = nur Abholung, 2 = nur Anlieferung, 3 = beides} ... // Kostenstellenname {"abcd", "efgh", ...} => Mapping csc_id [optional, wenn gesetzt, dann weitere Felder leer] ... // Firmenbezeichnung ... // Firmenzusatz ... // Straße ... // Hausnummer ... // PLZ ... // Ort ... // Bemerkung zur Station ... // Abgabe der Sendung bei ..., Ansprechpartner [optional] ... // Telefonnummer [optional] ... // Email [optional] // Rechnungsangaben (des belieferten Endkunden) ... // Kostenstellenname {"abcd", "efgh", ...} => Mapping csc_id [optional, wenn gesetzt, dann weitere Felder leer] ... // Firmenbezeichnung ... // Firmenzusatz ... // Straße ... // Hausnummer ... // Etage, Flur ... // PLZ ... // Ort ... // Bemerkung zur Station ... // Abgabe der Sendung bei ..., Ansprechpartner [optional] ... // Telefonnummer [optional] ... // Email [optional] ... // Belegnummer des Endkunden (Rechnungsnummer, Kassenbon) ... // Zahlungsart (leer oder 0 = Bar, 1 = EC–Pin, 2 = EC–Lastschrift, etc.) ... // Art des rabattierten Preises ("" = Standardpreis, 0 = Aktionpreis_1 (z.B. "family card"), 1 = Aktionspreis_2) ... // Bereits geleisteter Betrag (leer = 0 = keine Anzahlung/Bezahlung)
... // Modus (leer oder 0 = Auslieferung, 1 = Retoure, 2 = Montage, 3 = Demontage, 4 = Entsorgung (bei 2 und 3 mindestens Felder "description" und "quantity" gesetzt)) ... // Artikelnummer ... // Seriennummer (1) ... // Beschreibung ... // Menge ... // Stückpreis ... // Einzelgewicht eines Artikels ... // Länge eines Artikels ... // Breite eines Artikels ... // Höhe eines Artikels ... // Anzahl Packstücke (leer oder 0 = z.B. keine Lieferung und nur Montage, ansonsten Anzahl) ... // Stellplätze, Kolli ... // Warengruppe
...
// Preisestruktur(en) [optional] ... // Zeitintervalle für Belieferung bzw. Anfahrt (leer = keine Einschränkung, "0" = vormittags, "1" = nachmittags, "2" = abends, "1,2" = vormittags und abends, ..., "1,2,3 = ganztägig") ... // Anzahl Zeiteinheiten für Erfüllung des Auftrags (1 Zeiteinheit = 10 Minuten) ... // Versandart (bit-string) // 0 => 2^0 = 1 Lieferung (Delivery) // 1 => 2^1 = 2 Montage (Installation) // 2 => 2^2 = 4 Neumöbelmontage (Installation furniture) ("Installation" [2^1] also has to be set) // 3 => 2^3 = 8 Besichtigung (Viewing) // 4 => 2^4 = 16 Kücheninstallation (Installation kitchen) ("Installation" [2^1] also has to be set) // 5 => 2^5 = 32 Nachlieferung (Delivery supplementary) // 6 => 2^6 = 64 Reklamation (Complaint) // 7 => 2^7 = 128 Abholung (Return shipment, Retoure)) // 8 => 2^8 = 256 Austausch (Replacement) // 9 => 2^9 = 512 Aufmaß (Measurement) // (E.g.: Delivery = 1, Installation furniture = 6 (including "Installation"), // Installation kitchen = 18 (including "Installation"), // Retoure = 128, Delivery and Retoure = 129, Replacement = 256 // Delivery and Replacement = 257, ...) ... // Auftragsart(en) (Sameday = 0, Nextday = 1, Kurier = 2) // Calculatorpreise [optional] // Spezielle Zelle der Preis-/Leistungsmatrix ... // Leistungstyp ... // Preistyp ... // Preis [optional] => überschreibt den in der zelle eingetragenen Preis ... // Menge ... // Calculatorpreisfunktionen [optional] ... // Nummer der Funktion (Erläuterung siehe bitte unten) ... // Wert für Parameter Nr. 1 der Funktion ... // Wert für Parameter Nr. 2 der Funktion ... // Wert für Parameter Nr. 3 der Funktion ... // Wert für Parameter Nr. 4 der Funktion ... // Wert für Parameter Nr. 5 der Funktion ... // Menge (leer = 1 = default, ansonsten angegebene Anzahl) ... // Zusätzliche Informationen pro Station, die gesondert behandelt und bei Rückgaben herangezogen werden können <1>[optional] <2>[optional] <3>[optional] <4>[optional] <5>[optional]
// Station 2 ... // Abholung, Anlieferung, beides [optional] ... ... // Weitere Stationen
Calculatorpreisfunktionen: ... Nr. : Kontext Parameter (außer der Menge, die bei jeder Funktion optional übergeben werden kann) Menge (leer = 1 = default, ansonsten angegebene Anzahl) 10002 : Gestaffelter warenwertabhängiger Grundpreis für den Transport 10002 490 // Warenwert (Bsp. 490,- €) 10003 : Tagessatz für Lagerungskosten ab dem n. Tag 10003 14 // Anzahl Tage (bei 0 => keine Berechnung => keine Kosten für Endkunde) 1 10004 : Montagebetrag auf Basis des Prozentsatzes p% vom Warenwert 10004 288 // Warenwert 10010 : Preis pro Meter Küchenmontage 10010 5 // Angabe lfd. Meter 20005 : Elektroanschluss bei Küchenmontage 20005 1 20006 : Wasseranschluss bei Küchenmontage 20006 1 10005 : Expresslieferung nach Zonen 10005 22525 // PLZ 20001 : Zusätzliche Montagestunde 20001 2.25 20002 : Pauschale Nachmontage 20002 1.5 20003 : Monteurstunde bei Nachmontage 20003 3 10007 : Prozentsatzes p% des Lieferpreises beim Abholauftrag 10007 197 // Preis des Abholauftrags 1 10009 : Warengruppenabhängiger Preis für die Montage 10009 10 // Warengruppe 1 10006 : Warengruppenabhängiger Preis für die Altmöbelrücknahme 10006 15 // Warengruppe 1 10008 : Preis für Liefergewicht pro x kg höher als das Freigewicht 10008 350 // Gewicht in kg 1 20004 : Endkundenpreis für Einkaufsservice 20004 1 10011 : Verrechnungssatz pro Artikel in Prozent p% vom Verkaufspreis bei Verlust und Schäden 10011 350 // Warenwert 1 20007 : Hantierungshilfsmittel: Verrechnungssatz Euro-Palette 20007 3 20008 : Hantierungshilfsmittel: Verrechnungssatz IKEA-Palette 20008 3 1xxxx : Kosten für Transportverpackung(en) z.B. bei Kleinteilen 1xxxx 1 // PFLICHTFELDER UND OPTIONALE FELDER // Fuhrauftrag // Identifikation des Kunden [mandatory] // Kundennummer (EID) {"STBxxxxxx", ...} [mandatory] // Eingetragener Benutzer für den Kunden [mandatory] // Passwort für den Benutzer [mandatory] // Zusätzliche ausgehandelte Session-ID [optional] // Bekannte Kostenstelle [optional] // Nummer der Kundengruppe (Bei einer automatischen Preisfindung muss entweder oder gesetzt sein) [optional] // Name der Kundengruppe (Bei einer automatischen Preisfindung muss entweder oder gesetzt sein) [optional] // Operation (INS, UPD, DEL) [optional] // Activates debug output ("ON" or "YES") // Manuelle EVENTS [optional] [optional] [optional] ... [optional] // Eigene Auftragsnummer z.B. aus Lotus [optional] // Auftragstype (z.B. 1,2,3,...) (Mapping z.B. auf "G", "K", ...) [mandatory] // HH (HB, B, DD), Städtekürzel // Angefordertes Fahrzeug [mandatory] // {2=PKW, 3=Kombi, 4=Kastenwagen, 5=Bus, 6=Großer Bus, 7=LKW} [optional] // {PKW, ...} [optional] // Gewicht des Transportguts [optional] // Angeforderte Mindestlänge des Fahrzeugs [optional] // Angeforderte Mindestbreite des Fahrzeugs [optional] // Angeforderte Mindesthöhe des Fahrzeugs [optional] // Angeforderte Mindestanzahl an Stellplätzen im Fahrzeug [optional] // Startzeit des Auftrags (wenn leer, dann "adhoc"-Auftrag mit aktuellem Zeitstempel) (Bsp: 2012-02-17 09:30:00) [optional] // Startzeit des Auftrags in UTC (erst wird nach der Inhalt in geschaut, dann ich ) [optional] // Späteste Erledigungszeit des Auftrags (Bsp: 2014-10-22 09:00:00) [optional] // Späteste Erledigungszeit des Auftrags in UTC (erst wird nach der Inhalt in geschaut, dann ich ) [optional] // Erfassungszeit des Auftrags bei asynchroner Übertragung [optional] // {HH1000, HH1420, ...} Wunschfahrer [optional] // Fahrzeug-Filter zur Einschränkung der Fahrzeugvermittlung (Aufstellung siehe Anhang) (Bsp.: EN=Englisch, HW=Hubwagen, ...) [mandatory] // Rechnungstext und Bemerkung zum Auftrag [optional] // Bemerkung zum Auftrag für den Fahrer // Zusätzliche Informationen pro Auftrag, die gesondert behandelt und bei Rückgaben herangezogen werden können [optional] [optional] [optional] ... // Stationen // Station 1 (Abholung) [optional] // Abholung, Anlieferung, beides {leer, 0, 1, 2, 3} [optional] // Kostenstellenname {"abcd", "efgh", ...} [mandatory] // Firmenbezeichnung ODER Person [optional] // Firmenzusatz [mandatory] // Straße [mandatory] // Hausnummer [optional] // Etage, Flur [mandatory] // PLZ [mandatory] // Ort [optional] // Bemerkung zur Station [optional] // Abgabe der Sendung bei ..., Ansprechpartner [optional] // Telefonnummer [optional] // Email // Rechnungsangaben (des belieferten Endkunden) [optional] // Kostenstellenname {"abcd", "efgh", ...} => Mapping csc_id [optional, wenn gesetzt, dann weitere Felder leer] [optional] // Firmenbezeichnung [optional] // Firmenzusatz [optional] // Straße [optional] // Hausnummer [optional] // PLZ [optional] // Ort [optional] // Bemerkung zur Station [optional] // Abgabe der Sendung bei ..., Ansprechpartner [optional] [optional] // Telefonnummer [optional] [optional] // Email [optional] [optional] // Belegnummer des Endkunden (Rechnungsnummer, Kassenbon) [optional] // Zahlungsart (leer oder 0 = Bar, 1 = EC–Pin, 2 = EC–Lastschrift, 20 = Familycard, 21 = Businesscard) [optional] // Art des rabattierten Preises ("" = Standardpreis, 0 = Aktionpreis_1 (z.B. "family card"), 1 = Aktionspreis_2) [optional] // Bereits geleisteter Betrag (leer = 0 = keine Anzahlung/Bezahlung)
[optional] // Modus (leer oder 0 = Auslieferung, 1 = Retoure, 2 = Montage, 3 = Demontage, 4 = Entsorgung (bei 2 und 3 mindestens Felder "description" und "quantity" gesetzt)) [optional] // Artikelnummer [optional] // Seriennummer (1) [optional] // Beschreibung [optional] // Menge [optional] // Stückpreis [optional] // Einzelgewicht eines Artikels [optional] // Länge eines Artikels [optional] // Breite eines Artikels [optional] // Höhe eines Artikels [optional] // Anzahl Packstücke (leer oder 0 = z.B. keine Lieferung und nur Montage, ansonsten Anzahl) [optional] // Stellplätze, Kolli [optional] // Warengruppe
...
// Preisestruktur(en) [optional] [optional] // Zeitintervalle für Belieferung bzw. Anfahrt (leer = keine Einschränkung, "0" = vormittags, "1" = nachmittags, "2" = abends, "1,2" = vormittags und abends, ..., "1,2,3" = ganztägig") [mandatory] // Anzahl Zeiteinheiten für Erfüllung des Auftrags (1 Zeiteinheit = 10 Minuten) [optional] // Versandart (bit-string) // 0 => 2^0 = 1 Lieferung (Delivery) // 1 => 2^1 = 2 Montage (Installation) // 2 => 2^2 = 4 Neumöbelmontage (Installation furniture) ("Installation" [2^1] also has to be set) // 3 => 2^3 = 8 Besichtigung (Viewing) // 4 => 2^4 = 16 Kücheninstallation (Installation kitchen) ("Installation" [2^1] also has to be set) // 5 => 2^5 = 32 Nachlieferung (Delivery supplementary) // 6 => 2^6 = 64 Reklamation (Complaint) // 7 => 2^7 = 128 Abholung (Return shipment, Retoure)) // 8 => 2^8 = 256 Austausch (Replacement) // 9 => 2^9 = 512 Aufmaß (Measurement) // (E.g.: Delivery = 1, Installation furniture = 6 (including "Installation"), // Installation kitchen = 18 (including "Installation"), // Retoure = 128, Delivery and Retoure = 129, Replacement = 256 // Delivery and Replacement = 257, ...) [optional] // Auftragsart(en) (Sameday = 0, Nextday = 1, Kurier = 2) // Calculatorpreise [optional] // Spezielle Zelle der Preis-/Leistungsmatrix [mandatory] // Leistungstyp [mandatory] // Preistyp [optional] // Preis [optional] => überschreibt den in der zelle eingetragenen Preis [mandatory] // Menge ... // Calculatorpreisfunktionen [optional] [mandatory] // Nummer der Funktion (Erläuterung siehe bitte unten) [optional] // Wert für Parameter Nr. 1 der Funktion [optional] // Wert für Parameter Nr. 2 der Funktion [optional] // Wert für Parameter Nr. 3 der Funktion [optional] // Wert für Parameter Nr. 4 der Funktion [optional] // Wert für Parameter Nr. 5 der Funktion [optional] // Menge (leer = 1 = default, ansonsten angegebene Anzahl) ... // Zusätzliche Informationen pro Station, die gesondert behandelt und bei Rückgaben herangezogen werden können <1>[optional] <2>[optional] <3>[optional] <4>[optional] <5>[optional]
// Station 2 [optional] // Abholung, Anlieferung, beides [optional] ... ... // Weitere Stationen
*/ ?>