update customer transaction list

This commit is contained in:
Aung Myo
2017-11-17 11:47:42 +06:30
parent cd7ae874b9
commit 393d0badc3
3 changed files with 70 additions and 41 deletions

View File

@@ -121,8 +121,9 @@ class Origami::CustomersController < BaseOrigamiController
if status == true
render json: JSON.generate({:status => true})
# Re-calc All Amount in Sale
if(id == "SAL")
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount)
end
else
render json: JSON.generate({:status => false, :error_message => "Record not found"})
end

View File

@@ -68,27 +68,39 @@
<tr>
<th><%= t("views.right_panel.detail.date") %></th>
<!-- <th>Redeem</th> -->
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.amount") %></th>
<!-- <th>Balance</th> -->
<th><%= t("views.right_panel.detail.from_account") %></th>
<th><%= t("views.right_panel.detail.status") %></th>
<th><%= t("views.right_panel.detail.from_account") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
</tr>
</thead>
<tbody>
<% if @response["status"] == true %>
<% @response["data"].each do |transaction| %>
<tr>
<td><%= transaction["date"]%></td>
<!-- <td><%= transaction["redeem"]%></td> -->
<td><%= transaction["deposit"] %></td>
<!-- <td><%= transaction["balance"] %></td> -->
<td><%= transaction["account_status"] %></td>
<td><%= transaction["status"] %></td>
<td><%= transaction["receipt_no"] %></td>
</tr>
<% end %>
<% @response["data"].each do |transaction| %>
<tr>
<td><%= transaction["date"]%></td>
<% if transaction["status"] == 'Rebate' || transaction["status"] == 'Discount'%>
<td><%= transaction["deposit"] %></td>
<% else %>
<td>(<%= transaction["withdraw"] %>)</td>
<% end %>
<td><%= transaction["status"] %></td>
<td><%= transaction["account_status"] %></td>
<td><%= transaction["receipt_no"] %></td>
</tr>
<% end %>
<% if @response["data"].first["status"] != 'Discount'%>
<tr >
<th>Balance</th>
<th>
<%= @response["data"].first["balance"] %>
</th>
</tr>
<%end%>
<%else%>
<tr><td colspan="5"><p class="align-center">There is no transaction coz of <%=@response["data"]%> ...</p></td></tr>
<% end %>
</tbody>
</table>
@@ -133,13 +145,15 @@
<table class="table table-striped">
<thead>
<tr>
<th><%= t("views.right_panel.detail.sale_id") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.tax_amount") %></th>
<th><%= t :cashier %></th>
<th><%= t("views.right_panel.detail.sales_status") %></th>
<th><%= t("views.right_panel.detail.receipt_date") %></th>
<th><%= t("views.right_panel.detail.sale_id") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t("views.right_panel.detail.total_discount") %></th>
<th><%= t("views.right_panel.detail.tax_amount") %></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t :cashier %></th>
<th><%= t("views.right_panel.detail.sales_status") %></th>
<th><%= t("views.right_panel.detail.receipt_date") %></th>
</tr>
</thead>
@@ -147,12 +161,14 @@
<% @sales.each do |sale| %>
<tr>
<td><%= link_to sale.sale_id, transactions_sale_path(sale) %></td>
<td><%= sale.receipt_no %></td>
<td><%= sale.grand_total rescue '-' %></td>
<td><%= sale.total_tax %></td>
<td><%= sale.cashier_name rescue '-' %></td>
<td> <%= sale.sale_status %> </td>
<td> <%= sale.receipt_date.strftime("%d-%m-%Y %I:%m %p") %> </td>
<td><%= sale.receipt_no %></td>
<td><%= sale.total_discount %></td>
<td><%= sale.total_tax %></td>
<td><%= sale.total_amount %></td>
<td><%= sale.grand_total rescue '-' %></td>
<td><%= sale.cashier_name rescue '-' %></td>
<td> <%= sale.sale_status %> </td>
<td> <%= sale.receipt_date.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> </td>
</tr>
<% end %>
</tbody>

View File

@@ -27,7 +27,7 @@
<div class="card sales red text-white" data-id="<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %>
<span class="pull-right font-12"><%= sale.sale_status %></span>
<span class="float-right font-12"><%= sale.sale_status %></span>
</div>
</div>
<% end %>
@@ -43,7 +43,7 @@
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span class="pull-right font-12 new_text_<%= table.id %>"> billed</span>
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div>
</div>
@@ -55,7 +55,7 @@
<% end %>
<div class="card-block">
<%= table.name %>
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
<% end %>
@@ -63,7 +63,7 @@
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span class="pull-right font-12 new_text_<%= table.id %> hide"> new</span>
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
</div>
</div>
<% end %>
@@ -81,9 +81,9 @@
<div class="card-block">
<%= room.name %>
<% if room.get_booking.nil? %>
<span class="pull-right font-12 new_text_<%= room.id %>"> billed</span>
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
<% else %>
<span class="pull-right font-12 new_text_<%= room.id %>"> new</span>
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
<% end %>
</div>
</div>
@@ -91,7 +91,7 @@
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<span class="pull-right font-12 new_text_<%= room.id %> hide">
<span class="float-right font-12 new_text_<%= room.id %> hide">
</div>
</div>
<% end %>
@@ -134,6 +134,8 @@
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %>
</div>
<div class="card-block">
@@ -154,7 +156,16 @@
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-12 col-md-12 col-sm-12 text-right">
<div class="col-lg-6 col-md-6 col-sm-6">
Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
<br>
</div>
@@ -162,15 +173,16 @@
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if !@sale_array.empty? %>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
Customer : <%= @sale_array[0].customer.name rescue '' %>
<% else %>
<% elsif @status_order == 'order'
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
Customer : <%= @customer.name rescue "" %>
<% end %>
<% end %>
</div>
</div>
</div>
@@ -350,7 +362,7 @@
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% if @dining.status != "available" %>
<% if @status_order == 'order' %>
<!-- <button type="button" id="customer" class="btn btn-block bg-blue waves-effect" disabled>Customer</button> -->
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled>Edit</button> -->
<!-- <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" disabled>Discount</button> -->
<!-- <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect" disabled>Charges</button> -->