fixed conflit

This commit is contained in:
NyanLinHtut
2019-09-11 13:30:45 +06:30
28 changed files with 262 additions and 132 deletions

View File

@@ -47,7 +47,7 @@ GEM
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
aescrypt (1.0.0) aescrypt (1.0.0)
airbrussh (1.3.2) airbrussh (1.3.3)
sshkit (>= 1.6.1, != 1.7.0) sshkit (>= 1.6.1, != 1.7.0)
arel (8.0.0) arel (8.0.0)
axlsx (2.0.1) axlsx (2.0.1)
@@ -62,7 +62,7 @@ GEM
builder (3.2.3) builder (3.2.3)
byebug (11.0.1) byebug (11.0.1)
cancancan (1.17.0) cancancan (1.17.0)
capistrano (3.11.0) capistrano (3.11.1)
airbrussh (>= 1.0.0) airbrussh (>= 1.0.0)
i18n i18n
rake (>= 10.0.0) rake (>= 10.0.0)
@@ -99,8 +99,8 @@ GEM
factory_girl_rails (4.9.0) factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0) factory_girl (~> 4.9.0)
railties (>= 3.0.0) railties (>= 3.0.0)
faker (2.1.0) faker (2.2.2)
i18n (>= 0.7) i18n (~> 1.6.0)
ffi (1.11.1) ffi (1.11.1)
filterrific (5.2.1) filterrific (5.2.1)
font-awesome-rails (4.7.0.5) font-awesome-rails (4.7.0.5)
@@ -148,9 +148,9 @@ GEM
material_icons (2.2.1) material_icons (2.2.1)
railties (>= 3.2) railties (>= 3.2)
method_source (0.9.2) method_source (0.9.2)
mime-types (3.2.2) mime-types (3.3)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331) mime-types-data (3.2019.0904)
mini_magick (4.9.5) mini_magick (4.9.5)
mini_mime (1.0.2) mini_mime (1.0.2)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
@@ -163,8 +163,8 @@ GEM
net-scp (2.0.0) net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0) net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0) net-ssh (5.2.0)
nio4r (2.4.0) nio4r (2.5.1)
nokogiri (1.10.3) nokogiri (1.10.4)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
pdf-core (0.7.0) pdf-core (0.7.0)
pdfjs_viewer-rails (0.3.1) pdfjs_viewer-rails (0.3.1)
@@ -183,7 +183,7 @@ GEM
puma (3.12.1) puma (3.12.1)
rack (2.0.7) rack (2.0.7)
rack-cors (1.0.3) rack-cors (1.0.3)
rack-protection (2.0.5) rack-protection (2.0.7)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
@@ -202,7 +202,7 @@ GEM
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.1.0) rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2) loofah (~> 2.2, >= 2.2.2)
railties (5.1.7) railties (5.1.7)
actionpack (= 5.1.7) actionpack (= 5.1.7)
@@ -251,9 +251,8 @@ GEM
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
sassc (2.0.1) sassc (2.2.0)
ffi (~> 1.9) ffi (~> 1.9)
rake
schema_to_scaffold (0.8.0) schema_to_scaffold (0.8.0)
activesupport (>= 3.2.1) activesupport (>= 3.2.1)
shoulda-matchers (3.1.3) shoulda-matchers (3.1.3)

View File

