change some func:

This commit is contained in:
phyusin
2018-08-23 14:23:08 +06:30
parent 7e353915e3
commit e820f564ea
7 changed files with 22 additions and 4 deletions

View File

@@ -24,6 +24,8 @@ class Inventory::InventoryController < BaseInventoryController
inventory = InventoryDefinition.find(inventory_definition_id)
@stock_journals = StockJournal.where(item_code: inventory.item_code)
@stock_journals = Kaminari.paginate_array(@stock_journals).page(params[:page]).per(20)
respond_to do |format|
format.html
format.xls

View File

@@ -28,7 +28,13 @@
</td>
<td><%= item.min_order_level %></td>
<td><%= item.max_stock_level %></td>
<td><%= item.balance rescue '0' %></td>
<td>
<% if item.balance.nil? %>
0
<% else %>
<%= item.balance rescue 0 %>
<% end %>
</td>
<td>
<button type="button" data-value="<%= item.id %>" class="btn bg-blue waves-effect btn-link show_track"><%= t("views.btn.show") %> <%= t("views.right_panel.detail.stock_check") %></button>
</td>

View File

@@ -66,5 +66,9 @@
<% end %>
</tbody>
</table>
<br>
<% if !@stock_journals.nil? && !@stock_journals.empty? %>
<%= paginate @stock_journals %>
<% end %>
</div>
</div>

View File

@@ -109,6 +109,7 @@
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :payment_method %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.amount") %> </th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
</tr>
@@ -129,8 +130,8 @@
<% end %>
<td><%= payment.receipt_no rescue '-' %></td>
<td><%= payment.cashier_name rescue '-' %></td>
<!--<td><%= payment.sale.customer.name rescue '-' %></td>-->
<td><%= payment.payment_method rescue '-' %></td>
<td><%= payment.sale.customer.name rescue '-' %></td>
<% if payment.payment_method === 'cash' %>
<td><%= number_with_precision(payment.payment_amount - payment.change_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
<%else%>
@@ -143,7 +144,7 @@
<% end %>
<%if total>0%>
<tr>
<td colspan="4" style="text-align: right;"><strong >Total </strong></td>
<td colspan="5" style="text-align: right;"><strong >Total </strong></td>
<td colspan="2"><strong><%=number_with_precision(total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></strong></td>
</tr>
<%end%>

View File

@@ -96,6 +96,7 @@
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :payment_method %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.amount") %> </th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
</tr>
@@ -116,8 +117,8 @@
<% end %>
<td><%= payment.receipt_no rescue '-' %></td>
<td><%= payment.cashier_name rescue '-' %></td>
<!--<td><%= payment.sale.customer.name rescue '-' %></td>-->
<td><%= payment.payment_method rescue '-' %></td>
<td><%= payment.sale.customer.name rescue '-' %></td>
<% if payment.payment_method === 'cash' %>
<td><%= number_with_precision(payment.payment_amount - payment.change_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
<%else%>

View File

@@ -53,6 +53,7 @@
<th><%= t("views.right_panel.detail.remark") %></th>
<th><%= t("views.right_panel.detail.checked_by") %></th>
<th><%= t("views.right_panel.detail.stock_check") %> <%= t("views.right_panel.detail.reason") %></th>
<th><%= t :date_time %></th>
</tr>
</thead>
<tbody>
@@ -87,6 +88,7 @@
<td><%= result.remark rescue '-' %></td>
<td><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
<td><%= result.stock_check.reason rescue '-' %></td>
<td><%= result.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></td>
</tr>
<% !result.stock_count.nil? ? total_stock_count += result.stock_count : total_stock_count += 0 %>
<% !result.stock_balance.nil? ? total_stock_balance += result.stock_balance : total_stock_balance += 0 %>

View File

@@ -21,6 +21,7 @@
<th><%= t("views.right_panel.detail.remark") %></th>
<th><%= t("views.right_panel.detail.checked_by") %></th>
<th><%= t("views.right_panel.detail.stock_check") %> <%= t("views.right_panel.detail.reason") %></th>
<th><%= t :date_time %></th>
</tr>
</thead>
<tbody>
@@ -55,6 +56,7 @@
<td><%= result.remark rescue '-' %></td>
<td><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
<td><%= result.stock_check.reason rescue '-' %></td>
<td><%= result.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></td>
</tr>
<% !result.stock_count.nil? ? total_stock_count += result.stock_count : total_stock_count += 0 %>
<% !result.stock_balance.nil? ? total_stock_balance += result.stock_balance : total_stock_balance += 0 %>