<?
// 기본 설정 로딩
require_once('config.php');
require_once('function.php');
require_once('lib.php');
?>
<?
$E5504=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('E5504')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('E5504') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('E5504') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$E5504=mysql_fetch_assoc($E5504);
$E5504_LIST=@mysql_query("select * from serverdb where server_cpuname in ('E5504') and server_use_status = 'y' and gear_notready = 'n'" , $db_connect) or die($db_q_error);
$E5504_DATA=mysql_fetch_assoc($E5504_LIST);

#select * from serverdb where server_cpuname in ('E5504') and server_use_status = 'y' and gear_notready = 'n';
#select * from serverdb where server_cpuname in ('E5540') and server_use_status = 'y' and gear_notready = 'n';
/*
#select * from serverdb where server_cpuname in ('E5504') and server_use_status = 'y' and gear_notready = 'n';
select * from serverdb where server_cpuname in ('E5540') and server_use_status = 'y' and gear_notready = 'n';
select * from serverdb where server_cpuname in ('E5540') and server_use_status = 'y';

#UPDATE `idc`.`serverdb` SET `gear_notready`='y',`server_ram`='', `server_hdd`='', `server_ram1`='', `server_ram2`='', `server_ram3`='', `server_ram4`='', `server_ram5`='', `server_hdd1`='', `server_hdd2`='', `server_hdd3`='', `server_hdd4`='', `server_hdd5`='' WHERE  `server_code` like
#'%M024';
#select server_code,gear_notready,server_ram,server_hdd,server_ram1,server_ram2,server_ram3,server_ram4,server_ram5,server_hdd1,server_hdd2,server_hdd3,server_hdd4,server_hdd5 from serverdb where server_code like 
#'%M024';
#select * from serverdb where server_cpuname in ('E5504','E5530','E5540','X5570','X5650','X5670','X5675') and server_use_status like 'y' order by server_spec asc;
#SELECT * FROM `idc`.`serverdb` where server_code not like ('%일회성') and server_code not like ('%전용회선') and server_process not like ('INTEL%') ORDER BY `server_recieve_date` desc;
#select * from serverdb where server_cpuname like 'E5504' order by server_code asc;
#select * from serverdb where server_spec like 'DQ20' order by server_code asc;
#select * from serverdb order by server_code asc;
*/

$E5530=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('E5530')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('E5530') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('E5530') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$E5530=mysql_fetch_assoc($E5530);

$E5540=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('E5540')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('E5540') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('E5540') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$E5540=mysql_fetch_assoc($E5540);

$X5560=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('X5560')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('X5560') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('X5560') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$X5560=mysql_fetch_assoc($X5560);

$X5570=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('X5570')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('X5570') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('X5570') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$X5570=mysql_fetch_assoc($X5570);

$X5650=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('X5650')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('X5650') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('X5650') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$X5650=mysql_fetch_assoc($X5650);

$X5670=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('X5670')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('X5670') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('X5670') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$X5670=mysql_fetch_assoc($X5670);

$X5675=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('X5675')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('X5675') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('X5675') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$X5675=mysql_fetch_assoc($X5675);