@@ -298,13 +298,6 @@ select.form-control {
/* Discount */ /* Discount */
.discount-item-row {
cursor: pointer;
}
tr.discount-item-row:hover {
background-color: #e3e3e3 !important;
}
.required abbr{ .required abbr{
color: red !important; color: red !important;
} }

View File

@@ -5,6 +5,7 @@ class Crm::CustomersController < BaseCrmController
# GET /crm/customers # GET /crm/customers
# GET /crm/customers.json # GET /crm/customers.json
def index def index
@no_need_validation =false
filter = params[:filter] filter = params[:filter]
filter_card_no = params[:filter_card_no] filter_card_no = params[:filter_card_no]
type = params[:type] type = params[:type]
@@ -39,24 +40,37 @@ class Crm::CustomersController < BaseCrmController
@crm_customers.tax_profiles = ["1", "2"] @crm_customers.tax_profiles = ["1", "2"]
@crm_customers.save @crm_customers.save
@crm_customers = Customer.search(filter) @crm_customers = Customer.search(filter)
flash[:notice]='Customer was successfully created.' flash[:member_notice]='Customer was successfully created.'
else else
flash[:error]=response["message"] flash[:member_error]=response["message"]
end end
else else
@crm_customers.each do |customer| if response["status"] ==true
if customer.contact_no != response["customer_data"]["phone"] @crm_customers.each do |customer|
@customer_update_phone_email_membertype =true if !response["customer_data"].nil?
if customer.contact_no != response["customer_data"]["phone"]
@customer_update_phone_email_membertype =true
end
if customer.email != response["customer_data"]["email"]
@customer_update_phone_email_membertype =true
end
if customer.name != response["customer_data"]["name"]
@customer_update_phone_email_membertype =true
end
if customer.membership_type.to_i != response["customer_data"]["member_group_id"]
@customer_update_phone_email_membertype =true
end
else
flash[:member_error]=response["message"]
end
end end
if customer.email != response["customer_data"]["email"] else
@customer_update_phone_email_membertype =true if response["message"] =='No internet connection '
end flash[:member_error]=response["message"]
if customer.name != response["customer_data"]["name"] else
@customer_update_phone_email_membertype =true flash[:member_error]="Need to press sync button "
end
if customer.membership_type.to_i != response["customer_data"]["member_group_id"]
@customer_update_phone_email_membertype =true
end end
end end
end end
end end
@@ -190,14 +204,18 @@ class Crm::CustomersController < BaseCrmController
}, },
:timeout => 10 :timeout => 10
) )
rescue HTTParty::Error
response = {"status" => false, "message" => "No internet connection "}
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = {"status" => false, "message" => "No internet connection "}
rescue OpenURI::HTTPError rescue OpenURI::HTTPError
response = { status: false} response = {"status" => false, "message" => "No internet connection "}
rescue SocketError rescue SocketError
response = { status: false} response = {"status" => false, "message" => "No internet connection "}
end end
customer = Customer.find(@crm_customer.customer_id) customer = Customer.find(@crm_customer.customer_id)
Rails.logger.debug "--------Sync Member response -------" Rails.logger.debug "--------Sync Member response -------"
@@ -222,6 +240,9 @@ class Crm::CustomersController < BaseCrmController
customer.destroy customer.destroy
format.html { redirect_to crm_customers_path } format.html { redirect_to crm_customers_path }
flash[:member_error] ='Member cannot created.Invalid Account.' flash[:member_error] ='Member cannot created.Invalid Account.'
else
format.html { redirect_to crm_customers_path }
flash[:member_error] =response["message"]
end end
format.html { redirect_to crm_customers_path } format.html { redirect_to crm_customers_path }
flash[:member_error] =response["message"] flash[:member_error] =response["message"]
@@ -286,16 +307,16 @@ class Crm::CustomersController < BaseCrmController
) )
rescue HTTParty::Error rescue HTTParty::Error
response = {"status" => false, "message" => "Can't open membership server "} response = {"status" => false, "message" => "No internet connection "}
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = {"status" => false, "message" => "Can't open membership server "} response = {"status" => false, "message" => "No internet connection "}
rescue OpenURI::HTTPError rescue OpenURI::HTTPError
response = {"status" => false, "message" => "Can't open membership server "} response = {"status" => false, "message" => "No internet connection "}
rescue SocketError rescue SocketError
response = {"status" => false, "message" => "Can't open membership server "} response = {"status" => false, "message" => "No internet connection "}
end end
Rails.logger.debug "--------------Create Member---------" Rails.logger.debug "--------------Create Member---------"
Rails.logger.debug response.to_json Rails.logger.debug response.to_json
@@ -332,6 +353,9 @@ class Crm::CustomersController < BaseCrmController
format.html { redirect_to crm_customers_path } format.html { redirect_to crm_customers_path }
flash[:member_error]='Member cannot created.Invalid Account.' flash[:member_error]='Member cannot created.Invalid Account.'
end end
else
format.html { redirect_to crm_customers_path }
flash[:member_error]=response["message"]
end end
if params[:sale_id] if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page] } format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page] }
@@ -431,14 +455,17 @@ class Crm::CustomersController < BaseCrmController
}, },
:timeout => 10 :timeout => 10
) )
rescue HTTParty::Error
response = {"status" => false, "message" => "No internet connection "}
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = {"status" => false, "message" => "No internet connection "}
rescue OpenURI::HTTPError rescue OpenURI::HTTPError
response = { status: false} response = {"status" => false, "message" => "No internet connection "}
rescue SocketError rescue SocketError
response = { status: false} response = {"status" => false, "message" => "No internet connection "}
end end
customer = Customer.find(@crm_customer.customer_id) customer = Customer.find(@crm_customer.customer_id)
Rails.logger.debug "--------Update Member response -------" Rails.logger.debug "--------Update Member response -------"
@@ -493,14 +520,17 @@ class Crm::CustomersController < BaseCrmController
}, },
:timeout => 10 :timeout => 10
) )
rescue HTTParty::Error
response = {"status" => false, "message" => "No internet connection "}
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = {"status" => false, "message" => "No internet connection "}
rescue OpenURI::HTTPError rescue OpenURI::HTTPError
response = { status: false} response = {"status" => false, "message" => "No internet connection "}
rescue SocketError rescue SocketError
response = { status: false} response = {"status" => false, "message" => "No internet connection "}
end end
Rails.logger.debug "--------Update Member response -------" Rails.logger.debug "--------Update Member response -------"
Rails.logger.debug response.to_json Rails.logger.debug response.to_json

