0) :
$whereClauseJobs = "(" . implode(",", $jobArrayOfIFTMIN) . ")";
// Get data from "job", "tour", "tourarticle"
$sqlquery = "SELECT jb.jb_id, jb.cr_id, csc.csc_id, csc.csc_name,"
. " tr.tr_sort, tr.tr_signname, tr.tr_hsno,"
. " ad.ad_id, ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country,"
. " crvh.crvh_sid"
. " FROM phoenix.job AS jb LEFT JOIN phoenix.couriervehicle AS crvh ON jb.cr_id = crvh.cr_id,"
. " phoenix.tour AS tr, phoenix.address AS ad, phoenix.costcenter AS csc"
. " WHERE jb.jb_id IN " . $whereClauseJobs . " AND"
. " jb.jb_id = tr.jb_id AND"
. " tr.ad_id = ad.ad_id AND"
. " jb.csc_id_payer = csc.csc_id"
. " ORDER BY jb.jb_id, tr.tr_sort";
// echo $sqlquery . "
";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$numOfStations = $result->numRows();
while ($row = $result->fetch_assoc()):
// Get the tracking IDs of the stations
$trackingIDs = getColVectorFromDB2ArrayByClause("tourarticle", "trat_serialno", "jb_id = '" . $row["jb_id"] . "' AND tr_sort = '" . $row["tr_sort"] . "'", "", "");
$trackingIDsString = implode(",", $trackingIDs);
// Get number of stations of the job
$numOfStationsOfCurrentJob = getCountOfTable("tour", "jb_id = '" . $row["jb_id"] . "'");
$retArray[] = array($row["csc_id"],$row["csc_name"],$row["ad_id"],$row["ad_street"],$row["tr_hsno"],$row["ad_zipcode"],$row["ad_city"],$row["trat_id"],$trackingIDsString);
// $row["jb_id"],$row["tr_sort"],$row["crvh_sid"]
endwhile;
$result->free();
endif;
return $retArray;
}
if ($checkFile1 == "" || $checkFile2 == "") :
// Get costcenters of all current IFTMIN orders
$sqlquery = "SELECT DISTINCT jb.csc_id_payer, csc.csc_name"
. " FROM phoenix.job AS jb, phoenix.costcenter AS csc"
. " WHERE jb.jb_status = '" . $specialJbStatusNo . "' AND"
. " jb.csc_id_payer = csc.csc_id"
. " ORDER BY jb.csc_id_payer";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$cscIdPayerArrayOfIFTMIN[$row["csc_id_payer"]] = $row["csc_name"];
endwhile;
$result->free();
// Get job data array of specified IFTMIN orders accorting to the selected costcenter
$whereClauseCostcenter = "";
if ($f_costcenter != "" && is_numeric($f_costcenter)) :
$whereClauseCostcenter = " AND jb.csc_id_payer = '" . $f_costcenter . "'";
endif;
$sqlquery = "SELECT jb.jb_id"
. " FROM phoenix.job AS jb"
. " WHERE jb.jb_status = '" . $specialJbStatusNo . "'"
. $whereClauseCostcenter
. " ORDER BY jb.jb_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$jobArrayOfIFTMIN[] = $row["jb_id"];
endwhile;
$result->free();
// Get current state of the station data with their package informations
$stationArray = getCurrentJobData($jobArrayOfIFTMIN);
$stationArrayLen = count($stationArray);
for ($i = 0; $i < $stationArrayLen; $i++) :
$logText = implode(";", $stationArray[$i]);
writeImportLog($logText);
endfor;
$filesInFolder = getFilenamesInFolder($tempPath);
$filesInFolderLen = count($filesInFolder);
for ($i = 0; $i < $filesInFolderLen; $i++) :
if (substr($filesInFolder[$i], 0, 8) == "stations") :
$output .= $filesInFolder[$i] . "
";
endif;
endfor;
$output .= "
";
else :
$matchArray = array();
$noMatchArray = array();
// Check specified files
$data = importCSV($tempPath . $checkFile1);
$dataLen = count($data);
$data2 = importCSV($tempPath . $checkFile2);
$data2Len = count($data2);
// loop all rows
for ($j = 0; $j < $dataLen; $j++) {
$isFound = false;
// loop for all fields of $fields of the row
for ($i = 0; $i < $data2Len; $i++) {
if ($data[$j] == $data2[$i]) :
$isFound = true;
break;
endif;
}
if ($isFound) :
$matchArray[] = implode(";", $data[$j]);
else :
$noMatchArray[] = implode(";", $data[$j]);
endif;
}
// Output of the Arrays
$matchArrayLen = count($matchArray);
$output .= "OK:
";
for ($i = 0; $i < $matchArrayLen; $i++) {
$output .= $i . ".: " . $matchArray[$i] . "
";
}
$output .= "
";
$noMatchArrayLen = count($noMatchArray);
$output .= "NOT OK:
";
for ($i = 0; $i < $noMatchArrayLen; $i++) {
$output .= $i . ".: " . $noMatchArray[$i] . "
";
}
$output .= "
";
endif;
?>