api discount and change tax
This commit is contained in:
@@ -40,71 +40,64 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
@saleobj.sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<% sub_total = BigDecimal("0.0") %>
|
||||
<% count = 0 %>
|
||||
<% @saleobj.sale_items.each do |sale_item| %>
|
||||
<% sub_total = sub_total + sale_item.price %>
|
||||
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr>
|
||||
<td class="p-1" width="2%"><%= count %></td>
|
||||
<td class="p-2" width="20%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.status != 'void' && sale_item.status != 'edit' && sale_item.status != 'foc' %>
|
||||
<td class="p-1" width="5%">
|
||||
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control " onkeyup="checkQuantity(this.value,'<%= sale_item.id %>');" onkeypress="return isNumberKey(event);" />
|
||||
<span id="<%= sale_item.id %>_qtyErr" style="color:red;"></span>
|
||||
</td>
|
||||
<td class="p-1" width="10%">
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" onkeypress="return isNumberKey(event);"/>
|
||||
<span id="<%= sale_item.id %>_priceErr" style="color:red;"></span>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
</td> -->
|
||||
<td class="p-1" width="25%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-blue waves-effect update'>Update</button>
|
||||
<button data-id="<%= sale_item.id %>" data-type="void" class='editModal btn btn-lg bg-danger waves-effect' data-toggle="modal" data-target="#editModal">Void</button>
|
||||
<% if sale_item.price > 0 %>
|
||||
<% count += 1 %>
|
||||
<tr class="item-row">
|
||||
<td class="p-1" width="2%"><%= count %></td>
|
||||
<td class="p-2" width="20%">
|
||||
<% if sale_item.foc_item %>
|
||||
<span><%= sale_item.foc_item.product_name %></span>
|
||||
<% elsif sale_item.void_item %>
|
||||
<span><%= sale_item.void_item.product_name %></span>
|
||||
<% else %>
|
||||
<span><%= sale_item.product_name %></span>
|
||||
<% end %>
|
||||
<% if sale_item.discount_item %>
|
||||
<% if sale_item.discount_item.nett? %>
|
||||
<div id="item-discount" class="text-secondary">With a <strong><%= number_format(sale_item.discount_item.discount) %></strong> discount</div>
|
||||
<% elsif sale_item.discount_item.percentage? %>
|
||||
<div id="item-discount" class="text-secondary">With a <strong><%= number_format(sale_item.discount_item.discount, precision: 0) %>%</strong> discount</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% if sale_item.status != 'void' && sale_item.status != 'edit' && sale_item.status != 'foc' %>
|
||||
<td class="p-1" width="5%">
|
||||
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control " onkeyup="checkQuantity(this.value,'<%= sale_item.id %>');" onkeypress="return isNumberKey(event);" />
|
||||
<span id="<%= sale_item.id %>_qtyErr" style="color:red;"></span>
|
||||
</td>
|
||||
<td class="p-1" width="10%">
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" onkeypress="return isNumberKey(event);"/>
|
||||
<span id="<%= sale_item.id %>_priceErr" style="color:red;"></span>
|
||||
</td>
|
||||
<td class="p-1" width="25%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg btn-primary waves-effect update'>Update</button>
|
||||
<button data-id="<%= sale_item.id %>" data-type="void" class='editModal btn btn-lg btn-danger waves-effect' data-toggle="modal" data-target="#editModal">Void</button>
|
||||
|
||||
<button data-id="<%= sale_item.id %>" data-type="foc" class='editModal btn btn-lg bg-danger waves-effect' data-toggle="modal" data-target="#editModal">FOC</button>
|
||||
</td>
|
||||
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.status == 'edit' %>
|
||||
<td class="p-1" width="5%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="10%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td> -->
|
||||
<td class="p-1" width="25%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-danger waves-effect cancel'>Cancel
|
||||
Void/Update
|
||||
</button>
|
||||
</td>
|
||||
<% else %>
|
||||
<td class="p-1" width="5%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class="p-1" width="10%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
<button data-id="<%= sale_item.id %>" data-type="foc" class='editModal btn btn-lg btn-danger waves-effect' data-toggle="modal" data-target="#editModal">FOC</button>
|
||||
</td>
|
||||
<% elsif sale_item.status == 'foc' || sale_item.status == 'void' %>
|
||||
<td class="p-1" width="5%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="10%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class="p-1" width="25%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg btn-danger waves-effect cancel'>Cancel
|
||||
<%= sale_item.status %>
|
||||
</button>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -121,7 +114,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 col-lg-4 col-sm-4">
|
||||
|
||||
|
||||
<div class="p-l-20">
|
||||
<div class="row bottom">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 m-l--5">
|
||||
@@ -208,10 +201,11 @@
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||
<button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button>
|
||||
<button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button>
|
||||
<button type="button" class="btn btn-block bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>Refresh</button>
|
||||
<hr>
|
||||
<button type="button" class="btn btn-block btn-danger waves-effect" id='cancel_all_void'>Cancel All</button>
|
||||
<button type="button" class="btn btn-block btn-primary waves-effect" id='apply'>Apply</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -475,8 +469,4 @@ var access_code = localStorage.getItem("access_code");
|
||||
$("#"+sale_item_id+"_qty").val('1');
|
||||
}
|
||||
}
|
||||
|
||||
$('#add_order').on('click', function () {
|
||||
window.location.href = '/foodcourt/food_court?sale_id=<%=@saleobj.sale_id %>';
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user