View File

@@ -3,6 +3,8 @@ class Origami::DiscountsController < BaseOrigamiController
#discount page show from origami index with selected order #discount page show from origami index with selected order
def index def index
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@webview = false @webview = false
if check_mobile if check_mobile
@webview = true @webview = true

View File

@@ -17,7 +17,8 @@ class Origami::HomeController < BaseOrigamiController
# origami table detail # origami table detail
def show def show
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@webview = check_mobile @webview = check_mobile
@tables = Table.unscoped.all.active.order('status desc') @tables = Table.unscoped.all.active.order('status desc')

View File

@@ -8,7 +8,6 @@ class Origami::VoidController < BaseOrigamiController
access_code = params[:access_code] access_code = params[:access_code]
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id) sale = Sale.find_by_sale_id(sale_id)
if sale.discount_type == "member_discount" if sale.discount_type == "member_discount"
sale.update_attributes(total_discount: 0) sale.update_attributes(total_discount: 0)
sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source) sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source)

View File

@@ -59,6 +59,7 @@ class Reports::HourlySaleitemController < BaseReportController
# @hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}} # @hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
@hourly_total_qty = @sale_data.group_by(&:date_format).map { |k,v|{"date" => k , "total_qty" => v.count }} @hourly_total_qty = @sale_data.group_by(&:date_format).map { |k,v|{"date" => k , "total_qty" => v.count }}
puts @hourly_total_qty.to_json
respond_to do |format| respond_to do |format|
format.html format.html
format.xls format.xls

View File

@@ -54,8 +54,7 @@ class Reports::SaleitemController < BaseReportController
@shift_data = sh @shift_data = sh
end end
end end
respond_to do |format|
respond_to do |format|
format.html format.html
format.xls format.xls
end end
@@ -64,7 +63,7 @@ class Reports::SaleitemController < BaseReportController
def show def show
from, to, report_type = get_date_range_from_params from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
sale_data = @sale_data
date_arr = Array.new date_arr = Array.new
@sale_data.each do |sale| @sale_data.each do |sale|
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p") local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")

View File

@@ -30,9 +30,6 @@ class Settings::EmployeesController < ApplicationController
# POST /employees # POST /employees
# POST /employees.json # POST /employees.json
def create def create
puts "puts ssssssssssssssssssssssssss"
puts employee_params.to_json
@employee = Employee.new(employee_params) @employee = Employee.new(employee_params)
respond_to do |format| respond_to do |format|

View File

@@ -64,6 +64,8 @@ class AssignedOrderItem < ApplicationRecord
private private
def generate_custom_id def generate_custom_id
self.assigned_order_item_id = SeedGenerator.generate_id(self.class.name, "AOI") if self.assigned_order_item_id.nil?
self.assigned_order_item_id = SeedGenerator.generate_id(self.class.name, "AOI")
end
end end
end end

View File

@@ -122,6 +122,8 @@ class Booking < ApplicationRecord
private private
def generate_custom_id def generate_custom_id
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI") if self.booking_id.nil?
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
end
end end
end end

View File

