update payment report
This commit is contained in:
@@ -21,7 +21,7 @@ class Reports::PaymentMethodController < BaseReportController
|
||||
end
|
||||
@payment_type = params[:payment_type]
|
||||
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type)
|
||||
puts @pyament_method.to_json
|
||||
puts @sale_data.to_json
|
||||
puts "sssssssssssss"
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
@@ -26,8 +26,6 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
def get_instance
|
||||
@id = MenuItemInstance.find(params[:id])
|
||||
puts "iddddddddd"
|
||||
puts @id.to_json
|
||||
end
|
||||
|
||||
# GET /settings/menu_item_instances/1/edit
|
||||
|
||||
@@ -813,11 +813,12 @@ end
|
||||
|
||||
def self.get_payment_method_by_shift(shift_sale_range,shift,from,to,payment_type)
|
||||
|
||||
sale_payment = SalePayment.select("s.receipt_no, sale_payments.*,s.receipt_date as sale_date,
|
||||
sale_payment = SalePayment.select("s.amount_changed as change_amount,s.receipt_no, sale_payments.*,s.receipt_date as sale_date,
|
||||
s.cashier_name as cashier_name")
|
||||
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
||||
.order('s.receipt_no DESC')
|
||||
|
||||
payments_total = SalePayment.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||
payments_total = SalePayment.select("sales.amount_changed as total_change_amount,CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||
SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
|
||||
SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<tr>
|
||||
<th> <%= t("views.right_panel.detail.shift_name") %> </th>
|
||||
<th> <%= t("views.right_panel.detail.payment_method") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th> <%= t :payment_method %></th>
|
||||
<th> <%= t("views.right_panel.detail.amount") %> </th>
|
||||
@@ -92,7 +92,11 @@
|
||||
<tbody>
|
||||
<% total = 0 %>
|
||||
<% @pyament_method.each do |payment| %>
|
||||
<% total += payment.payment_amount + payment.outstanding_amount %>
|
||||
<% if payment.payment_method === 'cash'
|
||||
total += payment.payment_amount - payment.change_amount
|
||||
else
|
||||
total += payment.payment_amount
|
||||
end%>
|
||||
<tr>
|
||||
<% if @shift_from.nil? && @shift_to.nil? %>
|
||||
<td><%= payment.sale_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-'%></td>
|
||||
@@ -103,7 +107,11 @@
|
||||
<td><%= payment.cashier_name rescue '-' %></td>
|
||||
<!--<td><%= payment.sale.customer.name rescue '-' %></td>-->
|
||||
<td><%= payment.payment_method rescue '-' %></td>
|
||||
<td><%= payment.payment_amount + payment.outstanding_amount%> </td>
|
||||
<% if payment.payment_method === 'cash' %>
|
||||
<td><%= payment.payment_amount - payment.change_amount%> </td>
|
||||
<%else%>
|
||||
<td><%= payment.payment_amount%> </td>
|
||||
<%end%>
|
||||
<td><%= payment.sale.grand_total rescue '-' %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user