remove conflict data

This commit is contained in:
phyusin
2018-05-29 14:32:37 +06:30
16 changed files with 397 additions and 44 deletions

View File

@@ -28,6 +28,7 @@ _ALIPAY_ = "/   Alipay";
_JUNCTIONPAY_ = "/   JunctionPay";
_PAYMAL_ = "/   PAYMAL";
_DINGA_ = "/   DINGA PAYMENT";
_GIFT_VOUCHER_ = "/   GIFT VOUCHER";
_OTHER_CHARGES_ = "/   CHARGES";
_OTHER_PAYMENTS_ = "/   OTHER PAYMENT";
_PAYMENTS_ = "/   PAYMENT";

View File

@@ -0,0 +1,71 @@
class Origami::GiftVoucherController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
@cashier_type = params[:type]
# limit gift_voucher_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = 0
@gift_vouchercount = 0
@shop = Shop.first
@rounding_adj = 0
@can_gift_voucher = 0
@member_discount = 0
@sub_total = 0
@membership_id = nil
@receipt_no = nil
if !sale_data.nil?
total = sale_data.grand_total
others = 0
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "gift_voucher"
@gift_vouchercount = @gift_vouchercount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@can_gift_voucher = total - @gift_vouchercount - others
@member_discount = MembershipSetting.find_by_discount(1)
@sub_total = sale_data.total_amount
@membership_id = sale_data.customer.membership_id
#for bank integration
@receipt_no = sale_data.receipt_no
end
end
def create
cash = params[:amount]
sale_id = params[:sale_id]
ref_no = params[:reference_no]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.first
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
# rounding_adj = new_total-saleObj.grand_total
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
# end
# saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "GiftVoucher",ref_no)
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.first
end
end

View File

@@ -235,6 +235,7 @@ class Origami::PaymentsController < BaseOrigamiController
@credit = 0.0
@paymalcount = 0.0
@dingacount = 0.0
@giftvouchercount = 0.0
@sale_data = Sale.find_by_sale_id(sale_id)
@balance = 0
@accountable_type = ''
@@ -374,6 +375,8 @@ class Origami::PaymentsController < BaseOrigamiController
@alipaycount += spay.payment_amount
elsif spay.payment_method == "dinga"
@dingacount += spay.payment_amount
elsif spay.payment_method == "giftvoucher"
@giftvouchercount += spay.payment_amount
end
end
end

View File

@@ -6,7 +6,7 @@ class Reports::PaymentMethodController < BaseReportController
["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"]]
["JunctionPay","junctionpay"],["Redeem Payment","paypar"],["Gift Voucher","giftvoucher"]]
from, to = get_date_range_from_params

View File

