1. Import

This commit is contained in:
2026-03-29 10:34:57 +02:00
parent b0e00c1259
commit a1129565af
4899 changed files with 3007593 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
<?php
include_once ("../include/mcglobal.inc.php");
include_once ("../include/inc_history.inc.php");
include_once("inv.inc.php");
//// Check HTTP-Parameters
//getSecHttpVars("1",array("crId", "fromDateRange", "toDateRange"));
list ($sel_cr_sid) = getHttpVars(array("cr_sid"));
$crId = $db->getOne("SELECT cr_id FROM couriervehicle WHERE crvh_sid = '" . $sel_cr_sid . "'");
check_daterange();
// Get the year of the begin of history data
$dbhistory = getDBNames(0);
// $logoIds <=> (3 = Annahme [Default], 6 = Automatisch vermittelt, 7 = Manuell vermittelt, 8 = Automatisch entzogen, 11 = Abgelehnt [Default])
function crHistory ($crId, $logoIds = array(), $fromDateRange = "", $toDateRange = "", $limitOfRowsDisplayed = "4000") {
global $db, $dbh_log, $PHP_SELF, $hq_id;
$pageTitle = getLngt("TRANSPORTEURSHISTORIE");
$debug = false;
if ($debug):
echo "crId = " . $crId . "<br>";
print_r($logoIds); echo "<br><br>";
endif;
$outPut = "";
if (isset($crId) && is_numeric($crId) && $crId > 0 && is_array($logoIds)) :
$outputFormatField = defineOutputFormats();
if (count($logoIds) == 0) : $logoIds = array(3,6,7,8,11,35,37,86); endif; // [3,11] [3,6,7,8,11] [3,6,7,8,11,35,37,86]
if ($fromDateRange == "") : $fromDateRange = getDateTime("date_firstday_currentmonth_lastyear") . " 00:00:00"; endif;
if ($toDateRange == "") : $toDateRange = getDateTime("0"); endif;
if ($debug):
echo "fromDateRange = " . $fromDateRange . "<br>";
echo "toDateRange = " . $toDateRange . "<br><br>";
print_r($logoIds); echo "<br><br>";
endif;
// From table "log"
$fieldClause = getDBFields("logoperation") . "," . getDBFields("log") . "," . getDBFields("user") . " ";
$fromClause = "phoenix_log.logoperation AS logo, phoenix_log." . $dbh_log . " AS log " .
"LEFT JOIN phoenix.user AS usr ON log.usr_id = usr.usr_id ";
// $whereClause = "log.cr_id = '" . $crId . "' AND log.hq_id = '" . $hq_id . "' AND log.logo_id = logo.logo_id AND ";
$whereClause = "log.cr_id = '" . $crId . "' AND log.logo_id = logo.logo_id AND ";
$whereClause .= "log.log_createtime >= '" . $fromDateRange . "' AND log.log_createtime <= '" . $toDateRange . "'";
$whereClause .= " AND logo.logo_id IN (" . implode(",", $logoIds) . ")";
$orderByClause = "log.log_createtime LIMIT 0," . $limitOfRowsDisplayed;
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
if ($debug):
echo $sqlquery . "<br><br>";
endif;
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Vorgang") . "&nbsp;&nbsp;",getLngt("Zeitpunkt") . "&nbsp;&nbsp;",getLngt("Auftrag") . "&nbsp;&nbsp;",getLngt("Fahrzeug") . "&nbsp;&nbsp;",getLngt("Name") . "&nbsp;&nbsp;",getLngt("Vorname") . "&nbsp;&nbsp;",getLngt("Telefon") . "&nbsp;&nbsp;",getLngt("Details"));
$fieldArray = array("logo_op_shortname","log_createtime","jb_id","cr_sid","usr_name","usr_firstname","usr_phone","logo_description");
$aligns = "l,c,c,c,l,l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "330,130,50,50,150,150,80,200";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "logo_description";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
$result->free();
// Courier data
$crSid = getFieldValueFromId("courier", "cr_id", $crId, "cr_sid");
$crUsrId = getFieldValueFromId("courier", "cr_id", $crId, "usr_id");
$tmpFields = getFieldsValueFromId("user","usr_id",$crUsrId,array("usr_firstname","usr_name"));
$crUsrFirstname = $tmpFields[0];
$crUsrName = $tmpFields[1];
// Post parsing if necessary
if ($postParserField != "") :
// $tableBody = postParseCrHistory($tableBody, $crSid);
$tableBody = postParseCrHistory($tableBody, $crSid, false);
endif;
$outPut .= "
<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/phoenix.css\">
<script src=\"../include/lib_global.js\" type=\"text/javascript\"></script>
</head>
<body>
<div>
<div class=\"f10bp1_blue\">" . $pageTitle . "&nbsp;&nbsp;&nbsp;" . $crUsrFirstname . " " . $crUsrName . "</br></br></div>
<div><table cellspacing=\"0\" cellpadding=\"0\" vspace=\"0\" hspace=\"0\">" . $tableHeader . $tableBody . "</table></div>
</div>
</body>
</html>";
endif;
return $outPut;
}
// TEST
//$crId = "3001" ; // SELECT * FROM courier WHERE cr_eid = 'STHB83551'
echo crHistory($crId, array(), $fromDateRange, $toDateRange);
?>

1
html/invoice/index.html Normal file
View File

@@ -0,0 +1 @@
<html>

311
html/invoice/inv.inc.php Normal file
View File

