<tr><td height=50><a href="<?=$g4[path]?>/bbs/board.php?bo_table=static&wr_id=9&page=0""><b><u>생산</u></b></a></td></tr>


<tr>
    <td height=30 style="color:#888;">
<?
//현재 재고
$i=0;

	if($want_year =="") $want_year = date("Y");

	$query4 = "select  *  from g4_write_project  where wr_9 ='open'  ";  
		$result4 = sql_query($query4);
		while($row  = sql_fetch_array($result4)) {

			
			$output[$i] = $row[wr_10];
//			$shipping[$i] = $row[sunwr1];
			$target[$i] = $row[wr_1];
			$project[$i] = $row[wr_subject];
			$customer[$i] = $row[wr_4];
			$start[$i] = $row[wr_2];
			$end[$i] = $row[wr_3];
			$real[$i] = $row[wr_link1];
			$delay[$i] = $row[wr_link1];

			
		//echo $output[$i] = $project[$i] = $row[wr_subject].$row[wr_10].$target[$i]."<br>";
			$i++;
		}
?>



<table class="t_ex2">
<tr><td colspan=10 bgcolor=white align=center height=50> <b>진행 중 프로젝트</b></td></tr>
	<tr><th  class='c1'  >Project</th>
	<th  class='c1'  >Output(%)</th>
	<th  class='c1'  >Shipping(%)</th>
	<th  class='c1'  >Target</th>
	<th  class='c1'  >Customer</th>
	<th  class='c1'  >Start</th>
	<th  class='c1'  >Planned</th>
	<th  class='c1'  >Remaining</th>
	<th  class='c1'  >End</th>

	<th  class='c1'  >Delayed</th>

		<?

	for($i=0; $i < count($project); $i++) {
	

		$d1 = strtotime($start[$i]);
		$d2 = strtotime($real[$i]);
		$d3 = strtotime($end[$i]);
		//echo $end."//".$d3;
		$seconds_diff = $d2 - $d1;
		$remaining_diff = $d3 - $d1;
		//$delay = date_diff($start, $end);

			
        @$b = round($output[$i]/$target[$i]*100);

		echo "<tr><td class='c1' width=7% align=center> ".$project[$i]." </td>";
		echo "<td  class='c2' width=7% align=right> ".number_format($output[$i])."(".$b.")&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".number_format($shipping[$i])."&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".number_format($target[$i])."&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".$customer[$i]."&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".$start[$i]."&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".$end[$i]."&nbsp;</td>";
		echo "<td class='c2' >";
		if($end[$i] != "") 
		echo number_format(floor($remaining_diff/3600/24))." days";
		else echo "0";
		echo "</td>";
		echo "<td  class='c2' width=7% align=right> ".$real[$i]."&nbsp;</td>";
		echo "<td class='c2' >";
		if($end[$i] != "" && $d2 > $d3) 
		echo "<font color=red><b>".number_format(floor($seconds_diff/3600/24))."<b></font> days";
		else echo "0";
		echo "</td>";
		
		echo "</tr>";
	}

?>
</tr>

</table>



    </td>
</tr>


<tr>
    <td height=30 style="color:#888;">
<?
//현재 재고
$i=0;

	if($want_year =="") $want_year = date("Y");

	$query4 = "select  *  from g4_write_project  where wr_9 ='pending'  ";  
		$result4 = sql_query($query4);
		while($row  = sql_fetch_array($result4)) {

			
			$poutput[$i] = $row[wr_10];
//			$shipping[$i] = $row[sunwr1];
			$ptarget[$i] = $row[wr_1];
			$pproject[$i] = $row[wr_subject];
			$pcustomer[$i] = $row[wr_4];
			$pstart[$i] = $row[wr_2];
			$pend[$i] = $row[wr_3];
			$preal[$i] = $row[wr_link1];
			$pdelay[$i] = $row[wr_link1];

			
		//echo $output[$i] = $project[$i] = $row[wr_subject].$row[wr_10].$target[$i]."<br>";
			$i++;
		}
?>



<table class="t_ex2">
<tr><td colspan=10 bgcolor=white align=center height=50> <b>중지된 프로젝트</b></td></tr>
	<tr><th  class='c1'  >Project</th>
	<th  class='c1'  >Output(%)</th>
	<th  class='c1'  >Shipping(%)</th>
	<th  class='c1'  >Target</th>
	<th  class='c1'  >Customer</th>
	<th  class='c1'  >Start</th>
	<th  class='c1'  >Planned</th>

	

		<?

	for($i=0; $i < count($pproject); $i++) {
	

		$d1 = strtotime($pstart[$i]);
		$d2 = strtotime($preal[$i]);
		$d3 = strtotime($pend[$i]);
		//echo $end."//".$d3;
		$seconds_diff = $d2 - $d1;
		$remaining_diff = $d3 - $d1;
		//$delay = date_diff($start, $end);

			
        @$b = round($output[$i]/$target[$i]*100);

		echo "<tr><td class='c2' width=7% align=center> ".$pproject[$i]." </td>";
		echo "<td  class='c2' width=7% align=right> ".number_format($poutput[$i])."(".$b.")&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".number_format($pshipping[$i])."&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".number_format($ptarget[$i])."&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".$pcustomer[$i]."&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".$pstart[$i]."&nbsp;</td>";
		echo "<td  class='c2' width=7% align=right> ".$pend[$i]."&nbsp;</td>";
		
		
		
		echo "</tr>";
	}

?>



</table>
    </td>
</tr>