query($sqlStmt);
if (DB::isError($result))
reportDie ("$PHP_SELF:
$sqlStmt
" . $result->getMessage());
endif;
endif;
$cmp_name = getFieldValueFromId("company", "cmp_id", "$cmp_id", "cmp_comp");
$tableHeader =
"
$cmp_name, $hq_cmp_comp: " . ($jb_status == 1 ? "Laufende" : "Erledigte") . " Aufträge" .
"
";
$price_title = "Preis";
check_daterange();
if (INV_SHOW_JB_CR_REMARK == "1"):
if ($jb_status == "1")
$dateSelectionStmt = str_replace("jb_finishtime", "jb_ordertime", $dateSelectionStmt);
endif;
$cr_id_clause = "$dbh_jb.cr_id = $cr_id";
// check whether sub-couriers are to be shown
if (INV_SHOW_CR_ID_PARENT == "1"):
$cr_id_clause = $cr_id;
$sqlquery = "SELECT cr_id FROM courier WHERE cr_id_parent = '$cr_id'";
$res = $db->query($sqlquery);
if (DB::isError($res)) reportDie ("$PHP_SELF: '$sqlquery': " . $res->getMessage());
while ($row = $res->fetch_assoc()):
$cr_id_clause .= "," . $row['cr_id'];
endwhile;
$res->free();
$cr_id_clause = " $dbh_jb.cr_id IN ($cr_id_clause)";
list ($sel_cr_sid) = getHttpVars(array("cr_sid"));
if ($sel_cr_sid != "" && $sel_cr_sid != "all")
$cr_id_clause .= " AND $dbh_jb.cr_sid = '$sel_cr_sid'";
endif;
//echo $cr_id_clause;
// get all finished jobs of current hq of current courier
//$sqlquery = "SELECT DISTINCT $dbh_jb.jb_id, $dbh_jb.csc_id, $dbh_jb.jb_ordertime, " .
// "$dbh_jb.cr_id, $dbh_jb.jb_finishtime, $dbh_jb.emp_id, $dbh_jb.jb_fixprice, $dbh_jb.csc_id_payer, $dbh_tr.csc_id AS csc_id_tour " .
// "FROM $dbh_jb, $dbh_tr WHERE $dbh_jb.hq_id = '$hq_id' " .
// "AND $dbh_jb.cr_id = $cr_id AND $dbh_jb.jb_id = $dbh_tr.jb_id " .
// "AND $dbh_jb.jb_status = 2" .
// " ORDER BY $dbh_jb.jb_finishtime, $dbh_tr.tr_sort";
$sqlquery = "SELECT $dbh_jb.jb_id, $dbh_jb.csc_id, $dbh_jb.jb_ordertime, " .
"$dbh_jb.cr_id, $dbh_jb.cr_sid, $dbh_jb.jb_finishtime, $dbh_jb.jb_booktime, $dbh_jb.emp_id, $dbh_jb.jb_fixprice, $dbh_jb.csc_id_payer, $dbh_jb.jb_storno, $dbh_jb.jb_cr_filter, " .
(INV_JB_INVOICE_CR == "1" ? "$dbh_jb.jb_invtext_cr AS jb_invtext, " : "$dbh_jb.jb_invtext, ") .
"$dbh_jb.jb_cr_remark, $dbh_tr.csc_id AS csc_id_tour, $dbh_tr.tr_comp, $dbh_tr.tr_person, $dbh_tr.tr_remark, $dbh_tr.tr_hsno, " .
"address.ad_street, address.ad_zipcode, address.ad_city " .
"FROM $dbh_jb, $dbh_tr, address WHERE " . /* $dbh_jb.hq_id = '$hq_id' AND . */
$cr_id_clause . " AND $dbh_jb.jb_id = $dbh_tr.jb_id" .
" AND $dbh_jb.jb_status = $jb_status " . $dateSelectionStmt .
" AND $dbh_tr.ad_id = address.ad_id " .
" ORDER BY $dbh_jb.jb_finishtime, $dbh_jb.jb_id";
list ($show_invoice_text) = getHttpVars(array("show_invoice_text"));
$job_list = mk_job_list($sqlquery, $show_invoice_text);
$content = "";
print_job_list($job_list, $content, "courier");
?>
AUFTRÄGE
|