finish reprint
This commit is contained in:
@@ -51,6 +51,7 @@ $(document).ready(function(){
|
|||||||
var customer_id=$(this).find(".customer-id").text();
|
var customer_id=$(this).find(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
|
$("#re-print").val(unique_id);
|
||||||
|
|
||||||
var cashier="";
|
var cashier="";
|
||||||
var receipt_date="";
|
var receipt_date="";
|
||||||
@@ -199,6 +200,14 @@ $(document).ready(function(){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#re-print').click(function() {
|
||||||
|
var sale_id = $(".selected-item").find(".orders-id").text();
|
||||||
|
|
||||||
|
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
function show_customer_details(customer_id){
|
function show_customer_details(customer_id){
|
||||||
|
|
||||||
if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
|
if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
|
||||||
@@ -297,19 +306,25 @@ function control_button(order_status){
|
|||||||
$("#request_bills").prop('disabled', true);
|
$("#request_bills").prop('disabled', true);
|
||||||
$("#discount").prop('disabled', false);
|
$("#discount").prop('disabled', false);
|
||||||
$("#pay-bill").prop('disabled', false);
|
$("#pay-bill").prop('disabled', false);
|
||||||
|
$("#re-print").prop('disabled', true);
|
||||||
}
|
}
|
||||||
else if(order_status=="new") {
|
else if(order_status=="new") {
|
||||||
$("#customer").prop('disabled', false);
|
$("#customer").prop('disabled', false);
|
||||||
$("#request_bills").prop('disabled', false);
|
$("#request_bills").prop('disabled', false);
|
||||||
$("#discount").prop('disabled', true);
|
$("#discount").prop('disabled', true);
|
||||||
$("#pay-bill").prop('disabled', true);
|
$("#pay-bill").prop('disabled', true);
|
||||||
|
$("#re-print").prop('disabled', true);
|
||||||
|
}else if(order_status=="completed"){
|
||||||
|
$("#re-print").prop('disabled', false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#customer").prop('disabled', true);
|
$("#customer").prop('disabled', true);
|
||||||
$("#request_bills").prop('disabled', true);
|
$("#request_bills").prop('disabled', true);
|
||||||
$("#discount").prop('disabled', true);
|
$("#discount").prop('disabled', true);
|
||||||
$("#pay-bill").prop('disabled', true);
|
$("#pay-bill").prop('disabled', true);
|
||||||
|
$("#re-print").prop('disabled', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For Receipt - Update Balance */
|
/* For Receipt - Update Balance */
|
||||||
|
|||||||
@@ -77,4 +77,28 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reprint
|
||||||
|
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
|
||||||
|
saleObj = Sale.find(sale_id)
|
||||||
|
|
||||||
|
unique_code = "ReceiptBillPdf"
|
||||||
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
|
# get member information
|
||||||
|
member_info = Customer.get_member_account(customer)
|
||||||
|
|
||||||
|
# get printer info
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# Calculate Food and Beverage Total
|
||||||
|
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
||||||
|
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -383,6 +383,6 @@
|
|||||||
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block">Discount</button>
|
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block">Discount</button>
|
||||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
||||||
<button type="button" id="pay-bill" class="btn btn-primary btn-lg btn-block">Pay</button>
|
<button type="button" id="pay-bill" class="btn btn-primary btn-lg btn-block">Pay</button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
<button type="button" id="re-print" class="btn btn-primary btn-lg btn-block">Re.Print</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ Rails.application.routes.draw do
|
|||||||
post "/:id/discount" => "discounts#create"
|
post "/:id/discount" => "discounts#create"
|
||||||
|
|
||||||
get "/:id/request_bills" => "request_bills#print"
|
get "/:id/request_bills" => "request_bills#print"
|
||||||
|
get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' }
|
||||||
#--------- Payment ------------#
|
#--------- Payment ------------#
|
||||||
get 'sale/:sale_id/payment' => 'payments#show'
|
get 'sale/:sale_id/payment' => 'payments#show'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user