263 lines
11 KiB
PHP
263 lines
11 KiB
PHP
<?php
|
|
if (!empty($_SESSION['site404']))
|
|
{
|
|
?>
|
|
<script>
|
|
$(function() {$("#data_01").datepicker({changeMonth: true,changeYear: true});});
|
|
$(function() {$("#data_02").datepicker({changeMonth: true,changeYear: true});});
|
|
</script>
|
|
|
|
<?php
|
|
// usuwanie pomiaru
|
|
if (!empty($_GET['param']))
|
|
{
|
|
unset($paramArray);
|
|
$paramArray = explode(',', $_GET['param']);
|
|
$_GET['pgn'] = $paramArray[0];
|
|
if ($paramArray[2]>0 && $paramArray[1]=='del')
|
|
{
|
|
mysql_query("delete from seg_dev_resources_det where DRD_ID=".$paramArray[2]);
|
|
mysql_query("delete from seg_dev_resources_det_his where DRD_ID=".$paramArray[2]);
|
|
|
|
$_POST['sub_search']='Pokaż';
|
|
}
|
|
}
|
|
|
|
|
|
//paginacja
|
|
if (!$_GET['pgn'])
|
|
{
|
|
$_GET['pgn']=1;
|
|
unset($_SESSION['site404pdet_array']);
|
|
unset($_SESSION['site404chart_x']);
|
|
unset($_SESSION['site404chart_y']);
|
|
unset($_SESSION['inDateFrom']);
|
|
unset($_SESSION['inDateTo']);
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if (!$_POST['inDateFrom'] && empty($_SESSION['inDateFrom'])) $_POST['inDateFrom']=date('Y-m-d');
|
|
if (!$_POST['inDateTo'] && empty($_SESSION['inDateTo'])) $_POST['inDateTo']=date('Y-m-d');
|
|
|
|
if (!empty($_POST['inDateFrom'])) $_SESSION['inDateFrom']=$_POST['inDateFrom'];
|
|
if (!empty($_POST['inDateTo'])) $_SESSION['inDateTo']=$_POST['inDateTo'];
|
|
|
|
|
|
//ładuje preloader
|
|
if (empty($_SESSION['site404pdet_array']) || $_POST['sub_search']=='Pokaż')
|
|
echo"<div id='loader-wrapper'><div id='loader'></div></div>";
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="tag100">
|
|
<div class="head_tag">Zwierciadło statyczne H<sub>ST</sub> [m]</div>
|
|
<div class="tag_center">
|
|
|
|
<form method="post" action="./?pg=site404pdet&dev=<?php echo $_GET['dev'];?>"><br/>
|
|
<input type="hidden" name="inShowHisParam" value="<?php echo $_POST['inShowHisParam'];?>">
|
|
<table>
|
|
<tr>
|
|
<td>Wyświetle pomiary za okres od:</td>
|
|
<td style='width: 5px;'></td>
|
|
<td><INPUT STYLE='text-align: right' TYPE='TEXT' id='data_01' NAME='inDateFrom' value='<?php echo $_SESSION['inDateFrom'];?>' SIZE='10'></td>
|
|
<td style='width: 15px;'></td>
|
|
<td>do:</td>
|
|
<td style='width: 5px;'></td>
|
|
<td><INPUT STYLE='text-align: right' TYPE='TEXT' id='data_02' NAME='inDateTo' value='<?php echo $_SESSION['inDateTo'];?>' SIZE='10'></td>
|
|
<td style='width: 20px;'></td>
|
|
<td><input type='submit' name='sub_search' value='Pokaż' class='btn btn-default btn-sm' onclick="makeRequest('?pg=site402chart');"></td>
|
|
</tr>
|
|
</table>
|
|
</form><br/>
|
|
|
|
|
|
<?php
|
|
// informacja o dacie dłuższej niż 6 miesięcy
|
|
$roznica = (strtotime(date("Y-m-d")) - strtotime($_SESSION['inDateFrom'])) / (60*60*24);
|
|
if ($roznica>180)
|
|
echo('<script>sweetAlert("Uwaga!", "Z uwagi na wydajność systemu prezentowane są dane z ostatnich 6 miesięcy. Jeśli chcesz zobaczyć starsze dane skorzystaj z modułu raportowego.", "warning");</script>');
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
|
include("./pChart/pData.class.php");
|
|
include("./pChart/pDraw.class.php");
|
|
include("./pChart/pImage.class.php");
|
|
include("./pChart/pScatter.class.php");
|
|
|
|
$fileName="./charts/".$_SESSION['user']."_".date("Ymd")."_".date("His")."site404pdet.png";
|
|
|
|
|
|
//if (empty($_SESSION['site404pdet_array']) || $_POST['sub_search']=='Pokaż')
|
|
if ($_POST['sub_search']=='Pokaż')
|
|
{
|
|
$x=null; $y=null; $res=null;
|
|
$wynik = mysql_query("select DRD_ID,DRD_VALUE,DRD_AUDIT_DATE,TM from (SELECT DRD_ID,DRD_VALUE,DRD_AUDIT_DATE,SUBSTRING(DRD_AUDIT_DATE,12,5) TM from seg_dev_resources_det where DRD_DRS_ID=".$_GET['dev']." and DRD_RESOURCES_DETAIL=210 and DRD_AUDIT_DATE>'".$_SESSION['inDateFrom']." 00:00:00' and DRD_AUDIT_DATE<'".$_SESSION['inDateTo']." 23:59:59' union SELECT DRD_ID,DRD_VALUE,DRD_AUDIT_DATE,SUBSTRING(DRD_AUDIT_DATE,12,5) TM from seg_dev_resources_det_his where DRD_DRS_ID=".$_GET['dev']." and DRD_RESOURCES_DETAIL=210 and DRD_AUDIT_DATE>'".$_SESSION['inDateFrom']." 00:00:00' and DRD_AUDIT_DATE<'".$_SESSION['inDateTo']." 23:59:59') tb order by DRD_AUDIT_DATE");
|
|
//$wynik = mysql_query("select ".$srchOUTVAL." OUTVAL,RHD_DATE,RHD_AUDIT_CD from rep_his_data_everyday where RHD_DRS_ID=".$_GET['dev']." and RHD_DATE>='".$_SESSION['inDateFrom']." 00:00:00' and RHD_DATE<='".$_SESSION['inDateTo']." 23:59:59' order by RHD_DATE");
|
|
//$wynik = mysql_query("SELECT DRD_VALUE,DRD_AUDIT_DATE,SUBSTRING(DRD_AUDIT_DATE,12,5) TM from viw_dev_resources_det where DRD_DRS_ID=".$_GET['dev']." and DRD_RESOURCES_DETAIL=".$_SESSION['site404pdet_dic'][0]['DIC_ID']." and DRD_AUDIT_DATE>'".$_POST['inDateFrom']." 00:00:00' and DRD_AUDIT_DATE<'".$_POST['inDateTo']." 23:59:59' order by DRD_AUDIT_DATE");
|
|
//$wynik = mysql_query("SELECT DRD_VALUE,DRD_AUDIT_DATE,SUBSTRING(DRD_AUDIT_DATE,12,5) TM from seg_dev_resources_det where DRD_DRS_ID=".$_GET['dev']." and DRD_RESOURCES_DETAIL=".$_SESSION['site404pdet_dic'][0]['DIC_ID']." and DRD_AUDIT_DATE>'".$_POST['inDateFrom']." 00:00:00' and DRD_AUDIT_DATE<'".$_POST['inDateTo']." 23:59:59' order by DRD_AUDIT_DATE");
|
|
if($wynik)while ($r = mysql_fetch_array($wynik))
|
|
{
|
|
$res[]=array(
|
|
'water_id' => $r["DRD_ID"],
|
|
'water_value' => $r["DRD_VALUE"],
|
|
'water_time' => $r["TM"],
|
|
'water_audit' => $r["DRD_AUDIT_DATE"],
|
|
'water_x' =>''
|
|
);
|
|
$x[] = '';
|
|
$y[] = $r["DRD_VALUE"];
|
|
}
|
|
unset($_SESSION['site404pdet_array']);
|
|
unset($_SESSION['site404chart_x']);
|
|
unset($_SESSION['site404chart_y']);
|
|
|
|
$_SESSION['site404pdet_array']=$res;
|
|
$_SESSION['site404chart_x']=$x;
|
|
$_SESSION['site404chart_y']=$y;
|
|
}
|
|
|
|
|
|
|
|
/* Create and populate the pData object */
|
|
$MyData = new pData();
|
|
|
|
$MyData->addPoints($_SESSION['site404chart_x'],"Labels");
|
|
$MyData->addPoints($_SESSION['site404chart_y'],"VALUE");
|
|
|
|
$MyData->setAxisDisplay(0,AXIS_FORMAT_CURRENCY);
|
|
$MyData->setSerieDescription("Labels","Time");
|
|
$MyData->setAbscissa("Labels");
|
|
$MyData->setPalette("VALUE",array("R"=>55,"G"=>91,"B"=>127));
|
|
|
|
/* Create the pChart object */
|
|
//$myPicture = new pImage(700,230,$MyData);
|
|
$myPicture = new pImage(960,500,$MyData);
|
|
|
|
|
|
|
|
|
|
|
|
$myPicture->drawGradientArea(0,0,960,500,DIRECTION_VERTICAL,array("StartR"=>220,"StartG"=>220,"StartB"=>220,"EndR"=>255,"EndG"=>255,"EndB"=>255,"Alpha"=>100));
|
|
$myPicture->drawRectangle(0,0,959,499,array("R"=>200,"G"=>200,"B"=>200));
|
|
|
|
/* Write the picture title */
|
|
$myPicture->setFontProperties(array("FontName"=>"./fonts/calibri.ttf","FontSize"=>11));
|
|
$myPicture->drawText(390,40,str_replace(array('<sub>','</sub>','<sup>','</sup>'), array('','','',''), 'Zwierciadło statyczne Hst [m]'),array("FontSize"=>16,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
|
|
|
|
/* Do some cosmetic and draw the chart */
|
|
$myPicture->setGraphArea(60,60,930,460);
|
|
$myPicture->drawFilledRectangle(60,60,930,460,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
|
|
|
|
$myPicture->drawScale(array("GridR"=>180,"GridG"=>180,"GridB"=>180));
|
|
|
|
|
|
|
|
/* Draw a spline chart on top */
|
|
$myPicture->setFontProperties(array("FontName"=>"./fonts/pf_arma_five.ttf","FontSize"=>6));
|
|
//$myPicture->drawFilledSplineChart();
|
|
$myPicture->drawSplineChart();
|
|
|
|
$myPicture->setShadow(FALSE);
|
|
|
|
|
|
|
|
/* Write the chart legend */
|
|
//$myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
|
|
|
|
/* Render the picture (choose the best way) */
|
|
$myPicture->Render($fileName);
|
|
|
|
?>
|
|
<?php echo "<p style='text-align: center;'><img src='$fileName'></p>" ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="tag100">
|
|
<div class="head_tag">Lista pomiarów</div>
|
|
<div class="tag">
|
|
<table WIDTH="100%" class="tag">
|
|
<TR>
|
|
<TD class="label">Lp.</TD>
|
|
<TD class="label">Data pomiaru</TD>
|
|
<TD class="label">Zwierciadło statyczne H<sub>ST</sub> [m]</TD>
|
|
</TR>
|
|
|
|
<?php
|
|
|
|
$start=($_GET['pgn']-1)*20;
|
|
$stop = $_GET['pgn']*20;
|
|
if ($stop>count($_SESSION['site404pdet_array'])) $stop=count($_SESSION['site404pdet_array']);
|
|
|
|
for($i=$start;$i<$stop;$i++)
|
|
{
|
|
echo"
|
|
<TR>
|
|
<TD class='field_right'>".($i+1).".</TD>
|
|
<TD class='field_center'>".$_SESSION['site404pdet_array'][$i]['water_audit']."</TD>
|
|
<TD class='field_center'>".$_SESSION['site404pdet_array'][$i]['water_value']."</TD>";
|
|
|
|
|
|
if (!empty($_SESSION['site404_edit']))
|
|
{
|
|
echo"<td CLASS='field_center' width='5%'>
|
|
<a href='./?pg=site404pdet&dev=".$_GET['dev']."¶m=1,del,".$_SESSION['site404pdet_array'][$i]['water_id']."'><img src='./images/remove_ico.png' title='$lab_ButtonName_Delete' onclick=".chr(34)."return confirm('Jesteś pewien, że chcesz usunąć rekord z historii pomiarów?');".chr(34)."></a>
|
|
</td>";
|
|
}
|
|
|
|
|
|
echo"</TR>
|
|
";
|
|
}
|
|
?>
|
|
|
|
</table>
|
|
|
|
<table style="width:100%; background-color: #f5f5f5">
|
|
<tr>
|
|
<td style="width: 25%; text-align: left;"><span class="resume">Wyników: <?php echo count($_SESSION['site404pdet_array']); ?></span></td>
|
|
<td style="width: 50%; text-align: center;">
|
|
<?php
|
|
if (count($_SESSION['site404pdet_array'])>20)
|
|
echo pagination_grid('./?pg=site404pdet&dev='.$_GET['dev'], $_GET['pgn'], count($_SESSION['site404pdet_array']));
|
|
?>
|
|
</td>
|
|
<td style="width: 25%; text-align: right;">
|
|
<a href="./export/site401pdet_xls.php" target="_blank" title="Export do EXCEL"><img src="./images/excel_ico.png" style="max-width: 20px; border: 0;"></a>
|
|
<a href="./export/site401pdet_print.php" target="_blank" title="Wydruk"><img src="./images/printer-icon.png" style="max-width: 20px; border: 0;"></a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
echo"
|
|
<div class=tag_buttons>
|
|
<a href='./?pg=site404inf&dev=".$_GET['dev']."'> <INPUT class='btn btn-info btn-sm' TYPE='BUTTON' VALUE='$lab_ButtonName_Back'></A>
|
|
</div>
|
|
";
|
|
?>
|
|
|
|
</div>
|
|
|
|
|
|
<?php
|
|
}
|
|
else showFooterWarningAccessNotification($lab_FooterWarningAccessNotification_001);
|
|
?>
|