@@ -0,0 +1,311 @@
<?php
/*=======================================================================
*
* inv.inc.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/caglobal.inc.php");
include_once("../include/global.inc.php");
include_once("../include/auth.inc.php");
if ($dbhostStatistic != ""):
$db2 = getDbConnectionSpecial ($dbhostStatistic, $dbname2, $dblogin2, $dbpassword2);
else:
getDb2Connection();
endif;
$csc_id_customer_list_complete = array();
$csc_id_customer_list = array();
//list ($csc_id) =
getSecHttpVars("1", array("csc_id"));
//echo "'$csc_id'";
$hq_id = isset($HTTP_SESSION_VARS['hq_id']) ? $HTTP_SESSION_VARS['hq_id'] : 0;
$usr_id = isset($HTTP_SESSION_VARS['usr_id']) ? $HTTP_SESSION_VARS['usr_id'] : 0;
$usr_type = getFieldValueFromId("user", "usr_id", "$usr_id", "usr_type");
$cs_id = getFieldValueFromId("costcenter", "csc_id", "$csc_id", "cs_id");
$all_csc_ids = array();
// Decision to use the archive or normal tables
list ($dbhistory) = getHttpVars(array("dbhistory"));
getDBNames($dbhistory);
if ($usr_type == 2):
// customer (employee)
// get usr data
list($csc_id_usr, $emp_rights) =
getFieldsValueFromId("employee", "usr_id", $usr_id,
array("csc_id", "emp_rights"));
// check whether employee has invoice-rights
if (substr($emp_rights, 5, 1) != '1'):
reportDie ("$PHP_SELF: 'usr_id' '$usr_id' hat keine Rechte für das Rechnungsmodul!", false);
endif;
// if csc_id is given as parameter, check
// whether csc_id_usr is parent of csc_id
mkCsc_id_customer_list_complete();
if (!costcenterIsParent($csc_id_usr, $csc_id)):
$csc_id = $csc_id_usr;
endif;
elseif ($usr_type == 1 || $usr_type == 0):
// headquarter or sysadmin
$cs_id = "";
elseif ($usr_type == 3):
else:
reportDie ("$PHP_SELF: Ungültiger 'usr_type': '$usr_type'", false);
endif;
function mkCsc_id_customer_list_complete($mode = 0)
{
global $PHP_SELF, /*$db2,*/ $hq_id, $cs_id, $csc_id_customer_list_complete, $usr_type, $dateSelectionStmt, $cs_eid, $cmp_name, $dbh_jb;
$sqlQuery =
"SELECT costcenter.csc_id, costcenter.csc_name, costcenter.csc_pre_id, costcenter.csc_path, customer.cs_eid, company.cmp_comp" .
" FROM company, customer, costcenter" .
" WHERE customer.cs_id = costcenter.cs_id AND company.cmp_id = customer.cmp_id";
if ($usr_type == 0);
// system administrator gets all costcenters in the system
if ($usr_type == 1):
if ($mode == 0):
// MODE 0 IS CURRENTLY NOT USED ANY MORE
// headquarter gets only costcenters of its customers ($mode == 0)
// $sqlQuery =
// "SELECT costcenter.csc_id, costcenter.csc_name, costcenter.csc_pre_id, costcenter.csc_path" .
// " FROM costcenter, customer" .
// " WHERE customer.csc_id = costcenter.csc_id AND customer.hq_id = '$hq_id'";
elseif ($mode == 1):
// Headquarter gets all costcenters of current customer
// (for invoicing only, not for navigation)
if ($cs_id != ''):
$sqlQuery .= " AND customer.cs_id = '$cs_id'";
else:
// if no customer is given, get all costcenters of current hq_id
// only costcenters with invoices are to be shown here!!!
// $res = $db2->query("SELECT DISTINCT csc_id_payer FROM $dbh_jb WHERE jb_status = 2 AND hq_id = '$hq_id'");
//// TOBEDONE: consider date in query!!!
// if (DB::isError($res))
// reportDie ("$PHP_SELF: 'SELECT DISTINCT csc_id_payer FROM $dbh_jb WHERE jb_status = 2 AND hq_id = $hq_id': " . $res->getMessage());
// $i = 0;
// $csc_id_list_sql_arr = array();
// while ($row = $res->fetch_assoc()):
// $csc_id_list_sql_arr[] = $row["csc_id_payer"];
// endwhile;
// $res->free();
// $csc_id_list_sql = implode(",", array_unique($csc_id_list_sql_arr));
// $sqlQuery =
// "SELECT costcenter.csc_id, costcenter.csc_name, costcenter.csc_pre_id, costcenter.csc_path" .
// " FROM costcenter, customer" .
// " WHERE customer.cs_id = costcenter.cs_id AND customer.hq_id = '$hq_id' AND " .
// " costcenter.csc_id IN ($csc_id_list_sql)";
$sqlQuery =
"SELECT DISTINCT costcenter.csc_id, costcenter.csc_name, costcenter.csc_pre_id, costcenter.csc_path, customer.cs_eid, company.cmp_comp" .
" FROM company, customer, costcenter, $dbh_jb" .
" WHERE customer.cs_id = costcenter.cs_id AND company.cmp_id = customer.cmp_id " .
" AND $dbh_jb.csc_id_payer = costcenter.csc_id AND $dbh_jb.jb_status = 2 AND $dbh_jb.hq_id = '$hq_id'";
if ($cs_eid != "" || $cmp_name != ""):
if ($cs_eid != ""):
$sqlQuery .= " AND customer.cs_eid LIKE '%$cs_eid%'";
endif;
if ($cmp_name != ""):
$sqlQuery .= " AND (company.cmp_comp LIKE '%$cmp_name%' OR company.cmp_match LIKE '%$cmp_name%')";
endif;
$sqlQuery .= " AND costcenter.csc_is_extern = 0";
endif;
// " WHERE costcenter.csc_id IN ($csc_id_list_sql)";
//"SELECT cs.cs_eid from customer AS cs, costcenter AS csc" .
// " WHERE cs.cs_id = csc.cs_id AND csc.csc_id = '" . $$dbh_jb["csc_id_payer"] . "'"
//die( $sqlQuery);
endif;
else:
reportDie ("$PHP_SELF: Ungültiger Wert für Parameter 'mode' : '$mode'");
endif;
endif;
if ($usr_type == 2)
// customer (employee) gets all its own costcenters
$sqlQuery .= " AND customer.cs_id = '$cs_id'";
// given cs_eid overrules date selection
// if ($cs_eid == "" && $cmp_name == "")
$sqlQuery .= $dateSelectionStmt;
$sqlQuery .= " ORDER BY csc_name";
// select costcenters
//echo $sqlQuery . "<br>";
//include_once("../include/caglobal.inc.php");
mkCsc_id_customer_list_complete_with_csc_pre_id($sqlQuery);
//print_r ($csc_id_customer_list_complete);
// global $all_csc_ids;
// print_r ($all_csc_ids);
usort ($csc_id_customer_list_complete, "cmp_csc_id_customer_list_complete");
//print_r($csc_id_customer_list_complete);
//echo count($csc_id_customer_list_complete) . "<br>";
}
function mkCsc_id_customer_list_complete_with_csc_pre_id($sqlQuery)
{
global $db2, $csc_id_customer_list_complete, $all_csc_ids;
$tmp_csc_ids = array();
$res = $db2->query($sqlQuery);
if (DB::isError($res))
reportDie ("$PHP_SELF: '$sqlQuery' : " . $res->getMessage());
$i = count($csc_id_customer_list_complete);
while ($row = $res->fetch_assoc()):
if (!in_array ($row["csc_id"], $all_csc_ids)):
$all_csc_ids[] = $row["csc_id"];
$csc_id_customer_list_complete[$i]["csc_id"] = $row["csc_id"];
$csc_id_customer_list_complete[$i]["csc_pre_id"] = $row["csc_pre_id"];
if ($row["csc_pre_id"] != ""):
$csc_id_customer_list_complete[$i]["csc_name"] = $row["csc_name"] . " (". $row["cs_eid"] . ")";
if (!in_array ($row["csc_pre_id"], $all_csc_ids)):
if (!in_array ($row["csc_pre_id"], $tmp_csc_ids)):
$tmp_csc_ids[] = $row["csc_pre_id"];
endif;
endif;
else:
$csc_id_customer_list_complete[$i]["csc_name"] = $row["cmp_comp"] . " (". $row["cs_eid"] . ")";
endif;
$csc_id_customer_list_complete[$i++]["csc_path"] = $row["csc_path"];
endif;
endwhile;
$res->free();
if (count($tmp_csc_ids) > 0):
$tmp_csc_ids_sql = implode(",", array_unique($tmp_csc_ids));
$sqlQuery =
"SELECT DISTINCT costcenter.csc_id, costcenter.csc_name, costcenter.csc_pre_id, costcenter.csc_path, customer.cs_eid, 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 IN ($tmp_csc_ids_sql)";
mkCsc_id_customer_list_complete_with_csc_pre_id($sqlQuery);
endif;
}
function cmp_csc_id_customer_list_complete ($a, $b) {
if ($a["csc_name"] == $b["csc_name"]) return 0;
return ($a["csc_name"] < $b["csc_name"]) ? -1 : 1;
}
function mkCsc_id_customer_list()
{
global $cs_id, $csc_id, $csc_id_root,
$csc_id_customer_list, $usr_type, $csc_id_usr,
$csc_id_customer_list_complete;
if ($usr_type == 2 || $usr_type == 1):
// get identification of external costcenters
// external costcenters cannot be invoiced,
// private costcenters are not to be seen for anybody in the customer's company
$csc_id_root = getFieldValueFromId("customer", "cs_id", "$cs_id", "csc_id");
$csc_name_root = getFieldValueFromId("costcenter", "csc_id", "$csc_id_root", "csc_name");
$csc_path_extern = "//" . $csc_name_root . "//EXTERN//";
$csc_path_private = "//" . $csc_name_root . "//PRIVAT//";
// write all costcenters for the current user
// except external ones in array
$j = 0;
//echo count($csc_id_customer_list_complete);
for ($i = 0; $i < count($csc_id_customer_list_complete); $i++):
//echo "'" . strtoupper(substr($csc_id_customer_list_complete[$i]["csc_path"], 0,
// strlen($csc_path_extern))) . "' == '" . strtoupper($csc_path_extern) . "'<br>";
if ((strtoupper(substr($csc_id_customer_list_complete[$i]["csc_path"], 0,
strlen($csc_path_extern)))
!= strtoupper($csc_path_extern)) &&
(strtoupper(substr($csc_id_customer_list_complete[$i]["csc_path"], 0,
strlen($csc_path_private)))
!= strtoupper($csc_path_private)) &&
(strtoupper($csc_id_customer_list_complete[$i]["csc_name"]) != "EXTERN") &&
((strtoupper($csc_id_customer_list_complete[$i]["csc_name"]) != "PRIVAT" || $usr_type == 1))
):
// if (substr($csc_id_customer_list_complete[$i]["csc_path"], 0, strlen($csc_path_start))
// != $csc_path_extern):
//echo "'" . $csc_id_usr . "' '" . $csc_id_customer_list_complete[$i]["csc_id"] . "'<br>";
if ($usr_type == 1):
// Only if the costcenter of the user currently logged in
// is parent of the current costcenter, then take it
$csc_id_customer_list[$j]["csc_id"] = $csc_id_customer_list_complete[$i]["csc_id"];
$csc_id_customer_list[$j]["csc_name"] = $csc_id_customer_list_complete[$i]["csc_name"];
$csc_id_customer_list[$j++]["csc_pre_id"] = $csc_id_customer_list_complete[$i]["csc_pre_id"];
else:
if (costcenterIsParent($csc_id_usr, $csc_id_customer_list_complete[$i]["csc_id"])):
$csc_id_customer_list[$j]["csc_id"] = $csc_id_customer_list_complete[$i]["csc_id"];
$csc_id_customer_list[$j]["csc_name"] = $csc_id_customer_list_complete[$i]["csc_name"];
$csc_id_customer_list[$j++]["csc_pre_id"] = $csc_id_customer_list_complete[$i]["csc_pre_id"];
endif;
endif;
endif;
endfor;
else:
// usr_type 0
for ($i = 0; $i < count($csc_id_customer_list_complete); $i++):
$csc_id_customer_list[$i]["csc_id"] = $csc_id_customer_list_complete[$i]["csc_id"];
$csc_id_customer_list[$i]["csc_name"] = $csc_id_customer_list_complete[$i]["csc_name"];
$csc_id_customer_list[$i]["csc_pre_id"] = $csc_id_customer_list_complete[$i]["csc_pre_id"];
endfor;
endif;
//print_r($csc_id_customer_list);
}
function costcenterIsParent($csc_id_parent, $csc_id_child)
{
global $csc_id_customer_list_complete;
//echo $csc_id_child . "<br>";
if ($csc_id_parent == $csc_id_child)
return true;
for($i = 0; $i < count($csc_id_customer_list_complete); $i++):
if ($csc_id_customer_list_complete[$i]["csc_id"] == $csc_id_child):
if ($csc_id_customer_list_complete[$i]["csc_pre_id"] == $csc_id_parent):
return true;
else:
if ($csc_id_child == "")
return false;
else
return costcenterIsParent($csc_id_parent, $csc_id_customer_list_complete[$i]["csc_pre_id"]);
endif;
endif;
endfor;
}
function check_daterange()
{
global $dateSelectionStmt, $day_from, $month_from, $year_from, $day_to, $month_to, $year_to,
$jb_costcenter, $fromDateRange, $toDateRange, $dbh_jb, $price_title;
list ($day_from, $month_from, $year_from,
$day_to, $month_to, $year_to, $jb_costcenter) =
getHttpVars(array("day_from", "month_from", "year_from",
"day_to", "month_to", "year_to", "jb_costcenter"));
// check daterange
$dateSelectionStmt = "";
if ($day_from != "" && $month_from != "" && $year_from != "" ||
$day_to != "" && $month_to != "" && $year_to != ""):
// dates are given
else:
// dates are not given
// include_once("../include/calendar.inc.php");
$day_to = date("d");
$day_from = 1;
$month_to = date("m");
$month_from = $month_to;
$year_to = date("Y");
$year_from = $year_to;
// list($year_from, $month_from) = addMonths($year_to, $month_to, -1);
// $day_from = $day_to + 1;
// if (daysPerMonth($year_from, $month_from) < $day_from)
// $day_from = daysPerMonth($year_from, $month_from);
endif;
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2) . " 00:00:00";
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2) . " 23:59:59";
$dateSelectionStmt = " AND ($dbh_jb.jb_finishtime BETWEEN '$fromDateRange' AND '$toDateRange')";
if (MASK_CR_PRICE_MODE == "1") {
$price_title = "Vergütung";
if (strtotime(MASK_CR_PRICE_MODE_DATE) > strtotime($fromDateRange))
$price_title .= " (bis " . substr(MASK_CR_PRICE_MODE_DATE, 8, 2) . "." . substr(MASK_CR_PRICE_MODE_DATE, 5, 2) . "." . substr(MASK_CR_PRICE_MODE_DATE, 0, 4) . " Auftragspreis)";
}
}
?>

View File

