175 lines
9.5 KiB
PHP
175 lines
9.5 KiB
PHP
<?php
|
|
if (!empty($_SESSION['site304']))
|
|
{
|
|
?>
|
|
|
|
<?php
|
|
if (empty($_GET['eng'])) delSearchSessionData();
|
|
?>
|
|
|
|
|
|
<?php
|
|
if ($_POST['inEngineID']>0 && $_POST['subEngineSave']==$lab_ButtonName_Save)
|
|
{
|
|
mysql_query("INSERT INTO seg_dev_resources SET DRS_DEV_ID=".$_POST['inEngineID'].",DRS_DEV_TYPE=(select DIC_ID from sys_dictionaries where DIC_TYPE='DRS_DEV_TYPE' and DIC_NAME='ENGINE'),DRS_SN_NUMBER='".$_POST['inEngineSN']."',DRS_BUY_DATE='".$_POST['inEngineBuyDate']."',DRS_AVAILABLE_DATE='".$_POST['inEngineAvDate']."',DRS_STATUS_DIC_ID=".$_POST['inEngineStat'].",DRS_RESOURCES_DIC_ID=".$_POST['inEngineDevRes'].",DRS_DEV_ATTENTION='".$_POST['inEngineAtt']."',DRS_AUDIT_USR='".$_SESSION['user']."',DRS_AUDIT_DATE=now()");
|
|
$maxDRSid = sqlValue("select max(DRS_ID) from seg_dev_resources");
|
|
mysql_query("INSERT INTO seg_dev_resources_det SET DRD_DRS_ID=$maxDRSid,DRD_RESOURCES_DETAIL=(select DIC_ID from sys_dictionaries where DIC_TYPE='DEV_RESOURCES_DETAIL' and DIC_NAME='ASSET'),DRD_VALUE='".$_POST['inEngineEST']."',DRD_AUDIT_USR='".$_SESSION['user']."',DRD_AUDIT_DATE=now()");
|
|
mysql_query("insert into seg_dev_resources_his select * from seg_dev_resources where DRS_ID=$maxDRSid");
|
|
|
|
echo"<div class='actionOK'>$lab_Field_site803_013</div>";
|
|
unset($maxDRSid);
|
|
unset($_SESSION['site304_print_array']);
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
<div class="tag100">
|
|
<div class="head_tag"><?php echo $lab_Tag_site304_001 ;?></div>
|
|
<div class="tag">
|
|
<table WIDTH="100%" class="tag">
|
|
<TR>
|
|
<TD class="label"><?php echo $lab_Field_site204_001 ;?></TD>
|
|
<TD class="label"><?php echo $lab_Field_site303_001 ;?></TD>
|
|
<TD class="label">Dostępne [szt.]</TD>
|
|
<TD class="label">Użytkowane [szt.]</TD>
|
|
<TD class="label">W remoncie [szt.]</TD>
|
|
<TD class="label">Ilość razem [szt.]</TD>
|
|
</TR>
|
|
|
|
<?php
|
|
if (empty($_SESSION['site304_array']))
|
|
$_SESSION['site304_array'] = sqlGetResAsArray("select ENG_ID,count(ENG_ID) ILOSC,ENG_NAME,MCF_NAME from seg_dev_resources left join seg_engines on DRS_DEV_ID=ENG_ID and DRS_DEV_TYPE=11 left join seg_manufacturers on ENG_MCF_ID=MCF_ID where ENG_ID>0 and DRS_DEPARTMENT = '".$_SESSION['syndis_eq_stock']."' and DRS_STATUS_DIC_ID in (6,7,8) group by ENG_ID,ENG_NAME,MCF_NAME order by ENG_NAME");
|
|
|
|
|
|
if (empty($_SESSION['site304_print_array']))
|
|
{
|
|
$res=null;
|
|
$wynik = mysql_query("select DRS_SN_NUMBER,DRS_RESOURCES_DIC_ID,ENG_NAME,ENG_VOLTAGE,ENG_POWER,(select WLL_NAME from seg_wells where WLL_ID=(select RWL_WLL_ID from seg_well_pump_eng_rel where RWL_ENG_DRS_ID=DRS_ID limit 1)) WLL_NAME from seg_dev_resources left join seg_engines on DRS_DEV_ID=ENG_ID and DRS_DEV_TYPE=11 where ENG_ID>0 and DRS_DEPARTMENT = '".$_SESSION['syndis_eq_stock']."' and DRS_STATUS_DIC_ID in (6,7,8,30) order by ENG_NAME,ENG_POWER");
|
|
if($wynik)while ($r = mysql_fetch_array($wynik))
|
|
{
|
|
$res[]=array(
|
|
'ENG_NAME' => $r["ENG_NAME"],
|
|
'DRS_SN_NUMBER' => $r["DRS_SN_NUMBER"],
|
|
'STATUS' => setDicName($r["DRS_RESOURCES_DIC_ID"]),
|
|
'ENG_VOLTAGE' => $r["ENG_VOLTAGE"],
|
|
'ENG_POWER' => $r["ENG_POWER"],
|
|
'WLL_NAME' => $r["WLL_NAME"],
|
|
'DRS_DEPARTMENT' => $_SESSION['syndis_eq_stock']
|
|
);
|
|
|
|
}
|
|
unset($_SESSION['site304_print_array']);
|
|
$_SESSION['site304_print_array']=$res;
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET['eng']) && $_GET['eng']>0)
|
|
$eng_array = sqlGetResAsArray("select DRS_ID,DRS_SN_NUMBER,DRS_STATUS_DIC_ID,DRS_RESOURCES_DIC_ID,ENG_ID,ENG_NAME,ENG_VOLTAGE,ENG_POWER,(select WLL_NAME from seg_wells where WLL_ID=(select RWL_WLL_ID from seg_well_pump_eng_rel where RWL_ENG_DRS_ID=DRS_ID limit 1)) WLL_NAME from seg_dev_resources left join seg_engines on DRS_DEV_ID=ENG_ID and DRS_DEV_TYPE=11 where DRS_DEPARTMENT = '".$_SESSION['syndis_eq_stock']."' and DRS_STATUS_DIC_ID in (6,7,8,30) and ENG_ID=".$_GET['eng']);
|
|
|
|
//select DRS_ID,DRS_SN_NUMBER,DRS_STATUS_DIC_ID,DRS_RESOURCES_DIC_ID,PUP_ID,PUP_NAME,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_ENG_DRS_ID=DRS_ID limit 1)) WLL_NAME from seg_dev_resources left join seg_engines on DRS_DEV_ID=ENG_ID and DRS_DEV_TYPE=11 where DRS_DEPARTMENT = '".$_SESSION['syndis_eq_stock']."' and DRS_STATUS_DIC_ID in (6,7,8,30) and ENG_ID=".$_GET['eng'])
|
|
|
|
for($i=0; $i<count($_SESSION['site304_array']); $i++)
|
|
{
|
|
|
|
unset($arrayStatuses);
|
|
$arrayStatuses = sqlGetResAsArray("select DRS_STATUS_DIC_ID, count(DRS_STATUS_DIC_ID) ILE from seg_dev_resources,seg_engines where DRS_DEV_TYPE=11 and ENG_ID=DRS_DEV_ID and DRS_STATUS_DIC_ID in (6,7,8) and DRS_DEPARTMENT='".$_SESSION['syndis_eq_stock']."' and ENG_ID=".$_SESSION['site304_array'][$i]['ENG_ID']." group by DRS_STATUS_DIC_ID");
|
|
|
|
$dostepne=0; $uzytkowa=0; $remont=0; $nieuzytk=0;
|
|
for ($s=0; $s<count($arrayStatuses); $s++)
|
|
{
|
|
if ($arrayStatuses[$s]['DRS_STATUS_DIC_ID']==6)
|
|
$dostepne = $arrayStatuses[$s]['ILE'];
|
|
elseif ($arrayStatuses[$s]['DRS_STATUS_DIC_ID']==7)
|
|
$uzytkowa = $arrayStatuses[$s]['ILE'];
|
|
elseif ($arrayStatuses[$s]['DRS_STATUS_DIC_ID']==8)
|
|
$remont = $arrayStatuses[$s]['ILE'];
|
|
elseif ($arrayStatuses[$s]['DRS_STATUS_DIC_ID']==30)
|
|
$nieuzytk = $arrayStatuses[$s]['ILE'];
|
|
}
|
|
|
|
|
|
|
|
echo"
|
|
<TR STYLE='cursor: pointer;' onclick=".chr(34)."document.location.href='./?pg=site304&eng=".$_SESSION['site304_array'][$i]['ENG_ID']."'".chr(34).">
|
|
<TD class='field_left'>".$_SESSION['site304_array'][$i]['ENG_NAME']."</TD>
|
|
<TD class='field_center'>".$_SESSION['site304_array'][$i]['MCF_NAME']."</TD>
|
|
<TD class='field_center'>".$dostepne."</TD>
|
|
<TD class='field_center'>".$uzytkowa."</TD>
|
|
<TD class='field_center'>".$remont."</TD>
|
|
<TD class='field_center'>".$_SESSION['site304_array'][$i]['ILOSC']."</TD>
|
|
</TR>
|
|
";
|
|
|
|
if (isset($_GET['eng']) && $_GET['eng']>0 && count($eng_array)>0 && $_GET['eng']==$_SESSION['site304_array'][$i]['ENG_ID'])
|
|
{
|
|
echo"
|
|
<tr>
|
|
<td colspan='6' class='eq_details'>
|
|
<table WIDTH='100%' class='tag'>
|
|
<TR>
|
|
<TD class='eq_label'>Lp.</TD>
|
|
<TD class='eq_label'>".$lab_Field_site204_001."</TD>
|
|
<TD class='eq_label'>".$lab_Field_site303_001."</TD>
|
|
<TD class='eq_label'>".$lab_Field_site204_002."</TD>
|
|
<TD class='eq_label'>".$lab_Field_site204_003."</TD>
|
|
<TD class='eq_label'>".$lab_Field_site203_022."</TD>
|
|
<td class='eq_label'>".$lab_Field_site303_004."</td>
|
|
</TR>
|
|
";
|
|
|
|
for ($j=0; $j<count($eng_array); $j++)
|
|
{
|
|
|
|
echo"
|
|
<tr STYLE='cursor: pointer;' onclick=".chr(34)."document.location.href='./?pg=site304inf&dev=".$eng_array[$j]['DRS_ID']."'".chr(34).">
|
|
<td class='field_left group_color'>".($j+1)."</td>
|
|
<td class='field_left group_color'>".$eng_array[$j]['ENG_NAME']."</td>
|
|
<td class='field_center group_color'>".$eng_array[$j]['DRS_SN_NUMBER']."</td>
|
|
<td class='field_right group_color'>".$eng_array[$j]['ENG_VOLTAGE']."</td>
|
|
<td class='field_right group_color'>".$eng_array[$j]['ENG_POWER']."</td>
|
|
<td class='field_center group_color'>".$eng_array[$j]['WLL_NAME']."</td>
|
|
<td class='field_center group_color'>".setDicName($eng_array[$j]['DRS_STATUS_DIC_ID'])."</td>
|
|
</tr>
|
|
";
|
|
}
|
|
echo"
|
|
</table>
|
|
</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($_SESSION['site304_print_array']); ?></span></td>
|
|
<td style="width: 25%; text-align: right;">
|
|
<a href="./export/site304_xls.php" target="_blank" title="Export do EXCEL"><img src="/images/excel_ico.png" style="max-width: 20px; border: 0;"></a>
|
|
<a href="./export/site304_print.php" target="_blank" title="Wydruk"><img src="/images/printer-icon.png" style="max-width: 20px; border: 0;"></a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
</div>
|
|
|
|
<?php
|
|
if (!empty($_SESSION['site304_edit']))
|
|
echo"
|
|
<div class=tag_buttons>
|
|
<a href='?pg=site304A'> <INPUT class='btn btn-success btn-sm' TYPE='BUTTON' VALUE='$lab_ButtonName_Add'></A>
|
|
</div>
|
|
";
|
|
?>
|
|
|
|
|
|
</div>
|
|
|
|
<?php
|
|
}
|
|
else showFooterWarningAccessNotification($lab_FooterWarningAccessNotification_001);
|
|
?>
|