@@ -325,16 +325,16 @@ class Customer < ApplicationRecord
:timeout => 10 :timeout => 10
) )
rescue HTTParty::Error rescue HTTParty::Error
response = {status: false, message: "Server Error"} response = {"status" => false, "message" => "No internet connection "}
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false , message: "Server Time out"} response = {"status" => false, "message" => "No internet connection "}
rescue OpenURI::HTTPError rescue OpenURI::HTTPError
response = { status: false, message: "Can't connect server"} response = {"status" => false, "message" => "No internet connection "}
rescue SocketError rescue SocketError
response = { status: false, message: "Can't connect server"} response = {"status" => false, "message" => "No internet connection "}
end end
Rails.logger.debug "--------Search Paypar Account No response -------" Rails.logger.debug "--------Search Paypar Account No response -------"
Rails.logger.debug response.to_json Rails.logger.debug response.to_json

View File

@@ -557,7 +557,9 @@ class Order < ApplicationRecord
private private
def generate_custom_id def generate_custom_id
self.order_id = SeedGenerator.generate_id(self.class.name, "ODR") if self.order_id.nil?
self.order_id = SeedGenerator.generate_id(self.class.name, "ODR")
end
end end
def set_order_date def set_order_date

View File

@@ -97,6 +97,8 @@ class OrderItem < ApplicationRecord
private private
def generate_custom_id def generate_custom_id
self.order_items_id = SeedGenerator.generate_id(self.class.name, "ODI") if self.order_items_id.nil?
self.order_items_id = SeedGenerator.generate_id(self.class.name, "ODI")
end
end end
end end

View File

@@ -452,6 +452,7 @@ class Sale < ApplicationRecord
self.total_amount = subtotal_price self.total_amount = subtotal_price
self.total_discount = total_discount self.total_discount = total_discount
self.grand_total = (self.total_amount - self.total_discount) + self.total_tax self.grand_total = (self.total_amount - self.total_discount) + self.total_tax
self.grand_total_round
#compute rounding adjustment #compute rounding adjustment
adjust_rounding adjust_rounding
@@ -460,7 +461,8 @@ class Sale < ApplicationRecord
end end
#compute - invoice total #compute - invoice total
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil,order_source=nil,tax_type=nil) def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil,order_source=nil,tax_type=nil,type=nil)
shop = Shop.first
sale = Sale.find(sale_id) sale = Sale.find(sale_id)
sales_items = sale_itemss sales_items = sale_itemss
@@ -471,19 +473,23 @@ class Sale < ApplicationRecord
sales_items.each do |item| sales_items.each do |item|
#compute each item and added to total #compute each item and added to total
subtotal_price = subtotal_price + item.price subtotal_price = subtotal_price + item.price
# check for item is taxable and calculate # check for item is taxable and calculate
if item.is_taxable if item.is_taxable
total_taxable = total_taxable + item.taxable_price total_taxable = total_taxable + item.taxable_price
end end
end end
compute_tax(sale, total_taxable, total_discount, order_source, tax_type) compute_tax(sale, total_taxable, total_discount, order_source, tax_type)
sale.total_amount = subtotal_price sale.total_amount = subtotal_price
sale.total_discount = total_discount sale.total_discount = total_discount
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax if type =="foc"
sale.grand_total = 0
else
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax
sale.grand_total_round
end
if discount_type == "member_discount" if discount_type == "member_discount"
sale.discount_type = discount_type sale.discount_type = discount_type
end end
@@ -519,6 +525,7 @@ class Sale < ApplicationRecord
self.total_amount = subtotal_price self.total_amount = subtotal_price
self.total_discount = total_discount self.total_discount = total_discount
self.grand_total = (self.total_amount - self.total_discount) + self.total_tax self.grand_total = (self.total_amount - self.total_discount) + self.total_tax
self.grand_total_round
#compute rounding adjustment #compute rounding adjustment
adjust_rounding adjust_rounding
@@ -1092,7 +1099,7 @@ def self.get_item_query(type)
"i.unit_price,i.price as price,i.product_name as product_name, " + "i.unit_price,i.price as price,i.product_name as product_name, " +
"i.menu_category_name,i.menu_category_code as menu_category_id, " + "i.menu_category_name,i.menu_category_code as menu_category_id, " +
"date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p') "date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')
as date_format") as date_format")
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" + query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id") " JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")
@@ -2948,9 +2955,19 @@ end
# End hourly sale item report # End hourly sale item report
#not to show decimal in grand total
def grand_total_round
print_settings = PrintSetting.get_precision_delimiter()
if !print_settings.nil?
self.grand_total =self.grand_total.round(print_settings.precision.to_i)
end
end
private private
def generate_custom_id def generate_custom_id
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL") if self.sale_id.nil?
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL")
end
end end
end end

