Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into crm

This commit is contained in:
Aung Myo
2017-07-05 10:36:16 +06:30
13 changed files with 71 additions and 61 deletions

View File

@@ -6,9 +6,9 @@
//= require_tree ./channels
// Temp Disable
(function() {
this.App || (this.App = {});
// (function() {
// this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
// App.cable = ActionCable.createConsumer();
}).call(this);
// }).call(this);

View File

@@ -1,18 +1,18 @@
App.order_queue_station = App.cable.subscriptions.create("OrderQueueStationChannel", {
connected: function() {},
// App.order_queue_station = App.cable.subscriptions.create("OrderQueueStationChannel", {
// connected: function() {},
disconnected: function() {},
// disconnected: function() {},
received: function(message) {
alert(message);
},
// received: function(message) {
// alert(message);
// },
order: function(message) {
return this.perform('order', {
message: message
});
}
});
// order: function(message) {
// return this.perform('order', {
// message: message
// });
// }
// });
// $(function(){
// $("#submit_order").on('click', function(event) {

View File

@@ -82,7 +82,7 @@ class HomeController < ApplicationController
if !shift.nil?
redirect_to origami_root_path
else
redirect_to new_origami_shift_path
redirect_to dashboard_path
end
elsif employee.role == "cashier"
#check if cashier has existing open cashier

View File

@@ -11,6 +11,7 @@ class Oqs::EditController < BaseOqsController
remarks = params[:remarks]
order_item = OrderItem.find(order_items_id);
order_item.item_order_by = current_user.name
order_item.qty = qty_weight
order_item.remark = remarks
order_item.save

View File

@@ -9,7 +9,7 @@ class OrderItem < ApplicationRecord
#Validation
validates_presence_of :item_code, :item_name, :qty
validates :qty, numericality: { :greater_than => 0 }
# validates :qty, numericality: { :greater_than => 0 }
validates_associated :order
#This Method - handle how items is added into order

View File

@@ -1,4 +1,5 @@
class OrderItemPdf < Prawn::Document
include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order_item, print_status, options, alt_name)
self.page_width = 180
@@ -30,7 +31,7 @@ class OrderItemPdf < Prawn::Document
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
# order items
order_items(order_item, options, alt_name)
order_items(order_item, options, alt_name, print_settings.precision)
end
# Write Order Information to PDF
@@ -58,11 +59,11 @@ class OrderItemPdf < Prawn::Document
end
# Write Order items to PDF
def order_items(order_item, options, alt_name)
def order_items(order_item, options, alt_name, precision)
y_position = cursor
#Add Order Item
add_order_items(order_item, options, alt_name)
add_order_items(order_item, options, alt_name, precision)
dash(1, :space => 1, :phase => 1)
stroke_horizontal_line 0, (self.page_width - self.margin)
@@ -70,7 +71,7 @@ class OrderItemPdf < Prawn::Document
end
# Add order items under order info
def add_order_items(order_item, options, alt_name)
def add_order_items(order_item, options, alt_name, precision)
y_position = cursor
move_down 5
@@ -80,7 +81,7 @@ class OrderItemPdf < Prawn::Document
end
bounding_box([self.item_width,y_position], :width => self.qty_width) do
text "[#{order_item.qty.to_i}]", :size => self.item_font_size,:align => :left
text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
end
bounding_box([0,y_position], :width => self.item_width) do

View File

@@ -1,4 +1,5 @@
class OrderSummaryPdf < Prawn::Document
include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order, print_status, order_items = nil,alt_name)
self.page_width = 180
@@ -29,9 +30,9 @@ class OrderSummaryPdf < Prawn::Document
# order items
if order_items == nil
order_items(order, alt_name)
order_items(order, alt_name, print_settings.precision)
else
order_items(order_items, alt_name)
order_items(order_items, alt_name, print_settings.precision)
end
end
@@ -60,7 +61,7 @@ class OrderSummaryPdf < Prawn::Document
end
# Write Order items to PDF
def order_items(order_item, alt_name)
def order_items(order_item, alt_name, precision)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
@@ -75,12 +76,12 @@ class OrderSummaryPdf < Prawn::Document
move_down 5
#Add Order Item
add_order_items(order_item, alt_name)
add_order_items(order_item, alt_name, precision)
end
# Add order items under order info
def add_order_items(order_item, alt_name)
def add_order_items(order_item, alt_name, precision)
y_position = cursor
move_down 5
@@ -96,7 +97,7 @@ class OrderSummaryPdf < Prawn::Document
end
bounding_box([self.item_width,y_position], :width => self.qty_width) do
text "#{odi.qty}", :size => self.item_font_size,:align => :left
text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
end
bounding_box([0,y_position], :width => self.item_width) do

View File

@@ -142,7 +142,7 @@ class ReceiptBillPdf < Prawn::Document
pad_top(15) {
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
}
move_down 1

View File

@@ -105,7 +105,8 @@
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
<button id="cash_in" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash In </button>
<!-- TEMP Disable for BITP -->
<!-- <button id="cash_in" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash In </button> -->
<button id="cash_out" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash Out </button>
<button id="close_cashier" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Close Cashier </button>
</div>