Sale Item Pdf added
This commit is contained in:
@@ -85,5 +85,77 @@ class Reports::SaleitemController < BaseReportController
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
period_name = get_period_name(params[:period])
|
||||
|
||||
shop_details = shop_detail
|
||||
|
||||
# get printer info
|
||||
print_settings = PrintSetting.find_by_unique_code('CloseCashierPdf') # SaleItemsPdf
|
||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||
|
||||
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.'}
|
||||
format
|
||||
end
|
||||
end
|
||||
|
||||
def get_period_name(period)
|
||||
period_name = '-'
|
||||
unless period.nil? or period.blank?
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
period_name = "Today"
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
period_name = "Yesterday"
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user