OSDN Git Service

・納品書・ピッキングリストを作成
authorYOSHIDA Hiroki <hyoshida@appirits.com>
Fri, 1 Mar 2013 01:32:14 +0000 (10:32 +0900)
committerymatsumoto <ymatsumoto@appirits.com>
Thu, 21 Mar 2013 08:18:02 +0000 (17:18 +0900)
・受注管理画面にピッキングリストへのボタン追加

app/controllers/admin/orders_controller.rb
app/views/admin/orders/picking_list.html.erb [new file with mode: 0644]
app/views/admin/orders/search.html.erb
app/views/admin/orders/statement.html.erb [new file with mode: 0644]
app/views/admin/orders/statement_only.html.erb [new file with mode: 0644]
app/views/layouts/admin/statement.html.erb [new file with mode: 0644]
config/routes.rb
public/stylesheets/admin.css

index a311c75..90305b0 100644 (file)
@@ -61,6 +61,22 @@ class Admin::OrdersController < Admin::BaseController
     end
   end
 
+  def statement
+      @order_delivery = OrderDelivery.find_by_order_id(params[:id].to_i)
+      @order_delivery.update_ticket(params[:order_delivery_ticket])
+      @shop = Shop.find(:first)
+  end
+
+  def statement_only
+      @order_delivery = OrderDelivery.find_by_order_id(params[:id].to_i)
+      @shop = Shop.find(:first)
+      render :layout => "admin/statement"
+  end
+
+  def picking_list
+      @order_deliveries = OrderDelivery.find(:all)
+  end
+
   def destroy
     # 親と子も消す
     order_delivery = OrderDelivery.find(:first, :conditions => ["order_id=?", params[:id].to_i])
diff --git a/app/views/admin/orders/picking_list.html.erb b/app/views/admin/orders/picking_list.html.erb
new file mode 100644 (file)
index 0000000..a18ecf7
--- /dev/null
@@ -0,0 +1,31 @@
+<%=h flash[:notice] %>
+<%=h flash[:error] %>
+<%= render :partial => "submenu" %>
+
+ <div id="main"><!-- メイン -->
+ <h2>ピッキングチェック表</h2></br>
+
+<table cellspacing="1" class="data2">
+<tr>
+<th colspan="8">受付商品情報</th></tr>
+<tr>
+  <th class="center">受注コード</th><th class="center">お客様氏名</th><th class="center">商品コード</th><th class="center">商品名/<br />規格1/<br />規格2</th><th class="center">単価</th><th class="center">数量</th><th class="ce
+nter">税込み価格</th><th class="center">小計</th>
+  </tr>
+<% @order_deliveries.each do | order_delivery | %>
+  <% order_delivery.order_details.each do | detail | %>
+ <tr>
+    <td><%=h order_delivery.order_code %> </td>
+    <td><%=h order_delivery.family_name %> <%=h order_delivery.first_name %> 様</td>
+
+    <td><%=h detail.product_code %></td>
+    <td><%=h detail.product_name %>/<br /><%=h detail.style_category_name1 %>/<br /><%=h detail.style_category_name2 %></td>
+    <td><%=h detail.price %>円</td>
+    <td><%=h detail.quantity %></td>
+    <td><%= number_with_delimiter(detail.price_with_tax) %>円</td>
+    <td><%= number_with_delimiter(detail.subtotal) %>円</td>
+   <% end %>
+<% end %>
+   </tr>
+
+</div>
index d8a6730..94a7de0 100644 (file)
     <%- end -%>
     <br />
     <p>&gt;&gt;検索結果一覧&nbsp;<%=@order_deliveries.total_entries %>件&nbsp;が該当しました</p>
+
     <div class="btn_box space20_bottom">
       <%= submit_tag 'CSV DOWNLOAD', :class=>"btn" %>
       <%= image_tag("btn_side.gif", :width => "6", :height => "34", :class => "btn_side") %>
     </div>