$TOTAL=@mysql_query("SELECT 
(select count(*) from serverdb where server_cpuname in ('E5504','E5530','E5540','X5570','X5650','X5670','X5675')) as 'total', 
(select count(*) from serverdb where server_cpuname in ('E5504','E5530','E5540','X5570','X5650','X5670','X5675') and server_use_status like 'y') as 'use',
(select count(*) from serverdb where server_cpuname in ('E5504','E5530','E5540','X5570','X5650','X5670','X5675') and gear_notready like 'y') as 'notready'
" , $db_connect) or die($db_q_error);
$TOTAL=mysql_fetch_assoc($TOTAL);
?>

<table border="1" cellspacing="0" cellpadding="0" style="text-align:center;">
  <tr>
    <th width="120" scope="col">구분</th>
    <th width="120" scope="col">전체</th>
    <th width="120" scope="col">임대+포맷보류(부품부족)</th>
    <th width="120" scope="col">가용가능</th>
    <th width="120" scope="col">사용가능</th>
    <th width="120" scope="col">실제 사용 가능</th>
  </tr>
  <tr>
    <td>E5504 (A-i3급)</td>
    <td><?=$E5504['total']?></td>
    <td><?=$E5504['total']-$E5504['use']?>(<?=$E5504['notready']?>)</td>
    <td><?=$E5504['use']?></td>
    <td><?=$E5504['use']-$E5504['notready']?></td>
	<td>9</td>
  </tr>
  <tr>
    <td>E5530 (B-i5급)</td>
    <td><?=$E5530['total']?></td>
    <td><?=$E5530['total']-$E5530['use']?>(<?=$E5530['notready']?>)</td>
    <td><?=$E5530['use']?></td>
    <td><?=$E5530['use']-$E5530['notready']?></td>
	<td>10</td>
  </tr>
  <tr>
    <td>E5540 (B-i5급)</td>
    <td><?=$E5540['total']?></td>
    <td><?=$E5540['total']-$E5540['use']?>(<?=$E5540['notready']?>)</td>
    <td><?=$E5540['use']?></td>
    <td><?=$E5540['use']-$E5540['notready']?></td>
	<td>1</td>
  </tr>
  <tr>
    <td>X5560 (C-i7급)</td>
    <td><?=$X5560['total']?></td>
    <td><?=$X5560['total']-$X5560['use']?>(<?=$X5560['notready']?>)</td>
    <td><?=$X5560['use']?></td>
    <td><?=$X5560['use']-$X5560['notready']?></td>
	<td>6</td>
  </tr>
  <tr>
    <td>X5570 (C-i7급)</td>
    <td><?=$X5570['total']?></td>
    <td><?=$X5570['total']-$X5570['use']?></td>
    <td><?=$X5570['use']?></td>
    <td><?=$X5570['notready']?></td>
    <td><?=$X5570['use']-$X5570['notready']?></td>
	<td>7(+1/300G , +1/테스트중)</td>
  </tr>
  <tr>
    <td>X5650 (D급)</td>
    <td><?=$X5650['total']?></td>
    <td><?=$X5650['total']-$X5650['use']?></td>
    <td><?=$X5650['use']?></td>
    <td><?=$X5650['notready']?></td>
    <td><?=$X5650['use']-$X5650['notready']?></td>
	<td>0</td>
  </tr>
  <tr>
    <td>X5670 (D급)</td>
    <td><?=$X5670['total']?></td>
    <td><?=$X5670['total']-$X5670['use']?></td>
    <td><?=$X5670['use']?></td>
    <td><?=$X5670['notready']?></td>
    <td><?=$X5670['use']-$X5670['notready']?></td>
	<td>0</td>
  </tr>
  <tr>
    <td>X5675 (D급)</td>
    <td><?=$X5675['total']?></td>
    <td><?=$X5675['total']-$X5675['use']?></td>
    <td><?=$X5675['use']?></td>
    <td><?=$X5675['notready']?></td>
    <td><?=$X5675['use']-$X5675['notready']?></td>
	<td>2</td>
  </tr>
  <tr style="font-weight:bold;">
    <td>전체</td>
    <td><?=$TOTAL['total']?></td>
    <td><?=$TOTAL['total']-$TOTAL['use']?></td>
    <td><?=$TOTAL['use']?></td>
    <td><?=$TOTAL['notready']?></td>
    <td><?=$TOTAL['use']-$TOTAL['notready']?></td>
	<td>25</td>
  </tr>
</table>

* HP Prolaint DL360 G6 / G7 부품 재고현황<br>
2015년 11월 12일자 <br>
메모리 2G : 12 (+52) = 64개<br>
메모리 4G : 24 (+51) = 65개<br>
SAS 146G : 스페어 4 개<br>
SAS 300G : 스페어 4 개<br>
SATA 500G : 3 개<br>
SATA 1T : 6 개<br>
SATA 2T : 1 개<br>
<?
//DB닫기
mysql_close($db_connect);
?>