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

<div id="main"><!-- メイン -->
  <div id="category" class="clearfix"><!-- カテゴリ選択 -->
    <p id="category_info">編集したいカテゴリをクリックして下さい。</p>
    <% if session[:admin_user].master_shop? %>
      <%= link_to image_tag("store_btn_l.gif", :width => "222", :height => "138", :alt => "店舗管理"), :controller => "shops", :action => "index" %>
    <% else %>
      <%= link_to image_tag("store_btn_l.gif", :width => "222", :height => "138", :alt => "店舗管理"), :controller => "shops", :action => "delivery_index" %>
    <% end %>
    <%= link_to image_tag("goods_btn_l.gif", :width => "222", :height => "138", :alt => "商品管理", :id => "category_img"), :controller => "products", :action => "index" %>
    <% if @system_supplier_use_flag %>
      <%= link_to image_tag("order_btn_l.gif", :width => "222", :height => "138", :alt => "発注・出荷管理"), :controller => "suppliers", :action => "index" %>
	  <%else%>
      <%= link_to image_tag("order_btn_l.gif", :width => "222", :height => "138", :alt => "発注・出荷管理"), :controller => "stock_in", :action => "index" %>
	  <%end%>
  </div><!-- /カテゴリ選択 -->
  <% if flash[:notice] %>
    <div style="color: red"><%= flash[:notice] %></div>
  <% end %>
  <h2>ショップの状況</h2>
  <table cellspacing="1" cellpadding="4" class="data">
    <tr>
      <th>現在の会員数</th>
      <td><%=h @active_customer_num %> 人</td>
    </tr>
    <tr>
      <th>昨日の受注金額</th>
      <td><%=h number_with_delimiter(@last_day_sales) %>円（税込）</td>
    </tr>
    <tr>
      <th>昨日の受注件数</th>
      <td><%=h @last_day_sales_num %>件</td>
    </tr>
    <tr>
      <th>今月の受注金額(昨日まで)</th>
      <td><%=h number_with_delimiter(@this_month_sales) %>円（税込）</td>
    </tr>
    <tr>
      <th>今月の受注件数 (昨日まで)</th>
      <td><%=h @this_month_sales_num %>件</td>
    </tr>
    <tr>
      <th rowspan="2">
        <%= link_to '品切れ商品', :controller => 'products', :action => 'actual_count_index' %>
      </th>
      <td style="text-align:left;"><%= sold_outs(@sold_outs) %></td>
    </tr>
    <tr>
      <td><%= sold_out_counts(@sold_outs) %></td>
    </tr>
  </table>
  <br />
  <h2>新規受付一覧（最新の10件を表示します）</h2>
  <table class="data" cellspacing="1">
    <tr>
      <th>受注日</th>
      <th>顧客名</th>
      <th>購入商品</th>
      <th>支払方法</th>
      <th >購入金額(円)</th>
    </tr>
    <% @new_orders.each do | new_order | %>
      <tr>
        <td><%=h date(new_order.created_at) %></td>
        <td><%=h new_order.family_name %> <%=h new_order.first_name %></td>
        <td>
          <% if new_order.order_details.find(:first) %>
            <%=h new_order.order_details.find(:first).product_name %>
          <% end %>
        </td>
        <td><%=h new_order.payment_name %></td>
        <td><%=h number_with_delimiter(new_order.total) %></td>
      </tr>
    <% end %>
  </table>

</div><!-- メイン -->