View File

@@ -176,6 +176,8 @@ class SaleAudit < ApplicationRecord
private private
def generate_custom_id def generate_custom_id
self.sale_audit_id = SeedGenerator.generate_id(self.class.name, "SAI") if self.sale_audit_id.nil?
self.sale_audit_id = SeedGenerator.generate_id(self.class.name, "SAI")
end
end end
end end

View File

@@ -85,8 +85,10 @@ class SaleItem < ApplicationRecord
# sale_item.is_taxable = 1 # sale_item.is_taxable = 1
# sale_item.sale_id = sale_id # sale_item.sale_id = sale_id
# sale_item.save # sale_item.save
sale = Sale.find(sale_id) if type != "foc"
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount) sale = Sale.find(sale_id)
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount)
end
end end
def self.get_order_items_details(sale_id) def self.get_order_items_details(sale_id)
@@ -223,6 +225,8 @@ class SaleItem < ApplicationRecord
private private
def generate_custom_id def generate_custom_id
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI") if self.sale_item_id.nil?
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
end
end end
end end

View File

@@ -34,7 +34,9 @@ class SaleOrder < ApplicationRecord
private private
def generate_sale_order_id def generate_sale_order_id
# self.class.name # self.class.name
saleOrderId = SeedGenerator.generate_id(self.class.name, 'SOI') if self.sale_order_id.nil?
self.sale_order_id = saleOrderId self.sale_order_id = SeedGenerator.generate_id(self.class.name, 'SOI')
end
end end
end end

View File

@@ -82,7 +82,6 @@ class SalePayment < ApplicationRecord
amount_due = amount_due - payment.payment_amount amount_due = amount_due - payment.payment_amount
end end
end end
if (amount_due >= 0) if (amount_due >= 0)
payment_status = false payment_status = false
membership_data = nil membership_data = nil
@@ -395,7 +394,6 @@ class SalePayment < ApplicationRecord
self.payment_status = "paid" self.payment_status = "paid"
payment_status = self.save! payment_status = self.save!
if !payment_for if !payment_for
sale_update_payment_status(self.received_amount,status) sale_update_payment_status(self.received_amount,status)
end end
@@ -420,6 +418,8 @@ class SalePayment < ApplicationRecord
sale_items.each do|item| sale_items.each do|item|
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "foc", item.unit_price, item.price) SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "foc", item.unit_price, item.price)
end end
sale = Sale.find(self.sale.sale_id)
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount,'','','',"foc")
self.payment_method = "foc" self.payment_method = "foc"
self.payment_amount = self.received_amount self.payment_amount = self.received_amount
@@ -661,7 +661,6 @@ class SalePayment < ApplicationRecord
method_status = true method_status = true
end end
end end
if (self.sale.grand_total <= all_received_amount) && method_status if (self.sale.grand_total <= all_received_amount) && method_status
if is_credit == 0 if is_credit == 0
self.sale.payment_status = "paid" self.sale.payment_status = "paid"
@@ -1065,6 +1064,8 @@ class SalePayment < ApplicationRecord
private private
def generate_custom_id def generate_custom_id
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI") if self.sale_payment_id.nil?
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
end
end end
end end

View File

@@ -34,6 +34,8 @@ class SaleTax < ApplicationRecord
private private
def generate_custom_id def generate_custom_id
self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI") if self.sale_tax_id.nil?
self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI")
end
end end
end end

View File

