This commit is contained in:
Myat Zin Wai Maw
2020-02-26 17:09:17 +06:30
parent 0715a02495
commit e17091ac06
3 changed files with 17 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ class MenuCategory < ApplicationRecord
has_many :menu_items has_many :menu_items
validates_presence_of :code, :name, :menu, :order_by validates_presence_of :code, :name, :menu, :order_by
validate_uniqueness_of :code, scope: shop_code validates_uniqueness_of :code, scope: :shop_code
default_scope { order('order_by asc') } default_scope { order('order_by asc') }
scope :active, -> {where("is_available = 1")} scope :active, -> {where("is_available = 1")}

View File

@@ -14,7 +14,7 @@ class MenuItem < ApplicationRecord
has_and_belongs_to_many :item_sets, join_table: "menu_item_sets" has_and_belongs_to_many :item_sets, join_table: "menu_item_sets"
validates_presence_of :item_code, :name, :type, :min_qty,:account_id validates_presence_of :item_code, :name, :type, :min_qty,:account_id
validate_uniqueness_of :item_code, scope: shop_code validates_uniqueness_of :item_code, scope: :shop_code
default_scope { order('item_code asc') } default_scope { order('item_code asc') }

View File

@@ -36,16 +36,25 @@ class OrderItemPdf < Prawn::Document
# font "public/fonts/padauk.ttf" # font "public/fonts/padauk.ttf"
#font "public/fonts/Chinese.ttf" #font "public/fonts/Chinese.ttf"
if order_item.source =='app' if order_item.source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left text "Mobile Order", :size => self.header_font_size,:align => :center, :style=>:bold
move_down 1
text "Customer Ph : #{order_item.contact_no}", :size => self.header_font_size,:align => :left
move_down 1 move_down 1
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{order_item.contact_no}", :size => self.header_font_size,:align => :left
end end
if !order_item.dining.nil?
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{ order_item.type + '-' + order_item.dining + print_status }" , :size => self.header_font_size,:align => :right
end
end
move_down 1
else
if !order_item.dining.nil? if !order_item.dining.nil?
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20 text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else else
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20 text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
end end
end
stroke_horizontal_rule stroke_horizontal_rule
move_down 3 move_down 3