From 46f9bef2464610221d81830e80464f7fbf9667c2 Mon Sep 17 00:00:00 2001 From: Nweni Date: Sun, 4 Jun 2017 14:50:50 +0630 Subject: [PATCH 01/48] fixed conflict --- Gemfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 985d976c..4daa7759 100644 --- a/Gemfile +++ b/Gemfile @@ -9,19 +9,17 @@ end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.0' # Use mysql as the database for Active Record -<<<<<<< HEAD + #gem 'mysql2', '>= 0.3.18', '< 0.5' gem 'pg' -======= + gem 'mysql2', '>= 0.3.18', '< 0.5' #Use PosgreSQL -gem 'pg' + # redis server for cable # gem 'redis', '~> 3.0' - ->>>>>>> a2c9996b765666db4cbcbef188fcfa2d27a7a6e2 # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for stylesheets From cd3177c6829ca2a5c36b1d63f94bc3eff729d2c2 Mon Sep 17 00:00:00 2001 From: Nweni Date: Mon, 19 Jun 2017 15:22:50 +0630 Subject: [PATCH 02/48] order --- app/assets/stylesheets/origami.scss | 4 ++++ app/models/order.rb | 2 +- dump.rdb | Bin 18163 -> 17902 bytes 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 71a9915e..c96237fa 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -95,6 +95,10 @@ background-color:#7a62d3; } +.orange{ + background-color:#FF7F50; +} + .red { background-color:#ff0000; } diff --git a/app/models/order.rb b/app/models/order.rb index 14fd8cda..96382c07 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -246,7 +246,7 @@ class Order < ApplicationRecord .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") .where("sales.sale_status='completed'") - .group("sales.sale_id") + .group("sales.sale_id,bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id") # For PG #bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id end diff --git a/dump.rdb b/dump.rdb index 211fd505548a6a60b85596d4201ab6d1155b4f22..e6612cd4d745c3a266a4b581523a7577e82df134 100644 GIT binary patch delta 571 zcmey|%lNLFae}12;V-VD)RfF(-K5Nt;sXx9Sd&XKb5jpJh;fhn#Zg+EnxdPVntN!1 z1V6(+hTlRAlM|W56-;!E3=SwTh!vM4mRO}FX6B@(SQ!}@n(G>v=^C0HkOwM~lmjvp zu`4mKIFJfb!fI%G@D;=4>x?RFU=tZ8*D)zg)?_ka0jZdnWHhl%j?GNh!2CeqWJV_8 z&427Jvdc2D6_%!!rWP}?r=+GOmgbZ&=NA?;vlgY66jjP^erxf8k@>2V^W;Fjmd%?C z(-! zzU1Tr)YP(BMJ1V$@itieArDXq#FDwjIgFd-Mcy-R{xANDaq|L}*Nn^$fzA>XYuTJ2 zQ^Gj;qeaVR6D6RdZcNVC?ARP{o65+1*zp?JoGW}8jLeUmg29feHZNghzV75cxlprh z^AqhfM&=t(=jKagF>cP&dz>% delta 735 zcmY+AO-vI}6oq>`Q!65C{e<%tsGfc)=K3|DM%UC!Vo>(Bn1mBWUH6Wtk{S$frV+)}mtasY9{N!ArCUf&;x0%rBADis*Oy1<{Ko!6yYhL07=bva*uQE{ETS-*FF6 zDy!*=l)*?urW^4{(bZOY>XSDk& zc6wPu9hVf{*~`VVO59LYti7#eN-4;(#WV}_P5TG$wt^d@(W&F>e4o{%62Zg)e#HfG3J zwth6}5mg*kgyqxp|6=G1H)Yi6N~#A-cs0AyvdW178&l-A8geXKiB>>vebFH}(j zV^guN=DFp*Qsf4C(eRkgwdR11_k0I3UpGao$5KFdoV&oRMWW zGSIEQO<+oq!CLl52{UF|yqE^!XrH1@ji$#HssNp@EB`}z7}kIe`pRH- kbD9k-E?CUAT9`nQql@s#zONn)74h$ldmlE+(;YAW0K#ksk^lez From 6035e6612adc475feb381bb21e6ebd3764adf516 Mon Sep 17 00:00:00 2001 From: Nweni Date: Tue, 20 Jun 2017 07:40:24 +0630 Subject: [PATCH 03/48] udpate --- app/views/origami/home/show.html.erb | 216 +++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 app/views/origami/home/show.html.erb diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb new file mode 100644 index 00000000..4c784627 --- /dev/null +++ b/app/views/origami/home/show.html.erb @@ -0,0 +1,216 @@ +
+ +
+ + + + + +
+ +
+
+ +
+
+ + +
+
+
+
+ + +
+
+ <% @tables.each do |table| %> + <% if table.status == 'occupied' %> +
+
+ <%= table.name %> +
+
+ <% else %> +
+
+ <%= table.name %> +
+
+ <% end %> + <% end %> +
+
+ + +
+
+ <% @rooms.each do |room| %> + <% if room.status == 'occupied' %> +
+
+ <%= room.name %> +
+
+ <% else %> +
+
+ <%= room.name %> +
+
+ <% end %> + <% end %> +
+
+ + +
+
+ +
+
+ +
+
+
+ +
+
+ +
+ + + +
+
+
+
ORDER DETAILS
+
+
+
+
+

Receipt No: + <% if @status == 'sale' %> + <%= @obj.receipt_no rescue '' %> + <% end %> +

+
+
+

Date: <%= @obj.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+
+
+
+
+

Customer :

