Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Nweni
2017-06-14 10:07:48 +06:30
30 changed files with 668 additions and 542 deletions

View File

@@ -14,7 +14,7 @@
<div class="row">
<div class="col-lg-8">
<div class="col-lg-7 col-md-7 col-sm-7">
<div class="main-box-body clearfix">
<div class="table-responsive">
@@ -25,8 +25,8 @@
<tr>
<td colspan="6">
<%= form_tag crm_customers_path, :method => :get do %>
<div class="input-append form-group pull-left">
<input type="text" name="filter" placeholder="Search" class="form-control input-sm col-md-8">
<div class="input-append col-md-12 form-group pull-left">
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" class="form-control input-sm col-md-4">
<button type="submit" class="btn btn-primary btn-sm">Search</button>
</div>
<% end %>
@@ -42,20 +42,21 @@
</thead>
<tbody>
<% @crm_customers.each do |crm_customer| %>
<tr>
<td>
<input type="radio" style="width:20px;" value="<%= crm_customer.customer_id %>" name="checkbox" class="checkbox_check" ></td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.company %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
<td>
<%= link_to 'Show', crm_customer_path(crm_customer) %>
</td>
</tr>
<% if @crm_customers.count > 0 %>
<% @crm_customers.each do |crm_customer| %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.company rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
<td><%= link_to 'Show', crm_customer_path(crm_customer) %></td>
</tr>
<% end %>
<%else%>
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
<% end %>
</tbody>
</table>
@@ -66,7 +67,7 @@
</div>
</div>
<div class="col-lg-4">
<div class="col-lg-4 col-md-4 col-sm-4">
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
@@ -115,6 +116,12 @@
</div>
<%end%>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<br>
<a href="<%= crm_customers_path%>" class="btn btn-primary">
<i class="fa fa-arrow-left fa-lg"></i> Back
</a>
</div>
</div>
@@ -129,11 +136,10 @@ $(function() {
$('.datepicker').css('cursor','pointer');
});
$(document).on('click',".checkbox_check",function(){
if(this.checked){
$(document).on('click',".customer_tr",function(){
// if(this.checked){
var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).val();
var customer_id = $(this).attr('data-ref');
if(sale_id != 0){
// var url = "/"+customer_id;
@@ -172,9 +178,9 @@ $(function() {
//$(".edit_customer").attr('method', 'PATCH');
}
});
}else{
// }else{
}
// }
})
function update_sale(customer_id,sale_id) {
@@ -199,7 +205,6 @@ $(function() {
success: function(data) {
if(data.status == true)
{
alert('Customer has assigned');
window.location.href = '/origami'
}else{
alert('Record not found!');
@@ -216,7 +221,4 @@ $(function() {
}
</script>

View File

@@ -1,120 +1,130 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= crm_customers_path %>">Customer</a>
</li>
<li class="active">Details
</li>
</ol>
</div>
</div>
<div class="col-lg-10 col-md-10 col-sm-10">
<!-- Column One -->
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#queue" role="tab">Customer Details </a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#booking" role="tab">Orders </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#customer" role="tab">Sales</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<hr>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Contact no</th>
<th>Company</th>
<th>Date Of Birth</th>
<th>Membership Account</th>
<th>Balance</th>
<th>Type</th>
</tr>
</thead>
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<tbody>
<tr>
<td><%= @crm_customer.name %></td>
<td><%= @crm_customer.email %></td>
<td><%= @crm_customer.contact_no %></td>
<td><%= @crm_customer.company %></td>
<td><%= @crm_customer.date_of_birth %> </td>
<td><%= @balance %> </td>
<td><%= @type %> </td>
<%
puts "hhhhhhhhhhhhhhhhhhhhh"
puts @member_data.to_json %>
</tr>
</tbody>
</table>
<br>
<h3>Order Items</h3>
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<tr>
<th>Name</th>
<td><%= @crm_customer.name %></td>
</tr>
<tr>
<th>Email</th>
<td><%= @crm_customer.email %></td>
</tr>
<tr>
<th>Contact no</th>
<td><%= @crm_customer.contact_no %></td>
</tr>
<tr>
<th>Company</th>
<td><%= @crm_customer.company %></td>
</tr>
<tr>
<th>Date Of Birth</th>
<td><%= @crm_customer.date_of_birth %> </td>
</tr>
</tbody>
</table>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Created at </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Option</th>
<th>Status</th>
<th>Waiter</th>
</tr>
</thead>
<div class="tab-pane" id="booking" role="tabpanel">
<h3>Order Details</h3>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order ID</th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Option</th>
<th>Status</th>
<th>Waiter</th>
<th>Created at </th>
</tr>
</thead>
<tbody>
<% @order_items.each do |order_item| %>
<tr>
<td><%= order_item.created_at %></td>
<td><%= order_item.item_name %></td>
<td><%= order_item.qty %></td>
<td><%= order_item.price %></td>
<td><%= order_item.options %></td>
<td><%= order_item.order_item_status %></td>
<td><%= order_item.item_order_by %> </td>
</tr>
<% end %>
</tbody>
</table>
<tbody>
<% @order_items.each do |order_item| %>
<tr>
<td><%= order_item.order_id %></td>
<td><%= order_item.item_name %></td>
<td><%= order_item.qty %></td>
<td><%= order_item.price %></td>
<td><%= order_item.options %></td>
<td><%= order_item.order_item_status %></td>
<td><%= order_item.item_order_by %> </td>
<td><%= order_item.created_at.strftime("%d-%m-%y") %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<h3>Sale Items</h3>
<div class="tab-pane" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<h3>Sale Details</h3>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Tax Price</th>
<th>Created At</th>
</tr>
</thead>
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Tax Price</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @sale_items.each do |sale_item| %>
<tr>
<td><%= sale_item.sale_id %></td>
<td><%= sale_item.product_name %></td>
<td><%= sale_item.qty %></td>
<td><%= sale_item.unit_price %></td>
<td><%= sale_item.taxable_price %></td>
<td><%= sale_item.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<tbody>
<% @sale_items.each do |sale_item| %>
<tr>
<td><%= sale_item.sale_id %></td>
<td><%= sale_item.product_name %></td>
<td><%= sale_item.qty %></td>
<td><%= sale_item.unit_price %></td>
<td><%= sale_item.taxable_price %></td>
<td><%= sale_item.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<br><br>
<a href="<%= crm_customers_path%>" class="btn btn-primary pull">
<i class="fa fa-arrow-left fa-xs"></i> Back
</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,85 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= crm_customers_path %>">Customer</a>
</li>
<li class="active">Details
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<hr>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Contact no</th>
<th>Company</th>
<th>Date Of Birth</th>
<th>Membership Account</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @crm_customer.name %></td>
<td><%= @crm_customer.email %></td>
<td><%= @crm_customer.contact_no %></td>
<td><%= @crm_customer.company %></td>
<td><%= @crm_customer.date_of_birth %> </td>
</tr>
</tbody>
</table>
<br>
<h3>Sale Items</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Tax Price</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @sale_items.each do |sale_item| %>
<tr>
<td><%= sale_item.sale_id %></td>
<td><%= sale_item.product_name %></td>
<td><%= sale_item.qty %></td>
<td><%= sale_item.unit_price %></td>
<td><%= sale_item.taxable_price %></td>
<td><%= sale_item.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -21,7 +21,7 @@
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
<% if !flash["errors"]%>
<%=message%>
<%=message%>
<% end %>
</div>
<% end %>

View File

@@ -28,8 +28,8 @@
<li class="navbar-nav mr-auto dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">&nbsp;&nbsp;&nbsp;Transactions</a>
<ul class="dropdown-menu">
<li><%= link_to "Orders ", settings_orders_path, :tabindex =>"-1" %></li>
<li><%= link_to "Sales ", settings_sales_path, :tabindex =>"-1" %></li>
<li><%= link_to "Orders ", transactions_orders_path, :tabindex =>"-1" %></li>
<li><%= link_to "Sales ", transactions_sales_path, :tabindex =>"-1" %></li>
</ul>
</li>
<li class="navbar-nav mr-auto dropdown">

View File

@@ -24,9 +24,10 @@
<tr>
<td colspan="6">
<%= form_tag crm_customers_path, :method => :get do %>
<div class="input-append form-group pull-left">
<input type="text" name="filter" placeholder="Search" class="form-control input-sm col-md-8">
<% path ="/origami/#{@sale_id}/customers" %>
<%= form_tag path, :method => :get do %>
<div class="input-append col-md-12 form-group pull-left">
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" class="form-control input-sm col-md-4">
<button type="submit" class="btn btn-primary btn-sm">Search</button>
</div>
<% end %>
@@ -42,17 +43,21 @@
</thead>
<tbody>
<% @crm_customers.each do |crm_customer| %>
<tr>
<td>
<input type="radio" style="width:20px;" value="<%= crm_customer.customer_id %>" name="checkbox" class="checkbox_check" ></td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.company rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
</tr>
<% if @crm_customers.count > 0 %>
<% @crm_customers.each do |crm_customer| %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.company rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
</tr>
<% end %>
<%else%>
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
<% end %>
</tbody>
</table>
@@ -110,8 +115,9 @@
<%end%>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<a href="<%= origami_root_path%>" class="btn btn-primary btn-lg ">
Back
<br>
<a href="<%= origami_root_path%>" class="btn btn-primary">
<i class="fa fa-arrow-left fa-lg"></i> Back
</a>
</div>
</div>
@@ -128,11 +134,11 @@
$('.datepicker').css('cursor','pointer');
});
$(document).on('click',".checkbox_check",function(){
if(this.checked){
$(document).on('click',".customer_tr",function(){
// if(this.checked){
var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).val();
var customer_id = $(this).attr('data-ref');
if(sale_id != 0){
// var url = "/"+customer_id;
@@ -171,9 +177,9 @@
//$(".edit_customer").attr('method', 'PATCH');
}
});
}else{
// }else{
}
// }
})
function update_sale(customer_id,sale_id) {

View File

@@ -1,84 +0,0 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_sales_path %>">Sale</a>
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td colspan="8">
<%= form_tag settings_sales_path, :method => :get do %>
<div class="input-append form-group pull-right">
<!-- <input data-behaviour='datepicker' class="datepicker col-md-3 form-control" name="date" id="date" type="text" placeholder="Search by date" style="margin-right: 10px"> -->
<input type="text" name="receipt_no" class="col-md-8 form-control" placeholder="Receipt No" style="margin-right: 10px">
<button type="submit" class="btn btn-primary btn">Search</button>
</div>
<% end %>
</td>
</tr>
<tr>
<th>Sale Id </th>
<th>Receipt no </th>
<th>Grand total</th>
<th>Tax amount</th>
<th>Cashier</th>
<th>Sales status</th>
<th>Receipt Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% @sales.each do |sale| %>
<tr>
<td><%= sale.sale_id %></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") %> </td>
<td><%= link_to 'Show', settings_sale_path(sale) %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
</script>

View File

@@ -1,103 +0,0 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_sales_path %>">Sale</a>
</li>
<li class="active">
<a href="<%= settings_sales_path %>"><%= @sale.sale_id %></a>
</li>
</ol>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Receipt Date </th>
<th>Receipt no</th>
<th>Cashier</th>
<th>OSales status</th>
<th>Receipt generated at</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
<td><%= @sale.receipt_no %></td>
<td><%= @sale.cashier rescue '-' %></td>
<td> <%= @sale.sale_status %> </td>
<td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td>
</tr>
<tr style="border-top:2px solid #000">
<th>Sale item name</th>
<th> Qty</th>
<th>Unit price</th>
<th>Total pirce </th>
<th>Created at</th>
</tr>
<% @sale.sale_items.each do |s| %>
<tr>
<td><%=s.product_name rescue ' '%></td>
<td><%=s.qty rescue ' '%></td>
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
</tr>
<% end %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td>Total</td>
<td colspan="2"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Tax</td>
<td colspan="2"><%= number_with_precision(@sale.total_tax, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Discount</td>
<td colspan="2"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Grand Total</td>
<td colspan="2"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr><td>&nbsp;<td></tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Pay Amount</td>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Change</td>
<td colspan="2"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
</tbody>
</table>
<a href="<%= settings_sales_path%>" class="btn btn-primary pull-left">
<i class="fa fa-arrow-left fa-xs"></i> Back
</a>
</div>
</div>
</div>
</div>

View File

@@ -3,7 +3,7 @@
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_orders_path %>">Order</a>
<a href="<%= transactions_orders_path %>">Order</a>
</li>
</ol>
@@ -19,7 +19,7 @@
<thead>
<tr>
<td colspan="6">
<%= form_tag settings_orders_path, :method => :get do %>
<%= form_tag transactions_orders_path, :method => :get do %>
<div class="input-append form-group pull-right">
<input type="text" name="filter" placeholder="Order ID" class="form-control input-sm col-md-8">
<button type="submit" class="btn btn-primary btn-sm">Search</button>
@@ -48,7 +48,7 @@
<td><%= order.status %></td>
<td> <%= order.date.strftime("%d-%m-%Y") %> </td>
<td> <%= order.item_count %> </td>
<td><%= link_to 'Show', settings_order_path(order) %></td>
<td><%= link_to 'Show', transactions_order_path(order) %></td>
</tr>
<% end %>
</tbody>

View File

@@ -1,59 +1,84 @@
<p id="notice"><%= notice %></p>
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= transactions_sales_path %>">Sale</a>
</li>
</ol>
</div>
</div>
<h1>Transactions Sales</h1>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td colspan="8">
<%= form_tag transactions_sales_path, :method => :get do %>
<div class="input-append form-group pull-right col-md-6">
<!-- <input class="datepicker col-md-3 form-control" name="date" id="date" type="text" placeholder="Receipt date" style="margin-right: 10px"> -->
<input type="text" name="receipt_no" class="col-md-6 form-control" placeholder="Receipt No" style="margin-right: 10px">
<button type="submit" class="btn btn-primary btn">Search</button>
</div>
<% end %>
</td>
</tr>
<tr>
<th>Sale Id </th>
<th>Receipt no </th>
<th>Grand total</th>
<th>Tax amount</th>
<th>Cashier</th>
<th>Sales status</th>
<th>Receipt Date</th>
<th>Action</th>
</tr>
</thead>
<table>
<thead>
<tr>
<th>Cashier</th>
<th>Cashier name</th>
<th>Requested by</th>
<th>Requested at</th>
<th>Receipt no</th>
<th>Receipt date</th>
<th>Customer</th>
<th>Payment status</th>
<th>Sale status</th>
<th>Total amount</th>
<th>Total discount</th>
<th>Total tax</th>
<th>Tax type</th>
<th>Grand total</th>
<th>Rounding adjustment</th>
<th>Amount received</th>
<th>Amount changed</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @sales.each do |sale| %>
<tbody>
<% @transactions_sales.each do |transactions_sale| %>
<tr>
<td><%= transactions_sale.cashier %></td>
<td><%= transactions_sale.cashier_name %></td>
<td><%= transactions_sale.requested_by %></td>
<td><%= transactions_sale.requested_at %></td>
<td><%= transactions_sale.receipt_no %></td>
<td><%= transactions_sale.receipt_date %></td>
<td><%= transactions_sale.customer %></td>
<td><%= transactions_sale.payment_status %></td>
<td><%= transactions_sale.sale_status %></td>
<td><%= transactions_sale.total_amount %></td>
<td><%= transactions_sale.total_discount %></td>
<td><%= transactions_sale.total_tax %></td>
<td><%= transactions_sale.tax_type %></td>
<td><%= transactions_sale.grand_total %></td>
<td><%= transactions_sale.rounding_adjustment %></td>
<td><%= transactions_sale.amount_received %></td>
<td><%= transactions_sale.amount_changed %></td>
<td><%= link_to 'Show', transactions_sale %></td>
<td><%= link_to 'Edit', edit_transactions_sale_path(transactions_sale) %></td>
<td><%= link_to 'Destroy', transactions_sale, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<tr>
<td><%= sale.sale_id %></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") %> </td>
<td><%= link_to 'Show', transactions_sale_path(sale) %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
</div>
</div>
<br>
</div>
</div>
<script type="text/javascript">
$(function () {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
</script>
<%= link_to 'New Transactions Sale', new_transactions_sale_path %>

View File

@@ -0,0 +1,59 @@
<p id="notice"><%= notice %></p>
<h1>Transactions Sales</h1>
<table>
<thead>
<tr>
<th>Cashier</th>
<th>Cashier name</th>
<th>Requested by</th>
<th>Requested at</th>
<th>Receipt no</th>
<th>Receipt date</th>
<th>Customer</th>
<th>Payment status</th>
<th>Sale status</th>
<th>Total amount</th>
<th>Total discount</th>
<th>Total tax</th>
<th>Tax type</th>
<th>Grand total</th>
<th>Rounding adjustment</th>
<th>Amount received</th>
<th>Amount changed</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @transactions_sales.each do |transactions_sale| %>
<tr>
<td><%= transactions_sale.cashier %></td>
<td><%= transactions_sale.cashier_name %></td>
<td><%= transactions_sale.requested_by %></td>
<td><%= transactions_sale.requested_at %></td>
<td><%= transactions_sale.receipt_no %></td>
<td><%= transactions_sale.receipt_date %></td>
<td><%= transactions_sale.customer %></td>
<td><%= transactions_sale.payment_status %></td>
<td><%= transactions_sale.sale_status %></td>
<td><%= transactions_sale.total_amount %></td>
<td><%= transactions_sale.total_discount %></td>
<td><%= transactions_sale.total_tax %></td>
<td><%= transactions_sale.tax_type %></td>
<td><%= transactions_sale.grand_total %></td>
<td><%= transactions_sale.rounding_adjustment %></td>
<td><%= transactions_sale.amount_received %></td>
<td><%= transactions_sale.amount_changed %></td>
<td><%= link_to 'Show', transactions_sale %></td>
<td><%= link_to 'Edit', edit_transactions_sale_path(transactions_sale) %></td>
<td><%= link_to 'Destroy', transactions_sale, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Transactions Sale', new_transactions_sale_path %>

View File

@@ -1,89 +1,103 @@
<p id="notice"><%= notice %></p>
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_sales_path %>">Sale</a>
</li>
<li class="active">
<a href="<%= settings_sales_path %>"><%= @sale.sale_id %></a>
</li>
</ol>
</div>
</div>
<hr>
<p>
<strong>Cashier:</strong>
<%= @transactions_sale.cashier %>
</p>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Receipt Date </th>
<th>Receipt no</th>
<th>Cashier</th>
<th>OSales status</th>
<th>Receipt generated at</th>
</tr>
</thead>
<p>
<strong>Cashier name:</strong>
<%= @transactions_sale.cashier_name %>
</p>
<tbody>
<tr>
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
<td><%= @sale.receipt_no %></td>
<td><%= @sale.cashier rescue '-' %></td>
<td> <%= @sale.sale_status %> </td>
<td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td>
</tr>
<tr style="border-top:2px solid #000">
<th>Sale item name</th>
<th> Qty</th>
<th>Unit price</th>
<th>Total pirce </th>
<th>Created at</th>
</tr>
<% @sale.sale_items.each do |s| %>
<p>
<strong>Requested by:</strong>
<%= @transactions_sale.requested_by %>
</p>
<tr>
<td><%=s.product_name rescue ' '%></td>
<td><%=s.qty rescue ' '%></td>
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
</tr>
<% end %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td>Total</td>
<td colspan="2"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Tax</td>
<td colspan="2"><%= number_with_precision(@sale.total_tax, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Discount</td>
<td colspan="2"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Grand Total</td>
<td colspan="2"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr><td>&nbsp;<td></tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Pay Amount</td>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Change</td>
<td colspan="2"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<p>
<strong>Requested at:</strong>
<%= @transactions_sale.requested_at %>
</p>
</tbody>
</table>
<a href="<%= settings_sales_path%>" class="btn btn-primary pull-left">
<i class="fa fa-arrow-left fa-xs"></i> Back
</a>
</div>
</div>
<p>
<strong>Receipt no:</strong>
<%= @transactions_sale.receipt_no %>
</p>
</div>
</div>
<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

@@ -0,0 +1,89 @@
<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 %>