Compare commits

..

10 Commits

Author SHA1 Message Date
Dev Team
0ba20f45b3 toggle mmqr cancel amount in dailysale and filter in void sale 2025-07-28 19:21:46 +06:30
DevTeam
cfa73532db tweak order_summary and receipt bill pdfs 2025-07-28 17:07:10 +06:30
DevTeam
ca6bb56fc3 feat: overall foc 2025-07-28 16:44:18 +06:30
Dev Team
904698180c discount second display in card 2025-07-28 11:26:56 +06:30
Aung Phyo Thant
d97bada5e6 Fix: Void amount in Daily Sale Report was not being handled correctly. 2025-07-16 15:38:12 +06:30
DevTeam
d52bbd6de1 fix: typo in dailysale 2025-07-16 10:32:36 +06:30
Dev Team
fc69dc2293 change tax in qrpay precreate 2025-07-14 14:51:46 +06:30
Dev Team
a603223f1c update second display for qrpay 2025-07-14 14:39:06 +06:30
DevTeam
04e03896b9 fixes
- no tax after edit, discount, other charges
- redirect after discount, edit and other changes
2025-07-04 16:37:24 +06:30
aungthetkhaing
f003900fee get response from foodcourt server and save this response in audit
record every response from kbz api
2025-07-04 16:37:24 +06:30
19 changed files with 296 additions and 117 deletions

View File

@@ -289,5 +289,27 @@ App.checkin = App.cable.subscriptions.create("SecondDisplayViewChannel", {
jQuery("#s_reload").click();
}, 3000);
}
if (status == "reload_and_update") {
$(".second_display_items tbody").empty();
console.log("data.data", data.data);
var items = items.items
for (var i in items) {
$(".second_display_items tbody").append(
`<tr>
<td>${parseInt(i) + 1}</td>
<td>${items[i].product_name}</td>
<td>${parseInt(items[i].qty)}</td>
<td>${items[i].price}</td>
</tr>
`,
);
}
$("#s_sub_total").text(data.data.subtotal);
$("#s_tatal_tax").text(data.data.total_tax);
$("#s_total_discount").text(data.data.total_discount);
$("#s_grand_total").text(data.data.grand_total);
}
},
});

View File

@@ -18,7 +18,7 @@ class Foodcourt::QrpayController < BaseFoodcourtController
sale_id = params[:sale_id]
@trans_flag = true
@cashier_type = params[:cashier_type] || session[:cashier_type] || "food_court_qr"
@cashier_type = params[:cashier_type] || session[:cashier_type] || "food_court"
Rails.logger.info "Precreate action called with params: #{@cashier_type}"
# if params[:type] == "transaction"
@@ -35,6 +35,18 @@ class Foodcourt::QrpayController < BaseFoodcourtController
@member_discount = MembershipSetting.find_by_discount(1)
@membership_rebate_balance=0
@changable_tax = true
lookup_changable_tax = Lookup.collection_of('changable_tax')
if !lookup_changable_tax.empty?
lookup_changable_tax.each do |changable_tax|
if changable_tax[0].downcase == "change"
if changable_tax[1] == '0'
@changable_tax = false
end
end
end
end
if Sale.exists?(sale_id)
begin
@cash = 0.0
@@ -421,6 +433,9 @@ class Foodcourt::QrpayController < BaseFoodcourtController
def create
sale_id = params[:sale_id]
Rails.logger.info("Processing payment for sale ID: #{sale_id}")
Rails.logger.info("#{params[:response_data]}")
unless current_login_employee
render json: { status: false, message: "User not authenticated or employee context missing." }, status: :unauthorized
return
@@ -434,10 +449,10 @@ class Foodcourt::QrpayController < BaseFoodcourtController
PaymentGatewayAuditJob.perform_later({
receipt_no: Sale.find_by(sale_id: sale_id).receipt_no,
gateway_name: "MMQR",
endpoint_url: "",
endpoint_url: "Response from foodcourt server",
event_type: "kbz.payment.success",
request_body: {},
response_body: {},
response_body: params[:response_data].to_json,
request_method: nil,
shop_code: Shop.current_shop.shop_code
})

