diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb new file mode 100644 index 00000000..a9bdcc2b --- /dev/null +++ b/app/controllers/origami/voucher_controller.rb @@ -0,0 +1,32 @@ +class Origami::VoucherController < BaseOrigamiController + + def index + @sale_id = params[:sale_id] + + # limit voucher_amount + sale_data = Sale.find_by_sale_id(@sale_id) + total = sale_data.grand_total + @vouchercount = 0 + others = 0 + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "voucher" + @vouchercount = @vouchercount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_voucher = total - @vouchercount - others + + end + + def create + cash = params[:amount] + sale_id = params[:sale_id] + if(Sale.exists?(sale_id)) + saleObj = Sale.find(sale_id) + sale_payment = SalePayment.new + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "voucher") + end + end + +end diff --git a/app/views/origami/voucher/create.json.jbuilder b/app/views/origami/voucher/create.json.jbuilder new file mode 100644 index 00000000..9767a7d8 --- /dev/null +++ b/app/views/origami/voucher/create.json.jbuilder @@ -0,0 +1,5 @@ +if(@status) + json.status @status +else + json.status false +end diff --git a/app/views/origami/voucher/index.html.erb b/app/views/origami/voucher/index.html.erb new file mode 100644 index 00000000..809793ce --- /dev/null +++ b/app/views/origami/voucher/index.html.erb @@ -0,0 +1,169 @@ + +
+ +
+
+
+

Voucher / Coupon

+
+
+
+
+
+
+ + +
+
+
+ <% if @vouchercount != 0 %> +
+
+ + +
+
+
+ <% end %> +
+
+ + +
+
+
+
+
+ +
0.0
+
+
+
+
+
+
+ +
+ +
+
+
+
1
+
2
+
3
+
+
+
4
+
5
+
6
+
+
+
7
+
8
+
9
+
+
+
0
+
.
+
00
+
+
+
Nett
+
Del
+
Clr
+
+
+
+
+
1000
+
3000
+
+
+
5000
+
10000
+
+
+
Pay
+
+
+
+ +
+ +
+ +
+
+ + diff --git a/lib/tasks/menu_osaka.rake b/lib/tasks/menu_osaka.rake index 0acc4a1e..117fdb5c 100644 --- a/lib/tasks/menu_osaka.rake +++ b/lib/tasks/menu_osaka.rake @@ -1224,6 +1224,7 @@ payment_methods = PaymentMethodSetting.create({payment_method:"VISA",gateway_url payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http://staging.membership.paypar.ws"}) payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://staging.membership.paypar.ws"}) payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv"}) +payment_methods = PaymentMethodSetting.create({payment_method:"Voucher",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv"}) #Default Order Queue stations order_queue_station1 = OrderQueueStation.create({station_name: "K1", is_active: true,printer_name: "Cashier", processing_items: JSON.generate(['I0001','I0002','I0003','I0004']), print_copy:false, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})