update and fix

This commit is contained in:
Yan
2017-08-21 16:50:24 +06:30
parent ce7d15c2d4
commit 2b0dcd4ab9
12 changed files with 24 additions and 14 deletions

View File

@@ -132,6 +132,6 @@ class Settings::SetMenuItemsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_params
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
end
end

View File

@@ -154,6 +154,6 @@ class Settings::SimpleMenuItemsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_params
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
end
end

View File

@@ -1,8 +1,8 @@
class CrmOrderPdf < Prawn::Document
attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width
def initialize(booking,order_items,printer_settings)
self.page_width = PrintSetting.where("name = ?","CRM Order").first.page_width
self.page_height = PrintSetting.where("name = ?","CRM Order").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 10
# self.price_width = self.p_width / 2
self.price_width=80

View File

@@ -2,8 +2,8 @@ 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 = PrintSetting.where("name = ?","OrderItemPdf").first.page_width
self.page_height = PrintSetting.where("name = ?","OrderItemPdf").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 0
self.price_width = 40 # No Need for item
self.qty_width = 40

View File

@@ -2,8 +2,8 @@ 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 = PrintSetting.where("name = ?","Order Summary").first.page_width
self.page_height = PrintSetting.where("name = ?","Order Summary").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 0
self.price_width = 40 # No Need for item
self.qty_width = 40

View File

@@ -1,8 +1,8 @@
class QueueNoPdf < Prawn::Document
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(printer_settings, queue)
self.page_width = PrintSetting.where("name = ?","Queue No").first.page_width
self.page_height = PrintSetting.where("name = ?","Queue No").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 5
self.price_width = 35
self.qty_width = 20

View File

@@ -2,8 +2,8 @@ class ReceiptBillPdf < 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, :description_width, :price_num_width
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status)
self.page_width = PrintSetting.where("name = ?","Receipt Bill").first.page_width
self.page_height = PrintSetting.where("name = ?","Receipt Bill").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 5
self.price_width = 40
self.qty_width = 20

View File

@@ -35,6 +35,7 @@ json.account_id item.account_id
json.min_qty item.min_qty
json.is_available item.is_available
json.is_sub_item item.is_sub_item
json.unit item.unit
json.item_sets item.item_sets
json.attributes attr_format
json.options item.item_options

View File

@@ -16,6 +16,8 @@
<%= f.input :is_sub_item, :class => "form-control" %>
<%= f.input :unit, :collection => Lookup.collection_of("unit") ,:class => "form-control" %>
<%= f.input :item_attributes, :collection => @item_attributes, :input_html => { :multiple => true }, :class => "form-control item_attributes" %>
<%= f.input :item_options, :collection => @item_options, :input_html => { :multiple => true }, :class => "form-control item_options" %>

View File

@@ -16,6 +16,8 @@
<%= f.input :is_sub_item, :class => "form-control" %>
<%= f.input :unit, :collection => Lookup.collection_of("unit") ,:class => "form-control" %>
<%= f.input :item_attributes, :collection => @item_attributes, :input_html => { :multiple => true }, :class => "form-control item_attributes" %>
<%= f.input :item_options, :collection => @item_options, :input_html => { :multiple => true }, :class => "form-control item_options" %>

View File

@@ -7,6 +7,7 @@ class CreateMenuItems < ActiveRecord::Migration[5.1]
t.string :image_path
t.text :description
t.string :information
t.string :unit
t.string :type, :null => false, :default => "SimpleMenuItem"
t.references :menu_category, foreign_key: true
t.json :item_attributes

View File

@@ -95,8 +95,12 @@ float_value = Lookup.create([{lookup_type:'float_value', name: '500', value: '50
# customer type
customer_type = Lookup.create([{lookup_type:'customer_type', name: 'Dinein', value: 'Dinein'},
{lookup_type:'customer_type', name: 'Takeaway', value: 'Takeaway'},
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])
{lookup_type:'customer_type', name: 'Takeaway', value: 'Takeaway'},
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])
#unit
units = Lookup.create([{lookup_type:'unit', name: 'PCS', value: 'pcs'},
{lookup_type:'unit', name: 'KG', value: 'kg'}])
# Default CUSTOMER
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000", customer_type:"Dinein", tax_profiles:["2", "1"]})