spree-point-of-sale 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.gitignore +16 -0
  2. data/Gemfile +20 -0
  3. data/LICENSE +23 -0
  4. data/README.md +71 -0
  5. data/Rakefile +29 -0
  6. data/Versionfile +11 -0
  7. data/app/assets/images/admin/pos/customer.png +0 -0
  8. data/app/assets/images/admin/pos/del_16.png +0 -0
  9. data/app/assets/images/admin/pos/plus_16.png +0 -0
  10. data/app/assets/images/admin/pos/select.jpg +0 -0
  11. data/app/assets/javascripts/admin/spree_pos.js +20 -0
  12. data/app/assets/stylesheets/admin/html-label.css +20 -0
  13. data/app/assets/stylesheets/admin/spree_pos.css +25 -0
  14. data/app/controllers/spree/admin/barcode_controller.rb +49 -0
  15. data/app/controllers/spree/admin/checkout_controller_decorator.rb +7 -0
  16. data/app/controllers/spree/admin/pos_controller.rb +205 -0
  17. data/app/controllers/spree/admin/stock_locations_controller_decorator.rb +13 -0
  18. data/app/helpers/admin/barcode_helper.rb +31 -0
  19. data/app/models/spree/order_decorator.rb +38 -0
  20. data/app/models/spree/payment_decorator.rb +10 -0
  21. data/app/models/spree/payment_method/point_of_sale.rb +30 -0
  22. data/app/models/spree/shipment_decorator.rb +29 -0
  23. data/app/models/spree/stock/coordinator_decorator.rb +10 -0
  24. data/app/models/spree/stock_location_decorator.rb +18 -0
  25. data/app/models/spree/user_decorator.rb +10 -0
  26. data/app/models/spree/variant_decorator.rb +3 -0
  27. data/app/overrides/add_barcode_link_for_products_and_variants.rb +21 -0
  28. data/app/overrides/add_is_pos_filter_to_admin_orders.rb +11 -0
  29. data/app/overrides/add_pos_button.rb +5 -0
  30. data/app/overrides/add_store_to_spree_stock_locations.rb +11 -0
  31. data/app/overrides/admin_adds_pos_config.rb +7 -0
  32. data/app/overrides/codes.rb +10 -0
  33. data/app/overrides/pos_tab.rb +6 -0
  34. data/app/views/spree/admin/barcode/basic.html.erb +28 -0
  35. data/app/views/spree/admin/invoice/_line_items_invoice.html.erb +34 -0
  36. data/app/views/spree/admin/invoice/_receipt_header.html.erb +13 -0
  37. data/app/views/spree/admin/invoice/_totals_receipt.html.erb +25 -0
  38. data/app/views/spree/admin/invoice/receipt.html.erb +26 -0
  39. data/app/views/spree/admin/orders/_admin_pos_config.html.erb +5 -0
  40. data/app/views/spree/admin/orders/_pos_button.html.erb +1 -0
  41. data/app/views/spree/admin/pos/find.html.erb +81 -0
  42. data/app/views/spree/admin/pos/show.html.erb +137 -0
  43. data/app/views/spree/admin/pos/update_stock_location.js.erb +5 -0
  44. data/app/views/spree/admin/products/_barcode_product_link.html.erb +3 -0
  45. data/app/views/spree/admin/products/_barcode_variant_link.html.erb +3 -0
  46. data/config/application.rb +23 -0
  47. data/config/boot.rb +5 -0
  48. data/config/initializers/constants.rb +4 -0
  49. data/config/locales/codes-fi.yml +3 -0
  50. data/config/locales/en.yml +16 -0
  51. data/config/locales/fi.yml +8 -0
  52. data/config/routes.rb +21 -0
  53. data/db/migrate/20130723140316_add_delivered_at_and_canceled_at_to_spree_shipments.rb +6 -0
  54. data/db/migrate/20130730102503_add_store_and_address_id_in_spree_stock_locations.rb +8 -0
  55. data/db/migrate/20131014053417_add_is_pos_to_spree_orders.rb +6 -0
  56. data/db/migrate/20131025110309_add_card_name_to_spree_payments.rb +5 -0
  57. data/lib/generators/spree_pos/install/install_generator.rb +27 -0
  58. data/lib/spree_pos.rb +2 -0
  59. data/lib/spree_pos/configuration.rb +7 -0
  60. data/lib/spree_pos/engine.rb +29 -0
  61. data/spec/constants_spec.rb +8 -0
  62. data/spec/controllers/spree/admin/barcode_controller_spec.rb +86 -0
  63. data/spec/controllers/spree/admin/pos_controller_spec.rb +849 -0
  64. data/spec/models/spree/order_decorator_spec.rb +178 -0
  65. data/spec/models/spree/payment_decorator_spec.rb +115 -0
  66. data/spec/models/spree/payment_method/point_of_sale_spec.rb +25 -0
  67. data/spec/models/spree/shipment_decorator_spec.rb +172 -0
  68. data/spec/models/spree/stock/coordinator_spec.rb +31 -0
  69. data/spec/models/spree/stock_location_decorator_spec.rb +43 -0
  70. data/spec/models/spree/user_decorator_spec.rb +24 -0
  71. data/spec/models/spree/varaint_decorator_spec.rb +31 -0
  72. data/spec/spec_helper.rb +67 -0
  73. data/spree-point-of-sale.gemspec +32 -0
  74. metadata +183 -0