@@ -729,6 +729,7 @@ def self.daily_sales_list(from,to)
SUM(case when (sale_payments.payment_method='JunctionPay') then sale_payments.payment_amount else 0 end) as junctionpay_amount,
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='giftvoucher') then sale_payments.payment_amount else 0 end) as giftvoucher_amount,
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
.joins(" left join sale_payments on sale_payments.sale_id = sales.sale_id")
.where("sale_status = ? AND sales.receipt_date between ? and ? ", 'completed', from, to)
@@ -771,6 +772,7 @@ def self.daily_sales_list(from,to)
:cash_amount => pay.cash_amount,
:credit_amount => pay.credit_amount,
:foc_amount => pay.foc_amount,
:giftvoucher_amount => pay.giftvoucher_amount,
:total_discount => total_discount,
:total_change_amount => total_change_amount,
:grand_total => grand_total,
@@ -928,7 +930,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay' or sale_payments.payment_method = 'giftvoucher') then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
@@ -949,7 +951,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay' or sale_payments.payment_method = 'giftvoucher') then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
@@ -970,7 +972,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
product = product.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay' or sale_payments.payment_method = 'giftvoucher') then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
@@ -1027,11 +1029,7 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
if payment_type.blank?
payment_type = ''
else
# if payment_type == 'card'
# payment_type = " and sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay'"
# else
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
# end
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
end
query = Sale.all
@@ -1144,6 +1142,7 @@ def self.get_payment_method_by_shift(shift_sale_range,shift,from,to,payment_type
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='cash') then sales.amount_changed else 0 end) as total_change_amount,
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='giftvoucher') then sale_payments.payment_amount else 0 end) as giftvoucher_amount,
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
.joins("join sales on sales.sale_id = sale_payments.sale_id")
@@ -1485,7 +1484,7 @@ end
else
query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'")
end
query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay') THEN 'card' ELSE sp.payment_method END)","e.name")
query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
.order("e.name")
else
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
@@ -1496,7 +1495,7 @@ end
else
query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'")
end
query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay') THEN 'card' ELSE sp.payment_method END)","e.name")
query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
.order("e.name")
else
shift = ShiftSale.current_open_shift(current_user.id)
@@ -1508,7 +1507,7 @@ end
else
query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}' and shift_sale_id='#{shift.id}'")
end
query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay') THEN 'card' ELSE sp.payment_method END)","e.name")
query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
.order("e.name")
end
end
@@ -1518,14 +1517,14 @@ end
query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id")
.joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id")
.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}'")
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay') THEN 'card' ELSE sp.payment_method END)","e.name")
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
.order("e.name")
else
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id")
.joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id")
.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}'")
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay') THEN 'card' ELSE sp.payment_method END)","e.name")
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
.order("e.name")
else
shift = ShiftSale.current_open_shift(current_user.id)
@@ -1533,7 +1532,7 @@ end
query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id")
.joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id")
.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}' and shift_sale_id='#{shift.id}'")
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay') THEN 'card' ELSE sp.payment_method END)","e.name")
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
.order("e.name")
end
end
@@ -1632,22 +1631,22 @@ end
if !from.nil? && !to.nil?
if current_user.nil?
if !from_time.nil? && !to_time.nil?
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',from,to,from_time,to_time)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',from,to,from_time,to_time)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
else
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',from,to)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',from,to)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
end
else
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
if !from_time.nil? && !to_time.nil?
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',from,to,from_time,to_time)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',from,to,from_time,to_time)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
else
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',from,to)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',from,to)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
end
@@ -1655,11 +1654,11 @@ end
shift = ShiftSale.current_open_shift(current_user.id)
if !shift.nil?
if !from_time.nil? && !to_time.nil?
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay") and shift_sale_id=?',from,to,from_time,to_time,shift.id)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher") and shift_sale_id=?',from,to,from_time,to_time,shift.id)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
else
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay") and shift_sale_id=?',from,to,shift.id)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher") and shift_sale_id=?',from,to,shift.id)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
end
@@ -1668,18 +1667,18 @@ end
end
else
if current_user.nil?
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',today,today)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',today,today)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
else
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',today,today)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',today,today)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
else
shift = ShiftSale.current_open_shift(current_user.id)
if !shift.nil?
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay") and shift_sale_id=?',today,today,shift.id)
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher") and shift_sale_id=?',today,today,shift.id)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
end
@@ -1878,7 +1877,7 @@ end
if !from_time.nil? && !to_time.nil?
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method="alipay" or sp.payment_method="paymal" or sp.payment_method="dinga" or sp.payment_method="JunctionPay")',from,to,from_time,to_time)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method="alipay" or sp.payment_method="paymal" or sp.payment_method="dinga" or sp.payment_method="JunctionPay" or sp.payment_method = "giftvoucher")',from,to,from_time,to_time)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ? and and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%H:%i') between ? and ?",from,to,from_time,to_time)
end
@@ -1886,7 +1885,7 @@ end
else
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',from,to)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',from,to)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ?",from,to)
end
@@ -1897,7 +1896,7 @@ end
if !from_time.nil? && !to_time.nil?
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',from,to,from_time,to_time)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',from,to,from_time,to_time)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%H:%i') between ? and ?",from,to,from_time,to_time)
end
@@ -1905,7 +1904,7 @@ end
else
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',from,to)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ?",from,to)
end
@@ -1917,7 +1916,7 @@ end
if !from_time.nil? && !to_time.nil?
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay") and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher") and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%H:%i') between ? and ? and sales.shift_sale_id=?",from,to,from_time,to_time,shift.id)
end
@@ -1925,7 +1924,7 @@ end
else
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay") and sales.shift_sale_id=?',from,to,shift.id)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher") and sales.shift_sale_id=?',from,to,shift.id)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ? and sales.shift_sale_id=?",from,to,shift.id)
end
@@ -1938,7 +1937,7 @@ end
if current_user.nil?
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',today)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',today)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
end
@@ -1947,7 +1946,7 @@ end
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',today)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher")',today)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
end
@@ -1957,7 +1956,7 @@ end
if !shift.nil?
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay") and sales.shift_sale_id=?',today,shift.id)
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay" or sp.payment_method = "giftvoucher") and sales.shift_sale_id=?',today,shift.id)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ? and sales.shift_sale_id=?",today,shift.id)
end
@@ -2685,6 +2684,7 @@ end
SUM(case when (sale_payments.payment_method='JunctionPay') then sale_payments.payment_amount else 0 end) as junctionpay_amount,
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount,
SUM(case when (sale_payments.payment_method='giftvoucher') then sale_payments.payment_amount else 0 end) as giftvoucher_amount,
SUM(case when (sale_items.status='foc') then sale_items.price else 0 end) as item_foc,
SUM(case when (sale_items.status='Discount') then sale_items.price else 0 end) as item_discount,
SUM(sale_items.qty) as qty,

