Merge branch 'discount'

This commit is contained in:
Yan
2017-06-08 18:58:28 +06:30
4 changed files with 46 additions and 8 deletions

View File

@@ -21,6 +21,10 @@ $(document).ready(function(){
var zone_name=$(this).find(".orders-table").text();
var receipt_no=$(this).find(".orders-receipt-no").text();
var unique_id=$(this).find(".orders-id").text();
var order_status=$(this).find(".orders-order-status").text().trim();
// Enable/Disable Button
control_button(order_status);
var cashier="";
var receipt_date="";
@@ -85,15 +89,26 @@ $(document).ready(function(){
// Bill Request
$('#request_bills').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/origami/request_bills/'+ order_id
var order_id=$(".selected-item").find(".orders-id").text();
if(order_id!=""){
window.location.href = '/origami/request_bills/'+ order_id
}
else {
alert("Please select an order!");
}
return false;
});
// Discount for Payment
$('#discount').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/origami/discount/'+ order_id
var order_id=$(".selected-item").find(".orders-id").text();
if(order_id!=""){
window.location.href = '/origami/discount/'+ order_id
}
else {
alert("Please select an order!");
}
return false;
});
@@ -122,8 +137,14 @@ $(document).ready(function(){
// Payment for Bill
$('#pay').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/origami/sale/'+ sale_id + "/payment"
var sale_id=$(".selected-item").find(".orders-id").text();
if(order_id!=""){
window.location.href = '/origami/sale/'+ sale_id + "/payment"
}
else {
alert("Please select an order!");
}
return false;
});
});
@@ -174,6 +195,20 @@ $(document).on('click', '.cashier_number', function(event){
}
});
/* Button Control by Status */
function control_button(order_status){
if(order_status=="billed"){
$("#request_bills").prop('disabled', true);
$("#discount").prop('disabled', false);
$("#pay").prop('disabled', false);
}
else if(order_status=="new") {
$("#request_bills").prop('disabled', false);
$("#discount").prop('disabled', true);
$("#pay").prop('disabled', true);
}
}
/* For Receipt - Update Balance */
function update_balance(){
var discount_type = $('#discount-type').val();