Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2018-04-02 16:13:46 +06:30
98 changed files with 1742 additions and 325 deletions

1
Gemfile Executable file → Normal file
View File

@@ -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'

5
Gemfile.lock Executable file → Normal file
View File

@@ -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)

View File

@@ -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

View File

@@ -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 ="<tr class='item_box' data-price ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+name+ "' data-code='"+item_code+"' data-instance-code='"
@@ -398,7 +400,7 @@ $(function() {
+attribute_arr+"' data-options ='"
+option+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + option +'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + option_name +'</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(total).toFixed(2)
@@ -406,15 +408,16 @@ $(function() {
+'</tr>';
$(".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 ="<tr class='item_box' data-price ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+name+ "' data-code='"+item_code+"' data-instance-code='"
@@ -422,7 +425,7 @@ $(function() {
+attribute_arr+"' data-options ='"
+set_option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + set_option +'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + set_option_name +'</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(total).toFixed(2)

View File

@@ -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();

View File

@@ -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(){

View File

@@ -16,6 +16,30 @@
//= require BSBMaterial/demo.js
//= require custom.js
/* Constant Varaibles */
_CREDIT_PAYMENTS_ = "/&nbsp;&nbsp;&nbsp;CREDIT PAYMENTS";
_CUSTOMERS_ = "/&nbsp;&nbsp;&nbsp;CUSTOMERS";
_DISCOUNTS_ = "/&nbsp;&nbsp;&nbsp;DISCOUNTS";
_IN_DUTIES_ = "/&nbsp;&nbsp;&nbsp;IN DUTIES";
_JCB_ = "/&nbsp;&nbsp;&nbsp;JCB PAYMENT";
_MASTER_ = "/&nbsp;&nbsp;&nbsp;MASTER PAYMENT";
_MPU_ = "/&nbsp;&nbsp;&nbsp;MPU PAYMENT";
_ALIPAY_ = "/&nbsp;&nbsp;&nbsp;Alipay";
_JUNCTIONPAY_ = "/&nbsp;&nbsp;&nbsp;JunctionPay";
_PAYMAL_ = "/&nbsp;&nbsp;&nbsp;PAYMAL";
_OTHER_CHARGES_ = "/&nbsp;&nbsp;&nbsp;CHARGES";
_OTHER_PAYMENTS_ = "/&nbsp;&nbsp;&nbsp;OTHER PAYMENT";
_PAYMENTS_ = "/&nbsp;&nbsp;&nbsp;PAYMENT";
_PAYPAR_PAYMENT_ = "/&nbsp;&nbsp;&nbsp;PAYPAR PAYMENT";
_COMMISSIONS_ = "/&nbsp;&nbsp;&nbsp;COMMISSIONS";
_REDEEM_PAYMENT_ = "/&nbsp;&nbsp;&nbsp;REDEEM PAYMENT";
_SALE_EDIT_ = "/&nbsp;&nbsp;&nbsp;SALE EDIT";
_SPLIT_BILL_ = "/&nbsp;&nbsp;&nbsp;SPLIT BILL";
_UNION_ = "/&nbsp;&nbsp;&nbsp;UNION PAYMENT";
_VISA_ = "/&nbsp;&nbsp;&nbsp;VISA PAYMENT";
_VOUCHER_ = "/&nbsp;&nbsp;&nbsp;VOUCHER";
_SURVEY_ = "/&nbsp;&nbsp;&nbsp;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
//end CB ECR integration
function setHeaderBreadCrumb(params){
$("#others_payment").html(params);
}

View File

@@ -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/

View File

@@ -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"

View File

@@ -98,4 +98,9 @@ nav.pagination .page a:hover,
i.logout_icon{
position: relative;
top: 5px;
}
/* Second display image */
.second-display{
margin : 12px;
}

View File

@@ -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;
}

View File

@@ -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/

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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'

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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')

View File

@@ -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)

View File

@@ -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'

View File

@@ -1,7 +1,10 @@
class Origami::SecondDisplayController < BaseOrigamiController
def index
@display_images = DisplayImage.all
end
def show
end
def customer_view

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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

View File

@@ -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.' }

View File

@@ -0,0 +1,2 @@
module Origami::PaymalHelper
end

View File

@@ -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

View File

@@ -1,5 +1,3 @@
class DisplayImage < ApplicationRecord
mount_uploader :image, DisplayImageUploader
belongs_to :shop
end

View File

@@ -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

View File

@@ -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")

View File

@@ -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

View File

@@ -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

59
app/pdf/move_table_pdf.rb Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -28,12 +28,10 @@
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
<span class="navbar-brand-txt">SX Restaurant</span>
</a>
<% if @payment_method_setting_nav.present? %>
<span class="navbar-brand m-0">/ &nbsp;
<span id="otherPayment"></span>&nbsp; Payment
</span>
<% end %>
<span class="navbar-brand m-0">
<span id="others_payment"></span>
</span>
</div>
<!-- Start Shop Info -->
<div class="navbar-right">
@@ -84,11 +82,6 @@
</nav>
<%end%>
<script type="text/javascript">
if((document.getElementById("otherPayment")!=undefined) && (document.getElementById("otherPayment")!=null) && (document.getElementById("otherPayment")!="")){
var otherPayment = location.href.split('/')[location.href.split('/').length -1 ];
document.getElementById("otherPayment").innerHTML = otherPayment;
}
$(function(){
$('.delete').click(function(){
var method = $(this).attr('data-method');

View File

@@ -144,6 +144,9 @@
<li>
<a href="<%= reports_void_sale_index_path %>">Void Sales</a>
</li>
<li>
<a href="<%= reports_waste_and_spoilage_index_path %>">Wastes & Spoilages</a>
</li>
<li>
<a href="<%= reports_payment_method_index_path %>">Payment Method</a>
</li>

View File

@@ -158,11 +158,19 @@
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
</form>
<div class="login_dashboard p-card">
<i class="material-icons md-48" style="font-size: 100px;">person</i>
<div class="p-name"><b><%= employee.name%></b>
<%if employee.image_path.present? %>
<div class="login_dashboard p-card">
<%= image_tag employee.image_path, :class => "style_image" %>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
</div>
<% else %>
<div class="login_dashboard p-card">
<i class="material-icons style_icon">person</i>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
<% end %>
</div>
<% end %>
<% end %>
@@ -173,11 +181,19 @@
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
</form>
<div class="login_dashboard p-card">
<i class="material-icons md-48" style="font-size: 100px;">person</i>
<div class="p-name"><b><%= employee.name%></b>
<%if employee.image_path.present? %>
<div class="login_dashboard p-card">
<%= image_tag employee.image_path, :class => "style_image" %>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
</div>
<% else %>
<div class="login_dashboard p-card">
<i class="material-icons style_icon">person</i>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
<% end %>
</div>
<% end %>
<% end %>
@@ -189,11 +205,19 @@
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
</form>
<div class="login_dashboard p-card">
<i class="material-icons md-48" style="font-size: 100px;">person</i>
<div class="p-name"><b><%= employee.name%></b>
<%if employee.image_path.present? %>
<div class="login_dashboard p-card">
<%= image_tag employee.image_path, :class => "style_image" %>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
</div>
<% else %>
<div class="login_dashboard p-card">
<i class="material-icons style_icon">person</i>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
<% end %>
</div>
<% end %>
<% end %>
@@ -205,11 +229,19 @@
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
</form>
<div class="login_dashboard p-card">
<i class="material-icons md-48" style="font-size: 100px;">person</i>
<div class="p-name"><b><%= employee.name%></b>
<%if employee.image_path.present? %>
<div class="login_dashboard p-card">
<%= image_tag employee.image_path, :class => "style_image" %>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
</div>
<% else %>
<div class="login_dashboard p-card">
<i class="material-icons style_icon">person</i>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
<% end %>
</div>
<% end %>
<% end %>
@@ -221,11 +253,19 @@
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
</form>
<div class="login_dashboard p-card">
<i class="material-icons md-48" style="font-size: 100px;">person</i>
<div class="p-name"><b><%= employee.name%></b>
<%if employee.image_path.present? %>
<div class="login_dashboard p-card">
<%= image_tag employee.image_path, :class => "style_image" %>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
</div>
<% else %>
<div class="login_dashboard p-card">
<i class="material-icons style_icon">person</i>
<div class="p-name"><b><%= employee.name%></b>
</div>
</div>
<% end %>
</div>
<% end %>
<% end %>

View File

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

View File

@@ -0,0 +1,259 @@
<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.alipay") %></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_alipay = @can_alipay +@rounding_adj%>
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @can_alipay %>" data-member-value="">
</div>
<hr>
</div>
<% if @alipaycount != 0 %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label>Recent Alipay paid amount </label>
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@alipaycount %>" 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="alipay_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(_ALIPAY_);
var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>";
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#validamount').attr("value",parseFloat("<%= @can_alipay %>") - parseFloat(localStorage.getItem("cash")));
}
if(bank_integration == '1'){
if(typeof code2lab != 'undefined'){
code2lab.getCommPorts(); //get comportlists from jade
}else{
swal({
title: 'Oops',
text: 'Alipay is not available in here!',
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment/others_payment";
});
}
}
});
$(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;
}
});
$('#alipay_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(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text();
// var member_discount = $('#member_discount').text();
// if (member_id && member_discount) {
// $.ajax({
// type: "POST",
// url: "/origami/" + sale_id + "/member_discount",
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
// success:function(result){
// }
// });
// }
//end member discount
if(bank_integration == '1'){
pay_withBank("SALE", "alipay", amount, sale_id, receipt_no,cashier_type);
}else{
$.ajax({type: "POST",
url: "<%= origami_payment_alipay_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,
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{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}
})
</script>

View File

@@ -1,2 +1,2 @@
<h1>CashMgmt#index</h1>
<p>Find me in app/views/cash_mgmt/index.html.erb</p>
<p>Find me in app/views/cash_mgmt/index.html.erb</p>

View File

@@ -1,2 +1,3 @@
<h1>CashMgmt#new</h1>
<p>Find me in app/views/cash_mgmt/new.html.erb</p>

View File

@@ -25,7 +25,6 @@
</div>
</div>
<script>
$('#cash_out').on('click',function(){
var reference = $('#reference').val();
var remark = $('#remark').val();

View File

@@ -118,6 +118,7 @@
<span id="cashier_type" class="hidden"><%=@cashier_type%></span>
<script>
$(document).ready(function() {
setHeaderBreadCrumb(_CREDIT_PAYMENTS_);
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#validamount').attr("value",parseFloat("<%= @can_credit %>") - parseFloat(localStorage.getItem("cash")));

View File

@@ -26,7 +26,7 @@
</div>
<% end %>
<button id="member_acc_no" class="btn btn-success btn-sm"><span class="fa fa-credit-card"></span> Member Card</button> -->
<% path ="/origami/#{@sale_id}/customers" %>
<% path ="/origami/#{@sale_id}/#{@cashier_type}/customers/#{@page}" %>
<%= form_tag path, :id => "filter_form", :method => :get do %>
<div class="row clearfix">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
@@ -119,11 +119,13 @@
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
<input type="hidden" id="page" name="page" value="<%= @page %>" />
<%if !@dining_facility.nil?%>
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
<input type="hidden" id="table_type" name="table_type" value="<%= @dining_facility.type %>" />
<%else%>
<input type="hidden" id="table_id" name="table_id" value="" />
<input type="hidden" id="type" name="type" value="" />
<input type="hidden" id="type" name="type" value="" />
<input type="hidden" id="table_type" name="table_type" value="" />
<%end%>
<%= f.error_notification %>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
@@ -291,6 +293,10 @@
}
});
$(document).ready(function () {
setHeaderBreadCrumb(_CUSTOMERS_);
});
// Read Card Reader
$("#member_acc_no").on('click', function(e){
var cardNo = "";
@@ -469,7 +475,7 @@
if(data.status == true)
{
var id = $("#table_id").val();
var type = $("#type").val();
var type = $("#table_type").val();
var booking_id = "";
<% if !@booking_order.nil? %>
booking_id = "<%= @booking_order.booking_id %>";
@@ -502,7 +508,7 @@
$('#back').on('click',function(){
var id = $("#table_id").val();
var type = $("#type").val();
var type = $("#table_type").val();
var sale_id = $("#sale_id").val();
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';

View File

@@ -1,6 +1,7 @@
<div class="container-fluid">
<div class="block-header">
<h2><%= t :dashboard %></h2>
<!-- <h2><%= t :dashboard %></h2> -->
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
</div>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision

View File

@@ -116,25 +116,23 @@
<div class="card-title">
<div class="form-horizontal">
<div class="col-md-12">
<div class="form-group">
<div class="form-group">
<input type="text" id="discount-amount" name="discount-amount" value="<%= @sale_data.total_discount rescue 0 %>" class="form-control" />
<span id="discount-amountErr" style="color:red;"></span>
</div>
<br>
<div class="form-group">
<%
@accounts.each do |acc|
%>
<% @accounts.each do |acc| %>
<button id="account-<%= acc.id %>" class="accounts-type btn bg-default"><%= acc.title %></button>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
<hr />
<div class="p-l-20">
<div class="row">
<hr />
<div class="p-l-20">
<div class="row">
<div class="col-md-8">
<div class="row bottom">
<div class="col-md-3">
@@ -208,12 +206,35 @@
<button id="remove-item" class="btn bg-default fluid action-btn">Clear Discount</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<div><strong id="order-title">Promo Code</strong></div>
</div>
<div class="card-block">
<div class="card-title">
<div class="form-horizontal">
<div class="p-l-20">
<div class="row">
<div class="col-md-8 form-group">
<div class="form-group">
<input type="text" id="promo-code" name="promo-code" value="" class="form-control" /></span>
</div>
</div>
<div class="col-md-4">
<button id="" class="btn bg-primary btn-block action-btn">Promo</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Action Panel -->
@@ -235,6 +256,7 @@
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
setHeaderBreadCrumb(_DISCOUNTS_);
$('#back').on('click',function(){
var id = $("#table_id").text();

View File

@@ -300,7 +300,7 @@
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
@@ -488,11 +488,6 @@
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<% if current_login_employee.role != "waiter" %>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
@@ -511,6 +506,10 @@
<%end%>
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
<% if current_login_employee.role != "waiter" %>
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
<% end %>
<% end %>
<% end %>
<!-- Cashier Buttons -->
@@ -598,8 +597,6 @@
</div>
</div>
<div class="modal-footer ">
</div>
</div>
</div>
@@ -784,12 +781,13 @@
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
alert(parseInt(jQuery.inArray("PAYMAL", type)));
var sale_id = $('#sale_id').val();
// type = $('.payment_method').val();
type = get_selected_attributes('selected-payment');
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
calculate_member_discount(sale_id,"Card");
}else{
@@ -1059,8 +1057,6 @@
if (isConfirm) {
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
var url = "/origami/sale/" + sale_id + '/cashier/waste_and_spoilage';
console.log(url)
$.ajax({
type: 'POST',
url: url,
@@ -1068,10 +1064,10 @@ console.log(url)
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);
// }
// window.location.href = '/origami/';
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/';
}
});
}

View File

@@ -60,6 +60,7 @@
<script type="text/javascript">
$(document).ready(function () {
setHeaderBreadCrumb(_IN_DUTIES_);
});

View File

@@ -44,6 +44,7 @@
</div>
</div>
<script type="text/javascript">
$(document).on('click', ".induty_tr", function () {
$(this).closest('tr').find('.checkbox_check').prop("checked", true);

View File

@@ -121,6 +121,7 @@
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_JCB_);
var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>";
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}

View File

@@ -120,6 +120,7 @@
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_JUNCTIONPAY_);
var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>";
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}

View File

@@ -122,6 +122,7 @@
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_MASTER_);
var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>";
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}

View File

@@ -124,6 +124,7 @@
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_MPU_);
var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>";

View File

@@ -210,7 +210,8 @@
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
$(document).ready(function(){
setHeaderBreadCrumb(_OTHER_CHARGES_);
$(".cashier_number").on('click', function(event){
if(event.handled !== true) {
var original_value=0;

View File

@@ -27,6 +27,9 @@
</div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<script type="text/javascript">
$(document).ready(function () {
setHeaderBreadCrumb(_OTHER_PAYMENTS_);
});
/* start check first bill or not*/
var cashier_type = "<%= @cashier_type %>";
var receipt_no = "";

View File

@@ -0,0 +1,2 @@
json.set! :status, @out[0]
json.set! :message, @out[1]

View File

@@ -0,0 +1,202 @@
<div class="container-fluid">
<!-- <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.right_panel.details.redeem") %></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">
<div class="card m-l-10 m-t-10" style="padding:0px 20px;">
<div class="rebate-form">
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">You can pay up to </label>
<%@payment_prices = @payment_prices +@rounding_adj%>
<input type="text" name="" id="paymentamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payment_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
</div>
<% if @payparcount > 0 %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">Recent Payment Amount </label>
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payparcount %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
</div>
<% end %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">Available Balance </label>
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
</div>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">Payment Balance</label>
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
</div>
<hr>
</div>
</div>
</div>
<!-- <% if @payparcount > 0 %>
<p class="">Last time rebate amount is <%= @payparcount %></p>
<% end %>
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @payment_prices %></span></p> -->
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="m-t-10 p-l-20">
<div class="row">
<div class="col-lg-6 col-md-1 col-sm-1">
<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 green border-left" 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="paymal_payment">Pay</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default m-t-10 btn-lg 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 type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_PAYMAL_);
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#paymentamt').attr("value",parseFloat("<%= @payment_prices %>") - parseFloat(localStorage.getItem("cash")));
}
});
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
event.preventDefault();
if(event.handled !== true) {
var original_value;
original_value = $('#used_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"){
$('#used_amount').text(input_value);
}else{
$('#used_amount').append(input_value);
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#used_amount').html(amount);
break;
case 'clr':
$('#used_amount').html("0.0");
break;
case 'del' :
var cash=$('#used_amount').text();
$('#used_amount').text(cash.substr(0,cash.length-1));
break;
case 'nett':
var remain_amount = $('#paymentamt').val();
$('#used_amount').text(remain_amount);
break;
}
event.handled = true;
} else {
return false;
}
});
$("#paymal_payment").click(function(){
valid_amount = $("#valid_amount").val();
sale_id = $("#valid_amount").attr('data-value');
membership_id = $("#valid_amount").attr('data-member-value');
payment_amount = parseFloat($("#used_amount").text());
if(payment_amount<=0 ){
swal ( "Oops" , "Please type valid amount!" , "warning" );
}else if(valid_amount< payment_amount){
swal ( "Oops" , "Insufficient Amount!" , "warning" );
}else{
if(payment_amount <= "<%= @payment_prices %>"){
$(this).off("click");
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"
});
}else{
swal ( "Information" , result.message);
}
}
})
}else {
swal ( "Oops" , "Payment Amount is over!" , "warning" );
}
}
});
</script>

View File

@@ -182,103 +182,135 @@
<div class="card-title m-l-5 m-r-5">
<!-- mpu -->
<% if @other != 0.0 %>
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">MPU</div>
<div class="col-md-4 mpu is_card" id="others"><%= number_with_precision(@other, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<div class="row payment others-color">
<% else %>
<div class="row hidden">
<div class="col-md-5"></div>
<div class="col-md-3">MPU</div>
<div class="col-md-4" id="others"><%= number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<div class="row hidden">
<% end %>
<div class="col-md-5"></div>
<div class="col-md-3">MPU</div>
<% if @other != 0.0 %>
<div class="col-md-4 mpu is_card" id="others"><%= number_with_precision(@other, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="others"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<!-- paypar -->
<% if @ppamount != 0.0 %>
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">Redeem</div>
<div class="col-md-4" id="ppamount"><%= number_with_precision(@ppamount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% else %>
<div class="row hidden">
<% end %>
<div class="col-md-5"></div>
<div class="col-md-3">Redeem</div>
<% if @ppamount != 0.0 %>
<div class="col-md-4" id="ppamount"><%= number_with_precision(@ppamount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="ppamount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<% end %>
<!-- Visa -->
<% if @visacount != 0.0 %>
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">VISA</div>
<div class="col-md-4 visa is_card" id="visacount"><%= number_with_precision(@visacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% else %>
<div class="row hidden">
<% end %>
<div class="col-md-5"></div>
<div class="col-md-3">VISA</div>
<div class="col-md-4" id="visacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% if @visacount != 0.0 %>
<div class="col-md-4 visa is_card" id="visacount"><%= number_with_precision(@visacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="visacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<% end %>
<!-- JCB -->
<% if @jcbcount != 0.0 %>
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">JCB</div>
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_with_precision(@jcbcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% else %>
<div class="row hidden">
<% end %>
<div class="col-md-5"></div>
<div class="col-md-3">JCB</div>
<div class="col-md-4" id="jcbcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% if @jcbcount != 0.0 %>
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_with_precision(@jcbcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="jcbcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<% end %>
<!-- Master -->
<% if @mastercount != 0.0 %>
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">MASTER</div>
<div class="col-md-4 master is_card" id="mastercount"><%= number_with_precision(@mastercount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% else %>
<div class="row hidden">
<% end %>
<div class="col-md-5"></div>
<div class="col-md-3">MASTER</div>
<div class="col-md-4" id="mastercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% if @mastercount != 0.0 %>
<div class="col-md-4 master is_card" id="mastercount"><%= number_with_precision(@mastercount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="mastercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<% end %>
<!-- <br> -->
<!-- UNIONPAY -->
<% if @unionpaycount != 0.0 %>
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">UNIONPAY</div>
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_with_precision(@unionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% else %>
<div class="row hidden">
<% end %>
<div class="col-md-5"></div>
<div class="col-md-3">UNIONPAY</div>
<div class="col-md-4" id="unionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% if @unionpaycount != 0.0 %>
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_with_precision(@unionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="unionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<!-- Alipay -->
<% if @alipaycount != 0.0 %>
<div class="row payment others-color">
<% else %>
<div class="row hidden">
<% end %>
<div class="col-md-5"></div>
<div class="col-md-3">Alipay</div>
<% if @alipaycount != 0.0 %>
<div class="col-md-4 alipay is_card" id="alipaycount"><%= number_with_precision(@alipaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="alipaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<div class="row payment <%= @paymalcount!=0.0 ? 'payment others-color' : 'hidden'%>">
<div class="col-md-5"></div>
<div class="col-md-3">PAYMAL</div>
<% if @paymalcount != 0.0 %>
<div class="col-md-4 master is_card" id="paymalcount"><%= number_with_precision(@paymalcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="paymalcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<!-- Junction Pay -->
<% if @junctionpaycount != 0.0 %>
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">JUNCTION PAY</div>
<div class="col-md-4 master is_card" id="junctionpaycount"><%= number_with_precision(@junctionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% else %>
<div class="row hidden">
<% end %>
<!-- PAYMAL -->
<div class="col-md-5"></div>
<div class="col-md-3">JUNCTION PAY</div>
<div class="col-md-4" id="junctionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% if @junctionpaycount != 0.0 %>
<div class="col-md-4 master is_card" id="junctionpaycount"><%= number_with_precision(@junctionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %>
<div class="col-md-4" id="junctionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %>
</div>
<% end %>
<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>
@@ -340,6 +372,8 @@
</button>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
<% if @cashier_type=="quick_service" %>
<hr>
@@ -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");
}
}
});
}
});
}
</script>

View File

@@ -13,4 +13,9 @@
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment';"> Back </button>
</div>
<div>
<div>
<script>
$(document).ready(function () {
setHeaderBreadCrumb(_PAYPAR_PAYMENT_);
});
</script>

View File

@@ -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);
}

View File

@@ -121,6 +121,7 @@
</div>
<script>
$(document).ready(function () {
setHeaderBreadCrumb(_COMMISSIONS_);
var selected_sale_item = 0;
$('.sale_item').on('click', function () {

View File

@@ -109,6 +109,7 @@
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_REDEEM_PAYMENT_);
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#redeemamt').attr("value",parseFloat("<%= @redeem_prices %>") - parseFloat(localStorage.getItem("cash")));
@@ -176,7 +177,6 @@
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
success: function(result){
if(result.status == true){
console.log(result)
swal({
title: "Information!",
text: result.message,

View File

@@ -370,7 +370,7 @@
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
@@ -450,10 +450,11 @@
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
<% if current_login_employee.role != "waiter" %>
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button>
@@ -512,6 +513,32 @@
</div>
</div>
</div>
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
</div>
<div class="modal-body">
<div class="row p-r-20">
<div class="col-md-3">
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')"><strong>Spoile</strong></button>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button>
</div>
</div>
</div>
<div class="modal-footer ">
</div>
</div>
</div>
</div>
<script>
var cashier_type = "cashier";
$(document).ready(function(){
@@ -714,13 +741,12 @@ $("#first_bill").on('click', function(){
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
var sale_id = $('#sale_id').val();
type = get_selected_attributes('selected-payment');
// type = $('.payment_method').val();
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL", type)) != -1) {
calculate_member_discount(sale_id,"Card");
}else{
@@ -979,4 +1005,34 @@ $('#add_invoice').on('click',function(){
});
return attribute_arr;
}
function waste_and_spoilage(remark) {
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 sale_id = "<%= @obj_sale.sale_id rescue "" %>"
var url = "/origami/sale/" + sale_id + '/cashier/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);
}
window.location.href = '/origami/';
}
});
}
});
}
</script>

View File

@@ -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'));

View File

@@ -54,7 +54,14 @@
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<%= image_tag("slider/s2.jpg", :alt => "rss feed") %>
<div id="wowslider-container" style="max-width: 100%;">
<div class="ws_images full_screen">
<% @display_images.each do |p| %>
<%= image_tag "#{p.image}", :alt => "rss feed"%>
<% break %>
<% end %>
</div>
</div>
</div>
</div>

View File

@@ -2,17 +2,19 @@
<%= javascript_include_tag 'wowslider', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'wow_script', 'data-turbolinks-track': 'reload' %>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div id="wowslider-container" style="max-width: 100%;">
<div class="ws_images full_screen">
<ul>
<li><%= image_tag("slider/s1.jpg", :alt => "rss feed") %></li>
<li><%= image_tag("slider/s2.jpg", :alt => "rss feed") %></li>
<li><%= image_tag("slider/s4.jpg", :alt => "rss feed") %></li>
</ul>
</div>
<div class="ws_bullets"></div>
<div class="col-lg-12 col-md-12 col-sm-12">
<div id="wowslider-container" style="max-width: 100%;">
<div class="ws_images full_screen">
<ul>
<% @display_images.each do |p| %>
<li>
<%= image_tag "#{p.image}", :alt => "rss feed"%>
</li>
<% end %>
</ul>
</div>
<div class="ws_bullets"></div>
</div>
</div>
</div>

View File

@@ -335,6 +335,7 @@
var split_receipt_no = "";
var cashier_type = '<%= @cashier_type %>';
$(document).ready(function(){
setHeaderBreadCrumb(_SPLIT_BILL_);
$('#back').on('click',function(){
backToOrigami();
})

View File

@@ -196,6 +196,7 @@
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
setHeaderBreadCrumb(_SURVEY_);
//click add button for new row
$('#addForeigner').on('click',function(){
$('#newTemplate').removeClass('hidden');

View File

@@ -123,6 +123,7 @@
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_UNION_);
var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>";

View File

@@ -122,6 +122,7 @@
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_VISA_);
var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>";

View File

@@ -98,6 +98,8 @@
<script>
$(document).ready(function() {
setHeaderBreadCrumb(_VOUCHER_);
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#validamount').attr("value",parseFloat("<%= @can_voucher %>") - parseFloat(localStorage.getItem("cash")));

38
app/views/reports/product_sale/index.html.erb Executable file → Normal file
View File

@@ -45,41 +45,58 @@
<th><%= t("views.right_panel.detail.code") %></th>
<th><%= t("views.right_panel.detail.product") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t("views.right_panel.detail.unit_price") %></th>
<!-- <th><%= t("views.right_panel.detail.unit_price") %></th> -->
<th><%= t("views.right_panel.detail.total") %></th>
</tr>
</thead>
<tbody id="tbd_data">
<% unless @sale_data.blank? %>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% cate_arr = Array.new %>
<% grand_total = 0 %>
<% total_qty = 0 %>
<% total_item = {} %>
<% total_data = {} %>
<% @sale_data.each do |sale|
if !total_item.has_key?(sale.item_code)
total_item[sale.item_code] = sale.total_item
total_data[sale.item_code] = sale.grand_total
else
if sale.status_type == "void"
total_item[sale.item_code] += sale.total_item
end
if sale.status_type == "void" || sale.status_type == "Discount" || sale.status_type == "foc"
total_data[sale.item_code] += sale.grand_total
end
end
end %>
<% @sale_data.each do |sale| %>
<% grand_total += sale.grand_total %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if !sale.status_type %>
<% if sale.status_type != "Discount" && sale.price.to_f >= 0 %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<% cate_arr = Array.new %>
<% if sale.total_item > 0 %>
<% cate_arr = Array.new %>
<% end %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
<td><%= total_item[sale.item_code] rescue '-' %></td>
<!-- <td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td><%= number_with_precision(total_data[sale.item_code] , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
</tr>
<!-- sub total -->
<!-- end sub total -->
@@ -89,7 +106,6 @@
<td colspan="3"></td>
<td><strong>Total</strong></td>
<td><strong><%= total_qty %></strong></td>
<td></td>
<td><strong><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></strong></td>
</tr>

30
app/views/reports/product_sale/index.xls.erb Executable file → Normal file
View File

@@ -11,7 +11,7 @@
<th><%= t("views.right_panel.detail.code") %></th>
<th><%= t("views.right_panel.detail.product") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t("views.right_panel.detail.unit_price") %></th>
<!-- <th><%= t("views.right_panel.detail.unit_price") %></th> -->
<th><%= t("views.right_panel.detail.total") %></th>
</tr>
</thead>
@@ -21,6 +21,21 @@
<% cate_arr = Array.new %>
<% grand_total = 0 %>
<% total_qty = 0 %>
<% total_item = {} %>
<% total_data = {} %>
<% @sale_data.each do |sale|
if !total_item.has_key?(sale.item_code)
total_item[sale.item_code] = sale.total_item
total_data[sale.item_code] = sale.grand_total
else
if sale.status_type == "void"
total_item[sale.item_code] += sale.total_item
end
if sale.status_type == "void" || sale.status_type == "Discount" || sale.status_type == "foc"
total_data[sale.item_code] += sale.grand_total
end
end
end %>
<% @sale_data.each do |sale| %>
<% grand_total += sale.grand_total %>
@@ -31,21 +46,23 @@
total_qty += sale.total_item
end %>
<% if !sale.status_type %>
<% if sale.status_type != "Discount" && sale.price.to_f >= 0 %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<% cate_arr = Array.new %>
<% if sale.total_item > 0 %>
<% cate_arr = Array.new %>
<% end %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue ' ' %></td>
<td><%= sale.unit_price rescue ' ' %></td>
<td><%= sale.grand_total rescue ' ' %></td>
<td><%= total_item[sale.item_code] rescue ' ' %></td>
<!-- <td><%= sale.unit_price rescue ' ' %></td> -->
<td><%= total_data[sale.item_code] rescue ' ' %></td>
</tr>
<!-- sub total -->
<!-- end sub total -->
@@ -55,7 +72,6 @@
<td colspan="3"></td>
<td><strong>Total</strong></td>
<td><strong><%= total_qty rescue ' ' %></strong></td>
<td></td>
<td><strong><%= grand_total rescue ' ' %></strong></td>
</tr>
<% end %>

View File

@@ -0,0 +1,73 @@
<div class="p-l-15">
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %>
<div class="row">
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14">Type</label>
<select name="sale_type" id="sel_sale_type" class="form-control">
<%if @sale_type=="waste" %>
<option value="waste" selected>Waste</option>
<% else %>
<option value="waste">Waste</option>
<% end %>
<%if @sale_type=="spoile" %>
<option value="spoile" selected>Spoilage</option>
<% else %>
<option value="spoile">Spoilage</option>
<% end %>
</select>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option>
<option value="1">Yesterday</option>
<option value="2">This week</option>
<option value="3">Last week</option>
<option value="4">Last 7 days</option>
<option value="5">This month</option>
<option value="6">Last month</option>
<option value="7">Last 30 days</option>
<option value="8">This year</option>
<option value="9">Last year</option>
</select>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
</div>
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20">
<br>
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
</div>
<% end %>
<% end %>
</div>
<script type="text/javascript">
<% if params[:shift_name].to_i > 0%>
shift_id = '<%= params[:shift_name] %>'
local_date = '<%= @shift_from %> - <%= @shift_to %> '
var shift = $('#shift_name');
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
shift.append(str);
<% end %>
$("#from").val("<%=params[:from] rescue '-'%>");
$("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
</script>

View File

@@ -0,0 +1,75 @@
<div class="container-fluid">
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-md-12">
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_waste_and_spoilage_index_path} %>
<hr />
<div class="text-right">
<a href="javascript:export_to('<%=reports_waste_and_spoilage_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div>
<div class="margin-top-20">
<div class="card">
<table class="table table-striped" border="0">
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<% @sale_data.each do |sale| %>
<% waste_and_spoil_item_count = 0%>
<thead>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td ><strong>Item Name</strong></td>
<td ><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
</tr>
<% end %>
<% end %>
<tr>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td><span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
</tbody>
<% end %>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,58 @@
<div class="row">
<div class="col-md-12">
<div class="margin-top-20">
<div class="card">
<table class="table table-striped" border="0">
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<% @sale_data.each do |sale| %>
<% waste_and_spoil_item_count = 0%>
<thead>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td ><strong>Item Name</strong></td>
<td ><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
</tr>
<% end %>
<% end %>
<tr>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td><span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
</tbody>
<% end %>
</table>
</div>
</div>
</div>
</div>

View File

@@ -40,30 +40,22 @@
</div>
</div>
<label>Shop Images</label>
<div class="panel padding-10">
<div class="form-group">
<div class="menu-item-img">
<%= f.fields_for :display_images do |p| %>
<div class="field">
<%= p.label :image %><br>
<%= image_tag p.object.image, :class => "img-thumbnail" %>
<%= p.file_field :image, :multiple => true, name: "display_images[image][]" %>
<%= link_to "Destroy", settings_shop_display_image_path(p.object), method: :delete %>
</div>
<% end %>
<div class="card">
<div class="card-block">
<label class="card-title">Shop Images</label>
<div class="panel padding-10">
<div class="form-group">
<div class="menu-item-img">
<%= f.fields_for :display_images do |p| %>
<%= image_tag "#{p.object.image}", :class => "img-thumbnail second-display", :size => "150x185"%>
<%= link_to '<i class="material-icons">delete</i>'.html_safe, settings_shop_display_image_path(p.object), method: :delete %>
<% end %>
</div>
</div>
</div>
</div>
<!-- <%= f.fields_for :display_images do |p| %>
<div class="field">
<%= p.label :image %><br>
<%= p.file_field :image, :multiple => true, name: "display_images[image][]" %>
</div>
<% end %> -->
</div>
</div>
<%= f.file_field :image, :multiple => true, name: "display_images[image][]" %>
</div>
<div class="form-actions p-l-15">
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>

View File

@@ -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 %>

View File

@@ -97,13 +97,13 @@
</tr>
<tr>
<td style="width:20%">Shop Image</td>
<td><%= image_tag @settings_shop.logo, :size => '200x200'%></td>
<td><%= image_tag @settings_shop.logo, :class => "img-thumbnail second-display", :size => "155x185"%></td>
</tr>
<tr>
<td style="width:20%">Shop Images</td>
<td>
<% @display_images.each do |p| %>
<%= image_tag p.image , :size => '200x200'%><br>
<%= image_tag "#{p.image}", :class => "img-thumbnail second-display", :size => "155x185"%>
<% end %>
</td>
</tr>

View File

@@ -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

View File

@@ -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"

View File

@@ -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: "အကြွေး ရောင်းရငွေ"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Origami::AlipayController, type: :controller do
end

View File

@@ -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

View File

@@ -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

View File

@@ -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