View File

@@ -751,6 +751,14 @@ class Sale < ApplicationRecord
.where('(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ', 'completed', 'void', from, to)
.group('sale_id')
void_audits = SaleAudit.select(
"`sale_audits`.`sale_id`",
"`sale_audits`.`action`",
"MAX(`sale_audits`.`created_at`) as latest_audit"
)
.where(action: ['SALEVOID', 'CANCEL_MMQR_PAYMENT'])
.group("`sale_audits`.`sale_id`")
commercial_tax = ''
if tax_profiles.present?
sale_taxes = sale_taxes.select(tax_profiles.map { |name| "SUM(case when (sale_taxes.tax_name = '#{name}') then sale_taxes.tax_payable_amount else 0 end) as `#{name.parameterize}`"}.join(', '))
@@ -765,8 +773,8 @@ class Sale < ApplicationRecord
IFNULL(SUM(case when (sale_status='completed') then old_grand_total else 0 end),0) as old_grand_total,
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
IFNULL(SUM(case when (sale_status='completed') then amount_changed else 0 end),0) as total_change_amount,
IFNULL(SUM(case when (sale_status='void' AND sa_salevoid.sale_audit_id IS NOT NULL) then grand_total else 0 end),0) as void_amount,
IFNULL(SUM(case when (sale_status='void' AND sa_mmqr.sale_audit_id IS NOT NULL) then grand_total else 0 end),0) as mmqr_cancelled_void_amount,
IFNULL(SUM(CASE WHEN sale_status = 'void' AND void_audits.action = 'SALEVOID' THEN grand_total ELSE 0 END),0) as void_amount,
IFNULL(SUM(CASE WHEN sale_status = 'void' AND void_audits.action = 'CANCEL_MMQR_PAYMENT' THEN grand_total ELSE 0 END),0) as mmqr_cancelled_void_amount,
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj,
#{tax_profiles.map { |name| "IFNULL(SUM(case when (sale_status='completed') then `#{name.parameterize}` else 0 end),0) as `#{name.parameterize}`"}.push('').join(', ') if tax_profiles.present?}
IFNULL(SUM(case when (sale_status='completed') then total_tax else 0 end),0) as tax,
@@ -785,8 +793,7 @@ class Sale < ApplicationRecord
#{sales.to_sql}
) as s
LEFT JOIN (#{sale_taxes.to_sql}) AS st ON s.sale_id = st.sale_id
LEFT JOIN sale_audits sa_salevoid ON s.sale_id = sa_salevoid.sale_id AND sa_salevoid.action = 'SALEVOID'
LEFT JOIN sale_audits sa_mmqr ON s.sale_id = sa_mmqr.sale_id AND sa_mmqr.action = 'CANCEL_MMQR_PAYMENT'
LEFT JOIN (#{void_audits.to_sql}) AS `void_audits` ON `void_audits`.`sale_id` = `s`.`sale_id`
GROUP BY DATE(CONVERT_TZ(receipt_date,'+00:00','+06:30'))").to_hash.map(&:symbolize_keys)
return daily_total
end

View File

@@ -84,7 +84,7 @@ class SalePayment < ApplicationRecord
amount_due = invoice.sale_payments
.map(&:payment_amount).reduce(invoice.grand_total, :-)
end
# byebug
if amount_due > 0
payment_status = false
membership_data = nil
@@ -169,11 +169,20 @@ class SalePayment < ApplicationRecord
end
else
sale_update_payment_status(0)
membership_data = nil
#route to payment type
case payment_method
when "foc"
payment_status = foc_payment
when "paymal"
payment_status, membership_data = paymal_payment
end
#record an payment in sale-audit
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by.name)
return false, "No outstanding Amount"
return false, "No outstanding Amount", membership_data
end
end

View File

@@ -121,39 +121,47 @@ class OrderSummaryPdf < Prawn::Document
# Add order items under order info
def add_order_items(order_item, alt_name, precision)
y_position = cursor
order = order_item.first.order
sale_orders = order.sale_orders
sale = Sale.find_by(sale_id: sale_orders.first.sale_id)
sale_items = sale.sale_items.order(:product_name)
move_down 5
order_item.each do|odi|
sale_items.each do|sale_item|
# check for item not to show
# if odi.price != 0
if sale_item.status == 'foc' || sale_item.status == 'Discount'
next
end
y_position = cursor
bounding_box([0,y_position], :width => self.item_width) do
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
text "#{sale_item.product_code} - #{sale_item.product_name}", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_width,y_position], :width => self.qty_width) do
text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
text "#{number_format(sale_item.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
end
bounding_box([0,y_position], :width => self.item_width) do
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
text "#{sale_item.product_code} - #{sale_item.product_name}", :size => self.item_font_size,:align => :left
end
if alt_name
if !(odi.alt_name).empty?
if !(sale_item.alt_name).empty?
move_down 4
# font("public/fonts/NotoSansCJKtc-Regular.ttf") do
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
text "(#{sale_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
# end
end
end
# add option
odi = OrderItem.where(item_instance_code: sale_item.item_instance_code).first
options = odi.options == "[]"? "" : odi.options
if options != ""
@@ -174,6 +182,57 @@ class OrderSummaryPdf < Prawn::Document
move_down 5
# end
end
# order_item.each do|odi|
# # check for item not to show
# # if odi.price != 0
# y_position = cursor
# bounding_box([0,y_position], :width => self.item_width) do
# text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
# end
# bounding_box([self.item_width,y_position], :width => self.qty_width) do
# text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
# end
# bounding_box([0,y_position], :width => self.item_width) do
# text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
# end
# if alt_name
# if !(odi.alt_name).empty?
# move_down 4
# # font("public/fonts/NotoSansCJKtc-Regular.ttf") do
# text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
# # end
# end
# end
# # add option
# options = odi.options == "[]"? "" : odi.options
# if options != ""
# move_down 5
# y_position = cursor
# bounding_box([0,y_position], :width => self.item_width) do
# text "#{options}", :size => self.item_font_size,:align => :left
# end
# move_down 5
# end
# move_down 5
# dash(1, :space => 1, :phase => 1)
# stroke_horizontal_line 0, (self.page_width - self.margin)
# move_down 5
# # end
# end
end
def get_booking_id(order_no)

