update foc and void overall add remark
This commit is contained in:
@@ -87,7 +87,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
sale_payment.process_payment(saleObj, @usercurrent_user.name, cash, "cash")
|
||||||
|
|
||||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
@@ -300,6 +300,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
cash = params[:cash]
|
cash = params[:cash]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
sub_total = params[:sub_total]
|
sub_total = params[:sub_total]
|
||||||
|
remark = params[:remark]
|
||||||
member_info = nil
|
member_info = nil
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
current_balance = nil
|
current_balance = nil
|
||||||
@@ -313,7 +314,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash, "foc")
|
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
def overall_void
|
def overall_void
|
||||||
|
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
remark = params[:remark]
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find_by_sale_id(sale_id)
|
sale = Sale.find_by_sale_id(sale_id)
|
||||||
if sale.discount_type == "member_discount"
|
if sale.discount_type == "member_discount"
|
||||||
@@ -64,8 +64,8 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# FOr Sale Audit
|
# FOr Sale Audit
|
||||||
action_by = current_user.id
|
action_by = current_user.name
|
||||||
remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
|
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
|
||||||
|
|
||||||
# For Print
|
# For Print
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ class SaleAudit < ApplicationRecord
|
|||||||
sale_audit.sale_id = sale_id
|
sale_audit.sale_id = sale_id
|
||||||
sale_audit.action = "SALECOMPLETE"
|
sale_audit.action = "SALECOMPLETE"
|
||||||
sale_audit.action_at = DateTime.now.utc
|
sale_audit.action_at = DateTime.now.utc
|
||||||
sale_audit.action_by = action_by
|
sale_audit.action_by = Sale.find(sale_id).cashier_id
|
||||||
sale_audit.remark = remark
|
sale_audit.remark = remark
|
||||||
sale_audit.approved_by = Time.now
|
sale_audit.approved_by = action_by
|
||||||
sale_audit.save!
|
sale_audit.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -72,9 +72,9 @@ class SaleAudit < ApplicationRecord
|
|||||||
sale_audit.sale_id = sale_id
|
sale_audit.sale_id = sale_id
|
||||||
sale_audit.action = "SALEPAYMENT"
|
sale_audit.action = "SALEPAYMENT"
|
||||||
sale_audit.action_at = DateTime.now.utc
|
sale_audit.action_at = DateTime.now.utc
|
||||||
sale_audit.action_by = action_by
|
sale_audit.action_by = Sale.find(sale_id).cashier_id
|
||||||
sale_audit.remark = remark
|
sale_audit.remark = remark
|
||||||
sale_audit.approved_by = Time.now
|
sale_audit.approved_by = action_by
|
||||||
sale_audit.save!
|
sale_audit.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -83,9 +83,9 @@ class SaleAudit < ApplicationRecord
|
|||||||
sale_audit.sale_id = sale_id
|
sale_audit.sale_id = sale_id
|
||||||
sale_audit.action = "PAYMAL"
|
sale_audit.action = "PAYMAL"
|
||||||
sale_audit.action_at = DateTime.now.utc
|
sale_audit.action_at = DateTime.now.utc
|
||||||
sale_audit.action_by = action_by
|
sale_audit.action_by = Sale.find(sale_id).cashier_id
|
||||||
sale_audit.remark = remark
|
sale_audit.remark = remark
|
||||||
sale_audit.approved_by = Time.now
|
sale_audit.approved_by = action_by
|
||||||
sale_audit.save!
|
sale_audit.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
||||||
|
|
||||||
def process_payment(invoice, action_by, cash_amount, payment_method)
|
def process_payment(invoice, action_by, cash_amount, payment_method,remark=nil)
|
||||||
self.sale = invoice
|
self.sale = invoice
|
||||||
self.received_amount = cash_amount
|
self.received_amount = cash_amount
|
||||||
amount_due = invoice.grand_total
|
amount_due = invoice.grand_total
|
||||||
@@ -53,7 +53,7 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
# remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
||||||
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||||
|
|
||||||
# update complete order items in oqs
|
# update complete order items in oqs
|
||||||
@@ -67,7 +67,7 @@ class SalePayment < ApplicationRecord
|
|||||||
return true, self.save
|
return true, self.save
|
||||||
else
|
else
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
# 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)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by)
|
||||||
|
|
||||||
return false, "No outstanding Amount"
|
return false, "No outstanding Amount"
|
||||||
|
|||||||
@@ -428,7 +428,8 @@
|
|||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</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" 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="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||||
|
|
||||||
<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="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>
|
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||||
|
|
||||||
@@ -488,6 +489,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
@@ -814,9 +839,12 @@
|
|||||||
if (isConfirm) {
|
if (isConfirm) {
|
||||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
|
var remark = $("#remark").val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
|
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
success: function () {
|
success: function () {
|
||||||
window.location.href = '/origami/';
|
window.location.href = '/origami/';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,19 +289,64 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||||
<i class="material-icons">reply</i>
|
<i class="material-icons">reply</i>
|
||||||
Back
|
Back
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </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" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
|
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="focModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="focModalLabel">Please Enter Reason for FOC</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="foc_remark">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-red waves-effect " id="foc" active="true">FOC</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
@@ -513,26 +558,51 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#void').on('click',function () {
|
// $('#void').on('click',function () {
|
||||||
if ($(this).attr('active') === "true") {
|
// if ($(this).attr('active') === "true") {
|
||||||
|
// var sale_id = $('#sale_id').text();
|
||||||
|
// var remark = $("#remark").val();
|
||||||
|
// var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
|
// $.ajax({
|
||||||
|
// type: 'POST',
|
||||||
|
// url: ajax_url,
|
||||||
|
// data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
|
// success: function () {
|
||||||
|
// window.location.href = '/origami/';
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }else{
|
||||||
|
// swal("Opps","You are not authorized for void","warning")
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
$('#void').on('click', function () {
|
||||||
|
if ($(this).attr('active')=== "true") {
|
||||||
swal({
|
swal({
|
||||||
title: "Information!",
|
title: "Alert",
|
||||||
text: 'Are you sure want to Void !',
|
text: "Are you sure want to Void?",
|
||||||
}, function () {
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, void it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
|
var remark = $("#remark").val();
|
||||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
|
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
success: function () {
|
success: function () {
|
||||||
window.location.href = '/origami/';
|
window.location.href = '/origami/';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
}
|
||||||
|
});
|
||||||
}else{
|
}else{
|
||||||
swal("Opps","You are not authorized for void","warning")
|
swal("Opps","You are not authorized for void","warning")
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -554,31 +624,41 @@
|
|||||||
$('#foc').click(function() {
|
$('#foc').click(function() {
|
||||||
//$( "#loading_wrapper" ).show();
|
//$( "#loading_wrapper" ).show();
|
||||||
// payment
|
// payment
|
||||||
|
var remark = $("#foc_remark").val();
|
||||||
var cash = $('#grand_total').text();
|
var cash = $('#grand_total').text();
|
||||||
var sub_total = $('#sub-total').text();
|
var sub_total = $('#sub-total').text();
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
|
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark };
|
||||||
|
|
||||||
if ($(this).attr('active')=== "true") {
|
if ($(this).attr('active')=== "true") {
|
||||||
$.ajax({
|
swal({
|
||||||
type: "POST",
|
title: "Alert",
|
||||||
url: "<%= origami_payment_foc_path %>",
|
text: "Are you sure want to FOC This Receipt?",
|
||||||
data: params,
|
type: "warning",
|
||||||
success:function(result){
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
//$( "#loading_wrapper" ).hide();
|
confirmButtonText: "Yes, FOC it!",
|
||||||
|
closeOnConfirm: false
|
||||||
if (cash >= 0) {
|
}, function (isConfirm) {
|
||||||
swal({
|
if (isConfirm) {
|
||||||
title: "Information!",
|
$.ajax({
|
||||||
text: 'Thank You !',
|
type: "POST",
|
||||||
}, function () {
|
url: "<%= origami_payment_foc_path %>",
|
||||||
window.location.href = '/origami';
|
data: params,
|
||||||
});
|
success:function(result){
|
||||||
}
|
if (cash >= 0) {
|
||||||
|
swal({
|
||||||
|
title: "Information!",
|
||||||
|
text: 'Thank You !',
|
||||||
|
}, function () {
|
||||||
|
window.location.href = '/origami';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
swal("Opps","You are not authorized for foc","warning")
|
swal("Opps","You are not authorized for foc","warning")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user