@@ -0,0 +1,619 @@
<?php
/*=======================================================================
*
* inv_aux.inc.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/caglobal.inc.php");
include_once("../include/global.inc.php");
include_once("../include/services_func.inc.php");
if (!(isset($check_jb_permanent_flag) && $check_jb_permanent_flag == true))
{
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
}
function mk_job_list($sqlquery /*, $getCr_sid = true */, $show_invoice_text = "false")
{
global $PHP_SELF, $db2, $dbh_tr, $hq_id;
$invoice_text_separator = "";
while (strlen($invoice_text_separator) < INV_MAXCOLS)
$invoice_text_separator .= "_";
// // get cr_sid of all couriers of current hq
// if ($getCr_sid)
// $cr_sid_list = mkCr_sid_list();
// print $sqlquery . "<br>";
$res = $db2->query($sqlquery);
if (DB::isError($res))
reportDie ("$PHP_SELF: '$sqlquery' : " . $res->getMessage());
$i = 0;
$job_list = array();
$prev_job_id = 0;
while ($row = $res->fetch_assoc()):
//print_r($row);
//echo "<br>";
if (
// ($row["csc_id_payer"] == 0) ||
// (
// (
// ($row["csc_id_payer"] != 0) ||
// ($row["jb_fixprice"] != "" && $row["jb_fixprice"] != 0)
// )
/*&&*/ $prev_job_id != $row["jb_id"]
// )
):
// // if csc_id_payer == 0 then costsplit: take every tour of the job
// // because the payer is the csc_id of each tour
// // if csc_id_payer != 0 then no costsplit: take only one entry for the job
// // because payer pays all tours of the job; the same applies if
// // price is fix_price (no entries in tourservice)
// // if csc_id_payer == -1 then cash (no invoice): take only one entry for the job
// // because paying is not interesting here
$job_list[$i]["jb_id"] = $row["jb_id"];
$job_list[$i]["csc_id"] = $row["csc_id"];
$job_list[$i]["jb_ordertime"] = $row["jb_ordertime"];
$job_list[$i]["cr_sid"] = $row["cr_sid"];
// if ($getCr_sid):
// $job_list[$i]["cr_id"] = $cr_sid_list[$row["cr_id"]];
// else:
// $job_list[$i]["cr_id"] = $row["cr_id"];
// endif;
$job_list[$i]["jb_finishtime"] = $row["jb_finishtime"];
$job_list[$i]["jb_booktime"] = $row["jb_booktime"];
$job_list[$i]["jb_export_time"] = isset($row["jb_export_time"]) ? $row["jb_export_time"] : "";
$job_list[$i]["emp_id"] = $row["emp_id"];
if ($row["csc_id_payer"] != 0):
$job_list[$i]["csc_id_payer"] = $row["csc_id_payer"];
$job_list[$i]["cnt_costsplit"] = 1;
else:
$job_list[$i]["csc_id_payer"] = $row["csc_id_tour"];
// save tour count for fixprice with costsplit
$job_list[$i]["cnt_costsplit"] =
$db2->getOne("SELECT COUNT(jb_id) FROM $dbh_tr WHERE jb_id = " . $row["jb_id"]);
endif;
if ($row["jb_storno"] != 3 && $row["jb_storno"] != 4):
$job_list[$i]["tr_comp"] = $row["tr_comp"] .
(trim($row["ad_street"]) != "" ? ", " . $row["ad_street"] : "") .
(trim($row["tr_hsno"]) != "" ? " " . $row["tr_hsno"] : "") .
(trim($row["ad_zipcode"]) != "" ? ", " . $row["ad_zipcode"] : "") .
(trim($row["ad_city"]) != "" ? " " . $row["ad_city"] : "") .
(trim($row["tr_person"]) != "" ? "; " . $row["tr_person"] : "") .
(trim($row["tr_remark"]) != "" ? "; " . nl2br($row["tr_remark"]) : "");
else:
$job_list[$i]["tr_comp"] = "(" . trim($row["jb_invtext"]) . ")";
endif;
$job_list[$i]["jb_invoice"] = "";
if ($show_invoice_text == "true"):
$job_list[$i]["jb_invoice"] = "<br>\n" . $invoice_text_separator . "<br>\n" .
nl2br(trim($row["jb_invtext"])) . "<br>\n" . $invoice_text_separator . "<br>\n";
endif;
$mandatory_filters = trim(getParameterValue("0", "MASK_MANDATORY_FILTERS", $hq_id));
if ($mandatory_filters != ''):
$mandatory_filtersArr = explode(",", $mandatory_filters);
for ($j = 0; $j < count($mandatory_filtersArr); $j++):
if ($row["jb_cr_filter"] == $mandatory_filtersArr[$j])
$row["jb_cr_filter"] = "";
$row["jb_cr_filter"] = str_replace("," . $mandatory_filtersArr[$j] . ",", ",", $row["jb_cr_filter"]);
$row["jb_cr_filter"] = str_replace($mandatory_filtersArr[$j] . ",", "", $row["jb_cr_filter"]);
$row["jb_cr_filter"] = str_replace("," . $mandatory_filtersArr[$j], "", $row["jb_cr_filter"]);
endfor;
endif;
$jb_cr_filter_list_str = "";
if (trim($row["jb_cr_filter"]) != ""):
$jb_cr_filter_list = explode(",", $row["jb_cr_filter"]);
//print_r($jb_cr_filter_list);
for ($j = 0; $j < count($jb_cr_filter_list); $j++):
if ($jb_cr_filter_list[$j] != ""):
$jb_cr_filter_list_str .= ", " . $jb_cr_filter_list[$j];
endif;
endfor;
endif;
if ($jb_cr_filter_list_str != ""):
$job_list[$i]["jb_invoice"] .= "<br>\nFilter: " . substr($jb_cr_filter_list_str, 2);
endif;
$job_list[$i]["jb_cr_remark"] = $row["jb_cr_remark"];
$job_list[$i]["jb_fixprice"] = $row["jb_fixprice"];
$job_list[$i++]["jb_incomplete"] = isset($row["jb_incomplete"]) ? $row["jb_incomplete"] : "";
$prev_jb_invtext = $row["jb_invtext"];
$prev_job_id = $row["jb_id"];
else:
if ($row["jb_storno"] != 3 && $row["jb_storno"] != 4):
$job_list[$i-1]["tr_comp"] .= "<br>--&gt;&nbsp;" . $row["tr_comp"] .
(trim($row["ad_street"]) != "" ? ", " . $row["ad_street"] : "") .
(trim($row["tr_hsno"]) != "" ? " " . $row["tr_hsno"] : "") .
(trim($row["ad_zipcode"]) != "" ? ", " . $row["ad_zipcode"] : "") .
(trim($row["ad_city"]) != "" ? " " . $row["ad_city"] : "") .
(trim($row["tr_person"]) != "" ? "; " . $row["tr_person"] : "") .
(trim($row["tr_remark"]) != "" ? "; " . nl2br($row["tr_remark"]) : "");
endif;
endif;
endwhile;
//print_r($job_list);
$res->free();
return $job_list;
}
//function mkCr_sid_list()
//{
// global $PHP_SELF, $db2, $hq_id;
//
// $res = $db2->query("SELECT cr_id, cr_sid FROM courier WHERE hq_id = '$hq_id'");
// if (DB::isError($res))
// reportDie ("$PHP_SELF: 'SELECT cr_id, cr_sid ...' :" . $res->getMessage());
// $cr_sid_list = array();
// while ($row = $res->fetch_assoc()):
// $cr_sid_list[$row["cr_id"]] = trim($row["cr_sid"]);
// endwhile;
// $res->free();
// return $cr_sid_list;
//}
//function print_job_list_cust($job_list, &$tpl)
//{
// global $PHP_SELF, $db2, $hq_id;
//
// // Print jobs and fetch their costs
// $i = 0;
// $all_sum = 0;
// foreach ($job_list as $job)
// {
// if ($i % 2 == 0) : $cellColor = "#DDDDDD"; $cellColor2 = "#EEEEEE"; endif;
// if ($i++ % 2 == 1) : $cellColor = "#BBBBFF"; $cellColor2 = "#CCCCFF"; endif;
// $tmp_nr = $job["jb_id"];
// $tmp_order_name = $db2->getOne("SELECT csc_name FROM costcenter WHERE csc_id = '" . $job["csc_id"] . "'") .
// ", " .
// $db2->getOne("SELECT usr_account FROM user WHERE usr_id = '" .
// $db2->getOne("SELECT usr_id FROM employee WHERE emp_id = '" . $job["emp_id"] . "'") . "'");
// $tmp_payer_name = $db2->getOne("SELECT csc_name FROM costcenter WHERE csc_id = '" . $job["csc_id_payer"] . "'");
// $tmp_ordertime = my_datum_zeit_format_datetime($job["jb_ordertime"]);
// $tmp_cr_id = $job["cr_id"];
// $tmp_finishtime = my_datum_zeit_format_datetime($job["jb_finishtime"]);
//
// // fetch costs and print them (if not fixprice)
// if ($job["jb_fixprice"] == "" || $job["jb_fixprice"] == 0):
// $sqlquery =
// "SELECT tr_sort, trs_srv_name, trs_srvt_name, trs_price, trs_discount " .
// "FROM $dbh_trs WHERE jb_id = '" . $job["jb_id"] . "'";
// $res = $db2->query($sqlquery);
// if (DB::isError($res)):
// reportDie ("$PHP_SELF: '$sqlquery' : " . $res->getMessage());
// endif;
// $is_jb_fixprice = false;
// else:
// $is_jb_fixprice = true;
// endif;
// $job_sum = 0;
// while (($row = $res->fetch_assoc()) || $is_jb_fixprice):
// if (!$is_jb_fixprice):
// $tmp_srv_name = str_replace("<br>", " ", $row["trs_srv_name"]) . " " . $row["trs_srvt_name"];
// $tmp_price = $row["trs_price"] - $row["trs_discount"];
// else:
// // if costsplit, it must be considerered here!
// if ($job["cnt_costsplit"] > 1):
// $tmp_srv_name = "Festpreis (anteilig 1/" . $job["cnt_costsplit"] . ")";
// $tmp_price = $job["jb_fixprice"] / $job["cnt_costsplit"];
// else:
// $tmp_srv_name = "Festpreis";
// $tmp_price = $job["jb_fixprice"];
// endif;
// $is_jb_fixprice = false;
// endif;
// $tpl->setCurrentBlock("jobentry");
// $tpl->setVariable("_jobentry_",
// "<td bgcolor=\"$cellColor\" align=\"center\">$tmp_nr" .
// "</td><td bgcolor=\"$cellColor2\" align=\"left\">$tmp_payer_name" .
// "</td><td bgcolor=\"$cellColor\" align=\"left\">$tmp_order_name" .
// "</td><td bgcolor=\"$cellColor2\" align=\"center\">$tmp_ordertime" .
// "</td><td bgcolor=\"$cellColor\" align=\"center\">$tmp_cr_id" .
// "</td><td bgcolor=\"$cellColor2\" align=\"center\">$tmp_finishtime" .
// "</td><td bgcolor=\"$cellColor\" align=\"left\">" . $tmp_srv_name .
// "</td><td bgcolor=\"$cellColor2\" align=\"right\">" . number_format($tmp_price, 2, ',', '.') .
// "</td>"
// );
// $tpl->parseCurrentBlock("jobentry");
// $tmp_nr = "&nbsp;";
// $tmp_payer_name = "&nbsp;";
// $tmp_order_name = "&nbsp;";
// $tmp_ordertime = "&nbsp;";
// $tmp_cr_id = "&nbsp;";
// $tmp_finishtime = "&nbsp;";
// $job_sum += $tmp_price;
// endwhile;
// $tpl->setCurrentBlock("jobentry");
// $tpl->setVariable("_jobentry_",
// "<td bgcolor=\"$cellColor\" align=\"center\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor2\" align=\"left\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor\" align=\"left\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor2\" align=\"center\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor\" align=\"left\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor2\" align=\"center\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor\" align=\"left\"><span style=\"color:red\"><i>#</i></span>" .
// "</td><td bgcolor=\"$cellColor2\" align=\"right\"><span style=\"color:red\"><i>" .
// number_format($job_sum, 2, ',', '.') .
// "</i></span></td>"
// );
// $tpl->parseCurrentBlock("jobentry");
// $res->free();
// $all_sum += $job_sum;
// }
//
// if ($i % 2 == 0) : $cellColor = "#DDDDDD"; $cellColor2 = "#EEEEEE"; endif;
// if ($i % 2 == 1) : $cellColor = "#BBBBFF"; $cellColor2 = "#CCCCFF"; endif;
// $tpl->setCurrentBlock("jobentry");
// $tpl->setVariable("_jobentry_",
// "<td bgcolor=\"$cellColor\" align=\"center\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor2\" align=\"left\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor\" align=\"left\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor2\" align=\"center\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor\" align=\"left\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor2\" align=\"center\">&nbsp;" .
// "</td><td bgcolor=\"$cellColor\" align=\"left\"><span style=\"color:red\"><i><b>Gesamtsumme</b></i></span>" .
// "</td><td bgcolor=\"$cellColor2\" align=\"right\"><span style=\"color:red\"><i><b>" .
// number_format($all_sum, 2, ',', '.') .
// "</b></i></span></td>"
// );
// $tpl->parseCurrentBlock("jobentry");
//}
function print_job_list($job_list, &$tpl, $mode = "customer", $target = "html")
{
global $PHP_SELF, $db2, $hq_id, $ascii_text, $price_title;
//print_r ($job_list);
if ($mode == "courier"):
// get Provision
$hq_cr_prov = getFieldValueFromId("headquarters", "hq_id", "$hq_id", "hq_cr_prov");
$hq_prov = getFieldValueFromId("headquarters", "hq_id", "$hq_id", "hq_prov");
if ($target == "html"):
$tpl .= "<tr>\n" .
"<td align=\"center\">Lfd. Nr." .
"</td><td align=\"center\" valign=\"bottom\">Auftr.-Nr.<br>Erfasser<br>Fahrzeug" .
// "</td><td align=\"center\ valign=\"bottom\"">Erfasser" .
// "</td><td align=\"center\ valign=\"bottom\"">Besteller (Firma, Person)" .
"</td><td align=\"center\" valign=\"bottom\">Auftragszeit<br>Annahme<br>Erledigung" .
// "</td><td align=\"center\" valign=\"bottom\">erledigt" .
// "</td><td align=\"center\" valign=\"bottom\">gebucht" .
"</td><td align=\"center\" valign=\"bottom\">Tour" .
"</td><td align=\"left\" valign=\"bottom\">Leistung" .
(INV_JB_CR_PRICE == 1
? "</td><td align=\"right\" valign=\"bottom\">Auftragswert&nbsp;&euro;" .
"</td><td align=\"right\" valign=\"bottom\">Provisionsfrei&nbsp;&euro;</td>"
: "</td><td align=\"right\" valign=\"bottom\">" . $price_title . " &euro;</td>" ) .
"</tr>\n";
elseif ($target == "ascii"):
elseif ($target == "csv"):
endif;
elseif ($mode == "customer"):
if ($target == "html"):
$tpl .= "<tr>\n" .
"<td align=\"center\">Lfd. Nr." .
"</td><td align=\"center\">Auftr.-Nr." .
"</td><td align=\"center\">Zahler (KST)" .
"</td><td align=\"center\">Besteller (KST, MA)" .
"</td><td align=\"center\">bestellt" .
"</td><td align=\"center\">erledigt" .
"</td><td align=\"center\">gebucht" .
"</td><td align=\"center\">Kurier" .
"</td><td align=\"center\">Leistung" .
"</td><td align=\"center\">Preis &euro;</td>" .
"</tr>\n";
elseif ($target == "ascii"):
elseif ($target == "csv"):
endif;
endif;
// Print jobs and fetch their costs
$i = -1;
$all_sum = 0;
$all_sum_fuhrlohn = 0;
$prev_tmp_jb_id = 0;
$job_cnt = 0;
foreach ($job_list as $job)
{
if ($job["csc_id_payer"] != -1 || ($mode == "courier")): // Cash payments are not to be invoiced!!!
$tmp_jb_id = $job["jb_id"];
if ($tmp_jb_id != $prev_tmp_jb_id):
$prev_tmp_jb_id = $tmp_jb_id;
$tmp_jb_id_print = $tmp_jb_id;
$tmp_job_cnt = ++$job_cnt;
$i++;
if ($db2->getOne("SELECT emp_id FROM employee WHERE usr_id = '" . $job["emp_id"] . "'") != ""):
// Erfasser war Employee: Kundenauftrag
$tmp_csc_name = $db2->getOne("SELECT csc_name FROM costcenter WHERE csc_id = '" . $job["csc_id"] . "'");
if (trim($tmp_csc_name) != "")
$tmp_csc_name .= ", ";
$tmp_order_name = $tmp_csc_name .
$db2->getOne("SELECT usr_name FROM user WHERE usr_id = '" .
// $db2->getOne("SELECT usr_id FROM employee WHERE emp_id = '" .
$job["emp_id"] . "'")
// . "'")
;
else:
// Erfasser war kein Employee: Zentralenauftrag
$tmp_order_name = $job["emp_id"] . $db2->getOne("SELECT cmp_comp FROM company WHERE cmp_id = '" .
$db2->getOne("SELECT cmp_id FROM headquarters WHERE hq_id = '" .
$db2->getOne("SELECT hq_id FROM user WHERE usr_id = '" .
$job["emp_id"] . "'") . "'") . "'") .
", " .
$db2->getOne("SELECT usr_name FROM user WHERE usr_id = '" . $job["emp_id"] . "'");
$tmp_order_name = "(System)";
endif;
// $tmp_ordertime = str_replace("&nbsp;", "<br>", my_datum_zeit_format_datetime($job["jb_ordertime"])) . "&nbsp;Uhr";
$tmp_ordertime = my_datum_zeit_format_datetime($job["jb_ordertime"], " ") . "&nbsp;Uhr";
$tmp_cr_id = $job["cr_sid"];
// $tmp_cr_id = $job["cr_id"];
// $tmp_finishtime = str_replace("&nbsp;", "<br>", my_datum_zeit_format_datetime($job["jb_finishtime"])) . "&nbsp;Uhr";
$tmp_finishtime = my_datum_zeit_format_datetime($job["jb_finishtime"], " ") . "&nbsp;Uhr";
// $tmp_booktime = (trim($job["jb_booktime"]) != ""
// ? str_replace("&nbsp;", "<br>", my_datum_zeit_format_datetime($job["jb_booktime"])) . "&nbsp;Uhr" : "");
$tmp_booktime = (trim($job["jb_booktime"]) != ""
? my_datum_zeit_format_datetime($job["jb_booktime"], " ") . "&nbsp;Uhr" : "");
$tmp_is_exported = (trim($job["jb_export_time"]) != "" ? true : false);
$tmp_comp = $job["tr_comp"];
$tmp_invoice = $job["jb_invoice"];
$tmp_remark = $job["jb_cr_remark"];
endif;
// wenn Root-Kostenstelle, dann Name aus company nehmen
if (trim($db2->getOne("SELECT csc_pre_id FROM costcenter WHERE csc_id = '" . $job["csc_id_payer"] . "'")) == ""):
$tmp_payer_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 = '" . $job["csc_id_payer"] . "'");
else:
// wenn Unterkostenstelle, dann Kostenstellennnamen
$tmp_payer_name = $db2->getOne("SELECT csc_name FROM costcenter WHERE csc_id = '" . $job["csc_id_payer"] . "'");
endif;
// Die Kundennummer in Klammern dahinter
$tmp_payer_name .= " (" . $db2->getOne("SELECT cs.cs_eid from customer AS cs, costcenter AS csc" .
" WHERE cs.cs_id = csc.cs_id AND csc.csc_id = '" . $job["csc_id_payer"] . "'") . ")";
$costArr = getJobCosts($job, $mode);
mk_jobentry($mode, $tpl, $i, $tmp_job_cnt, $tmp_jb_id_print, $tmp_payer_name, $tmp_order_name,
$tmp_ordertime, $tmp_finishtime, $tmp_booktime, $tmp_comp, $tmp_cr_id, "costArr", "costArr", $target, $costArr, $job["jb_incomplete"], $tmp_invoice, $tmp_remark, $tmp_is_exported);
$tmp_order_name = "&nbsp;";
$tmp_job_cnt = "&nbsp;";
$tmp_ordertime = "&nbsp;";
$tmp_finishtime = "&nbsp;";
$tmp_booktime = "&nbsp;";
$tmp_comp = "&nbsp;";
$tmp_invoice = "&nbsp;";
$tmp_remark = "&nbsp;";
// Auftragssumme
mk_jobentry($mode, $tpl, $i, "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;",
"<i class=\"red\">" . $costArr[count($costArr) - 1][0] . "</i>",
"<i class=\"red\">" . number_format($costArr[count($costArr) - 1][1], 2, ',', '.') . "</i>", $target, "", $job["jb_incomplete"], "", "&nbsp;");
$tmp_jb_id_print = "&nbsp;";
// zur Gesamtsumme addieren
if (INV_JB_CR_PRICE == 1 && !(strpos ($costArr[count($costArr) - 1][0], "Fuhrlohn") === false)):
$all_sum_fuhrlohn += $costArr[count($costArr) - 1][1];
else:
$all_sum += $costArr[count($costArr) - 1][1];
endif;
endif;
}
$all_sum_fuhrlohn_formatted = "&nbsp;";
if ($mode == "courier" && INV_JB_CR_PRICE == 1)
$all_sum_fuhrlohn_formatted = number_format($all_sum_fuhrlohn, 2, ',', '.');
mk_jobentry($mode, $tpl, ++$i, "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;",
"<i class=\"red\"><b>" . $all_sum_fuhrlohn_formatted . "</b></i>",
"<i class=\"red\"><b>Gesamtsumme</b></i>",
"<i class=\"red\"><b>" . number_format($all_sum, 2, ',', '.') . "</b></i>", $target, "Gesamtsumme", "", "", "&nbsp;");
if ($mode == "courier" && $target != "csv"):
if ($hq_cr_prov > 0 || $hq_prov > 0):
$all_prov = -1 * $job_cnt * ($hq_cr_prov + $hq_prov);
mk_jobentry($mode, $tpl, $i, "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;",
"<span style=\"color:red\"><i><b>abzgl. Provision ($job_cnt Auftr. zu " .
number_format(($hq_cr_prov + $hq_prov), 2, ',', '.') . " &euro;)</b></i></span>",
"<span style=\"color:red\"><i><b>" . number_format($all_prov, 2, ',', '.') . "</b></i></span>", $target, "", "", "&nbsp;");
mk_jobentry($mode, $tpl, ++$i, "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;",
"<span style=\"color:red\"><i><b>Abrechnungssumme</b></i></span>",
"<span style=\"color:red\"><i><b>" . number_format($all_sum + $all_prov, 2, ',', '.') . "</b></i></span>", $target, "", "", "&nbsp;");
endif;
endif;
}
function mk_jobentry($mode, &$tpl, $i, $job_cnt, $tmp_jb_id, $tmp_payer_name, $tmp_order_name,
$tmp_ordertime, $tmp_finishtime, $tmp_booktime, $tmp_comp, $tmp_cr_id, $tmp_srv_name, $tmp_price, $target = "html", $costArr, $jb_incomplete = 0, $tmp_invoice = "", $tmp_remark = "", $tmp_is_exported = false)
{
global $db2, $ascii_text, $csv_text, $dbhistory,
$csc_id, $day_from, $month_from, $year_from, $day_to, $month_to, $year_to, $sel_cr_sid, $jb_status, $show_invoice_text, $usr_type;
if ($tmp_srv_name == "costArr"):
$tmp_srv_name = "";
$tmp_price = "";
for ($j = 0; $j < (count($costArr) - 1); $j++):
if ($target == "html"):
$tmp_srv_name .= $costArr[$j][0] . "<br>(" . $db2->getOne("SELECT mt_value FROM metatype WHERE mt_sort = '" . $db2->getOne("SELECT vht_id FROM job WHERE jb_id = " . $tmp_jb_id) . "' AND mt_type = 'vehicletype'") . ")";
if ($mode == "courier"):
$jb_cr_serviceprice = (float) $db2->getOne("SELECT jbprc_price FROM jobprice WHERE jb_id = " . $tmp_jb_id . " AND mt_sort = 3");
if ($jb_cr_serviceprice != "" AND $jb_cr_serviceprice != 0)
$tmp_srv_name .= "<br>inkl. Servicevergütung " . number_format($jb_cr_serviceprice, 2, ',', '.') . " EUR";
// $jbCrAgio = $db2->getOne("SELECT jbprc_price FROM jobprice WHERE jb_id = " . $tmp_jb_id . " AND mt_sort = 7");
$jbprc_cr_subtotal = (float) $db2->getOne("SELECT jbprc_price FROM jobprice WHERE jb_id = " . $tmp_jb_id . " AND mt_sort = 10") - $jb_cr_serviceprice;
// if ($jbCrAgio != "") {
// $tmp_srv_name .= "<br>inkl. Kundenaufschlag " . number_format($jbprc_cr_subtotal * ($jbCrAgio / 100), 2, ',', '.') . " EUR (" . number_format($jbCrAgio, 2, ',', '.') . " % auf " . number_format($jbprc_cr_subtotal, 2, ',', '.') . ")";
// $jbprc_cr_subtotal = $jbprc_cr_subtotal * (1 + ($jbCrAgio / 100));
// }
$jbprc_cr_markup = $db2->getOne("SELECT jbprc_price FROM jobprice WHERE jb_id = " . $tmp_jb_id . " AND mt_sort IN (1,9)");
if ($jbprc_cr_markup != "")
$tmp_srv_name .= "<br>inkl. Treibstoffzuschlag " . number_format($jbprc_cr_subtotal * ($jbprc_cr_markup / 100), 2, ',', '.') . " EUR (" . number_format($jbprc_cr_markup, 2, ',', '.') . " % auf " . number_format($jbprc_cr_subtotal, 2, ',', '.') . ")";
endif;
$tmp_price .= number_format($costArr[$j][1], 2, ',', '.') . "<br>";
elseif ($target == "ascii"):
$tmp_srv_name .= "\t" . tabExpand($costArr[$j][0]) . number_format($costArr[$j][1], 2, ',', '.') . "\n";
elseif ($target == "csv"):
if ($mode == "customer"):
$tmp_srv_name .= "\"$tmp_jb_id\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"" .
$costArr[$j][0] . "\"\t\"" . number_format($costArr[$j][1], 2, ',', '.') . "\"\n";
elseif ($mode == "courier"):
$tmp_srv_name .= "\"$tmp_cr_id\"\t\"$tmp_jb_id\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"" .
$costArr[$j][0] . "\"\t\"" . number_format($costArr[$j][1], 2, ',', '.') . "\"\n";
endif;
endif;
endfor;
endif;
if ($target == "html"):
if ($jb_incomplete == 1):
if ($i % 2 == 0) : $cellColor = "FFBBBB"; $cellColor2 = "FFCCCC"; endif;
if ($i % 2 == 1) : $cellColor = "FF9999"; $cellColor2 = "FFAAAA"; endif;
else:
if ($i % 2 == 0) : $cellColor = "DDDDDD"; $cellColor2 = "EEEEEE"; endif;
if ($i % 2 == 1) : $cellColor = "BBBBFF"; $cellColor2 = "CCCCFF"; endif;
endif;
endif;
if ($mode == "customer"):
if ($target == "html"):
$tpl .= "<tr>\n" .
"<td class=\"$cellColor\" align=\"center\" valign=\"top\">$job_cnt" .
"</td><td class=\"$cellColor2\" align=\"center\" valign=\"top\">" .
($usr_type == 1
? "<a href=\"../jobs/job_edit.php?jb_id=" . ec($tmp_jb_id) . "&dbhistory=" . ec($dbhistory) . "\" target=_blank>" . $tmp_jb_id . "</a>"
: "<a href=\"../customer/jb_detail.php?job_id=" . ec($tmp_jb_id) . "&dbhistory=" . ec($dbhistory) . "\" target=_blank>" . $tmp_jb_id . "</a>") .
"</td><td class=\"$cellColor\" align=\"left\" valign=\"top\">$tmp_payer_name $tmp_invoice" .
"</td><td class=\"$cellColor2\" align=\"left\" valign=\"top\">$tmp_order_name" .
"</td><td class=\"$cellColor\" align=\"center\" valign=\"top\">$tmp_ordertime" .
"</td><td class=\"$cellColor2\" align=\"center\" valign=\"top\">$tmp_finishtime" .
"</td><td class=\"$cellColor\" align=\"center\" valign=\"top\">$tmp_booktime" .
"</td><td class=\"$cellColor2\" align=\"center\" valign=\"top\">$tmp_cr_id" .
"</td><td class=\"$cellColor\" align=\"left\" valign=\"top\">" . $tmp_srv_name .
"</td><td class=\"$cellColor2\" align=\"right\" valign=\"top\">" . $tmp_price .
"</td>" .
"</tr>\n";
elseif ($target == "ascii"):
if ($costArr != "" && $costArr != "Gesamtsumme"):
$ascii_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\n\nLfd. Nr.:\t\t\t$job_cnt\n" .
"Auftr.-Nr.:\t\t\t$tmp_jb_id\n" .
"Besteller (KST, MA):\t$tmp_order_name\n" .
"Bestelldatum:\t\t$tmp_ordertime\n" .
"Kuriernummer:\t\t$tmp_cr_id\n" .
"Erledigt:\t\t\t$tmp_finishtime\n" .
"\n$tmp_srv_name")));
else:
if ($costArr != "Gesamtsumme"):
$ascii_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\t" . tabExpand(strip_tags($tmp_srv_name)) . "$tmp_price\n")));
else:
$ascii_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\n\n" . tabExpand(strip_tags($tmp_srv_name)) . "$tmp_price\n")));
endif;
endif;
elseif ($target == "csv"):
if ($costArr != "" && $costArr != "Gesamtsumme"):
$csv_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\"$tmp_jb_id\"\t\"$tmp_payer_name\"\t\"$tmp_order_name\"\t" .
"\"$tmp_ordertime\"\t\"$tmp_cr_id\"\t\"$tmp_finishtime\"\n$tmp_srv_name")));
else:
if ($costArr != "Gesamtsumme"):
$csv_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\"$tmp_jb_id\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"" .
strip_tags($tmp_srv_name) . "\"\t\"$tmp_price\"\n")));
endif;
endif;
endif;
elseif ($mode == "courier"):
if (INV_SHOW_JB_CR_REMARK == "1" && INV_JB_CR_PRICE == "1" /* letztere Bedingung damit das nur bei Gütertaxi angezeigt wird*/):
if ($tmp_remark == ""):
$tmp_remark = "(Bemerkung hinzuf&uuml;gen)";
$tmp_remark_parm = "";
else:
$tmp_remark_parm = $tmp_remark;
endif;
if ($tmp_remark != "&nbsp;"):
$tmp_remark =
"<br><br><div id=\"remark_link$tmp_jb_id\">\n" .
"<i><a href=\"javascript:mkJb_cr_remark('remark_link" . $tmp_jb_id . "','remark_form" . $tmp_jb_id . "');\">$tmp_remark</a></i>" .
"</div>\n" .
"<div id=\"remark_form$tmp_jb_id\" style=\"display:none;\">\n" .
"<form id=\"form$tmp_jb_id\" action=\"../invoice/inv_details_cr.php" .
"?csc_id=$csc_id&day_from=$day_from&month_from=$month_from&year_from=$year_from&day_to=$day_to&month_to=$month_to&year_to=$year_to&cr_sid=$sel_cr_sid&jb_status=$jb_status&show_invoice_text=$show_invoice_text&dbhistory=$dbhistory\" " .
"method=\"post\">\n" .
"<input type=\"hidden\" name=\"jb_id\" value=\"" . $tmp_jb_id . "\">\n" .
"<textarea id=\"jb_cr_remark$tmp_jb_id\" name=\"jb_cr_remark\" cols=\"60\" rows=\"4\" onKeyUp=\"countDigits('jb_cr_remark$tmp_jb_id')\" onClick=\"countDigits('jb_cr_remark$tmp_jb_id')\">\n" .
$tmp_remark_parm . "</textarea>\n" .
"</form>\n" .
defineButtonType10("Abbrechen", "abbrechen", "mkJb_cr_remark('remark_form$tmp_jb_id','remark_link$tmp_jb_id');", "100", "left", "2", "Abbrechen alt+a", "a") .
defineButtonType10("Löschen", "loeschen", "doDelete('jb_cr_remark$tmp_jb_id');", "100", "left", "2", "Löschen alt+l", "l") .
defineButtonType10("Speichern", "speichern", "doSave('form$tmp_jb_id');", "100", "left", "", "Speichern alt+s", "s") .
"</div>\n";
endif;
else:
$tmp_remark = "";
endif;
if ($target == "html"):
$tpl .= "<tr>\n" .
"<td class=\"$cellColor\" align=\"center\" valign=\"top\">$job_cnt" .
"</td><td class=\"$cellColor2\" align=\"center\" valign=\"top\">$tmp_jb_id" .
(trim($tmp_order_name) != "&nbsp;" ? "<br>$tmp_order_name": "") . "&nbsp;<br>" .
(INV_SHOW_CR_ID_PARENT == "1" ? ($costArr == "Gesamtsumme" ? "&nbsp;" : $tmp_cr_id) : "") .
// "</td><td class=\"$cellColor\" align=\"left\" valign=\"top\">$tmp_order_name" .
"</td><td class=\"$cellColor2\" align=\"center\" valign=\"top\">" . str_replace(" ", "&nbsp;", $tmp_ordertime) .
(trim($tmp_booktime) != "&nbsp;" ? "<br>". str_replace(" ", "&nbsp;", $tmp_booktime) : "") .
(trim($tmp_finishtime) != "&nbsp;" ? "<br>" . str_replace(" ", "&nbsp;", $tmp_finishtime) : "") .
// "</td><td class=\"$cellColor\" align=\"center\" valign=\"top\">$tmp_finishtime" .
// "</td><td class=\"$cellColor2\" align=\"center\" valign=\"top\">$tmp_booktime" .
"</td><td class=\"$cellColor\" align=\"left\" valign=\"top\">$tmp_comp $tmp_invoice $tmp_remark" .
"</td><td class=\"$cellColor2\" align=\"left\" valign=\"top\">" . str_replace("Fuhrlohn", "", str_replace("PLZ ", "", $tmp_srv_name)) .
"</td><td class=\"$cellColor\" align=\"right\" valign=\"top\">" .
(INV_JB_CR_PRICE == "1" && !(strpos ($tmp_srv_name, "Fuhrlohn") === false) ? "&nbsp;" : $tmp_price) .
(INV_JB_CR_PRICE == "1"
? "</td><td class=\"$cellColor2\" align=\"right\" valign=\"top\">" .
(!(strpos ($tmp_srv_name, "Fuhrlohn") === false)
? $tmp_price
: ($costArr != "Gesamtsumme" ? "&nbsp;" : $tmp_cr_id))
: "" ) .
"</td>" .
"</tr>\n";
elseif ($target == "ascii"):
if ($costArr != "" && $costArr != "Gesamtsumme"):
$ascii_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\n\nLfd. Nr.:\t\t\t$job_cnt\n" .
"Auftr.-Nr.:\t\t\t$tmp_jb_id\n" .
"Erfasser:\t$tmp_order_name\n" .
// "Besteller (Fa., Name):\t$tmp_order_name\n" .
"Bestelldatum:\t\t$tmp_ordertime\n" .
"Erledigt:\t\t\t$tmp_finishtime\n" .
"\n$tmp_srv_name")));
else:
if ($costArr != "Gesamtsumme"):
$ascii_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\t" . tabExpand(str_replace("&euro;", "EUR", strip_tags($tmp_srv_name))) . "$tmp_price\n")));
else:
$ascii_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\n\n" . tabExpand(strip_tags($tmp_srv_name)) . "$tmp_price\n")));
endif;
endif;
elseif ($target == "csv"):
if ($costArr != "" && $costArr != "Gesamtsumme"):
$csv_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\"$tmp_cr_id\"\t\"$tmp_jb_id\"\t\"$tmp_order_name\"\t" .
"\"$tmp_ordertime\"\t\"$tmp_finishtime\"\n$tmp_srv_name")));
else:
if ($costArr != "Gesamtsumme"):
$csv_text .= strip_tags(str_replace("&nbsp;", " ", str_replace("<br>", " ",
"\"$tmp_cr_id\"\t\"$tmp_jb_id\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"" .
strip_tags($tmp_srv_name) . "\"\t\"$tmp_price\"\n")));
endif;
endif;
endif;
endif;
}
function tabExpand($aStr)
{
$tabCnt = ceil((48 - strlen($aStr)) / 6);
$tabStr = "";
for ($k = 1; $k <= $tabCnt; $k++) { $tabStr .= "\t"; }
return ($aStr . $tabStr);
}
?>

