shift sale

This commit is contained in:
Nweni
2017-07-01 09:46:14 +06:30
parent 18094f5a71
commit c589f11758
6 changed files with 29 additions and 17 deletions

View File

@@ -345,8 +345,8 @@ class Sale < ApplicationRecord
else
## up to 100
value = 100 - get_last_no.to_f
num += value
puts 'up to 100'
num += value
puts 'up to 100'
end
end
end
@@ -479,11 +479,12 @@ 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
self.sale_taxes.each do |taxobj|
if taxobj.tax_name == "Commerical Tax"
tax += taxobj.tax_payable_amount
end
end
return tax
end

View File

@@ -266,6 +266,8 @@ class SalePayment < ApplicationRecord
shift = ShiftSale.current_open_shift(self.sale.cashier_id)
if !shift.nil?
shift.update(self.sale)
self.sale.shift_sale_id = shift.id
self.sale.save
end
end
@@ -324,7 +326,7 @@ class SalePayment < ApplicationRecord
}, :timeout => 10)
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}

View File

@@ -27,8 +27,8 @@ class ShiftSale < ApplicationRecord
#end
end
def create(opening_balance,current_user)
self.cashier_terminal_id = CashierTerminal.first.id
def create(opening_balance,cashier_terminal, current_user)
self.cashier_terminal_id = cashier_terminal
self.shift_started_at = DateTime.now
self.employee_id = current_user.id
self.opening_balance = opening_balance