daily & hourly report

This commit is contained in:
NyanLinHtut
2019-12-23 14:51:37 +06:30
parent 450c847da6
commit 358ff50934
7 changed files with 323 additions and 259 deletions

View File

@@ -45,7 +45,7 @@ class Printer::PrinterWorker
if printer_destination.nil?
printer_destination = self.printer_destination
end
copy = self.print_copies
#Print only when printer information is not null
if !self.printer_destination.nil?

View File

@@ -788,7 +788,7 @@ def self.daily_sales_list(from,to)
daily_total = connection.select_all("SELECT
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) - (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as total_sale,
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as total_sale,
IFNULL(SUM(case when (sale_status='completed') then old_grand_total else 0 end),0) as old_grand_total,
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
IFNULL(SUM(case when (sale_status='completed') then amount_changed else 0 end),0) as total_change_amount,
@@ -796,7 +796,7 @@ def self.daily_sales_list(from,to)
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj,
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) / 21 as tax,
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0))-(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) / 21) as net_sale,
SUM(grand_total + total_discount) as gross_sale,
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) + (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as gross_sale,
CAST((CONVERT_TZ(receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
SUM(kbzpay_amount) as kbzpay_amount,
SUM(mpu_amount) as mpu_amount,
@@ -2068,9 +2068,14 @@ def self.get_by_hourly_items(shift_sale_range, shift, from, to, status,type,acco
query = self.get_hourly_item_query(type,filter,false)
end
puts "start time - end time >>>>>>>>>"
puts "#{start_time},#{end_time}"
unless start_time.blank? && end_time.blank?
from_date = from.to_date
to_date = to.to_date
from_date_time = DateTime.new(from_date.year, from_date.month, from_date.day, start_time.hour, start_time.min, start_time.sec, start_time.zone)
to_date_time = DateTime.new(to_date.year, to_date.month, to_date.day, end_time.hour, end_time.min, end_time.sec, end_time.zone)
receipt_date = "sales.receipt_date between '#{from_date_time}' and '#{to_date_time}'"
query = self.get_hourly_item_query(type,filter,false)
end
# query = self.get_hourly_item_query(type,filter)