merge with origin master
This commit is contained in:
@@ -96,14 +96,15 @@ class Api::OrdersController < Api::ApiController
|
||||
end
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
@status, @booking = @order.generate
|
||||
end
|
||||
|
||||
# render json for http status code
|
||||
def return_json_status_with_code(code, msg)
|
||||
render status: code, json: {
|
||||
message: msg
|
||||
}.to_json
|
||||
message: msg,
|
||||
booking_id: booking_id
|
||||
}.to_json
|
||||
end
|
||||
|
||||
def check_order_with_table(table_id)
|
||||
|
||||
@@ -6,12 +6,12 @@ class Crm::CustomersController < BaseCrmController
|
||||
# GET /crm/customers.json
|
||||
def index
|
||||
filter = params[:filter]
|
||||
|
||||
|
||||
if filter.nil?
|
||||
@crm_customers = Customer.all
|
||||
else
|
||||
@crm_customers = Customer.search(filter)
|
||||
|
||||
@crm_customers = Customer.search(filter)
|
||||
|
||||
end
|
||||
#@crm_customers = Customer.all
|
||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||
@@ -32,7 +32,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
def show
|
||||
@orders = Order.where("customer_id=?", params[:id])
|
||||
@sales = Sale.where("customer_id=?", params[:id])
|
||||
|
||||
|
||||
if @orders
|
||||
@order_items = []
|
||||
@orders.each do |order|
|
||||
@@ -70,7 +70,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
def create
|
||||
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customers.save
|
||||
name = customer_params[:name]
|
||||
@@ -81,7 +81,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
|
||||
if !member_group_id.nil?
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||
@@ -90,7 +90,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
member_group_id: member_group_id,
|
||||
@@ -103,18 +103,24 @@ class Crm::CustomersController < BaseCrmController
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
|
||||
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
|
||||
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' }
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
|
||||
end
|
||||
end
|
||||
# format.json { render :index, status: :created, location: @crm_customers }
|
||||
else
|
||||
# @crm_customers.destroy
|
||||
@@ -129,7 +135,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
if params[:sale_id]
|
||||
flash[:errors] = @crm_customers.errors
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
||||
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
||||
else
|
||||
flash[:errors] = @crm_customers.errors
|
||||
@@ -166,7 +172,7 @@ end
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
response = HTTParty.post(url,
|
||||
:body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
card_no:card_no,member_group_id: member_group_id,
|
||||
@@ -176,16 +182,22 @@ end
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
|
||||
|
||||
customer = Customer.find(@crm_customer.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
|
||||
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
@@ -199,7 +211,7 @@ end
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
@@ -211,6 +223,12 @@ end
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
@@ -219,8 +237,8 @@ end
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@@ -251,7 +269,7 @@ end
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def customer_params
|
||||
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,5 +11,8 @@ class Origami::CashInsController < BaseOrigamiController
|
||||
payment_method_reference = params[:payment_method_reference]
|
||||
p_jour = PaymentJournal.new
|
||||
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user.id)
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
shift.cash_in = shift.cash_in + amount.to_i
|
||||
shift.save
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,5 +9,8 @@ class Origami::CashOutsController < BaseOrigamiController
|
||||
amount = params[:amount]
|
||||
p_jour = PaymentJournal.new
|
||||
p_jour.cash_out(reference, remark, amount, current_user.id)
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
shift.cash_out = shift.cash_out + amount.to_i
|
||||
shift.save
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def show
|
||||
puts current_user.id
|
||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||
end
|
||||
|
||||
@@ -18,13 +19,17 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def update_shift
|
||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||
closing_balance = params[:closing_balance]
|
||||
shift_id = params[:shift_id]
|
||||
@shift = ShiftSale.find_by_id(shift_id)
|
||||
if @shift
|
||||
@shift.shift_closed_at = DateTime.now.utc
|
||||
@shift.closing_balance = closing_balance.to_f
|
||||
@shift.save
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,6 +31,12 @@ class Customer < ApplicationRecord
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
|
||||
return response;
|
||||
@@ -55,6 +61,12 @@ class Customer < ApplicationRecord
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
|
||||
return response;
|
||||
|
||||
@@ -38,6 +38,7 @@ class Order < ApplicationRecord
|
||||
booking.save!
|
||||
self.default_values
|
||||
|
||||
# cashier already opened?
|
||||
if self.save!
|
||||
|
||||
self.adding_line_items
|
||||
|
||||
@@ -19,4 +19,25 @@ class PaymentJournal < ApplicationRecord
|
||||
self.created_by = current_user
|
||||
self.save
|
||||
end
|
||||
|
||||
# def self.today_cash_in(current_user)
|
||||
# credit = 0.0
|
||||
# today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||
# pj_credit = PaymentJournal.where("TO_CHAR(created_at, 'YYYY-MM-DD')=? and created_by=?",today_date, current_user)
|
||||
# pj_credit.each do |obj|
|
||||
# credit += obj.credit_amount
|
||||
# end
|
||||
# return credit
|
||||
# end
|
||||
#
|
||||
# def self.today_cash_out(current_user)
|
||||
# debit = 0.0
|
||||
# today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||
# pj_debit = PaymentJournal.where("TO_CHAR(created_at, 'YYYY-MM-DD')=? and created_by=?",today_date, current_user)
|
||||
# pj_debit.each do |obj|
|
||||
# debit += obj.debit_amount
|
||||
# end
|
||||
# return debit
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ class Sale < ApplicationRecord
|
||||
SALE_STATUS_OUTSTANDING = "outstanding"
|
||||
SALE_STATUS_COMPLETED = "completed"
|
||||
|
||||
def generate_invoice_from_booking(booking_id, requested_by, cashier)
|
||||
def generate_invoice_from_booking(booking_id, requested_by, cashier)
|
||||
booking = Booking.find(booking_id)
|
||||
status = false
|
||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||
@@ -66,7 +66,7 @@ class Sale < ApplicationRecord
|
||||
#Default Tax - Values
|
||||
self.tax_type = "exclusive"
|
||||
|
||||
# set cashier
|
||||
# set cashier
|
||||
if cashier != nil
|
||||
self.cashier_id = cashier[0].id
|
||||
self.cashier_name = cashier[0].name
|
||||
@@ -270,8 +270,6 @@ class Sale < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def product_get_unit_price(item_code)
|
||||
menu_item_hash =MenuItem.search_by_item_code(item_code)
|
||||
if (menu_instance_code)
|
||||
@@ -444,10 +442,51 @@ def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||
|
||||
end
|
||||
|
||||
|
||||
def self.get_by_shiftsales(from,to)
|
||||
return ShiftSale.where("(shift_started_at between ? and ? OR shift_closed_at between ? and ? )", from, to, from, to)
|
||||
end
|
||||
|
||||
def get_cash_amount
|
||||
cash = 0.0
|
||||
self.sale_payments.each do |pay|
|
||||
if pay.payment_method == 'cash'
|
||||
cash = pay.payment_amount
|
||||
end
|
||||
end
|
||||
return cash
|
||||
end
|
||||
|
||||
def get_credit_amount
|
||||
credit = 0.0
|
||||
self.sale_payments.each do |pay|
|
||||
if pay.payment_method == 'creditnote'
|
||||
credit = pay.payment_amount
|
||||
end
|
||||
end
|
||||
return credit
|
||||
end
|
||||
|
||||
def get_other_amount
|
||||
other = 0.0
|
||||
self.sale_payments.each do |pay|
|
||||
if pay.payment_method != 'cash' && pay.payment_method != 'creditnote'
|
||||
other += pay.payment_amount
|
||||
end
|
||||
end
|
||||
return other
|
||||
end
|
||||
|
||||
def get_commerical_tax
|
||||
tax = 0.0
|
||||
self.sale_taxes.each do |tax|
|
||||
if tax.tax_name == "Commerical Tax"
|
||||
tax += tax.tax_payable_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
@@ -77,6 +77,12 @@ class SalePayment < ApplicationRecord
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
return response;
|
||||
end
|
||||
@@ -110,6 +116,12 @@ class SalePayment < ApplicationRecord
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = false
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
else
|
||||
response = false;
|
||||
@@ -131,7 +143,6 @@ class SalePayment < ApplicationRecord
|
||||
self.payment_status = "paid"
|
||||
payment_method = self.save!
|
||||
sale_update_payment_status(self.received_amount)
|
||||
|
||||
return payment_status
|
||||
end
|
||||
|
||||
@@ -146,7 +157,6 @@ class SalePayment < ApplicationRecord
|
||||
payment_method = self.save!
|
||||
|
||||
sale_update_payment_status(self.received_amount)
|
||||
|
||||
return payment_status
|
||||
end
|
||||
|
||||
@@ -161,7 +171,6 @@ class SalePayment < ApplicationRecord
|
||||
payment_method = self.save!
|
||||
|
||||
sale_update_payment_status(self.received_amount)
|
||||
|
||||
return payment_status
|
||||
end
|
||||
|
||||
@@ -175,7 +184,6 @@ class SalePayment < ApplicationRecord
|
||||
self.outstanding_amount = self.sale.grand_total- self.received_amount
|
||||
self.payment_status = "paid"
|
||||
payment_method = self.save!
|
||||
|
||||
sale_update_payment_status(self.received_amount)
|
||||
|
||||
return payment_status
|
||||
@@ -192,7 +200,6 @@ class SalePayment < ApplicationRecord
|
||||
self.outstanding_amount = self.sale.grand_total- self.received_amount
|
||||
self.payment_status = "paid"
|
||||
payment_method = self.save!
|
||||
|
||||
sale_update_payment_status(self.received_amount)
|
||||
|
||||
return payment_status
|
||||
@@ -220,7 +227,6 @@ class SalePayment < ApplicationRecord
|
||||
else
|
||||
sale_update_payment_status(0)
|
||||
end
|
||||
|
||||
return payment_status
|
||||
|
||||
end
|
||||
@@ -249,16 +255,20 @@ class SalePayment < ApplicationRecord
|
||||
self.sale.save!
|
||||
table_update_status(sObj)
|
||||
rebat(sObj)
|
||||
shift = ShiftSale.current_open_shift(self.sale.cashier_id)
|
||||
puts shift
|
||||
if !shift.nil?
|
||||
puts ">>>> shift >>>>>>"
|
||||
shift.update(self.sale)
|
||||
if paid_amount != "0.0"
|
||||
update_shift
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def update_shift
|
||||
shift = ShiftSale.current_open_shift(self.sale.cashier_id)
|
||||
if !shift.nil?
|
||||
shift.update(self.sale)
|
||||
end
|
||||
end
|
||||
|
||||
def table_update_status(sale_obj)
|
||||
status = true
|
||||
booking = Booking.find_by_sale_id(sale_obj.id)
|
||||
@@ -314,6 +324,12 @@ class SalePayment < ApplicationRecord
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
return response
|
||||
# puts response.to_json
|
||||
@@ -321,6 +337,8 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
||||
|
||||
@@ -21,7 +21,7 @@ class ShiftSale < ApplicationRecord
|
||||
#find open shift where is open today and is not closed and login by current cashier
|
||||
today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||
puts today_date
|
||||
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
|
||||
shift = ShiftSale.where("TO_CHAR(shift_started_at, 'YYYY-MM-DD')=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}", today_date).take
|
||||
|
||||
return shift
|
||||
#end
|
||||
@@ -37,16 +37,26 @@ class ShiftSale < ApplicationRecord
|
||||
|
||||
def update(sale)
|
||||
saleobj = Sale.find_by_sale_id(sale)
|
||||
self.total_revenue = self.total_revenue + saleobj.total_amount
|
||||
cash = saleobj.get_cash_amount
|
||||
credit = saleobj.get_credit_amount
|
||||
other_sales = saleobj.get_other_amount
|
||||
tax = saleobj.get_commerical_tax
|
||||
self.total_revenue = self.total_revenue.to_f + saleobj.total_amount.to_f
|
||||
self.total_discounts = self.total_discounts + saleobj.total_discount
|
||||
self.total_taxes = self.total_taxes + saleobj.total_tax
|
||||
self.grand_total = self.grand_total + saleobj.grand_total
|
||||
# self.nett_sales =
|
||||
# self.cash_sales =
|
||||
# self.credit_sales =
|
||||
# self.other_sales =
|
||||
# self.commercial_taxes =
|
||||
self.cash_sales = self.cash_sales.to_f + cash.to_f
|
||||
self.credit_sales = self.credit_sales.to_i + credit.to_f
|
||||
self.other_sales = self.other_sales.to_i + other_sales.to_f
|
||||
self.nett_sales = self.grand_total.to_i - self.commercial_taxes
|
||||
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
|
||||
self.save
|
||||
|
||||
end
|
||||
|
||||
def get_closing_balance(shift)
|
||||
shiftobj = ShiftSale.find(shift)
|
||||
closing_balance = shiftobj.grand_total + shiftobj.cash_in - shiftobj.cash_out + shiftobj.total_cash
|
||||
return closing_balance
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,40 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="1" data-type="num">1</div>
|
||||
<div class=" cashier_number left" data-value="2" data-type="num">2</div>
|
||||
<div class=" cashier_number left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="4" data-type="num">4</div>
|
||||
<div class=" cashier_number left" data-value="5" data-type="num">5</div>
|
||||
<div class=" cashier_number left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="7" data-type="num">7</div>
|
||||
<div class=" cashier_number left" data-value="8" data-type="num">8</div>
|
||||
<div class=" cashier_number left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="0" data-type="num">0</div>
|
||||
<div class=" cashier_number left" data-value="." data-type="num">.</div>
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number red" data-type="del" >Del</div>
|
||||
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||
<div class=" cashier_number purple left" data-type="ent">Ent</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var total = 0
|
||||
$(document).on('focusout', '.float-value', function(event){
|
||||
|
||||
@@ -12,54 +12,7 @@
|
||||
<td>Cashier Name</td>
|
||||
<td><%= @shift.employee.name rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Opening Balance</td>
|
||||
<td><%= @shift.opening_balance rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Total Revenue</td>
|
||||
<td><%= @shift.total_revenue rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Total Discount</td>
|
||||
<td><%= @shift.total_discounts rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Total Tax</td>
|
||||
<td><%= @shift.total_taxes rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Grand Total</td>
|
||||
<td><%= @shift.grand_total rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nett Sale</td>
|
||||
<td><%= @shift.nett_sales rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cash Sale</td>
|
||||
<td><%= @shift.cash_sales rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Credit Sale</td>
|
||||
<td><%= @shift.credit_sales rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Other Sale</td>
|
||||
<td><%= @shift.other_sales rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Commercial Tax</td>
|
||||
<td><%= @shift.commercial_taxes rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cash In</td>
|
||||
<td><%= @shift.cash_in rescue ''%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cash Out</td>
|
||||
<td><%= @shift.cash_out rescue ''%></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<hr>
|
||||
<div class='row'>
|
||||
@@ -67,7 +20,7 @@
|
||||
<span style='font-size:20px;'><b>Closing Balance</b></span>
|
||||
</div>
|
||||
<div class='col-md-6'>
|
||||
<span style='font-size:20px;padding-left:18px;'><b><%= @shift.closing_balance rescue ''%></b></span>
|
||||
<span style='font-size:20px;'><b><input type='text' id='closing_balance_amount' value=''></b></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,8 +31,11 @@
|
||||
</div>
|
||||
<script>
|
||||
$('#close_cashier').on('click',function(){
|
||||
var amount = $('#closing_balance_amount').val();
|
||||
var shift_id = "<%= @shift.id %>"
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_close_shift_path %>",
|
||||
data: "closing_balance="+ amount + "&shift_id="+ shift_id,
|
||||
success:function(result){
|
||||
console.log(result)
|
||||
window.location.href = '/';
|
||||
|
||||
@@ -20,7 +20,7 @@ class CreateSales < ActiveRecord::Migration[5.1]
|
||||
t.decimal :rounding_adjustment, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :amount_received, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :amount_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,7 +18,9 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
|
||||
t.decimal :commercial_taxes, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :cash_in, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :cash_out, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
|
||||
t.integer :dining_count, :default => 0
|
||||
t.integer :takeaway_count, :default => 0
|
||||
t.integer :member_count, :default => 0
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
@@ -181,4 +181,6 @@ payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_u
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
||||
|
||||
cashier_terminal = CashierTerminal.create({name:"Terminal 1"})
|
||||
cashier_terminal2 = CashierTerminal.create({name:"Terminal 2"})
|
||||
cashier_terminal3 = CashierTerminal.create({name:"Terminal 3"})
|
||||
puts " Finished System Default Set Up Data "
|
||||
|
||||
Reference in New Issue
Block a user