-  <% end %>
+    <% end %>
+
+  <% form_tag :action => 'picking_list' do %>
+  <div class="btn_box space20_bottom">
+      <%= submit_tag 'ピッキングリスト', :class=>"btn" %>
+      <%= image_tag("btn_side.gif", :width => "6", :height => "34", :class => "btn_side") %>
+  </div>
+     <% end %>
+
   <table class="data2 clear" cellspacing="1">
    <tr>
     <th>受注日</th>
@@ -36,6 +45,7 @@
     <th>対応状況</th>
     <th>編集</th>
     <th>メール</th>
+    <th>納品書</th>
     <th>削除</th>
    </tr>
    <% @order_deliveries.each do | order_delivery | %>
  mailto = 'mailto:%s?body=%s' % [order_delivery.email, URI.encode(body)]
  -%>
       <td><%= link_to '作成', mailto %></td>
-      <td><%= link_to "削除", { :action => "destroy", :id => order_delivery.id }, :confirm => "本当に削除しますか?", :method=>"delete" %></td>
-     </tr>
+   <td><%= link_to '納品書',{ :action => "statement", :id => order_delivery.id }  %></td>
+      
+<td><%= link_to "削除", { :action => "destroy", :id => order_delivery.id }, :confirm => "本当に削除しますか?", :method=>"delete" %></td>
    <% end %>
+</tr>
   </table>
+
   <%= will_paginate @order_deliveries, :params => params %>
 <% end %>
 
