fix timezone
This commit is contained in:
@@ -29,8 +29,8 @@ class Sale < ApplicationRecord
|
||||
before_save :round_to_precision
|
||||
after_update :update_stock_journal
|
||||
|
||||
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||
scope :complete_sale, -> { where("sale_status = 'completed' and receipt_date BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") }
|
||||
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{Time.current.utc.end_of_day}' AND '#{Time.current.utc.beginning_of_day}'") }
|
||||
scope :complete_sale, -> { where("sale_status = 'completed' and receipt_date BETWEEN '#{Time.current.utc.beginning_of_day}' AND '#{Time.current.utc.end_of_day}'") }
|
||||
scope :paid, -> { where(payment_status: 'paid')}
|
||||
scope :completed, -> { where(sale_status: 'completed') }
|
||||
|
||||
@@ -202,7 +202,7 @@ class Sale < ApplicationRecord
|
||||
def generate_invoice_by_items (items, requested_by)
|
||||
taxable = true
|
||||
self.requested_by = requested_by
|
||||
self.requested_at = DateTime.now
|
||||
self.requested_at = Time.current
|
||||
|
||||
items.each do |item|
|
||||
add_item(item)
|
||||
@@ -658,7 +658,7 @@ class Sale < ApplicationRecord
|
||||
# SaleOrder.create(:sale_id => self.id, :order_id => order_id)
|
||||
# end
|
||||
#dosomrting here
|
||||
#puts Time.now.format(":short")
|
||||
#puts Time.current.format(":short")
|
||||
end
|
||||
|
||||
def adjust_rounding
|
||||
@@ -707,7 +707,7 @@ class Sale < ApplicationRecord
|
||||
shop_details = Shop.current_shop
|
||||
#Date-Shift-
|
||||
if self.receipt_no.nil?
|
||||
prefix = DateTime.now().utc
|
||||
prefix = Time.current().utc
|
||||
#self.receipt_no = prefix.to_s + "/" + self.shit_id.to_s + "/" + SeedGenerator.new_receipt_no().to_s
|
||||
new_receipt_no = SeedGenerator.new_receipt_no().to_s
|
||||
|
||||
@@ -897,8 +897,8 @@ def self.get_by_shiftsales(from,to,shift)
|
||||
end
|
||||
|
||||
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," +
|
||||
query = ShiftSale.select("shift_sales.id ,shift_started_at,
|
||||
shift_closed_at," +
|
||||
" grand_total AS grand_total, cash_sales AS cash," +
|
||||
"total_taxes AS total_tax,total_discounts As total_discount")
|
||||
.order("shift_sales.id DESC")
|
||||
@@ -906,8 +906,8 @@ def self.get_by_shift_sale(from,to,status)
|
||||
end
|
||||
|
||||
def self.get_by_shift_sale_by_item(from,to,status)
|
||||
query = ShiftSale.select("shift_sales.id ,shift_started_at AS opening_date,
|
||||
shift_closed_at As closing_date," +
|
||||
query = ShiftSale.select("shift_sales.id ,shift_started_at,
|
||||
shift_closed_at," +
|
||||
" grand_total AS grand_total, cash_sales AS cash," +
|
||||
"total_taxes AS total_tax,total_discounts As total_discount")
|
||||
.order("shift_sales.id DESC")
|
||||
|
||||
Reference in New Issue
Block a user