update unsuccessfully rebate and alert
This commit is contained in:
@@ -205,5 +205,6 @@ tr.discount-item-row:hover {
|
|||||||
/* Jquery Confirm */
|
/* Jquery Confirm */
|
||||||
|
|
||||||
.jconfirm-box-container{
|
.jconfirm-box-container{
|
||||||
margin-left:-40px !important
|
margin-left:-40px !important;
|
||||||
|
margin-top:-40px !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,11 +41,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||||
|
|
||||||
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
||||||
# rounding_adj = saleObj.grand_total - new_total
|
|
||||||
|
|
||||||
# saleObj.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj)
|
|
||||||
|
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
@@ -65,7 +61,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
|
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
|
||||||
|
|
||||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -341,28 +341,58 @@ $( document ).ready(function() {
|
|||||||
if($('#balance').text() > 0){
|
if($('#balance').text() > 0){
|
||||||
alert(" Insufficient Amount!")
|
alert(" Insufficient Amount!")
|
||||||
}else{
|
}else{
|
||||||
// payment
|
// payment
|
||||||
var cash = $('#cash').text();
|
var cash = $('#cash').text();
|
||||||
var credit = $('#credit').text();
|
var credit = $('#credit').text();
|
||||||
var card = $('#card').text();
|
var card = $('#card').text();
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
|
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_cash_path %>",
|
url: "<%= origami_payment_cash_path %>",
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
localStorage.removeItem("cash");
|
localStorage.removeItem("cash");
|
||||||
if($('#balance').text() < 0){
|
if (result.status) {
|
||||||
alert("Changed amount " + $('#balance').text() * (-1) )
|
var msg = result.message;
|
||||||
}else{
|
}else{
|
||||||
$('#pay').text("Pay")
|
var msg = '';
|
||||||
alert("Thank you")
|
}
|
||||||
|
|
||||||
|
if($('#balance').text() < 0){
|
||||||
|
$.confirm({
|
||||||
|
title: 'Hi!',
|
||||||
|
content: 'Changed amount ' + $('#balance').text() * (-1) + '\n\n' + msg,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: 'Ok',
|
||||||
|
btnClass: 'btn-green',
|
||||||
|
action: function(){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$('#pay').text("Pay")
|
||||||
|
|
||||||
|
$.confirm({
|
||||||
|
title: 'Hi!',
|
||||||
|
content: 'Thank you !'+'\n\n'+msg,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: 'Ok',
|
||||||
|
btnClass: 'btn-green',
|
||||||
|
action: function(){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
window.location.href = '/origami';
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#void').on('click',function () {
|
$('#void').on('click',function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user