update report detail ,close_cashire_pdf and view reports
This commit is contained in:
@@ -30,12 +30,20 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
|
|
||||||
unique_code = "CloseCashierPdf"
|
unique_code = "CloseCashierPdf"
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop.find(1)
|
||||||
|
#get tax
|
||||||
|
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||||
|
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||||
|
|
||||||
|
puts @sale_taxes.to_a
|
||||||
|
puts @sale_taxes
|
||||||
|
puts @sale_taxes.to_json
|
||||||
|
puts "taxxxxxxxxxxxx"
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_close_cashier(print_settings,@shift,shop_details)
|
printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ class Reports::DailysaleController < BaseReportController
|
|||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
def index
|
def index
|
||||||
from, to ,report_type = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
@sale_data = Sale.daily_sales_list(from,to)
|
@sale_data = Sale.daily_sales_list(from,to)
|
||||||
@tax = SaleTax.get_tax(from,to)
|
@tax = SaleTax.get_tax(from,to)
|
||||||
|
@from = from
|
||||||
|
@to = to
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ authorize_resource :class => false
|
|||||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to, params[:payment_type])
|
payment_type = params[:payment_type]
|
||||||
|
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
|
||||||
|
@sale_taxes = Sale.get_separate_tax(@shift,from,to,payment_type)
|
||||||
|
|
||||||
|
@from = from
|
||||||
|
@to = to
|
||||||
|
|
||||||
if @shift.present?
|
if @shift.present?
|
||||||
@shift.each do |sh|
|
@shift.each do |sh|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||||
@sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
@sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
||||||
|
|
||||||
|
@from = from
|
||||||
|
@to = to
|
||||||
|
|
||||||
if shift.present?
|
if shift.present?
|
||||||
shift.each do |sh|
|
shift.each do |sh|
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ class Reports::ShiftsaleController < BaseReportController
|
|||||||
@shift = ShiftSale.find(params[:shift_name])
|
@shift = ShiftSale.find(params[:shift_name])
|
||||||
end
|
end
|
||||||
@sale_data = Sale.get_by_shiftsales(from,to,@shift)
|
@sale_data = Sale.get_by_shiftsales(from,to,@shift)
|
||||||
|
@from = from
|
||||||
|
@to = to
|
||||||
|
if @shift.present?
|
||||||
|
|
||||||
|
@shift_from = @shift.shift_started_at.nil? ? '-' : @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
|
@shift_to = @shift.shift_closed_at.nil? ? '-' : @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
|
@shift_data = @shift
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
#Bill Receipt Print
|
#Bill Receipt Print
|
||||||
def print_close_cashier(printer_settings,shift_sale,shop_details)
|
def print_close_cashier(printer_settings,shift_sale,shop_details,sale_taxes)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
cashier = shift_sale.employee.name
|
cashier = shift_sale.employee.name
|
||||||
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
||||||
|
|
||||||
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details)
|
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes)
|
||||||
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
self.print(filename)
|
self.print(filename)
|
||||||
|
|||||||
@@ -602,7 +602,6 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
|
|||||||
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
puts payment_type
|
|
||||||
|
|
||||||
query = Sale.all
|
query = Sale.all
|
||||||
if shift.present?
|
if shift.present?
|
||||||
@@ -610,23 +609,47 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
|
|||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
.group("sales.sale_id")
|
.group("sales.sale_id")
|
||||||
else
|
else
|
||||||
query = query .where("sale_status='completed' #{payment_type} and sale_payments.payment_amount != 0 and sales.shift_sale_id in (?)",shift_sale_range.to_a)
|
query = query.where("sale_status='completed' #{payment_type} and sale_payments.payment_amount != 0 and sales.shift_sale_id in (?)",shift_sale_range.to_a)
|
||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
.group("sales.sale_id")
|
.group("sales.sale_id")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_separate_tax(shift,from,to,payment_type)
|
||||||
|
|
||||||
def self.get_separate_tax(from,to,payment_method=nil)
|
if payment_type.blank?
|
||||||
|
payment_type = ''
|
||||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
else
|
||||||
.joins("INNER JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
if payment_type == 'card'
|
||||||
.group("sale_taxes.tax_name")
|
payment_type = " and 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'"
|
||||||
|
else
|
||||||
return query = query.where("sale_status=? and receipt_date between ? and ?","completed",from,to)
|
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||||
|
.joins("INNER JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||||
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
|
.group("sale_taxes.tax_name")
|
||||||
|
.order("sale_taxes.sale_tax_id asc")
|
||||||
|
|
||||||
|
if shift.present?
|
||||||
|
query = query.where("sales.shift_sale_id in (?) #{payment_type} and sale_status= 'completed'", shift.to_a)
|
||||||
|
else
|
||||||
|
query = query.where("sales.receipt_date between ? and ? #{payment_type} and sale_status= 'completed' ",from,to)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# def self.get_separate_tax(from,to,payment_method=nil)
|
||||||
|
|
||||||
|
# query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||||
|
# .joins("INNER JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||||
|
# .group("sale_taxes.tax_name")
|
||||||
|
|
||||||
|
# return query = query.where("sale_status=? and receipt_date between ? and ?","completed",from,to)
|
||||||
|
# end
|
||||||
|
|
||||||
def grand_total_after_rounding
|
def grand_total_after_rounding
|
||||||
return self.old_grand_total.to_f + self.rounding_adjustment.to_f
|
return self.old_grand_total.to_f + self.rounding_adjustment.to_f
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class CloseCashierPdf < Prawn::Document
|
class CloseCashierPdf < Prawn::Document
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||||
def initialize(printer_settings, shift_sale,shop_details)
|
def initialize(printer_settings, shift_sale,shop_details,sale_taxes)
|
||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 7000
|
self.page_height = 7000
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
@@ -32,7 +32,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
shift_detail(shift_sale)
|
shift_detail(shift_sale,sale_taxes)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def shift_detail(shift_sale)
|
def shift_detail(shift_sale,sale_taxes)
|
||||||
move_down 7
|
move_down 7
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
@@ -190,15 +190,17 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.total_discounts}", :size => self.item_font_size, :align => :right
|
text "#{shift_sale.total_discounts}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
sale_taxes.each do |tax|
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
|
||||||
text "Commercial Tax :", :size => self.item_font_size, :align => :right
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "#{tax.tax_name} :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{tax.st_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
|
||||||
text "#{shift_sale.commercial_taxes}", :size => self.item_font_size, :align => :right
|
|
||||||
end
|
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Grand Total :", :size => self.item_font_size, :align => :right
|
text "Grand Total :", :size => self.item_font_size, :align => :right
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label>Select Period</label>
|
<label>Select Period</label>
|
||||||
<select name="period" id="sel_period" class="form-control">
|
<select name="period" id="sel_period" class="form-control">
|
||||||
|
<option value="">Select Period</option>
|
||||||
<option value="0">Today</option>
|
<option value="0">Today</option>
|
||||||
<option value="1">Yesterday</option>
|
<option value="1">Yesterday</option>
|
||||||
<option value="2">This week</option>
|
<option value="2">This week</option>
|
||||||
|
|||||||
@@ -25,10 +25,10 @@
|
|||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="17"> Sale (<%= from rescue '-' %> - <%= to rescue '-'%>)</th>
|
<th colspan="15"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style='text-align:center;'>Sr.no</th>
|
<th style='text-align:center;'>Sr</th>
|
||||||
<th style='text-align:center;'>Date</th>
|
<th style='text-align:center;'>Date</th>
|
||||||
<th style='text-align:center;'>Void Amount</th>
|
<th style='text-align:center;'>Void Amount</th>
|
||||||
<th style='text-align:center;'>Mpu Sales</th>
|
<th style='text-align:center;'>Mpu Sales</th>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="17"> Sale (<%= from rescue '-' %> - <%= to rescue '-'%>)</th>
|
<th colspan="15"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style='text-align:center;'>Sr.no</th>
|
<th style='text-align:center;'>Sr.no</th>
|
||||||
|
|||||||
@@ -24,11 +24,9 @@
|
|||||||
<table class="table table-striped" border="0">
|
<table class="table table-striped" border="0">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
||||||
<% if !params[:from].blank?%>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7">From Date : <%= params[:from] %> , To Date : <%= params[:to] %></th>
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
|
||||||
<% if @shift_from %>
|
<% if @shift_from %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if @shift_data.employee %>
|
<% if @shift_data.employee %>
|
||||||
@@ -43,7 +41,9 @@
|
|||||||
<th>Cashier Name</th>
|
<th>Cashier Name</th>
|
||||||
<th>Total Amount</th>
|
<th>Total Amount</th>
|
||||||
<th>Discount Amount </th>
|
<th>Discount Amount </th>
|
||||||
<th>Tax Amount</th>
|
<% @sale_taxes.each do |tax| %>
|
||||||
|
<th><%= tax.tax_name %></th>
|
||||||
|
<% end %>
|
||||||
<!-- <th>Other Amount</th> -->
|
<!-- <th>Other Amount</th> -->
|
||||||
<th>Grand Total</th>
|
<th>Grand Total</th>
|
||||||
<th>Rounding Adj.</th>
|
<th>Rounding Adj.</th>
|
||||||
@@ -78,8 +78,9 @@
|
|||||||
<td><%= result.cashier_name rescue '-' %></td>
|
<td><%= result.cashier_name rescue '-' %></td>
|
||||||
<td><%= result.total_amount rescue '-' %></td>
|
<td><%= result.total_amount rescue '-' %></td>
|
||||||
<td><%= result.total_discount rescue '-' %></td>
|
<td><%= result.total_discount rescue '-' %></td>
|
||||||
<td><%= result.total_tax rescue '-' %></td>
|
<% result.sale_taxes.each do |tax| %>
|
||||||
|
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
||||||
|
<%end%>
|
||||||
|
|
||||||
<td><%= result.old_grand_total %></td>
|
<td><%= result.old_grand_total %></td>
|
||||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||||
@@ -91,9 +92,9 @@
|
|||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
<td><b><%= total_sum rescue '-'%></b></td>
|
<td><b><%= total_sum rescue '-'%></b></td>
|
||||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||||
<td><b><%= sprintf "%.2f",total_tax rescue '-'%></b></td><!--
|
<% @sale_taxes.each do |tax| %>
|
||||||
<td><b><%= sprintf "%.2f",service_charge rescue '-'%></b></td> -->
|
<td><b><%= tax.st_amount.round(2) %></b></td>
|
||||||
<!-- <td><b><%= other_amt rescue '-'%></b></td> -->
|
<% end %>
|
||||||
<td><b><%= old_grand_total.to_f.round(2) rescue '-'%></b></td>
|
<td><b><%= old_grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||||
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
||||||
@@ -102,7 +103,9 @@
|
|||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
<td>Total Amount</td>
|
<td>Total Amount</td>
|
||||||
<td>Discount Amount</td>
|
<td>Discount Amount</td>
|
||||||
<td>Tax Amount</td>
|
<% @sale_taxes.each do |tax| %>
|
||||||
|
<td><%= tax.tax_name %></td>
|
||||||
|
<% end %>
|
||||||
<td>Grand Total</td>
|
<td>Grand Total</td>
|
||||||
<td>Rounding Adj.</td>
|
<td>Rounding Adj.</td>
|
||||||
<td>Grand Total +<br/>
|
<td>Grand Total +<br/>
|
||||||
|
|||||||
@@ -2,12 +2,9 @@
|
|||||||
<div class="card row">
|
<div class="card row">
|
||||||
<table class="table table-striped" border="0">
|
<table class="table table-striped" border="0">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
||||||
<% if !params[:from].blank?%>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7">From Date : <%= params[:from] %> , To Date : <%= params[:to] %></th>
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
|
||||||
<% if @shift_from %>
|
<% if @shift_from %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if @shift_data.employee %>
|
<% if @shift_data.employee %>
|
||||||
@@ -22,7 +19,10 @@
|
|||||||
<th>Cashier Name</th>
|
<th>Cashier Name</th>
|
||||||
<th>Total Amount</th>
|
<th>Total Amount</th>
|
||||||
<th>Discount Amount </th>
|
<th>Discount Amount </th>
|
||||||
<th>Tax Amount</th>
|
<% @sale_taxes.each do |tax| %>
|
||||||
|
<th><%= tax.tax_name %></th>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
<!-- <th>Other Amount</th> -->
|
<!-- <th>Other Amount</th> -->
|
||||||
<th>Grand Total</th>
|
<th>Grand Total</th>
|
||||||
<th>Rounding Adj.</th>
|
<th>Rounding Adj.</th>
|
||||||
@@ -57,8 +57,9 @@
|
|||||||
<td><%= result.cashier_name rescue '-' %></td>
|
<td><%= result.cashier_name rescue '-' %></td>
|
||||||
<td><%= result.total_amount rescue '-' %></td>
|
<td><%= result.total_amount rescue '-' %></td>
|
||||||
<td><%= result.total_discount rescue '-' %></td>
|
<td><%= result.total_discount rescue '-' %></td>
|
||||||
<td><%= result.total_tax rescue '-' %></td>
|
<% result.sale_taxes.each do |tax| %>
|
||||||
|
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
||||||
|
<%end%>
|
||||||
|
|
||||||
<td><%= result.old_grand_total %></td>
|
<td><%= result.old_grand_total %></td>
|
||||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||||
@@ -70,9 +71,9 @@
|
|||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
<td><b><%= total_sum rescue '-'%></b></td>
|
<td><b><%= total_sum rescue '-'%></b></td>
|
||||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||||
<td><b><%= sprintf "%.2f",total_tax rescue '-'%></b></td><!--
|
<% @sale_taxes.each do |tax| %>
|
||||||
<td><b><%= sprintf "%.2f",service_charge rescue '-'%></b></td> -->
|
<td><b><%= tax.st_amount.round(2) %></b></td>
|
||||||
<!-- <td><b><%= other_amt rescue '-'%></b></td> -->
|
<% end %>
|
||||||
<td><b><%= old_grand_total.to_f.round(2) rescue '-'%></b></td>
|
<td><b><%= old_grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||||
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
||||||
@@ -81,7 +82,9 @@
|
|||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
<td>Total Amount</td>
|
<td>Total Amount</td>
|
||||||
<td>Discount Amount</td>
|
<td>Discount Amount</td>
|
||||||
<td>Tax Amount</td>
|
<% @sale_taxes.each do |tax| %>
|
||||||
|
<td><%= tax.tax_name %></td>
|
||||||
|
<% end %>
|
||||||
<td>Grand Total</td>
|
<td>Grand Total</td>
|
||||||
<td>Rounding Adj.</td>
|
<td>Rounding Adj.</td>
|
||||||
<td>Grand Total +<br/>
|
<td>Grand Total +<br/>
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
<div class="page-header">
|
|
||||||
<ul class="breadcrumb">
|
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
|
||||||
<li>Receipt List Report</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
|
||||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_receipt_no_index_path} %>
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 text-right">
|
|
||||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
|
||||||
<div class="card row">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style='text-align:center;'>Date</th>
|
|
||||||
<th style='text-align:center;'>Receipt No</th>
|
|
||||||
<th style='text-align:center;'>Cashier Name</th>
|
|
||||||
<th style='text-align:center;'>Gross Sales</th>
|
|
||||||
<th style='text-align:center;'>Discount</th>
|
|
||||||
<th style='text-align:center;'>Total Sales</th>
|
|
||||||
<% TaxProfile.all.each do |r|%>
|
|
||||||
<th style='text-align:center;'><%=r.name%></th>
|
|
||||||
<% end %>
|
|
||||||
<th style='text-align:center;'>Nett Sales</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% total_sales = 0 %>
|
|
||||||
<% net_sales = 0 %>
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
|
|
||||||
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
|
|
||||||
<tr>
|
|
||||||
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
|
||||||
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
|
||||||
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
|
||||||
<% sale.sale_taxes.each do |sale|%>
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= paginate @sale_data %>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(function(){
|
|
||||||
var check_arr = [];
|
|
||||||
var search = '<%= params[:period_type] %>';
|
|
||||||
if(search){
|
|
||||||
if(parseInt(search) == 0){
|
|
||||||
search_by_period();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
search_by_date();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
search_by_period();
|
|
||||||
}
|
|
||||||
$('#sel_period').change(function(){
|
|
||||||
search_by_period();
|
|
||||||
});
|
|
||||||
function search_by_period(){
|
|
||||||
var period = $('#sel_period').val();
|
|
||||||
var period_type = 0;
|
|
||||||
var from = "";
|
|
||||||
var to = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#from').change(function(){
|
|
||||||
search_by_date();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#to').change(function(){
|
|
||||||
search_by_date();
|
|
||||||
});
|
|
||||||
function search_by_date(){
|
|
||||||
var from = $('#from').val();
|
|
||||||
var to = $('#to').val();
|
|
||||||
var period = 0;
|
|
||||||
var period_type = 1;
|
|
||||||
if(to != '' && from != ''){
|
|
||||||
shift_name = from + ',' + to;
|
|
||||||
check_arr.push(to);
|
|
||||||
// console.log(check_arr.length)
|
|
||||||
if(check_arr.length == 1){
|
|
||||||
}
|
|
||||||
if(check_arr.length == 3){
|
|
||||||
check_arr = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<div class="span12">
|
|
||||||
<div class="table-responsive">
|
|
||||||
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style='text-align:center;'>Date</th>
|
|
||||||
<th style='text-align:center;'>Receipt No</th>
|
|
||||||
<th style='text-align:center;'>Cashier Name</th>
|
|
||||||
<th style='text-align:center;'>Gross Sales</th>
|
|
||||||
<th style='text-align:center;'>Discount</th>
|
|
||||||
<th style='text-align:center;'>Total Sales</th>
|
|
||||||
<% TaxProfile.all.each do |r|%>
|
|
||||||
<th style='text-align:center;'><%=r.name%></th>
|
|
||||||
<% end %>
|
|
||||||
<th style='text-align:center;'>Nett Sales</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% total_sales = 0 %>
|
|
||||||
<% net_sales = 0 %>
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
|
|
||||||
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
|
|
||||||
<tr>
|
|
||||||
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
|
||||||
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
|
||||||
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
|
||||||
<% sale.sale_taxes.each do |sale|%>
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label>Select Period</label>
|
<label>Select Period</label>
|
||||||
<select name="period" id="sel_period" class="form-control">
|
<select name="period" id="sel_period" class="form-control">
|
||||||
|
<option value="">Select Period</option>
|
||||||
<option value="0">Today</option>
|
<option value="0">Today</option>
|
||||||
<option value="1">Yesterday</option>
|
<option value="1">Yesterday</option>
|
||||||
<option value="2">This week</option>
|
<option value="2">This week</option>
|
||||||
|
|||||||
@@ -29,11 +29,9 @@
|
|||||||
<table class="table table-striped" id="items_table" border="0">
|
<table class="table table-striped" id="items_table" border="0">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
||||||
<% if !params[:from].blank?%>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7">From Date : <%= params[:from] %> , To Date : <%= params[:to] %></th>
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
|
||||||
<% if @shift_from %>
|
<% if @shift_from %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if @shift_data.employee %>
|
<% if @shift_data.employee %>
|
||||||
|
|||||||
@@ -6,11 +6,9 @@
|
|||||||
<table class="table table-striped" id="items_table" border="0">
|
<table class="table table-striped" id="items_table" border="0">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
||||||
<% if !params[:from].blank?%>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7">From Date : <%= params[:from] %> , To Date : <%= params[:to] %></th>
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
|
||||||
<% if @shift_from %>
|
<% if @shift_from %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if @shift_data.employee %>
|
<% if @shift_data.employee %>
|
||||||
|
|||||||
@@ -27,12 +27,20 @@
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<% if params[:from]%>
|
<tr>
|
||||||
<tr>
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
|
||||||
<th colspan="7">From Date : <%= params[:from] rescue '-'%> ,To Date : <%= params[:to] rescue '-'%></th>
|
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
|
||||||
</tr>
|
|
||||||
<% end %>
|
</th>
|
||||||
|
</tr>
|
||||||
|
<% if @shift_from %>
|
||||||
|
<tr>
|
||||||
|
<% if @shift_data.employee %>
|
||||||
|
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||||
|
<% end %>
|
||||||
|
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Cashier Station</th>
|
<th>Cashier Station</th>
|
||||||
<th>Cashier Name</th>
|
<th>Cashier Name</th>
|
||||||
@@ -82,7 +90,7 @@
|
|||||||
|
|
||||||
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
||||||
<% grand_total = result.grand_total.to_f %>
|
<% grand_total = result.grand_total.to_f %>
|
||||||
<td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td>
|
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
||||||
</tr>
|
</tr>
|
||||||
<% cash += result.cash_sales.to_f %>
|
<% cash += result.cash_sales.to_f %>
|
||||||
<% credit += result.credit_sales.to_f %>
|
<% credit += result.credit_sales.to_f %>
|
||||||
@@ -103,7 +111,7 @@
|
|||||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
||||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,11 +1,24 @@
|
|||||||
|
<div class="container margin-top-20">
|
||||||
|
<!-- <div class="span11">
|
||||||
|
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
||||||
|
</div> -->
|
||||||
<div class="card row">
|
<div class="card row">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<% if params[:from]%>
|
<tr>
|
||||||
<tr>
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
|
||||||
<th colspan="7">From Date : <%= params[:from] rescue '-'%> ,To Date : <%= params[:to] rescue '-'%></th>
|
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
|
||||||
</tr>
|
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<% if @shift_from %>
|
||||||
|
<tr>
|
||||||
|
<% if @shift_data.employee %>
|
||||||
|
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||||
|
<% end %>
|
||||||
|
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@@ -57,7 +70,7 @@
|
|||||||
|
|
||||||
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
||||||
<% grand_total = result.grand_total.to_f %>
|
<% grand_total = result.grand_total.to_f %>
|
||||||
<td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td>
|
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
||||||
</tr>
|
</tr>
|
||||||
<% cash += result.cash_sales.to_f %>
|
<% cash += result.cash_sales.to_f %>
|
||||||
<% credit += result.credit_sales.to_f %>
|
<% credit += result.credit_sales.to_f %>
|
||||||
@@ -78,9 +91,10 @@
|
|||||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
||||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user