add star printer setting

This commit is contained in:
NyanLinHtut
2019-05-31 15:39:21 +06:30
parent 62d571a6a7
commit bd55069c2d
9 changed files with 346 additions and 72 deletions

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,7 +80,7 @@ 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
@@ -98,7 +98,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?
@@ -122,9 +122,19 @@ class Reports::SaleitemController < BaseReportController
# get printer info
print_settings = PrintSetting.find_by_unique_code('CloseCashierPdf') # SaleItemsPdf
printer = Printer::CashierStationPrinter.new(print_settings)
print_settings_star = PrintSetting.find_by_unique_code('CloseCashierStarPdf')
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_type, from, to, shift_name, @sale_data)
respond_to do |format|
format.html { redirect_to '/en/reports/saleitem/', notice: 'Printing Completed.'}
@@ -144,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