View File

@@ -252,7 +252,7 @@ class ReceiptBillPdf < Prawn::Document
show_price = Lookup.find_by_lookup_type("show_price")
sale_items.each do |item|
# check for item not to show
if item.status != 'Discount' && item.qty > 0
if !show_price.nil? && show_price.value.to_i > 0 && item.price == 0
total_qty += item.qty
@@ -263,6 +263,10 @@ class ReceiptBillPdf < Prawn::Document
end
end
if item.qty < 0 && item.status == 'void'
total_qty += item.qty
end
product_name = item.product_name
# if item.status = 'promotion' && (item.remark =='promotion nett price' || item.remark == 'promotion discount')

View File

@@ -56,6 +56,16 @@ class KbzMerchant
api_url = "#{@url}/queryorder"
payload = build_query_payload(merch_order_id)
response = send_request(payload, api_url)
PaymentGatewayAuditJob.perform_later({
receipt_no: merch_order_id,
gateway_name: "MMQR",
endpoint_url: api_url,
event_type: "kbz.payment.queryorder",
request_body: payload,
response_body: response,
request_method: "POST",
shop_code: Shop.current_shop.shop_code
})
handle_response(response)
end

View File

@@ -40,7 +40,7 @@
<tbody>
<% sub_total = 0 %>
<% @sale_data.sale_items.includes(:discount_item).each do |sale_item| %>
<% sub_total += sale_item.qty * sale_item.unit_price %>
<% sub_total += sale_item.status == "Discount"? sale_item.price : sale_item.qty * sale_item.unit_price %>
<% if sale_item.price > 0 && sale_item.status.blank? %>
<tr class="item-row item" id="<%= sale_item.sale_item_id %>"
data-account-type="<%=sale_item.account_id%>"
@@ -271,6 +271,8 @@
var precision = <%= precision %>;
var originalAmount = totalAmount;
var originalDiscount = totalDiscount;
var queryParams = new URLSearchParams(window.location.search)
$(document).ready(function(){
setHeaderBreadCrumb(_DISCOUNTS_);
/* check webview loaded*/
@@ -281,17 +283,10 @@
var id = $("#table_id").text();
var type = $("#table_type").text();
var sale_id = $('#sale-id').text();
if (cashier_type=="quick_service" || cashier_type=="food_court") {
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
} else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
} else if (cashier_type == 'food_court_qr') {
window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
}
else{
if (type=="Table") {
window.location.href = '/foodcourt/table/'+id
}else{
window.location.href = '/foodcourt/room/'+id
}
}
})
@@ -488,12 +483,7 @@
var sub_total = totalAmount;
var ajax_url = "/foodcourt/" + sale_id + "/discount";
if (cashier_type == "food_court_qr") {
var c_type = "food_court";
var params = { 'cashier_type' : c_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
}else{
var params = { 'cashier_type' : cashier_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
}
var params = { 'cashier_type' : cashier_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
$.ajax({
type: "POST",
@@ -505,18 +495,11 @@
title: "Information!",
text: result.status,
}, function () {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else if(cashier_type == "food_court_qr") {
window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
}
else{
if(result.table_type == "Table"){
window.location.href = "/foodcourt/table/" + result.table_id
}
else {
window.location.href = "/foodcourt/room/" + result.table_id
}
else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
});
}
@@ -554,15 +537,11 @@
text: result.status,
type: "success",
}, function () {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
}
else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
window.location.href = "/foodcourt/table/" + result.table_id
}
else {
window.location.href = "/foodcourt/room/" + result.table_id
}
}
});
}
@@ -581,15 +560,11 @@
text: result.status,
type: "success",
}, function () {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
}
else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
window.location.href = "/foodcourt/table/" + result.table_id
}
else {
window.location.href = "/foodcourt/room/" + result.table_id
}
}
});
}

