Merge branch 'r-1902001-01' into r-1902001-01-dev

This commit is contained in:
NyanLinHtut
2019-06-03 11:16:16 +06:30
69 changed files with 2292 additions and 1409 deletions

View File

@@ -47,8 +47,12 @@ class Api::OrdersController < Api::ApiController
# end
@shop = Shop.first
puts "Hello world"
puts @shop.to_json
return @shop.to_json
end
# Description
# This API allow new order creation
# Input Params

View File

@@ -5,12 +5,14 @@ class Oqs::PrintController < ApplicationController
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
printer = PrintSetting.all
unique_code="OrderItemPdf"
unique_code="OrderItemStarPdf"
if !order_slim_pdf.empty?
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'OrderItemPdf'
if printer_setting.unique_code == 'OrderItemPdf'
unique_code="OrderItemPdf"
elsif printer_setting.unique_code == 'OrderItemStarPdf'
unique_code="OrderItemStarPdf"
elsif printer_setting.unique_code == 'OrderItemSlimPdf'
unique_code="OrderItemSlimPdf"
elsif printer_setting.unique_code == 'OrderSetItemPdf'
@@ -18,17 +20,17 @@ class Oqs::PrintController < ApplicationController
elsif printer_setting.unique_code == 'OrderItemCustomisePdf'
unique_code="OrderItemCustomisePdf"
elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf'
unique_code="OrderSetItemCustomisePdf"
unique_code="OrderSetItemCustomisePdf"
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
unique_code="OrderItemSlimCustomisePdf"
end
end
end
end
end
assigned_item_id = params[:id]
options = params[:options]
assigned_item = AssignedOrderItem.find(assigned_item_id)
assigned_item = AssignedOrderItem.find(assigned_item_id)
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
# order queue stations
@@ -38,28 +40,28 @@ class Oqs::PrintController < ApplicationController
# Check Printed
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
# print when complete click
# print when complete click
print_settings = PrintSetting.find_by_unique_code(unique_code)
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
filename, receipt_no, cashier_printer = order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, "", options )
# update print status for completed same order items
assigned_items.each do |ai|
ai.print_status=true
ai.save
ai.save
end
# filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount)
# filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount)
if ENV["SERVER_MODE"] == "cloud"
result = {
:filepath => filename,
:printer_model => print_settings.brand_name,
:printer_url => print_settings.api_settings
result = {
:filepath => filename,
:printer_model => print_settings.brand_name,
:printer_url => print_settings.api_settings
}
# Mobile Print
render :json => result.to_json
render :json => result.to_json
end
# end
# end
end
# Print Order Details with booking id
@@ -71,7 +73,7 @@ class Oqs::PrintController < ApplicationController
if !order_slim_pdf.empty?
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'OrderSummaryPdf'
if printer_setting.unique_code == 'OrderSummaryPdf'
unique_code="OrderSummaryPdf"
elsif printer_setting.unique_code == 'OrderSummarySlimPdf'
unique_code="OrderSummarySlimPdf"
@@ -80,17 +82,17 @@ class Oqs::PrintController < ApplicationController
elsif printer_setting.unique_code == 'OrderSummaryCustomisePdf'
unique_code="OrderSummaryCustomisePdf"
elsif printer_setting.unique_code == 'OrderSummarySetCustomisePdf'
unique_code="OrderSummarySetCustomisePdf"
unique_code="OrderSummarySetCustomisePdf"
elsif printer_setting.unique_code == 'OrderSummarySlimCustomisePdf'
unique_code="OrderSummarySlimCustomisePdf"
end
end
end
end
end
assigned_item_id = params[:id]
table_name = params[:table_name]
assigned_item = AssignedOrderItem.find(assigned_item_id)
assigned_item = AssignedOrderItem.find(assigned_item_id)
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
# order queue stations
@@ -105,8 +107,8 @@ class Oqs::PrintController < ApplicationController
# Get Booking ID
booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0]
# print when complete click
# print when complete click
print_settings = PrintSetting.find_by_unique_code(unique_code)
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
filename, receipt_no, cashier_printer = order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
@@ -114,20 +116,20 @@ class Oqs::PrintController < ApplicationController
# update print status for completed same order items
assigned_items.each do |ai|
ai.print_status = true
ai.save
ai.save
end
# filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount)
# filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount)
if ENV["SERVER_MODE"] == "cloud"
result = {
:filepath => filename,
:printer_model => print_settings.brand_name,
:printer_url => print_settings.api_settings
result = {
:filepath => filename,
:printer_model => print_settings.brand_name,
:printer_url => print_settings.api_settings
}
# Mobile Print
render :json => result.to_json
render :json => result.to_json
end
# end
# end
end
end
end

View File

@@ -1,6 +1,6 @@
class Reports::DailysaleController < BaseReportController
authorize_resource :class => false
def index
from, to = get_date_range_from_params
@sale_data = Sale.daily_sales_list(from,to)
@@ -16,9 +16,9 @@ class Reports::DailysaleController < BaseReportController
format.xls
end
end
def show
end
end

View File

@@ -1,7 +1,7 @@
class Reports::SaleitemController < BaseReportController
authorize_resource :class => false
def index
@account = Account.all
from, to = get_date_range_from_params
@@ -13,7 +13,7 @@ class Reports::SaleitemController < BaseReportController
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
if to.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
@@ -43,7 +43,7 @@ class Reports::SaleitemController < BaseReportController
@from = from
@to = to
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@@ -80,38 +80,61 @@ class Reports::SaleitemController < BaseReportController
# @sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
def print_sale_items
type = params[:type]
account = params[:account]
from_date = to_date = '-'
if !params[:from].nil?
from_date = Date.parse(params[:from])
end
if !params[:to].nil?
to_date = Date.parse(params[:to])
end
from, to = get_date_range_from_params
shift = params[:shift_name]
shift_name = "All Shifts"
if shift.to_i > 0
shift_name = params[:shift_from].to_s+" - ".to_s+params[:shift_to].to_s
end
shift_sale_range = ''
period_name = get_period_name(params[:period])
shift = ''
shift_name = 'All Shift'
if params[:shift_name].to_i != 0
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at)
else
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
sh_name = "#{shift_sale.shift_started_at.utc.getlocal.strftime('%d %B %l:%M%p')} - #{shift_sale.shift_closed_at.utc.getlocal.strftime('%d %B %l:%M%p')}"
employee = Employee.find(shift_sale.employee_id)
shift_name = employee.nil? ? sh_name : "#{sh_name} (#{employee.name})"
end
shop_details = shop_detail
account_type = params[:account_type]
@type = params[:period_type]
period_name = get_period_name(params[:period])
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
# get printer info
print_settings = PrintSetting.find_by_unique_code('CloseCashierPdf') # SaleItemsPdf
printer = Printer::CashierStationPrinter.new(print_settings)
print_settings = PrintSetting.find_by_unique_code('SaleItemsPdf') # SaleItemsPdf
print_settings_star = PrintSetting.find_by_unique_code('SaleItemsStarPdf')
if print_settings.nil?
if !print_settings_star.nil?
printer = Printer::CashierStationPrinter.new(print_settings_star)
printer.print_sale_items_report(print_settings_star, shop_details, period_name, @type, account_type, from, to, shift_name, @sale_data)
end
else
printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_sale_items_report(print_settings, shop_details, period_name, @type, account_type, from, to, shift_name, @sale_data)
end
printer.print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, params[:sale_items], params[:menu_cate_count])
respond_to do |format|
format.html { redirect_to '/en/reports/saleitem/', notice: 'Printing Completed.'}
@@ -131,31 +154,31 @@ class Reports::SaleitemController < BaseReportController
when PERIOD["this_week"]
period_name = "This Week"
when PERIOD["last_week"]
period_name = "Last Week"
when PERIOD["last_7"]
period_name = "Last 7 days"
when PERIOD["this_month"]
period_name = "This Month"
when PERIOD["last_month"]
period_name = "Last Month"
when PERIOD["last_30"]
period_name = "Last 30 Days"
when PERIOD["this_year"]
period_name = "This Year"
when PERIOD["last_year"]
period_name = "Last Year"
end
end
return period_name
end
end

View File

@@ -52,14 +52,11 @@ class Reports::ShiftsaleController < BaseReportController
shift_id = params[:id]
@shift = ShiftSale.find_by_id(shift_id)
shift_obj = ShiftSale.where('id =?',shift_id)
puts "shift obj!!!!!"
puts shift_obj.to_json
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
close_cashier_pdf = Lookup.collection_of("print_settings")
puts "close !!!!"
puts close_cashier_pdf
unique_code = "CloseCashierPdf"