View File

@@ -0,0 +1,185 @@
<?php
/*=======================================================================
*
* inv_details.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/global.inc.php");
include_once("../include/auth.inc.php");
include_once("../include/caglobal.inc.php");
include_once("inv.inc.php");
include_once("inv_aux.inc.php");
// TOBEDONE:
// - csc_inv_interval (Rechnungsuntervall)
// - csc_inv_type (Art der Rechnungstellung)
// Verschiedene Sortierungen
// Rechnungslauf für headquarter
if ($usr_type == 2):
// customer (employee)
if ($csc_id == ""): reportDie ("$PHP_SELF: Parameter 'csc_id' fehlt", false); endif;
elseif ($usr_type == 1 || $usr_type == 0):
// headquarter and sysadmin see all jobs of current customer
if ($csc_id != "" && $csc_id != "undefined"):
$cs_id = getFieldValueFromId("costcenter", "csc_id", "$csc_id", "cs_id");
else:
$_tableHeader_ = "&nbsp;<br><center><b>Bitte links einen Kunden ausw&auml;hlen!</b></center>";
$_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_ =
"<td align=\"center\" colspan=\"8\">" .
"<span class=\"verysmall\"> &nbsp;<br>&nbsp;<br></span>" .
"<b>$csc_name" .
(($jb_costcenter == "2") ? " (inkl. untergeordnete KST)" : "") .
"</b><br><br>";
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;
?>
<html>
<head>
<title>AUFTR&Auml;GE</title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<!--
<link rel="stylesheet" type="text/css" href="../css/phoenix-print.css">
-->
<script src="../include/lib_global.js" type="text/javascript">
</script>
<script type="text/javascript">
<!--
function initForm()
{
if (top.frames.length <= 0)
{
alert ("Diese Seite ist Bestandteil eines Framesets und kann nicht direkt aufgerufen werden!\n\n" +
"Bitte rufen Sie den entsprechenden Menüpunkt auf, damit die Inhalte dieser Seite im dazugehörigen Kontext angezeigt werden können."
);
var newURL = String(window.location.protocol) + "//" + String(window.location.hostname) + String(window.location.pathname);
newURL = newURL.replace(/invoice\/inv_details.php/, "admin/start.php");
window.location.href = newURL;
return;
}
parent.frames[0].csc_id = <?php echo $_csc_id_;?>
}
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
<style type="text/css">
<!--
.verysmall
{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 2pt; font-weight: normal; padding: 0px}
-->
</style>
</head>
<body onload="initForm()">
<table border="0" width="100%" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr>
<td>
&nbsp;
</td>
<td align="center">
<table width="100%" align="left" cellspacing="0" cellpadding="4" vspace="0" hspace="0">
<tr>
<?php echo $_tableHeader_;?>
</tr>
<?php echo $content;?>
<tr>
<td>
&nbsp;
</td>
</tr>
</table>
</td>
<td>
&nbsp;
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,197 @@
<?php
/*=======================================================================
*
* inv_courier.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/global.inc.php");
include_once("../include/auth.inc.php");
include_once("../include/caglobal.inc.php");
include_once("inv.inc.php");
include_once("inv_aux.inc.php");
// TOBEDONE: Link auf Auftragsdetails (Popup)
// - include Start/Ziel
// - make it sortable
$hq_id = $HTTP_SESSION_VARS['hq_id'];
$hq_cmp_id = getFieldValueFromId("headquarters", "hq_id", "$hq_id", "cmp_id");
$hq_cmp_comp = getFieldValueFromId("company", "cmp_id", "$hq_cmp_id", "cmp_comp");
$usr_id = $HTTP_SESSION_VARS['usr_id'];
$usr_type = getFieldValueFromId("user", "usr_id", "$usr_id", "usr_type");
if ($usr_type == 3):
$cr_id = getFieldValueFromId("courier", "usr_id", "$usr_id", "cr_id");
$cr_sid = getFieldValueFromId("courier", "usr_id", "$usr_id", "cr_sid");
$cmp_id = getFieldValueFromId("courier", "usr_id", "$usr_id", "cmp_id");
else:
reportDie ("$PHP_SELF: Ungültiger 'usr_type': '$usr_type'", false);
endif;
// find all finished jobs for current courier
// finished jobs in the table 'job' aren't invoiced yet,
// invoiced jobs live in jobhistory (happy until they die...)
$jb_status = 2;
if (INV_SHOW_JB_CR_REMARK == "1"):
list ($jb_status, $jb_id, $jb_cr_remark) = getHttpVars(array("jb_status", "jb_id", "jb_cr_remark"));
if ($jb_status == "")
$jb_status = 2;
if ($jb_id != ""):
$sqlStmt = "UPDATE job SET jb_cr_remark = '$jb_cr_remark' WHERE jb_id = '$jb_id'";
$result = $db->query($sqlStmt);
if (DB::isError($result))
reportDie ("$PHP_SELF: <br>$sqlStmt<br>" . $result->getMessage());
endif;
endif;
$cmp_name = getFieldValueFromId("company", "cmp_id", "$cmp_id", "cmp_comp");
$tableHeader =
"<td align=\"center\" colspan=\"8\"><b>$cmp_name, $hq_cmp_comp: " . ($jb_status == 1 ? "Laufende" : "Erledigte") . " Auftr&auml;ge" .
"</b><br><br>";
$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");
?>
<html>
<head>
<title>AUFTR&Auml;GE</title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<!--
<link rel="stylesheet" type="text/css" href="../css/phoenix-print.css">
-->
<script src="../include/lib_global.js" type="text/javascript"></script>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script type="text/javascript">
<!--
function initForm()
{
if (top.frames.length <= 0)
{
alert ("Diese Seite ist Bestandteil eines Framesets und kann nicht direkt aufgerufen werden!\n\n" +
"Bitte rufen Sie den entsprechenden Menüpunkt auf, damit die Inhalte dieser Seite im dazugehörigen Kontext angezeigt werden können."
);
var newURL = String(window.location.protocol) + "//" + String(window.location.hostname) + String(window.location.pathname);
newURL = newURL.replace(/invoice\/inv_details_cr.php/, "admin/start.php");
window.location.href = newURL;
return;
}
parent.frames[0].csc_id = "courier";
}
function mkJb_cr_remark(form_id_hide,form_id_show) {
myhide(form_id_hide);
myshow(form_id_show);
// $(form_id_hide).hide();
// $(form_id_show).show();
};
function doDelete(elem_id){
document.getElementById(elem_id).value = "";
}
function doSave(form_id){
document.getElementById(form_id).submit();
}
// Quelle: http://www.nak-webmaster.de/modules.php?name=News&file=article&sid=71\n" +
function countDigits(elem_id){
var maxDigits = 255; //maximale Zeichenanzahl
if (document.getElementById(elem_id).value.length > maxDigits - 1) {
//die folgende Zeile entfernt alle Zeichen die > maxDigits sind
document.getElementById(elem_id).value = document.getElementById(elem_id).value.substring(0, maxDigits);
}
}
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
<style type="text/css">
<!--
.verysmall
{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 2pt; font-weight: normal; padding: 0px}
-->
</style>
</head>
<body onload="initForm()">
<table border="0" width="100%" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr>
<td>
&nbsp;
</td>
<td align="center">
<table width="100%" align="left" cellspacing="0" cellpadding="4" vspace="0" hspace="0">
<tr>
<?php echo $tableHeader;?>
</tr>
<?php echo $content;?>
<tr>
<td>
&nbsp;
</td>
</tr>
</table>
</td>
<td>
&nbsp;
</td>
</tr>
</table>
</body>
</html>

396
html/invoice/inv_header.php Normal file
View File

@@ -0,0 +1,396 @@
<?php
/*=======================================================================
*
* job_header.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/global.inc.php");
include_once("../include/caglobal.inc.php");
include_once("../include/global.inc.php");
include_once("../include/auth.inc.php");
include_once("inv.inc.php");
$pageTitel = "RECHNUNGS&Uuml;BERSICHT";
if ($usr_type == 3)
$pageTitel = "AUFTR&Auml;GE";
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// customer or headquarter?
//$filter_costcenter_disabled = "disabled";
$costcenter_disabled_start = "";
$costcenter_disabled_end = "";
$_csc_id_ = "";
$_cs_eid_ = "&nbsp; ExtID:&nbsp;<input type=\"text\" class=\"f8np1\" name=\"cs_eid\" value=\"\" size=\"8\"> " .
"&nbsp;Kundenname:&nbsp;<input type=\"text\" class=\"f8np1\" name=\"cmp_name\" value=\"\" size=\"12\">";
$_show_invoice_text_ =
"&nbsp;&nbsp;<input type=\"checkbox\" name=\"show_invoice_text\" value=\"1\" title=\"Kundenrechnungstext für jeden Auftrag anzeigen\">&nbsp;Rechnungstext&nbsp;anzeigen\n";
if ($usr_type == 2):
// customer (employee)
// if ($csc_id == "") reportDie ("$PHP_SELF: Parameter 'csc_id' fehlt", false);
$cmp_id = getFieldValueFromId("customer", "cs_id", "$cs_id", "cmp_id");
$cmp_comp = getFieldValueFromId("company", "cmp_id", "$cmp_id", "cmp_comp");
$csc_name = getFieldValueFromId("costcenter", "csc_id", "$csc_id", "csc_name");
$kundenname = "$cmp_comp, Kostenstelle $csc_name";
// $filter_costcenter_disabled = "";
$_cs_eid_ = "";
$_show_invoice_text_ = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
elseif ($usr_type == 1):
// sysadmin
$cmp_id = getFieldValueFromId("headquarters", "hq_id", "$hq_id", "cmp_id");
$cmp_comp = getFieldValueFromId("company", "cmp_id", "$cmp_id", "cmp_comp");
$kundenname = "Zentrale $cmp_comp";
elseif ($usr_type == 0):
// headquarter
$kundenname = "Systemadministrator";
elseif ($usr_type == 3):
// courier
$costcenter_disabled_start = "<!--";
$costcenter_disabled_end = "-->";
$_csc_id_ = "courier";
$_cs_eid_ = "";
if (INV_SHOW_JB_CR_REMARK == "1"):
$_cs_eid_ = "&nbsp;&nbsp;&nbsp;Auftragsstatus:<input type=\"radio\" name=\"jb_status\" value=\"2\" checked>erledigt&nbsp;<input type=\"radio\" name=\"jb_status\" value=\"1\">laufend";
endif;
if (INV_SHOW_INVOICE_TEXT != "1"):
$_show_invoice_text_ = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
endif;
$courierListOptions = "";
if (INV_SHOW_CR_ID_PARENT == "1"):
$cr_id = getFieldValueFromId("courier", "usr_id", "$usr_id", "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());
$cr_id_clause = $cr_id;
while ($row = $res->fetch_assoc()):
$cr_id_clause .= "," . $row['cr_id'];
endwhile;
$res->free();
// Kuriere zusammenstellen, damit danach selektiert werden kann
$sqlquery = "SELECT crvh_sid FROM couriervehicle WHERE cr_id IN ($cr_id_clause) ORDER BY crvh_sid";
$res = $db->query($sqlquery);
if (DB::isError($res)) reportDie ("$PHP_SELF: '$sqlquery': " . $res->getMessage());
$courierListOptions = "Fahrzeug: <select class=\"f8np1\" name=\"cr_sid\">\n<option value=\"all\">alle</option>\n";
while ($row = $res->fetch_assoc()):
$courierListOptions .= "<option value=" . $row["crvh_sid"] . ">" . $row["crvh_sid"] . "</option>\n";
endwhile;
$res->free();
$courierListOptions .= "</select>\n";
$_cs_eid_ = $courierListOptions . $_cs_eid_;
endif;
else:
reportDie ("$PHP_SELF: Ungültiger 'usr_type': '$usr_type'", false);
endif;
//include_once("../include/calendar.inc.php");
//$day_to = date("d");
//$month_to = date("m");
//$year_to = date("Y");
//list($year_from, $month_from) = addMonths($year_to, $month_to, -1);
//$day_from = $day_to + 1;
//if (daysPerMonth($year_from, $month_from) < $day_from)
// $day_from = daysPerMonth($year_from, $month_from);
$day_to = date("d");
$day_from = 1;
$month_to = date("m");
$month_from = $month_to;
$year_to = date("Y");
$year_from = $year_to;
$_js_date_ = " fillDateFields(1,\"inv_header\",\"invoiceOptions\",\"\",\"day_from\",\"month_from\",\"year_from\",\"\",\"\",\"\");\n";
$_js_date_ .= " setDateTimeFields(\"inv_header\",\"invoiceOptions\",".$day_from.",".$month_from.",".$year_from.", \"\", \"\", \"day_from\", \"month_from\", \"year_from\", \"\", \"\", \"\");\n";
$_js_date_ .= " fillDateFields(0, 'inv_header', 'invoiceOptions', 'year_from', 'day_from', 'month_from', 'year_from', '', '', '');\n";
$_js_date_ .= " fillDateFields(1,\"inv_header\",\"invoiceOptions\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
$_js_date_ .= " setDateTimeFields(\"inv_header\",\"invoiceOptions\",".$day_to.",".$month_to.",".$year_to.", \"\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
$_js_date_ .= " fillDateFields(0, 'inv_header', 'invoiceOptions', 'year_to', 'day_to', 'month_to', 'year_to', '', '', '');\n";
//$_js_date_ .= ($_csc_id_ != "" ? " csc_id = \"$_csc_id_\"\n" : "");
list ($jb_costcenter) = getHttpVars(array("jb_costcenter"));
$filter_costcenter = addOptionsFromTable("metatype", "mt_sort", "mt_value", "mt_sort",
"mt_type = 'job_costcenter'", 2);
//$title = "&Uuml;bersicht der Rechnungsdaten";
?>
<html>
<head>
<title><?php echo $pageTitel; ?></title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
<?php include_once ("../css/navigation.css.php"); ?>
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script src="../include/lib_global.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
<?php echo $jsMenuOut; ?>
/* csc_id muss nach jedem Reload von 'inv_details.php' angepasst werden */
var csc_id = "<?php echo $_csc_id_; ?>";
var inv_list_params = "";
var prev_cs_eid = "";
var prev_cmp_name = "";
function initForm()
{
if (top.frames.length <= 0)
{
alert ("Diese Seite ist Bestandteil eines Framesets und kann nicht direkt aufgerufen werden!\n\n" +
"Bitte rufen Sie den entsprechenden Menüpunkt auf, damit die Inhalte dieser Seite im dazugehörigen Kontext angezeigt werden können."
);
var newURL = String(window.location.protocol) + "//" + String(window.location.hostname) + String(window.location.pathname);
newURL = newURL.replace(/invoice\/inv_header.php/, "admin/start.php");
window.location.href = newURL;
return;
}
/*
Initialisierung der Datumsfelder
fillDateFields(init, frameIdx, formIdx, callerIdx, dayIdx, monIdx, yearIdx, hourIdx, minuteIdx, rhythmIdx)
*/
<!--
<?php echo $_js_date_; ?>
for (var i = 0; i < document.links.length; i++) {
curHref = document.links[i].getAttribute('href');
if (curHref.indexOf("currentNavigationItem") != -1)
document.links[i].setAttribute("target", "_top", "false");
}
Event.observe('page_headline', 'click', function() {
// var rows = document.getElementById("winInvoice").rows;
// var myHeight = Number(rows.substr(0, rows.indexOf(",") - 1));
var myHeight = 125
+ (((csc_id != "courier" && parent.document.body.clientWidth < 1400) || (csc_id == "courier" && parent.document.body.clientWidth < 1200)) ? 25 : 0)
- ($('menu').visible() ? 0 : 65);
parent.document.getElementById("winInvoice").rows = String(myHeight) + ",*";
});
/*
Die aktuellen Werte der Datumsfelder werden von inv_details.php gesetzt!
*/
}
function finishPageDoIt(csc_id_param)
{
var addParams = "";
var selectedCr_sid = "";
var selectedJb_status = "";
var selected_show_invoice_text = "";
if (typeof document.invoiceOptions.show_invoice_text != "undefined")
selected_show_invoice_text = document.invoiceOptions.show_invoice_text.checked;
if (csc_id != "courier") // nur wenn csc_id auch wirklich eine verschlüsselte Kostenstellennumer enthält
{
if (csc_id_param == 0) csc_id_param = csc_id;
if (typeof document.invoiceOptions.cs_eid != "undefined")
addParams = "&cs_eid=" + document.invoiceOptions.cs_eid.value;
if (typeof document.invoiceOptions.cmp_name != "undefined")
addParams = addParams + "&cmp_name=" + document.invoiceOptions.cmp_name.value;
parent.frames[2].location.href="inv_details.php" +
"?csc_id=" + csc_id_param +
"&day_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'day_from') +
"&month_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'month_from') +
"&year_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'year_from') +
"&day_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'day_to') +
"&month_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'month_to') +
"&year_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'year_to') +
"&jb_costcenter=" + getSelectedVal('inv_header', 'invoiceOptions', 'jb_costcenter_select') +
"&show_invoice_text=" + selected_show_invoice_text +
addParams +
"&dbhistory=" + document.invoiceOptions.dbhistory.value;
} else {
if (typeof document.invoiceOptions.cr_sid != "undefined")
selectedCr_sid = getSelectedVal('inv_header', 'invoiceOptions', 'cr_sid');
if (typeof document.invoiceOptions.jb_status != "undefined") {
if (document.invoiceOptions.jb_status[0].checked)
selectedJb_status = document.invoiceOptions.jb_status[0].value;
if (document.invoiceOptions.jb_status[1].checked)
selectedJb_status = document.invoiceOptions.jb_status[1].value;
}
parent.frames[1].location.href="inv_details_cr.php" +
"?csc_id=" + csc_id_param +
"&day_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'day_from') +
"&month_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'month_from') +
"&year_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'year_from') +
"&day_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'day_to') +
"&month_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'month_to') +
"&year_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'year_to') +
"&cr_sid=" + selectedCr_sid +
"&jb_status=" + selectedJb_status +
"&show_invoice_text=" + selected_show_invoice_text +
"&dbhistory=" + document.invoiceOptions.dbhistory.value +
"&deactivateMenu=1";
}
}
function finishPageDoItFull()
{
var addParams = "";
if (csc_id == "courier") {
finishPageDoIt(0);
return;
}
if (typeof document.invoiceOptions.cs_eid != "undefined")
{
addParams = "&cs_eid=" + document.invoiceOptions.cs_eid.value;
if (prev_cs_eid != document.invoiceOptions.cs_eid.value)
{
prev_cs_eid = document.invoiceOptions.cs_eid.value;
csc_id = "";
}
}
if (typeof document.invoiceOptions.cmp_name != "undefined")
{
addParams = addParams + "&cmp_name=" + document.invoiceOptions.cmp_name.value;
if (prev_cmp_name != document.invoiceOptions.cmp_name.value)
{
prev_cmp_name = document.invoiceOptions.cmp_name.value;
csc_id = "";
}
}
parent.frames[1].location.href="inv_list.php" +
"?day_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'day_from') +
"&month_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'month_from') +
"&year_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'year_from') +
"&day_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'day_to') +
"&month_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'month_to') +
"&year_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'year_to') +
"&start=" + csc_id +
inv_list_params +
addParams +
"&dbhistory=" + document.invoiceOptions.dbhistory.value;
}
function finishPage(csc_id_param)
{
// var csc_id = csc_id_param;
// wg. Timingproblemen wird eine Pause von 100 Millisekunden zwischengeschaltet
setTimeout("finishPageDoIt('" + csc_id_param + "')", 100);
}
function finishPageFull()
{
setTimeout("finishPageDoItFull()", 200);
}
function show_history()
{
if (getSelectedVal('inv_header', 'invoiceOptions', 'cr_sid') == "all") {
alert("Bitte ein Fahrzeug wählen!");
} else {
parent.frames[1].location.href="crHistoryUN.php" +
"?day_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'day_from') +
"&month_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'month_from') +
"&year_from=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'year_from') +
"&day_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'day_to') +
"&month_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'month_to') +
"&year_to=" + getSelectedNumVal('inv_header', 'invoiceOptions', 'year_to') +
"&cr_sid=" + getSelectedVal('inv_header', 'invoiceOptions', 'cr_sid');
}
}
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
<style type="text/css">
<!--
.verysmall
{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 2pt; font-weight: normal; padding: 0px}
-->
</style>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>initForm();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<div style="float:left;">
<form name="invoiceOptions" action="inv_details.php" method="post" target="inv_details">
<?php echo $costcenter_disabled_start ?>
<div style="float:left; padding-top:5px;">
<select class="f8np1" name="jb_costcenter_select" <?php echo isset($filter_costcenter_disabled) ? $filter_costcenter_disabled : ""; ?>>
<?php echo $filter_costcenter ?>
</select>
</div>
<?php echo $costcenter_disabled_end ?>
<div style="float:left; padding-top:5px;">
<?php echo $_cs_eid_ ?>
</div>
</div>
<div style="float:right;">
<div style="float:left; padding-top:5px;">
&nbsp;&nbsp;Datum erledigt von:&nbsp;
<select name="day_from" class="f8np1"
onchange="fillDateFieldsCheck(0, 'inv_header', 'invoiceOptions', 'day_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')">
</select>
<select name="month_from" class="f8np1"
onchange="fillDateFieldsCheck(0, 'inv_header', 'invoiceOptions', 'month_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')">
</select>
<select name="year_from" class="f8np1"
onchange="fillDateFieldsCheck(0, 'inv_header', 'invoiceOptions', 'year_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')">
</select>
&nbsp;bis:&nbsp;
<select name="day_to" class="f8np1"
onchange="fillDateFieldsCheck(0, 'inv_header', 'invoiceOptions', 'day_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')">
</select>
<select name="month_to" class="f8np1"
onchange="fillDateFieldsCheck(0, 'inv_header', 'invoiceOptions', 'month_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')">
</select>
<select name="year_to" class="f8np1"
onchange="fillDateFieldsCheck(0, 'inv_header', 'invoiceOptions', 'year_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')">
</select>
<input type="hidden" name="dbhistory" value="<?php echo isset($_db_history) ? $_db_history : ""; ?>">
</div>
<div style="float:left; padding-top:5px;">
<?php echo $_show_invoice_text_ ?>
</div>
<div style="float:left; padding-top:5px;">
&nbsp;&nbsp;
</div>
<div style="float:left; padding-top:5px;">
<?php echo defineButton("Anzeigen", "submit", "finishPageFull()", "left", "", "", "", "", "", "", "", "10pt", "", "", "", "Anzeigen (alt+a)", "a", false); ?>
&nbsp;&nbsp;</div>
<div style="float:left; padding-top:5px;">
<?php echo defineButton("Log anzeigen", "submit_log", "show_history()", "left", "", "", "", "", "", "", "", "10pt", "", "", "", "Fahrzeug-Log anzeigen (alt+f)", "f", false); ?>
&nbsp;&nbsp;
</div>
<div style="float:left; padding-top:5px;">
&nbsp;
</div>
</form>
</div>
</div>
</body>
</html>