View File

@@ -32,7 +32,7 @@
<% sub_total = 0 %>
<% @sale_data.sale_items.each do |sale_item| %>
<%
sub_total += sale_item.qty*sale_item.unit_price
sub_total += sale_item.status == "Discount" ? sale_item.price : sale_item.qty*sale_item.unit_price
unless sale_item.price == 0
%>
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
@@ -200,7 +200,7 @@
<%if !@table.nil?%>
<button type="button" class="btn btn-block btn-default waves-effect" onclick="window.location.href='/foodcourt/<%=@table.type.downcase%>/<%=@table.id%>'" id="back"><i class="material-icons">reply</i> Back</button>
<%else%>
<button type="button" class="btn btn-block btn-default waves-effect" onclick="window.location.href='/foodcourt/sale/<%=@sale_data.sale_id%>/<%=@cashier_type%>/payment'" id="back"><i class="material-icons">reply</i> Back</button>
<button type="button" class="btn btn-block btn-default waves-effect" id="back"><i class="material-icons">reply</i> Back</button>
<%end%>
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>Refresh</button>
<hr>
@@ -210,6 +210,7 @@
</div>
</div>
<script type="text/javascript">
var queryParams = new URLSearchParams(window.location.search);
function otherCharges(val){
var aa = parseInt(val);
@@ -273,6 +274,10 @@
}
});
$('#back').on('click', function() {
window.location.href = '/foodcourt/<%= @sale_data.sale_id %>/qrpay/precreate';
});
// Remove selected discount items
$("#remove-item").on('click', function(e){
e.preventDefault();
@@ -336,19 +341,11 @@
text: "Success",
type:"success"
}, function () {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
} else if (cashier_type == "food_court_qr") {
window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
} else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
else{
if(result.table_type == "Table"){
window.location.href = "/foodcourt/table/" + result.table_id
}
else {
window.location.href = "/foodcourt/room/" + result.table_id
}
}s
});
}
});

