diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 7ee03e47..f78f162a 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -15,6 +15,7 @@ class Origami::HomeController < BaseOrigamiController @rooms = Room.all.active.order('status desc') @complete = Sale.where("sale_status != 'new'") @orders = Order.all.order('date desc') + @shop = Shop.find_by_id(1) @status_order = "" @status_sale = "" @sale_array = Array.new diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb index 893746b2..4eadf007 100644 --- a/app/pdf/close_cashier_pdf.rb +++ b/app/pdf/close_cashier_pdf.rb @@ -200,6 +200,13 @@ class CloseCashierPdf < Prawn::Document bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do text "#{tax.st_amount.round(2)}", :size => self.item_font_size, :align => :right end + end + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do + text "Rounding Adjustment :", :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.total_rounding.round(2)}", :size => self.item_font_size, :align => :right end y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index daacffd9..709ed7ca 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -20,7 +20,7 @@ - +
@@ -452,15 +452,20 @@ $("#first_bill").on('click', function(){ $('#pay').on('click',function() { var sale_id = $('#sale_id').val(); - var url = '/origami/sale/'+ sale_id + "/rounding_adj" ; + var rounding_adj = $('#rounding_adj').val(); - $.ajax({ - type: "POST", - url: '/origami/sale/'+ sale_id + "/rounding_adj", - success:function(result){ - window.location.href = '/origami/sale/'+ sale_id + "/payment"; - } - }); + if(rounding_adj == "true"){ + var url = '/origami/sale/'+ sale_id + "/rounding_adj" ; + $.ajax({ + type: "POST", + url: '/origami/sale/'+ sale_id + "/rounding_adj", + success:function(result){ + window.location.href = '/origami/sale/'+ sale_id + "/payment"; + } + }); + }else{ + window.location.href = '/origami/sale/'+ sale_id + "/payment"; + } }); diff --git a/db/migrate/20170530072247_create_shops.rb b/db/migrate/20170530072247_create_shops.rb index 4f07d5c4..72d8b882 100644 --- a/db/migrate/20170530072247_create_shops.rb +++ b/db/migrate/20170530072247_create_shops.rb @@ -18,6 +18,7 @@ class CreateShops < ActiveRecord::Migration[5.1] t.string :cloud_token t.string :owner_token t.string :id_prefix, :null => false, :limit => 3 + t.boolean :is_rounding_adj, :default => false t.timestamps end diff --git a/db/seeds.rb b/db/seeds.rb index 317194c1..14f070eb 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -139,7 +139,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", 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"}) +activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111",is_rounding_adj:"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"})