update void sale report and transaction sales
This commit is contained in:
@@ -481,7 +481,7 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
||||
end
|
||||
|
||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id, current_user.name, action_by,remark, "SALEVOID")
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id, current_user.name, action_by,remark, "CANCEL_MMQR_PAYMENT")
|
||||
|
||||
# update complete order items in oqs
|
||||
SaleOrder.where("sale_id = '#{sale.sale_id}'").find_each do |sodr|
|
||||
@@ -561,7 +561,7 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
||||
current_user.name,
|
||||
action_by,
|
||||
remark,
|
||||
"SALEVOID"
|
||||
"CANCEL_MMQR_PAYMENT"
|
||||
)
|
||||
|
||||
SaleOrder.where(sale_id: sale.sale_id).find_each do |sodr|
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Reports::VoidSaleController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
# @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
@@ -16,7 +16,7 @@ authorize_resource :class => false
|
||||
end
|
||||
end
|
||||
|
||||
@sale_data = Sale.get_void_sale(@shift,from,to)
|
||||
@sale_data = Sale.get_void_sale(@shift, from, to, params[:void_filter])
|
||||
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
@@ -1330,20 +1330,29 @@ def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to,filter,
|
||||
credits = credits.group("sale_payments.sale_payment_id, sales_sale_payments.sale_id")
|
||||
end
|
||||
|
||||
def self.get_void_sale(shift,from,to)
|
||||
def self.get_void_sale(shift,from,to, status)
|
||||
sale_arr = Array.new
|
||||
|
||||
query = Sale.select("sales.receipt_no,sales.receipt_date, sales.payment_status, sales.sale_status,sales.total_amount,sales.grand_total, sales.rounding_adjustment")
|
||||
query = Sale.select("sales.sale_id,sales.receipt_no,sales.receipt_date, sales.payment_status, sales.sale_status,sales.total_amount,sales.grand_total, sales.rounding_adjustment")
|
||||
# .joins("INNER JOIN shift_sales sh ON sh.id = sales.shift_sale_id")
|
||||
# .where("sales.sale_status = 'void' and (sh.shift_started_at between ? and ?
|
||||
# OR sh.shift_closed_at between ? and ? )", from ,to, from, to)
|
||||
|
||||
|
||||
if shift.present?
|
||||
query = query.where("sales.sale_status = 'void' and sales.shift_sale_id in (?)",shift.to_a)
|
||||
else
|
||||
query = query.where("sales.sale_status = 'void' and sales.receipt_date between ? and ? ",from,to)
|
||||
end
|
||||
|
||||
if status.present? && status == 'cancelled_mmqr'
|
||||
query = query.joins("INNER JOIN sale_audits sa ON sa.sale_id = sales.sale_id")
|
||||
.where("sa.action = 'CANCEL_MMQR_PAYMENT'")
|
||||
elsif status.present? && status == 'void'
|
||||
query = query.joins("LEFT JOIN sale_audits sa ON sa.sale_id = sales.sale_id AND sa.action = 'CANCEL_MMQR_PAYMENT'")
|
||||
.where("sa.sale_id IS NULL")
|
||||
end
|
||||
|
||||
out = {:items => query}
|
||||
sale_arr.push(out)
|
||||
return sale_arr
|
||||
|
||||
@@ -28,10 +28,18 @@
|
||||
<label class="font-20 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-lg-3 col-md-3 col-sm-3 mbl-style">
|
||||
<!-- <div class="form-group col-lg-3 col-md-3 col-sm-3 mbl-style">
|
||||
<label class="font-20 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
|
||||
</select>
|
||||
</div> -->
|
||||
<div class="form-group col-lg-3 col-md-3 col-sm-3 mbl-style">
|
||||
<label class="font-20 mbl_lbl">Status</label>
|
||||
<select class="form-control select" name="void_filter" id="void_filter" style="height: 37px;">
|
||||
<option value="" <%= 'selected' if params[:void_filter].blank? %>>ALL</option>
|
||||
<option value="void" <%= 'selected' if params[:void_filter] == 'void' %>>Void</option>
|
||||
<option value="cancelled_mmqr" <%= 'selected' if params[:void_filter] == 'cancelled_mmqr' %>>Cancelled Payment (MMQR)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-right-btn mbl-style">
|
||||
<br>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<th><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<th><%= t("views.right_panel.detail.grand_total") %> + <br/><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<!-- <th>Sale Status</th> -->
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -65,7 +65,9 @@
|
||||
<td><%= number_format(item.grand_total.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
|
||||
<td><%= number_format(item.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(item.grand_total.to_f + item.rounding_adjustment.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
|
||||
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
||||
<td>
|
||||
<%= item.sale_audits.where(action: 'CANCEL_MMQR_PAYMENT').exists? ? "payment cancelled (mmqr)" : item.sale_status rescue '-' %>
|
||||
</td>
|
||||
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
||||
</tr>
|
||||
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
|
||||
@@ -74,7 +76,7 @@
|
||||
<% grand_rounding_adjustment = grand_rounding_adjustment.to_f + item.grand_total.to_f + item.rounding_adjustment.to_f %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;font-weight:600;">
|
||||
<tr style="border-top:4px double #666;font-weight:600;">
|
||||
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
||||
<td><%= number_format(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(grand_total, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<th><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<th><%= t("views.right_panel.detail.grand_total") %> + <br/><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<!-- <th>Sale Status</th> -->
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -49,7 +49,7 @@
|
||||
<td><%= item.grand_total.to_f rescue '-'%> </td>
|
||||
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
|
||||
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
||||
<td><%= item.sale_audits.where(action: 'CANCEL_MMQR_PAYMENT').exists? ? "payment cancelled (mmqr)" : item.sale_status rescue '-' %> </td>
|
||||
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
||||
</tr>
|
||||
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
<td><%= sale.total_amount %></td>
|
||||
<td><%= sale.grand_total rescue '-' %></td>
|
||||
<td><%= sale.cashier_name rescue '-' %></td>
|
||||
<td> <%= sale.sale_status %> </td>
|
||||
<td> <%= sale.sale_audits.where(action: 'CANCEL_MMQR_PAYMENT').exists? ? "payment cancelled (mmqr)" : sale.sale_status %> </td>
|
||||
<td> <%= sale.receipt_date.strftime("%d-%m-%Y %I:%M %p") %> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user