View File

@@ -58,6 +58,8 @@ class SalePayment < ApplicationRecord
payment_status = junction_pay_payment
when "dinga"
payment_status,membership_data = dinga_payment
when "GiftVoucher"
payment_status = giftvoucher_payment
else
puts "it was something else"
end
@@ -485,6 +487,18 @@ class SalePayment < ApplicationRecord
end
def giftvoucher_payment
payment_status = false
self.payment_method = "giftvoucher"
self.payment_amount = self.received_amount
self.payment_reference = self.payment_reference
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
self.payment_status = "paid"
payment_method = self.save!
sale_update_payment_status(self.received_amount)
return payment_status
end
def sale_update_payment_status(paid_amount,check_foc = false)
#update amount_outstanding
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f

View File

@@ -0,0 +1,5 @@
if(@status)
json.status @status
else
json.status false
end

View File

@@ -0,0 +1,223 @@
<div class="container-fluid">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
<!-- <div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%=origami_root_path %>"><%= t :home %></a></li>
<li class="breadcrumb-item"><a href="/origami/sale/<%=@sale_id %>/payment"><%= t("views.btn.payment") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.gift_voucher") %></li>
<span class="float-right">
<%= link_to t('.back',:default => t("views.btn.back")),'/origami/sale/'+@sale_id+'/payment/others_payment'%>
</span>
</ol>
</div> -->
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-5">
<span class="hidden" id="membership_id"><%= @membership_id%></span>
<span class="hidden" id="member_discount"><%= @member_discount%></span>
<span class="hidden" id="sub-total"><%= @sub_total%></span>
<div class="card" style="margin-top:10px;padding:20px;">
<div class="card-block">
<div class="rebate-form">
<% if @bank_integration == '1' %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label for="com_port_name">Select Device</label>
<select id="com_port_name" name="com_port_name" class="form-control select col-lg-7 col-md-7 col-sm-7">
</select>
</div>
<hr>
</div>
<% end %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label>You can pay up to </label>
<%@can_gift_voucher = @can_gift_voucher +@rounding_adj%>
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @can_gift_voucher %>" data-member-value="">
</div>
<hr>
</div>
<% if @gift_vouchercount != 0 %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label>Recent GiftVoucher paid amount </label>
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@gift_vouchercount %>" data-member-value="">
</div>
<hr>
</div>
<% end %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label>Reference Number</label>
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
<br><span id="reference_no_Err" style="color:red;"></span>
</div>
<hr>
</div>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label>Amount</label>
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
</div>
<hr>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:;">
<div class=" m-t-10 p-l-20">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="row bottom">
<div class="col-md-4 cashier_number border-left" data-value="1" data-type="num">1</div>
<div class="col-md-4 cashier_number border-left" data-value="2" data-type="num">2</div>
<div class="col-md-4 cashier_number border-left" data-value="3" data-type="num">3</div>
</div>
<div class="row bottom">
<div class="col-md-4 cashier_number border-left" data-value="4" data-type="num">4</div>
<div class="col-md-4 cashier_number border-left" data-value="5" data-type="num">5</div>
<div class="col-md-4 cashier_number border-left" data-value="6" data-type="num">6</div>
</div>
<div class="row bottom">
<div class="col-md-4 cashier_number border-left" data-value="7" data-type="num">7</div>
<div class="col-md-4 cashier_number border-left" data-value="8" data-type="num">8</div>
<div class="col-md-4 cashier_number border-left" data-value="9" data-type="num">9</div>
</div>
<div class="row bottom">
<div class="col-md-4 cashier_number border-left" data-value="0" data-type="num">0</div>
<div class="col-md-4 cashier_number border-left" data-value="." data-type="num">.</div>
<div class="col-md-4 cashier_number border-left" data-value="00" data-type="num">00</div>
</div>
<div class="row bottom">
<div class="col-md-4 cashier_number border-left green" data-type="nett" >Nett</div>
<div class="col-md-4 cashier_number red border-left" data-type="del">Del</div>
<div class="col-md-4 cashier_number orange border-left" data-type="clr">Clr</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="row bottom m-l-5">
<div class="cashier_number long border-left" data-value="1000" data-type="add">1000</div>
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
</div>
<div class="row bottom m-l-5">
<div class="cashier_number long border-left" data-value="5000" data-type="add">5000</div>
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
</div>
<div class="row bottom m-l-5">
<div class="pay purple left" id="gift_voucher_pay">Pay</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-1 col-lg-1 col-sm-1">
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
</div>
</div>
</div>
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_GIFT_VOUCHER_);
var sale_id = "<%= @sale_id %>";
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#validamount').attr("value",parseFloat("<%= @can_gift_voucher %>") - parseFloat(localStorage.getItem("cash")));
}
});
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
event.preventDefault();
if(event.handled !== true) {
var original_value;
original_value = $('#amount').text();
var input_value = $(this).attr("data-value");
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
if (original_value == "0.0"){
$('#amount').text(input_value);
}else{
$('#amount').append(input_value);
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#amount').html(amount);
break;
case 'clr':
$('#amount').html("0.0");
break;
case 'del' :
var cash=$('#amount').text();
$('#amount').text(cash.substr(0,cash.length-1));
break;
case 'nett':
var remain_amount = $('#validamount').val();
$('#amount').text(remain_amount);
break;
}
event.handled = true;
} else {
return false;
}
});
$('#gift_voucher_pay').on('click',function(){
var amount = $('#amount').text();
var reference_no = $('#reference_no').val();
var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
$("#reference_no_Err").html("");
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
if(reference_no!=""){
$(this).off("click");
$.ajax({type: "POST",
url: "<%= origami_payment_gift_voucher_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id + "&reference_no="+reference_no,
success:function(result){
if(result){
swal({
title: "Information!",
text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment";
});
}
}
});
}
else{
$("#reference_no_Err").html("can't be blank");
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
})
</script>

View File

@@ -174,7 +174,7 @@
<div class="col-md-8">Credit</div>
<div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 %>
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 && @giftvouchercount == 0.0 %>
<div class="row payment other-payment-color" id="card_payment" >
<div class="col-md-8">Other Payments</div>
<div class="col-md-4" id="others"><%= number_with_precision(@other, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %></div>
@@ -298,6 +298,17 @@
<% end %>
</div>
<!-- Gift Voucher -->
<div class="row <%= @giftvouchercount!=0.0 ? 'payment others-color' : 'hidden'%>">
<div class="col-md-5"></div>
<div class="col-md-3">GIFT VOUCHER</div>
<% if @giftvouchercount != 0.0 %>
<div class="col-md-4 master is_card" id="giftvouchercount"><%= number_with_precision(@giftvouchercount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="giftvouchercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<div class="row m-l-5 m-r-5">
<div class="col-md-8"><strong>Balance</strong></div>
<div class="col-md-4"><strong><span id='balance'><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></span></strong></div>
@@ -649,7 +660,8 @@ var customer_name = "<%= @customer.name %>";
parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 ||
parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 ||
parseInt(jQuery.inArray("Alipay", payment_type)) != -1 ||
parseInt(jQuery.inArray("DINGA", payment_type)) != -1){
parseInt(jQuery.inArray("DINGA", payment_type)) != -1 ||
parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1){
$("#card_payment").show();
} else{
$("#card_payment").hide();
@@ -729,6 +741,8 @@ var customer_name = "<%= @customer.name %>";
swal("Oops","Please Pay with Paymal Payment","warning");
}else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Dinga Payment","warning");
}else if(parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1 && $('#giftvouchercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Gift Voucher","warning");
}else{
$( "#loading_wrapper").show();
@@ -978,7 +992,8 @@ var customer_name = "<%= @customer.name %>";
var alipay1 = $('#alipaycount').text();
var junctionpay1 = $('#junctionpaycount').text();
var dingapay1 = $('#dingacount').text();
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(alipay1) + parseFloat(junctionpay1) + parseFloat(paymal1) + parseFloat(dingapay1);
var giftvoucherpay1 = $('#giftvouchercount').text();
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(alipay1) + parseFloat(junctionpay1) + parseFloat(paymal1) + parseFloat(dingapay1) + parseFloat(giftvoucherpay1);
var total = $('#amount_due').text();
var amt = 0;
<% if precision.to_i > 0 %>;
@@ -1010,8 +1025,10 @@ var customer_name = "<%= @customer.name %>";
var alipay = $('#alipaycount').text();
var junctionpay = $('#junctionpaycount').text();
var dinga = $('#dingacount').text();
var giftvoucher = $('#giftvouchercount').text();
var amount_due = $('#amount_due').text();
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(alipay) + parseFloat(junctionpay) + parseFloat(paymal) + parseFloat(dinga);
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(alipay) + parseFloat(junctionpay) + parseFloat(paymal) + parseFloat(dinga) + parseFloat(giftvoucher);
var result = parseFloat(amount_due) - parseFloat(total);
<% if precision.to_i > 0 %>

View File

@@ -43,6 +43,7 @@
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
@@ -75,6 +76,7 @@
<% paymal = 0 %>
<% dinga = 0 %>
<% junctionpay = 0 %>
<% giftvoucher = 0 %>
<% paypar = 0 %>
<% cash = 0 %>
<% credit = 0 %>
@@ -95,6 +97,7 @@
<% paymal += sale[:paymal_amount] %>
<% dinga += sale[:dinga_amount] %>
<% junctionpay += sale[:junctionpay_amount] %>
<% giftvoucher += sale[:giftvoucher_amount] %>
<% paypar += sale[:paypar_amount] %>
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
<% credit += sale[:credit_amount] %>
@@ -121,6 +124,7 @@
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
@@ -129,12 +133,11 @@
</tr>
<% count = count + 1 %>
<% end %>
<tr style="font-weight:600;">
<td colspan="3" style='text-align:center;'>Total</td>
<td style='text-align:right;'><%= number_with_precision(mpu , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(master, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(visa, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(visa, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(jcb, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(unionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
@@ -144,7 +147,8 @@
<td style='text-align:right;'><%= number_with_precision(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
<!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
@@ -157,7 +161,7 @@
<% @tax.each do |tax|
total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td colspan="18" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
@@ -168,7 +172,7 @@
<% net = net - rounding_adj%>
<% net = net - total_tax %>
<tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td colspan="18" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>

View File

@@ -31,6 +31,7 @@
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
@@ -63,6 +64,7 @@
<% paymal = 0 %>
<% dinga = 0 %>
<% junctionpay = 0 %>
<% giftvoucher = 0 %>
<% paypar = 0 %>
<% cash = 0 %>
<% credit = 0 %>
@@ -83,6 +85,7 @@
<% paymal += sale[:paymal_amount] %>
<% dinga += sale[:dinga_amount] %>
<% junctionpay += sale[:junctionpay_amount] %>
<% giftvoucher += sale[:giftvoucher_amount] %>
<% paypar += sale[:paypar_amount] %>
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
<% credit += sale[:credit_amount] %>
@@ -109,6 +112,7 @@
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]),delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]),delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:giftvoucher_amount]),delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), delimiter => ',') rescue '-'%>)</td>
<!-- <td style='text-align:right;'><%= number_with_delimiter(sale[:grand_total].to_f + sale[:rounding_adj].to_f ,delimiter => ',') rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]),delimiter => ',') rescue '-'%></td>
@@ -133,6 +137,7 @@
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash),delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit),delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",giftvoucher), delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_delimiter(discount,delimiter => ',') rescue '-'%>)</td>
<!-- <td style='text-align:right;'><%= number_with_delimiter(total,delimiter => ',') rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total),delimiter => ',') rescue '-'%></td>
@@ -145,7 +150,7 @@
<% @tax.each do |tax|
total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td colspan="18" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount),delimiter => ',') rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
@@ -156,7 +161,7 @@
<% net = net - rounding_adj%>
<% net = net - total_tax %>
<tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td colspan="18" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net),delimiter => ',') rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>

