<%= render :partial => "submenu" %>

<div id="main"><!-- メイン -->

<h2>在庫管理作業履歴</h2>
<%unless @product_style.blank?%>
<h3>現在在庫状況</h3>
<table class="data" cellspacing="1">
  <tr>
    <th>現在実在庫数</th>
    <td>
      <%= number_with_delimiter(@product_style.actual_count.to_i) %>
    </td>
  </tr>
  <tr>
    <th>現在受注可能数</th>
    <td>
      <%= number_with_delimiter(@product_style.orderable_count.to_i) %>
    </td>
  </tr>
  <tr>
    <th>現在不良在庫数</th>
    <td>
      <%= number_with_delimiter(@product_style.broken_count.to_i) %>
    </td>
  </tr>
</table>
<h3>作業履歴</h3>
<% unless @stock_histories.blank?%>
  <table class="data2 clear" cellspacing="1">
    <tr>
      <th>操作者</th>
      <th>移動日</th>
      <th>作業区分</th>
      <th>入庫数</th>
      <th>実在庫調整数</th>
      <th>当時実在庫数</th>
      <th>販売可能調整数</th>
      <th>当時販売可能数</th>
      <th>不良在庫調整数</th>
      <th>当時不良在庫数</th>
	  <th>備考</th>
	</tr>
    <% @stock_histories.each do | sh | %>
      <tr>
        <td><%= h sh.admin_user.name %></td>
        <td><%= date_time(sh.moved_at) %></td>
        <td><%= h(StockHistory::STOCK_TYPE_NAMES[sh.stock_type]) %></td>
        <td><%= number_with_delimiter(sh.storaged_count) %></td>
        <td><%= number_with_delimiter(sh.actual_adjustment) %></td>
        <td><%= number_with_delimiter(sh.actual_count.to_i) %></td>
        <td><%= number_with_delimiter(sh.orderable_adjustment) %></td>
        <td><%= number_with_delimiter(sh.orderable_count.to_i) %></td>
        <td><%= number_with_delimiter(sh.broken_adjustment) %></td>
        <td><%= number_with_delimiter(sh.broken_count.to_i) %></td>
        <td><%= h sh.comment %></td>
      </tr>
    <% end %>
</table>
<%else%>
<br/><p>在庫作業履歴はありません。</p>
<%end%>
<%else%>
<p>商品規格は存在しません。</p>
<%end%>
</div><!-- /メイン -->

