multiple invoice

This commit is contained in:
Nweni
2017-06-22 05:24:31 +06:30
parent c7139609c4
commit 168c571a23
7 changed files with 53 additions and 27 deletions

View File

@@ -97,7 +97,7 @@
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<% if @status_order == 'order' %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong></div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong></div>
@@ -150,7 +150,7 @@
end
end
if @status_order == 'order'
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil?
@order_items.each do |order_item |
sub_total = sub_total + order_item.price
@@ -217,8 +217,25 @@
</table>
<button class='btn btn-primary'> Add to existing invoice </button>
<%
else
@sale_array.each do |sale|
if @sale_array.size > 1
%>
Pending New Invoice
<%
unless sale.receipt_no == @obj_sale.receipt_no
%>
<table class="table table-striped">
<tr>
<td><%= sale.receipt_no %></td>
</tr>
</table>
<%
end
end
end
end
end
end
%>
</div>

View File

@@ -99,6 +99,7 @@
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-attr">QTY</td>
<th class="item-attr">Price</td>
@@ -106,14 +107,17 @@
</thead>
<tbody>
<%
count = 0
sub_total = 0
if @status_sale == "sale"
@obj_sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
count += 1
%>
<input type="hidden" id="sale_id" value="<%= @obj_sale.sale_id %>">
<% unless sale_item.price <= 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
@@ -122,14 +126,15 @@
end
end
end
if @status_order == 'order'
count = 0
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil?
@order_items.each do |order_item |
sub_total = sub_total + order_item.price
count += 1
unless order_item.price <= 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
@@ -150,10 +155,13 @@
Pending New Order
<table class="table table-striped">
<%
count = 0
@order_items.each do |order_item |
count += 1
%>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>