change hardcoded payment methods

This commit is contained in:
NyanLinHtut
2020-06-08 10:13:55 +06:30
parent 51932b8a86
commit 98ca01533e
16 changed files with 302 additions and 646 deletions

View File

@@ -1,28 +1,30 @@
class Reports::PaymentMethodController < BaseReportController
class Reports::PaymentMethodController < BaseReportController
# authorize_resource :class => false
def index
@payments = [["All Payment",''],["Cash Payment","cash"], ["KBZ Payment", KbzPay::KBZ_PAY], ["Credit Payment","creditnote"],
["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"],
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
["Alipay Payment","alipay"],["Paymal Payment", "paymal"],["Dinga Payment","dinga"],
["JunctionPay","junctionpay"],["Redeem Payment","paypar"],["Gift Voucher","giftvoucher"]]
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
@payments = [["All Payment",''],["Cash Payment","cash"], ["Credit Payment","creditnote"],
["FOC Payment","foc"]]
@payment_methods.each do |m|
@payments.push(["#{m} Payment", m.parameterize])
end
from, to = get_date_range_from_params
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift = ''
if params[:shift_name].to_i != 0
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
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
@payment_type = params[:payment_type]
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type)
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift,from,to,@payment_type)
@from = from
@to = to
# get printer info
@@ -58,10 +60,10 @@ class Reports::PaymentMethodController < BaseReportController
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end
end

View File

@@ -80,6 +80,7 @@ class Reports::ShiftsaleController < BaseReportController
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
# Calculate price_by_accounts
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
@@ -95,8 +96,8 @@ class Reports::ShiftsaleController < BaseReportController
printer = Printer::CashierStationPrinter.new(print_settings)
# printer.print_close_cashier(print_settings,cashier_terminal,@shift, nil, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments,@payment_methods)
respond_to do |format|
format.html { redirect_to '/en/reports/shiftsale/', notice: 'Printing Completed.'}
format