diff --git a/Gemfile b/Gemfile old mode 100755 new mode 100644 index c20dec66..41682d12 --- a/Gemfile +++ b/Gemfile @@ -41,6 +41,7 @@ gem 'rack-cors' # image upload gem 'carrierwave', '~> 1.0' gem 'mini_magick' +gem 'jquery-fileupload-rails' #Report and Printing gems gem 'cups' diff --git a/Gemfile.lock b/Gemfile.lock old mode 100755 new mode 100644 index 254ff760..eee001d1 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -115,6 +115,10 @@ GEM jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) + jquery-fileupload-rails (0.4.7) + actionpack (>= 3.1) + railties (>= 3.1) + sass (>= 3.2) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -319,6 +323,7 @@ DEPENDENCIES font-awesome-rails (~> 4.7, >= 4.7.0.2) httparty (~> 0.15.5) jbuilder (~> 2.5) + jquery-fileupload-rails jquery-rails jquery-ui-rails kaminari (~> 1.0.1) diff --git a/README.md b/README.md index 18eaed7b..e19f7a51 100755 --- a/README.md +++ b/README.md @@ -158,11 +158,25 @@ For CloseCashierCustomisePdf in lookups 1) settings/print_settings 2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 } +<<<<<<< HEAD +<---- Extra Fields Script -----> +For MoveTablePdf in lookups + *** Both Table and Room Moving *** + 1) settings/lookups => { type:print_settings, name: MoveTablePdf, value:1 } + +For MoveTablePdf in print settings + * Backend > Printer > Print Settings > New + i) Name : Move Table + ii) Unique Code: MoveTablePdf + iii)Template: ... + iv) Font: Zawgyi-One v) Printer: #printer name +======= /* Tax Profile Group Types in lookups */ 1) settings/lookups => { type:tax_profiles, name: Cashier, value:cashier } 2) settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service } 3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal } /* Tax Profile Group Types in lookups */ +>>>>>>> 1c13b0469758fb968c0dfcc1f0a876ed2c5e395a * ToDo list diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 47c6cd4f..31209c99 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -381,16 +381,18 @@ $(function() { item = get_set_item(items); customer_display_view(item,"set_add"); - var option = '' + var option = [] attribute_arr = [] var rowCount = $('.summary-items tbody tr').length+1; code = $('.set-item').attr('data-code'); name = $('.set-item').attr('data-name'); price = $('.set-item').attr('data-price'); - option = ($('.set-item').attr('data-options') === 'undefined') ? '' :$('.set-item').attr('data-options'); + option_name = ($('.set-item').attr('data-options') === 'undefined') ? '' :$('.set-item').attr('data-options'); + option = ($('.set-item').attr('data-options') === '') ? '[]' :$('.set-item').attr('data-options'); parent = $('.set-item').attr('data-parent'); total = qty * price ; + row ="" +''+rowCount+'' - +'' + item_name+ ' ' + name +' ' + option +'' + +'' + item_name+ ' ' + name +' ' + option_name +'' +'' + qty + '' +'' + parseFloat(total).toFixed(2) @@ -406,15 +408,16 @@ $(function() { +''; $(".summary-items tbody").append(row); var rowCount = $('.summary-items tbody tr').length+1; - var set_option = '' + var set_option = [] $(items).each(function(i){ code = $(items[i]).attr('data-code'); name = $(items[i]).attr('data-name'); price = $(items[i]).attr('data-price'); - set_option = ($(items[i]).attr('data-options') === 'undefined') ? ' ' :$(items[i]).attr('data-options'); - + set_option_name = ($(items[i]).attr('data-options') === 'undefined') ? ' ' :$(items[i]).attr('data-options'); + set_option= ($(items[i]).attr('data-options') === '') ? '[]' :$(items[i]).attr('data-options'); sub_item = $(items[i]).attr('data-sub-item'); total = qty * price ; + row ="" +''+rowCount+'' - +'' + item_name+ ' ' + name +' ' + set_option +'' + +'' + item_name+ ' ' + name +' ' + set_option_name +'' +'' + qty + '' +'' + parseFloat(total).toFixed(2) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e486c152..d2faf9da 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -28,11 +28,12 @@ //= require raphael/raphael.min //= require Chart.bundle //= require chartkick -//= require fileinput.min +//= require fileinput.min.js //= require settings/processing_items //= require BSBMaterial/admin.js //= require BSBMaterial/demo.js //= require custom.js +//= require jquery-fileupload/basic $(document).ready(function() { $('.count-to').countTo(); diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 778de553..c6e6a47b 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -10,7 +10,7 @@ $(document).ready(function() { alwaysVisible: false, borderRadius: '0', railBorderRadius: '0', - touchScrollStep : 25 + touchScrollStep : 50 }); $('#order-detail-slimscroll').slimScroll({ @@ -20,7 +20,7 @@ $(document).ready(function() { alwaysVisible: false, borderRadius: '0', railBorderRadius: '0', - touchScrollStep : 25 + touchScrollStep : 50 }); $('#menu-slimscroll').slimScroll({ @@ -30,7 +30,7 @@ $(document).ready(function() { alwaysVisible: false, borderRadius: '0', railBorderRadius: '0', - touchScrollStep : 25 + touchScrollStep : 50 }); // $('.delete').click(function(){ diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 7388529b..573f7c9e 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -16,6 +16,30 @@ //= require BSBMaterial/demo.js //= require custom.js +/* Constant Varaibles */ +_CREDIT_PAYMENTS_ = "/   CREDIT PAYMENTS"; +_CUSTOMERS_ = "/   CUSTOMERS"; +_DISCOUNTS_ = "/   DISCOUNTS"; +_IN_DUTIES_ = "/   IN DUTIES"; +_JCB_ = "/   JCB PAYMENT"; +_MASTER_ = "/   MASTER PAYMENT"; +_MPU_ = "/   MPU PAYMENT"; +_ALIPAY_ = "/   Alipay"; +_JUNCTIONPAY_ = "/   JunctionPay"; +_PAYMAL_ = "/   PAYMAL"; +_OTHER_CHARGES_ = "/   CHARGES"; +_OTHER_PAYMENTS_ = "/   OTHER PAYMENT"; +_PAYMENTS_ = "/   PAYMENT"; +_PAYPAR_PAYMENT_ = "/   PAYPAR PAYMENT"; +_COMMISSIONS_ = "/   COMMISSIONS"; +_REDEEM_PAYMENT_ = "/   REDEEM PAYMENT"; +_SALE_EDIT_ = "/   SALE EDIT"; +_SPLIT_BILL_ = "/   SPLIT BILL"; +_UNION_ = "/   UNION PAYMENT"; +_VISA_ = "/   VISA PAYMENT"; +_VOUCHER_ = "/   VOUCHER"; +_SURVEY_ = "/   SURVEY"; +/* Constant Varaibles */ $(document).on('turbolinks:load', function() { @@ -323,7 +347,7 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun if(jobj.STATUS == "Approved"){ $.ajax({type: "POST", url: "/origami/payment/"+payment_type, - data: "amount="+ bnk_bill_amount + "&sale_id="+ sale_id, + data: "amount="+ bnk_bill_amount + "&sale_id="+ sale_id + "&ref_no=" + jobj.REFNUM, success:function(result){ if(result){ swal({ @@ -358,4 +382,8 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun }); } } -//end CB ECR integration \ No newline at end of file +//end CB ECR integration + +function setHeaderBreadCrumb(params){ + $("#others_payment").html(params); +} diff --git a/app/assets/javascripts/origami/paymal.coffee b/app/assets/javascripts/origami/paymal.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/origami/paymal.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/settings/display_images.js.coffee b/app/assets/javascripts/settings/display_images.js.coffee new file mode 100644 index 00000000..e25943a1 --- /dev/null +++ b/app/assets/javascripts/settings/display_images.js.coffee @@ -0,0 +1,6 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ +jQuery -> + $('#new_display_image').fileupload + dataType: "script" \ No newline at end of file diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 2249d049..15e8a986 100755 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -98,4 +98,9 @@ nav.pagination .page a:hover, i.logout_icon{ position: relative; top: 5px; +} + +/* Second display image */ +.second-display{ + margin : 12px; } \ No newline at end of file diff --git a/app/assets/stylesheets/login.scss b/app/assets/stylesheets/login.scss index b5f29da6..ed0b36f9 100755 --- a/app/assets/stylesheets/login.scss +++ b/app/assets/stylesheets/login.scss @@ -90,3 +90,14 @@ padding-bottom: 20px; font-size: 14px; } + +.style_image{ + height : 138px; + padding : 20px 0 20px 0; + width : 70%; +} + +.style_icon{ + font-size: 111px; + padding : 20px 0 20px 0; +} diff --git a/app/assets/stylesheets/origami/paymal.scss b/app/assets/stylesheets/origami/paymal.scss new file mode 100644 index 00000000..93758d38 --- /dev/null +++ b/app/assets/stylesheets/origami/paymal.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the origami/Paymal controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb index 39219c6b..459589ed 100755 --- a/app/controllers/api/payments_controller.rb +++ b/app/controllers/api/payments_controller.rb @@ -84,6 +84,17 @@ class Api::PaymentsController < ActionController::API sale_payment.payment_reference = params[:payment_reference] #TODO: implement paypar implementation @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + when "JunctionPay" + sale_payment.payment_method = "JunctionPay" + sale_payment.received_amount = params[:amount] + sale_payment.customer_id = params[:customer_id] + sale_payment.payment_reference = params[:vochure_no] + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + when "alipay" + sale_payment.payment_method = "alipay" + sale_payment.received_amount = params[:amount] + sale_payment.payment_reference = params[:payment_reference] + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) end end end diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index ccef4e4a..049bbda6 100644 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -36,33 +36,39 @@ class Oqs::EditController < BaseOqsController if ENV["SERVER_MODE"] != "cloud" #no print in cloud server # print assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) - # order queue stations - oqs = assigned_item.order_queue_station - - order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf + assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'") - unique_code="OrderItemPdf" - if !order_slim_pdf.empty? - order_slim_pdf.each do |order_item_slim| - if order_item_slim[0] == 'OrderSlimPdf' - if order_item_slim[1] == '1' - unique_code="OrderItemSlimPdf" - else - unique_code="OrderItemPdf" - end - elsif order_item_slim[0] == 'OrderSetPdf' - if order_item_slim[1] == '1' - unique_code="OrderSetItemPdf" - else - unique_code="OrderItemPdf" + if !assigned_items.nil? + assigned_items.each do |assign_item| + # order queue stations + oqs = assign_item.order_queue_station + + order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf + + unique_code="OrderItemPdf" + if !order_slim_pdf.empty? + order_slim_pdf.each do |order_item_slim| + if order_item_slim[0] == 'OrderSlimPdf' + if order_item_slim[1] == '1' + unique_code="OrderItemSlimPdf" + else + unique_code="OrderItemPdf" + end + elsif order_item_slim[0] == 'OrderSetPdf' + if order_item_slim[1] == '1' + unique_code="OrderSetItemPdf" + else + unique_code="OrderItemPdf" + end + end end end + + print_settings=PrintSetting.find_by_unique_code(unique_code) + order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty ) end end - - print_settings=PrintSetting.find_by_unique_code(unique_code) - order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty ) end end diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index baa4af40..930d3d5c 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -26,7 +26,7 @@ class Oqs::PrintController < ApplicationController assigned_item_id = params[:id] options = params[:options] assigned_item = AssignedOrderItem.find(assigned_item_id) - assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); + assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'") # order queue stations oqs = assigned_item.order_queue_station diff --git a/app/controllers/origami/alipay_controller.rb b/app/controllers/origami/alipay_controller.rb new file mode 100644 index 00000000..3f449856 --- /dev/null +++ b/app/controllers/origami/alipay_controller.rb @@ -0,0 +1,77 @@ +class Origami::AlipayController < BaseOrigamiController + def index + @sale_id = params[:sale_id] + @cashier_type = params[:type] + # limit alipay_amount + sale_data = Sale.find_by_sale_id(@sale_id) + total = 0 + @alipaycount = 0 + @shop = Shop::ShopDetail + @rounding_adj = 0 + @can_alipay = 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 == "alipay" + @alipaycount = @alipaycount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_alipay = total - @alipaycount - 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 + + bank_integration = Lookup.collection_of('bank_integration') + @bank_integration = 0 + if !bank_integration[0].nil? + @bank_integration = bank_integration[0][1] + end + end + + def create + cash = params[:amount] + sale_id = params[:sale_id] + ref_no = params[:ref_no] + if(Sale.exists?(sale_id)) + saleObj = Sale.find(sale_id) + shop_details = Shop::ShopDetail + + # 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, "alipay",ref_no) + end + end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end +end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index a8e2818c..759cb1b6 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -95,7 +95,7 @@ class Origami::HomeController < BaseOrigamiController @status_order = 'order' else sale = Sale.find(booking.sale_id) - if sale.sale_status != "completed" && sale.sale_status != 'void' + if sale.sale_status != "completed" && sale.sale_status != 'void' && sale.sale_status != 'spoile' && sale.sale_status != 'waste' @sale_array.push(sale) if @status_order == 'order' @status_order = 'sale' diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb index 5c06f9fe..fd79f6d8 100644 --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -35,6 +35,7 @@ class Origami::JcbController < BaseOrigamiController end @can_jcb = total - @jcbcount - others + @member_discount = MembershipSetting.find_by_discount(1) @sub_total = sale_data.total_amount @membership_id = sale_data.customer.membership_id @@ -52,6 +53,7 @@ class Origami::JcbController < BaseOrigamiController def create cash = params[:amount] sale_id = params[:sale_id] + ref_no = params[:ref_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop::ShopDetail @@ -65,7 +67,7 @@ class Origami::JcbController < BaseOrigamiController # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb") + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb",ref_no) end end diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb index 858d0125..cca8a2c4 100644 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -24,7 +24,7 @@ class Origami::MasterController < BaseOrigamiController else new_total = sale_data.grand_total end - @rounding_adj = new_total-sale_data.grand_total + @rounding_adj = new_total-sale_data.grand_total sale_data.sale_payments.each do |sale_payment| if sale_payment.payment_method == "master" @@ -50,6 +50,7 @@ class Origami::MasterController < BaseOrigamiController def create cash = params[:amount] sale_id = params[:sale_id] + ref_no = params[:ref_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop::ShopDetail @@ -63,7 +64,7 @@ class Origami::MasterController < BaseOrigamiController # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master") + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master",ref_no) end end diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index dfdfcabf..09d9669e 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -69,6 +69,18 @@ class Origami::MovetableController < BaseOrigamiController end @get_type = Booking.update_dining_facility(booking_array,change_to,change_from) + + # get printer info + @from = (DiningFacility.find(change_from)).name + @to = (DiningFacility.find(change_to)).name + @type = (DiningFacility.find(change_to)).type + @moved_by = @current_user.name + @date = DateTime.now + @shop = Shop::ShopDetail + unique_code = "MoveTablePdf" + print_settings = PrintSetting.find_by_unique_code(unique_code) + printer = Printer::ReceiptPrinter.new(print_settings) + printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by) end end diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb index 1b125bda..7d3ded34 100644 --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -51,6 +51,7 @@ class Origami::MpuController < BaseOrigamiController def create cash = params[:amount] sale_id = params[:sale_id] + ref_no = params[:ref_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop::ShopDetail @@ -64,7 +65,7 @@ class Origami::MpuController < BaseOrigamiController # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu") + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "alipay",ref_no) end end diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb new file mode 100644 index 00000000..3db34a1c --- /dev/null +++ b/app/controllers/origami/paymal_controller.rb @@ -0,0 +1,101 @@ +class Origami::PaymalController < BaseOrigamiController + def index + @sale_id = params[:sale_id] + payment_method = params[:payment_method] + @cashier_type = params[:type] + @membership_rebate_balance=0 + sale_data = Sale.find_by_sale_id(@sale_id) + + @shop = Shop::ShopDetail + # 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 + @rounding_adj = sale_data.rounding_adjustment + + @payparcount = 0 + others = 0 + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "paypar" + @payparcount = @payparcount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @payment_prices = sale_data.grand_total - @payparcount -others + + + if sale_data + if sale_data.customer_id + customer_data= Customer.find_by_customer_id(sale_data.customer_id) + if customer_data + @membership_id = customer_data.membership_id + if !@membership_id.nil? + membership_setting = MembershipSetting.find_by_membership_type("paypar_url") + if membership_setting.gateway_url + member_actions =MembershipAction.find_by_membership_type("get_account_balance") + if member_actions.gateway_url + @campaign_type_id = nil + url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s + merchant_uid= member_actions.merchant_account_id + auth_token = member_actions.auth_token.to_s + membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token) + if membership_data["status"]==true + @membership_rebate_balance=membership_data["balance"] + @out = true, @membership_rebate_balance,@membership_id + end + else + @out =false,0 + end + else + @out = false,0 + end + + + else + @out = false, 0 + end + else + @out = false, 0 + end + else + @out = false, 0 + end + else + @out = false, 0 + end + @out = false, 0 + end + def create + cash = params[:payment_amount] + sale_id = params[:sale_id] + if(Sale.exists?(sale_id)) + saleObj = Sale.find(sale_id) + shop_details = Shop::ShopDetail + + # 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, "paymal") + if status == true + @out = true, "Success!" + else + @out =false, "Please try again payment!" + end + end + end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end +end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 5397c7f0..da5f216b 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -113,8 +113,6 @@ class Origami::PaymentsController < BaseOrigamiController end end #end rounding adjustment - puts "sale" - puts saleObj.to_json sale_payment = SalePayment.new sale_payment.process_payment(saleObj, current_user.name, cash, "cash") @@ -163,8 +161,10 @@ class Origami::PaymentsController < BaseOrigamiController if customer.membership_id != nil && rebate && credit_data.nil? member_info = Customer.get_member_account(customer) - rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) - current_balance = SaleAudit.paymal_search(sale_id) + if member_info["status"] == true + rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) + current_balance = SaleAudit.paymal_search(sale_id) + end end #orders print out @@ -226,8 +226,10 @@ class Origami::PaymentsController < BaseOrigamiController @jcbcount= 0.0 @mastercount = 0.0 @unionpaycount = 0.0 + @alipaycount = 0.0 @junctionpaycount = 0.0 @credit = 0.0 + @paymalcount = 0.0 @sale_data = Sale.find_by_sale_id(sale_id) @balance = 0 @accountable_type = '' @@ -346,6 +348,10 @@ class Origami::PaymentsController < BaseOrigamiController @junctionpaycount += spay.payment_amount elsif spay.payment_method == "creditnote" @credit += spay.payment_amount + elsif spay.payment_method == "paymal" + @paymalcount += spay.payment_amount + elsif spay.payment_method == "alipay" + @alipaycount += spay.payment_amount end end end diff --git a/app/controllers/origami/quick_service_controller.rb b/app/controllers/origami/quick_service_controller.rb index 8abcfcc8..d2194bb5 100644 --- a/app/controllers/origami/quick_service_controller.rb +++ b/app/controllers/origami/quick_service_controller.rb @@ -12,7 +12,7 @@ class Origami::QuickServiceController < ApplicationController day = Date.today.wday @menus = Menu.all @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') - @zone = Zone.all + @zone = Zone.all @customer = Customer.all @tables = Table.all.active.order('status desc') @rooms = Room.all.active.order('status desc') diff --git a/app/controllers/origami/redeem_payments_controller.rb b/app/controllers/origami/redeem_payments_controller.rb index bcb8f9ae..347fd3ea 100755 --- a/app/controllers/origami/redeem_payments_controller.rb +++ b/app/controllers/origami/redeem_payments_controller.rb @@ -6,7 +6,6 @@ class Origami::RedeemPaymentsController < BaseOrigamiController @membership_rebate_balance=0 sale_data = Sale.find_by_sale_id(@sale_id) - @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail # if @shop.is_rounding_adj # new_total = Sale.get_rounding_adjustment(sale_data.grand_total) diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index 11a7f93d..5c0cd454 100755 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -79,8 +79,7 @@ class Origami::RoomsController < BaseOrigamiController @status_order = 'order' else sale = Sale.find(booking.sale_id) - if sale.sale_status != "completed" && sale.sale_status != 'void' - puts "enter" + if sale.sale_status != "completed" && sale.sale_status != 'void' && sale.sale_status != 'spoile' && sale.sale_status != 'waste' @sale_array.push(sale) if @status_order == 'order' @status_order = 'sale' diff --git a/app/controllers/origami/second_display_controller.rb b/app/controllers/origami/second_display_controller.rb index 8d2efd6f..a2bf34fd 100644 --- a/app/controllers/origami/second_display_controller.rb +++ b/app/controllers/origami/second_display_controller.rb @@ -1,7 +1,10 @@ class Origami::SecondDisplayController < BaseOrigamiController def index - + @display_images = DisplayImage.all + end + + def show end def customer_view diff --git a/app/controllers/origami/surveys_controller.rb b/app/controllers/origami/surveys_controller.rb index 654f8a1a..b30ff1b0 100644 --- a/app/controllers/origami/surveys_controller.rb +++ b/app/controllers/origami/surveys_controller.rb @@ -5,7 +5,6 @@ class Origami::SurveysController < BaseOrigamiController @id = params[:id] @cashier_type = params[:type] - if(@id[0,3] == "SAL") @sale = Sale.find(@id) @receipt_no = @sale.receipt_no diff --git a/app/controllers/origami/unionpay_controller.rb b/app/controllers/origami/unionpay_controller.rb index 7213af6d..ec941a20 100644 --- a/app/controllers/origami/unionpay_controller.rb +++ b/app/controllers/origami/unionpay_controller.rb @@ -48,6 +48,7 @@ class Origami::UnionpayController < BaseOrigamiController def create cash = params[:amount] sale_id = params[:sale_id] + ref_no = params[:ref_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop::ShopDetail @@ -62,7 +63,7 @@ class Origami::UnionpayController < BaseOrigamiController # saleObj = Sale.find(sale_id) #end rounding adjustment sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay") + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay",ref_no) end end diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb index 346b66d1..17b70010 100644 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -6,7 +6,7 @@ class Origami::VisaController < BaseOrigamiController sale_data = Sale.find_by_sale_id(@sale_id) total = 0 @visacount = 0 - @shop = Shop::ShopDetail + @shop = Shop::ShopDetail @rounding_adj = 0 @can_visa = 0 @member_discount = 0 @@ -48,6 +48,7 @@ class Origami::VisaController < BaseOrigamiController def create cash = params[:amount] sale_id = params[:sale_id] + ref_no = params[:ref_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop::ShopDetail @@ -62,7 +63,7 @@ class Origami::VisaController < BaseOrigamiController # saleObj = Sale.find(sale_id) #end rounding adjustment sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa") + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa",ref_no) end end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index 74e495ca..83dce707 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -48,7 +48,7 @@ class Origami::VoidController < BaseOrigamiController table.bookings.each do |booking| if booking.booking_status != 'moved' if booking.sale_id - if booking.sale.sale_status != 'completed' && booking.sale.sale_status != 'void' + if booking.sale.sale_status != 'completed' && booking.sale.sale_status != 'void' && booking.sale.sale_status != 'spoile' && booking.sale.sale_status != 'waste' table_avaliable = false table_count += 1 else diff --git a/app/controllers/origami/waste_spoile_controller .rb b/app/controllers/origami/waste_spoile_controller.rb similarity index 83% rename from app/controllers/origami/waste_spoile_controller .rb rename to app/controllers/origami/waste_spoile_controller.rb index 72180786..c94b33bb 100755 --- a/app/controllers/origami/waste_spoile_controller .rb +++ b/app/controllers/origami/waste_spoile_controller.rb @@ -1,29 +1,28 @@ class Origami::WasteSpoileController < BaseOrigamiController - def index - - end - def waste_and_spoile + def waste_and_spoilage sale_id = params[:sale_id] remark = params[:remark] order_source = params[:type] #tax profile source if Sale.exists?(sale_id) sale = Sale.find_by_sale_id(sale_id) - - if sale.discount_type == "member_discount" - sale.update_attributes(total_discount: 0) - sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source) + SaleTax.where("sale_id='#{sale_id}'").find_each do |existing_tax| + existing_tax.delete end - + sale.update_attributes(total_discount: 0,total_tax: 0,grand_total: sale.total_amount,rounding_adjustment:0) sale.payment_status = remark sale.sale_status = remark sale.save + # sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source) # add to sale item with foc - sale_items = SaleItem.where("sale_id='#{ sale_id }' and status is null") + # sale_items = SaleItem.where("sale_id='#{ sale_id }' and status is null") - sale_items.each do|item| - SaleItem.update_existing_item(item.qty, item, sale_id, remark, item.unit_price, item.price) + sale.sale_items.each do|item| + # SaleItem.update_existing_item(item.qty, item, sale_id, remark, item.unit_price, item.price) + item.status = remark + item.remark = remark + item.save end if sale.bookings[0].dining_facility_id.to_i > 0 @@ -33,7 +32,7 @@ class Origami::WasteSpoileController < BaseOrigamiController table.bookings.each do |booking| if booking.booking_status != 'moved' if booking.sale_id - if booking.sale.sale_status != 'completed' && booking.sale.sale_status != 'void' + if booking.sale.sale_status != 'completed' && booking.sale.sale_status != 'void' && booking.sale.sale_status != 'spoile' && booking.sale.sale_status != 'waste' table_avaliable = false table_count += 1 else @@ -45,7 +44,6 @@ class Origami::WasteSpoileController < BaseOrigamiController end end end - if table_avaliable && table_count == 0 table.status = 'available' table.save @@ -104,7 +102,7 @@ class Origami::WasteSpoileController < BaseOrigamiController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil) result = { :filepath => filename, :printer_model => print_settings.brand_name, diff --git a/app/controllers/reports/waste_and_spoilage_controller.rb b/app/controllers/reports/waste_and_spoilage_controller.rb new file mode 100755 index 00000000..369c6860 --- /dev/null +++ b/app/controllers/reports/waste_and_spoilage_controller.rb @@ -0,0 +1,19 @@ +class Reports::WasteAndSpoilageController < BaseReportController +authorize_resource :class => false + def index + from, to = get_date_range_from_params + @sale_type = params[:sale_type] + @sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type) + @from = from + @to = to + # get printer info + @print_settings = PrintSetting.get_precision_delimiter() + + respond_to do |format| + format.html + format.xls + end + end + + +end \ No newline at end of file diff --git a/app/controllers/settings/shops_controller.rb b/app/controllers/settings/shops_controller.rb index 365be7e2..975d9e25 100644 --- a/app/controllers/settings/shops_controller.rb +++ b/app/controllers/settings/shops_controller.rb @@ -47,11 +47,13 @@ class Settings::ShopsController < ApplicationController # PATCH/PUT /settings/shops/1 # PATCH/PUT /settings/shops/1.json def update + respond_to do |format| if @settings_shop.update(shop_params) if params[:display_images].present? - params[:display_images]['image'].each do |a| - @display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => a) + params[:display_images][:image].each do |a| + @aa = Base64.encode64(a.read) + @display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => "data:image/jpeg;base64,"+@aa) end end format.html { redirect_to settings_shops_url, notice: 'Shop was successfully updated.' } diff --git a/app/helpers/origami/paymal_helper.rb b/app/helpers/origami/paymal_helper.rb new file mode 100644 index 00000000..8d1787c8 --- /dev/null +++ b/app/helpers/origami/paymal_helper.rb @@ -0,0 +1,2 @@ +module Origami::PaymalHelper +end diff --git a/app/models/ability.rb b/app/models/ability.rb index 0b1edcc3..b1930e1b 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -179,6 +179,11 @@ class Ability can :remove_all_discount, :discount can :member_discount, :discount + can :move_dining, :movetable + can :moving, :movetable + + can :move_dining, :moveroom + can :manage, Customer can :manage, DiningQueue diff --git a/app/models/display_image.rb b/app/models/display_image.rb index 63405b26..30d83566 100644 --- a/app/models/display_image.rb +++ b/app/models/display_image.rb @@ -1,5 +1,3 @@ class DisplayImage < ApplicationRecord - mount_uploader :image, DisplayImageUploader belongs_to :shop - end diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index a5482b31..447543f2 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -238,6 +238,16 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker self.print("tmp/print_queue_no.pdf") end + #Move Table Print + def print_move_table(printer_settings,to,from,shop_detail,date,type,moved_by) + #Use CUPS service + #Generate PDF + #Print + pdf = MoveTablePdf.new(printer_settings,to,from,shop_detail,date,type,moved_by) + pdf.render_file "tmp/print_move_table.pdf" + self.print("tmp/print_move_table.pdf") + end + #Bill Receipt Print def print_crm_order(booking,order_items,setting) #Use CUPS service diff --git a/app/models/sale.rb b/app/models/sale.rb index 970896bf..883fbad4 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -950,7 +950,7 @@ def self.get_menu_item_query(order_by) " LEFT JOIN sale_items si ON si.item_instance_code = mii.item_instance_code" + " LEFT JOIN sales s ON s.sale_id = si.sale_id") .where("(CASE WHEN s.sale_status IS NOT NULL THEN s.sale_status='completed' ELSE 1 END)") - .group("mc.id, (CASE WHEN si.product_name IS NOT NULL THEN si.product_name ELSE mii.item_instance_name END)") + .group("mc.id, (CASE WHEN si.product_name IS NOT NULL THEN si.product_name ELSE CONCAT(menu_items.name,' - ',mii.item_instance_name) END)") .order("si.qty #{order_by}, menu_items.menu_category_id #{order_by}") end #product sale report query @@ -1109,6 +1109,16 @@ def self.get_payment_method_by_shift(shift_sale_range,shift,from,to,payment_type return all_total,sale_type end +def self.get_wastes_and_spoilages(from,to,status) + if status == "spoile" + type = "and sales.sale_status = 'spoile'" + else + type = "and sales.sale_status = 'waste'" + end + query = Sale.all.where("sales.receipt_date between ? and ? #{type}",from,to) + .group("sales.receipt_no") +end + # def self.get_separate_tax(from,to,payment_method=nil) # query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name") diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 3ff4697e..e43414b8 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -49,8 +49,12 @@ class SalePayment < ApplicationRecord payment_status = paypar_payment when "foc" payment_status = foc_payment + when "paymal" + payment_status = paymal_payment when "JunctionPay" payment_status = junction_pay_payment + when "alipay" + payment_status = external_terminal_card_payment(:alipay) else puts "it was something else" end @@ -162,6 +166,60 @@ class SalePayment < ApplicationRecord return response; + end + + def self.create_payment(paypar_url,token,membership_id,received_amount,sale_id) + membership_actions_data = MembershipAction.find_by_membership_type("create_payment"); + + if !membership_actions_data.nil? + + url = paypar_url.to_s + membership_actions_data.gateway_url.to_s + merchant_uid = membership_actions_data.merchant_account_id + auth_token = membership_actions_data.auth_token + sale_data = Sale.find_by_sale_id(sale_id) + + if sale_data + others = 0 + sale_data.sale_payments.each do |sale_payment| + others = others + sale_payment.payment_amount + end + payment_prices = sale_data.grand_total - others + # Control for Paypar Cloud + begin + response = HTTParty.post(url, + :body => { membership_id:membership_id, + amount:received_amount, + receipt_no:sale_data.receipt_no, + merchant_uid:merchant_uid, + auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json; version=3' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = false + + rescue OpenURI::HTTPError + response = { status: false} + + rescue SocketError + response = { status: false} + end + else + response = false; + end + + else + response =false; + end + + Rails.logger.debug "Payment response" + Rails.logger.debug response.to_json + + return response; + end # Check for Card Payment @@ -230,7 +288,7 @@ class SalePayment < ApplicationRecord payment_status = false self.payment_method = method self.payment_amount = self.received_amount - self.payment_reference = self.card_payment_reference + # self.payment_reference = self.card_payment_reference self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f self.payment_status = "paid" payment_method = self.save! @@ -299,6 +357,35 @@ class SalePayment < ApplicationRecord end + def paymal_payment + payment_status = false + + #Next time - validate if the vochure number is valid - within + customer_data = Customer.find_by_customer_id(self.sale.customer_id) + membership_setting = MembershipSetting.find_by_membership_type("paypar_url") + membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id) + + #record an payment in sale-audit + remark = "#{membership_data} PayMal Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} " + sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1) + + if membership_data["status"]==true + self.payment_method = "paymal" + self.payment_amount = self.received_amount + self.payment_reference = self.voucher_no + self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f + self.payment_status = "pending" + payment_method = self.save! + SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid') + sale_update_payment_status(self.received_amount.to_f) + + else + sale_update_payment_status(0) + end + + return payment_status + end + def junction_pay_payment payment_status = false @@ -310,9 +397,7 @@ class SalePayment < ApplicationRecord 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) @@ -418,7 +503,7 @@ class SalePayment < ApplicationRecord bookings.each do |tablebooking| if tablebooking.booking_status != 'moved' if tablebooking.sale_id - if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void' + if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void' && tablebooking.sale.sale_status != 'spoile' && tablebooking.sale.sale_status != 'waste' status = false sale_count += 1 else diff --git a/app/models/shop.rb b/app/models/shop.rb index b0e84912..c039ace4 100755 --- a/app/models/shop.rb +++ b/app/models/shop.rb @@ -6,4 +6,8 @@ class Shop < ApplicationRecord has_many :display_images accepts_nested_attributes_for :display_images + + def file_data=(input_data) + self.data = input_data.read + end end diff --git a/app/pdf/move_table_pdf.rb b/app/pdf/move_table_pdf.rb new file mode 100644 index 00000000..7b4ad8e4 --- /dev/null +++ b/app/pdf/move_table_pdf.rb @@ -0,0 +1,59 @@ +class MoveTablePdf < Prawn::Document + attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width + def initialize(printer_settings,to,from,shop_detail,date,type,moved_by) + self.page_width = printer_settings.page_width + self.page_height = printer_settings.page_height + self.margin = 5 + self.price_width = 35 + self.qty_width = 20 + self.total_width = 35 + self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width)) + self.item_height = 15 + self.item_description_width = (self.page_width-20) / 2 + self.label_width = 100 + + super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) + + # db font setup + if printer_settings.font != "" + font_families.update("#{printer_settings.font}" => { + :normal => "public/fonts/#{printer_settings.font}.ttf", + :italic => "public/fonts/#{printer_settings.font}.ttf", + :bold => "public/fonts/#{printer_settings.font}.ttf", + :bold_italic => "public/fonts/#{printer_settings.font}.ttf" + }) + + font "#{printer_settings.font}" + fallback_fonts ["Courier", "Helvetica", "Times-Roman"] + end + + self.header_font_size = 10 + self.item_font_size = 8 + + header(printer_settings.name,type) + + call_move_table(to,from,date,type,moved_by) + + move_down 5 + stroke_horizontal_rule + move_down 5 + + end + + def header (name,type) + text "Move #{type}", :left_margin => -10, :size => self.header_font_size.to_i + 3,:align => :center + # move_down self.item_height + move_down 5 + stroke_horizontal_rule + move_down 5 + end + + def call_move_table (to,from,date,type,moved_by) + move_down 3 + text "Date Time : #{date.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :left_margin => -10, :size => self.header_font_size + text "Change [#{from}] To [#{to}]", :left_margin => -10, :size => self.header_font_size + text "Moved By : #{moved_by}", :left_margin => -10, :size => self.header_font_size + end + + +end \ No newline at end of file diff --git a/app/uploaders/display_image_uploader.rb b/app/uploaders/display_image_uploader.rb deleted file mode 100644 index 33e28997..00000000 --- a/app/uploaders/display_image_uploader.rb +++ /dev/null @@ -1,59 +0,0 @@ -class DisplayImageUploader < CarrierWave::Uploader::Base - - # Include RMagick or MiniMagick support: - # include CarrierWave::RMagick - include CarrierWave::MiniMagick - - # Choose what kind of storage to use for this uploader: - storage :file - # storage :fog - - # def root - # Rails.root.join 'public/' - # end - - # Override the directory where uploaded files will be stored. - # This is a sensible default for uploaders that are meant to be mounted: - def store_dir - #"image/image" - "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" - end - - # def cache_dir - # '/tmp/images' - # end - - # Provide a default URL as a default if there hasn't been a file uploaded: - # def default_url(*args) - # # For Rails 3.1+ asset pipeline compatibility: - # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) - # - # "/images/fallback/" + [version_name, "default.png"].compact.join('_') - # end - - # Process files as they are uploaded: - # process scale: [200, 300] - process :resize_to_fit => [200, 150] - # - # def scale(width, height) - # # do something - # end - - # Create different versions of your uploaded files: - # version :thumb do - # process resize_to_fit: [50, 50] - # end - - # Add a white list of extensions which are allowed to be uploaded. - # For images you might use something like this: - def extension_whitelist - %w(jpg jpeg gif png) - end - - # Override the filename of the uploaded files: - # Avoid using model.id or version_name here, see uploader/store.rb for details. - # def filename - # "something.jpg" if original_filename - # end - -end \ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 1c60c569..d6a2d2f1 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -28,12 +28,10 @@ Logo SX Restaurant - <% if @payment_method_setting_nav.present? %> - /   -   Payment - - <% end %> - + + + + diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index eb3eefe3..965f1814 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -182,103 +182,135 @@
<% if @other != 0.0 %> -
-
-
MPU
-
<%= number_with_precision(@other, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
-
+
<% else %> - + <% if @ppamount != 0.0 %>
-
-
Redeem
-
<%= number_with_precision(@ppamount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
-
<% else %> - <% end %> + <% if @visacount != 0.0 %>
-
-
VISA
-
<%= number_with_precision(@visacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
-
<% else %> - <% end %> + <% if @jcbcount != 0.0 %>
-
-
JCB
-
<%= number_with_precision(@jcbcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
-
<% else %> - <% end %> + <% if @mastercount != 0.0 %>
-
-
MASTER
-
<%= number_with_precision(@mastercount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i ) %>
-
<% else %> - <% end %> + <% if @unionpaycount != 0.0 %>
-
-
UNIONPAY
-
<%= number_with_precision(@unionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
-
<% else %> + + + <% if @alipaycount != 0.0 %> +
+ <% else %> + + +
+
+
PAYMAL
+ <% if @paymalcount != 0.0 %> +
<%= number_with_precision(@paymalcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
+ <% else %> +
<%= number_with_precision(0, precision: precision.to_i ) %>
+ <% end %> +
+ <% if @junctionpaycount != 0.0 %>
-
-
JUNCTION PAY
-
<%= number_with_precision(@junctionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
-
<% else %> - <% end %> +
Balance
<%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
@@ -340,6 +372,8 @@ + <% if @cashier_type=="quick_service" %>
@@ -495,6 +529,7 @@ var cashier_type = "<%= @cashier_type %>"; var customer_id = "<%= @customer.id %>"; var customer_name = "<%= @customer.name %>"; $(document).ready(function(){ + setHeaderBreadCrumb(_PAYMENTS_); //start customer modal popup if((cashier_type=='quick_service') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){ // if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){ @@ -521,7 +556,7 @@ var customer_name = "<%= @customer.name %>"; $("#credit_payment").show(); } - if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1 || parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) !=-1){ + if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1, parseInt(jQuery.inArray("PAYMAL", payment_type)) !=-1 || parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Alipay", payment_type)) !=-1){ $("#card_payment").show(); } else{ $("#card_payment").hide(); @@ -584,11 +619,16 @@ var customer_name = "<%= @customer.name %>"; else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){ swal("Oops","Please Pay with UNIONPAY Payment","warning"); } + else if(payment_type == "Alipay" && $('#alipaycount').text()==0 && sub_total != 0.0){ + swal("Oops","Please Pay with Alipay Payment","warning"); + } else if(payment_type == "JUNCTIONPAY" && $('#junctionpaycount').text()==0 && sub_total != 0.0){ swal("Oops","Please Pay with JUNCTIONPAY Payment","warning"); } else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){ swal("Oops","Please Pay with Credit Payment","warning"); + }else if(payment_type == "PAYMAL" && $('#paymalcount').text()==0 && sub_total != 0.0){ + swal("Oops","Please Pay with Paymal Payment","warning"); }else{ $( "#loading_wrapper").show(); @@ -866,8 +906,10 @@ var customer_name = "<%= @customer.name %>"; var jcb1 = $('#jcbcount').text(); var master1 = $('#mastercount').text(); var unionpay1 = $('#unionpaycount').text(); + var paymal1 = $('#paymalcount').text(); + var alipay1 = $('#alipaycount').text(); var junctionpay1 = $('#junctionpaycount').text(); - var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(junctionpay1); + var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(alipay1) + parseFloat(junctionpay1) + parseFloat(paymal1); var total = $('#amount_due').text(); var amt = 0; <% if precision.to_i > 0 %>; @@ -895,9 +937,11 @@ var customer_name = "<%= @customer.name %>"; var jcb = $('#jcbcount').text(); var master = $('#mastercount').text(); var unionpay = $('#unionpaycount').text(); + var paymal = $('#paymalcount').text(); + var alipay = $('#alipaycount').text(); var junctionpay = $('#junctionpaycount').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(junctionpay) + var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(alipay) + parseFloat(junctionpay) + parseFloat(paymal); var result = parseFloat(amount_due) - parseFloat(total); <% if precision.to_i > 0 %> $('#balance').text(parseFloat(result).toFixed(<%= precision %>)); @@ -1160,4 +1204,40 @@ var customer_name = "<%= @customer.name %>"; var sale_id = $("#sale_id").text() || 0; update_sale("", customer_id, customer_name, sale_id); }); + + function waste_and_spoilage(remark) { + var sale_id = $('#sale_id').text(); + console.log(sale_id) + swal({ + title: "Alert", + text: "Are you sure want to " + remark +" ?", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "Yes, " +remark+ " it!", + closeOnConfirm: false + }, function (isConfirm) { + if (isConfirm) { + var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage'; + $.ajax({ + type: 'POST', + url: url, + data: "remark="+ remark + "&sale_id=" + sale_id, + success: function (result) { + console.log(result) + // For Server Print - from jade + if ($("#server_mode").val() == "cloud") { + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } + if (cashier_type=="cashier") { + window.location.href = '/origami'; + }else{ + window.location.href = '/origami/quick_service'; + customer_display_view(null,"reload"); + } + } + }); + } + }); + } \ No newline at end of file diff --git a/app/views/origami/paypar_payments/index.html.erb b/app/views/origami/paypar_payments/index.html.erb index 3b9fd2a3..3412b79b 100755 --- a/app/views/origami/paypar_payments/index.html.erb +++ b/app/views/origami/paypar_payments/index.html.erb @@ -13,4 +13,9 @@
-
\ No newline at end of file +
+ \ No newline at end of file diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb index 19750c4d..de208374 100644 --- a/app/views/origami/pending_order/show.html.erb +++ b/app/views/origami/pending_order/show.html.erb @@ -208,6 +208,7 @@ $(document).ready(function(){ url: ajax_url, // data: 'order_id='+ order_id, success: function (result) { + console.log(result) if (!result.status) { swal("Information!", result.error_message); } diff --git a/app/views/origami/product_commissions/load_commissioners.html.erb b/app/views/origami/product_commissions/load_commissioners.html.erb index af01f1ee..6383f1fa 100755 --- a/app/views/origami/product_commissions/load_commissioners.html.erb +++ b/app/views/origami/product_commissions/load_commissioners.html.erb @@ -121,6 +121,7 @@
diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb index ff203657..3079d76c 100755 --- a/app/views/origami/sale_edit/edit.html.erb +++ b/app/views/origami/sale_edit/edit.html.erb @@ -189,6 +189,8 @@ var cashier_type = "<%= @cashier_type %>"; // Bill Request $(document).ready(function () { + + setHeaderBreadCrumb(_SALE_EDIT_); $('.editModal').on('click', function () { $("#action").attr('data-type', $(this).attr('data-type')); $("#action").attr('data-id', $(this).attr('data-id')); diff --git a/app/views/origami/second_display/_second_display.html.erb b/app/views/origami/second_display/_second_display.html.erb index 267be25a..c09d6c4c 100644 --- a/app/views/origami/second_display/_second_display.html.erb +++ b/app/views/origami/second_display/_second_display.html.erb @@ -54,7 +54,14 @@
- <%= image_tag("slider/s2.jpg", :alt => "rss feed") %> +
+
+ <% @display_images.each do |p| %> + <%= image_tag "#{p.image}", :alt => "rss feed"%> + <% break %> + <% end %> +
+
diff --git a/app/views/origami/second_display/_slider.html.erb b/app/views/origami/second_display/_slider.html.erb index 61c71203..71f463b7 100644 --- a/app/views/origami/second_display/_slider.html.erb +++ b/app/views/origami/second_display/_slider.html.erb @@ -2,17 +2,19 @@ <%= javascript_include_tag 'wowslider', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'wow_script', 'data-turbolinks-track': 'reload' %>
-
-
-
-
    -
  • <%= image_tag("slider/s1.jpg", :alt => "rss feed") %>
  • -
  • <%= image_tag("slider/s2.jpg", :alt => "rss feed") %>
  • -
  • <%= image_tag("slider/s4.jpg", :alt => "rss feed") %>
  • -
-
-
+
+
+
+
    + <% @display_images.each do |p| %> +
  • + <%= image_tag "#{p.image}", :alt => "rss feed"%> +
  • + <% end %> +
+
+
diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb index 95061960..ff698bbc 100644 --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -335,6 +335,7 @@ var split_receipt_no = ""; var cashier_type = '<%= @cashier_type %>'; $(document).ready(function(){ + setHeaderBreadCrumb(_SPLIT_BILL_); $('#back').on('click',function(){ backToOrigami(); }) diff --git a/app/views/origami/surveys/_form.html.erb b/app/views/origami/surveys/_form.html.erb index 82b7c12a..68c3f59b 100755 --- a/app/views/origami/surveys/_form.html.erb +++ b/app/views/origami/surveys/_form.html.erb @@ -196,6 +196,7 @@ diff --git a/app/views/reports/waste_and_spoilage/index.html.erb b/app/views/reports/waste_and_spoilage/index.html.erb new file mode 100755 index 00000000..f74f99e0 --- /dev/null +++ b/app/views/reports/waste_and_spoilage/index.html.erb @@ -0,0 +1,75 @@ +
+ +
+
+ <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_waste_and_spoilage_index_path} %> +
+ +
+
+ + +
Report For <%= @sale_type? @sale_type : 'Waste' %>
+ <% @sale_data.each do |sale| %> + <% waste_and_spoil_item_count = 0%> + + + + + + + + + + + + + + + + + <% sale.sale_items.each do |item| %> + <% if !item.item_instance_code.nil?%> + <% waste_and_spoil_item_count += item.qty.to_i%> + + + + + + + + <% end %> + <% end %> + + + + + + + + <% end %> +
+ Receipt No :<%= sale.receipt_no %> + Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %>
Item NameItem CodeQtyPriceTotal Price
<%= item.product_name %><%= item.product_code %><%= item.qty %><%= item.price %><%= item.price %>
Total Qty: + <%= waste_and_spoil_item_count %> + Grand Total: + + <%= sale.grand_total %> + +
+
+
+
+
+
\ No newline at end of file diff --git a/app/views/reports/waste_and_spoilage/index.xls.erb b/app/views/reports/waste_and_spoilage/index.xls.erb new file mode 100755 index 00000000..4b4fa0a3 --- /dev/null +++ b/app/views/reports/waste_and_spoilage/index.xls.erb @@ -0,0 +1,58 @@ +
+
+
+
+ + +
Report For <%= @sale_type? @sale_type : 'Waste' %>
+ <% @sale_data.each do |sale| %> + <% waste_and_spoil_item_count = 0%> + + + + + + + + + + + + + + + + + <% sale.sale_items.each do |item| %> + <% if !item.item_instance_code.nil?%> + <% waste_and_spoil_item_count += item.qty.to_i%> + + + + + + + + <% end %> + <% end %> + + + + + + + + <% end %> +
+ Receipt No :<%= sale.receipt_no %> + Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %>
Item NameItem CodeQtyPriceTotal Price
<%= item.product_name %><%= item.product_code %><%= item.qty %><%= item.price %><%= item.price %>
Total Qty: + <%= waste_and_spoil_item_count %> + Grand Total: + + <%= sale.grand_total %> + +
+
+
+
+
\ No newline at end of file diff --git a/app/views/settings/shops/_form.html.erb b/app/views/settings/shops/_form.html.erb index 0be7b052..57665164 100755 --- a/app/views/settings/shops/_form.html.erb +++ b/app/views/settings/shops/_form.html.erb @@ -40,30 +40,22 @@
- -
-
- + <%= f.file_field :image, :multiple => true, name: "display_images[image][]" %> +
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %> diff --git a/app/views/settings/shops/create.js.erb b/app/views/settings/shops/create.js.erb new file mode 100644 index 00000000..62a98b09 --- /dev/null +++ b/app/views/settings/shops/create.js.erb @@ -0,0 +1,5 @@ +<% if @display_image.new_record? %> + alert("Failed to upload display_image: <%= j @display_image.errors.full_messages.join(', ').html_safe %>"); +<% else %> + $("#display_images").append("<%= j render(@display_image) %>"); +<% end %> diff --git a/app/views/settings/shops/show.html.erb b/app/views/settings/shops/show.html.erb index d30ca274..40082d72 100755 --- a/app/views/settings/shops/show.html.erb +++ b/app/views/settings/shops/show.html.erb @@ -97,13 +97,13 @@ Shop Image - <%= image_tag @settings_shop.logo, :size => '200x200'%> + <%= image_tag @settings_shop.logo, :class => "img-thumbnail second-display", :size => "155x185"%> Shop Images <% @display_images.each do |p| %> - <%= image_tag p.image , :size => '200x200'%>
+ <%= image_tag "#{p.image}", :class => "img-thumbnail second-display", :size => "155x185"%> <% end %> diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 02e35bb8..dcfcfed5 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -19,7 +19,7 @@ class ActionController::Base render :json => [{ status: false, message: 'Invalid Access!'}] end else - # check for license file + #check for license file # if check_license # current_license(ENV["SX_PROVISION_URL"]) # else diff --git a/config/locales/en.yml b/config/locales/en.yml index 84a7b03a..dba88aee 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -122,6 +122,8 @@ en: mpu: "MPU" jcb: "JCB" visa: "VISA" + master: "MASTER" + alipay: "Alipay" credit: "CREDIT" other_payment: "Other Payment" percentage: "PERCENTAGE" @@ -412,6 +414,7 @@ en: redeem_sales: "Redeem Sales" cash_sales: "Cash Sales" credit_sales: "Credit Sales" + alipay_sales: "Alipay Sales" foc_sales: "FOC Sales" foc_item: "Item FOC" net_amount: "Net Amount" diff --git a/config/locales/mm.yml b/config/locales/mm.yml index f18136c4..e06733e9 100644 --- a/config/locales/mm.yml +++ b/config/locales/mm.yml @@ -117,6 +117,8 @@ mm: mpu: "MPU" jcb: "JCB" visa: "VISA" + master: "MASTER" + alipay: "Alipay" credit: "အကြွေး" other_payment: "အခြားငွေပေးဆောင်မှုများ" percentage: "ရာခိုင်နှုန်း" @@ -404,6 +406,7 @@ mm: master_sales: "Master ရောင်းရငွေ" visa_sales: "Visa ရောင်းရငွေ" jcb_sales: "JCB ရောင်းရငွေ" + alipay_sales: "Alipay ရောင်းရငွေ" redeem_sales: "ဆုကြေးပြန်သုံးငွေနှင့် ရောင်းရငွေ" cash_sales: "ငွေသား ရောင်းရငွေ" credit_sales: "အကြွေး ရောင်းရငွေ" diff --git a/config/routes.rb b/config/routes.rb index 38d26a7a..94db2ebd 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -78,15 +78,13 @@ scope "(:locale)", locale: /en|mm/ do post "check_in" => "check_in_process#check_in_process" post "request_time" => "check_in_process#request_time" post "call_waiter" => "call_waiters#index" - #---------Waste and Spoile --------------# - post 'sale/:sale_id/:type/waste_and_spoilage' => 'waste_spoile#waste_and_spoilage' end end #--------- Cashier ------------# - namespace :origami do + namespace :origami do get "dashboard" => "dashboard#index" @@ -181,6 +179,9 @@ scope "(:locale)", locale: /en|mm/ do post 'payment/paypar' => 'paypar_payments#create' post 'payment/credit' => 'credit_payments#create' post 'payment/voucher' => 'voucher_payments#create' + post 'payment/paymal' => 'paymal#create' + post 'payment/alipay' => 'alipay#create' + post 'payment/junctionpay' => 'junctionpay#create' get 'sale/:sale_id/:type/payment/credit_payment' => "credit_payments#index" get 'sale/:sale_id/:type/payment/others_payment' => "others_payments#index" @@ -188,14 +189,17 @@ scope "(:locale)", locale: /en|mm/ do get 'sale/:sale_id/:type/payment/others_payment/VISA' => "visa#index" get 'sale/:sale_id/:type/payment/others_payment/Master' => "master#index" get 'sale/:sale_id/:type/payment/others_payment/JCB' => "jcb#index" + get 'sale/:sale_id/:type/payment/others_payment/PAYMAL' => "paymal#index" get 'sale/:sale_id/:type/payment/others_payment/UNIONPAY' => "unionpay#index" get 'sale/:sale_id/:type/payment/others_payment/Redeem' => "redeem_payments#index" get 'sale/:sale_id/:type/payment/others_payment/Voucher' => "voucher#index" + get 'sale/:sale_id/:type/payment/others_payment/JunctionPay' => "junction_pay#index" + get 'sale/:sale_id/:type/payment/others_payment/Alipay' => "alipay#index" #---------Void --------------# post 'sale/:sale_id/:type/void' => 'void#overall_void' - + post 'sale/:sale_id/:type/waste_and_spoilage' => "waste_spoile#waste_and_spoilage" #---------Multiple Invoices --------------# get 'table/:table_id/table_invoices' => "table_invoices#index", :as => "table_invoice_index" @@ -296,7 +300,9 @@ scope "(:locale)", locale: /en|mm/ do #--------- System Settings ------------# namespace :settings do - resources :shops + resources :shops do + resources :display_images + end #employees resources :employees #menu @@ -406,6 +412,7 @@ scope "(:locale)", locale: /en|mm/ do resources :shiftsale, :only => [:index, :show] resources :credit_payment, :only => [:index, :show] resources :void_sale, :only => [:index, :show] + resources :waste_and_spoilage, :only => [:index, :show] resources :commission, :only => [:index, :show] resources :stock_check, :only => [:index, :show] resources :payment_method diff --git a/db/migrate/20170403183755_create_tax_profiles.rb b/db/migrate/20170403183755_create_tax_profiles.rb index f5210bbb..2c96fd0d 100755 --- a/db/migrate/20170403183755_create_tax_profiles.rb +++ b/db/migrate/20170403183755_create_tax_profiles.rb @@ -2,7 +2,7 @@ class CreateTaxProfiles < ActiveRecord::Migration[5.1] def change create_table :tax_profiles do |t| t.string :name, :null => false - t.string :group_type, :null => false + t.string :group_type t.decimal :rate, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.boolean :inclusive, :null => false, :default => false t.integer :order_by, :null => false, :default => 1 diff --git a/lib/tasks/clear_data.rake b/lib/tasks/clear_data.rake index 9d476d67..247992be 100755 --- a/lib/tasks/clear_data.rake +++ b/lib/tasks/clear_data.rake @@ -17,7 +17,7 @@ namespace :clear do Survey.delete_all DiningFacility.update_all(status:'available') CashierTerminal.update_all(is_currently_login: 0) - SeedGenerator.where("id > 1").update(:current => 0, :next => 1) + SeedGenerator.where("id > 1").update(:current => 0, :next => 0) puts "Clear Data Done." end diff --git a/spec/controllers/origami/alipay_controller_spec.rb b/spec/controllers/origami/alipay_controller_spec.rb new file mode 100644 index 00000000..5994c9fa --- /dev/null +++ b/spec/controllers/origami/alipay_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Origami::AlipayController, type: :controller do + +end diff --git a/spec/controllers/origami/paymal_controller_spec.rb b/spec/controllers/origami/paymal_controller_spec.rb new file mode 100644 index 00000000..8dffaf69 --- /dev/null +++ b/spec/controllers/origami/paymal_controller_spec.rb @@ -0,0 +1,12 @@ +require 'rails_helper' + +RSpec.describe Origami::PaymalController, type: :controller do + + describe "GET #index" do + it "returns http success" do + get :index + expect(response).to have_http_status(:success) + end + end + +end diff --git a/spec/helpers/origami/paymal_helper_spec.rb b/spec/helpers/origami/paymal_helper_spec.rb new file mode 100644 index 00000000..7d27aafa --- /dev/null +++ b/spec/helpers/origami/paymal_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Origami::PaymalHelper. For example: +# +# describe Origami::PaymalHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Origami::PaymalHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/paymal/index.html.erb_spec.rb b/spec/views/origami/paymal/index.html.erb_spec.rb new file mode 100644 index 00000000..c047162a --- /dev/null +++ b/spec/views/origami/paymal/index.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "paymal/index.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end