diff --git a/app/views/admin/orders/statement.html.erb b/app/views/admin/orders/statement.html.erb
new file mode 100644 (file)
index 0000000..9671bf2
--- /dev/null
@@ -0,0 +1,102 @@
+<%=h flash[:notice] %>
+<%=h flash[:error] %>
+<%= render :partial => "submenu" %>
+
+ <div id="main"><!-- メイン -->
+ <h2>納品書</h2><br />
+
+<% form_tag({:action => 'statement_only',:id=>@order_delivery.id },:target=>["_blank"])do  %>
+  <div class="btn_box space20_bottom">
+      <%= submit_tag '納品書全体表示', :class=>"btn" %>
+      <%= image_tag("btn_side.gif", :width => "6", :height => "34", :class => "btn_side") %>
+ </div>
+<%end%>
+
+ <table cellspacing="1" class="data">
+ <tr>
+ <th>発行日</th><td><%=h Time.now.strftime('%Y/%m/%d')%></td>
+ </tr>
+ <tr>
+ <th>受注日</th><td><%=h date(@order_delivery.received_at) %></td>
+ </tr>
+ <tr>
+ <th>お客様氏名</th><td><%=h @order_delivery.family_name %> <%=h @order_delivery.first_name %> 様</td>
+ </tr>
+  <tr>
+  <th>受注コード</th><td><%=h @order_delivery.order_code %></td></tr>
+  <tr>
+   <th>住所</th>
+   <td colspan="3">
+     〒<%=h @order_delivery.zipcode01 %>-<%=h @order_delivery.zipcode02 %><br />
+     <%=h @order_delivery.prefecture_name %> <%=h @order_delivery.address_city %> <%=h @order_delivery.address_detail %>
+   </td>
+   </tr>
+    <tr>
+    <th colspan="2">会社情報</th></tr>
+    <tr>
+    <th>会社名</th><td><%=h @shop.try(:corp_name) %></td></tr>
+    <tr>
+    <th>住所</th><td>〒<%=h @shop.try(:zipcode) %><br />
+                   <%=h @shop.try(:address) %></td></tr>
+    <tr>
+    <th>TEL</th><td><%=h @shop.try(:tel) %></td></tr>
+    </table>    
+
+<h3>毎度お買い上げいただき誠にありがとうございます。下記の通りに納品いたします。</h3> <br />
+<table cellspacing="1" class="data2">  
+<tr>
+<th colspan="6">受付商品情報</th></tr>
+<tr>
+   <th class="center">商品コード</th><th class="center">商品名/<br />規格1/<br />規格2</th><th class="center">単価</th><th class="center">数量</th><th class="ce
+nter">税込み価格</th><th class="center">小計</th>
+  </tr>
+  <% @order_delivery.order_details.each do | detail | %>
+   <tr>
+    <td><%=h detail.product_code %></td>
+    <td><%=h detail.product_name %>/<br /><%=h detail.style_category_name1 %>/<br /><%=h detail.style_category_name2 %></td>
+    <td><%=h detail.price %>円</td>
+    <td><%=h detail.quantity %></td>
+    <td><%= number_with_delimiter(detail.price_with_tax) %>円</td>
+    <td><%= number_with_delimiter(detail.subtotal) %>円</td>
+   </tr>
+  <% end %>
+  <tr>
+   <th colspan="5">小計</th>
+   <td><%=h number_with_delimiter(@order_delivery.subtotal) %>円</td>
+  </tr>
+  <% unless @order_delivery.discount.blank? %>
+  <tr>
+   <th colspan="5">値引</th>
+   <td><%=h @order_delivery.discount %>円</td>
+  </tr>
+  <% end %>
+  <tr>
+   <th colspan="5">送料</th>
+   <td><%=h @order_delivery.deliv_fee %>円</td>
+  </tr>
+  <tr>
+   <th colspan="5">手数料</th>
+   <td><%=h @order_delivery.charge %>円</td>
+  </tr>
+  <tr>
+<th colspan="5">合計</th>
+   <td><%=h number_with_delimiter(@order_delivery.total) %>円</td>
+  </tr>
+  <% unless @order_delivery.use_point.blank? %>
+  <tr>
+   <th colspan="5">使用ポイント</th>
+   <td><%=h number_with_delimiter(@order_delivery.use_point) %>ポイント</td>
+  </tr>
+  <% end %>
+  <% unless @order_delivery.add_point.blank? %>
+  <tr>
+   <th colspan="5">追加ポイント</th>
+   <td><%=h number_with_delimiter(@order_delivery.add_point) %>ポイント</td>
+  </tr>
+  <% end %>
+  <tr>
+   <th colspan="5">お支払い合計</th>
+   <td><%=h number_with_delimiter(@order_delivery.payment_total) %>円</td>
+  </tr>
+</table>
+ </div >
diff --git a/app/views/admin/orders/statement_only.html.erb b/app/views/admin/orders/statement_only.html.erb
new file mode 100644 (file)
index 0000000..890adec
--- /dev/null
@@ -0,0 +1,90 @@
+<div id="statement"><!-- メイン -->
+ <h2>納品書</h2><br />
+ <table cellspacing="1" class="data">
+<tbody> <tr>
+ <th>発行日</th><td><%=h Time.now.strftime('%Y/%m/%d')%></td>
+ </tr>
+ <tr>
+ <th>受注日</th><td><%=h date(@order_delivery.received_at) %></td>
+ </tr>
+ <tr>
+ <th>お客様氏名</th><td><%=h @order_delivery.family_name %> <%=h @order_delivery.first_name %> 様</td>
+ </tr>
+  <tr>
+  <th>受注コード</th><td><%=h @order_delivery.order_code %></td></tr>
+  <tr>
+   <th>住所</th>
+   <td colspan="3">
+     〒<%=h @order_delivery.zipcode01 %>-<%=h @order_delivery.zipcode02 %><br />
+     <%=h @order_delivery.prefecture_name %> <%=h @order_delivery.address_city %> <%=h @order_delivery.address_detail %>
+   </td>
+   </tr>
+    <tr>
+    <th colspan="2">会社情報</th></tr>
+    <tr>
+    <th>会社名</th><td><%=h @shop.try(:corp_name) %></td></tr>
+    <tr>
+    <th>住所</th><td>〒<%=h @shop.try(:zipcode) %><br />
+                   <%=h @shop.try(:address) %></td></tr>
+    <tr>
+    <th>TEL</th><td><%=h @shop.try(:tel) %></td></tr>
+   </tbody> </table>    
+
+<h3>毎度お買い上げいただき誠にありがとうございます。下記の通りに納品いたします。</h3> <br />
+<table cellspacing="1" class="data2">  
+<tr>
+<th colspan="6">受付商品情報</th></tr>
+<tr>
+   <th class="center">商品コード</th><th class="center">商品名/<br />規格1/<br />規格2</th><th class="center">単価</th><th class="center">数量</th><th class="ce
+nter">税込み価格</th><th class="center">小計</th>
+  </tr>
+  <% @order_delivery.order_details.each do | detail | %>
+   <tr>
+    <td><%=h detail.product_code %></td>
+    <td><%=h detail.product_name %>/<br /><%=h detail.style_category_name1 %>/<br /><%=h detail.style_category_name2 %></td>
+    <td><%=h detail.price %>円</td>
+    <td><%=h detail.quantity %></td>
+    <td><%= number_with_delimiter(detail.price_with_tax) %>円</td>
+    <td><%= number_with_delimiter(detail.subtotal) %>円</td>
+   </tr>
+  <% end %>
+  <tr>
+   <th colspan="5">小計</th>
+   <td><%=h number_with_delimiter(@order_delivery.subtotal) %>円</td>
+  </tr>
+  <% unless @order_delivery.discount.blank? %>
+  <tr>
+   <th colspan="5">値引</th>
+   <td><%=h @order_delivery.discount %>円</td>
+  </tr>
+  <% end %>
+  <tr>
+   <th colspan="5">送料</th>
+   <td><%=h @order_delivery.deliv_fee %>円</td>
+  </tr>
+  <tr>
+   <th colspan="5">手数料</th>
+   <td><%=h @order_delivery.charge %>円</td>
+  </tr>
+  <tr>
+<th colspan="5">合計</th>
+   <td><%=h number_with_delimiter(@order_delivery.total) %>円</td>
+  </tr>
+  <% unless @order_delivery.use_point.blank? %>
+  <tr>
+   <th colspan="5">使用ポイント</th>
+   <td><%=h number_with_delimiter(@order_delivery.use_point) %>ポイント</td>
+  </tr>
+  <% end %>
+  <% unless @order_delivery.add_point.blank? %>
+  <tr>
+   <th colspan="5">追加ポイント</th>
+   <td><%=h number_with_delimiter(@order_delivery.add_point) %>ポイント</td>
+  </tr>
+  <% end %>
+  <tr>
+   <th colspan="5">お支払い合計</th>
+   <td><%=h number_with_delimiter(@order_delivery.payment_total) %>円</td>
+  </tr>
+</table>
+</div>
diff --git a/app/views/layouts/admin/statement.html.erb b/app/views/layouts/admin/statement.html.erb
new file mode 100644 (file)
index 0000000..e353070
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<link href="/stylesheets/admin.css" rel="Stylesheet" type="text/css" />
+<html>
+  <head>
+    <title><%= @title || "納品書" %></title>
+  </head>
+<div id="login_body">
+<div id="containar" class="clearfix">
+  <%= yield %>
+</div>
+</div>
+</html>
index a6f95d7..728eaac 100644 (file)
@@ -14,7 +14,7 @@ ActionController::Routing::Routes.draw do |map|
     admin.resources :feature_products, :collection => {:product_search => [:get]}
     admin.resources :mobile_devices, :collection => {:search => [:get]}
     admin.resources :customers, :collection => {:get_address => [:get], :search => [:get]}
-    admin.resources :orders, :collection => {:get_address => [:get], :search => [:get]}, :member => {:edit => [:get, :put]}
+    admin.resources :orders, :collection => {:get_address => [:get], :search => [:get],:picking_list =>[:get]}, :member => {:edit => [:get, :put],:statement =>[:get]}
     admin.resources :order_statuses
     admin.resources :products, :collection => {:search => [:get], :actual_count_index => [:get], :actual_count_search => [:get]}
     admin.resources :product_styles
index 8404442..116c4d9 100644 (file)
@@ -218,6 +218,14 @@ html>/**/body {
   background-color: #ffffec;
 }
 
+#statement {
+  float: none;
+  width: 710px;
+  height: 823px;
+  padding: 10px 18px 18px;
+  background-color: #ffffec;
+}
+
 /*------メニュー------*/
 #menu {
   width: 190px;