274 lines
8.7 KiB
PHP
274 lines
8.7 KiB
PHP
<?php session_start();
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="pl">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="shortcut icon" href="../images/SoftSPM.ico">
|
|
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
|
<title>Zrzut wody na odprowadzalniki</title>
|
|
|
|
<!-- Bootstrap -->
|
|
<link href="./bootstrap.min.css" rel="stylesheet">
|
|
|
|
</head>
|
|
<body>
|
|
<script src="./jquery.min.js"></script>
|
|
|
|
|
|
<?php
|
|
date_default_timezone_set('Europe/Warsaw');
|
|
require_once("../func.php");
|
|
require_once("../dbaccess.php");
|
|
$polacz = mysql_connect($db_host, $db_user, $db_user_pass) or die ('cannot connect to db');
|
|
mysql_select_db($db_name);
|
|
mysql_query("SET NAMES utf8");
|
|
mysql_query("SET CHARACTER_SET utf8_general_ci");
|
|
?>
|
|
|
|
|
|
<?php
|
|
function cdt($inDate)
|
|
{
|
|
unset($out);
|
|
$out = (float) str_replace(array('-',' '), array('',''), $inDate);
|
|
return $out;
|
|
}
|
|
|
|
function getFullTree($inOdprowadzID)
|
|
{
|
|
unset($outParam);
|
|
unset($counter); $counter=0;
|
|
|
|
//================================================================
|
|
unset($getArray01);
|
|
$getArray01 = sqlGetResAsArray("select WWD_ID,sum(Q_H) QH, sum(Q_MIN) QM from softspm_rep.rep_003_data where WWD_PARENT_ID=".$inOdprowadzID." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' group by WWD_ID ");
|
|
for($i1=0; $i1<count($getArray01); $i1++)
|
|
{
|
|
$counter += (float) $getArray01[$i1]['QM'];
|
|
|
|
//================================================================
|
|
if ($getArray01[$i1]['WWD_ID']>0)
|
|
{
|
|
unset($getArray02);
|
|
$getArray02 = sqlGetResAsArray("select WWD_ID,sum(Q_H) QH, sum(Q_MIN) QM from softspm_rep.rep_003_data where WWD_PARENT_ID=".$getArray01[$i1]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' group by WWD_ID ");
|
|
for($i2=0; $i2<count($getArray02); $i2++)
|
|
{
|
|
$counter += (float) $getArray02[$i2]['QM'];
|
|
|
|
//================================================================
|
|
if ($getArray02[$i2]['WWD_ID']>0)
|
|
{
|
|
unset($getArray03);
|
|
$getArray03 = sqlGetResAsArray("select WWD_ID,sum(Q_H) QH, sum(Q_MIN) QM from softspm_rep.rep_003_data where WWD_PARENT_ID=".$getArray02[$i2]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' group by WWD_ID ");
|
|
for($i3=0; $i3<count($getArray03); $i3++)
|
|
{
|
|
$counter += (float) $getArray03[$i3]['QM'];
|
|
|
|
//================================================================
|
|
if ($getArray03[$i3]['WWD_ID']>0)
|
|
{
|
|
unset($getArray04);
|
|
$getArray04 = sqlGetResAsArray("select WWD_ID,sum(Q_H) QH, sum(Q_MIN) QM from softspm_rep.rep_003_data where WWD_PARENT_ID=".$getArray03[$i3]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' group by WWD_ID ");
|
|
for($i4=0; $i4<count($getArray04); $i4++)
|
|
{
|
|
$counter += (float) $getArray04[$i4]['QM'];
|
|
|
|
//================================================================
|
|
if ($getArray04[$i4]['WWD_ID']>0)
|
|
{
|
|
unset($getArray05);
|
|
$getArray05 = sqlGetResAsArray("select WWD_ID,sum(Q_H) QH, sum(Q_MIN) QM from softspm_rep.rep_003_data where WWD_PARENT_ID=".$getArray04[$i4]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' group by WWD_ID ");
|
|
for($i5=0; $i5<count($getArray05); $i5++)
|
|
{
|
|
$counter += (float) $getArray05[$i5]['QM'];
|
|
}
|
|
}
|
|
//================================================================
|
|
}
|
|
}
|
|
//================================================================
|
|
}
|
|
}
|
|
//================================================================
|
|
}
|
|
}
|
|
//================================================================
|
|
}
|
|
//================================================================
|
|
unset($getArray01);
|
|
unset($getArray02);
|
|
unset($getArray03);
|
|
unset($getArray04);
|
|
unset($getArray05);
|
|
|
|
$outParam = (float) $counter;
|
|
|
|
return $outParam;
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
<div class="panel panel-danger">
|
|
<div class="panel-heading">
|
|
<h3 class="panel-title">Zrzut wody na odprowadzalniki <?php echo $_SESSION['syndis_eq_stock'];?> <br/>Studnie pracujące - status ON</h3>
|
|
</div>
|
|
<div class="panel-body">
|
|
Na dzień:<b> <?php echo sqlStringValue("select max(WLL_AUDIT_CD) DT from softspm_rep.rep_003_data", "DT"); ?></b>
|
|
</div>
|
|
<div class="panel-footer">
|
|
<a class="btn btn-default" href="#" role="button" onclick="window.print();">Drukuj <span class="glyphicon glyphicon-print" aria-hidden="true"></span></a>
|
|
<a class="btn btn-success" href="#" role="button">Eksport do Excel <span class="glyphicon glyphicon-file" aria-hidden="true"></span></a>
|
|
<a class="btn btn-danger" href="#" role="button">Eksport do PDF <span class="glyphicon glyphicon-file" aria-hidden="true"></span></a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<table class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>Zrzut</th>
|
|
<th></th>
|
|
<th>[m<sup>3</sup>/min]</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
|
|
|
|
<?php
|
|
|
|
echo getFullTree(73)."<br/>";
|
|
|
|
|
|
$levVAL=0;
|
|
unset($rep003Array_00);
|
|
$rep003Array_00 = sqlGetResAsArray("select * from seg_water_drainage where WWD_PARENT_ID is null order by WWD_NAME");
|
|
for($f=0;$f<count($rep003Array_00);$f++)
|
|
{
|
|
//poziom pierwszy
|
|
unset($rep003Array_01);
|
|
$rep003Array_01 = sqlGetResAsArray("select WWD_ID,WWD_NAME,sum(Q_H) QH,sum(Q_MIN) QM from softspm_rep.rep_003_data where WWD_PARENT_ID=".$rep003Array_00[$f]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' group by WWD_ID order by WWD_NAME");
|
|
if (sqlValue("select count(*) from softspm_rep.rep_003_data where WWD_PARENT_ID=".$rep003Array_00[$f]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."'")>0)
|
|
{
|
|
echo"
|
|
<tr style='font-weight: bolder; background-color: #B22222; color: #ffffff;'>
|
|
<td style='width: 15%;'>".$rep003Array_00[$f]['WWD_NAME']."</td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
";
|
|
|
|
|
|
for ($i1=0; $i1<count($rep003Array_01); $i1++)
|
|
{
|
|
unset($rep003Array_01Val);
|
|
$rep003Array_01Val = (float) $rep003Array_01[$i1]['QM'] + getFullTree($rep003Array_01[$i1]['WWD_ID']);
|
|
echo"
|
|
<tr>
|
|
<td></td>
|
|
<td style='background-color: #FFEBCD;'>".$rep003Array_01[$i1]['WWD_NAME']."</td>
|
|
<td>".$rep003Array_01Val."</td>
|
|
</tr>";
|
|
}
|
|
|
|
echo"
|
|
<tr style='font-weight: bolder; background-color: #ADD8E6;'>
|
|
<td style='text-align: right;'>Łącznie</td>
|
|
<td></td>
|
|
<td>".getFullTree($rep003Array_00[$f]['WWD_ID'])."</td>
|
|
</tr><tr style='height: 10px;'><tr>
|
|
";
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ========================================================================================================================
|
|
// ========================================================================================================================
|
|
if (sqlValue("select count(*) from softspm_rep.rep_003_data where WWD_PARENT_ID=".$rep003Array_00[$f]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."'")>0)
|
|
{
|
|
|
|
for ($i1=0; $i1<count($rep003Array_01); $i1++)
|
|
{
|
|
$lacznie = 0;
|
|
|
|
echo"
|
|
<tr style='font-weight: bolder; background-color: #FFEBCD;'>
|
|
<td>".$rep003Array_01[$i1]['WWD_NAME']."</td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
";
|
|
|
|
echo("select * from softspm_rep.rep_003_data where WWD_ID=".$rep003Array_01[$i1]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' order by WLL_NAME");
|
|
|
|
echo"<br/>";
|
|
|
|
|
|
unset($rep003Array_02);
|
|
$rep003Array_02 = sqlGetResAsArray("select * from softspm_rep.rep_003_data where WWD_ID=".$rep003Array_01[$i1]['WWD_ID']." and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' order by WLL_NAME");
|
|
for($i2=0; $i2<count($rep003Array_02); $i2++)
|
|
{
|
|
echo"
|
|
<tr>
|
|
<td>".$rep003Array_02[$i2]['WLL_BARIERA']."</td>
|
|
<td>".$rep003Array_02[$i2]['WLL_NAME']."</td>
|
|
<td>".$rep003Array_02[$i2]['Q_MIN']."</td>
|
|
</tr>
|
|
";
|
|
$lacznie += $rep003Array_02[$i2]['Q_MIN'];
|
|
}
|
|
|
|
|
|
echo"
|
|
<tr style='font-weight: bolder; background-color: #ADD8E6;'>
|
|
<td style='text-align: right;'>Łącznie</td>
|
|
<td>".$rep003Array_01[$i1]['WWD_ID']." -> ".getFullTree($rep003Array_01[$i1]['WWD_ID'])."</td>
|
|
<td>".($lacznie + getFullTree($rep003Array_01[$i1]['WWD_ID']))."</td>
|
|
</tr><tr style='height: 10px;'><tr>
|
|
";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
// ========================================================================================================================
|
|
// ========================================================================================================================
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
</table>
|
|
|
|
<?php
|
|
mysql_close($polacz);
|
|
|
|
?>
|
|
|
|
<script src="./bootstrap.min.js"></script>
|
|
</body>
|
|
</html>
|