transaction sales

This commit is contained in:
Myat Zin Wai Maw
2020-02-04 17:47:06 +06:30
parent 70a0c21567
commit 978e7b7e07
11 changed files with 80 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
source 'https://rubygems.org'
ruby '2.4.1'
ruby '2.6.5'
#ruby '2.5.7'

View File

@@ -236,3 +236,54 @@ i.logout_icon{
.input-group-addon {
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;
}

View File

@@ -6,31 +6,30 @@ class Transactions::SalesController < ApplicationController
# GET /transactions/sales
# GET /transactions/sales.json
def index
sale =nil
receipt_no = params[:receipt_no]
# from = params[:from]
# to = params[:to]
from, to = get_date_range_from_params
@shift = ''
from = params[:from]
to = params[:to]
if params[:shift_name].to_i != 0
@shift = ShiftSale.find(params[:shift_name])
@shift = ShiftSale.find(params[:shift_name])
end
if receipt_no.nil? && from.nil? && to.nil?
if params[:period].blank? && from.blank? && to.blank?
if @shift.blank?
@sales = Sale.where("NOT sale_status='new'").order("sale_id desc")
else
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").order("sale_id desc")
if current_user.role =="cashier"
@shift =ShiftSale.current_open_shift(current_user)
end
end
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
else
sale = Sale.search(receipt_no,from,to,@shift)
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
else
@sales = 0
end
from, to = get_date_range_from_params
end
sale = Sale.search(receipt_no,from,to,@shift)
if !sale.nil?
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
else
@sales = 0
end
end
@receipt_no = receipt_no
@from = from

View File

@@ -153,7 +153,7 @@ class Ability
can :create, :discount
can :remove_discount_items, :discount
can :remove_all_discount, :discount
can :member_discount, :discount
can :member_discount, :discount
can :first_bill, :payment
can :show, :payment
@@ -205,6 +205,7 @@ class Ability
can :overall_void, :void
can :manage, Sale
can :show, :receipt_no
elsif user.role == "account"

View File

@@ -704,14 +704,14 @@ class Sale < ApplicationRecord
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)
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
query = sale.where(keyword)
else
if shift.blank?
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%")
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
.order("sale_id DESC")

View File

@@ -162,7 +162,7 @@
</p>
</li>
<%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>
<p class="waves-effect waves-block p-l-30 m-b-5 close_cashier">
<i class="material-icons font-7 logout_icon">close</i>

View File

@@ -21,4 +21,4 @@
<% end %>
</ol>
</div>
<% end %>
<% end %>

View File

@@ -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>
@media screen and (max-width: 785px) {
section.content{

View File

@@ -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>
@media screen and (max-width: 785px) {
section.content{

View File

@@ -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>
@media screen and (max-width: 785px) {
section.content{

View File

@@ -1,6 +1,4 @@
<% breadcrumb_add t('sale'), transactions_sales_path, transactions_sales_path, t('details') %>
<% if can? :menage, Inventory %>
<% end %>
<% breadcrumb_add t('sale'), transactions_sales_path, :back, t('details') %>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<!-- Column One -->