From e3b3ff76b2f5b70f5cf791c4d12a931fb2042634 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 21 Jun 2017 14:49:01 +0630 Subject: [PATCH] add account_id to od_item and sale_item table --- app/assets/stylesheets/origami.scss | 10 +- app/models/order.rb | 2 +- app/models/order_item.rb | 3 +- app/models/sale.rb | 1 + app/views/origami/discounts/index.html.erb | 177 ++++++++++++++++-- .../20170403140820_create_order_items.rb | 1 + .../20170403161857_create_sale_items.rb | 1 + 7 files changed, 180 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 3229ed3e..6b350bf1 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -9,6 +9,7 @@ // min-height: 75rem; // padding-top: 4.5rem; // } + .others-payment{ line-height:100px; text-align:center; @@ -41,12 +42,13 @@ .pay{ width: 98%; - height:211px; + height:211px; line-height:211px; text-align:center; font-size:20px; color:white; } + .payment{ height:70px;line-height:70px;align:center;color:white;font-size:16px;margin-bottom:1px; } @@ -58,6 +60,7 @@ .credit-color{ background-color:#FFCCBC; } + .other-payment-color{ background-color:#E1BEE7; } @@ -100,6 +103,11 @@ background-color: blue !important; } +.selected-account { + color: #fff !important; + background-color: blue !important; +} + /* Reciept Style */ #order-charges-table td { border-top: none !important; diff --git a/app/models/order.rb b/app/models/order.rb index 7ab39a4c..1337b89b 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -82,7 +82,7 @@ class Order < ApplicationRecord set_order_items end - OrderItem.processs_item(menu_item[:item_code], menu_item[:name], + OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id] item[:quantity],menu_item[:price], item[:options], set_order_items, self.id, self.employee_name) diff --git a/app/models/order_item.rb b/app/models/order_item.rb index 564aa939..2c9a9ba0 100644 --- a/app/models/order_item.rb +++ b/app/models/order_item.rb @@ -20,12 +20,13 @@ class OrderItem < ApplicationRecord # option_values : [], # sub_order_items : [], # } - def self.processs_item (item_code, menu_name, qty,price, options, set_menu_items, order_id, item_order_by) + def self.processs_item (item_code, menu_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by) orderitem = OrderItem.create do |oitem| oitem.order_id = order_id oitem.item_code = item_code oitem.item_name = menu_name + oitem.account_id = account_id oitem.qty = qty oitem.price = price oitem.options = options diff --git a/app/models/sale.rb b/app/models/sale.rb index e717717a..4998abfc 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -133,6 +133,7 @@ class Sale < ApplicationRecord #pull sale_item.product_code = item.item_code sale_item.product_name = item.item_name + sale_item.account_id = item.account_id sale_item.remark = item.remark sale_item.qty = item.qty diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index 2a063007..b2d3d5bc 100644 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -88,17 +88,6 @@
-
@@ -107,7 +96,7 @@ <% @accounts.each do |acc| %> - + <% end %>
@@ -186,3 +175,167 @@
+ + diff --git a/db/migrate/20170403140820_create_order_items.rb b/db/migrate/20170403140820_create_order_items.rb index c5382030..d8c858bd 100644 --- a/db/migrate/20170403140820_create_order_items.rb +++ b/db/migrate/20170403140820_create_order_items.rb @@ -7,6 +7,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.1] t.string :item_order_by #person who order this t.string :item_code, :null => false t.string :item_name, :null => false + t.integer :account, :limit => 8, :null => false, :default => 1 t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.string :remark diff --git a/db/migrate/20170403161857_create_sale_items.rb b/db/migrate/20170403161857_create_sale_items.rb index cb07db08..18c1a876 100644 --- a/db/migrate/20170403161857_create_sale_items.rb +++ b/db/migrate/20170403161857_create_sale_items.rb @@ -5,6 +5,7 @@ class CreateSaleItems < ActiveRecord::Migration[5.1] t.string :sale_id, foreign_key: true, :limit => 16 t.string :product_code, :null => false t.string :product_name, :null => false + t.integer :account, :limit => 8, :null => false, :default => 1 t.string :remark t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00