View File

@@ -212,9 +212,11 @@
<% if @sale_payment.nil? %>
<hr>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> Foc</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<% else %>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> > 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-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<% end %>
@@ -407,6 +409,17 @@
<%= render "layouts/read_modal" %>
<script type="text/javascript">
$.post('/foodcourt/customer_view', {
data: {
items: <%= raw @sale_data.sale_items.to_json %>,
subtotal: <%= number_with_precision(@sale_data.total_amount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i) %>,
total_discount: <%= number_with_precision(@sale_data.total_discount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>,
total_tax: <%= number_with_precision(@sale_data.total_tax, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>,
grand_total: <%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i) %>,
},
status: "reload_and_update"
}, function(result) {}, 'json');
// //control borwser back
window.location.hash="no-back-button";
window.location.hash="Again-No-back-button";//again because google chrome don't insert first hash into history

View File

@@ -326,6 +326,8 @@ $(document).ready(function() {
let fallbackTimeout;
let connected = false;
let fc_server_response;
function handlePaymentSuccess() {
if (paymentProcessed) return;
paymentProcessed = true;
@@ -347,7 +349,7 @@ $(document).ready(function() {
headers: {
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
},
data: JSON.stringify({ sale_id: "<%= @sale_data.sale_id %>" }),
data: JSON.stringify({ sale_id: "<%= @sale_data.sale_id %>", response_data: fc_server_response }),
success: (data) => {
if (data.status) {
customer_display_view({
@@ -411,6 +413,7 @@ $(document).ready(function() {
received(data) {
console.log("Received:", data);
if (data.status === "PAY_SUCCESS" && !paymentProcessed) {
fc_server_response = data
clearTimeout(fallbackTimeout);
handlePaymentSuccess();
}

View File

@@ -259,9 +259,11 @@
<% if @sale_payment.nil? %>
<hr>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> Foc</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<% else %>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> > 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-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<% end %>
@@ -465,6 +467,19 @@ var paymalcount = <%= @paymalcount %>;
var customer_paypar_account = '<%= @sale_data.customer.paypar_account_no %>';
// console.log(pdf_view)
$(document).ready(function(){
$.post('/foodcourt/customer_view', {
data: {
items: <%= raw @sale_data.sale_items.to_json %>,
subtotal: <%= number_with_precision(@sale_data.total_amount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i) %>,
total_discount: <%= number_with_precision(@sale_data.total_discount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>,
total_tax: <%= number_with_precision(@sale_data.total_tax, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>,
grand_total: <%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i) %>,
},
status: "reload_and_update"
}, function(result) {}, 'json');
$("#read_modal").modal('hide');
/* replace url type*/
if(!trans_flag){
@@ -557,7 +572,7 @@ $(document).ready(function(){
var sale_id = $('#save_order_id').attr('data-order');
}
if (sale_id != "") {
window.location.href = '/foodcourt/' + sale_id +"/"+cashier_type+ '/other_charges'
window.location.href = '/foodcourt/' + sale_id +"/"+cashier_type+ '/other_charges?payment_type=qr'
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
@@ -575,7 +590,7 @@ $(document).ready(function(){
}
if (sale_id != "") {
window.location.href = '/foodcourt/' + sale_id + "/"+cashier_type+'/discount'
window.location.href = '/foodcourt/' + sale_id + "/"+cashier_type+'/discount?payment_type=qr'
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
@@ -591,9 +606,9 @@ $(document).ready(function(){
var sale_id = $('#sale_id').text();
if ($(this).attr('active')=== "true") {
if (dining_id) {
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit?payment_type=qr";
}else{
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit";
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit?payment_type=qr";
}
}else{
@@ -1010,7 +1025,7 @@ $(document).ready(function(){
if (type == "edit") {
var dining_id = $('#dining').text();
var sale_id = $('#sale_id').text();
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit";
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit?payment_type=qr";
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
@@ -1175,7 +1190,7 @@ $(document).ready(function(){
if(data.status){
// console.log(type);
localStorage.setItem("tax_type", type);
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment';
window.location.reload();
}
}
});

View File

@@ -237,6 +237,8 @@
<script>
var cashier_type = "<%= @cashier_type %>";
var access_code = localStorage.getItem("access_code");
var queryParams = new URLSearchParams(window.location.search);
// Bill Request
$(document).ready(function () {
@@ -370,15 +372,12 @@ var access_code = localStorage.getItem("access_code");
$('#back').on('click', function () {
var table_id = '<%= @table_id %>'
var sale_id = "<%= @saleobj.sale_id %>"
if (cashier_type=="quick_service" || cashier_type == "food_court") {
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
} else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
else if(cashier_type=="food_court_qr"){
window.location.href = '/foodcourt/'+sale_id+'/'+ 'qrpay' +'/precreate';
}
else{
window.location.href = '/foodcourt/table/' + table_id;
}
})
$('#cancel_all_void').on('click', function () {
@@ -403,16 +402,11 @@ var access_code = localStorage.getItem("access_code");
url: ajax_url,
data: 'sale_id=' + sale_id+'&type='+cashier_type,
success: function (result) {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
} else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
else if(cashier_type=="food_court_qr"){
window.location.href = '/foodcourt/'+sale_id+'/'+ 'qrpay' +'/precreate';
}
else{
window.location.href = '/foodcourt/table/' + table_id;
}
}
});
})

View File

@@ -37,7 +37,7 @@
<td class="text-right item-attr"><strong id="s_total_discount"></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax Amount (5%):</strong></td>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="text-right item-attr"><strong id="s_tatal_tax"></strong></td>
</tr>
<tr class="table-active">

View File

@@ -57,6 +57,9 @@
.new-design-navbar .navbar-brand:hover {
opacity: 0.9;
}
.new-design-navbar .navbar-brand img {
margin-right: 8px;
}
.new-design-navbar .navbar-brand .material-icons {
margin-right: 8px;
@@ -145,25 +148,60 @@
font-feature-settings: 'liga';
}
/* Responsive Styles */
@media (max-width: 768px) {
.new-design-navbar .navbar-center-section {
/* display: none; */
}
.new-design-navbar .navbar-right-section .connection-status-text,
.new-design-navbar .navbar-right-section .user-name-text {
display: none;
}
.new-design-navbar .navbar-right-section .nav-item {
margin-left: 8px;
padding: 0 5px;
}
.new-design-navbar .navbar-brand {
font-size: 1rem;
}
.new-design-navbar .bars-toggle {
margin-right: 10px;
}
}
@media (max-width: 480px) {
.new-design-navbar .navbar-brand-text {
display: none;
}
.new-design-navbar .navbar-brand img {
margin-right: 0;
}
}
</style>
<%# Top Bar - New Design %>
<% if !request.path_info.include?('second_display') %>
<nav class="navbar new-design-navbar mb-1" style="position: sticky;">
<div class="container-fluid">
<div class="navbar-left-section">
<div class="navbar-left-section d-flex justify-content-between">
<% if current_login_employee.role != "waiter" %>
<a href="javascript:void(0);" class="bars bars-toggle">
<!-- <i class="material-icons">menu</i> -->
</a>
<% end %>
<%# Brand Name and Icon %>
<a class="navbar-brand" href="<%= root_path %>">
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
<span>SX Restaurant</span>
<%# <span class="navbar-brand-text">SX Restaurant</span> %>
</a>
</div>
<div class="navbar-center-section">
<%= Shop.current_shop.name %>
</div>
<div class="navbar-right-section">
<%# Connection Status %>
<div class="nav-item" id="connection-status-item">
@@ -175,7 +213,7 @@
<div class="nav-item dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="material-icons">person</i>
<span><%= current_login_employee.name %></span>
<span class="user-name-text"><%= current_login_employee.name %></span>
</a>
<ul class="dropdown-menu">
<% if current_login_employee.role == "administrator" %>

View File

@@ -46,7 +46,10 @@
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.mmqr_void_amount") %></th>
<% mmqr = PaymentMethodSetting.find_by(payment_method: 'MMQR') %>
<% if mmqr.present? && mmqr.is_active %>
<th style='text-align:center;'><%= t("views.right_panel.detail.mmqr_void_amount") %></th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<% if @tax_profiles.present? %>
@@ -101,7 +104,9 @@
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(sale[:mmqr_cancelled_void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if mmqr.present? && mmqr.is_active %>
<td style='color:red;text-align:right;'><%= number_format(sale[:mmqr_cancelled_void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
@@ -131,7 +136,9 @@
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(mmqr_void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if mmqr.present? && mmqr.is_active %>
<td style='color:red;text-align:right;'><%= number_format(mmqr_void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>

View File

@@ -35,7 +35,10 @@
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.mmqr_void_amount") %></th>
<% mmqr = PaymentMethodSetting.find_by(payment_method: 'MMQR') %>
<% if mmqr.present? && mmqr.is_active %>
<th style='text-align:center;'><%= t("views.right_panel.detail.mmqr_void_amount") %></th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<% if @tax_profiles.present? %>
@@ -89,7 +92,10 @@
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(sale[:mmqr_cancelled_void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if mmqr.present? && mmqr.is_active %>
<td style='color:red;text-align:right;'><%= number_format(sale[:mmqr_cancelled_void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
@@ -119,7 +125,9 @@
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(mmqr_void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if mmqr.present? && mmqr.is_active %>
<td style='color:red;text-align:right;'><%= number_format(mmqr_void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>

View File

@@ -33,14 +33,17 @@
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
</select>
</div> -->
<div class="form-group col-lg-3 col-md-3 col-sm-3 mbl-style">
<label class="font-20 mbl_lbl">Status</label>
<select class="form-control select" name="void_filter" id="void_filter" style="height: 37px;">
<option value="" <%= 'selected' if params[:void_filter].blank? %>>ALL</option>
<option value="void" <%= 'selected' if params[:void_filter] == 'void' %>>Void</option>
<option value="cancelled_mmqr" <%= 'selected' if params[:void_filter] == 'cancelled_mmqr' %>>Cancelled Payment (MMQR)</option>
</select>
</div>
<% mmqr = PaymentMethodSetting.find_by(payment_method: 'MMQR') %>
<% if mmqr.present? && mmqr.is_active %>
<div class="form-group col-lg-3 col-md-3 col-sm-3 mbl-style">
<label class="font-20 mbl_lbl">Status</label>
<select class="form-control select" name="void_filter" id="void_filter" style="height: 37px;">
<option value="" <%= 'selected' if params[:void_filter].blank? %>>ALL</option>
<option value="void" <%= 'selected' if params[:void_filter] == 'void' %>>Void</option>
<option value="cancelled_mmqr" <%= 'selected' if params[:void_filter] == 'cancelled_mmqr' %>>Cancelled Payment (MMQR)</option>
</select>
</div>
<% end %>
<div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-right-btn mbl-style">
<br>
<input type="submit" value="Generate Report" class='btn btn-primary'>

View File

@@ -424,7 +424,7 @@ en:
to_date: "To Date"
sr: "Sr"
void_amount: "Void Amount"
mmqr_void_amount: "MMQR Void Amount"
mmqr_void_amount: "MMQR Cancel Amount"
mpu_sales: "MPU Sales"
master_sales: "Master Sales"
visa_sales: "Visa Sales"