shop_setup branch
This commit is contained in:
7
app/forms/shop_form.rb
Normal file
7
app/forms/shop_form.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
#Form object to use during the installation process - will handle creation of shop model into db after verification from the cloud
|
||||
#provising service through license verification
|
||||
|
||||
class ShopForm < ActiveModel
|
||||
:attr_accessor :logo, :name, :address, :township, :city, :state, :country, :license, :base_currency, :password, :password_confirmation
|
||||
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
class Booking < ApplicationRecord
|
||||
|
||||
#primary key - need to be unique
|
||||
|
||||
belongs_to :dining_facility, :optional => true
|
||||
belongs_to :sale, :optional => true
|
||||
has_many :booking_orders
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class BookingOrder < ApplicationRecord
|
||||
#primary key - need to be unique
|
||||
|
||||
belongs_to :booking
|
||||
belongs_to :order
|
||||
end
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Order < ApplicationRecord
|
||||
#primary key - need to be unique
|
||||
|
||||
before_create :set_order_date
|
||||
|
||||
belongs_to :customer
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class OrderItem < ApplicationRecord
|
||||
#primary key - need to be unique
|
||||
|
||||
#Associations
|
||||
belongs_to :order, autosave: true
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
|
||||
class Sale < ApplicationRecord
|
||||
#before_create :generate_receipt_no
|
||||
belongs_to :cashier, :optional => true
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class SaleAudit < ApplicationRecord
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
|
||||
belongs_to :sale
|
||||
|
||||
def record_audit_void(sale_id, void_by, approved_by, reason)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class SaleItem < ApplicationRecord
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
|
||||
belongs_to :sale
|
||||
|
||||
#compute items - discount, tax, price_change
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class SaleOrder < ApplicationRecord
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
|
||||
belongs_to :sale
|
||||
belongs_to :order
|
||||
end
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class SalePayment < ApplicationRecord
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
|
||||
belongs_to :sale
|
||||
|
||||
:attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
class SaleTax < ApplicationRecord
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
|
||||
belongs_to :sale
|
||||
end
|
||||
|
||||
@@ -1,4 +1,23 @@
|
||||
class SeedGenerator < ApplicationRecord
|
||||
def self.generate_id(model, prefix)
|
||||
seed = SeedGenerator.find_by_model(model)
|
||||
new_receipt_no = 0
|
||||
if (seed.nil?)
|
||||
seed = SeedGenerator.new()
|
||||
seed.model = model
|
||||
new_receipt_no = seed.next
|
||||
seed.save
|
||||
|
||||
else
|
||||
current_no = seed.next
|
||||
seed.next = seed.next + seed.increase_by
|
||||
seed.current = current_no
|
||||
seed.save
|
||||
end
|
||||
|
||||
return prefix + "-" + seed.current.to_s
|
||||
end
|
||||
|
||||
def self.new_receipt_no
|
||||
seed = SeedGenerator.find_by_model("sale")
|
||||
new_receipt_no = 0
|
||||
|
||||
2
app/models/shop.rb
Normal file
2
app/models/shop.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class Shop < ApplicationRecord
|
||||
end
|
||||
Reference in New Issue
Block a user