View File

@@ -53,6 +53,7 @@
<th><%= t("views.right_panel.detail.cash_sales") %></th>
<th><%= t("views.right_panel.detail.credit_sales") %></th>
<th><%= t("views.right_panel.detail.foc_sales") %></th>
<th><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
</tr>
</thead>
<% if @print_settings.precision.to_i > 0
@@ -84,6 +85,7 @@
<td><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
</tr>
<% end %>

View File

@@ -40,6 +40,7 @@
<th><%= t("views.right_panel.detail.cash_sales") %></th>
<th><%= t("views.right_panel.detail.credit_sales") %></th>
<th><%= t("views.right_panel.detail.foc_sales") %></th>
<th><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
</tr>
</thead>
<% unless @sale_data.empty? %>
@@ -59,6 +60,7 @@
<td><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
<td><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
<td><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
<td><%= number_with_delimiter(sprintf("%.2f",sale[:giftvoucher_amount]), :delimiter => ',') rescue '-'%></td>
</tr>
<% end %>

View File

@@ -144,6 +144,7 @@ en:
check_in: "Check In"
card_settle: "CB CARD SETTLEMENT"
gift_voucher: "GiftVoucher"
pagination:
first: "&laquo; First"
@@ -423,6 +424,7 @@ en:
paymal_sales: "Paymal Sales"
dinga_sales: "Dinga Sales"
junctionpay_sales: "JunctionPay Sales"
gift_voucher_sales: "GiftVoucher Sales"
redeem_sales: "Redeem Sales"
cash_sales: "Cash Sales"
credit_sales: "Credit Sales"

