SQA feedback

This commit is contained in:
phyusin
2018-03-20 15:55:00 +06:30
parent 829c09040d
commit f354e32e31
3 changed files with 28 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ class Origami::ShiftsController < BaseOrigamiController
end
def show
@type = params[:type]
@cashier_type = params[:type]
@shift = ShiftSale.current_open_shift(current_user.id)
#for bank integration
bank_integration = Lookup.collection_of('bank_integration')

View File

@@ -371,6 +371,8 @@ class Sale < ApplicationRecord
end
#compute rounding adjustment
# adjust_rounding
sale.rounding_adjustment = compute_adjust_rounding(sale.grand_total)
sale.save!
end
@@ -552,6 +554,26 @@ class Sale < ApplicationRecord
end
def compute_adjust_rounding(grand_total)
shop_details = Shop::ShopDetail
# rounding adjustment
if shop_details.is_rounding_adj
a = grand_total % 25 # Modulus
b = grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(grand_total)
rounding_adjustment = new_total - grand_total
else
rounding_adjustment = 0.00
end
else
rounding_adjustment = 0.00
end
return rounding_adjustment
end
#Generate new Receipt No when it is not assigned
def generate_receipt_no
#shop_code and client_code

View File

@@ -58,7 +58,7 @@
</div>
</div>
<script>
var type = '<%= @type %>';
var cashier_type = '<%= @cashier_type %>';
$('#close_cashier').on('click',function(){
var amount = $('#closing_balance_amount').val();
var shift_id = "<%= @shift.id rescue ""%>"
@@ -73,7 +73,7 @@
});
$('#back').on('click',function(){
if(type!='quick_service'){
if(cashier_type!='quick_service'){
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
@@ -95,7 +95,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/shift/'+type+'/close';
window.location.href = '/origami/shift/'+cashier_type+'/close';
});
}
});
@@ -120,7 +120,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/shift/'+type+'/close';
window.location.href = '/origami/shift/'+cashier_type+'/close';
});
}
}
@@ -184,7 +184,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/shift/close';
window.location.href = '/origami/shift/'+cashier_type+'/close';
});
// reqCBBankAlipaySettlement();
}