0 && $_POST['subPumpSave']==$lab_ButtonName_Save)
{
if (sqlValue("select count(1) from seg_dev_resources where DRS_DEV_TYPE=10 and DRS_DEV_ID=".$_POST['inPumpID']." and DRS_SN_NUMBER='".$_POST['inPumpSN']."'")==0)
{
mysql_query("INSERT INTO seg_dev_resources SET DRS_DEV_ID=".$_POST['inPumpID'].",DRS_DEV_TYPE=10,DRS_SN_NUMBER='".$_POST['inPumpSN']."',DRS_BUY_DATE='".$_POST['inPumpBuyDate']."',DRS_AVAILABLE_DATE='".$_POST['inPumpAvDate']."',DRS_STATUS_DIC_ID=".$_POST['inPumpStat'].",DRS_RESOURCES_DIC_ID=".$_POST['inPumpDevRes'].",DRS_DEV_ATTENTION='".$_POST['inPumpAtt']."',DRS_DEPARTMENT = '".$_SESSION['syndis_eq_stock']."',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['inPumpEST']."',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"
";
delSearchSessionData();
}
}
//usuwanie
// ==================================================================================
if (!empty($_GET['param']))
{
$tpmArray=explode(',', $_GET['param']);
if ($tpmArray[0]>0 && $tpmArray[1]=='del' && $tpmArray[2]==md5($tpmArray[0]))
{
// Sprawdza warunek, czy nie jest powiązany z jakimś stanem
if (sqlValue("select count(*) from seg_well_pump_eng_rel where RWL_PUP_DRS_ID=".$tpmArray[0])>0)
{
echo"
$lab_DeleteRecordNotification_003
";
delSearchSessionData();
}
else {
mysql_query("DELETE FROM seg_dev_resources WHERE DRS_ID=".$tpmArray[0]);
echo"
0 and (DRS_RESOURCES_DIC_ID in (1,2,3,707) or (DRS_RESOURCES_DIC_ID=40) and DRS_DEV_ATTENTION in ('1401','1524')) group by PUP_ID,PUP_NAME order by PUP_NAME,PUP_Q_N".$subQuery);
$listArray = sqlGetResAsArray("select * from seg_pumps,seg_dev_resources where DRS_DEV_TYPE=10 and DRS_DEV_ID=PUP_ID and PUP_NAME like '%".$_POST['sr_well']."%' 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']."' group by PUP_ID order by PUP_NAME,PUP_Q_N");
for ($i=0; $i0) $suma += $rec1; else $rec1=null;
if ($rec2>0) $suma += $rec2; else $rec2=null;
if ($rec3ALL>0) $suma += $rec3ALL; else $rec3ALL=null;
if ($rec707>0) $suma += $rec707; else $rec707=null;
if ($rec40_LIK>0) $suma += $rec40_LIK; else $rec40_LIK=null;
if ($rec40_ZAT>0) $suma += $rec40_ZAT; else $rec40_ZAT=null;
if ($rec3ALL>$rec3SPM) $rec3BESTGUM = $rec3ALL-$rec3SPM;
if ($rec3SPM==0) $rec3SPM=null;
$_SESSION['site303_array'][]=array(
'id' => $listArray[$i]['PUP_ID'],
'pumpName' => $listArray[$i]['PUP_NAME'],
'pumpcount' => $suma,
'nowe' => $rec1,
'rezerwa' => $rec2,
'remont' => $rec707,
'eksp_spm' => $rec3SPM,
'bestgum' => $rec3BESTGUM,
'kas_lik' => $rec40_LIK,
'kas_zatop' => $rec40_ZAT
);
}
}
//print_r($_SESSION['site303_array']);
//echo"