View File

@@ -138,6 +138,7 @@ mm:
exp_to_excel: "Excel သို့ ပို့ပြီးဆက်လက်လုပ်ဆောင်ရန်"
card_settle: "CB ကဒ် စာရင်းရှင်းတမ်း"
gift_voucher: "GiftVoucher"
pagination:
first: "&laquo; ပထမ"
last: "အဆံုး &raquo;"
@@ -418,6 +419,7 @@ mm:
paymal_sales: "Paymal ရောင်းရငွေ"
dinga_sales: "Dinga ရောင်းရငွေ"
junctionpay_sales: "JunctionPay ရောင်းရငွေ"
gift_voucher_sales: "GiftVoucher ရောင်းရငွေ"
redeem_sales: "ဆုကြေးပြန်သုံးငွေနှင့် ရောင်းရငွေ"
cash_sales: "ငွေသား ရောင်းရငွေ"
credit_sales: "အကြွေး ရောင်းရငွေ"

View File

@@ -199,6 +199,7 @@ scope "(:locale)", locale: /en|mm/ do
post 'payment/alipay' => 'alipay#create'
post 'payment/junctionpay' => 'junctionpay#create'
post 'payment/dinga' => 'dinga#create'
post 'payment/gift_voucher' => 'gift_voucher#create'
post 'payment/:type/change_tax' => 'payments#change_tax', :defaults => {:format => 'json'}
@@ -215,6 +216,7 @@ scope "(:locale)", locale: /en|mm/ do
get 'sale/:sale_id/:type/payment/others_payment/JunctionPay' => "junction_pay#index"
get 'sale/:sale_id/:type/payment/others_payment/Alipay' => "alipay#index"
get 'sale/:sale_id/:type/payment/others_payment/DINGA' => "dinga#index"
get 'sale/:sale_id/:type/payment/others_payment/GiftVoucher' => "gift_voucher#index"
#---------Void --------------#
post 'sale/:sale_id/:type/void' => 'void#overall_void'