Bitte links einen Kunden auswählen!
"; $_csc_id_ = "''"; $content = ""; endif; // rebuild $csc_id_customer_list_complete // $csc_id_customer_list_complete = array(); mkCsc_id_customer_list_complete(1); else: reportDie ("$PHP_SELF: Ungültiger 'usr_type': '$usr_type'", false); endif; if (($usr_type == 1 || $usr_type == 0 || $usr_type == 2) && ($csc_id != "" && $csc_id != "undefined")): mkCsc_id_customer_list(); // get list of all costcenters that are to be shown for current csc_id (without externals) $csc_id_list_sql = ""; for ($i = 0; $i < count($csc_id_customer_list); $i++): if (costcenterIsParent($csc_id, $csc_id_customer_list[$i]["csc_id"])): // Only if the costcenter of the current csc_id // is parent of the current costcenter, then take it $csc_id_list_sql .= $csc_id_customer_list[$i]["csc_id"] . ","; endif; endfor; $csc_id_list_sql = trim($csc_id_list_sql, ","); check_daterange(); // check costcenterrange $cscSelectionStmt = ""; if ($jb_costcenter == "") // default: including sub-costcenters $jb_costcenter = "2"; if ($jb_costcenter == "1") // selected costcenter exclusively $cscSelectionStmt = " AND (($dbh_jb.csc_id_payer = $csc_id)" . " OR ($dbh_jb.csc_id_payer = 0 AND $dbh_jb.jb_id = $dbh_tr.jb_id AND $dbh_tr.csc_id = $csc_id))"; // find all finished jobs for current costcenter / headquarter // finished jobs in the table 'job' aren't invoiced yet, // invoiced jobs live in jobhistory (happy until they die...) // wenn Root-Kostenstelle, dann Name aus company nehmen if (trim($db2->getOne("SELECT csc_pre_id FROM costcenter WHERE csc_id = '" . $csc_id . "'")) == ""): $csc_name = $db2->getOne( "SELECT company.cmp_comp FROM company, customer, costcenter" . " WHERE customer.cs_id = costcenter.cs_id AND company.cmp_id = customer.cmp_id " . " AND costcenter.csc_id = '" . $csc_id . "'"); else: // wenn Unterkostenstelle, dann Kostenstellennamen $csc_name = $db2->getOne("SELECT csc_name FROM costcenter WHERE csc_id = '" . $csc_id . "'"); endif; $_tableHeader_ = "" . "  
 
" . "$csc_name" . (($jb_costcenter == "2") ? " (inkl. untergeordnete KST)" : "") . "

"; include_once("../include/caglobal.inc.php"); // get all finished jobs where csc_id_payer is in list of costcenters to be shown // if csc_id_payer = 0, then costsplit: csc_id of the tour stations must be in this list $sqlquery = "SELECT DISTINCT $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_invtext, " . "$dbh_jb.jb_incomplete, $dbh_jb.jb_export_time, $dbh_tr.csc_id AS csc_id_tour " . "FROM $dbh_jb, $dbh_tr " . "WHERE $dbh_jb.hq_id = '$hq_id' " . "AND $dbh_jb.jb_id = $dbh_tr.jb_id " . "AND (($dbh_jb.csc_id_payer IN ($csc_id_list_sql)) " . "OR ($dbh_jb.csc_id_payer = 0 AND $dbh_jb.jb_id = $dbh_tr.jb_id AND $dbh_tr.csc_id IN ($csc_id_list_sql))" . ") " . "AND $dbh_jb.jb_status = 2 AND ($dbh_jb.jb_storno IS NULL OR $dbh_jb.jb_storno < 2)" . $dateSelectionStmt . $cscSelectionStmt . " ORDER BY $dbh_jb.jb_finishtime, $dbh_tr.jb_id, $dbh_tr.tr_sort"; //echo $sqlquery; 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); $_csc_id_ = "'" . ec($csc_id) . "'"; endif; ?> AUFTRÄGE