upadte customer and sale void

This commit is contained in:
Aung Myo
2017-06-15 13:17:58 +06:30
parent 061c06b3c3
commit ed3f97a2af
6 changed files with 76 additions and 108 deletions

View File

@@ -51,7 +51,7 @@
<tr>
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
<td><%= @sale.receipt_no %></td>
<td><%= @sale.cashier rescue '-' %></td>
<td><%= @sale.cashier_name rescue '-' %></td>
<td> <%= @sale.sale_status %> </td>
<td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td>
</tr>
@@ -175,7 +175,7 @@
<i class="fa fa-trash fa-lg"></i> Void Sale
</a>
<a href="<%= transactions_manual_void_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<a href="<%= %>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<i class="fa fa-invoice fa-lg"></i> Complete Sale
</a> -->
</div>

View File

@@ -1,89 +0,0 @@
<p id="notice"><%= notice %></p>
<p>
<strong>Cashier:</strong>
<%= @transactions_sale.cashier %>
</p>
<p>
<strong>Cashier name:</strong>
<%= @transactions_sale.cashier_name %>
</p>
<p>
<strong>Requested by:</strong>
<%= @transactions_sale.requested_by %>
</p>
<p>
<strong>Requested at:</strong>
<%= @transactions_sale.requested_at %>
</p>
<p>
<strong>Receipt no:</strong>
<%= @transactions_sale.receipt_no %>
</p>
<p>
<strong>Receipt date:</strong>
<%= @transactions_sale.receipt_date %>
</p>
<p>
<strong>Customer:</strong>
<%= @transactions_sale.customer %>
</p>
<p>
<strong>Payment status:</strong>
<%= @transactions_sale.payment_status %>
</p>
<p>
<strong>Sale status:</strong>
<%= @transactions_sale.sale_status %>
</p>
<p>
<strong>Total amount:</strong>
<%= @transactions_sale.total_amount %>
</p>
<p>
<strong>Total discount:</strong>
<%= @transactions_sale.total_discount %>
</p>
<p>
<strong>Total tax:</strong>
<%= @transactions_sale.total_tax %>
</p>
<p>
<strong>Tax type:</strong>
<%= @transactions_sale.tax_type %>
</p>
<p>
<strong>Grand total:</strong>
<%= @transactions_sale.grand_total %>
</p>
<p>
<strong>Rounding adjustment:</strong>
<%= @transactions_sale.rounding_adjustment %>
</p>
<p>
<strong>Amount received:</strong>
<%= @transactions_sale.amount_received %>
</p>
<p>
<strong>Amount changed:</strong>
<%= @transactions_sale.amount_changed %>
</p>
<%= link_to 'Edit', edit_transactions_sale_path(@transactions_sale) %> |
<%= link_to 'Back', transactions_sales_path %>

View File

@@ -15,12 +15,16 @@
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<h3>Choose your reason</h3>
<table>
<h3>Choose Reason For Void</h3>
<br>
<p class="hidden sale-id"><%= @sale %></p>
<table class="table table-striped">
<% @reason.each do |r| %>
<tr>
<tr class="customer_tr">
<td></td>
<td>
<%= check_box_tag "reason", "#{r.name}" rescue '-' %>
<input type="radio" style="width:20px;" name="reason" value="<%=r.name%>" class="checkbox_check" >
<!-- <%= check_box_tag "reason", "#{r.name}",:class => 'checkbox_check' rescue '-' %> -->
</td>
<td><%= label_tag "reasons[#{r.id}]", r.name, :style=>'font-weight:bold;font-size:18px;' rescue '-' %></td>
@@ -29,10 +33,13 @@
</table>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<a href="<%= transactions_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg"><i class="fa fa-arrow-left fa-lg"></i> Back
<div class="col-lg-2 col-md-2 col-sm-2">
<br><br><br>
<a href="<%= transactions_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg"><i class="fa fa-arrow-left fa-lg"></i> Cancel
</a>
</div>
<button type="button" style="margin-top: 10px " class="btn btn-danger pull-right btn-lg" id="void" disabled><i class="fa fa-trash fa-lg"></i> Void
</button>
</div>
</div>
<style>
@@ -42,6 +49,35 @@
}
</style>
<script>
$(function() {
$(document).on('click',".customer_tr",function(){
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
$('#void').removeAttr('disabled')
});
$("#void").click(function() {
var reason = $('input[type="radio"]:checked').val();
console.log(reason)
var url = '<% transactions_manual_void_sale_path()%>';
var sale_id = $(this).find(".customer-id").text();
$.ajax({
type: 'POST',
url: 'sales/manual_void_sale',
data: {reason: reason, sale_id: sale_id},
success: function(data){
window.location.href = "transactions/sales"
}
});
});
});
</script>