@@ -29,7 +29,9 @@
</div> </div>
</div> </div>
<div class="row p-l-20 p-t-20"> <div class="row p-l-20 p-t-20">
<div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div>
</div>
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8"> <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
<%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %> <%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
<div class="row clearfix"> <div class="row clearfix">
@@ -124,7 +126,7 @@
<td><%= crm_customer.card_no rescue '-' %></td> <td><%= crm_customer.card_no rescue '-' %></td>
<td><%= crm_customer.paypar_account_no rescue '-' %></td> <td><%= crm_customer.paypar_account_no rescue '-' %></td>
<td> <td>
<% if crm_customer.membership_id.nil? && !crm_customer.membership_type.nil? && !crm_customer.membership_type.blank? && !crm_customer.paypar_account_no.blank? && !crm_customer.paypar_account_no.nil? %> <% if crm_customer.membership_id.nil? && !crm_customer.membership_type.nil? && !crm_customer.membership_type.blank? && !crm_customer.paypar_account_no.blank? && !crm_customer.paypar_account_no.nil? %>
<%= link_to t("views.btn.sync"), crm_customer_sync_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %> <%= link_to t("views.btn.sync"), crm_customer_sync_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %>
<% end %> <% end %>
<% if @customer_update_phone_email_membertype %> <% if @customer_update_phone_email_membertype %>
@@ -157,6 +159,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$("#oqs_loading_wrapper").show();
localStorage.setItem("member_card",false); localStorage.setItem("member_card",false);
/*$('.datepicker').datepicker({ /*$('.datepicker').datepicker({
format : 'dd-mm-yyyy', format : 'dd-mm-yyyy',
@@ -177,6 +180,7 @@
},100); },100);
}); });
// QR Code Reader // QR Code Reader
$("#qr_code").on('click', function(e){ $("#qr_code").on('click', function(e){
var code = ""; var code = "";
@@ -359,4 +363,8 @@
$("#sxModal .btn_cancel").on('click',function(){ $("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide(); $("#sxModal").hide();
}); });
$('#filter_form').submit(function() {
$("#oqs_loading_wrapper").show();
return true
});
</script> </script>

View File

@@ -103,9 +103,9 @@
<li> <li>
<a href="<%= reports_saleitem_index_path %>">Sale Items</a> <a href="<%= reports_saleitem_index_path %>">Sale Items</a>
</li> </li>
<li> <!-- <li>
<a href="<%= reports_product_sale_index_path %>">Product Sale</a> <a href="<%= reports_product_sale_index_path %>">Product Sale</a>
</li> </li> -->
<% if order_reservation %> <% if order_reservation %>
<li> <li>
<a href="<%= reports_order_reservation_index_path %>"><%= t("views.right_panel.detail.order_reservation") %></a> <a href="<%= reports_order_reservation_index_path %>"><%= t("views.right_panel.detail.order_reservation") %></a>
@@ -289,9 +289,9 @@
<li> <li>
<a href="<%= reports_hourly_saleitem_index_path %>">Hourly Sale Items</a> <a href="<%= reports_hourly_saleitem_index_path %>">Hourly Sale Items</a>
</li> </li>
<li> <!-- <li>
<a href="<%= reports_product_sale_index_path %>">Product Sale</a> <a href="<%= reports_product_sale_index_path %>">Product Sale</a>
</li> </li> -->
<% if order_reservation %> <% if order_reservation %>
<li> <li>
<a href="<%= reports_order_reservation_index_path %>"><%= t("views.right_panel.detail.order_reservation") %></a> <a href="<%= reports_order_reservation_index_path %>"><%= t("views.right_panel.detail.order_reservation") %></a>

View File

@@ -2,6 +2,20 @@
<div id="loading_wrapper" style="display:none;"> <div id="loading_wrapper" style="display:none;">
<div id="loading"></div> <div id="loading"></div>
</div> </div>
<% if !@print_settings.nil? %>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<% end %>
<div class="row"> <div class="row">
<!-- Column One --> <!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
@@ -50,6 +64,7 @@
<tr class="item-row" id=<%= sale_item.sale_item_id %> > <tr class="item-row" id=<%= sale_item.sale_item_id %> >
<td style="width:60%; text-align:left"> <td style="width:60%; text-align:left">
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span> <span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
<span id="item-account-qty" class="hidden"><%=sale_item.qty%></span>
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span> <span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
</td> </td>
<td style="width:20%; text-align:right"> <td style="width:20%; text-align:right">
@@ -71,7 +86,7 @@
<table class="table" id="order-charges-table" border="0"> <table class="table" id="order-charges-table" border="0">
<tr> <tr>
<td class="charges-name"><strong>Sub Total:</strong></td> <td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%=sub_total%></strong></td> <td class="item-attr"><strong id="order-sub-total"><%= number_with_precision(sub_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
</tr> </tr>
<!-- <tr> <!-- <tr>
<td class="charges-name"><strong>Food:</strong></td> <td class="charges-name"><strong>Food:</strong></td>
@@ -88,15 +103,15 @@
<td class="charges-name"><strong>Discount:</strong></td> <td class="charges-name"><strong>Discount:</strong></td>
<%end%> <%end%>
<td class="item-attr">(<strong id="order-discount"><%=@sale_data.total_discount rescue 0%></strong>)</td> <td class="item-attr">(<strong id="order-discount"><%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong>)</td>
</tr> </tr>
<tr class="hidden"> <tr class="hidden">
<td class="charges-name"><strong>Tax:</strong></td> <td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%=@sale_data.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
</tr> </tr>
<tr class="hidden"> <tr class="hidden">
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%=@sale_data.grand_total rescue 0%></strong></td> <td class="item-attr"><strong id="order-grand-total"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
</tr> </tr>
</table> </table>
</div> </div>
@@ -313,10 +328,13 @@ var cashier_type = "<%= @cashier_type %>";
// Select Sale Item // Select Sale Item
$('.item-row').on('click',function(){ $('.item-row').on('click',function(){
if($(this).hasClass('selected-item') == true){ if($(this).hasClass('selected-item') == true){
$(this).removeClass('selected-item'); $(this).removeClass('selected-item');
} }
else { else {
$(this).addClass('selected-item'); if(parseInt($(this).children().find("#item-account-qty").text()) >0 && parseInt($(this).children().find("#item-total-price").text()) >0){
$(this).addClass('selected-item');
}
} }
}); });
@@ -326,14 +344,16 @@ var cashier_type = "<%= @cashier_type %>";
$(this).removeClass('selected-item'); $(this).removeClass('selected-item');
} }
else { else {
$(this).addClass('selected-item'); if(parseInt($(this).children().find("#item-account-qty").text()) >0 && parseInt($(this).children().find("#item-total-price").text()) >0){
$(this).addClass('selected-item');
}
} }
}); });
// Select for account types // Select for account types
$(".accounts-type").on('click', function(e){ $(".accounts-type").on('click', function(e){
var account_id = $(this).attr('id').substr(8); var account_id = $(this).attr('id').substr(8);
if($(this).hasClass('selected-account') == true){ if($(this).hasClass('selected-account') == true){
$(this).removeClass('selected-account'); $(this).removeClass('selected-account');
$(".item-row").each(function(i){ $(".item-row").each(function(i){
@@ -346,7 +366,12 @@ var cashier_type = "<%= @cashier_type %>";
$(this).addClass('selected-account'); $(this).addClass('selected-account');
$(".item-row").each(function(i){ $(".item-row").each(function(i){
if($(this).children().find("#item-account-type").text() == account_id){ if($(this).children().find("#item-account-type").text() == account_id){
$(this).addClass("selected-item"); if(parseInt($(this).children().find("#item-account-qty").text()) >0 && parseInt($(this).children().find("#item-total-price").text()) >0){
$(this).addClass("selected-item");
}
else{
console.log("discount item");
}
} }
}); });
} }
@@ -701,7 +726,7 @@ function calculate_overall_discount(type, amount){
} }
} }
$("#order-discount").text(total_discount); $("#order-discount").text(total_discount.toFixed(<%= precision.to_i %>));
} }
/* Calculate Items Discount*/ /* Calculate Items Discount*/
@@ -849,7 +874,7 @@ function calculate_item_discount(type, amount, sale_items, account_types){
// } // }
} }
$("#order-sub-total").text(parseFloat(sub_total).toFixed(2)); $("#order-sub-total").text(parseFloat(sub_total).toFixed(<%= precision.to_i %>));
}else{ }else{
$("#discount-amountErr").html("Discount is greater than sub total!"); $("#discount-amountErr").html("Discount is greater than sub total!");
} }