265
html/invoice/inv_list.php Normal file
View File

@@ -0,0 +1,265 @@
<?php
/*=======================================================================
*
* inv_list.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/global.inc.php");
include_once("../include/auth.inc.php");
include_once("inv.inc.php");
// - Einstellungen für Datum und jb_costcenter
// berücksichtigen bei Link auf 'inv_details'
//list ($csc_id_list) =
getSecHttpVars("1", array("csc_id_list"));
$csc_id_http_list = explode(",", $csc_id_list);
list ($day_from, $month_from, $year_from,
$day_to, $month_to, $year_to, $cs_eid, $cmp_name) =
getHttpVars(array("day_from", "month_from", "year_from",
"day_to", "month_to", "year_to", "cs_eid", "cmp_name"));
if ($day_from == "" || $month_from == "" || $year_from == "" || $day_to == "" || $month_to == "" || $year_to == ""):
// include_once("../include/calendar.inc.php");
// $day_to = date("d");
// $month_to = date("m");
// $year_to = date("Y");
// list($year_from, $month_from) = addMonths($year_to, $month_to, -1);
// $day_from = $day_to + 1;
// if (daysPerMonth($year_from, $month_from) < $day_from)
// $day_from = daysPerMonth($year_from, $month_from);
$day_to = date("d");
$day_from = 1;
$month_to = date("m");
$month_from = $month_to;
$year_to = date("Y");
$year_from = $year_to;
endif;
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2) . " 00:00:00";
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2) . " 23:59:59";
$dateSelectionStmt = " AND ($dbh_jb.jb_finishtime BETWEEN '$fromDateRange' AND '$toDateRange')";
$dateParms =
"&day_from=".$day_from."&month_from=".$month_from."&year_from=".$year_from."&day_to=".$day_to."&month_to=".$month_to."&year_to=".$year_to;
if ($usr_type != 2):
// for (usr_type == 2) the list was already made in 'inv.inc.php'
mkCsc_id_customer_list_complete(1);
endif;
$csc_id_customer_list_hasChildrenList = array();
$content = "";
$_csc_id_finish_page_start_ = "";
mkCostcenterList();
function mkCostcenterList()
{
global $csc_id_customer_list, $csc_id, $usr_type,
$content, $_csc_id_finish_page_start_, $_inv_list_params_;
$timeofday1 = gettimeofday();
//echo $timeofday1["sec"] . "." . sprintf("%06d", $timeofday1["usec"]) . "<br>";
// mkCsc_id_customer_list_complete();
mkCsc_id_customer_list();
//print_r($csc_id_customer_list);
if ($usr_type == 2):
for ($i = 0; $i < count($csc_id_customer_list); $i++):
// echo $csc_id_customer_list[$i]["csc_id"] . " == $csc_id . <br>";
if ($csc_id_customer_list[$i]["csc_id"] == $csc_id):
// save parent of costcenter of current user for
// the starting point of the tree
$csc_id_start_parent = $csc_id_customer_list[$i]["csc_pre_id"];
$csc_id_start_only = $csc_id_customer_list[$i]["csc_id"];
$csc_id_finish_page_start = $csc_id_customer_list[$i]["csc_id"];
break;
endif;
endfor;
else:
// usr_type 0 and 1
$csc_id_start_parent = "";
$csc_id_start_only = "";
$csc_id_finish_page_start = "";
for ($i = 0; $i < count($csc_id_customer_list); $i++):
if ($csc_id_customer_list[$i]["csc_pre_id"] == ""):
$csc_id_finish_page_start = $csc_id_customer_list[$i]["csc_id"];
break;
endif;
endfor;
endif;
if (count($csc_id_customer_list) == 0):
$content .= "&nbsp;<br><b>(Keine Kunden gefunden)</br>";
else:
mkCsc_id_customer_listHasChildrenList();
writeCostcenterList($csc_id_start_parent, $csc_id_start_only, "");
$csc_id_finish_page_start = ec($csc_id_finish_page_start);
list($start) = getHttpVars(array("start"));
if ($start != "")
$csc_id_finish_page_start = $start;
list($csc_id_param, $csc_id_list_param) = getHttpVars(array("csc_id", "csc_id_list"));
if ($csc_id_param == "")
$csc_id_param = $csc_id_finish_page_start;
$_csc_id_finish_page_start_ = $csc_id_finish_page_start;
$_inv_list_params_ = "&csc_id=$csc_id_param&csc_id_list=$csc_id_list_param";
endif;
}
function writeCostcenterList($csc_id_show_parent, $csc_id_show_only, $depth_str)
{
global $content, $cs_id, $csc_id, $csc_id_customer_list, $csc_id_http_list, $csc_id_list,
$csc_id_customer_list_hasChildrenList, $dateParms, $cs_eid, $cmp_name;
// write costcenterlist of current parent
// (being the first element in costcenter path list)
for ($i = 0; $i < count($csc_id_customer_list); $i++):
$followup = false;
//echo ("$i '" . $csc_id_show_parent . "' '" . $csc_id_customer_list[$i]["csc_pre_id"]) . "'<br>";
if ($csc_id_customer_list[$i]["csc_pre_id"] == $csc_id_show_parent &&
($csc_id_show_only == "" || $csc_id_customer_list[$i]["csc_id"] == $csc_id_show_only)):
// current costcenter is child of csc_id to be shown
if (in_array($csc_id_customer_list[$i]["csc_id"], $csc_id_http_list)):
// current costcenter has previously been opened by click
// - it gets the "can be closed"-mark
// (below, showing its children follows)
$childrenlink =
"<a href=\"$PHP_SELF?csc_id=" . ec($csc_id) . "&csc_id_list=" .
ec(trim(
str_replace("," . $csc_id_customer_list[$i]["csc_id"] . ",", ",", "," . $csc_id_list . ","),
",")) .
"$dateParms&cs_eid=$cs_eid&cmp_name=$cmp_name&start=" . $csc_id_customer_list[$i]["csc_id"] . "#$i\"><img src=\"../images/m.gif\" border=0></a>";
$followup = true;
elseif ($csc_id_customer_list_hasChildrenList[$csc_id_customer_list[$i]["csc_id"]] == true):
// current costcenter has children but is not opened
// - it gets the "can be opened"-mark
$childrenlink =
"<a href=\"$PHP_SELF?csc_id=" . ec($csc_id) . "&csc_id_list=" .
ec($csc_id_list .
(($csc_id_list == "") ? "" : ",") .
$csc_id_customer_list[$i]["csc_id"]) .
"$dateParms&cs_eid=$cs_eid&cmp_name=$cmp_name&start=" . $csc_id_customer_list[$i]["csc_id"] . "#$i\"><img src=\"../images/p.gif\" border=0></a>";
else:
// current costcenter has no children
// it gets the "cannot be opened" - mark
$childrenlink = "<img src=\"../images/o.gif\">";
endif;
// write current costcenter
// calling inv_details.php shall not forget the options set
// in the header-frame
$content .= "<tr><td align=\"left\">" .
"<a name=\"$i\">" . $depth_str . "</a>" . $childrenlink .
"&nbsp;<a href=\"javascript:finishPage('" .
ec($csc_id_customer_list[$i]["csc_id"]) . "')\">" .
$csc_id_customer_list[$i]["csc_name"] . "</a>" .
"</td></tr>\n";
// echo "$i: " . ($csc_id_customer_list[$i]["csc_id"]) . "<br>";
// if current costcenter is opened, continue there
if ($followup):
writeCostcenterList($csc_id_customer_list[$i]["csc_id"], "" ,$depth_str . "&nbsp;&nbsp;&nbsp;");
endif;
else:
endif;
endfor;
}
//function getCostcenterParentList($csc_id_child)
//{
// global $csc_id_root, $csc_id_customer_list;
//
// if ($csc_id_child == $csc_id_root)
// return "";
// for($i = 0; $i < count($csc_id_customer_list); $i++):
// if ($csc_id_customer_list[$i]["csc_id"] == $csc_id_child)
// return $csc_id_customer_list[$i]["csc_pre_id"] . " " .
// getCostcenterParentList($csc_id_customer_list[$i]["csc_pre_id"]);
// endfor;
//}
function mkCsc_id_customer_listHasChildrenList()
{
global $csc_id_customer_list, $csc_id_customer_list_hasChildrenList;
for($i = 0; $i < count($csc_id_customer_list); $i++):
$csc_id_customer_list_hasChildrenList[$csc_id_customer_list[$i]["csc_id"]] = false;
endfor;
for($i = 0; $i < count($csc_id_customer_list); $i++):
$csc_id_customer_list_hasChildrenList[$csc_id_customer_list[$i]["csc_pre_id"]] = true;
endfor;
}
//function costcenterHasChildren($csc_id_parent)
//{
// global $csc_id_customer_list;
//echo date("H:i:s") . "<br>";
// for($i = 0; $i < count($csc_id_customer_list); $i++):
// if ($csc_id_customer_list[$i]["csc_pre_id"] == $csc_id_parent)
// return true;
// endfor;
// return false;
//}
?>
<html>
<head>
<title>KUNDEN</title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<script type="text/javascript">
<!--
function finishPage(csc_id)
{
// parent.frames[0].csc_id = csc_id;
parent.frames[0].finishPage(csc_id);
// parent.frames[0].finishPage(csc_id);
return;
}
function init(csc_id, inv_list_params)
{
parent.frames[0].inv_list_params = inv_list_params;
if (csc_id != 0 && csc_id != "____") {
finishPage(csc_id);
}
return;
}
if (top.frames.length <= 0)
{
alert ("Diese Seite ist Bestandteil eines Framesets und kann nicht direkt aufgerufen werden!\n\n" +
"Bitte rufen Sie den entsprechenden Menüpunkt auf, damit die Inhalte dieser Seite im dazugehörigen Kontext angezeigt werden können."
);
var newURL = String(window.location.protocol) + "//" + String(window.location.hostname) + String(window.location.pathname);
newURL = newURL.replace(/invoice\/inv_list.php/, "admin/start.php");
window.location.href = newURL;
}
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body onload="init('<?php echo $_csc_id_finish_page_start_;?>','<?php echo $_inv_list_params_;?>')">
<table border=0 width=100% cellspacing=0 cellpadding=0 vspace=0 hspace=0>
<tr>
<td>
&nbsp;
</td>
<td align="center">
<table border=0 width=100% cellspacing=0 cellpadding=0 vspace=0 hspace=0>
<?php echo $content;?>
</table>
</td>
<td>
&nbsp;
</td>
</tr>
</table>
</body>
</html>

63
html/invoice/invoice.php Normal file
View File

@@ -0,0 +1,63 @@
<?php
/*=======================================================================
*
* invoice.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/global.inc.php");
include_once("../include/caglobal.inc.php");
include_once("../include/auth.inc.php");
list ($csc_id, $currentNavigationItem, $customerId, $cscIdRoot, $cscIdActual) = getHttpVars(array("csc_id", "currentNavigationItem", "customerId", "cscIdRoot", "cscIdActual"));
// Get the rights of the employee logged in and check the accessibility
if (!authCheckEmployeeRights($emp_id, "5")) : reportDie ("$PHP_SELF: Access denied!", false); endif;
list ($csc_id) = getHttpVars(array("csc_id"));
$usr_id = $HTTP_SESSION_VARS['usr_id'];
$usr_type = getFieldValueFromId("user", "usr_id", "$usr_id", "usr_type");
if ($usr_type == 2):
// customer (employee)
if ($csc_id == ""):
$csc_id = getFieldValueFromId("employee", "usr_id", $usr_id, "csc_id");
endif;
elseif ($usr_type == 1 || $usr_type == 0):
// headquarter or sysadmin
$csc_id = "";
else:
reportDie ("$PHP_SELF: Ungültiger 'usr_type': '$usr_type'", false);
endif;
?>
<html>
<head>
<title>RECHNUNGS&Uuml;BERSICHT</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Rechnungsdaten">
<script type="text/javascript">
function checkWidth (curWidth) {
if (document.body.clientWidth < 1400) {
document.getElementById("winInvoice").rows = "150,*";
}
}
</script>
</head>
<frameset id="winInvoice" rows="125,*" border=0 onLoad="checkWidth()">
<!-- BEGIN csc_id_ -->
<frame src="inv_header.php?csc_id=<?php echo $csc_id;?>&currentNavigationItem=<?php echo $currentNavigationItem;?>&customerId=<?php echo $customerId;?>&cscIdRoot=<?php echo $cscIdRoot;?>&cscIdActual=<?php echo $cscIdActual;?>" name="inv_header" scrolling="no" marginwidth=0 marginheight=0>
<frameset cols="25%,75%" border=0>
<frame src="inv_list.php?csc_id=<?php echo $csc_id;?>&csc_id_list=" name="inv_list" scrolling="yes" marginwidth=0 marginheight=0>
<frame src="inv_details.php?csc_id=<?php echo $csc_id;?>" name="inv_details" scrolling="yes" marginwidth=0 marginheight=0>
</frameset>
<!-- END csc_id_ -->
<noframes>
<p>Diese Seite benutzt Frames. Bitte benutzen Sie einen Browser, der Frames darstellen kann
(z.B. Internet Explorer ab Version 3.0 oder Netscape ab Version 2.0).</p>
</noframes>
</frameset>
</html>

View File

@@ -0,0 +1,46 @@
<?php
/*=======================================================================
*
* invoice.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/global.inc.php");
include_once("../include/caglobal.inc.php");
include_once("../include/auth.inc.php");
list ($csc_id, $currentNavigationItem) = getHttpVars(array("csc_id","currentNavigationItem"));
$usr_id = $HTTP_SESSION_VARS['usr_id'];
$usr_type = getFieldValueFromId("user", "usr_id", "$usr_id", "usr_type");
if ($usr_type != 3):
// no courier
reportDie ("$PHP_SELF: Ungültiger 'usr_type': '$usr_type'", false);
endif;
?>
<html>
<head>
<title>AUFTR&Auml;GE</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Auftr&auml;ge">
<script type="text/javascript">
function checkWidth (curWidth) {
if (document.body.clientWidth < 1200) {
document.getElementById("winInvoice").rows = "150,*";
}
}
</script>
</head>
<frameset id="winInvoice" rows="125,*" border=0 onLoad="checkWidth()">
<frame src="inv_header.php?currentNavigationItem=<?php echo $currentNavigationItem;?>" name="inv_header" scrolling="no" marginwidth=0 marginheight=0>
<frame src="inv_details_cr.php?deactivateMenu=1" name="inv_details_cr" scrolling="yes" marginwidth=0 marginheight=0>
<noframes>
<p>Diese Seite benutzt Frames. Bitte benutzen Sie einen Browser, der Frames darstellen kann
(z.B. Internet Explorer ab Version 3.0 oder Netscape ab Version 2.0).</p>
</noframes>
</frameset>
</html>