diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb
index 0e7f3388..2e8aba2c 100644
--- a/app/controllers/origami/home_controller.rb
+++ b/app/controllers/origami/home_controller.rb
@@ -2,10 +2,11 @@ class Origami::HomeController < BaseOrigamiController
before_action :set_dining, only: [:show]
def index
- @tables = Table.all.active.order('status desc')
- @rooms = Room.all.active.order('status desc')
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
- @orders = Order.all.order('date desc')
+ @orders = Order.all.order('date desc')
+ @shop = Shop.find_by_id(1)
# @shift = ShiftSale.current_open_shift(current_user.id)
end
diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb
index b9298a32..afb28714 100644
--- a/app/controllers/origami/shifts_controller.rb
+++ b/app/controllers/origami/shifts_controller.rb
@@ -35,8 +35,6 @@ class Origami::ShiftsController < BaseOrigamiController
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
- #t details for mpu or visa like card
- @other_payment = ShiftSale.get_by_shift_other_payment(@shift)
# Calculate price_by_accounts
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
@@ -60,6 +58,21 @@ class Origami::ShiftsController < BaseOrigamiController
def sale_summary
@shift = ShiftSale.current_open_shift(current_user.id)
+
+ # @shift = ShiftSale.find_by_id(shift_id)
+ if @shift
+ #get tax
+ shift_obj = ShiftSale.where('id =?',@shift.id)
+ @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
+ #other payment details for mpu or visa like card
+ @other_payment = ShiftSale.get_by_shift_other_payment(@shift)
+ #t details for mpu or visa like card
+ @other_payment = ShiftSale.get_by_shift_other_payment(@shift)
+
+ # Calculate price_by_accounts
+ @total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
+ @total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
+ end
end
diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb
index af9d014d..8a8c1469 100644
--- a/app/models/shift_sale.rb
+++ b/app/models/shift_sale.rb
@@ -57,6 +57,11 @@ class ShiftSale < ApplicationRecord
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
self.total_rounding = self.total_rounding + saleobj.rounding_adjustment
self.total_receipt = self.total_receipt + 1
+ if saleobj.customer.customer_type == "Dinein"
+ self.dining_count = self.dining_count + 1
+ else
+ self.takeaway_count = self.takeaway_count + 1
+ end
self.save
end
@@ -79,6 +84,11 @@ class ShiftSale < ApplicationRecord
self.commercial_taxes = self.commercial_taxes.to_i - tax.to_f
self.total_rounding = self.total_rounding - saleobj.rounding_adjustment
self.total_void = self.total_void + saleobj.grand_total
+ if saleobj.customer.customer_type == "Dinein"
+ self.dining_count = self.dining_count - 1
+ else
+ self.takeaway_count = self.takeaway_count - 1
+ end
self.save
end
end
diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb
index b5325aac..1955bf74 100644
--- a/app/pdf/close_cashier_pdf.rb
+++ b/app/pdf/close_cashier_pdf.rb
@@ -322,6 +322,22 @@ class CloseCashierPdf < Prawn::Document
text "#{shift_sale.total_receipt}", :size => self.item_font_size, :align => :right
end
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Dining Count :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.dining_count}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Takeaway Count :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.takeaway_count}", :size => self.item_font_size, :align => :right
+ end
+
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Void:", :size => self.item_font_size, :align => :right
diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb
index 04c12262..35aa4230 100644
--- a/app/views/origami/home/index.html.erb
+++ b/app/views/origami/home/index.html.erb
@@ -108,9 +108,9 @@
-
+
-
+
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
diff --git a/app/views/origami/shifts/sale_summary.html.erb b/app/views/origami/shifts/sale_summary.html.erb
new file mode 100644
index 00000000..c552d6b0
--- /dev/null
+++ b/app/views/origami/shifts/sale_summary.html.erb
@@ -0,0 +1,176 @@
+
+
+
+
Sales Summary Quick View
+
+
+
+ | Cashier |
+ Cashier Terminal |
+ Opening Date |
+ Opening float |
+ Received Amount |
+ Cast In |
+ Cast Out |
+ Total Receipt |
+ Dining Count |
+ Takeaway Count |
+ Total Void |
+
+
+ | <%= @shift.employee.name%> |
+ <%=@shift.cashier_terminal.name%> |
+ <%= @shift.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %>
+ |
+ <%=@shift.opening_balance %> |
+ <%=@shift.closing_balance %> |
+ <%=@shift.cash_in %> |
+ <%=@shift.cash_out %> |
+ <%= @shift.total_receipt %> |
+ <%= @shift.dining_count %> |
+ <%= @shift.takeaway_count %> |
+ (<%= @shift.total_void.round(2) %>) |
+
+
+
+
+
+ <% @total_amount_by_account.each do |amount| %>
+
+ |
+ Total <%= amount.account_name %> Amount |
+ <%= amount.total_price.round(2) %> |
+
+ <%end%>
+
+ |
+ Net Sales |
+ <%=@shift.nett_sales %> |
+
+
+ <% @total_discount_by_account.each do |amount| %>
+
+ |
+ Total <%= amount.account_name %> Discount |
+ <%= amount.total_price.round(2) %> |
+
+ <%end%>
+
+ |
+ Overall Discount Amount |
+ <%= @shift.total_discounts %> |
+
+
+ <% @sale_taxes.each do |tax| %>
+
+ |
+ <%= tax.tax_name %> |
+ <%= tax.st_amount.round(2) %> |
+
+ <%end%>
+
+ |
+ Total Tax |
+ <%=@shift.total_taxes %> |
+
+
+ |
+ Rounding Adj |
+ <%= @shift.total_rounding.round(2) %> |
+
+
+ |
+ Grand Total |
+ <%= @shift.grand_total.round(2) %> |
+
+
+ |
+
+
+
+ |
+ Cash Payment |
+ <%=@shift.cash_sales %> |
+
+
+ |
+ Credit Payment |
+ <%=@shift.credit_sales %> |
+
+ <% @total_amount = 0
+ @other_payment.each do |other| %>
+
+ |
+ Other Payment Detail |
+ |
+
+
+ |
+ MPU Payment |
+ <%=other.mpu_amount.round(2) %> |
+ <% @total_amount = @total_amount+other.mpu_amount %>
+
+
+ |
+ VISA Payment |
+ <%=other.visa_amount.round(2) %> |
+ <% @total_amount = @total_amount+other.visa_amount %>
+
+
+ |
+ JCB Payment |
+ <%=other.master_amount.round(2) %> |
+ <% @total_amount = @total_amount+other.master_amount %>
+
+
+ |
+ Master Payment |
+ <%=other.jcb_amount.round(2) %> |
+ <% @total_amount = @total_amount+other.jcb_amount %>
+
+
+ |
+ Reedem Payment |
+ <%=other.paypar_amount.round(2) %> |
+ <% @total_amount = @total_amount+other.paypar_amount %>
+
+ <%end%>
+
+
+ |
+ Total Other Payment |
+ <%=@shift.other_sales %> |
+
+
+ |
+ Total Payment |
+ <%= @total_amount+@shift.cash_sales+@shift.credit_sales %> |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/db/migrate/20170530072247_create_shops.rb b/db/migrate/20170530072247_create_shops.rb
index 72d8b882..27b2305e 100644
--- a/db/migrate/20170530072247_create_shops.rb
+++ b/db/migrate/20170530072247_create_shops.rb
@@ -19,6 +19,7 @@ class CreateShops < ActiveRecord::Migration[5.1]
t.string :owner_token
t.string :id_prefix, :null => false, :limit => 3
t.boolean :is_rounding_adj, :default => false
+ t.boolean :quick_sale_summary, :default => false
t.timestamps
end
diff --git a/db/seeds.rb b/db/seeds.rb
index 1b63bcb0..328c9e54 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -99,8 +99,8 @@ customer_type = Lookup.create([{lookup_type:'customer_type', name: 'Dinein', val
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])
#WALK CUSTOMER - Default CUSTOMER (take key 1)
-customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000"})
-customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111"})
+customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000",customer_type:"Dinein"})
+customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111",customer_type:"Takeaway"})
#Default ZOne
@@ -149,7 +149,7 @@ menu_item_attribute_size_medium = MenuItemAttribute.create({attribute_type:"size
menu_item_attribute_size_large = MenuItemAttribute.create({attribute_type:"size", name: "Large", value: "large"})
shop = Shop.create({id:1, name: "OSAKA OHSHO(Tamwe)", address:'No. 256, Kyaikkasan Road, Tamwe Township, Yangon', township:"Tamwe",state:"Yangon",city:"Yangon", country:"Myanmar", phone_no:"Tel: 09-258676611",reservation_no:"111",license:"123",
-activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111",is_rounding_adj:"0"})
+activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111",is_rounding_adj:"0",quick_sale_summary:"0"})
#Default Order Queue stations
# order_queue_station1 = OrderQueueStation.create({station_name: "Queue Station 1", is_active: true,printer_name: "kitchen_printer", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
# order_queue_station2 = OrderQueueStation.create({station_name: "Queue Station 2", is_active: true,printer_name: "drink_printer", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"})