<?php     

// TEST-SETE CO2e


include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../tools/co2e_sendReq.php");


// Check HTTP-Parameters
getSecHttpVars("1",array("jbId", "deactivateMenu"));

$deactivateMenu = "1";


$out = "";
if ($jbId != "" && is_numeric($jbId) && $jbId > "0") :
   
   $rspArr = sendReqCO2($jbId);

   $out .= "CO2e-Wert:&nbsp;&nbsp;<b>" . $rspArr[0] . "</b><br><br>";
   $out .= "Referenz:&nbsp;&nbsp;<b>" . $rspArr[3] . "</b>&nbsp;&nbsp;&nbsp;&nbsp;[Muss der Eingabe (Auftragsnummer) entsprechen, da Ausgabe hier aus der Server-Antwort]<br><br>";
   $out .= "Server-Antwort [JSON]:&nbsp;&nbsp;<b>" . $rspArr[1] . "</b><br><br>";
   // $out .= print_r($rspArr[1]); echo "<br><br>";
   $out .=  "Log-String:&nbsp;&nbsp;" . $rspArr[4] . "<br><br>";
   
   $outArr = getKeyValueArrayFromString($rspArr[4]);
   $out .= "<br>";
   $out .= "<b>Variable Werte für den Request:</b><br><br>";
   $out .= "T : <b>" . $outArr["T"] . "</b>&nbsp;&nbsp;&nbsp;&nbsp;[Angabe in KG, der Teilungsfaktor TF wird server-seitig einbezogen!]<br>";   
   $out .= "KM : <b>" . $outArr["KM"] . "</b><br>";
   $out .= "MLP : <b>" . $outArr["MLP"] . "</b><br>";
   $out .= "<br>";
   $out .= "<b>Stets konstante Werte für den Request:</b><br><br>";
   $out .= "L : " . $outArr["L"] . "<br>";
   $out .= "U : " . $outArr["U"] . "<br>";
   $out .= "TF : " . $outArr["TF"] . "<br>";
   $out .= "<br><br>";
   $out .= "<b>AUSWERTUNG SERVER-ANTWORT</b><br><br>";
   $out .= "<br>";
   $out .= "<b>REQUEST i.O. [OK] oder nicht [NOK]:</b><br><br>";
   $out .= "REQ_STATE : <b>" . $outArr["REQ_STATE"] . "</b><br>";
   $out .= "REQ_ERR_MSG : " . $outArr["REQ_ERR_MSG"] . "<br>";
   $out .= "<br>";
   $out .= "<b>RESPONSE i.O. [OK] oder nicht [NOK]:</b><br><br>";
   $out .= "RSP_STATE : <b>" . $outArr["RSP_STATE"] . "</b><br>";
   $out .= "RSP_ERR_STATE : " . $outArr["RSP_ERR_STATE"] . "<br>";
   $out .= "RSP_ERR_DESC : " . $outArr["RSP_ERR_DESC"] . "<br>";
   $out .= "<br>";
   
   
endif;

?>

<html>

<head>
<title>TESTSEITE CO2e</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">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
-->

</script>

<?php echo $js_date ?>

</head>

<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>initForm();">

<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>


<div class="maincontent" name="maincontent" id="maincontent">

<form name="history" action="../tools/mc_sendReq.php" method="post">

  <?php echo $phpCurrentNavigationInputHidden ?>
  <input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">

  <?php echo htmlDivLineSpacer("5px"); ?> 

  <div>
    <h2>TESTSEITE CO2e</h2>
  </div>
  <?php echo htmlDivLineSpacer("20px", "", "left"); ?>

  <div>
    Auftragsnummer&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="jbId" value="<?php echo $jbId ?>">
  </div>
  <?php echo htmlDivLineSpacer("20px", "", "left"); ?>
  
  <div>
    <?php echo defineButton(getLngt("Aktualisieren"), "action_refresh", "document.forms[0].submit();", "left", "5", "", "", "115px"); ?>
  </div>
  <?php echo htmlDivLineSpacer("30px", "", "left"); ?>
  
  <div>
    <?php echo $out ?>     
  </div>

</form>
</div>
</body>

</html>


