Merge branch 'ui_ux_changes'
This commit is contained in:
@@ -103,4 +103,8 @@ i.logout_icon{
|
|||||||
/* Second display image */
|
/* Second display image */
|
||||||
.second-display{
|
.second-display{
|
||||||
margin : 12px;
|
margin : 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.float_right{
|
||||||
|
float : right;
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
class Reports::SaleitemController < BaseReportController
|
class Reports::SaleitemController < BaseReportController
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
def index
|
def index
|
||||||
|
|
||||||
|
@account = Account.all
|
||||||
from, to = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
|
|
||||||
shift_sale_range = ''
|
shift_sale_range = ''
|
||||||
@@ -23,8 +24,9 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
account_type = params[:account_type]
|
||||||
@type = params[:sale_type]
|
@type = params[:sale_type]
|
||||||
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
|
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
|
||||||
|
|
||||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ class AssignedOrderItem < ApplicationRecord
|
|||||||
belongs_to :order_queue_station
|
belongs_to :order_queue_station
|
||||||
|
|
||||||
def self.assigned_order_item (order, item_code, instance_code, order_queue_station )
|
def self.assigned_order_item (order, item_code, instance_code, order_queue_station )
|
||||||
|
<<<<<<< HEAD
|
||||||
|
AssignedOrderItem.transaction do
|
||||||
|
=======
|
||||||
|
>>>>>>> 146f727f462174b1daa31972b597448c12e26d8c
|
||||||
assigned_order_item = AssignedOrderItem.new()
|
assigned_order_item = AssignedOrderItem.new()
|
||||||
assigned_order_item.order = order
|
assigned_order_item.order = order
|
||||||
assigned_order_item.item_code = item_code
|
assigned_order_item.item_code = item_code
|
||||||
@@ -16,6 +20,10 @@ class AssignedOrderItem < ApplicationRecord
|
|||||||
assigned_order_item.print_status = false
|
assigned_order_item.print_status = false
|
||||||
assigned_order_item.delivery_status = false
|
assigned_order_item.delivery_status = false
|
||||||
assigned_order_item.save!
|
assigned_order_item.save!
|
||||||
|
<<<<<<< HEAD
|
||||||
|
end
|
||||||
|
=======
|
||||||
|
>>>>>>> 146f727f462174b1daa31972b597448c12e26d8c
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.assigned_order_item_by_job(order_id)
|
def self.assigned_order_item_by_job(order_id)
|
||||||
|
|||||||
@@ -913,9 +913,14 @@ def self.get_other_charges()
|
|||||||
query = query.group("i.sale_item_id")
|
query = query.group("i.sale_item_id")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
|
def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type,account_type)
|
||||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||||
|
if account_type.blank?
|
||||||
|
account_type = ''
|
||||||
|
else
|
||||||
|
account_type = " and acc.title = '#{account_type}'"
|
||||||
|
end
|
||||||
|
|
||||||
query = self.get_item_query(type)
|
query = self.get_item_query(type)
|
||||||
|
|
||||||
discount_query = 0
|
discount_query = 0
|
||||||
@@ -931,7 +936,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
|
|||||||
product = self.get_product_sale()
|
product = self.get_product_sale()
|
||||||
|
|
||||||
if shift.present?
|
if shift.present?
|
||||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
query = query.where("sales.shift_sale_id IN (?) #{account_type} and sale_status='completed'",shift.to_a)
|
||||||
if type.nil? || type == 'all' || type == "other"
|
if type.nil? || type == 'all' || type == "other"
|
||||||
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||||
end
|
end
|
||||||
@@ -954,7 +959,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
|
|||||||
|
|
||||||
### => get all sales range in shift_sales
|
### => get all sales range in shift_sales
|
||||||
elsif shift_sale_range.present?
|
elsif shift_sale_range.present?
|
||||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
query = query.where("sales.shift_sale_id IN (?) #{account_type} and sale_status='completed'",shift_sale_range.to_a)
|
||||||
if type.nil? || type == 'all' || type == "other"
|
if type.nil? || type == 'all' || type == "other"
|
||||||
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||||
end
|
end
|
||||||
@@ -977,11 +982,13 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
|
|||||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||||
|
|
||||||
else
|
else
|
||||||
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
query = query.where("sales.receipt_date between ? and ? #{account_type} and sale_status='completed'",from,to)
|
||||||
|
|
||||||
if type.nil? || type == 'all' || type == "other"
|
if type.nil? || type == 'all' || type == "other"
|
||||||
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||||
end
|
end
|
||||||
product = product.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
product = product.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||||
|
|
||||||
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
||||||
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
||||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay' or sale_payments.payment_method = 'giftvoucher') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay' or sale_payments.payment_method = 'giftvoucher') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||||
|
|||||||
@@ -8,10 +8,18 @@ class SaleOrder < ApplicationRecord
|
|||||||
belongs_to :order
|
belongs_to :order
|
||||||
|
|
||||||
def create_sale_order(sale, order)
|
def create_sale_order(sale, order)
|
||||||
|
<<<<<<< HEAD
|
||||||
|
SaleOrder.transaction do
|
||||||
|
=======
|
||||||
|
>>>>>>> 146f727f462174b1daa31972b597448c12e26d8c
|
||||||
sale_order = SaleOrder.new
|
sale_order = SaleOrder.new
|
||||||
sale_order.sale_id = sale
|
sale_order.sale_id = sale
|
||||||
sale_order.order_id = order
|
sale_order.order_id = order
|
||||||
sale_order.save!
|
sale_order.save!
|
||||||
|
<<<<<<< HEAD
|
||||||
|
end
|
||||||
|
=======
|
||||||
|
>>>>>>> 146f727f462174b1daa31972b597448c12e26d8c
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -32,6 +32,16 @@
|
|||||||
<option value="other">Other Amount Only</option>
|
<option value="other">Other Amount Only</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
|
<label class="font-14"><%= t("views.right_panel.detail.select_account") %></label>
|
||||||
|
|
||||||
|
<select name="account_type" id="account_type" class="form-control">
|
||||||
|
<option value = "">Select Account</option>
|
||||||
|
<% @account.each do |acc| %>
|
||||||
|
<option value="<%=acc.title%>" class="<%=acc.title%>" > <%=acc.title%></option>
|
||||||
|
<%end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||||
@@ -46,9 +56,9 @@
|
|||||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20">
|
<div class="col-lg-12 col-md-12 col-sm-12 margin-top-20">
|
||||||
<br>
|
<br>
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
<input type="submit" value="Generate Report" class='btn btn-primary float_right'>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -70,6 +80,8 @@
|
|||||||
var item = $('#item').val();
|
var item = $('#item').val();
|
||||||
var payment_type = $('#payment_type');
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
|
$("#account_type").val("<%=params[:account_type]%>");
|
||||||
|
|
||||||
if(item == 'order'){
|
if(item == 'order'){
|
||||||
$('#cashier').hide();
|
$('#cashier').hide();
|
||||||
$('#waiter').show();
|
$('#waiter').show();
|
||||||
|
|||||||
Reference in New Issue
Block a user