merge with august_spring
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -51,3 +51,6 @@ dump.rdb
|
||||
|
||||
# Fonts
|
||||
public/fonts/*
|
||||
|
||||
# Ruby-Mine IDE folder
|
||||
/.idea
|
||||
|
||||
2
.idea/.generators
generated
2
.idea/.generators
generated
@@ -5,4 +5,4 @@ You are allowed to:
|
||||
2. Remove generators
|
||||
3. Add installed generators
|
||||
To add new installed generators automatically delete this file and reload the project.
|
||||
--><GeneratorsGroup><Generator name="active_record:migration" /><Generator name="active_record:model" /><Generator name="active_record:observer" /><Generator name="active_record:session_migration" /><Generator name="controller" /><Generator name="erb:controller" /><Generator name="erb:mailer" /><Generator name="erb:scaffold" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="mailer" /><Generator name="metal" /><Generator name="migration" /><Generator name="model" /><Generator name="model_subclass" /><Generator name="observer" /><Generator name="performance_test" /><Generator name="plugin" /><Generator name="resource" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="session_migration" /><Generator name="stylesheets" /><Generator name="test_unit:controller" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:observer" /><Generator name="test_unit:performance" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /></GeneratorsGroup></Settings>
|
||||
--><GeneratorsGroup><Generator name="assets" /><Generator name="cancan:ability" /><Generator name="channel" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="factory_girl:model" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="kaminari:config" /><Generator name="kaminari:views" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="resource" /><Generator name="rspec:controller" /><Generator name="rspec:feature" /><Generator name="rspec:helper" /><Generator name="rspec:install" /><Generator name="rspec:integration" /><Generator name="rspec:job" /><Generator name="rspec:mailer" /><Generator name="rspec:model" /><Generator name="rspec:observer" /><Generator name="rspec:request" /><Generator name="rspec:scaffold" /><Generator name="rspec:view" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="sidekiq:worker" /><Generator name="simple_form:install" /><Generator name="system_test" /><Generator name="task" /><Generator name="test_unit:controller" /><Generator name="test_unit:generator" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:job" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /><Generator name="test_unit:system" /></GeneratorsGroup></Settings>
|
||||
|
||||
2
.idea/.rakeTasks
generated
2
.idea/.rakeTasks
generated
File diff suppressed because one or more lines are too long
28
.idea/sxrestaurant.iml
generated
28
.idea/sxrestaurant.iml
generated
@@ -124,14 +124,14 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="actioncable (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="actionpack (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="actionview (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="activejob (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="actioncable (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="actionpack (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="actionview (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="activejob (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="arel (v8.0.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="autoprefixer-rails (v7.1.1.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="bcrypt (v3.1.11, rbenv: 2.3.3) [gem]" level="application" />
|
||||
@@ -142,6 +142,7 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.14.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="byebug (v9.0.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="cancancan (v1.17.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="chronic (v0.10.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="coffee-rails (v4.2.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="coffee-script (v2.4.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="coffee-script-source (v1.12.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
@@ -150,7 +151,7 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="cups (v0.0.7, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="database_cleaner (v1.6.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.6.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.6.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="execjs (v2.7.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="factory_girl (v4.8.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="factory_girl_rails (v4.8.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
@@ -160,7 +161,7 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="font-awesome-rails (v4.7.0.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="globalid (v0.4.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.15.5, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.8.4, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.8.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jbuilder (v2.7.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jquery-rails (v4.3.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jquery-ui-rails (v6.0.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
@@ -175,7 +176,7 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0521, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.2.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.12.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="mysql2 (v0.4.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
@@ -190,10 +191,10 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="rack-cors (v0.4.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rack-protection (v2.0.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rails (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rails (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.0.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="railties (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="railties (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rake (v12.0.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.9.8, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.9.10, rbenv: 2.3.3) [gem]" level="application" />
|
||||
@@ -228,6 +229,7 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="web-console (v3.5.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.6.5, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="whenever (v0.9.7, rbenv: 2.3.3) [gem]" level="application" />
|
||||
</component>
|
||||
<component name="RModuleSettingsStorage">
|
||||
<LOAD_PATH number="0" />
|
||||
|
||||
900
.idea/workspace.xml
generated
900
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,31 +1,50 @@
|
||||
class Origami::SaleEditController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
# Index for sale item void OR edit
|
||||
def edit
|
||||
sale_id = params[:sale_id]
|
||||
@table_id = params[:table_id]
|
||||
@saleobj = Sale.find(sale_id)
|
||||
end
|
||||
# Index for sale item void OR edit
|
||||
def edit
|
||||
sale_id = params[:sale_id]
|
||||
@table_id = params[:table_id]
|
||||
@saleobj = Sale.find(sale_id)
|
||||
end
|
||||
|
||||
# create item void. make duplicate old record and update qty and price
|
||||
def item_void
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
saleitemObj.remark = 'void'
|
||||
saleitemObj.save
|
||||
@newsaleitem = SaleItem.new
|
||||
@newsaleitem = saleitemObj.dup
|
||||
@newsaleitem.save
|
||||
@newsaleitem.qty = saleitemObj.qty * -1
|
||||
@newsaleitem.price = saleitemObj.price * -1
|
||||
@newsaleitem.is_taxable = 1
|
||||
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
||||
@newsaleitem.save
|
||||
# create item void. make duplicate old record and update qty and price
|
||||
def item_void
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
saleitemObj.remark = 'void'
|
||||
saleitemObj.save
|
||||
@newsaleitem = SaleItem.new
|
||||
@newsaleitem = saleitemObj.dup
|
||||
@newsaleitem.save
|
||||
@newsaleitem.qty = saleitemObj.qty * -1
|
||||
@newsaleitem.price = saleitemObj.price * -1
|
||||
@newsaleitem.is_taxable = 1
|
||||
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
||||
@newsaleitem.save
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
def item_foc
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
saleitemObj.remark = 'foc'
|
||||
saleitemObj.save
|
||||
@newsaleitem = SaleItem.new
|
||||
@newsaleitem = saleitemObj.dup
|
||||
@newsaleitem.save
|
||||
@newsaleitem.qty = saleitemObj.qty * -1
|
||||
@newsaleitem.price = saleitemObj.price * -1
|
||||
@newsaleitem.is_taxable = 1
|
||||
@newsaleitem.product_name = saleitemObj.product_name + ' foc'
|
||||
@newsaleitem.save
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
# def item_edit
|
||||
# saleitemId = params[:sale_item_id]
|
||||
@@ -48,63 +67,63 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
# end
|
||||
|
||||
def item_edit
|
||||
saleitemId = params[:sale_item_id]
|
||||
update_qty = params[:update_qty]
|
||||
saleitemId = params[:sale_item_id]
|
||||
update_qty = params[:update_qty]
|
||||
update_price = params[:update_price]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
|
||||
saleitemObj.qty = update_qty
|
||||
saleitemObj.price = update_qty.to_f * update_price.to_f
|
||||
saleitemObj.unit_price = update_price
|
||||
saleitemObj.qty = update_qty
|
||||
saleitemObj.price = update_qty.to_f * update_price.to_f
|
||||
saleitemObj.unit_price = update_price
|
||||
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
|
||||
# saleitemObj.remark = 'edit'
|
||||
saleitemObj.product_name = saleitemObj.product_name + " - updated"
|
||||
saleitemObj.product_name = saleitemObj.product_name + " - updated"
|
||||
saleitemObj.save
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
|
||||
# make cancel void item
|
||||
def item_void_cancel
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
both = SaleItem.where('product_code=?',saleitemObj.product_code)
|
||||
both.each do |item|
|
||||
if item.qty.to_i > 0
|
||||
item.remark = nil
|
||||
item.save
|
||||
end
|
||||
end
|
||||
saleitemObj.destroy
|
||||
# make cancel void item
|
||||
def item_void_cancel
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
both = SaleItem.where('product_code=?', saleitemObj.product_code)
|
||||
both.each do |item|
|
||||
if item.qty.to_i > 0
|
||||
item.remark = nil
|
||||
item.save
|
||||
end
|
||||
end
|
||||
saleitemObj.destroy
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
# remove all void items
|
||||
def cancel_all_void
|
||||
sale_id = params[:sale_id]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.sale_items.each do |item|
|
||||
if item.qty.to_i < 0
|
||||
item.destroy
|
||||
else
|
||||
item.remark = nil
|
||||
end
|
||||
item.save
|
||||
end
|
||||
# remove all void items
|
||||
def cancel_all_void
|
||||
sale_id = params[:sale_id]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.sale_items.each do |item|
|
||||
if item.qty.to_i < 0
|
||||
item.destroy
|
||||
else
|
||||
item.remark = nil
|
||||
end
|
||||
item.save
|
||||
end
|
||||
|
||||
# re-calc tax
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
# re-calc tax
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
def apply_void
|
||||
sale_id = params[:sale_id]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
def apply_void
|
||||
sale_id = params[:sale_id]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,6 +70,6 @@ class PrintSettingsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def print_setting_params
|
||||
params.require(:print_setting).permit(:name, :unique_code, :template, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,9 @@ class Settings::DiningChargesController < ApplicationController
|
||||
# GET /dining_charges/new
|
||||
def new
|
||||
@dining_charge = DiningCharge.new
|
||||
@dining_charge.minimum_free_time="00:30"
|
||||
@dining_charge.charge_block="02:00"
|
||||
@dining_charge.time_rounding_block="00:15"
|
||||
end
|
||||
|
||||
# GET /dining_charges/1/edit
|
||||
@@ -29,7 +32,11 @@ class Settings::DiningChargesController < ApplicationController
|
||||
@dining_charge.dining_facility_id = @settings_dining_facility.id
|
||||
respond_to do |format|
|
||||
if @dining_charge.save
|
||||
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
|
||||
if @table
|
||||
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
|
||||
else
|
||||
format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
|
||||
end
|
||||
format.json { render :show, status: :created, location: @dining_charge }
|
||||
else
|
||||
format.html { render :new }
|
||||
@@ -44,7 +51,11 @@ class Settings::DiningChargesController < ApplicationController
|
||||
respond_to do |format|
|
||||
@dining_charge.dining_facility_id = @settings_dining_facility.id
|
||||
if @dining_charge.update(dining_charge_params)
|
||||
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
|
||||
if @table
|
||||
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
|
||||
else
|
||||
format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
|
||||
end
|
||||
format.json { render :show, status: :ok, location: @dining_charge }
|
||||
else
|
||||
format.html { render :edit }
|
||||
|
||||
@@ -5,11 +5,8 @@ class Ability
|
||||
user ||= Employee.new
|
||||
|
||||
if user.role == "administrator"
|
||||
|
||||
can :manage, :all
|
||||
|
||||
elsif user.role == "manager"
|
||||
|
||||
can :manage, Menu
|
||||
can :manage, MenuCategory
|
||||
can :manage, MenuItemAttribute
|
||||
@@ -98,7 +95,6 @@ class Ability
|
||||
can :create, :payment
|
||||
can :reprint, :payment
|
||||
can :rounding_adj, :payment
|
||||
can :foc, :payment
|
||||
|
||||
can :move_dining, :movetable
|
||||
can :moving, :movetable
|
||||
@@ -132,7 +128,5 @@ class Ability
|
||||
can :reprint, :payment
|
||||
can :rounding_adj, :payment
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,40 +2,75 @@ class DiningCharge < ApplicationRecord
|
||||
belongs_to :table
|
||||
belongs_to :room
|
||||
|
||||
def amount_calculate(dining_charges_obj, checkin , checkout)
|
||||
def self.amount_calculate(dining_charges_obj, checkin , checkout)
|
||||
|
||||
if !checkin.nil? && !checkout.nil? && !dining_charges_obj.nil?
|
||||
|
||||
minutes = ((checkin - checkout) * 24 * 60).to_i # stay minutes
|
||||
dining_minutes = minutes - dining_charges_obj.minimum_free_time # stayminutes - free minutes
|
||||
price = 0
|
||||
minutes = DiningCharge.time_diff(checkout, checkin)
|
||||
free_time = DiningCharge.convert_to_minutes(dining_charges_obj.minimum_free_time.strftime('%H:%M'))
|
||||
dining_minutes = minutes - free_time # stayminutes - free minutes
|
||||
charge_type = dining_charges_obj.charge_type
|
||||
if charge_type == 'hr'
|
||||
|
||||
price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'hr')
|
||||
elsif charge_type == 'day'
|
||||
price = charge_by_day
|
||||
price = charges(dining_charges_obj, dining_minutes, 'day')
|
||||
end
|
||||
|
||||
return price
|
||||
else
|
||||
puts "<<<<<<<< NO"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def charge_by_hour
|
||||
|
||||
end
|
||||
|
||||
def charge_by_day(chargesObj, dining_minutes)
|
||||
minues_per_day = 12 * 60
|
||||
result = dining_minutes / minues_per_day
|
||||
if result < 1
|
||||
def self.charges(chargesObj, dining_minutes, type)
|
||||
solid_price = 0
|
||||
block = DiningCharge.convert_to_minutes(chargesObj.charge_block.strftime('%H:%M'))
|
||||
result = dining_minutes / block
|
||||
if result.to_i < 1
|
||||
return chargesObj.unit_price
|
||||
elsif result > 1
|
||||
elsif result.to_i >= 1
|
||||
solid_price = result * chargesObj.unit_price
|
||||
|
||||
remain_value = dining_minutes % minues_per_day
|
||||
roundingblock = remain_value / chargesObj.time_rounding_block
|
||||
if roundingblock > 1
|
||||
|
||||
remain_value = dining_minutes % block
|
||||
rounding_block = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.strftime('%H:%M'))
|
||||
roundingblock = remain_value / rounding_block
|
||||
if roundingblock.to_i < 1
|
||||
return DiningCharge.check_rounding(chargesObj, solid_price)
|
||||
else
|
||||
solid_price += roundingblock * chargesObj.time_rounding_block_price
|
||||
remain_rounding = dining_minutes % block
|
||||
if remain_rounding.to_i < 1
|
||||
return DiningCharge.check_rounding(chargesObj, solid_price)
|
||||
else
|
||||
return solid_price
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_rounding(chargesObj)
|
||||
if chargesObj.time_rounding == "down"
|
||||
return solid_price
|
||||
else
|
||||
return solid_price += chargesObj.time_rounding_block_price
|
||||
end
|
||||
end
|
||||
|
||||
def self.time_diff(start_time, end_time)
|
||||
seconds_diff = (start_time - end_time).to_i.abs
|
||||
hours = seconds_diff / 3600
|
||||
seconds_diff -= hours * 3600
|
||||
|
||||
minutes = seconds_diff / 60
|
||||
seconds_diff -= minutes * 60
|
||||
|
||||
seconds = seconds_diff
|
||||
return hours * 60 + minutes
|
||||
end
|
||||
|
||||
def self.convert_to_minutes(time)
|
||||
arr = time.split(":")
|
||||
hour = arr[0].to_i * 60
|
||||
return hour + arr[1].to_i
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,6 +109,14 @@ class Sale < ApplicationRecord
|
||||
booking.checkout_by = requested_by.name
|
||||
booking.save
|
||||
|
||||
# dining charges
|
||||
charges = DiningCharge.where('dining_facility_id=?',booking.dining_facility_id).take
|
||||
if !charges.nil?
|
||||
diningprice = DiningCharge.amount_calculate(charges, booking.checkin_at, booking.checkout_at)
|
||||
dining_time = booking.checkin_at.strftime('%H:%M %p').to_s + " - " + booking.checkout_at.strftime('%H:%M %p').to_s
|
||||
create_saleitem_diningcharges(charges, diningprice, booking.dining_facility.name, dining_time)
|
||||
end
|
||||
|
||||
return true, self.id
|
||||
end
|
||||
|
||||
@@ -162,6 +170,20 @@ class Sale < ApplicationRecord
|
||||
self.sale_items << sale_item
|
||||
end
|
||||
|
||||
def create_saleitem_diningcharges(chargeObj, diningprice, dining_name, dining_time)
|
||||
sale_item = SaleItem.new
|
||||
sale_item.product_code = chargeObj.item_code
|
||||
sale_item.product_name = dining_name.to_s + " ( " + dining_time.to_s + " )"
|
||||
# sale_item.account_id = item.account_id
|
||||
sale_item.product_alt_name = "-"
|
||||
sale_item.qty = 1
|
||||
sale_item.unit_price = chargeObj.unit_price
|
||||
sale_item.taxable_price = diningprice
|
||||
sale_item.is_taxable = chargeObj.taxable
|
||||
sale_item.sale_id = self.id
|
||||
sale_item.price = diningprice
|
||||
sale_item.save
|
||||
end
|
||||
|
||||
def update_item (item)
|
||||
#save sale_audit
|
||||
@@ -245,7 +267,7 @@ class Sale < ApplicationRecord
|
||||
rounding_adjustment = 0
|
||||
|
||||
sales_items.each do |item|
|
||||
if item.remark != 'void'
|
||||
if item.remark != 'void' && item.remark != 'foc'
|
||||
#compute each item and added to total
|
||||
subtotal_price = subtotal_price + item.price
|
||||
total_taxable = total_taxable + item.price
|
||||
@@ -318,7 +340,8 @@ class Sale < ApplicationRecord
|
||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
|
||||
customer = Customer.find(self.customer_id)
|
||||
# #Create new tax records
|
||||
|
||||
#Create new tax records
|
||||
tax_profiles.each do |tax|
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
@@ -396,7 +419,7 @@ class Sale < ApplicationRecord
|
||||
else
|
||||
keyword = "receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%"
|
||||
end
|
||||
|
||||
|
||||
if from.present? && to.present?
|
||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to)
|
||||
query = sale.where(keyword)
|
||||
@@ -556,97 +579,95 @@ def self.get_by_shift_sale(from,to,status)
|
||||
query = ShiftSale.select("shift_sales.id ,shift_started_at AS opening_date,
|
||||
shift_closed_at As closing_date," +
|
||||
" grand_total AS grand_total, cash_sales AS cash," +
|
||||
"total_taxes AS total_tax,total_discounts As total_discount")
|
||||
"total_taxes AS total_tax,total_discounts As total_discount")
|
||||
.order("shift_sales.id DESC")
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" + " AND shift_sales.shift_closed_at <= ?", from,to)
|
||||
end
|
||||
|
||||
def self.get_item_query()
|
||||
query = Sale.select("acc.title as account_name,mi.account_id, mi.item_code as item_code, " +
|
||||
query = Sale.select("acc.title as account_name,mi.account_id, mi.item_code as item_code, " +
|
||||
"(SUM(i.qty * i.unit_price)) as grand_total,SUM(i.qty) as total_item," +
|
||||
" i.unit_price as unit_price,mi.name as product_name, mc.name as" +
|
||||
" menu_category_name,mc.id as menu_category_id ")
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code" +
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code" +
|
||||
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id JOIN menu_categories mc ON mc.id = mi.menu_category_id ")
|
||||
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
|
||||
|
||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||
query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id")
|
||||
end
|
||||
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||
|
||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||
|
||||
query = self.get_item_query()
|
||||
discount_query = 0
|
||||
total_card_amount = 0
|
||||
total_cash_amount = 0
|
||||
total_credit_amount = 0
|
||||
total_foc_amount = 0
|
||||
total_grand_total = 0
|
||||
|
||||
if shift.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.to_a)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
### => get all sales range in shift_sales
|
||||
elsif shift_sale_range.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift_sale_range.to_a)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
else
|
||||
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.receipt_date between ? and ? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", from,to)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
end
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||
|
||||
return query, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
|
||||
end
|
||||
query = self.get_item_query()
|
||||
discount_query = 0
|
||||
total_card_amount = 0
|
||||
total_cash_amount = 0
|
||||
total_credit_amount = 0
|
||||
total_foc_amount = 0
|
||||
total_grand_total = 0
|
||||
|
||||
if shift.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.to_a)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
### => get all sales range in shift_sales
|
||||
elsif shift_sale_range.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift_sale_range.to_a)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
else
|
||||
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.receipt_date between ? and ? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", from,to)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
end
|
||||
|
||||
return query, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
|
||||
end
|
||||
|
||||
def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_type)
|
||||
## => left join -> show all sales although no orders
|
||||
@@ -659,7 +680,7 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
|
||||
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
query = Sale.all
|
||||
if shift.present?
|
||||
|
||||
@@ -678,10 +699,10 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
|
||||
query = query.where("sale_status='completed' and sales.receipt_date between ? and ? #{payment_type} and sale_payments.payment_amount != 0",from,to)
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.group("sales.sale_id")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to)
|
||||
def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to)
|
||||
query = SalePayment.select("s.receipt_no, sale_payments.*,s.receipt_date as sale_date,
|
||||
s.cashier_name as cashier_name")
|
||||
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
||||
@@ -693,16 +714,16 @@ def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to)
|
||||
else
|
||||
query = query.where("payment_method='creditnote' and s.sale_status = 'completed' and s.receipt_date between ? and ? ",from,to)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_void_sale(shift,from,to)
|
||||
sale_arr = Array.new
|
||||
|
||||
|
||||
query = Sale.select("sales.receipt_no,sales.receipt_date, sales.payment_status, sales.sale_status,sales.total_amount,sales.grand_total, sales.rounding_adjustment")
|
||||
# .joins("INNER JOIN shift_sales sh ON sh.id = sales.shift_sale_id")
|
||||
# .where("sales.sale_status = 'void' and (sh.shift_started_at between ? and ?
|
||||
# .where("sales.sale_status = 'void' and (sh.shift_started_at between ? and ?
|
||||
# OR sh.shift_closed_at between ? and ? )", from ,to, from, to)
|
||||
|
||||
|
||||
if shift.present?
|
||||
query = query.where("sales.sale_status = 'void' and sales.shift_sale_id in (?)",shift.to_a)
|
||||
else
|
||||
@@ -729,10 +750,10 @@ def self.get_separate_tax(shift_sale_range=nil,shift,from,to,payment_type)
|
||||
if shift.present?
|
||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) #{payment_type} and sale_status= 'completed' and sale_payments.payment_amount != 0", shift.to_a)
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) #{payment_type} and sale_status= 'completed' and sale_payments.payment_amount != 0", shift.to_a)
|
||||
.group("sale_taxes.tax_name")
|
||||
.order("sale_taxes.sale_tax_id asc")
|
||||
.order("sale_taxes.sale_tax_id asc")
|
||||
elsif shift_sale_range.present?
|
||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||
@@ -747,9 +768,18 @@ def self.get_separate_tax(shift_sale_range=nil,shift,from,to,payment_type)
|
||||
.where("sales.receipt_date between ? and ? #{payment_type} and sale_status= 'completed' and sale_payments.payment_amount != 0", from,to)
|
||||
.group("sale_taxes.tax_name")
|
||||
.order("sale_taxes.sale_tax_id asc")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# def self.get_separate_tax(from,to,payment_method=nil)
|
||||
|
||||
# query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||
# .joins("INNER JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||
# .group("sale_taxes.tax_name")
|
||||
|
||||
# return query = query.where("sale_status=? and receipt_date between ? and ?","completed",from,to)
|
||||
# end
|
||||
|
||||
def grand_total_after_rounding
|
||||
return self.old_grand_total.to_f + self.rounding_adjustment.to_f
|
||||
end
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
class CloseCashierPdf < 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,:text_width
|
||||
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
||||
self.page_width = 210
|
||||
self.page_height = 7000
|
||||
|
||||
def initialize(printer_settings, shift_sale,shop_details,sale_taxes)
|
||||
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.margin = 5
|
||||
self.price_width = 40
|
||||
self.qty_width = 20
|
||||
@@ -170,11 +171,9 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.credit_sales}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
#start other payment details
|
||||
#start other payment details
|
||||
if shift_sale.other_sales > 0
|
||||
|
||||
other_payment.each do |other|
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Other Payment Details", :size => self.item_font_size, :align => :right
|
||||
@@ -232,9 +231,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Other Payment :", :size => self.item_font_size, :align => :right
|
||||
@@ -242,15 +239,14 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.other_sales}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# end other payment details
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_amount_by_account.each do |amount|
|
||||
|
||||
total_amount_by_account.each do |amount|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Amount:", :size => self.item_font_size, :align => :right
|
||||
@@ -381,8 +377,6 @@ class CloseCashierPdf < Prawn::Document
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
move_down 5
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -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.p_width = 200
|
||||
self.page_height = 1450
|
||||
self.page_width = PrintSetting.where("name = ?","CRM Order").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","CRM Order").first.page_height
|
||||
self.margin = 10
|
||||
# self.price_width = self.p_width / 2
|
||||
self.price_width=80
|
||||
|
||||
@@ -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 = 185
|
||||
self.page_height = 1450
|
||||
self.page_width = PrintSetting.where("name = ?","OrderItemPdf").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","OrderItemPdf").first.page_height
|
||||
self.margin = 0
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 40
|
||||
|
||||
@@ -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 = 190
|
||||
self.page_height = 1450
|
||||
self.page_width = PrintSetting.where("name = ?","Order Summary").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","Order Summary").first.page_height
|
||||
self.margin = 0
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 40
|
||||
|
||||
@@ -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 = 210
|
||||
self.page_height = 1450
|
||||
self.page_width = PrintSetting.where("name = ?","Queue No").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","Queue No").first.page_height
|
||||
self.margin = 5
|
||||
self.price_width = 35
|
||||
self.qty_width = 20
|
||||
|
||||
@@ -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 = 210
|
||||
self.page_height = 1450
|
||||
self.page_width = PrintSetting.where("name = ?","Receipt Bill").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","Receipt Bill").first.page_height
|
||||
self.margin = 5
|
||||
self.price_width = 40
|
||||
self.qty_width = 20
|
||||
|
||||
@@ -1,21 +1,228 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
|
||||
|
||||
<% if current_login_employee.role = "admin" %>
|
||||
<% if current_login_employee.role = "admin" %>
|
||||
|
||||
<% elsif current_login_employee.role = "cashier" %>
|
||||
<%= link_to "Cashier Station", origami_path %>
|
||||
<% elsif current_login_employee.role = "cashier" %>
|
||||
<%= link_to "Cashier Station", origami_path %>
|
||||
<% elsif current_login_employee = "account" %>
|
||||
<%= link_to "Cashier Station", oishi_path %>
|
||||
<% else %>
|
||||
<%= link_to "Cashier Station", oishi_path %>
|
||||
<% end %>
|
||||
<% shop = Shop.first %>
|
||||
|
||||
<% elsif current_login_employee = "account" %>
|
||||
<%= link_to "Cashier Station", oishi_path %>
|
||||
|
||||
<% else %>
|
||||
<%= link_to "Cashier Station", oishi_path %>
|
||||
|
||||
<% end %>
|
||||
<% shop = Shop.first %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 container pull-right" style="margin: 0px !important;">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card" id="oqs" onclick="location.href='<%= oqs_root_path %>'">
|
||||
<div class="card-content">
|
||||
<span class="card-title">OQS</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card" id="origami" onclick="location.href='<%= origami_root_path %>'">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Origami</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card" id="crm" onclick="location.href='<%= crm_root_path %>'">
|
||||
<div class="card-content">
|
||||
<span class="card-title">CRM</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card" id="backend" onclick="location.href='<%= dashboard_path %>'">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Backend</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8 col-lg-8">
|
||||
<div class="" style="max-height:550px; overflow:auto;padding: 15px">
|
||||
<h4 class="card-title"><strong>Role Features</strong></h4>
|
||||
<!-- <p><strong>Note:</strong> The <strong>data-parent</strong> attribute makes sure that all collapsible elements under the specified parent will be closed when one of the collapsible item is shown.</p> -->
|
||||
<div class="panel-group" id="accordion">
|
||||
<% if current_user.role == 'administrator' %>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#admin">Administrator
|
||||
<span class="glyphicon glyphicon-plus"></span></a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="admin" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<ul class="col-md-4">
|
||||
<li class="">All Settings</li>
|
||||
<ul class="">
|
||||
<li>Zone</li>
|
||||
<li>OQS</li>
|
||||
<li>Menu</li>
|
||||
<li>Cashier Terminal</li>
|
||||
<li>Payment</li>
|
||||
<li>Merbership</li>
|
||||
<li>Print</li>
|
||||
<li>Employees</li>
|
||||
<li>Accounts</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<ul class="col-md-4">
|
||||
<li class="">Transactions</li>
|
||||
<ul class="">
|
||||
<li>Order</li>
|
||||
<li>Sale</li>
|
||||
<li>Credit Note</li>
|
||||
</ul><br>
|
||||
<li>Reports</li>
|
||||
<ul class="">
|
||||
<li>Daily Sale</li>
|
||||
<li>Sale Item</li>
|
||||
<li>Receipt</li>
|
||||
<li>Shift Sale</li>
|
||||
<li>Credit Sale</li>
|
||||
<li>Void Sale</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<ul class="col-md-4">
|
||||
<li>OQS</li><br>
|
||||
<li>Origami</li><br>
|
||||
<li>CRM</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif current_user.role == 'manager' %>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#manager">Manager
|
||||
<span class="glyphicon glyphicon-plus"></span></a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="admin" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<ul class="col-md-4">
|
||||
<li class="">All Settings</li>
|
||||
<ul class="">
|
||||
<li>Zone</li>
|
||||
<li>OQS</li>
|
||||
<li>Menu</li>
|
||||
<li>Cashier Terminal</li>
|
||||
<li>Print</li>
|
||||
<li>Employees</li>
|
||||
<li>Accounts</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<ul class="col-md-4">
|
||||
<li class="">Transactions</li>
|
||||
<ul class="">
|
||||
<li>Order</li>
|
||||
<li>Sale</li>
|
||||
<li>Credit Note</li>
|
||||
</ul><br>
|
||||
<li>Reports</li>
|
||||
<ul class="">
|
||||
<li>Daily Sale</li>
|
||||
<li>Sale Item</li>
|
||||
<li>Receipt</li>
|
||||
<li>Shift Sale</li>
|
||||
<li>Credit Sale</li>
|
||||
<li>Void Sale</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<ul class="col-md-4">
|
||||
<li>OQS</li><br>
|
||||
<li>Origami</li><br>
|
||||
<li>CRM</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif current_user.role == 'supervisour' %>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#supervisor">Supervisor
|
||||
<span class="glyphicon glyphicon-plus"></span></a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="supervisor" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<ul class="">
|
||||
<li>OQS</li>
|
||||
<ul>
|
||||
<li class="">Void</li>
|
||||
<li class="">FOC</li>
|
||||
<li class="">Edit</li>
|
||||
<li class="">Credit</li>
|
||||
<li class="">Payment</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif current_user.role == 'cashier' %>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#cashier">Cashier
|
||||
<span class="glyphicon glyphicon-plus"></span></a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="cashier" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<ul class="">
|
||||
<li class="">Orgami Panel except Edit and Void</li>
|
||||
<li class="">Sale and Order</li>
|
||||
<li class="">and Queue in CRM</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif current_user.role == 'account' %>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#accountant">Accountant
|
||||
<span class="glyphicon glyphicon-plus"></span></a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="accountant" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<ul class="">
|
||||
<li class="">Daily Sale Report</li>
|
||||
<li class="">Sale Item Report</li>
|
||||
<li class="">Receipt No Report</li>
|
||||
<li class="">ShiftSale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div> <!-- end accordion id -->
|
||||
</div>
|
||||
</div> <!-- end col-md-4 -->
|
||||
|
||||
<div class="footer">
|
||||
<div class="card">
|
||||
<div class="page-header center-text">
|
||||
@@ -31,4 +238,45 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
.card {
|
||||
margin-top: 10px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 2px;
|
||||
background-clip: padding-box;
|
||||
transition: 0.3s ease;
|
||||
background-color: white;
|
||||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
.card span.card-title {
|
||||
color: purple;
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
text-transform: uppercase;
|
||||
transition: color 0.3s ease;
|
||||
line-height: 48px;
|
||||
}
|
||||
|
||||
.card .card-content {
|
||||
padding: 15%;
|
||||
border-radius: 0 0 2px 2px;
|
||||
background-clip: padding-box;
|
||||
box-sizing: border-box;
|
||||
height: 120px;
|
||||
transition: color 0.3s ease;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card .card-content p {
|
||||
margin: 0;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.16), 0 10px 20px 0 rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,86 +1,91 @@
|
||||
<style>
|
||||
.pin_pad {
|
||||
width: 30%;
|
||||
height:70px;
|
||||
line-height:70px;
|
||||
text-align:center;
|
||||
background:#54A5AF;
|
||||
font-size:20px;
|
||||
color:white;
|
||||
height: 70px;
|
||||
line-height: 70px;
|
||||
text-align: center;
|
||||
background: #54A5AF;
|
||||
font-size: 20px;
|
||||
color: white;
|
||||
}
|
||||
.bottom{
|
||||
margin-bottom: 1px;
|
||||
|
||||
.bottom {
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
.left{
|
||||
margin-left:1px;
|
||||
|
||||
.left {
|
||||
margin-left: 1px;
|
||||
}
|
||||
.orange{
|
||||
background-color:#FF7F50;
|
||||
|
||||
.orange {
|
||||
background-color: #FF7F50;
|
||||
}
|
||||
|
||||
.purple {
|
||||
background-color:#7a62d3;
|
||||
background-color: #7a62d3;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
|
||||
<%= simple_form_for(@login_form, url: emp_login_update_path, method: "PATCH") do |f| %>
|
||||
<div class="card">
|
||||
<div class="content" style="margin:10px">
|
||||
<div class="form-group">
|
||||
<%= f.input :emp_id,as: :hidden, label: "Access PIN", required: false, class: "form-control" %>
|
||||
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
|
||||
<%= simple_form_for(@login_form, url: emp_login_update_path, method: "PATCH") do |f| %>
|
||||
<div class="card">
|
||||
<div class="content" style="margin:10px">
|
||||
<div class="form-group">
|
||||
<%= f.input :emp_id, as: :hidden, label: "Access PIN", required: false, class: "form-control" %>
|
||||
|
||||
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content row" style="padding-left:10px;margin-left:10px; margin-top:0px; text-align:center">
|
||||
<div class='col-md-12'>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad " data-value="1">1</div>
|
||||
<div class="pin_pad left" data-value="2">2</div>
|
||||
<div class="pin_pad left" data-value="3">3</div>
|
||||
</div>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad" data-value="4">4</div>
|
||||
<div class="pin_pad left" data-value="5">5</div>
|
||||
<div class="pin_pad left" data-value="6">6</div>
|
||||
</div>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad" data-value="7">7</div>
|
||||
<div class="pin_pad left" data-value="8">8</div>
|
||||
<div class="pin_pad left" data-value="9">9</div>
|
||||
</div>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad orange" data-value="CLR">CLR</div>
|
||||
<div class="pin_pad left" data-value="0">0</div>
|
||||
<div class="pin_pad left purple" data-value="ENT">ENT</div>
|
||||
</div>
|
||||
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content row" style="padding-left:10px;margin-left:10px; margin-top:0px; text-align:center">
|
||||
<div class='col-md-12'>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad " data-value="1">1</div>
|
||||
<div class="pin_pad left" data-value="2">2</div>
|
||||
<div class="pin_pad left" data-value="3">3</div>
|
||||
</div>
|
||||
<div class="footer text-center" style="margin:10px">
|
||||
|
||||
</div>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad" data-value="4">4</div>
|
||||
<div class="pin_pad left" data-value="5">5</div>
|
||||
<div class="pin_pad left" data-value="6">6</div>
|
||||
</div>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad" data-value="7">7</div>
|
||||
<div class="pin_pad left" data-value="8">8</div>
|
||||
<div class="pin_pad left" data-value="9">9</div>
|
||||
</div>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad orange" data-value="CLR">CLR</div>
|
||||
<div class="pin_pad left" data-value="0">0</div>
|
||||
<div class="pin_pad left purple" data-value="ENT">ENT</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer text-center" style="margin:10px">
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$(".pin_pad").click(function(event){
|
||||
event.preventDefault();
|
||||
console.log($(this).data("value"));
|
||||
var value = $(this).data("value");
|
||||
$(document).on('turbolinks:load', function () {
|
||||
$(".pin_pad").click(function (event) {
|
||||
event.preventDefault();
|
||||
console.log($(this).data("value"));
|
||||
var value = $(this).data("value");
|
||||
|
||||
if (value == "CLR") {
|
||||
$("#login_form_password").val("");
|
||||
} else if(value == "ENT") {
|
||||
$("#new_login_form").submit();
|
||||
} else {
|
||||
var old_value = $("#login_form_password").val();
|
||||
$("#login_form_password").val(old_value + value);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (value == "CLR") {
|
||||
$("#login_form_password").val("");
|
||||
} else if (value == "ENT") {
|
||||
$("#new_login_form").submit();
|
||||
} else {
|
||||
var old_value = $("#login_form_password").val();
|
||||
$("#login_form_password").val(old_value + value);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,216 +1,235 @@
|
||||
<div class="row">
|
||||
<!-- Column Two -->
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p> Receipt No: <span id="receipt_no">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p> Receipt No: <span id="receipt_no">
|
||||
<%= @saleobj.receipt_no rescue '' %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date:
|
||||
<span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table " id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%">#</th>
|
||||
<th class="" width="30%">Items</th>
|
||||
<th style="" width="13%">QTY</td>
|
||||
<th class="" width="13%">Price</td>
|
||||
<!-- <th class='' width="17%"> Total </th> -->
|
||||
<th class='' width="17%"> Action </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
@saleobj.sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
</div>
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table " id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%">#</th>
|
||||
<th class="" width="30%">Items</th>
|
||||
<th style="" width="13%">QTY
|
||||
</td>
|
||||
<th class="" width="13%">Price
|
||||
</td>
|
||||
<!-- <th class='' width="17%"> Total </th> -->
|
||||
<th class='' width="17%"> Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
@saleobj.sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr>
|
||||
<td width="4%"><%= count %></td>
|
||||
<td class='' width="30%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' %>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id%>_qty" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
<tr>
|
||||
<td width="4%"><%= count %></td>
|
||||
<td class='' width="30%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' && sale_item.remark != 'foc' %>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
</td> -->
|
||||
<td class='' width="17%">
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update
|
||||
</button>
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
|
||||
</td>
|
||||
<td class='' width="17%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update</button>
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-info btn-md foc'>FOC</button>
|
||||
</td>
|
||||
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
|
||||
<td class='' width="13%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td> -->
|
||||
<td class='' width="17%">
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel Void/Update</button>
|
||||
</td>
|
||||
<% else %>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<td class='' width="17%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel
|
||||
Void/Update
|
||||
</button>
|
||||
</td>
|
||||
<% else %>
|
||||
<td class='' width="13%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='cancel_all_void' >Cancel All Void</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='apply' >Apply</button>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='cancel_all_void'>Cancel All Void</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='apply'>Apply</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// Bill Request
|
||||
$(document).ready(function(){
|
||||
|
||||
$(".update").on('click',function() {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var qty = $('#'+sale_item_id + "_qty").val();
|
||||
var price = $('#'+ sale_item_id + "_price").val();
|
||||
console.log(qty + "|" + price)
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id='+ sale_item_id + "&update_qty="+qty + "&update_price="+ price,
|
||||
success:function(result){
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'Qty and Price was successfully Updated',
|
||||
buttons: {
|
||||
// Bill Request
|
||||
$(document).ready(function () {
|
||||
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green btn-lg',
|
||||
action: function(){
|
||||
location.reload();
|
||||
$(".update").on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var qty = $('#' + sale_item_id + "_qty").val();
|
||||
var price = $('#' + sale_item_id + "_price").val();
|
||||
console.log(qty + "|" + price)
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
|
||||
success: function (result) {
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'Qty and Price was successfully Updated',
|
||||
buttons: {
|
||||
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green btn-lg',
|
||||
action: function () {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.void').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.foc').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_foc";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.cancel').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_void_cancel";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#back').on('click', function () {
|
||||
var table_id = '<%= @table_id %>'
|
||||
window.location.href = '/origami/table/' + table_id;
|
||||
})
|
||||
|
||||
$('#cancel_all_void').on('click', function () {
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/origami/cancel_all_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.void').on('click',function(){
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id='+ sale_item_id,
|
||||
success:function(result){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.cancel').on('click',function(){
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_void_cancel";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id='+ sale_item_id,
|
||||
success:function(result){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
var table_id = '<%= @table_id %>'
|
||||
window.location.href = '/origami/table/'+ table_id;
|
||||
})
|
||||
|
||||
$('#cancel_all_void').on('click',function(){
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/origami/cancel_all_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id='+ sale_id,
|
||||
success:function(result){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#apply').on('click',function(){
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/origami/apply_void";
|
||||
var table_id = '<%= @table_id %>'
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id='+ sale_id,
|
||||
success:function(result){
|
||||
window.location.href = '/origami/table/'+ table_id ;
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#apply').on('click', function () {
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/origami/apply_void";
|
||||
var table_id = '<%= @table_id %>'
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
success: function (result) {
|
||||
window.location.href = '/origami/table/' + table_id;
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
<%= f.input :name %>
|
||||
<%= f.input :unique_code %>
|
||||
<%= f.input :template %>
|
||||
<%= f.input :db_name %>
|
||||
<%= f.input :db_type %>
|
||||
<%= f.input :db_username %>
|
||||
<%= f.input :db_password %>
|
||||
<%= f.input :printer_name %>
|
||||
<%= f.input :api_settings %>
|
||||
<%= f.input :page_width %>
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Unique code</th>
|
||||
<!--<th>Template</th>
|
||||
<th>Db name</th>
|
||||
<th>Db type</th>
|
||||
<th>Db username</th>
|
||||
<th>Db password</th> -->
|
||||
<th>Template</th>
|
||||
<th>Printer name</th>
|
||||
<th>Api settings</th>
|
||||
<th>Page width</th>
|
||||
@@ -38,11 +34,7 @@
|
||||
<tr>
|
||||
<td><%= print_setting.name %></td>
|
||||
<td><%= print_setting.unique_code %></td>
|
||||
<!--<td><%= print_setting.template %></td>
|
||||
<td><%= print_setting.db_name %></td>
|
||||
<td><%= print_setting.db_type %></td>
|
||||
<td><%= print_setting.db_username %></td>
|
||||
<td><%= print_setting.db_password %></td> -->
|
||||
<td><%= print_setting.template %></td>
|
||||
<td><%= print_setting.printer_name %></td>
|
||||
<td><%= print_setting.api_settings %></td>
|
||||
<td><%= print_setting.page_width %></td>
|
||||
|
||||
@@ -29,22 +29,6 @@
|
||||
<th>Template</th>
|
||||
<td><%= @print_setting.template %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Db name</th>
|
||||
<td><%= @print_setting.db_name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Db type</th>
|
||||
<td><%= @print_setting.db_type %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Db username</th>
|
||||
<td><%= @print_setting.db_username %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Db password</th>
|
||||
<td><%= @print_setting.db_password %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Printer name</th>
|
||||
<td><%= @print_setting.printer_name %></td>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :item_code %>
|
||||
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
|
||||
<%= f.input :unit_price %>
|
||||
<%= f.input :taxable %>
|
||||
<%= f.input :charge_type %>
|
||||
<%= f.input :charge_type, :collection => [:hr, :day] %>
|
||||
<%= f.input :minimum_free_time %>
|
||||
<%= f.input :charge_block %>
|
||||
<%= f.input :time_rounding %>
|
||||
@@ -16,3 +16,4 @@
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -16,3 +16,17 @@
|
||||
</div>
|
||||
<%= render 'form', dining_charge: @dining_charge %>
|
||||
</div>
|
||||
<script>
|
||||
function randomNumber(len) {
|
||||
var randomNumber;
|
||||
var n = '';
|
||||
|
||||
for(var count = 0; count < len; count++) {
|
||||
randomNumber = Math.floor(Math.random() * 10);
|
||||
n += randomNumber.toString();
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
document.getElementById("item_code").value = "<%= @zone.id %>"+"<%= @settings_dining_facility.id %>"+"_"+randomNumber(5);
|
||||
</script>
|
||||
@@ -7,6 +7,28 @@
|
||||
<%= f.input :seater %>
|
||||
<%= f.input :order_by %>
|
||||
<%= f.input :is_active %>
|
||||
<% if @settings_room.dining_charges.length == 0 %>
|
||||
<% if @settings_room.id != nil %>
|
||||
<div class="div-border">
|
||||
<div class="col-md-10">
|
||||
<%= link_to 'Add For Extra Charges', new_settings_zone_room_dining_charge_path(@zone,@settings_room),:class => 'btn btn-primary' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% @settings_room.dining_charges.each do |dc| %>
|
||||
<div class="div-border">
|
||||
<div class="col-md-10"><b><u>Dining Charge</u></b></div>
|
||||
<div class="col-md-10">item code : <%= dc.item_code %></div>
|
||||
<div class="col-md-10">Unit price : <%= dc.unit_price %></div>
|
||||
<div class="col-md-10">Charge type : <%= dc.charge_type %></div>
|
||||
<div class="col-md-10">
|
||||
<%= link_to 'Edit Charges', edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc),:class => 'btn btn-primary' %>
|
||||
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc) %>">Edit Charge</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
<%= f.input :order_by %>
|
||||
<%= f.input :is_active %>
|
||||
<% if @settings_table.dining_charges.length == 0 %>
|
||||
<div class="div-border">
|
||||
<div class="col-md-10">
|
||||
<%= link_to 'Add For Extra Charges', new_settings_zone_table_dining_charge_path(@zone,@settings_table),:class => 'btn btn-primary' %>
|
||||
</div>
|
||||
</div>
|
||||
<% if @settings_table.id != nil %>
|
||||
<div class="div-border">
|
||||
<div class="col-md-10">
|
||||
<%= link_to 'Add For Extra Charges', new_settings_zone_table_dining_charge_path(@zone,@settings_table),:class => 'btn btn-primary' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% @settings_table.dining_charges.each do |dc| %>
|
||||
<div class="div-border">
|
||||
|
||||
@@ -80,6 +80,7 @@ Rails.application.routes.draw do
|
||||
post 'moving' => "movetable#moving"
|
||||
get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit"
|
||||
post 'item_void' => "sale_edit#item_void"
|
||||
post 'item_foc' => "sale_edit#item_foc"
|
||||
post 'item_edit' => "sale_edit#item_edit"
|
||||
post 'item_void_cancel' => "sale_edit#item_void_cancel"
|
||||
post 'cancel_all_void' => 'sale_edit#cancel_all_void'
|
||||
|
||||
@@ -10,6 +10,7 @@ class CreateDiningCharges < ActiveRecord::Migration[5.1]
|
||||
t.time :charge_block
|
||||
t.string :time_rounding, :default => "down"
|
||||
t.time :time_rounding_block
|
||||
t.integer :time_rounding_block_price, :default => 0
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class RemoveDBcolsFromPrintSettings < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
remove_column :print_settings, :db_name, :string
|
||||
remove_column :print_settings, :db_type, :string
|
||||
remove_column :print_settings, :db_username, :string
|
||||
remove_column :print_settings, :db_password, :string
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user