Merge branch 'r-1902001-01' into foodcourt
This commit is contained in:
@@ -275,7 +275,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
@payment_methods = PaymentMethodSetting.where(is_active: true).pluck(:payment_method)
|
@payment_methods = PaymentMethodSetting.where(is_active: true).pluck(:payment_method)
|
||||||
@cash = payments.inject(0) { |sum, payment| sum + payment[1] if payment[0] == 'cash' }
|
@cash = payments.inject(0) { |sum, payment| sum + payment[1] if payment[0] == 'cash' }
|
||||||
@credit = payments.inject(0) { |sum, payment| sum + payment[1] if payment[0] == 'creditnote' }
|
@credit = payments.inject(0) { |sum, payment| payment[0] == 'creditnote' ? sum + payment[1] : sum }
|
||||||
@other_payments = payments.select { |payment| !['cash', 'creditnote', 'foc'].include? payment[0] }.map { |method, amount| [ @payment_methods.find { |payment_method| payment_method.parameterize == method }, amount ] }
|
@other_payments = payments.select { |payment| !['cash', 'creditnote', 'foc'].include? payment[0] }.map { |method, amount| [ @payment_methods.find { |payment_method| payment_method.parameterize == method }, amount ] }
|
||||||
@other_payment = @other_payments.sum { |payment| payment[1] }
|
@other_payment = @other_payments.sum { |payment| payment[1] }
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Origami::SalesController < BaseOrigamiController
|
|||||||
Sale.transaction do
|
Sale.transaction do
|
||||||
table = DiningFacility.find(dining)
|
table = DiningFacility.find(dining)
|
||||||
booking = table.current_checkin_booking
|
booking = table.current_checkin_booking
|
||||||
|
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
existing = sale.booking
|
existing = sale.booking
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ class DiningFacility < ApplicationRecord
|
|||||||
has_many :order_queue_stations, -> { where(is_active: true) }, through: :order_queue_process_by_zones
|
has_many :order_queue_stations, -> { where(is_active: true) }, through: :order_queue_process_by_zones
|
||||||
|
|
||||||
has_many :bookings
|
has_many :bookings
|
||||||
has_many :current_bookings, -> { left_joins(:sale).assign.merge(Booking.where(checkout_at: nil).or(Booking.merge(Sale.where(sale_status: ['new', nil])))) }, class_name: "Booking"
|
has_many :current_bookings, -> { left_joins(:sale).assign.merge(Booking.unscoped.where(checkout_at: nil).or(Booking.merge(Sale.unscoped.where(sale_status: ['new', nil])))) }, class_name: "Booking"
|
||||||
has_one :current_checkin_booking, -> { left_joins(:sale).assign.merge(Sale.where(sale_status: nil)) }, class_name: "Booking"
|
has_one :current_checkin_booking, -> { left_joins(:sale).assign.merge(Sale.unscoped.where(sale_status: nil)) }, class_name: "Booking"
|
||||||
has_one :current_checkout_booking, -> { left_joins(:sale).assign.where.not(checkout_at: nil).merge(Sale.where(sale_status: 'new')) }, class_name: "Booking"
|
has_one :current_checkout_booking, -> { left_joins(:sale).assign.where.not(checkout_at: nil).merge(Sale.unscoped.where(sale_status: 'new')) }, class_name: "Booking"
|
||||||
has_one :current_reserved_booking, -> { left_joins(:sale).assign.where.not(reserved_at: nil).merge(Sale.where(sale_status: nil)) }, class_name: "Booking"
|
has_one :current_reserved_booking, -> { left_joins(:sale).assign.where.not(reserved_at: nil).merge(Sale.unscoped.where(sale_status: nil)) }, class_name: "Booking"
|
||||||
|
|
||||||
has_many :current_sales, -> { where(sale_status: 'new').merge(Booking.assign) }, through: :bookings, class_name: "Sale", source: "sale"
|
has_many :current_sales, -> { where(sale_status: 'new').merge(Booking.assign) }, through: :bookings, class_name: "Sale", source: "sale"
|
||||||
|
|
||||||
|
|||||||
@@ -794,6 +794,8 @@ class Sale < ApplicationRecord
|
|||||||
def self.daily_sales_list(from,to)
|
def self.daily_sales_list(from,to)
|
||||||
payment_methods = SalePayment.where.not(payment_method: ['cash', 'creditnote', 'foc']).distinct.pluck(:payment_method)
|
payment_methods = SalePayment.where.not(payment_method: ['cash', 'creditnote', 'foc']).distinct.pluck(:payment_method)
|
||||||
|
|
||||||
|
tax_profiles = TaxProfile.group(:name).order(:order_by).pluck(:name)
|
||||||
|
|
||||||
sales = select(Sale.column_names)
|
sales = select(Sale.column_names)
|
||||||
.select("#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as `#{method == 'paypar' ? 'redeem' : method}`"}.push('').join(', ')}
|
.select("#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as `#{method == 'paypar' ? 'redeem' : method}`"}.push('').join(', ')}
|
||||||
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
|
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
|
||||||
@@ -804,6 +806,15 @@ class Sale < ApplicationRecord
|
|||||||
.where("(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ", 'completed', 'void', from, to)
|
.where("(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ", 'completed', 'void', from, to)
|
||||||
.group("sale_id").to_sql
|
.group("sale_id").to_sql
|
||||||
|
|
||||||
|
sale_taxes = Sale.select('sales.sale_id, sale_taxes.tax_name')
|
||||||
|
.joins(:sale_taxes)
|
||||||
|
.where('(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ', 'completed', 'void', from, to)
|
||||||
|
.group('sale_id')
|
||||||
|
|
||||||
|
if tax_profiles.present?
|
||||||
|
sale_taxes = sale_taxes.select(tax_profiles.map { |name| "SUM(case when (sale_taxes.tax_name = '#{name}') then sale_taxes.tax_payable_amount else 0 end) as `#{name.parameterize}`"}.join(', '))
|
||||||
|
end
|
||||||
|
|
||||||
daily_total = connection.select_all("SELECT
|
daily_total = connection.select_all("SELECT
|
||||||
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
|
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
|
||||||
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as total_sale,
|
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as total_sale,
|
||||||
@@ -812,8 +823,9 @@ class Sale < ApplicationRecord
|
|||||||
IFNULL(SUM(case when (sale_status='completed') then amount_changed else 0 end),0) as total_change_amount,
|
IFNULL(SUM(case when (sale_status='completed') then amount_changed else 0 end),0) as total_change_amount,
|
||||||
IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
|
IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
|
||||||
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj,
|
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj,
|
||||||
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) / 21 as tax,
|
#{tax_profiles.map { |name| "SUM(`#{name.parameterize}`) as `#{name.parameterize}`"}.push('').join(', ') if tax_profiles.present?}
|
||||||
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) - (IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) / 21) as net_sale,
|
IFNULL(SUM(case when (sale_status='completed') then total_tax else 0 end),0) as tax,
|
||||||
|
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) - (IFNULL(SUM(case when (sale_status='completed') then total_tax else 0 end),0)) as net_sale,
|
||||||
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) + (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as gross_sale,
|
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) + (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as gross_sale,
|
||||||
CAST((CONVERT_TZ(receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
CAST((CONVERT_TZ(receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||||
#{payment_methods.map { |method| pm = method == 'paypar' ? 'redeem' : method; "SUM(`#{pm}`) as `#{pm}`"}.push('').join(', ')}
|
#{payment_methods.map { |method| pm = method == 'paypar' ? 'redeem' : method; "SUM(`#{pm}`) as `#{pm}`"}.push('').join(', ')}
|
||||||
@@ -823,6 +835,7 @@ class Sale < ApplicationRecord
|
|||||||
FROM (
|
FROM (
|
||||||
#{sales}
|
#{sales}
|
||||||
) as s
|
) as s
|
||||||
|
JOIN (#{sale_taxes.to_sql}) AS st ON s.sale_id = st.sale_id
|
||||||
GROUP BY DATE(CONVERT_TZ(receipt_date,'+00:00','+06:30'))").to_hash.map(&:symbolize_keys)
|
GROUP BY DATE(CONVERT_TZ(receipt_date,'+00:00','+06:30'))").to_hash.map(&:symbolize_keys)
|
||||||
return daily_total
|
return daily_total
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</ul>
|
</ul>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
<div id="loading_wrapper" style="display:none;">
|
||||||
|
<div id="loading"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<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">
|
||||||
@@ -657,13 +659,14 @@
|
|||||||
|
|
||||||
swal({
|
swal({
|
||||||
title: "Confirmation !",
|
title: "Confirmation !",
|
||||||
text: 'Are You Sure to assign this customer' + customer + '!',
|
text: 'Are you sure to assign this customer' + customer + '!',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "green",
|
confirmButtonColor: "green",
|
||||||
confirmButtonText: "Yes!",
|
confirmButtonText: "Yes!",
|
||||||
cancelButtonClass: 'btn btn-danger',
|
cancelButtonClass: 'btn btn-danger',
|
||||||
closeOnConfirm: false,
|
closeOnConfirm: true,
|
||||||
}, function () {
|
}, function () {
|
||||||
|
$( "#loading_wrapper").show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
|
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
|
||||||
|
|||||||
@@ -817,10 +817,8 @@
|
|||||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||||
if (discount) {
|
if (discount) {
|
||||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||||
$("button.change_tax").hide();
|
|
||||||
$("#pay").show();
|
$("#pay").show();
|
||||||
}else{
|
}else{
|
||||||
$("button.change_tax").show();
|
|
||||||
$("#pay").hide();
|
$("#pay").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -832,6 +830,7 @@
|
|||||||
var sale_id = this.id;
|
var sale_id = this.id;
|
||||||
window.location.href = '/origami/table/' + dining_id + "/table_invoice/" + sale_id;
|
window.location.href = '/origami/table/' + dining_id + "/table_invoice/" + sale_id;
|
||||||
})
|
})
|
||||||
|
|
||||||
$(".tables").on('click', function () {
|
$(".tables").on('click', function () {
|
||||||
localStorage.setItem('dinning_type','table');
|
localStorage.setItem('dinning_type','table');
|
||||||
var customer_id = $(".customer-id").text();
|
var customer_id = $(".customer-id").text();
|
||||||
@@ -1157,32 +1156,35 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
$('#add_invoice').on('click', function () {
|
$('#add_invoice').on('click', function () {
|
||||||
$("#first_bill").prop('disabled',true);
|
$("#loading_wrapper").show();
|
||||||
$("#pay").prop('disabled',true);
|
$("#add_invoice").prop('disable', true);
|
||||||
var dining_id = "<%= @dining.id %>";
|
$("#first_bill").prop('disabled',true);
|
||||||
var sale_id = $("#sale_id").val(); //<%= @obj_sale.sale_id rescue "" %>
|
$("#pay").prop('disabled',true);
|
||||||
var ajax_url = "/origami/sale/append_order";
|
var dining_id = "<%= @dining.id %>";
|
||||||
// var tax_type = localStorage.getItem("tax_type");
|
var sale_id = $("#sale_id").val(); //<%= @obj_sale.sale_id rescue "" %>
|
||||||
var tax_type = $("#check_tax").val();
|
var ajax_url = "/origami/sale/append_order";
|
||||||
$.ajax({
|
// var tax_type = localStorage.getItem("tax_type");
|
||||||
type: "POST",
|
var tax_type = $("#check_tax").val();
|
||||||
url: ajax_url,
|
$.ajax({
|
||||||
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id + "&tax_type=" + tax_type,
|
type: "POST",
|
||||||
success: function (result) {
|
url: ajax_url,
|
||||||
swal({
|
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id + "&tax_type=" + tax_type,
|
||||||
title: "Information!",
|
success: function (result) {
|
||||||
text: "Invoice updated",
|
swal({
|
||||||
html: true,
|
title: "Information!",
|
||||||
closeOnConfirm: false,
|
text: "Invoice updated",
|
||||||
closeOnCancel: false,
|
html: true,
|
||||||
allowOutsideClick: false
|
closeOnConfirm: false,
|
||||||
}, function () {
|
closeOnCancel: false,
|
||||||
$("#first_bill").removeAttr('disabled');
|
allowOutsideClick: false
|
||||||
$("#pay").removeAttr('disabled');
|
}, function () {
|
||||||
window.location.reload();
|
$("#first_bill").removeAttr('disabled');
|
||||||
});
|
$("#pay").removeAttr('disabled');
|
||||||
}
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
$("#loading_wrapper").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
//show cusotmer rebate amount
|
//show cusotmer rebate amount
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="<%= column_count = @payment_methods.length + 12 %>"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
<th colspan="<%= column_count = @payment_methods.length + 11 + @tax_profiles.length %>"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<% @count = 1 %>
|
<% @count = 1 %>
|
||||||
<% @payment_methods.each_slice(10) do |slice| %>
|
<% @payment_methods.each_slice(10) do |slice| %>
|
||||||
@@ -71,13 +71,11 @@
|
|||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
|
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
|
||||||
<th colspan=4 style='text-align:center;'>Outgoing</th>
|
<th colspan='4' style='text-align:center;'>Outgoing</th>
|
||||||
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Gross Sales = (Income+Discount) - Void"><i class="material-icons md-18">live_help</i></th>
|
<th colspan='<%= @tax_profiles.size %>' style='text-align:center;'>Tax</th>
|
||||||
|
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Net Sales = Income - Tax"><i class="material-icons md-18">live_help</i></th>
|
||||||
|
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Gross Sales = Income + Discount"><i class="material-icons md-18">live_help</i></th>
|
||||||
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Total Sales = Gross Sales - Discount"><i class="material-icons md-18">live_help</i></th>
|
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Total Sales = Gross Sales - Discount"><i class="material-icons md-18">live_help</i></th>
|
||||||
<% if @tax.blank? %>
|
|
||||||
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Tax = Total Sales / 21"><i class="material-icons md-18">live_help</i></th>
|
|
||||||
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Net Sales = Total Sales - Tax"><i class="material-icons md-18">live_help</i></th>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
||||||
@@ -85,22 +83,21 @@
|
|||||||
<% @payment_methods.each do |method| %>
|
<% @payment_methods.each do |method| %>
|
||||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.#{method.parameterize == 'paymal' ? 'card_sales' : method.parameterize}") %></th>
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.#{method.parameterize == 'paymal' ? 'card_sales' : method.parameterize}") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
|
|
||||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||||
|
<% if @tax_profiles.present? %>
|
||||||
|
<% @tax_profiles.each do |name| %>
|
||||||
|
<th style='text-align:center;'><%= t name %></th>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.net_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.gross_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.gross_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.total_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.total_sales") %></th>
|
||||||
<% if @tax.blank? %>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.tax") %></th>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.net_sales") %></th>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<% unless @sale_data.blank? %>
|
<% unless @sale_data.blank? %>
|
||||||
@@ -147,12 +144,16 @@
|
|||||||
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||||
<td style='text-align:right;'><%= number_format(sale[:rounding_adj], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:rounding_adj], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
|
<% if @tax_profiles.present? %>
|
||||||
|
<% @tax_profiles.each do |name| %>
|
||||||
|
<td style='text-align:right;'><%= number_format(sale[name.parameterize.to_sym], precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<td style='text-align:right;'><%= number_format(sale[:net_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(sale[:gross_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:gross_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(sale[:total_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:total_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% if @tax.blank? %>
|
|
||||||
<td style='text-align:right;'><%= number_format(sale[:tax], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_format(sale[:net_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<% count = count + 1 %>
|
<% count = count + 1 %>
|
||||||
@@ -171,33 +172,37 @@
|
|||||||
|
|
||||||
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<td style='text-align:right;'><%= number_format(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(gross_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_format(total_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<% if @tax_profiles.present? %>
|
||||||
<% if @tax.blank? %>
|
<% @tax_profiles.each do |name| %>
|
||||||
<td style='text-align:right;'><%= number_format(tax, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[name.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<td style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_format(gross_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_format(total_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="<%= column_count %>"> </td>
|
<td colspan="<%= column_count %>"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<% total_tax = 0 %>
|
<% total_tax = 0 %>
|
||||||
<% net = 0 %>
|
<% net = 0 %>
|
||||||
<% unless @tax.blank? %>
|
<% if @tax_profiles.present? %>
|
||||||
<% @tax.each do |tax|
|
<% @tax_profiles.each do |name| %>
|
||||||
total_tax += tax.tax_amount.to_f %>
|
<tr style="font-weight:600;">
|
||||||
<tr style="font-weight:600;">
|
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t name rescue '-'%></td>
|
||||||
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
<td colspan="5" style='text-align:right;'>
|
||||||
<td colspan="5" style='text-align:right;'><%= number_format(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[name.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue '-'%>
|
||||||
</tr>
|
</td>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% net = grand_total %>
|
<% net = grand_total %>
|
||||||
<% net = net - rounding_adj%>
|
<% net = net - rounding_adj%>
|
||||||
<% net = net - total_tax %>
|
<% net = net - total_tax %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||||
<td colspan="5" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td colspan="5" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% else %>
|
<% else %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<th></th>
|
<th></th>
|
||||||
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
|
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
|
||||||
<th colspan=4 style='text-align:center;'>Outgoing</th>
|
<th colspan=4 style='text-align:center;'>Outgoing</th>
|
||||||
|
<th colspan='<%= @tax_profiles.size %>' style='text-align:center;'>Tax</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
||||||
@@ -38,13 +39,14 @@
|
|||||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||||
|
<% if @tax_profiles.present? %>
|
||||||
|
<% @tax_profiles.each do |name| %>
|
||||||
|
<th style='text-align:center;'><%= t name %></th>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.net_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.gross_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.gross_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.total_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.total_sales") %></th>
|
||||||
<% if @tax.blank? %>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.tax") %></th>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.net_sales") %></th>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<% unless @sale_data.blank? %>
|
<% unless @sale_data.blank? %>
|
||||||
@@ -90,12 +92,16 @@
|
|||||||
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||||
<td style='text-align:right;'><%= number_format(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
|
<% if @tax_profiles.present? %>
|
||||||
|
<% @tax_profiles.each do |name| %>
|
||||||
|
<td style='text-align:right;'><%= number_format(sale[name.parameterize.to_sym], precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<td style='text-align:right;'><%= number_format(sale[:net_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(sale[:gross_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:gross_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(sale[:total_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:total_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% if @tax.blank? %>
|
|
||||||
<td style='text-align:right;'><%= number_format(sale[:tax], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_format(sale[:net_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<% count = count + 1 %>
|
<% count = count + 1 %>
|
||||||
@@ -114,12 +120,15 @@
|
|||||||
|
|
||||||
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<td style='text-align:right;'><%= number_format(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% if @tax_profiles.present? %>
|
||||||
|
<% @tax_profiles.each do |name| %>
|
||||||
|
<td style='text-align:right;'><%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[name.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<td style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(gross_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(gross_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(total_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(total_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% if @tax.blank? %>
|
|
||||||
<td style='text-align:right;'><%= number_format(tax, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
@@ -127,20 +136,21 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<% total_tax = 0 %>
|
<% total_tax = 0 %>
|
||||||
<% net = 0 %>
|
<% net = 0 %>
|
||||||
<% unless @tax.blank? %>
|
<% if @tax_profiles.present? %>
|
||||||
<% @tax.each do |tax|
|
<% @tax_profiles.each do |name| %>
|
||||||
total_tax += tax.tax_amount.to_f %>
|
<tr style="font-weight:600;">
|
||||||
<tr style="font-weight:600;">
|
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t name rescue '-'%></td>
|
||||||
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
<td colspan="4" style='text-align:right;'>
|
||||||
<td colspan="1" style='text-align:right;'><%= number_format(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[name.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue '-'%>
|
||||||
</tr>
|
</td>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% net = grand_total %>
|
<% net = grand_total %>
|
||||||
<% net = net - rounding_adj%>
|
<% net = net - rounding_adj%>
|
||||||
<% net = net - total_tax %>
|
<% net = net - total_tax %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||||
<td colspan="1" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td colspan="4" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% else %>
|
<% else %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
|
|||||||
Reference in New Issue
Block a user