transaction sales
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -1,6 +1,6 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
ruby '2.4.1'
|
ruby '2.6.5'
|
||||||
#ruby '2.5.7'
|
#ruby '2.5.7'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -236,3 +236,54 @@ i.logout_icon{
|
|||||||
.input-group-addon {
|
.input-group-addon {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
.access_number{
|
||||||
|
width: 33%;
|
||||||
|
height:58px;
|
||||||
|
line-height:58px;
|
||||||
|
text-align:center;
|
||||||
|
background:#54A5AF;
|
||||||
|
// float:left;
|
||||||
|
// margin:2px;
|
||||||
|
font-size:20px;
|
||||||
|
color:white;
|
||||||
|
// cursor:pointer;
|
||||||
|
}
|
||||||
|
.border-top{
|
||||||
|
border-top:1px solid #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-right{
|
||||||
|
border-right:1px solid #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-left{
|
||||||
|
border-left:1px solid #fff;
|
||||||
|
}
|
||||||
|
.bottom{
|
||||||
|
margin-bottom:1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Colors */
|
||||||
|
.purple {
|
||||||
|
background-color:#7a62d3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.orange{
|
||||||
|
background-color:#FF7F50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
background-color:#F44336;
|
||||||
|
}
|
||||||
|
|
||||||
|
.green{
|
||||||
|
background-color: #009900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.orange{
|
||||||
|
background-color: #FF8C00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blue{
|
||||||
|
background-color: blue;
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,31 +6,30 @@ class Transactions::SalesController < ApplicationController
|
|||||||
# GET /transactions/sales
|
# GET /transactions/sales
|
||||||
# GET /transactions/sales.json
|
# GET /transactions/sales.json
|
||||||
def index
|
def index
|
||||||
|
sale =nil
|
||||||
receipt_no = params[:receipt_no]
|
receipt_no = params[:receipt_no]
|
||||||
# from = params[:from]
|
from = params[:from]
|
||||||
# to = params[:to]
|
to = params[:to]
|
||||||
from, to = get_date_range_from_params
|
|
||||||
@shift = ''
|
|
||||||
if params[:shift_name].to_i != 0
|
if params[:shift_name].to_i != 0
|
||||||
@shift = ShiftSale.find(params[:shift_name])
|
@shift = ShiftSale.find(params[:shift_name])
|
||||||
end
|
end
|
||||||
|
if params[:period].blank? && from.blank? && to.blank?
|
||||||
if receipt_no.nil? && from.nil? && to.nil?
|
|
||||||
if @shift.blank?
|
if @shift.blank?
|
||||||
@sales = Sale.where("NOT sale_status='new'").order("sale_id desc")
|
if current_user.role =="cashier"
|
||||||
else
|
@shift =ShiftSale.current_open_shift(current_user)
|
||||||
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").order("sale_id desc")
|
end
|
||||||
end
|
end
|
||||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
|
|
||||||
else
|
else
|
||||||
sale = Sale.search(receipt_no,from,to,@shift)
|
from, to = get_date_range_from_params
|
||||||
if sale.count > 0
|
end
|
||||||
@sales = sale
|
sale = Sale.search(receipt_no,from,to,@shift)
|
||||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
|
if !sale.nil?
|
||||||
else
|
if sale.count > 0
|
||||||
@sales = 0
|
@sales = sale
|
||||||
end
|
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
|
||||||
|
else
|
||||||
|
@sales = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@receipt_no = receipt_no
|
@receipt_no = receipt_no
|
||||||
@from = from
|
@from = from
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class Ability
|
|||||||
can :create, :discount
|
can :create, :discount
|
||||||
can :remove_discount_items, :discount
|
can :remove_discount_items, :discount
|
||||||
can :remove_all_discount, :discount
|
can :remove_all_discount, :discount
|
||||||
can :member_discount, :discount
|
can :member_discount, :discount
|
||||||
|
|
||||||
can :first_bill, :payment
|
can :first_bill, :payment
|
||||||
can :show, :payment
|
can :show, :payment
|
||||||
@@ -205,6 +205,7 @@ class Ability
|
|||||||
|
|
||||||
can :overall_void, :void
|
can :overall_void, :void
|
||||||
can :manage, Sale
|
can :manage, Sale
|
||||||
|
can :show, :receipt_no
|
||||||
|
|
||||||
elsif user.role == "account"
|
elsif user.role == "account"
|
||||||
|
|
||||||
|
|||||||
@@ -704,14 +704,14 @@ class Sale < ApplicationRecord
|
|||||||
if shift.blank?
|
if shift.blank?
|
||||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(receipt_date,'%Y-%m-%d') <= ? and NOT sale_status = 'new' ", from,to)
|
sale = Sale.where("DATE_FORMAT(receipt_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(receipt_date,'%Y-%m-%d') <= ? and NOT sale_status = 'new' ", from,to)
|
||||||
else
|
else
|
||||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(receipt_date,'%Y-%m-%d') <= ? and NOT sale_status = 'new' and shift_sale_id = '#{shift.id}'", from,to)
|
sale = Sale.where("(DATE_FORMAT(receipt_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(receipt_date,'%Y-%m-%d') <= ? and NOT sale_status = 'new') and shift_sale_id = '#{shift.id}'", from,to)
|
||||||
end
|
end
|
||||||
query = sale.where(keyword)
|
query = sale.where(keyword)
|
||||||
else
|
else
|
||||||
if shift.blank?
|
if shift.blank?
|
||||||
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%")
|
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%")
|
||||||
else
|
else
|
||||||
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}' and shift_sale_id = ?","%#{filter}%","%#{filter}%",shift.id)
|
where("(receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}') and shift_sale_id = ?","%#{filter}%","%#{filter}%",shift.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
.order("sale_id DESC")
|
.order("sale_id DESC")
|
||||||
|
|||||||
@@ -162,7 +162,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<%food_court = Lookup.find_by_lookup_type_and_value("food_court", "1")%>
|
<%food_court = Lookup.find_by_lookup_type_and_value("food_court", "1")%>
|
||||||
<% if food_court %>
|
<% if food_court && ShiftSale.current_open_shift(current_user)%>
|
||||||
<li>
|
<li>
|
||||||
<p class="waves-effect waves-block p-l-30 m-b-5 close_cashier">
|
<p class="waves-effect waves-block p-l-30 m-b-5 close_cashier">
|
||||||
<i class="material-icons font-7 logout_icon">close</i>
|
<i class="material-icons font-7 logout_icon">close</i>
|
||||||
|
|||||||
@@ -21,4 +21,4 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<% breadcrumb_add t(:bookings), "", @food_court ? foodcourt_food_court_path : dashboard_path %>
|
<% breadcrumb_add t(:bookings), "", (@food_court && current_user.role=='cashier') ? foodcourt_food_court_path : dashboard_path %>
|
||||||
<style>
|
<style>
|
||||||
@media screen and (max-width: 785px) {
|
@media screen and (max-width: 785px) {
|
||||||
section.content{
|
section.content{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<% breadcrumb_add t('views.right_panel.detail.order'), "", @food_court ? foodcourt_food_court_path : dashboard_path %>
|
<% breadcrumb_add t('views.right_panel.detail.order'), "", (@food_court && current_user.role=='cashier') ? foodcourt_food_court_path : dashboard_path %>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@media screen and (max-width: 785px) {
|
@media screen and (max-width: 785px) {
|
||||||
section.content{
|
section.content{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<% breadcrumb_add t('sale'), "", @food_court ? transactions_bookings_path : dashboard_path %>
|
<% breadcrumb_add t('sale'), "", (@food_court && current_user.role=='cashier') ? foodcourt_food_court_path : dashboard_path %>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@media screen and (max-width: 785px) {
|
@media screen and (max-width: 785px) {
|
||||||
section.content{
|
section.content{
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<% breadcrumb_add t('sale'), transactions_sales_path, transactions_sales_path, t('details') %>
|
<% breadcrumb_add t('sale'), transactions_sales_path, :back, t('details') %>
|
||||||
<% if can? :menage, Inventory %>
|
|
||||||
<% end %>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
|
|||||||
Reference in New Issue
Block a user