@@ -0,0 +1,13 @@
1
+ Spree::Admin::StockLocationsController.class_eval do
2
+ def update
3
+ if @stock_location.update_attributes(params[:stock_location])
4
+ flash[:success] = flash_message_for(@object, :successfully_updated)
5
+ respond_with(@object) do |format|
6
+ format.html { redirect_to location_after_save }
7
+ format.js { render :layout => false }
8
+ end
9
+ else
10
+ render :edit
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,31 @@
1
+ module Admin::BarcodeHelper
2
+
3
+ #"http://generator.onbarcode.com/linear.aspx?SHOW-START-STOP-IN-TEXT=false&X=3&Y=75&TYPE=7&DATA=<%=@product.sku%>"
4
+ def product_barcode_url
5
+ "/admin/barcode/code/#{@product.id}"
6
+ end
7
+
8
+ def empty_pdf(layout = {})
9
+ layout = { :width => 54, :height => 31, :margin => 1 }.merge(layout)
10
+ pdf = Prawn::Document.new( :page_size => [ layout[:width].mm , layout[:height].mm ] , :margin => layout[:margin].mm )
11
+ end
12
+
13
+ def current_symbol
14
+ @currency = Spree::Config[:currency]
15
+ @currency == 'NGN' ? 'N' : Money::Currency.table.select { |key, value| value.has_value?(@currency) }.values[0][:symbol]
16
+ end
17
+
18
+ def get_barcode(variant)
19
+ code = variant.sku
20
+ return code ? ::Barby::Code128B.new( code ) : code
21
+ end
22
+
23
+ def append_barcode_to_pdf_for_variant(variant, pdf = empty_pdf)
24
+ [ variant.name, variant.options_text, ( variant.price.to_s + current_symbol ) ].each { |item| pdf.text( item ) }
25
+
26
+ barcode = get_barcode(variant)
27
+ pdf.image( StringIO.new( barcode.to_png(:xdim => 5)) , :width => 50.mm , :height => 10.mm, :margin => 2.mm) if barcode
28
+ pdf.text(' ')
29
+ pdf
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ Spree::Order.class_eval do
2
+ attr_accessible :state, :is_pos, :completed_at, :payment_state
3
+
4
+ scope :pos, where(:is_pos => true)
5
+ scope :unpaid, where("payment_state != 'paid'")
6
+ scope :unpaid_pos_order, ->{ pos.unpaid }
7
+
8
+ def clean!
9
+ payments.delete_all
10
+ line_items.each { |line_item| contents.remove(line_item.variant, line_item.quantity, shipment) }
11
+ #shipment is removed on removing all items, so initializing a new shipment
12
+ assign_shipment_for_pos
13
+ end
14
+
15
+ def complete_via_pos
16
+ touch :completed_at
17
+ create_tax_charge!
18
+ save!
19
+ pending_payments.first.capture!
20
+ shipments.each { |shipment| shipment.finalize_pos }
21
+ deliver_order_confirmation_email
22
+ end
23
+
24
+ def assign_shipment_for_pos
25
+ shipments.create_shipment_for_pos_order if is_pos?
26
+ end
27
+
28
+ def save_payment_for_pos(payment_method_id, card_name = nil)
29
+ payments.delete_all
30
+ payment = payments.create(:amount => total, :payment_method_id => payment_method_id, :card_name => card_name)
31
+ end
32
+
33
+ def associate_user_for_pos(new_user_email)
34
+ associate_with_user = Spree::User.where(:email => new_user_email).first || Spree::User.create_with_random_password(new_user_email)
35
+ self.email = new_user_email if associate_with_user.valid?
36
+ associate_with_user
37
+ end
38
+ end
@@ -0,0 +1,10 @@
1
+ Spree::Payment.class_eval do
2
+ attr_accessible :card_name
3
+ validates :payment_method, :presence => true, :if => ["order.is_pos?"]
4
+ validates :card_name, :presence => true, :if => [:payment_method, "order.is_pos? && payment_method.name.scan(/card/i).present?"]
5
+ validate :no_card_name, :if => [:payment_method, "payment_method.name.scan(/card/i).blank?"]
6
+
7
+ def no_card_name
8
+ errors.add(:base, "No card name to be saved with this payment") if card_name.present?
9
+ end
10
+ end
@@ -0,0 +1,30 @@
1
+ module Spree
2
+ class PaymentMethod::PointOfSale < PaymentMethod
3
+
4
+ def actions
5
+ %w{capture void}
6
+ end
7
+
8
+ # Indicates whether its possible to capture the payment
9
+ def can_capture?(payment)
10
+ ['checkout', 'pending'].include?(payment.state)
11
+ end
12
+
13
+ # Indicates whether its possible to void the payment.
14
+ def can_void?(payment)
15
+ payment.state != 'void'
16
+ end
17
+
18
+ def capture(*args)
19
+ ActiveMerchant::Billing::Response.new(true, "", {}, {})
20
+ end
21
+
22
+ def void(*args)
23
+ ActiveMerchant::Billing::Response.new(true, "", {}, {})
24
+ end
25
+
26
+ def source_required?
27
+ false
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,29 @@
1
+ Spree::Shipment.class_eval do
2
+ before_save :udpate_order_addresses_from_stock_location, :if => ["order.is_pos?", "stock_location_id.present?", :stock_location_id_changed? ]
3
+ validate :empty_inventory, :if => ["order.is_pos?", "stock_location_id.present?", :stock_location_id_changed? ]
4
+
5
+ def finalize_pos
6
+ self.state = "shipped"
7
+ inventory_units.each &:ship!
8
+ self.save
9
+ touch :delivered_at
10
+ end
11
+
12
+ def self.create_shipment_for_pos_order
13
+ shipment = new
14
+ shipment.stock_location = Spree::StockLocation.stores.active.first
15
+ shipment.shipping_methods << Spree::ShippingMethod.where(:name => SpreePos::Config[:pos_shipping]).first
16
+ shipment.save!
17
+ end
18
+
19
+ private
20
+
21
+ def empty_inventory
22
+ errors[:base] = "Inventory Units assigned for the order. Please remove them to change stock location" if inventory_units.present?
23
+ end
24
+
25
+ def udpate_order_addresses_from_stock_location
26
+ order.bill_address = order.ship_address = stock_location.address
27
+ order.save
28
+ end
29
+ end
@@ -0,0 +1,10 @@
1
+ Spree::Stock::Coordinator.class_eval do
2
+ #overwrite the spree method to not use stores to build packages
3
+ def build_packages(packages)
4
+ ::Spree::StockLocation.active.not_store.each do |stock_location|
5
+ packer = build_packer(stock_location, order)
6
+ packages += packer.packages
7
+ end
8
+ packages
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ module Spree
2
+ StockLocation.class_eval do
3
+ attr_accessible :store
4
+ belongs_to :address
5
+
6
+ before_validation :associate_address
7
+
8
+ scope :stores, where(:store => true)
9
+ scope :not_store, where('store != ?', true)
10
+
11
+ validates_associated :address
12
+
13
+ private
14
+ def associate_address
15
+ self.address = Spree::Address.where(:firstname => name, :lastname => '(Store)', :state_id => state_id, :country_id => country_id, :address1 => address1, :address2 => address2, :phone => phone, :zipcode => zipcode, :city => city).first_or_initialize if respond_to?(:state_id) && store?
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ Spree::User.class_eval do
2
+ def unpaid_pos_orders
3
+ orders.unpaid_pos_order
4
+ end
5
+
6
+ def self.create_with_random_password(email)
7
+ random_pass = RANDOM_PASS_REGEX.sample(8).join
8
+ create(:email => email, :password => random_pass)
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ Spree::Variant.class_eval do
2
+ scope :available_at_stock_location, ->(stock_location_id) { active.joins(:stock_items).where('spree_stock_items.count_on_hand > 0 AND spree_stock_items.stock_location_id = ?', stock_location_id)}
3
+ end
@@ -0,0 +1,21 @@
1
+ Deface::Override.new(
2
+ :virtual_path => 'spree/admin/products/index',
3
+ :name => 'add print barcodes link to products for admin',
4
+ :insert_bottom => "[data-hook='admin_products_index_row_actions']",
5
+ :original => 'b918c38c9d3d9213d08b992cfc2c52dd0952ccf7',
6
+ :text => %q{
7
+ &nbsp;
8
+ <%= link_to 'barcodes', "/admin/barcode/print_variants_barcodes/#{product.id}" %>
9
+ }
10
+ )
11
+
12
+ Deface::Override.new(
13
+ :virtual_path => 'spree/admin/variants/index',
14
+ :name => 'add print barcode link to variants for admin',
15
+ :insert_bottom => "[data-hook='variants_row'] .actions",
16
+ :original => 'b918c38c9d3d9213d08b992cfc2c52dd0952ccf7',
17
+ :text => %q{
18
+ &nbsp;
19
+ <%= link_to 'barcode', "/admin/barcode/print/#{variant.id}" %>
20
+ }
21
+ )
@@ -0,0 +1,11 @@
1
+ Deface::Override.new(
2
+ :virtual_path => 'spree/admin/orders/index',
3
+ :name => 'add_is_pos_filter_to_admin_orders',
4
+ :insert_bottom => ".omega.four.columns .field.checkbox",
5
+ :text => %q{
6
+ <label>
7
+ <%= f.check_box :is_pos_eq, {}, '1', '' %>
8
+ show only pos orders
9
+ </label>
10
+ }
11
+ )
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(:virtual_path => "spree/admin/shared/_order_tabs",
2
+ :name => "add_pos_button",
3
+ :insert_after => ".sidebar",
4
+ :partial => "spree/admin/orders/pos_button",
5
+ :disabled => false)
@@ -0,0 +1,11 @@
1
+ Deface::Override.new(
2
+ :virtual_path => 'spree/admin/stock_locations/_form',
3
+ :name => 'add_store_to_spree_stock_locations',
4
+ :insert_bottom => "[data-hook='admin_stock_locations_form_fields'] ul",
5
+ :text => %q{
6
+ <li>
7
+ <%= f.label :store, Spree.t(:store) + ':' %>
8
+ <%= f.check_box :store %>
9
+ </li>
10
+ }
11
+ )
@@ -0,0 +1,7 @@
1
+ Deface::Override.new(
2
+ :virtual_path => "spree/admin/general_settings/edit",
3
+ :name => "add_adds_pos_config",
4
+ :insert_after => "fieldset.security",
5
+ :partial => "spree/admin/orders/admin_pos_config",
6
+ :disabled => false
7
+ )
@@ -0,0 +1,10 @@
1
+ Deface::Override.new(:virtual_path => 'spree/admin/variants/_form',
2
+ :name => "Add product label button",
3
+ :insert_bottom => ".right",
4
+ :partial => "spree/admin/products/barcode_variant_link",
5
+ :disabled => false)
6
+ Deface::Override.new(:virtual_path => 'spree/admin/products/_form',
7
+ :name => "Add product label button",
8
+ :insert_bottom => ".right",
9
+ :partial => "spree/admin/products/barcode_product_link",
10
+ :disabled => false)
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(:virtual_path => "spree/layouts/admin",
2
+ :name => "Add Pos tab to menu",
3
+ :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
4
+ :text => " <%= tab( :pos , :url => admin_pos_path) %>",
5
+ :sequence => {:after => "promo_admin_tabs"},
6
+ :disabled => false)
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ <%= stylesheet_link_tag "admin/html-label" %>
6
+ <%= stylesheet_link_tag "admin/html-label" , :media => "print" %>
7
+ <title>Barcode</title>
8
+ </head>
9
+
10
+ <body>
11
+ <div>
12
+ <table valign="middle" width="200px" height="75">
13
+ <tr class="label-name">
14
+ <td colspan="2"><%=@product.name%> </td>
15
+ </tr>
16
+ <tr>
17
+ <td>
18
+ <img src="<%=product_barcode_url%>" height="40" width="132"/>
19
+ </td>
20
+ <td class="label-price" width="60px"align="right">
21
+ <%=@product.price%> €
22
+ </td>
23
+ </tr>
24
+ </table>
25
+ </div>
26
+ </body>
27
+ </html>
28
+
@@ -0,0 +1,34 @@
1
+ <table width="700" cellspacing="0" cellpadding="7" border="0" class="line_items" style="border:solid 1px #cccccc; border-bottom:none; margin:30px 0;" >
2
+ <colgroup>
3
+ <col/>
4
+ <col/>
5
+ <col class="price"/>
6
+ <col class="qty"/>
7
+ <col class="total"/>
8
+ </colgroup>
9
+ <tr>
10
+ <th align="left" bgcolor="#cccccc" style="background:#cccccc;" class="sku bold"><font face="Arial, Helvetica, sans-serif" size="2"><%= t(:sku) %></font></th>
11
+ <th align="left" bgcolor="#cccccc" style="background:#cccccc;" class="desc bold"><font face="Arial, Helvetica, sans-serif" size="2"><%= t(:item_description) %></font></th>
12
+ <th align="left" bgcolor="#cccccc" style="background:#cccccc;" class="price bold"><font face="Arial, Helvetica, sans-serif" size="2"><%=t(:price) unless @receipt%></font></th>
13
+ <th align="left" bgcolor="#cccccc" style="background:#cccccc;" class="qty bold"><font face="Arial, Helvetica, sans-serif" size="2"><%= t(:qty) %> </font></th>
14
+ <th align="right" bgcolor="#cccccc" style="background:#cccccc;" class="total bold"><font face="Arial, Helvetica, sans-serif" size="2"><%= t(:total) %></font></th>
15
+ </tr>
16
+ <% @order.line_items.each do |item| %>
17
+ <tr >
18
+ <td class="cell" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%=item.variant.sku %></font></td>
19
+ <td class="cell" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%= item.variant.product.fullname rescue item.variant.product.name %></font></td>
20
+ <td class="cell price" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%=number_to_currency(item.price) unless @receipt%></font></td>
21
+ <td class="cell qty" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%=item.quantity %></font></td>
22
+ <td align="right" class="cell total" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%=number_to_currency(item.price * item.quantity) %></font></td>
23
+ </tr>
24
+ <% if item.respond_to? :discount and item.discount > 0 %>
25
+ <tr style="border-bottom:solid 1px #cccccc;">
26
+ <td class="cell" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;</font></td>
27
+ <td class="cell" style="border-bottom:solid 1px #cccccc;">(<font face="Arial, Helvetica, sans-serif" size="2"><%= t(:discount) %>)</font></td>
28
+ <td class="cell price" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%=number_to_currency(-1 * item.discount) %></font></td>
29
+ <td class="cell qty" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;</font></td>
30
+ <td class="cell total" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%=number_to_currency(-1 * item.discount * item.quantity) %></font></td>
31
+ </tr>
32
+ <% end %>
33
+ <% end %>
34
+ </table>
@@ -0,0 +1,13 @@
1
+ <table width="700" border="0" cellspacing="0" cellpadding="0">
2
+ <tr>
3
+ <td width="272"><%= logo %></td>
4
+ <td class="info" align="center" style=" font-size: 14px; letter-spacing: 2px; line-height: 1.3; padding: 6px; text-align: center; text-transform: uppercase; width: 700px;">
5
+ <font face="Georgia,"Times New Roman",Times,serif" color="black">
6
+ <!--<div class="shop"><%= Spree::Config[:site_name] %></div>-->
7
+ Fredrikinkatu 19 (Viiskulma) <br>
8
+ 00120 Helsinki<br><br>
9
+ <%=I18n.l(@order.completed_at.to_date) if @order.completed_at %>&nbsp;/&nbsp;
10
+ <%= Spree.t(:order_number) %> <%=@order.number%></font>
11
+ </td>
12
+ </tr>
13
+ </table>
@@ -0,0 +1,25 @@
1
+ <table width="700" cellspacing="0" cellpadding="7" border="0" class="line_items" style="border:solid 1px #cccccc; border-bottom:none; margin:30px 0;" >
2
+ <% @order.adjustments.eligible.each do |adjustment| %>
3
+ <tr class="total">
4
+ <td class="cel1 bold" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%= adjustment.label %>:</font></td>
5
+ <td class="cel2 cell" align="right" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%= adjustment.display_amount.to_html %></font></td>
6
+ </tr>
7
+ <% end %>
8
+ <tr>
9
+ <td class="cel1 bold" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><strong><%= t(:order_total) %>:</strong></font></td>
10
+ <td class="cel2 cell" align="right" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><strong><span id='summary-order-total'><%= number_to_currency @order.total %></span></strong></font></td>
11
+ </tr>
12
+ <% if @order.price_adjustment_totals.present? %>
13
+ <tr>
14
+ <td class="cel1" style="border-bottom:solid 1px #cccccc;" style="border-bottom:solid 1px #cccccc;"></td>
15
+ <td class="cel2" style="border-bottom:solid 1px #cccccc;"></td>
16
+ </tr>
17
+ <% @order.price_adjustment_totals.keys.each do |key| %>
18
+ <% next unless @order.price_adjustment_totals[key] %>
19
+ <tr class="total">
20
+ <td class="cel1 bold" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%= key %>:</font></td>
21
+ <td class="cel2 cell" align="right" style="border-bottom:solid 1px #cccccc;"><font face="Arial, Helvetica, sans-serif" size="2"><%= number_to_currency @order.price_adjustment_totals[key] %></font></td>
22
+ </tr>
23
+ <% end %>
24
+ <% end %>
25
+ </table>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ <title><%= Spree.t("#{params[:template]}.header") %></title>
6
+ </head>
7
+
8
+ <body onLoad="self.print()">
9
+ <div class="receipt">
10
+ <div id="header">
11
+ <%= render :partial => "spree/admin/invoice/receipt_header" %>
12
+ </div>
13
+
14
+ <div class="wrapper">
15
+ <div class="line_items">
16
+ <%= render :partial => "spree/admin/invoice/line_items_invoice" %>
17
+ </div>
18
+ <!--<div class="spacer"> &nbsp;</div>-->
19
+ <div class="totals">
20
+ <%= render :partial => "spree/admin/invoice/totals_receipt" %>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </body>
25
+ </html>
26
+
@@ -0,0 +1,5 @@
1
+ <fieldset class="no-border-bottom">
2
+ <legend align="center">Pos Settings</legend>
3
+ <label>Pos Shipping Method</label>
4
+ <%= select_tag :pos_shipping, options_from_collection_for_select(Spree::ShippingMethod.all, :name, :name, SpreePos::Config[:pos_shipping]), :class => 'fullwidth' %>
5
+ </fieldset>
@@ -0,0 +1 @@
1
+ <%= button_link_to("Pos", "/admin/pos/show/#{@order.number}" )%>
@@ -0,0 +1,81 @@
1
+ <% unless @variants.blank? %>
2
+ <table>
3
+ <tr>
4
+ <td>
5
+ <table class="index" id='listing_products'>
6
+ <tr>
7
+ <th>SKU</th>
8
+ <th><%= Spree.t("image") %></th>
9
+ <th><%= sort_link @search,:product_name, Spree.t("name"), {}, {:title => 'admin_products_listing_name_title'} %></th>
10
+ <th><%= sort_link @search,:price, Spree.t("master_price") %></th>
11
+ <th><%= Spree.t("select") %></th>
12
+ </tr>
13
+ <% @variants.each do |variant| %>
14
+ <% next if variant.is_master and variant.product.has_variants?%>
15
+ <tr <%= 'style="color:red;"' if variant.deleted? %> id="<%= dom_id variant %>">
16
+ <td><%= variant.sku %></td>
17
+ <td><% if variant.images.first %>
18
+ <%= image_tag variant.images.first.attachment.url(:mini) %>
19
+ <%elsif variant.product.images.first %>
20
+ <%= image_tag variant.product.images.first.attachment.url(:mini) %>
21
+ <% end %>
22
+ </td>
23
+ <td> <%= link_to( "#{variant.name} #{variant.options_text}" , edit_admin_product_url(variant.product)) %>
24
+ <br> <%== variant.description[0 .. 200] if variant.description%></td>
25
+ <td><%= variant.price %></td>
26
+ <td class="actions">
27
+ <%= link_to( image_tag('admin/pos/select.jpg'), "/admin/pos/add/#{@order.number}/#{variant.id}") %>
28
+ </td>
29
+ </tr>
30
+ <% end %>
31
+ </table>
32
+ <% @pos = @variants %>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+ <%= paginate @variants %>
37
+ <% else %>
38
+ No Result Found
39
+ <% end %>
40
+ <% content_for :sidebar do %>
41
+ <div>
42
+ <%= button_to "Back To Order", admin_pos_show_order_path(:number => @order.number) %>
43
+ </div>
44
+ <%= search_form_for @search , :url => "/admin/pos/find/#{@order.number}/" do |f| %>
45
+ <div class="box">
46
+ <h3><%= Spree.t(:search) %></h3>
47
+ <p>
48
+ <%= f.label :product_name_cont, Spree.t("name") %><br />
49
+ <%= f.text_field :product_name_cont, :size => 15 %>
50
+ </p>
51
+ <p>
52
+ <%= f.label :product_description_cont, Spree.t("description") %><br />
53
+ <%= f.text_field :product_description_cont, :size => 15 %>
54
+ </p>
55
+ <p>
56
+ <%= f.label :product_product_properties_value_cont , Spree.t(:properties_value) %><br />
57
+ <%= f.text_field :product_product_properties_value_cont, :size => 15 %>
58
+ </p>
59
+ <p>
60
+ <%= f.label :product_option_name_cont , Spree.t(:option_name_cont) %><br />
61
+ <%= f.text_field :option_values_name_cont, :size => 15 %>
62
+ </p>
63
+ <p>
64
+ <%= f.label :sku_cont, Spree.t("sku") %><br />
65
+ <%= f.text_field :sku_cont, :size => 15 %>
66
+ </p>
67
+ <p>
68
+ <%= f.label :prices_amount_gteq, Spree.t("price_min") %><br />
69
+ <%= f.text_field :prices_amount_gteq, :size => 15 %>
70
+ </p>
71
+ <p>
72
+ <%= f.label :prices_amount_lteq, Spree.t("price_max") %><br />
73
+ <%= f.text_field :prices_amount_lteq, :size => 15 %>
74
+ </p>
75
+
76
+ <p class="form-buttons">
77
+ <%= button Spree.t("search") %>
78
+ </p>
79
+ </div>
80
+ <% end %>
81
+ <%end%>