View File

@@ -2,6 +2,20 @@
<div id="loading_wrapper" style="display:none;"> <div id="loading_wrapper" style="display:none;">
<div id="loading"></div> <div id="loading"></div>
</div> </div>
<% if !@print_settings.nil? %>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<% end %>
<div class="row clearfix"> <div class="row clearfix">
<!-- Column One --> <!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
@@ -350,7 +364,7 @@
<table class="table" id="order-charges-table" border="0"> <table class="table" id="order-charges-table" border="0">
<tr> <tr>
<td class="charges-name"><strong>Sub Total:</strong></td> <td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td> <td class="item-attr"><strong id="sub-total"><%= number_with_precision(sub_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
</tr> </tr>
<tr> <tr>
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%> <%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
@@ -359,7 +373,7 @@
<td class="charges-name"><strong>Discount:</strong></td> <td class="charges-name"><strong>Discount:</strong></td>
<%end%> <%end%>
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td> <td class="item-attr"><strong id="order-discount">(<%= number_with_precision(@obj_sale.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</strong></td>
</tr> </tr>
<% if @status_sale == "sale" %> <% if @status_sale == "sale" %>
<tr> <tr>
@@ -382,15 +396,15 @@
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button> <button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
<% end %> <% end %>
</td> </td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@obj_sale.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
</tr> </tr>
<tr> <tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td> <td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td> <td class="item-attr"><strong id="order-round-adj"><%= number_with_precision(@obj_sale.rounding_adjustment, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
</tr> </tr>
<tr> <tr>
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td> <td class="item-attr"><strong id="order-grand-total"><%= number_with_precision(@obj_sale.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
</tr> </tr>
<% end %> <% end %>
<tr class="rebate_amount"></tr> <tr class="rebate_amount"></tr>

View File

@@ -95,7 +95,6 @@
total_qty += sale.total_item*(-1) total_qty += sale.total_item*(-1)
end %> end %>
<!-- end all total qty --> <!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0 <% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1) total_item_foc += sale.grand_total*(-1)
end %> end %>
@@ -249,9 +248,21 @@
<td colspan="3">&nbsp;</td> <td colspan="3">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td> <td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td> <td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td> <td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td> <td><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr> </tr>
<% if @type =="" || @type =="all" || @type.nil? %>
<tr class="foc_payment">
<td colspan="5">&nbsp;</td>
<td>Total FOC Amount</td>
<td><span><%= number_with_precision(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<tr class="foc_payment" style="border-top:2px solid grey;border-bottom:2px solid grey;">
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<% end %> <% end %>
<% if @type == "other"%> <% if @type == "other"%>
@@ -296,6 +307,7 @@
<script> <script>
$(function(){ $(function(){
var check_arr = []; var check_arr = [];
var search = '<%= params[:period_type] %>'; var search = '<%= params[:period_type] %>';

View File

@@ -108,12 +108,7 @@
<% end %> <% end %>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td> <td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td> <td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td> <td><%= sale.product_name rescue '-' %></td>
<% if sale.status_type != "Discount" %> <% if sale.status_type != "Discount" %>
@@ -143,13 +138,6 @@
sub_qty += sale.total_item sub_qty += sale.total_item
end %> end %>
<% if count == value %> <% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total <%= sale.account_name %> Qty </b> </td>
<td><b><%= sub_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
</tr>
<% sub_total = 0.0%> <% sub_total = 0.0%>
<% sub_qty = 0 %> <% sub_qty = 0 %>
<% count = 0%> <% count = 0%>
@@ -238,6 +226,18 @@
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td> <td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td> <td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr> </tr>
<% if @type =="" || @type =="all" %>
<tr>
<td colspan="5">&nbsp;</td>
<td>Total FOC Amount</td>
<td><span><%= number_with_precision(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<tr style="border-top:2px solid grey;border-bottom:2px solid grey;">
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<% end %> <% end %>
<% if @type == "other"%> <% if @type == "other"%>
@@ -280,3 +280,16 @@
</div> </div>
</body> </body>
</html> </html>
<script type="text/javascript">
$(function(){
var type =<%=@type %>;
console.log(type);
$('.foc_payment').hide();
if (type =="" || type =="all" ){
$('.foc_payment').show();
}
else{
$('.foc_payment').hide();
}
});
</script>

View File

@@ -21,11 +21,11 @@ class ActionController::Base
end end
else else
# check for license file # check for license file
# if check_license if check_license
# current_license(ENV["SX_PROVISION_URL"]) current_license(ENV["SX_PROVISION_URL"])
# else else
# redirect_to activate_path redirect_to activate_path
# end end
end end
end end

View File

@@ -1,10 +1,11 @@
# application_path="#{File.expand_path("../..", __FILE__)}" application_path="#{File.expand_path("../..", __FILE__)}"
# directory application_path directory application_path
# #environment ENV.fetch("RAILS_ENV") { "production" } #environment ENV.fetch("RAILS_ENV") { "production" }
# environment "production" environment "production"
# pidfile "#{application_path}/tmp/puma/pid" pidfile "#{application_path}/tmp/puma/pid"
# state_path "#{application_path}/tmp/puma/state" state_path "#{application_path}/tmp/puma/state"
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
# port ENV.fetch("PORT") { 62158 } port ENV.fetch("PORT") { 62158 }
# workers 2 workers 2
# preload_app! preload_app!
threads 1,1