+
+ +
+
+ + + + + + + + <% + # For Sale Items + sub_total = 0 + if @status == "sale" + @obj.sale_items.each do |sale_item| + sub_total = sub_total + sale_item.price + %> + <% unless sale_item.price <= 0 %> + + + + + + <% + end + end + end + %> + + <% + # For Order Items + if @selected_item_type == "order" + @selected_item.order_items.each do |order_item| + sub_total = sub_total + (order_item.qty*order_item.price) + %> + + + + + + <% + end + end + %> + +
ItemsQTY + Price +
<%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
<%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
+
+ +
+
+
+ + +
+ + + + + + + + + + + +
+
+ From 75dd4db10f2b17731f4e7740fe2f98431c72b629 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 26 Jun 2017 19:33:29 +0630 Subject: [PATCH 04/48] update seed --- db/seeds.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/seeds.rb b/db/seeds.rb index 21268860..d5b35629 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -63,6 +63,7 @@ employee_roles = Lookup.create([{lookup_type:'employee_roles', name: 'Cashier', {lookup_type:'employee_roles', name: 'Waiter', value: 'waiter'}, {lookup_type:'employee_roles', name: 'Supervisour', value: 'supervisour'}, {lookup_type:'employee_roles', name: 'Manager', value: 'manager'}, + {lookup_type:'employee_roles', name: 'Accountant', value: 'account'}, {lookup_type:'employee_roles', name: 'Administrator', value: 'administrator'}]) #booking_status From 0726af072e577d4c8290167280356009218b081c Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 26 Jun 2017 19:49:02 +0630 Subject: [PATCH 05/48] update cancan --- .../reports/daily_sales_controller.rb | 2 +- .../reports/sale_items_controller.rb | 2 +- app/models/ability.rb | 27 ++++++++++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/app/controllers/reports/daily_sales_controller.rb b/app/controllers/reports/daily_sales_controller.rb index 6d99551d..1a878aaa 100644 --- a/app/controllers/reports/daily_sales_controller.rb +++ b/app/controllers/reports/daily_sales_controller.rb @@ -1,5 +1,5 @@ class Reports::DailySalesController < BaseReportController - # authorize_resource :class => false + authorize_resource :class => false def index from, to ,report_type = get_date_range_from_params @sale_data = Sale.daily_sales_list(from,to) diff --git a/app/controllers/reports/sale_items_controller.rb b/app/controllers/reports/sale_items_controller.rb index 81f7af01..9001658c 100644 --- a/app/controllers/reports/sale_items_controller.rb +++ b/app/controllers/reports/sale_items_controller.rb @@ -1,5 +1,5 @@ class Reports::SaleItemsController < BaseReportController - # authorize_resource :class => false + authorize_resource :class => false def index from, to, report_type = get_date_range_from_params diff --git a/app/models/ability.rb b/app/models/ability.rb index f3e8da5c..10a289f1 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -20,9 +20,9 @@ class Ability can :manage, Zone can :manage, CashierTerminal can :manage, Employee - can :manage, MembershipSetting - can :manage, MembershipAction - can :manage, PaymentMethodSetting + # can :manage, MembershipSetting + # can :manage, MembershipAction + # can :manage, PaymentMethodSetting can :manage, TaxProfile can :manage, PrintSetting can :manage, Account @@ -30,9 +30,26 @@ class Ability can :manage, Order can :manage, Sale + can :manage, Customer + can :index, :dailysale can :index, :saleitem + can :add_customer, Customer + can :update_sale_by_customer, Customer + + can :index, :discount + can :create, :discount + + can :show, :payment + can :create, :payment + can :reprint, :payment + + can :move_dining, :movetable + can :moving, :movetable + + can :move_dining, :moveroom + elsif user.role == "cashier" can :read, Order @@ -55,6 +72,10 @@ class Ability can :moving, :movetable can :move_dining, :moveroom + + can :index, :dailysale + can :index, :saleitem + elsif user.role == "accountant" From 4c13be257b1aa09b0dd960915e30e2d523f9d3cc Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 26 Jun 2017 22:45:34 +0630 Subject: [PATCH 06/48] update authroize --- .../{dailysales.coffee => dailysale.coffee} | 0 .../{sale_items.coffee => saleitem.coffee} | 0 .../{dailysales.scss => dailysale.scss} | 2 +- .../{sale_items.scss => saleitem.scss} | 2 +- .../reports/bksale_items_controller.rb | 19 -- .../reports/daily_sales_controller.rb | 17 -- ..._controller.rb => dailysale_controller.rb} | 8 +- .../reports/receipt_no_controller.rb | 2 +- ...s_controller.rb => saleitem_controller.rb} | 6 +- app/helpers/reports/dailysale_helper.rb | 2 + app/helpers/reports/dailysales_helper.rb | 2 - app/helpers/reports/sale_items_helper.rb | 2 - app/helpers/reports/saleitem_helper.rb | 2 + app/models/ability.rb | 26 +-- app/views/layouts/_header.html.erb | 4 +- .../_shift_sale_report_filter.html.erb | 151 -------------- app/views/reports/daily_sales/index.html.erb | 190 ------------------ app/views/reports/daily_sales/index.xls.erb | 116 ----------- .../_shift_sale_report_filter.html.erb | 0 .../{daily_sale => dailysale}/index.html.erb | 4 +- .../{daily_sale => dailysale}/index.xls.erb | 0 .../_shift_sale_report_filter.html.erb | 156 -------------- app/views/reports/sale_items/index.html.erb | 141 ------------- app/views/reports/sale_items/index.xls.erb | 136 ------------- .../_shift_sale_report_filter.html.erb | 0 .../{sale_item => saleitem}/index.html.erb | 4 +- .../{sale_item => saleitem}/index.xls.erb | 0 config/routes.rb | 4 +- .../reports/dailysale_controller_spec.rb | 5 + .../reports/dailysales_controller_spec.rb | 5 - .../reports/sale_items_controller_spec.rb | 5 - .../reports/saleitem_controller_spec.rb | 5 + ...elper_spec.rb => dailysale_helper_spec.rb} | 6 +- ...helper_spec.rb => saleitem_helper_spec.rb} | 6 +- 34 files changed, 52 insertions(+), 976 deletions(-) rename app/assets/javascripts/reports/{dailysales.coffee => dailysale.coffee} (100%) rename app/assets/javascripts/reports/{sale_items.coffee => saleitem.coffee} (100%) rename app/assets/stylesheets/reports/{dailysales.scss => dailysale.scss} (60%) rename app/assets/stylesheets/reports/{sale_items.scss => saleitem.scss} (60%) delete mode 100644 app/controllers/reports/bksale_items_controller.rb delete mode 100644 app/controllers/reports/daily_sales_controller.rb rename app/controllers/reports/{daily_salesbk_controller.rb => dailysale_controller.rb} (70%) rename app/controllers/reports/{sale_items_controller.rb => saleitem_controller.rb} (73%) create mode 100644 app/helpers/reports/dailysale_helper.rb delete mode 100644 app/helpers/reports/dailysales_helper.rb delete mode 100644 app/helpers/reports/sale_items_helper.rb create mode 100644 app/helpers/reports/saleitem_helper.rb delete mode 100644 app/views/reports/daily_sales/_shift_sale_report_filter.html.erb delete mode 100644 app/views/reports/daily_sales/index.html.erb delete mode 100644 app/views/reports/daily_sales/index.xls.erb rename app/views/reports/{daily_sale => dailysale}/_shift_sale_report_filter.html.erb (100%) rename app/views/reports/{daily_sale => dailysale}/index.html.erb (97%) rename app/views/reports/{daily_sale => dailysale}/index.xls.erb (100%) delete mode 100644 app/views/reports/sale_items/_shift_sale_report_filter.html.erb delete mode 100644 app/views/reports/sale_items/index.html.erb delete mode 100644 app/views/reports/sale_items/index.xls.erb rename app/views/reports/{sale_item => saleitem}/_shift_sale_report_filter.html.erb (100%) rename app/views/reports/{sale_item => saleitem}/index.html.erb (95%) rename app/views/reports/{sale_item => saleitem}/index.xls.erb (100%) create mode 100644 spec/controllers/reports/dailysale_controller_spec.rb delete mode 100644 spec/controllers/reports/dailysales_controller_spec.rb delete mode 100644 spec/controllers/reports/sale_items_controller_spec.rb create mode 100644 spec/controllers/reports/saleitem_controller_spec.rb rename spec/helpers/reports/{sale_items_helper_spec.rb => dailysale_helper_spec.rb} (69%) rename spec/helpers/reports/{dailysales_helper_spec.rb => saleitem_helper_spec.rb} (69%) diff --git a/app/assets/javascripts/reports/dailysales.coffee b/app/assets/javascripts/reports/dailysale.coffee similarity index 100% rename from app/assets/javascripts/reports/dailysales.coffee rename to app/assets/javascripts/reports/dailysale.coffee diff --git a/app/assets/javascripts/reports/sale_items.coffee b/app/assets/javascripts/reports/saleitem.coffee similarity index 100% rename from app/assets/javascripts/reports/sale_items.coffee rename to app/assets/javascripts/reports/saleitem.coffee diff --git a/app/assets/stylesheets/reports/dailysales.scss b/app/assets/stylesheets/reports/dailysale.scss similarity index 60% rename from app/assets/stylesheets/reports/dailysales.scss rename to app/assets/stylesheets/reports/dailysale.scss index cfc48374..516e1b52 100644 --- a/app/assets/stylesheets/reports/dailysales.scss +++ b/app/assets/stylesheets/reports/dailysale.scss @@ -1,3 +1,3 @@ -// Place all the styles related to the reports/dailysales controller here. +// Place all the styles related to the reports/dailysale controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/reports/sale_items.scss b/app/assets/stylesheets/reports/saleitem.scss similarity index 60% rename from app/assets/stylesheets/reports/sale_items.scss rename to app/assets/stylesheets/reports/saleitem.scss index b9692327..3e3460a4 100644 --- a/app/assets/stylesheets/reports/sale_items.scss +++ b/app/assets/stylesheets/reports/saleitem.scss @@ -1,3 +1,3 @@ -// Place all the styles related to the reports/sale_items controller here. +// Place all the styles related to the reports/saleitem controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/reports/bksale_items_controller.rb b/app/controllers/reports/bksale_items_controller.rb deleted file mode 100644 index 1f349320..00000000 --- a/app/controllers/reports/bksale_items_controller.rb +++ /dev/null @@ -1,19 +0,0 @@ -class Reports::SaleItemsController < BaseReportController - authorize_resource :class => false - def index - - from, to, report_type = get_date_range_from_params - - @sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type) - - respond_to do |format| - format.html - format.xls - end - end - - def show - - end - -end \ No newline at end of file diff --git a/app/controllers/reports/daily_sales_controller.rb b/app/controllers/reports/daily_sales_controller.rb deleted file mode 100644 index 1a878aaa..00000000 --- a/app/controllers/reports/daily_sales_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Reports::DailySalesController < BaseReportController - authorize_resource :class => false - def index - from, to ,report_type = get_date_range_from_params - @sale_data = Sale.daily_sales_list(from,to) - @tax = SaleTax.get_tax(from,to) - respond_to do |format| - format.html - format.xls - end - end - - def show - - end - -end \ No newline at end of file diff --git a/app/controllers/reports/daily_salesbk_controller.rb b/app/controllers/reports/dailysale_controller.rb similarity index 70% rename from app/controllers/reports/daily_salesbk_controller.rb rename to app/controllers/reports/dailysale_controller.rb index 1a878aaa..27e812ab 100644 --- a/app/controllers/reports/daily_salesbk_controller.rb +++ b/app/controllers/reports/dailysale_controller.rb @@ -1,5 +1,6 @@ -class Reports::DailySalesController < BaseReportController - authorize_resource :class => false +class Reports::DailysaleController < BaseReportController + authorize_resource :class => false + def index from, to ,report_type = get_date_range_from_params @sale_data = Sale.daily_sales_list(from,to) @@ -13,5 +14,4 @@ class Reports::DailySalesController < BaseReportController def show end - -end \ No newline at end of file +end diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index d85c7d57..e4157c4e 100644 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -1,5 +1,5 @@ class Reports::ReceiptNoController < BaseReportController - +authorize_resource :class => false def index from, to = get_date_range_from_params puts "from..." diff --git a/app/controllers/reports/sale_items_controller.rb b/app/controllers/reports/saleitem_controller.rb similarity index 73% rename from app/controllers/reports/sale_items_controller.rb rename to app/controllers/reports/saleitem_controller.rb index 9001658c..0f91681d 100644 --- a/app/controllers/reports/sale_items_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -1,5 +1,5 @@ -class Reports::SaleItemsController < BaseReportController - authorize_resource :class => false +class Reports::SaleitemController < BaseReportController + authorize_resource :class => false def index from, to, report_type = get_date_range_from_params @@ -16,4 +16,4 @@ class Reports::SaleItemsController < BaseReportController end -end \ No newline at end of file +end diff --git a/app/helpers/reports/dailysale_helper.rb b/app/helpers/reports/dailysale_helper.rb new file mode 100644 index 00000000..88ccfd83 --- /dev/null +++ b/app/helpers/reports/dailysale_helper.rb @@ -0,0 +1,2 @@ +module Reports::DailysaleHelper +end diff --git a/app/helpers/reports/dailysales_helper.rb b/app/helpers/reports/dailysales_helper.rb deleted file mode 100644 index 94e34c27..00000000 --- a/app/helpers/reports/dailysales_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Reports::DailysalesHelper -end diff --git a/app/helpers/reports/sale_items_helper.rb b/app/helpers/reports/sale_items_helper.rb deleted file mode 100644 index 63e884d7..00000000 --- a/app/helpers/reports/sale_items_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Reports::SaleItemsHelper -end diff --git a/app/helpers/reports/saleitem_helper.rb b/app/helpers/reports/saleitem_helper.rb new file mode 100644 index 00000000..47544cf9 --- /dev/null +++ b/app/helpers/reports/saleitem_helper.rb @@ -0,0 +1,2 @@ +module Reports::SaleitemHelper +end diff --git a/app/models/ability.rb b/app/models/ability.rb index 10a289f1..2876c902 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -32,9 +32,6 @@ class Ability can :manage, Customer - can :index, :dailysale - can :index, :saleitem - can :add_customer, Customer can :update_sale_by_customer, Customer @@ -50,6 +47,10 @@ class Ability can :move_dining, :moveroom + can :index, :dailysale + can :index, :saleitem + can :index, :receipt_no + elsif user.role == "cashier" can :read, Order @@ -72,20 +73,21 @@ class Ability can :moving, :movetable can :move_dining, :moveroom - - can :index, :dailysale - can :index, :saleitem - elsif user.role == "accountant" can :index, :dailysale - can :index, :saleitem - can :index, :receiptno - can :show, :dailysale - can :show, :saleitem - can :show, :receiptno + can :manage, :saleitem + can :index, :receiptno + + elsif user.role == "supervisour" + + can :index, :dailysale + can :manage, :saleitem + can :index, :receiptno end + end + end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 24211081..4bf44234 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -38,8 +38,8 @@ diff --git a/app/views/reports/daily_sales/_shift_sale_report_filter.html.erb b/app/views/reports/daily_sales/_shift_sale_report_filter.html.erb deleted file mode 100644 index 3a5d788c..00000000 --- a/app/views/reports/daily_sales/_shift_sale_report_filter.html.erb +++ /dev/null @@ -1,151 +0,0 @@ -
-
- <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> - <% if period_type != false %> -
-
- - -
- - -
- - - -
-
- - -
-
- -
-
- <% end %> - - - -
-
- <% if defined? promotions %> - <%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %> - <% end %> - - <% if defined? menu_types %> - <%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %> - <% end %> - - <% if defined? payments %> - <%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %> - <% end %> - - <% if defined? shift_name %> - - <% end %> - - <% if defined? cashiers %> - <%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %> - <% end %> - - <% if defined? singer %> - <%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %> - <% end %> - - <% if defined? bsm %> - <%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %> - <% end %> - - <% if defined? guest_role %> - <%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %> - <% end %> - - <% if defined? list_by_payment_type %> - <%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %> - <% end %> - - <% if defined? products %> - <%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %> - <% end %> - - <% if defined? items %> - <%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %> - <% end %> -
-
- - - - <% end %> -
-
- - - - \ No newline at end of file diff --git a/app/views/reports/daily_sales/index.html.erb b/app/views/reports/daily_sales/index.html.erb deleted file mode 100644 index 7c2a8c61..00000000 --- a/app/views/reports/daily_sales/index.html.erb +++ /dev/null @@ -1,190 +0,0 @@ - - -
- <%= render :partial=>'shift_sale_report_filter', - :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %> -
-
- -
-
- -
-
- -
-
-
- - - <% if params[:from]%> - - - - <% end %> - - - - - - - - - - - - - - - - - - - <% unless @sale_data.empty? %> - - - <% void = 0 %> - <% mpu = 0 %> - <% master = 0 %> - <% visa = 0 %> - <% jcb = 0 %> - <% paypar = 0 %> - <% cash = 0 %> - <% credit = 0 %> - <% foc = 0 %> - <% discount = 0 %> - <% total = 0 %> - <% grand_total = 0 %> - <% count = 1 %> <% rounding_adj = 0 %> - <% @sale_data.each do |sale| %> - <% void += sale[:void_amount] %> - <% mpu += sale[:mpu_amount] %> - <% master += sale[:master_amount] %> - <% visa += sale[:visa_amount] %> - <% jcb += sale[:jcb_amount] %> - <% paypar += sale[:paypar_amount] %> - <% cash += sale[:cash_amount] %> - <% credit += sale[:credit_amount] %> - <% foc += sale[:foc_amount] %> - <% discount += sale[:total_discount] %> - <% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %> - <% grand_total += sale[:grand_total].to_f %> - <% rounding_adj += sale[:rounding_adj].to_f %> - - - - - - - - - - - - - - - - - - <% count = count + 1 %> - <% end %> - - - - - - - - - - - - - - - - - - <% total_tax = 0 %> - <% unless @tax.empty? %> - <% @tax.each do |tax| %> - <% total_tax += tax.tax_amount.to_f %> - - - - - - - <% end %> - <% net = total - total_tax %> - - - - - - <% end %> - - <% end %> -
Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)
Sr.noDateVoid AmountMpu SalesMaster SalesVisa SalesJcb SalesPaypar SalesCash SalesCredit SalesFOC Sales(Discount)Grand Total +
Rounding Adj.
Rounding Adj.Grand Total
<%= count %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%>
Total<%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%>
<%= tax.tax_name rescue '-'%><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> 
Net Amount<%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> 
-
-
-
- - - \ No newline at end of file diff --git a/app/views/reports/daily_sales/index.xls.erb b/app/views/reports/daily_sales/index.xls.erb deleted file mode 100644 index 67e76e3c..00000000 --- a/app/views/reports/daily_sales/index.xls.erb +++ /dev/null @@ -1,116 +0,0 @@ -
-
- - - <% if params[:from]%> - - - - <% end %> - - - - - - - - - - - - - - - - - - - <% unless @sale_data.empty? %> - - - <% void = 0 %> - <% mpu = 0 %> - <% master = 0 %> - <% visa = 0 %> - <% jcb = 0 %> - <% paypar = 0 %> - <% cash = 0 %> - <% credit = 0 %> - <% foc = 0 %> - <% discount = 0 %> - <% total = 0 %> - <% grand_total = 0 %> - <% count = 1 %> <% rounding_adj = 0 %> - <% @sale_data.each do |sale| %> - <% void += sale[:void_amount] %> - <% mpu += sale[:mpu_amount] %> - <% master += sale[:master_amount] %> - <% visa += sale[:visa_amount] %> - <% jcb += sale[:jcb_amount] %> - <% paypar += sale[:paypar_amount] %> - <% cash += sale[:cash_amount] %> - <% credit += sale[:credit_amount] %> - <% foc += sale[:foc_amount] %> - <% discount += sale[:total_discount] %> - <% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %> - <% grand_total += sale[:grand_total].to_f %> - <% rounding_adj += sale[:rounding_adj].to_f %> - - - - - - - - - - - - - - - - - - <% count = count + 1 %> - <% end %> - - - - - - - - - - - - - - - - - - <% total_tax = 0 %> - <% unless @tax.empty? %> - <% @tax.each do |tax| %> - <% total_tax += tax.tax_amount.to_f %> - - - - - - - <% end %> - <% net = total - total_tax %> - - - - - - <% end %> - - <% end %> -
Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)
Sr.noDateVoid AmountMpu SalesMaster SalesVisa SalesJcb SalesPaypar SalesCash SalesCredit SalesFOC Sales(Discount)Grand Total +
Rounding Adj.
Rounding Adj.Grand Total
<%= count %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%>
Total<%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%>
<%= tax.tax_name rescue '-'%><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> 
Net Amount<%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> 
-
-
\ No newline at end of file diff --git a/app/views/reports/daily_sale/_shift_sale_report_filter.html.erb b/app/views/reports/dailysale/_shift_sale_report_filter.html.erb similarity index 100% rename from app/views/reports/daily_sale/_shift_sale_report_filter.html.erb rename to app/views/reports/dailysale/_shift_sale_report_filter.html.erb diff --git a/app/views/reports/daily_sale/index.html.erb b/app/views/reports/dailysale/index.html.erb similarity index 97% rename from app/views/reports/daily_sale/index.html.erb rename to app/views/reports/dailysale/index.html.erb index 7c2a8c61..e151878e 100644 --- a/app/views/reports/daily_sale/index.html.erb +++ b/app/views/reports/dailysale/index.html.erb @@ -7,14 +7,14 @@
<%= render :partial=>'shift_sale_report_filter', - :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %> + :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
diff --git a/app/views/reports/daily_sale/index.xls.erb b/app/views/reports/dailysale/index.xls.erb similarity index 100% rename from app/views/reports/daily_sale/index.xls.erb rename to app/views/reports/dailysale/index.xls.erb diff --git a/app/views/reports/sale_items/_shift_sale_report_filter.html.erb b/app/views/reports/sale_items/_shift_sale_report_filter.html.erb deleted file mode 100644 index 7f95b6b9..00000000 --- a/app/views/reports/sale_items/_shift_sale_report_filter.html.erb +++ /dev/null @@ -1,156 +0,0 @@ -
-
- <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> - <% if period_type != false %> -
-
- - -
- - -
- - - -
-
- - -
-
- -
-
- <% end %> - - - -
-
- <% if defined? promotions %> - <%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %> - <% end %> - - <% if defined? menu_types %> - <%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %> - <% end %> - - <% if defined? payments %> - <%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %> - <% end %> - - <% if defined? shift_name %> - - <% end %> - - <% if defined? cashiers %> - <%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %> - <% end %> - - <% if defined? singer %> - <%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %> - <% end %> - - <% if defined? bsm %> - <%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %> - <% end %> - - <% if defined? guest_role %> - <%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %> - <% end %> - - <% if defined? list_by_payment_type %> - <%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %> - <% end %> - - <% if defined? products %> - <%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %> - <% end %> - - <% if defined? items %> - <%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %> - <% end %> -
-
- - - - <% end %> -
-
- - - - \ No newline at end of file diff --git a/app/views/reports/sale_items/index.html.erb b/app/views/reports/sale_items/index.html.erb deleted file mode 100644 index a3b460fc..00000000 --- a/app/views/reports/sale_items/index.html.erb +++ /dev/null @@ -1,141 +0,0 @@ - - -
- <%= render :partial=>'shift_sale_report_filter', - :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %> -
-
- -
-
- -
-
- -
-
-
- - - - - - - - - - - - - - - - - - -
Date
Menu CategoryCodeProductTotal ItemUnit PriceRevenue
-
-
-
- - \ No newline at end of file diff --git a/app/views/reports/sale_items/index.xls.erb b/app/views/reports/sale_items/index.xls.erb deleted file mode 100644 index 2807ec3f..00000000 --- a/app/views/reports/sale_items/index.xls.erb +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - -
-<% unless @sale_data.blank? %> - - - - - <% if !params[:from].blank?%> - - - - <% end %> - <% if @shift_from %> - - <% if @shift_data.employee %> - <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> - <% end %> - - - <% end %> - - - - - - - - - - - - - <% acc_arr = Array.new %> - <% cate_arr = Array.new %> - - <% sub_total = 0.0 %> - <% count = 0%> - <% total_price = 0.0 %> - <% cate_count = 0 %> - <% acc_count = 0%> - <% grand_total = 0%> - <% total_discount = 0.0 %> - - <% @sale_data.order("total_item desc").each do |sale| %> - - <% if !acc_arr.include?(sale.account_id) %> - - - - - - - <% acc_arr.push(sale.account_id) %> - - <% end %> - - - <% if !cate_arr.include?(sale.menu_category_id) %> - - <% cate_arr.push(sale.menu_category_id) %> - <% else %> - - <% end %> - - <% if @item_table == 'sale' %> - <% if sale.item_remark == 'FOC' %> - - <% elsif sale.item_remark == 'FOC ITEM' %> - - <% elsif sale.item_remark == 'DISCOUNT' %> - - <% else %> - - <% end %> - <% if sale.item_remark == 'DISCOUNT' %> - - - - <% total_price += sale.total_price %> - <% else %> - - - - <% end %> - <% else %> - - - - - <% end %> - - - - <% @menu_cate_count.each do |key,value| %> - <% if sale.menu_category_id == key %> - <% count = count + 1 %> - <% sub_total += sale.grand_total %> - <% if count == value %> - - - - - - <% sub_total = 0.0%> - <% total_discount = total_discount + total_price %> - <% total_price = 0.0%> - <% count = 0%> - <% end %> - <% end %> - <% end %> - - <% grand_total += sale.grand_total%> - <% end %> - - - - - - -
From Date : <%= params[:from] %> , To Date : <%= params[:to] %>
Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
 Menu CategoryCodeProductTotal ItemUnit PriceRevenue
