= "7.0") :
require("../PEAR/HTML/Template/IT.php");
else :
require("HTML/IT.php");
endif;
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "f_jb_id"));
// --- JOB -------------------
// initialize
$titles = "Nr.,Tourenname,Kostenstelle,Fahrz.,Bez.,Auslage,Gewicht,Auftragszeit,Reserv.,Kurier,Storno,Spät.Annahmez.,Annahme";
$titlesArray = spliti(",",$titles);
$titlesLength = count($titlesArray);
$fields = "jb_id,jb_tourname,csc_name,vht_value,csc_id_payer,jb_outlay,jb_weight,jb_ordertime,jb_reserv,cr_id,jb_storno,jb_latesttaketime,jb_taketime";
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$fieldClause = getDBFields("job") . "," . getDBFields("vehicletype") . "," . getDBFields("jobstatus") . "," . getDBFields("costcenter") . "," . getDBFields("jb_latesttaketime");
$fromClause = "job AS jb, costcenter AS csc, metatype AS vht, metatype AS jbs ";
$whereClause = "jb.hq_id = " . $hq_id . " AND ";
$whereClause = "jb.jb_id = " . $f_jb_id . " AND ";
$whereClause .= "(jb.csc_id = csc.csc_id) AND ";
$whereClause .= "(jb.vht_id = vht.mt_sort AND vht.mt_type = 'vehicletype') AND ";
$whereClause .= "(jb.jb_status = jbs.mt_sort AND jbs.mt_type = 'job_status') ";
$orderByClause = "";
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Job-data
$jobentry = "";
$jobCourierId = "";
while ($row = $result->fetch_assoc()):
$jobentry .= "
";
$jobentry .= "| " . $titlesArray[$i] . " | ";
$tmpVarName = $fieldsArray[$i];
${$tmpVarName} = $row[$tmpVarName];
// Get the current courier-ID of the job
if ($tmpVarName == "cr_id") : $jobCourierId = $row[cr_id]; endif;
$jobentry .= "" . $out . " | ";
$jobentry .= "
";
endwhile;
$result->free();
// --- TOUR ------------------
// initialize
$titles = "Firma,,Kostenstelle,Straße,PLZ,Ort,Hausnr.,Person,Tel.,Bemerk,Status";
$titlesArray = spliti(",",$titles);
$titlesLength = count($titlesArray);
$fields = "tr_comp,tr_comp2,csc_name,ad_street,ad_zipcode,ad_city,tr_hsno,tr_person,tr_phone,tr_remark,tr_status";
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$fieldClause = getDBFields("tour") . "," . getDBFields("address") . "," . getDBFields("costcenter") . " ";
$fromClause = "tour AS tr, address AS ad, costcenter AS csc ";
$whereClause = "tr.jb_id = " . $f_jb_id . " AND tr.ad_id = ad.ad_id AND tr.csc_id = csc.csc_id";
$orderByClause = "tr.tr_sort";
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Tour-data
$tourentry = "";
$rowCounter = 0;
while ($row = $result->fetch_assoc()):
$rowCounter++;
$tourentry .= "";
for ($i = 0; $i < $fieldsLength; $i++) :
$tourentry .= "";
if ($rowCounter == 1) :
$tourentry .= "| " . $titlesArray[$i] . " | ";
elseif ($i == floor($fieldsLength / 2)) :
$tourentry .= " | ";
else :
$tourentry .= " | ";
endif;
$tmpVarName = $fieldsArray[$i];
${$tmpVarName} = $row[$tmpVarName];
$out = formatOutput(${$tmpVarName},$outputFormatField[$tmpVarName]);
// special formatting for tour-fields
if ($tmpVarName == "tr_status") :
switch($out) {
case "0" : $out = "offen"; break;
case "1" : $out = "erledigt"; break;
};
endif;
$tourentry .= "" . $out . " | ";
$tourentry .= " ";
endfor;
$tourentry .= " | ";
endwhile;
$result->free();
// Output of the whole tour
if ($rowCounter > 1) :
$tpl->setCurrentBlock("tourentry");
$tpl->setVariable("_tourentry_", $tourentry);
$tpl->parseCurrentBlock("tourentry");
endif;
// --- COURIER ------------------
// Initialize for template-output
$courierentry = "";
if ($jobCourierId != "") :
// initialize
$titles = "Firma,,Name,Vorname,SID,Online";
$titlesArray = spliti(",",$titles);
$titlesLength = count($titlesArray);
$fields = "cmp_comp,cmp_comp2,usr_name,usr_firstname,cr_sid,cr_available";
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$fieldClause = getDBFields("courier") . "," . getDBFields("company") . "," . getDBFields("user") . " ";
$fromClause = "courier AS cr, company AS cmp, user AS usr ";
$whereClause = "cr.cr_id = " . $jobCourierId . " AND cmp.cmp_id = cr.cmp_id AND usr.usr_id = cr.usr_id";
$orderByClause = "";
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Courier-data
$courierentry .= "| KURIER: |
";
while ($row = $result->fetch_assoc()):
// $courierentry .= "";
for ($i = 0; $i < $fieldsLength; $i++) :
if ($i % 2 == 0) : $cellColor = "#BBBBFF"; $cellColor2 = "#DDDDDD"; endif;
if ($i % 2 == 1) : $cellColor = "#CCCCFF"; $cellColor2 = "#EEEEEE"; endif;
if (trim($titlesArray[$i]) == "") : $titlesArray[$i] = " "; endif;
$courierentry .= "";
$courierentry .= "| " . $titlesArray[$i] . " | ";
$tmpVarName = $fieldsArray[$i];
${$tmpVarName} = $row[$tmpVarName];
$out = formatOutput(${$tmpVarName},$outputFormatField[$tmpVarName]);
// special formatting for tour-fields
if ($tmpVarName == "cr_available") :
switch($out) {
case "0" : $out = "nicht online"; break;
case "1" : $out = "online"; break;
};
endif;
$courierentry .= "" . $out . " | ";
$courierentry .= " ";
endfor;
// $courierentry .= " | ";
endwhile;
$result->free();
endif;
// Output of the courier-data
$tpl->setCurrentBlock("courierentry");
$tpl->setVariable("_courierentry_", $courierentry);
$tpl->parseCurrentBlock("courierentry");
// --- JOB-COSTS ------------------
$jobcosts = "| KOSTEN: |
";
$jobcosts .= "";
$jobCostArr = getJobCostsByID($f_jb_id);
foreach ($jobCostArr as $costArr) {
$jobcosts .= "Zahler: " . $costArr[0] . " ";
for ($j = 0; $j < (count($costArr[1]) - 1); $j++):
$jobcosts .= $costArr[1][$j][0] . ": " . number_format($costArr[1][$j][1], 2, ',', '.') . " ";
endfor;
$jobcosts .= "" . $costArr[1][$j][0] . ": ";
$jobcosts .= "" . number_format($costArr[1][$j][1], 2, ',', '.') . "" . " ";
}
$jobcosts .= " |
";
// Output of the job-costs
$tpl->setCurrentBlock("jobcosts");
$tpl->setVariable("_jobcosts_", $jobcosts);
$tpl->parseCurrentBlock("jobcosts");
$tpl->show();
// endif;
?>