update search and crm
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
//= require settings/processing_items
|
||||
//= require jquery-ui
|
||||
//= require bootstrap-datepicker
|
||||
|
||||
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
|
||||
@@ -153,4 +155,3 @@ $(function(){
|
||||
}
|
||||
});
|
||||
*/
|
||||
>>>>>>> d54fd19d1c18384ee6b21c43ca51587fb7fa843f
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
@import "jquery-ui";
|
||||
@import "bootstrap-datepicker3";
|
||||
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
|
||||
@@ -10,8 +10,6 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
def show
|
||||
end
|
||||
|
||||
|
||||
|
||||
def add_customer
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
class Settings::OrdersController < ApplicationController
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
if filter.nil?
|
||||
orders = Order.order("order_id desc").limit(1000)
|
||||
else
|
||||
order = Order.where("order_id LIKE ?", "%#{filter}%").order("order_id desc").limit(1000).page(params[:page])
|
||||
if order.count > 0
|
||||
orders = order
|
||||
else
|
||||
orders = Order.order("order_id desc").limit(1000)
|
||||
flash[:notice] = "There is no data."
|
||||
end
|
||||
end
|
||||
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @orders }
|
||||
end
|
||||
end
|
||||
def show
|
||||
|
||||
@order = Order.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @order }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,32 +0,0 @@
|
||||
class Settings::SalesController < ApplicationController
|
||||
def index
|
||||
|
||||
search_date = params[:date]
|
||||
receipt_no = params[:receipt_no]
|
||||
today = Date.today
|
||||
|
||||
if receipt_no.nil?
|
||||
@sales = Sale.order("sale_id").page(params[:page])
|
||||
#@products = Product.order("name").page(params[:page]).per(5)
|
||||
else
|
||||
@sales = Sale.where("receipt_no LIKE ?", "%#{receipt_no}%").order("receipt_no").page(params[:page])
|
||||
end
|
||||
#@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @sales }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@sale = Sale.find(params[:id])
|
||||
# @sale_receivables = SaleReceivable.where('sale_id = ?', @sale.id)
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @sale }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -4,12 +4,34 @@ class Transactions::SalesController < ApplicationController
|
||||
# GET /transactions/sales
|
||||
# GET /transactions/sales.json
|
||||
def index
|
||||
@transactions_sales = Sale.all
|
||||
|
||||
search_date = params[:date]
|
||||
receipt_no = params[:receipt_no]
|
||||
today = Date.today
|
||||
|
||||
if receipt_no.nil?
|
||||
@sales = Sale.order("sale_id").page(params[:page])
|
||||
#@products = Product.order("name").page(params[:page]).per(5)
|
||||
else
|
||||
@sales = Sale.search(receipt_no)
|
||||
end
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @sales }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /transactions/sales/1
|
||||
# GET /transactions/sales/1.json
|
||||
def show
|
||||
|
||||
@sale = Sale.find(params[:id])
|
||||
# @sale_receivables = SaleReceivable.where('sale_id = ?', @sale.id)
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @sale }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /transactions/sales/new
|
||||
|
||||
@@ -292,6 +292,15 @@ class Order < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||
where("order_id LIKE ?", "%#{search}%")
|
||||
else
|
||||
find(:all)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
@@ -261,7 +261,8 @@ class Sale < ApplicationRecord
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
find(:all, :conditions => ['receipt_no LIKE ?', "%#{search}%"])
|
||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||
where("receipt_no LIKE ?", "%#{search}%",)
|
||||
else
|
||||
find(:all)
|
||||
end
|
||||
|
||||
@@ -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 %>
|
||||
@@ -44,9 +44,9 @@
|
||||
<tbody>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<tr>
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" value="<%= crm_customer.customer_id %>" name="checkbox" class="checkbox_check" ></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>
|
||||
@@ -117,8 +117,9 @@
|
||||
<%end%>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<a href="<%= crm_customers_path%>" class="btn btn-primary btn-lg ">
|
||||
Back
|
||||
<br>
|
||||
<a href="<%= crm_customers_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,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;
|
||||
@@ -178,9 +178,9 @@ $(function() {
|
||||
//$(".edit_customer").attr('method', 'PATCH');
|
||||
}
|
||||
});
|
||||
}else{
|
||||
// }else{
|
||||
|
||||
}
|
||||
// }
|
||||
})
|
||||
|
||||
function update_sale(customer_id,sale_id) {
|
||||
@@ -205,7 +205,6 @@ $(function() {
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
alert('Customer has assigned');
|
||||
window.location.href = '/origami'
|
||||
}else{
|
||||
alert('Record not found!');
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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"> 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">
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
<td colspan="6">
|
||||
<% path ="/origami/#{@sale_id}/customers" %>
|
||||
<%= form_tag 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 %>
|
||||
@@ -45,9 +45,9 @@
|
||||
<tbody>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<tr>
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" value="<%= crm_customer.customer_id %>" name="checkbox" class="checkbox_check" ></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>
|
||||
@@ -115,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>
|
||||
@@ -133,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;
|
||||
@@ -176,9 +177,9 @@
|
||||
//$(".edit_customer").attr('method', 'PATCH');
|
||||
}
|
||||
});
|
||||
}else{
|
||||
// }else{
|
||||
|
||||
}
|
||||
// }
|
||||
})
|
||||
|
||||
function update_sale(customer_id,sale_id) {
|
||||
|
||||
@@ -1,68 +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_orders_path %>">Order</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>
|
||||
<td colspan="6">
|
||||
<%= form_tag settings_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>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Order ID </th>
|
||||
<th>Type</th>
|
||||
<th>Customer</th>
|
||||
<th>Order status</th>
|
||||
<th>Order date</th>
|
||||
<th>Items Count</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @orders.each do |order| %>
|
||||
|
||||
<tr>
|
||||
<td><%= order.order_id %></td>
|
||||
<td><%= order.order_type %></td>
|
||||
<td><%= order.customer.name rescue '-' %></td>
|
||||
<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>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<%= paginate @orders %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,85 +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_orders_path %>">Order</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="<%= settings_orders_path %>"><%= @order.order_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>Type</th>
|
||||
<th>Customer</th>
|
||||
<th>Order status</th>
|
||||
<th>Order date</th>
|
||||
<th>Order By</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @order.order_type %></td>
|
||||
<td><%= @order.customer.name rescue '-' %></td>
|
||||
<td><%= @order.status %></td>
|
||||
<td> <%= @order.date.strftime("%d-%m-%Y") %> </td>
|
||||
<td> <%= @order.waiter rescue '-' %> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3>Order Items</h3>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Item Name</th>
|
||||
<th>Qty</th>
|
||||
<th> Unit Price</th>
|
||||
<th>Total Price</th>
|
||||
<th>Option</th>
|
||||
<th>Status</th>
|
||||
<th>Order By</th>
|
||||
<th>Created at</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @order.order_items.each do |order| %>
|
||||
|
||||
<tr>
|
||||
<td><%= order.item_name %></td>
|
||||
<td><%= order.qty %></td>
|
||||
<td><%= order.price %></td>
|
||||
<td><%= order.qty * order.price %></td>
|
||||
<td> <%= order.options %> </td>
|
||||
<td> <%= order.order_item_status %> </td>
|
||||
<td> <%= order.item_order_by %> </td>
|
||||
<td> <%= order.created_at.strftime("%d-%m-%Y") %> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="<%= settings_orders_path%>" class="btn btn-primary pull-left">
|
||||
<i class="fa fa-arrow-left fa-xs"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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> <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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
@@ -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> <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 %>
|
||||
|
||||
@@ -173,10 +173,6 @@ Rails.application.routes.draw do
|
||||
resources :tax_profiles
|
||||
#lookups
|
||||
resources :lookups
|
||||
#orders
|
||||
resources :orders
|
||||
#sales
|
||||
resources :sales
|
||||
#cashier_terminals
|
||||
resources :cashier_terminals
|
||||
#order_job_stations
|
||||
@@ -201,6 +197,7 @@ Rails.application.routes.draw do
|
||||
#--------- Transactions Sections ------------#
|
||||
namespace :transactions do
|
||||
resources :sales
|
||||
resources :orders
|
||||
end
|
||||
|
||||
#--------- Reports Controller Sections ------------#
|
||||
|
||||
Reference in New Issue
Block a user