Files
2026-09-03 11:24:19 +02:00

116 lines
6.4 KiB
PHP

<?php
if (!empty($_SESSION['site303']))
{
?>
<div class="tag100">
<div class="head_tag"><?php echo $lab_Tag_site303_001 ;?></div>
<div class="tag">
<table WIDTH="100%" class="tag">
<TR>
<TD class="label">Lp.</TD>
<TD class="label"><?php echo $lab_Field_site203_001 ;?></TD>
<TD class="label"><?php echo $lab_Field_site303_001 ;?></TD>
<TD class="label"><?php echo $lab_Field_site203_002a ;?></TD>
<TD class="label"><?php echo $lab_Field_site203_003 ;?></TD>
<TD class="label"><?php echo $lab_Field_site203_022 ;?></TD>
<TD class="label"><?php echo $lab_Field_site303_004 ;?></TD>
</TR>
<?php
if (isset($_GET['pup']) && $_GET['pup']>0)
{
unset($pup_array);
//$pup_array = sqlGetResAsArray("select * from seg_dev_resources,seg_pumps where DRS_DEV_TYPE=10 and DRS_DEV_ID=PUP_ID and DRS_ID in (select DRS_ID from seg_dev_resources,seg_pumps where DRS_DEV_TYPE=10 and DRS_DEV_ID=PUP_ID and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' and PUP_ID=".$_GET['pup']." and (DRS_RESOURCES_DIC_ID in (1,2,3,707) or (DRS_RESOURCES_DIC_ID=40 and DRS_DEV_ATTENTION='1524')) union select RWS_PUP_DRS_ID DRS_ID from seg_wellsink_pump_eng_rel,seg_dev_resources left join seg_pumps on DRS_DEV_TYPE=10 and DRS_DEV_ID=PUP_ID where RWS_PUP_DRS_ID=DRS_ID and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' and PUP_ID=".$_GET['pup'].") order by DRS_SN_NUMBER,PUP_Q_N");
$pup_array = sqlGetResAsArray("select * from seg_pumps,seg_dev_resources where DRS_DEV_TYPE=10 and DRS_DEV_ID=PUP_ID and PUP_ID=".$_GET['pup']." and (DRS_RESOURCES_DIC_ID in (1,2,3,707) or (DRS_RESOURCES_DIC_ID=40 and DRS_DEV_ATTENTION in ('1401','1524'))) and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' order by PUP_NAME,DRS_SN_NUMBER");
}
// $pup_array = sqlGetResAsArray("select DRS_ID,DRS_SN_NUMBER,DRS_STATUS_DIC_ID,DRS_RESOURCES_DIC_ID,PUP_ID,PUP_NAME,(PUP_Q_N/60) PUP_Q_N,PUP_H_P,(select WLL_NAME from seg_wells where WLL_ID=(select RWL_WLL_ID from seg_well_pump_eng_rel where RWL_PUP_DRS_ID=DRS_ID limit 1)) WLL_NAME from seg_dev_resources left join seg_pumps on DRS_DEV_ID=PUP_ID and DRS_DEV_TYPE=10 where DRS_DEPARTMENT = '".$_SESSION['syndis_eq_stock']."' and DRS_STATUS_DIC_ID in (6,7,8,30) and PUP_ID=".$_GET['pup']);
// $pup_array = sqlGetResAsArray("select DRS_ID,DRS_SN_NUMBER,DRS_STATUS_DIC_ID,DRS_RESOURCES_DIC_ID,PUP_ID,PUP_NAME,(PUP_Q_N/60) PUP_Q_N,PUP_H_P,(select WLL_NAME from seg_wells where WLL_ID=(select RWL_WLL_ID from seg_well_pump_eng_rel where RWL_PUP_DRS_ID=DRS_ID limit 1)) WLL_NAME from seg_dev_resources left join seg_pumps on DRS_DEV_ID=PUP_ID and DRS_DEV_TYPE=10 where DRS_DEPARTMENT = '".$_SESSION['syndis_eq_stock']."' and PUP_ID=".$_GET['pup']." order by PUP_NAME,DRS_SN_NUMBER");
//$pup_array = sqlGetResAsArray("select DRS_ID,DRS_SN_NUMBER,DRS_STATUS_DIC_ID,DRS_RESOURCES_DIC_ID,PUP_ID,PUP_NAME,(PUP_Q_N/60) PUP_Q_N,PUP_H_P,(select WLL_NAME from seg_wells where WLL_ID=(select RWL_WLL_ID from seg_well_pump_eng_rel where RWL_PUP_DRS_ID=DRS_ID limit 1)) WLL_NAME from seg_dev_resources left join seg_pumps on DRS_DEV_ID=PUP_ID and DRS_DEV_TYPE=10 where DRS_RESOURCES_DIC_ID in (1,2,3,40,707) and DRS_DEPARTMENT = '".$_SESSION['syndis_eq_stock']."' and PUP_ID=".$_GET['pup']." order by PUP_NAME,DRS_SN_NUMBER");
//print_r($pup_array);
//echo"<br/><br/><br/>";
for($i=0;$i<count($pup_array);$i++)
{
unset($wellInfo); unset($pupStatus); unset($pumpWellSink);
$wellInfo = sqlGetResAsArray("select * from seg_well_pump_eng_rel,seg_wells where RWL_WLL_ID=WLL_ID and RWL_PUP_DRS_ID=".$pup_array[$i]['DRS_ID']);
if ($pup_array[$i]['DRS_RESOURCES_DIC_ID']==1) $pupStatus = 'Nowe';
elseif ($pup_array[$i]['DRS_RESOURCES_DIC_ID']==2) $pupStatus = 'Rezerwa';
elseif ($pup_array[$i]['DRS_RESOURCES_DIC_ID']==707) $pupStatus = 'Remont';
elseif ($pup_array[$i]['DRS_RESOURCES_DIC_ID']==3 && count($wellInfo)>0) $pupStatus = 'Eksploatacja SPM';
elseif ($pup_array[$i]['DRS_RESOURCES_DIC_ID']==3 && count($wellInfo)==0) $pupStatus = 'Bestgum';
elseif ($pup_array[$i]['DRS_RESOURCES_DIC_ID']==40 && $pup_array[$i]['DRS_DEV_ATTENTION']=='1524') $pupStatus = 'Kasacja [w likwidacji]';
$pumpWellSink = sqlGetResAsArray("select * from seg_wellsink_pump_eng_rel,seg_wells where WLL_ID=RWS_WLL_ID and RWS_PUP_DRS_ID=".$pup_array[$i]['DRS_ID']);
if (count($pumpWellSink)>0)
{
$wellInfo[0]['WLL_NAME'] = 'Zatopiona w '.$pumpWellSink[0]['WLL_NAME'];
$pupStatus = 'Kasacja [zatopione]';
}
echo"
<TR STYLE='cursor: pointer;' onclick=".chr(34)."document.location.href='./?pg=site303inf&dev=".$pup_array[$i]['DRS_ID']."&pb=".$_GET['pup']."'".chr(34).">
<TD class='field_left'>".($i+1).".</TD>
<TD class='field_left'>".$pup_array[$i]['PUP_NAME']."</TD>
<TD class='field_center'>".$pup_array[$i]['DRS_SN_NUMBER']."</TD>
<TD class='field_right'>".round($pup_array[$i]['PUP_Q_N']/60,3)."</TD>
<TD class='field_right'>".$pup_array[$i]['PUP_H_P']."</TD>
<TD class='field_center'>".$wellInfo[0]['WLL_NAME']."</TD>
<TD class='field_center'>".$pupStatus."</TD>
</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($pup_array); ?></span></td>
<td style="width: 50%; text-align: center;">
</td>
<td style="width: 25%; text-align: right;">
<!-- <a href="./export/site303list_xls.php" target="_blank" title="Export do EXCEL"><img src="./images/excel_ico.png" style="max-width: 20px; border: 0;"></a>&nbsp; -->
<!-- <a href="./export/site303list_print.php" target="_blank" title="Wydruk"><img src="./images/printer-icon.png" style="max-width: 20px; border: 0;"></a>&nbsp; -->
</td>
</tr>
</table>
</div>
<div class="tag50_left">
<div class="tag_buttons" style="text-align: left;">
<button type="button" class="btn btn-default btn-sm" onclick="window.print();">Drukuj</button>
</div>
</div>
<div class="tag50_right">
<div class=tag_buttons>
<a href='./?pg=site303'> <INPUT class='btn btn-info btn-sm' TYPE='BUTTON' VALUE='<?php echo $lab_ButtonName_Back; ?>'></A>
</div>
</div>
</div>
<?php
}
else showFooterWarningAccessNotification($lab_FooterWarningAccessNotification_001);
?>