<%= sale.account_name %> Total Price By <%= sale.account_name %> - <% @totalByAccount.each do |account, total| %> - <% if sale.account_id == account %> - <%= total %> - <% end %> - <% end %> -
 <%= sale.menu_category_name %> <%= sale.code rescue '-' %><%= '[PROMO] '.to_s + sale.product_name.to_s rescue '-' %><%= '[DIS:QTY] '.to_s + sale.product_name.to_s rescue '-' %><%= '[DIS:TP] '.to_s + sale.product_name.to_s rescue '-' %><%= sale.product_name.to_s rescue '-' %> - - <%= sale.total_price.abs rescue '-' %><%= sale.total_item.abs rescue '-' %><%= sale.unit_price rescue '-' %><%= sale.grand_total.abs rescue '-' %><%= sale.product_name.to_s rescue '-' %><%= sale.total_item.abs rescue '-' %><%= sale.unit_price rescue '-' %><%= sale.grand_total.abs rescue '-' %>
 Sub Total<%= sub_total + total_price %>
 Grand Total<%= grand_total + total_discount %>
-<% end %> -
- - \ No newline at end of file diff --git a/app/views/reports/sale_item/_shift_sale_report_filter.html.erb b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb similarity index 100% rename from app/views/reports/sale_item/_shift_sale_report_filter.html.erb rename to app/views/reports/saleitem/_shift_sale_report_filter.html.erb diff --git a/app/views/reports/sale_item/index.html.erb b/app/views/reports/saleitem/index.html.erb similarity index 95% rename from app/views/reports/sale_item/index.html.erb rename to app/views/reports/saleitem/index.html.erb index a3b460fc..dd9fd1a5 100644 --- a/app/views/reports/sale_item/index.html.erb +++ b/app/views/reports/saleitem/index.html.erb @@ -7,14 +7,14 @@
<%= render :partial=>'shift_sale_report_filter', - :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %> + :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_saleitem_index_path} %>
diff --git a/app/views/reports/sale_item/index.xls.erb b/app/views/reports/saleitem/index.xls.erb similarity index 100% rename from app/views/reports/sale_item/index.xls.erb rename to app/views/reports/saleitem/index.xls.erb diff --git a/config/routes.rb b/config/routes.rb index cfaec2d0..ac43228c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -217,8 +217,8 @@ Rails.application.routes.draw do #--------- Reports Controller Sections ------------# namespace :reports do resources :receipt_no, :only => [:index, :show] - resources :daily_sales, :only => [:index, :show] - resources :sale_items, :only => [:index, :show] + resources :dailysale, :only => [:index, :show] + resources :saleitem, :only => [:index, :show] # resources :sales, :only => [:index, :show] # resources :orders, :only => [:index, :show] # resources :customers, :only => [:index, :show] diff --git a/spec/controllers/reports/dailysale_controller_spec.rb b/spec/controllers/reports/dailysale_controller_spec.rb new file mode 100644 index 00000000..b80d898e --- /dev/null +++ b/spec/controllers/reports/dailysale_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Reports::DailysaleController, type: :controller do + +end diff --git a/spec/controllers/reports/dailysales_controller_spec.rb b/spec/controllers/reports/dailysales_controller_spec.rb deleted file mode 100644 index 83fcb321..00000000 --- a/spec/controllers/reports/dailysales_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe Reports::DailysalesController, type: :controller do - -end diff --git a/spec/controllers/reports/sale_items_controller_spec.rb b/spec/controllers/reports/sale_items_controller_spec.rb deleted file mode 100644 index 546fc874..00000000 --- a/spec/controllers/reports/sale_items_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe Reports::SaleItemsController, type: :controller do - -end diff --git a/spec/controllers/reports/saleitem_controller_spec.rb b/spec/controllers/reports/saleitem_controller_spec.rb new file mode 100644 index 00000000..3e431a45 --- /dev/null +++ b/spec/controllers/reports/saleitem_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Reports::SaleitemController, type: :controller do + +end diff --git a/spec/helpers/reports/sale_items_helper_spec.rb b/spec/helpers/reports/dailysale_helper_spec.rb similarity index 69% rename from spec/helpers/reports/sale_items_helper_spec.rb rename to spec/helpers/reports/dailysale_helper_spec.rb index ea2807c4..2b1e1ddc 100644 --- a/spec/helpers/reports/sale_items_helper_spec.rb +++ b/spec/helpers/reports/dailysale_helper_spec.rb @@ -1,15 +1,15 @@ require 'rails_helper' # Specs in this file have access to a helper object that includes -# the Reports::SaleItemsHelper. For example: +# the Reports::DailysaleHelper. For example: # -# describe Reports::SaleItemsHelper do +# describe Reports::DailysaleHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # end -RSpec.describe Reports::SaleItemsHelper, type: :helper do +RSpec.describe Reports::DailysaleHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/reports/dailysales_helper_spec.rb b/spec/helpers/reports/saleitem_helper_spec.rb similarity index 69% rename from spec/helpers/reports/dailysales_helper_spec.rb rename to spec/helpers/reports/saleitem_helper_spec.rb index 96853812..2c579f0e 100644 --- a/spec/helpers/reports/dailysales_helper_spec.rb +++ b/spec/helpers/reports/saleitem_helper_spec.rb @@ -1,15 +1,15 @@ require 'rails_helper' # Specs in this file have access to a helper object that includes -# the Reports::DailysalesHelper. For example: +# the Reports::SaleitemHelper. For example: # -# describe Reports::DailysalesHelper do +# describe Reports::SaleitemHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # end -RSpec.describe Reports::DailysalesHelper, type: :helper do +RSpec.describe Reports::SaleitemHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end From bcd44db9a2cdd97f44ee9adbc5d81505ce061037 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Tue, 27 Jun 2017 11:35:36 +0630 Subject: [PATCH 07/48] multiple invoice void --- .idea/workspace.xml | 615 ++++++++++++++---- .../origami/table_invoices_controller.rb | 2 +- app/controllers/origami/void_controller.rb | 8 + app/views/origami/home/index.html.erb | 1 + app/views/origami/home/show.html.erb | 33 +- app/views/origami/orders/show.html.erb | 2 +- app/views/origami/payments/show.html.erb | 22 +- app/views/origami/rooms/show.html.erb | 2 +- app/views/origami/sales/show.html.erb | 6 +- .../origami/table_invoices/show.html.erb | 19 +- dump.rdb | Bin 18261 -> 17895 bytes 11 files changed, 568 insertions(+), 142 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4d3242d5..b5dfb1c3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,16 +2,17 @@ - - - - - - - - - + + + + + + + + + + @@ -27,21 +28,73 @@ - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -50,33 +103,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -85,8 +113,18 @@ - - + + + + + + + + + + + + @@ -97,6 +135,8 @@ origami + table_invoice + sale_id @@ -105,11 +145,17 @@ @@ -168,6 +214,264 @@ - @@ -672,38 +998,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -712,22 +1006,6 @@ - - - - - - - - - - - - - - - - @@ -760,16 +1038,27 @@ - + - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -781,34 +1070,124 @@ - + - - + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 32e0ef7f..4571ba87 100644 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -25,7 +25,7 @@ class Origami::TableInvoicesController < BaseOrigamiController else sale = Sale.find(booking.sale_id) - if sale.sale_status != "completed" + if sale.sale_status != "completed" && sale.sale_status != 'void' @sale_array.push(sale) end end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index bea37a21..3515b010 100644 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -9,6 +9,14 @@ class Origami::VoidController < BaseOrigamiController sale.sale_status = 'void' sale.save + bookings = sale.bookings + bookings.each do |booking| + orders = booking.orders + orders.each do |order| + # order.status = 'void' + end + end + table_avaliable = true table = sale.bookings[0].dining_facility table.bookings.each do |booking| diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 5888bb3e..cd451e68 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -27,6 +27,7 @@
<%= sale.receipt_no %> + <%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 2e852b7c..84f606f8 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -27,6 +27,7 @@
<%= sale.receipt_no %> + <%= sale.sale_status %>
<% end %> @@ -287,7 +288,7 @@ - + <% else %> @@ -474,23 +475,23 @@ $('#edit').on('click',function(){ window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; }) - $('#void').on('click',function () { - var sure = confirm("Are you sure want to Void"); - if (sure == true) { - var sale_id = $('#sale_id').val(); - var ajax_url = "/origami/sale/" + sale_id + '/void'; - $.ajax({ - type: 'POST', - url: ajax_url, - success: function () { - window.location.href = '/origami/'; - } - }) - } else { +$('#void').on('click',function () { + var sure = confirm("Are you sure want to Void"); + if (sure == true) { + var sale_id = $('#sale_id').val(); + var ajax_url = "/origami/sale/" + sale_id + '/void'; + $.ajax({ + type: 'POST', + url: ajax_url, + success: function () { + window.location.href = '/origami/'; + } + }) + } else { - } + } - }) +}) diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb index d2c065a1..b386a86d 100644 --- a/app/views/origami/orders/show.html.erb +++ b/app/views/origami/orders/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index cef27145..4d9089b5 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -11,7 +11,7 @@ Table No <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %> - Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %> + Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %> Customer : <%= @sale_data.customer.name%> @@ -244,7 +244,7 @@ - + @@ -354,6 +354,23 @@ $( document ).ready(function() { } }); +$('#void').on('click',function () { + var sure = confirm("Are you sure want to Void"); + if (sure == true) { + var sale_id = $('#sale_id').text(); + var ajax_url = "/origami/sale/" + sale_id + '/void'; + $.ajax({ + type: 'POST', + url: ajax_url, + success: function () { + window.location.href = '/origami/'; + } + }) + } else { + + } +}); + }); function update_balance(){ @@ -369,4 +386,5 @@ function update_balance(){ var result = amount_due - total; $('#balance').text(result.toFixed(2)); } + diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 584410d6..77b35a40 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index cd716052..8e660261 100644 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> @@ -185,7 +185,9 @@
- + <% if @sale.sale_status != 'void' %> + + <% end %>
diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb index ee66f9a3..ade1f021 100644 --- a/app/views/origami/table_invoices/show.html.erb +++ b/app/views/origami/table_invoices/show.html.erb @@ -128,6 +128,7 @@
+
diff --git a/dump.rdb b/dump.rdb index acef6aa79d6c19cf0bb0d215a80225ad58500e81..989b20db9eb66d7ef6d034695caac9e1fa5f72fb 100644 GIT binary patch delta 1616 zcmZvcU1(cn7{~MGq_hibnoer$T+*|#>RfDmzdz`<_C)9K16=j0)2+o?)X65T?!t>g zTs9pj;&|~sv;{9j=yrM`ZphjwBZ}Y$f>Y-@Ce#bDt4;)k>HD6OoaCan59d73|M@-t z|NGrLVD&BVF1#zbIx_lC$B9=apBp$fd2IP$HWRxY`!@r0UovxcESH!VU0Xf-I_+dc z35g0)A*}eh<;U#@cP6m7l=f5ct`0Dzb4ePi3gwiaTx7 zldn#{maBT#iX(anmGzCipPQ}_F;*a4U?KI6)ZxLE*jz$!NmS)#Vr=5&6UT?EF;+^) zUR(hWl>81}z?cX^X0{-zB$H5zu*9JBze?T$&XwW;)Ba&y8XETZb-w_dYsDvndAs@L zbV@cRGR~Ni`eOFT5SWisDcth-dVS)j&54U-i@@7m&=&B!Z>f{+Q6~@)`ZXKWAc)R%hf5%guxTj>=2h=|JvDgRcY2Qk z=XzcFjcs2&Qr+=906+N)WCS!iQV1zy zM&{^H>|6ptq-5nb7@KhO!(Y3zUROwdX_LXsA(9+7(Hqsari8LrwUkfkTU#%uH${|% z+YfL+c@WGy+>EMh1R3yx`;mhviWb0>7K}3xGp&En3*@w3*jel9j2bJ*&Gpvh(|Zz( zQ;I78S;_Ygf73V}EG=8k9213_ifvbpsrk9;t<-(^XlJd(7f2C=knzRgeV69jj4>5% z)hrrTTx_?-K$L`%xe*V;3MEx9yxd9s-mY4zDOz%(^!C(|y~gAYp;EbX;~Tl$vSx}1 zr6T1*g*C;HcD*zH8@pcu{`G;Yj`MSI#9u;>f%N7E9Bd>rH>dyVIpm#O0kaN8lvdX2 z=3aJvFBTs4ycvWD$CAqWAjKp%&M`G514LnTdS%mq5<@}5sDe31Q9(9LYOn)WoJM{@ zkk}o#v5V4c`8V~Cxt5DkNI4E{s5iUayIP!QGtUtsEP`P*+7ji`FDb*|m*P{#d}Td* zPpvz`O`&3hyM6kT?4kYT(tJBDK=Xt_?#_?@QHSwa(=Ikem{UcY(3O-yi8I+aX<2W{ zG+9tiA+szzbI~?II5SRc8oX{6SXzu5(C&per{NA95sB<8Vgf}B=SI-KbZedMjWfFa zaj4zYvwI|jQqdO5kqLc!Koeg9)lAyHCDw-6c-+FQdfyiJ+vNMDp;=&jaxh?&?Wr}Q zPXs1Z=|6j>?u{N3-(+$78Apj`Y7{eMs8R|l-}SDx#ea>PcYUkwJwQAD#&6Gj{LqKL F{SO!nWb;8p~1wU(TGj8O?)hj37{)U(Er}KbEiq!ez|kb`Oo>z zH-CI+egBa)1GkhO9e(}ahUv*%wtqA?x>$U;E%YSxxWm$)TAOEwc0|7EWxvi|pv_bW zOht?-$)ucHJYYFH!z~TrV`2A0eYk0xzT6bIy7cT|r~bJKH1^tc6S=90GhNP;XaBLB z@#hX%En!JH*j!Iyl5@$hzA*4c;`a4A!iB=L_#iSgGCn<)D1)0xE0kZg1`19CjUkGd zz~|Z!HPl!T$-I$7sGM9&9o4117keNdmXc!GpXDQ@pTgm6e@0T$udw8~+;M6{lEJ#Q z2kKXz$DNx9mf4XUR#}|QiQya^7QhZOhV;XZ_FhRilQ1S2Qiy?5p|SL>)lgT|NJpF- z>5NMbl}@y!WrQjuW$}?O{7djz(sqTz!Yx-gqCzrXIKq^BBMBjP9z_4P?E9(xu6QTi ze#){}Qiq(<-UC*1Ktmandh5QocauV^??$~rfP|3>CRLCi=uIfY<>XJPAs0{Q<=p^< z3r>-Kl>z;@Tg5|jwlJ?tTuJ|D4UK@l#J3?{0f&V}7n~7_&u#LZX3(Fga`H!=-1V-L z+OQGp-am25^-8qLd|AMfZQTxzMW z#s})dnDeS5FNNkJ5_5=(Ph3NGC+-Cz!2&3`G9|)_oNIMGaSd1Ah?w15_I$XcNA|4u zfh$3Us`(JVa(lkcWG+?B2vAP?iMmE0#5nh#VD_7f%1A=xT-*A{vX@gC&u_bXX`SB` zBLvs+>~sB&Fit7D7OI5%UG*)nQ1*BP!!^SR!-iTgBFo7YpJJ3RMI)Y50EA81z%Jdo z1?cn99usMMsxWVM#N>t`2lJVYEZ%FN!i3afRqlc+%(&ShKaW3OSZc1YB)TlZL1Q%y zW%iSp=)hchLmUM!46Y=uZNI5k44RSI@VR}Lo!@#*kM8>=IMT7y(p(K)5>r3r)5MuA zg`^u3uTTh#6%X`dZYTsMCX9nSf3bt*clz$EgEt+6q6+__O%YuO&#Lt;HM+ZlrMW)A zQQ){Tqs%Pqir=ix?Oz84#wJi%H7H>WLJ%o1`!s_*c&ZdZK_AQwF_a9N-?;v}#l56Y zZu+XGT_`C`xhfYT9=ECS=4sZr;DR%TRp1TbZe_XI-YWJ*eIr)8J!U~`$ih}skN~;p z7oZezx1ECl%fCBr#|*BSQE6`45BkW?_noWwsBJH%UiReAJhODZdK%0zlpJ(5O-zhW z42|X{Co?A!7o*c-`LX;|K65&MHkSn>;Cf^#Gd2a*T0RGbLb7xsbg+ASXfSaUblS%= z`O~Y`nbpw85yd4@#ozr~zECaCz^Zj4A|a)LsSGu$n1m9VzX9i7{4Yxn^}grqNgS)Q U7WB;Ep@yq_Ui&27bM}k>0awo~Z~y=R From df722de0e78decb5eb1e12563a946caf616a8a99 Mon Sep 17 00:00:00 2001 From: Nweni Date: Tue, 27 Jun 2017 14:02:44 +0630 Subject: [PATCH 08/48] billed --- app/controllers/api/bill_controller.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index f7a4070d..4fdd0c35 100644 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -19,7 +19,7 @@ class Api::BillController < Api::ApiController @sale_id = booking.sale_id end end - + elsif (params[:order_id]) @sale = Sale.new @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee) @@ -29,12 +29,7 @@ class Api::BillController < Api::ApiController @sale_items = SaleItem.where("sale_id=?",@sale_id) unique_code = "ReceiptBillPdf" - #shop detail - shop_details = Shop.find(1) - - customer= Customer.where('customer_id=' + @sale_data.customer_id) - # get member information - member_info = Customer.get_member_account(customer) + customer= Customer.find(@sale_data.customer_id) # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) @@ -43,7 +38,7 @@ class Api::BillController < Api::ApiController item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details) + printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts) end From f762664912adddb355fe9c3bfa80c0891c90e1d3 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 27 Jun 2017 14:16:48 +0630 Subject: [PATCH 09/48] update bill --- app/controllers/api/bill_controller.rb | 2 +- app/controllers/base_origami_controller.rb | 1 - app/helpers/origami/request_bills_helper.rb | 1 + app/pdf/receipt_bill_pdf.rb | 2 +- app/views/layouts/_header.html.erb | 2 +- config/application.rb | 1 + 6 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index f7a4070d..1160efcc 100644 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -32,7 +32,7 @@ class Api::BillController < Api::ApiController #shop detail shop_details = Shop.find(1) - customer= Customer.where('customer_id=' + @sale_data.customer_id) + customer= Customer.find(@sale_data.customer_id) # get member information member_info = Customer.get_member_account(customer) diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 2af895da..be4b4055 100644 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -14,5 +14,4 @@ class BaseOrigamiController < ActionController::Base @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] end - end diff --git a/app/helpers/origami/request_bills_helper.rb b/app/helpers/origami/request_bills_helper.rb index a33f7c3e..2d1f8313 100644 --- a/app/helpers/origami/request_bills_helper.rb +++ b/app/helpers/origami/request_bills_helper.rb @@ -1,2 +1,3 @@ module Origami::RequestBillsHelper + end diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index b156e2c2..ad48d457 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -83,7 +83,7 @@ class ReceiptBillPdf < Prawn::Document y_position = cursor bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do - text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left + text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 05b74b7a..5a3a03af 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -33,7 +33,7 @@
  • <%= link_to "Daily Sale Report", reports_dailysale_index_path, :tabindex =>"-1" %>
  • <%= link_to "Sales Item Report", reports_saleitem_index_path, :tabindex =>"-1" %>
  • <%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %>
  • + diff --git a/app/views/reports/shiftsale/_shift_sale_report_filter.html.erb b/app/views/reports/shiftsale/_shift_sale_report_filter.html.erb new file mode 100644 index 00000000..34173d99 --- /dev/null +++ b/app/views/reports/shiftsale/_shift_sale_report_filter.html.erb @@ -0,0 +1,127 @@ +
    +
    + <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
    +
    + + +
    + + +
    + + + +
    +
    + + +
    +
    + +
    +
    + <% end %> + + <% end %> +
    +
    + + \ No newline at end of file diff --git a/app/views/reports/shiftsale/index.html.erb b/app/views/reports/shiftsale/index.html.erb new file mode 100644 index 00000000..8582a578 --- /dev/null +++ b/app/views/reports/shiftsale/index.html.erb @@ -0,0 +1,160 @@ +
    + +
    + <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_shiftsale_index_path} %> +
    +
    + +
    + +
    + +
    +
    + + + <% if params[:from]%> + + + + <% end %> + + + + + + + + + + + + + + + + + <% void = 0%> + <% cash = 0%> + <% credit = 0%> + <% accept_credit = 0%> + <% foc = 0%> + <% card = 0%> + <% total = 0%> + <% rounding_adj = 0%> + <% g_total = 0 %> + + <% @sale_data.each do |result| %> + + + + + + + + + + + + <% grand_total = result[:grand_total].to_f - result[:rounding_adj].to_f %> + + + <% void += result[:void_amount].to_f %> + <% cash += result[:cash_amount].to_f %> + <% credit += result[:credit_amount].to_f %> + <% accept_credit += result[:accept_credit_amount].to_f %> + <% foc += result[:foc_amount].to_f %> + <% card += result[:card_amount].to_f %> + <% total += result[:grand_total].to_f %> + <% rounding_adj += result[:rounding_adj].to_f %> + <% g_total += grand_total.to_f %> + + <% end %> + + + + + + + + + + + + + + +
    From Date : <%= params[:from] rescue '-'%> ,To Date : <%= params[:to] rescue '-'%>
    Cashier StationShift NameVoid AmountCash PaymentCredit ChargesCredit PaymentFOC PaymentCard PaymentGrand Total + +
    Rounding Adj
    Rounding AdjGrand Total
    + <%= result[:cashier_station_name] rescue '-'%> + <%= result[:shift_started_at].strftime("%e %b %I:%M%p") rescue '-' %> - + <%= result[:shift_closed_at].strftime("%e %b %I:%M%p") rescue '-' %> + <%= sprintf "%.2f",result[:cash_amount].to_f.to_d rescue '-'%><%= sprintf "%.2f",result[:credit_amount].to_f.to_d rescue '-'%><%= sprintf "%.2f",result[:accept_credit_amount].to_f.to_d rescue '-'%><%= sprintf "%.2f",result[:foc_amount].to_f.to_d rescue '-'%><%= sprintf "%.2f",result[:card_amount].to_f.to_d rescue '-'%><%= sprintf "%.2f",result[:grand_total].to_f.to_d rescue '-'%><%= sprintf "%.2f",result[:rounding_adj].to_f.to_d rescue '-'%><%= sprintf "%.2f",grand_total.to_f.to_d rescue '-'%>
    (<%= sprintf("%.2f",void) rescue '-'%>)<%= sprintf("%.2f",cash) rescue '-'%><%= sprintf("%.2f",credit) rescue '-'%><%= sprintf("%.2f",accept_credit) rescue '-'%><%= sprintf("%.2f",foc) rescue '-'%><%= sprintf("%.2f",card) rescue '-'%><%= sprintf("%.2f",total) rescue '-'%><%= sprintf("%.2f",rounding_adj) rescue '-'%><%= sprintf("%.2f",g_total) rescue '-'%>
    +
    +
    +
    + + + \ No newline at end of file diff --git a/app/views/reports/daily_sale/index.html.erb b/app/views/reports/shiftsale/index.xls.erb similarity index 79% rename from app/views/reports/daily_sale/index.html.erb rename to app/views/reports/shiftsale/index.xls.erb index 7b790148..67e76e3c 100644 --- a/app/views/reports/daily_sale/index.html.erb +++ b/app/views/reports/shiftsale/index.xls.erb @@ -1,26 +1,4 @@ - - -
    - <%= render :partial=>'shift_sale_report_filter', - :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %> -
    -
    - -
    -
    - -
    -
    - -
    -
    +
    @@ -135,56 +113,4 @@ <% end %>
    -
    -
    - - - \ No newline at end of file +
    \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 37033f22..e3a0d7a0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -264,6 +264,7 @@ Rails.application.routes.draw do resources :receipt_no, :only => [:index, :show] resources :dailysale, :only => [:index, :show] resources :saleitem, :only => [:index, :show] + resources :shiftsale, :only => [:index, :show] # resources :sales, :only => [:index, :show] # resources :orders, :only => [:index, :show] # resources :customers, :only => [:index, :show] diff --git a/spec/controllers/reports/shiftsale_controller_spec.rb b/spec/controllers/reports/shiftsale_controller_spec.rb new file mode 100644 index 00000000..ed90f941 --- /dev/null +++ b/spec/controllers/reports/shiftsale_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Reports::ShiftsaleController, type: :controller do + +end diff --git a/spec/helpers/reports/shiftsale_helper_spec.rb b/spec/helpers/reports/shiftsale_helper_spec.rb new file mode 100644 index 00000000..3555ce0c --- /dev/null +++ b/spec/helpers/reports/shiftsale_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Reports::ShiftsaleHelper. For example: +# +# describe Reports::ShiftsaleHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Reports::ShiftsaleHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end From 2713fae6b5e9181253b9f0925896f08a151e968a Mon Sep 17 00:00:00 2001 From: Nweni Date: Fri, 30 Jun 2017 13:44:29 +0630 Subject: [PATCH 48/48] Update --- app/controllers/origami/shifts_controller.rb | 3 +- app/views/origami/shifts/new.html.erb | 4 +++ db/migrate/20170403160742_create_sales.rb | 2 +- lib/tasks/menu_import.rake | 29 +++++++++++--------- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 8649a0db..3329aa0b 100644 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -10,6 +10,7 @@ class Origami::ShiftsController < BaseOrigamiController def new @float = Lookup.where('lookup_type=?','float_value') + @terminal = CashierTerminal.all end def create @@ -29,7 +30,7 @@ class Origami::ShiftsController < BaseOrigamiController end end - + def edit end end diff --git a/app/views/origami/shifts/new.html.erb b/app/views/origami/shifts/new.html.erb index 1569eaea..2903a8ae 100644 --- a/app/views/origami/shifts/new.html.erb +++ b/app/views/origami/shifts/new.html.erb @@ -1,5 +1,9 @@

    Open Cashier


    +
    +
    +
    +
    diff --git a/db/migrate/20170403160742_create_sales.rb b/db/migrate/20170403160742_create_sales.rb index a3018bbd..ae806472 100644 --- a/db/migrate/20170403160742_create_sales.rb +++ b/db/migrate/20170403160742_create_sales.rb @@ -20,7 +20,7 @@ class CreateSales < ActiveRecord::Migration[5.1] t.decimal :rounding_adjustment, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :amount_received, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :amount_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00 - + t.integer :shift_sale_id, :null => false t.timestamps end end diff --git a/lib/tasks/menu_import.rake b/lib/tasks/menu_import.rake index 1979d364..47b84ef5 100644 --- a/lib/tasks/menu_import.rake +++ b/lib/tasks/menu_import.rake @@ -60,8 +60,8 @@ menu_category2 = MenuCategory.create({menu: menu, code:"C002", name: "Specialty menu_category3 = MenuCategory.create({menu: menu, code:"C003", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 3,created_by: "SYSTEM DEFAULT"}) # Australia Angus Boneless Short Rib menu_category1_menu_item6 = SimpleMenuItem.create({item_code:"01007", name: "Australia Angus Boneless Short Rib", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0142", menu_item: menu_category1_menu_item5, price:12500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0141", menu_item: menu_category1_menu_item5, price:25000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0142", menu_item: menu_category1_menu_item6, price:12500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0141", menu_item: menu_category1_menu_item6, price:25000.00, is_on_promotion:false}]) # Spain Beef menu_category1_menu_item7 = SimpleMenuItem.create({item_code:"01008", name: "Spain Beef", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0152", menu_item: menu_category1_menu_item7, price:8000.00, is_on_promotion:false}]) @@ -83,10 +83,13 @@ menu_category3 = MenuCategory.create({menu: menu, code:"C003", name: "Beef & Mut menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0192", menu_item: menu_category1_menu_item11, price:7000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0191", menu_item: menu_category1_menu_item11, price:14000.00, is_on_promotion:false}]) # Sliced Lamb - menu_category1_menu_item11 = SimpleMenuItem.create({item_code:"01012", name: "Sliced Lamb", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0202", menu_item: menu_category1_menu_item11, price:7000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0201", menu_item: menu_category1_menu_item11, price:14000.00, is_on_promotion:false}]) - + menu_category1_menu_item12 = SimpleMenuItem.create({item_code:"01013", name: "Sliced Lamb", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0202", menu_item: menu_category1_menu_item12, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0201", menu_item: menu_category1_menu_item12, price:14000.00, is_on_promotion:false}]) + # Sliced Beef ( Think ) + menu_category1_menu_item13 = SimpleMenuItem.create({item_code:"01014", name: "Sliced Beef ( Think )", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1432", menu_item: menu_category1_menu_item13, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1431", menu_item: menu_category1_menu_item13, price:14000.00, is_on_promotion:false}]) # Pork menu_category4 = MenuCategory.create({menu: menu, code:"C004", name: "Pork", alt_name: "Pork", order_by: 4,created_by: "SYSTEM DEFAULT"}) # Sliced Tenderloin Pork @@ -282,7 +285,7 @@ menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", menu_category1_menu_item61 = SimpleMenuItem.create({item_code:"01062", name: "Live Lobster", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0681", menu_item: menu_category1_menu_item61, price:10.00, is_on_promotion:false}]) # Live Mantis - menu_category1_menu_item62 = SimpleMenuItem.create({item_code:"01063", name: "Live Mantis", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_category1_menu_item62 = SimpleMenuItem.create({item_code:"01063", name: "Live Mantis Prawn", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:" ",item_instance_code:"II0691", menu_item: menu_category1_menu_item62, price:10.00, is_on_promotion:false}]) # Dumpling menu_category9 = MenuCategory.create({menu: menu, code:"C009", name: "Dumpling", alt_name: "Chicken", order_by: 9, created_by: "SYSTEM DEFAULT"}) @@ -567,20 +570,20 @@ menu_category19 = MenuCategory.create({menu: menu, code:"C0018", name: "Beer", a menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1392", menu_item: menu_category1_menu_item132, price:1500.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1391", menu_item: menu_category1_menu_item132, price:3000.00, is_on_promotion:false}]) # # Tiger Beer -# menu_category1_menu_item133 = SimpleMenuItem.create({item_code:"01134", name: "Tiger Beer ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) -# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item133, price:1500.00, is_on_promotion:false}]) -# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item133, price:3000.00, is_on_promotion:false}]) + menu_category1_menu_item133 = SimpleMenuItem.create({item_code:"01134", name: "Tiger Beer ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1442", menu_item: menu_category1_menu_item133, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1441", menu_item: menu_category1_menu_item133, price:3000.00, is_on_promotion:false}]) # Heineken Beer menu_category1_menu_item134 = SimpleMenuItem.create({item_code:"01135", name: "Heineken Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item134, price:1800.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item134, price:3600.00, is_on_promotion:false}]) # Tsing Tao Beer menu_category1_menu_item135 = SimpleMenuItem.create({item_code:"01136", name: "Tsing Tao Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II141", menu_item: menu_category1_menu_item135, price:2800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1411", menu_item: menu_category1_menu_item135, price:2800.00, is_on_promotion:false}]) # ABC Stout menu_category1_menu_item136 = SimpleMenuItem.create({item_code:"01137", name: "ABC Stout ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1432", menu_item: menu_category1_menu_item136, price:2000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1431", menu_item: menu_category1_menu_item136, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1422", menu_item: menu_category1_menu_item136, price:2000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1421", menu_item: menu_category1_menu_item136, price:4000.00, is_on_promotion:false}]) # Signature Hot Tea" menu_category20 = MenuCategory.create({menu: menu, code:"C0019", name: "Signature Hot Tea", alt_name: "Chicken", order_by: 19, created_by: "SYSTEM DEFAULT"}) puts "Beauty in the pot's menu setup"