Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -55,7 +55,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
var cashier="";
|
var cashier="";
|
||||||
var receipt_date="";
|
var receipt_date="";
|
||||||
var sub_total=0;
|
var sub_total=0.0;
|
||||||
var discount_amount=0;
|
var discount_amount=0;
|
||||||
var tax_amount=0;
|
var tax_amount=0;
|
||||||
var grand_total_amount=0;
|
var grand_total_amount=0;
|
||||||
@@ -83,34 +83,35 @@ $(document).ready(function(){
|
|||||||
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
|
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#receipt_no").text(receipt_no);
|
|
||||||
$("#cashier").text(cashier == null ? "" : cashier);
|
|
||||||
$("#receipt_date").text(show_date);
|
|
||||||
|
|
||||||
|
|
||||||
//Receipt Charges
|
//Receipt Charges
|
||||||
sub_total += (parse_data.qty*parse_data.price);
|
sub_total += parseFloat(parse_data.price);
|
||||||
|
|
||||||
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
|
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
|
||||||
tax_amount = parse_data.tax_amount;
|
tax_amount = parse_data.tax_amount;
|
||||||
grand_total_amount = parse_data.grand_total_amount;
|
grand_total_amount = parse_data.grand_total_amount;
|
||||||
|
|
||||||
|
// Ordered Items
|
||||||
|
var order_items_rows = "<tr>" +
|
||||||
|
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
||||||
|
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
||||||
|
"<td class='item-attr'>" + parse_data.price + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
|
||||||
|
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cashier Info
|
||||||
|
$("#receipt_no").text(receipt_no);
|
||||||
|
$("#cashier").text(cashier == null ? "" : cashier);
|
||||||
|
$("#receipt_date").text(show_date);
|
||||||
|
|
||||||
|
// Payment Info
|
||||||
$("#order-sub-total").text(sub_total);
|
$("#order-sub-total").text(sub_total);
|
||||||
// $("#order-food").text('');
|
// $("#order-food").text('');
|
||||||
// $("#order-beverage").text('');
|
// $("#order-beverage").text('');
|
||||||
$("#order-discount").text(discount_amount);
|
$("#order-discount").text(discount_amount);
|
||||||
$("#order-Tax").text(tax_amount);
|
$("#order-Tax").text(tax_amount);
|
||||||
$("#order-grand-total").text(grand_total_amount);
|
$("#order-grand-total").text(grand_total_amount);
|
||||||
|
|
||||||
// Ordered Items
|
|
||||||
var order_items_rows = "<tr>" +
|
|
||||||
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
|
||||||
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
|
||||||
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
|
|
||||||
"</tr>";
|
|
||||||
|
|
||||||
$("#order-items-table").children("tbody").append(order_items_rows);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// End AJAX Call
|
// End AJAX Call
|
||||||
|
|||||||
@@ -23,12 +23,70 @@ class BaseReportController < ActionController::Base
|
|||||||
period = params[:period]
|
period = params[:period]
|
||||||
from = params[:from]
|
from = params[:from]
|
||||||
to = params[:to]
|
to = params[:to]
|
||||||
day_ref = Time.now
|
day_ref = Time.now.utc.getlocal
|
||||||
|
|
||||||
|
if params[:report_type] == "daily_sale"
|
||||||
|
|
||||||
|
if from != "" && to != ""
|
||||||
|
|
||||||
|
f_date = DateTime.parse(params[:from])
|
||||||
|
t_date = DateTime.parse(params[:to])
|
||||||
|
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||||
|
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||||
|
from = f_time.beginning_of_day.utc.getlocal
|
||||||
|
to = t_time.end_of_day.utc.getlocal
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
case period.to_i
|
||||||
|
when PERIOD["today"]
|
||||||
|
|
||||||
|
from = day_ref.beginning_of_day.utc
|
||||||
|
to = day_ref.end_of_day.utc
|
||||||
|
|
||||||
|
when PERIOD["yesterday"]
|
||||||
|
from = (day_ref - 1.day).beginning_of_day.utc
|
||||||
|
to = (day_ref - 1.day).end_of_day.utc
|
||||||
|
|
||||||
|
when PERIOD["this_week"]
|
||||||
|
from = Time.now.beginning_of_week.utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_week"]
|
||||||
|
from = (day_ref - 7.day).beginning_of_week.utc
|
||||||
|
to = (day_ref - 7.day).end_of_week.utc
|
||||||
|
when PERIOD["last_7"]
|
||||||
|
from = (day_ref - 7.day).utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["this_month"]
|
||||||
|
from = Time.now.beginning_of_month.utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_month"]
|
||||||
|
from = (day_ref - 1.month).beginning_of_month.utc
|
||||||
|
to = (day_ref - 1.month).end_of_month.utc
|
||||||
|
when PERIOD["last_30"]
|
||||||
|
from = (day_ref - 30.day).utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["this_year"]
|
||||||
|
from = Time.now.beginning_of_year.utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_year"]
|
||||||
|
from = (day_ref - 1.year).beginning_of_year.utc
|
||||||
|
to = (day_ref - 1.year).end_of_year.utc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else # end daily sale report
|
||||||
if period_type.to_i == 1
|
if period_type.to_i == 1
|
||||||
|
|
||||||
if params[:from] && params[:to]
|
if params[:from] && params[:to]
|
||||||
|
|
||||||
if params[:from] != "" && params[:to] !=""
|
if params[:from] != "" && params[:to] !=""
|
||||||
from = DateTime.strptime(params[:from], "%m/%d/%Y")
|
|
||||||
to = DateTime.strptime(params[:to], "%m/%d/%Y")
|
f_date = DateTime.parse(params[:from])
|
||||||
|
t_date = DateTime.parse(params[:to])
|
||||||
|
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||||
|
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||||
|
from = f_time.beginning_of_day.utc.getlocal
|
||||||
|
to = t_time.end_of_day.utc.getlocal
|
||||||
else
|
else
|
||||||
from = day_ref.beginning_of_day.utc
|
from = day_ref.beginning_of_day.utc
|
||||||
to = day_ref.end_of_day.utc
|
to = day_ref.end_of_day.utc
|
||||||
@@ -71,7 +129,11 @@ class BaseReportController < ActionController::Base
|
|||||||
to = (day_ref - 1.year).end_of_year.utc
|
to = (day_ref - 1.year).end_of_year.utc
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return from, to
|
return from, to
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,8 +2,24 @@ class Reports::DailySaleController < BaseReportController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
from, to = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
@sale_data = Sale.get_receipt_no_list(from,to)
|
@sale_data = Sale.daily_sales_list(from,to)
|
||||||
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
|
@tax = SaleTax.get_tax(from,to)
|
||||||
|
end
|
||||||
|
|
||||||
|
# @locations = Location.all
|
||||||
|
|
||||||
|
# branch,from, to, report_type = get_date_range_from_params
|
||||||
|
|
||||||
|
# @location = Location.find_by_id(current_location)
|
||||||
|
# @sale_data = Sale.daily_sales_report(current_location,from,to)
|
||||||
|
# @tax = SaleT.get_tax(current_location,from,to)
|
||||||
|
|
||||||
|
# if @sale_data.blank? && @tax.blank? && request.post?
|
||||||
|
# flash.now[:notice] = "No data available for selected filters"
|
||||||
|
# end
|
||||||
|
|
||||||
|
def show
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -231,7 +231,7 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||||
.where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::TABLE_TYPE,true)
|
.where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::TABLE_TYPE,true)
|
||||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
|
.group("bookings.booking_id")
|
||||||
# For PG
|
# For PG
|
||||||
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true
|
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true
|
||||||
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
||||||
@@ -262,7 +262,7 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||||
.where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::ROOM_TYPE,true)
|
.where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::ROOM_TYPE,true)
|
||||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id")
|
.group("bookings.booking_id")
|
||||||
# For PG
|
# For PG
|
||||||
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true
|
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true
|
||||||
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id
|
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
if oqs.id == oqpbz.order_queue_station_id
|
if oqs.id == oqpbz.order_queue_station_id
|
||||||
#Same Order_items can appear in two location.
|
#Same Order_items can appear in two location.
|
||||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||||
|
else
|
||||||
|
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class Sale < ApplicationRecord
|
|||||||
Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s
|
Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s
|
||||||
#get all order attached to this booking and combine into 1 invoice
|
#get all order attached to this booking and combine into 1 invoice
|
||||||
|
|
||||||
puts booking.booking_orders.length
|
|
||||||
booking.booking_orders.each do |order|
|
booking.booking_orders.each do |order|
|
||||||
if booking.sale_id
|
if booking.sale_id
|
||||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
||||||
@@ -90,6 +89,8 @@ class Sale < ApplicationRecord
|
|||||||
order.save
|
order.save
|
||||||
|
|
||||||
booking.sale_id = self.id
|
booking.sale_id = self.id
|
||||||
|
booking.checkout_at = Time.now.utc
|
||||||
|
booking.checkout_by = requested_by.name
|
||||||
booking.save
|
booking.save
|
||||||
|
|
||||||
return true, self.id
|
return true, self.id
|
||||||
@@ -190,9 +191,14 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
# Tax Calculate
|
# Tax Calculate
|
||||||
def apply_tax(total_taxable)
|
def apply_tax(total_taxable)
|
||||||
|
#if tax is not apply create new record
|
||||||
|
# self.sale_taxes.each do |existing_tax|
|
||||||
|
# #delete existing and create new
|
||||||
|
# existing_tax.delete
|
||||||
|
# end
|
||||||
|
|
||||||
#if tax is not apply create new record
|
#if tax is not apply create new record
|
||||||
self.sale_taxes.each do |existing_tax|
|
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
|
||||||
#delete existing and create new
|
#delete existing and create new
|
||||||
existing_tax.delete
|
existing_tax.delete
|
||||||
end
|
end
|
||||||
@@ -275,6 +281,59 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.daily_sales_list(from,to)
|
||||||
|
payments_total = Sale.select("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,
|
||||||
|
SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount,
|
||||||
|
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='credit') then sale_payments.payment_amount else 0 end) as credit_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
|
||||||
|
.joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
|
.where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to)
|
||||||
|
.group("DATE_FORMAT((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')),'%Y-%m-%d')")
|
||||||
|
|
||||||
|
daily_total = Array.new
|
||||||
|
|
||||||
|
payments_total.each do |pay|
|
||||||
|
sale_date = pay.sale_date
|
||||||
|
diff_time = payments_total.first.sale_date.beginning_of_day.utc - from
|
||||||
|
diff = diff_time % 86400
|
||||||
|
from_date = sale_date.beginning_of_day.utc - diff
|
||||||
|
to_date = sale_date.end_of_day.utc - diff
|
||||||
|
|
||||||
|
total_sale = Sale.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 total_discount else 0 end),0) as total_discount,
|
||||||
|
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")
|
||||||
|
.where("(sale_status = ? OR sale_status = ?) AND receipt_date between ? and ? AND total_amount != 0", 'completed', 'void', from_date, to_date)
|
||||||
|
|
||||||
|
total_sale.each do |sale|
|
||||||
|
grand_total = sale.grand_total
|
||||||
|
total_discount = sale.total_discount
|
||||||
|
void_amount = sale.void_amount
|
||||||
|
total = {:sale_date => pay.sale_date,
|
||||||
|
:mpu_amount => pay.mpu_amount,
|
||||||
|
:master_amount => pay.master_amount,
|
||||||
|
:visa_amount => pay.visa_amount,
|
||||||
|
:jcb_amount => pay.jcb_amount,
|
||||||
|
:paypar_amount => pay.paypar_amount,
|
||||||
|
:cash_amount => pay.cash_amount,
|
||||||
|
:credit_amount => pay.credit_amount,
|
||||||
|
:foc_amount => pay.foc_amount,
|
||||||
|
:total_discount => total_discount,
|
||||||
|
:grand_total => grand_total,
|
||||||
|
:void_amount => void_amount,
|
||||||
|
:rounding_adj => sale.rounding_adj}
|
||||||
|
daily_total.push(total)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
return daily_total
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ class SaleItem < ApplicationRecord
|
|||||||
food_prices = food_prices + food_price
|
food_prices = food_prices + food_price
|
||||||
beverage_prices = beverage_prices + beverage_price
|
beverage_prices = beverage_prices + beverage_price
|
||||||
end
|
end
|
||||||
|
puts food_prices
|
||||||
|
puts beverage_prices
|
||||||
return food_prices, beverage_prices
|
return food_prices, beverage_prices
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -61,6 +63,17 @@ class SaleItem < ApplicationRecord
|
|||||||
return food_price, beverage_price
|
return food_price, beverage_price
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_overall_discount(sale_id)
|
||||||
|
price = 0.0
|
||||||
|
item=SaleItem.where("product_code=?", sale_id)
|
||||||
|
|
||||||
|
item.each do|i|
|
||||||
|
price += i.price
|
||||||
|
end
|
||||||
|
|
||||||
|
return price
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
||||||
|
|||||||
@@ -67,15 +67,19 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
|
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
|
||||||
|
# Control for Paypar Cloud
|
||||||
|
begin
|
||||||
response = HTTParty.get(url,
|
response = HTTParty.get(url,
|
||||||
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json'
|
'Accept' => 'application/json'
|
||||||
}
|
}, :timeout => 10
|
||||||
)
|
)
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = { status: false }
|
||||||
|
end
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||||
@@ -87,13 +91,19 @@ class SalePayment < ApplicationRecord
|
|||||||
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
if sale_data
|
if sale_data
|
||||||
|
# Control for Paypar Cloud
|
||||||
|
begin
|
||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json'
|
'Accept' => 'application/json'
|
||||||
}
|
},
|
||||||
|
:timeout => 10
|
||||||
)
|
)
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = false
|
||||||
|
end
|
||||||
else
|
else
|
||||||
response = false;
|
response = false;
|
||||||
end
|
end
|
||||||
@@ -119,7 +129,6 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def creditnote_payment(customer_id)
|
def creditnote_payment(customer_id)
|
||||||
|
|
||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
self.payment_method = "creditnote"
|
self.payment_method = "creditnote"
|
||||||
@@ -187,17 +196,16 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
#Next time - validate if the vochure number is valid - within
|
#Next time - validate if the vochure number is valid - within
|
||||||
|
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
||||||
|
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
|
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
||||||
|
if membership_data["status"]==true
|
||||||
self.payment_method = "paypar"
|
self.payment_method = "paypar"
|
||||||
self.payment_amount = self.received_amount
|
self.payment_amount = self.received_amount
|
||||||
self.payment_reference = self.voucher_no
|
self.payment_reference = self.voucher_no
|
||||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||||
self.payment_status = "pending"
|
self.payment_status = "pending"
|
||||||
payment_method = self.save!
|
payment_method = self.save!
|
||||||
|
|
||||||
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
|
||||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
|
||||||
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
|
||||||
if membership_data["status"]==true
|
|
||||||
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
|
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
|
||||||
sale_update_payment_status(self.received_amount.to_f)
|
sale_update_payment_status(self.received_amount.to_f)
|
||||||
|
|
||||||
@@ -251,7 +259,12 @@ class SalePayment < ApplicationRecord
|
|||||||
payparcost = payparcost + pp.payment_amount
|
payparcost = payparcost + pp.payment_amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
total_amount = food_prices - payparcost
|
overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||||
|
total_amount = food_prices - payparcost + overall_dis
|
||||||
|
puts "total_amount"
|
||||||
|
puts food_prices
|
||||||
|
puts payparcost
|
||||||
|
puts total_amount
|
||||||
if total_amount > 0
|
if total_amount > 0
|
||||||
receipt_no = sObj.receipt_no
|
receipt_no = sObj.receipt_no
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
@@ -261,6 +274,7 @@ class SalePayment < ApplicationRecord
|
|||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
|
||||||
|
# Control for Paypar Cloud
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
||||||
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
||||||
@@ -272,7 +286,7 @@ class SalePayment < ApplicationRecord
|
|||||||
response = { status: false }
|
response = { status: false }
|
||||||
end
|
end
|
||||||
|
|
||||||
puts response.to_json
|
# puts response.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ class SaleTax < ApplicationRecord
|
|||||||
before_create :generate_custom_id
|
before_create :generate_custom_id
|
||||||
belongs_to :sale
|
belongs_to :sale
|
||||||
|
|
||||||
|
def self.get_tax(from,to)
|
||||||
|
query = SaleTax.select("sale_taxes.tax_name,SUM(sale_taxes.tax_payable_amount) as tax_amount").joins("join sales on sales.sale_id = sale_taxes.sale_id").where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to).group("sale_taxes.tax_name")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI")
|
self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI")
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 2500
|
self.page_height = 2500
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
self.price_width = 35
|
self.price_width = 40
|
||||||
self.qty_width = 20
|
self.qty_width = 20
|
||||||
self.total_width = 35
|
self.total_width = 40
|
||||||
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
|
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
self.item_description_width = (self.page_width-20) / 2
|
self.item_description_width = (self.page_width-20) / 2
|
||||||
@@ -53,29 +53,36 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
# move_down 2
|
# move_down 2
|
||||||
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
|
||||||
text "Receipt No:", :size => self.item_font_size,:align => :left
|
text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
bounding_box([self.label_width, y_position], :width =>self.item_width) do
|
text "#{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||||
text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left
|
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
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.item_width) do
|
||||||
text "Customer:", :size => self.item_font_size,:align => :left
|
text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
|
||||||
end
|
|
||||||
bounding_box([self.label_width,y_position], :width =>self.item_width) do
|
|
||||||
text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
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.item_width, :height => self.item_height) do
|
||||||
text "Date:", :size => self.item_font_size,:align => :left
|
text "Cashier: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.label_width,y_position], :width => self.item_width) do
|
move_down 5
|
||||||
text "#{sale_data.receipt_date.strftime('%Y-%m-%d %I:%M %p')}" , :size => self.item_font_size,:align => :left
|
|
||||||
|
# bounding_box([self.label_width,y_position], :width =>self.item_width) do
|
||||||
|
# text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
||||||
|
# end
|
||||||
|
# move_down 5
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
|
text "Time In: #{ sale_data.bookings[0].checkin_at.strftime('%I:%M %p') }", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
|
text "Time Out: #{ sale_data.bookings[0].checkout_at.strftime('%I:%M %p') }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -118,7 +125,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :overflow => :shrink_to_fix, :size => self.item_font_size, :overflow => :shrink_to_fix
|
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "#{total_price}", :at =>[(item_name_width),y_position], :width =>self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{total_price}", :at =>[(item_name_width),y_position], :width =>self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
@@ -163,7 +170,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
if sale_data.sale_taxes.length > 1
|
if sale_data.sale_taxes.length > 0
|
||||||
sale_data.sale_taxes.each do |st|
|
sale_data.sale_taxes.each do |st|
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<li class="navbar-nav mr-auto dropdown">
|
<li class="navbar-nav mr-auto dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to "Daily Sale Report", origami_root_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Daily Sale Report", reports_daily_sale_index_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -306,12 +306,12 @@
|
|||||||
sub_total = 0
|
sub_total = 0
|
||||||
if @selected_item_type == "Sale"
|
if @selected_item_type == "Sale"
|
||||||
@selected_item.sale_items.each do |sale_item|
|
@selected_item.sale_items.each do |sale_item|
|
||||||
sub_total += (sale_item.qty*sale_item.unit_price)
|
sub_total = sub_total + sale_item.price
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='item-name'><%= sale_item.product_name %></td>
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
<td class='item-attr'><%= sale_item.qty*sale_item.price %></td>
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
end
|
end
|
||||||
@@ -322,7 +322,7 @@
|
|||||||
# For Order Items
|
# For Order Items
|
||||||
if @selected_item_type == "Order"
|
if @selected_item_type == "Order"
|
||||||
@selected_item.order_items.each do |order_item|
|
@selected_item.order_items.each do |order_item|
|
||||||
sub_total += (order_item.qty*order_item.unit_price)
|
sub_total = sub_total + (order_item.qty*order_item.price)
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='item-name'><%= order_item.item_name %></td>
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
|
|||||||
@@ -96,6 +96,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#validamount').attr("value",parseFloat("<%= @can_jcb %>") - parseFloat(localStorage.getItem("cash")));
|
||||||
|
}
|
||||||
|
});
|
||||||
// number key pad
|
// number key pad
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -144,7 +150,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#jcb_pay').on('click',function(){
|
$('#jcb_pay').on('click',function(){
|
||||||
var amount = $('#amount').text();
|
var amount = $('#amount').text();
|
||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
if(parseFloat(amount) <= "<%= @can_jcb %>"){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_jcb_path %>",
|
url: "<%= origami_payment_jcb_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
|
|||||||
@@ -96,6 +96,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#validamount').attr("value",parseFloat("<%= @can_master %>") - parseFloat(localStorage.getItem("cash")));
|
||||||
|
}
|
||||||
|
});
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -138,7 +144,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#master_pay').on('click',function(){
|
$('#master_pay').on('click',function(){
|
||||||
var amount = $('#amount').text();
|
var amount = $('#amount').text();
|
||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
if(parseFloat(amount) <= "<%= @can_master %>"){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_master_path %>",
|
url: "<%= origami_payment_master_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
|
|||||||
@@ -96,6 +96,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#validamount').attr("value",parseFloat("<%= @can_mpu %>") - parseFloat(localStorage.getItem("cash")));
|
||||||
|
}
|
||||||
|
});
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -141,7 +147,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#mpu_pay').on('click',function(){
|
$('#mpu_pay').on('click',function(){
|
||||||
var amount = $('#amount').text();
|
var amount = $('#amount').text();
|
||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
if(parseFloat(amount) <= "<%= @can_mpu %>"){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_mpu_path %>",
|
url: "<%= origami_payment_mpu_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
|
|||||||
@@ -96,6 +96,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#validamount').attr("value",parseFloat("<%= @can_visa %>") - parseFloat(localStorage.getItem("cash")));
|
||||||
|
}
|
||||||
|
});
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -141,7 +147,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#visa_pay').on('click',function(){
|
$('#visa_pay').on('click',function(){
|
||||||
var amount = $('#amount').text();
|
var amount = $('#amount').text();
|
||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
if(parseFloat(amount) <= "<%= @can_visa %>"){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value"))){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_visa_path %>",
|
url: "<%= origami_payment_visa_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
|
|||||||
212
app/views/reports/daily_sale/_shift_sale_report_filter.html.erb
Normal file
212
app/views/reports/daily_sale/_shift_sale_report_filter.html.erb
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||||
|
<% if period_type != false %>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label>Select Period</label>
|
||||||
|
<select name="period" id="sel_period" class="form-control">
|
||||||
|
<option value="0">Today</option>
|
||||||
|
<option value="1">Yesterday</option>
|
||||||
|
<option value="2">This week</option>
|
||||||
|
<option value="3">Last week</option>
|
||||||
|
<option value="4">Last 7 days</option>
|
||||||
|
<option value="5">This month</option>
|
||||||
|
<option value="6">Last month</option>
|
||||||
|
<option value="7">Last 30 days</option>
|
||||||
|
<option value="8">This year</option>
|
||||||
|
<option value="9">Last year</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type">
|
||||||
|
<!-- <div class="form-group col-md-2">
|
||||||
|
<label>Select Type</label>
|
||||||
|
<select name="sale_type" id="sel_sale_type" class="form-control">
|
||||||
|
<option value="0">All Sale Type</option>
|
||||||
|
<option value="1">Revenue Only</option>
|
||||||
|
<option value="2">Discount Only</option>
|
||||||
|
<option value="3">Void Only</option>
|
||||||
|
<option value="4">Taxes Only</option>
|
||||||
|
<option value="5">Other Amount Only</option>
|
||||||
|
</select>
|
||||||
|
</div> -->
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
|
<label class="">From</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label class="">To</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2 margin-top-20">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<!-- <div class="row">
|
||||||
|
<% if defined? show_monthly %>
|
||||||
|
<div class="span3" style="margin-bottom:10px;">
|
||||||
|
<input type="hidden" id="report_type" name="report_type" value="0">
|
||||||
|
<div class="btn-group" data-toggle="buttons-radio">
|
||||||
|
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
|
||||||
|
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<% if defined? promotions %>
|
||||||
|
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? menu_types %>
|
||||||
|
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? payments %>
|
||||||
|
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? shift_name %>
|
||||||
|
<!-- Temporary no needs
|
||||||
|
<select name="shift_name" id="shift_name"></select>
|
||||||
|
-->
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? cashiers %>
|
||||||
|
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? singer %>
|
||||||
|
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? bsm %>
|
||||||
|
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? guest_role %>
|
||||||
|
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
||||||
|
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? products %>
|
||||||
|
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? items %>
|
||||||
|
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<div class = "row">
|
||||||
|
|
||||||
|
<div class = "span3">
|
||||||
|
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
||||||
|
</div>
|
||||||
|
<div class = "span3">
|
||||||
|
<select name="shift" id="shift">
|
||||||
|
<option value="">All Shift</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class = "span3">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$('#custom_excel').hide();
|
||||||
|
|
||||||
|
$('#custom_excel').click(function(){
|
||||||
|
var url = $('#custom_excel').attr('data-url');
|
||||||
|
$('#frm_report').attr('action',url)
|
||||||
|
$('#frm_report').submit();
|
||||||
|
// window.location = url;
|
||||||
|
});
|
||||||
|
|
||||||
|
var item = $('#item').val();
|
||||||
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
|
if(item == 'order'){
|
||||||
|
$('#cashier').hide();
|
||||||
|
$('#waiter').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(item == 'sale'){
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
$("#item").val('sale');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Reset the form to pervious values
|
||||||
|
$("#branch").val(<%=params[:branch]%>);
|
||||||
|
$("#waiter").val("<%=params[:waiter]%>");
|
||||||
|
$("#cashier").val(<%=params[:cashier]%>);
|
||||||
|
$("#product").val(<%=params[:product]%>);
|
||||||
|
$("#singer").val(<%=params[:singer]%>);
|
||||||
|
$("#item").val('<%=params[:item]%>');
|
||||||
|
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||||
|
|
||||||
|
|
||||||
|
$("#from").val("<%=params[:from]%>");
|
||||||
|
$("#to").val("<%=params[:to]%>");
|
||||||
|
$("#sel_period").val(<%=params[:period]%>);
|
||||||
|
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||||
|
|
||||||
|
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||||
|
$("#rd_period_type_1").attr("checked","checked");
|
||||||
|
<% else %>
|
||||||
|
$("#rd_period_type_0").attr("checked","checked");
|
||||||
|
<% end %>
|
||||||
|
$(".btn-group button").removeClass("active");
|
||||||
|
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||||
|
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||||
|
|
||||||
|
$('#item').change(function(){
|
||||||
|
var item = $('#item').val();
|
||||||
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
|
if(item == 'sale'){
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#cashier').hide();
|
||||||
|
$('#waiter').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
190
app/views/reports/daily_sale/index.html.erb
Normal file
190
app/views/reports/daily_sale/index.html.erb
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= %>">Home</a></li>
|
||||||
|
<li>Daily Sale Report</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
|
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sale_index_path} %>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right">
|
||||||
|
<a href="javascript:export_to('<%=reports_daily_sale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container margin-top-20">
|
||||||
|
<div class="card row">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<% if params[:from]%>
|
||||||
|
<tr>
|
||||||
|
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th style='text-align:center;'>Sr.no</th>
|
||||||
|
<th style='text-align:center;'>Date</th>
|
||||||
|
<th style='text-align:center;'>Daily Void Amount</th>
|
||||||
|
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily master Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily visa Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||||
|
<th style='text-align:center;'>(Daily Discount)</th>
|
||||||
|
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Grand Total</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% unless @sale_data.empty? %>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% void = 0 %>
|
||||||
|
<% mpu = 0 %>
|
||||||
|
<% master = 0 %>
|
||||||
|
<% visa = 0 %>
|
||||||
|
<% jcb = 0 %>
|
||||||
|
<% paypar = 0 %>
|
||||||
|
<% cash = 0 %>
|
||||||
|
<% credit = 0 %>
|
||||||
|
<% foc = 0 %>
|
||||||
|
<% discount = 0 %>
|
||||||
|
<% total = 0 %>
|
||||||
|
<% grand_total = 0 %>
|
||||||
|
<% count = 1 %> <% rounding_adj = 0 %>
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
|
<% void += sale[:void_amount] %>
|
||||||
|
<% mpu += sale[:mpu_amount] %>
|
||||||
|
<% master += sale[:master_amount] %>
|
||||||
|
<% visa += sale[:visa_amount] %>
|
||||||
|
<% jcb += sale[:jcb_amount] %>
|
||||||
|
<% paypar += sale[:paypar_amount] %>
|
||||||
|
<% cash += sale[:cash_amount] %>
|
||||||
|
<% credit += sale[:credit_amount] %>
|
||||||
|
<% foc += sale[:foc_amount] %>
|
||||||
|
<% discount += sale[:total_discount] %>
|
||||||
|
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||||
|
<% grand_total += sale[:grand_total].to_f %>
|
||||||
|
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||||
|
<tr>
|
||||||
|
<td style='text-align:right;'><%= count %></td>
|
||||||
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
<% count = count + 1 %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="3" style='text-align:center;'>Total</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% total_tax = 0 %>
|
||||||
|
<% unless @tax.empty? %>
|
||||||
|
<% @tax.each do |tax| %>
|
||||||
|
<% total_tax += tax.tax_amount.to_f %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% net = total - total_tax %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
||||||
116
app/views/reports/daily_sale/index.xls.erb
Normal file
116
app/views/reports/daily_sale/index.xls.erb
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<div class="card row">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<% if params[:from]%>
|
||||||
|
<tr>
|
||||||
|
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th style='text-align:center;'>Sr.no</th>
|
||||||
|
<th style='text-align:center;'>Date</th>
|
||||||
|
<th style='text-align:center;'>Daily Void Amount</th>
|
||||||
|
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily master Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily visa Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||||
|
<th style='text-align:center;'>(Daily Discount)</th>
|
||||||
|
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Grand Total</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% unless @sale_data.empty? %>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% void = 0 %>
|
||||||
|
<% mpu = 0 %>
|
||||||
|
<% master = 0 %>
|
||||||
|
<% visa = 0 %>
|
||||||
|
<% jcb = 0 %>
|
||||||
|
<% paypar = 0 %>
|
||||||
|
<% cash = 0 %>
|
||||||
|
<% credit = 0 %>
|
||||||
|
<% foc = 0 %>
|
||||||
|
<% discount = 0 %>
|
||||||
|
<% total = 0 %>
|
||||||
|
<% grand_total = 0 %>
|
||||||
|
<% count = 1 %> <% rounding_adj = 0 %>
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
|
<% void += sale[:void_amount] %>
|
||||||
|
<% mpu += sale[:mpu_amount] %>
|
||||||
|
<% master += sale[:master_amount] %>
|
||||||
|
<% visa += sale[:visa_amount] %>
|
||||||
|
<% jcb += sale[:jcb_amount] %>
|
||||||
|
<% paypar += sale[:paypar_amount] %>
|
||||||
|
<% cash += sale[:cash_amount] %>
|
||||||
|
<% credit += sale[:credit_amount] %>
|
||||||
|
<% foc += sale[:foc_amount] %>
|
||||||
|
<% discount += sale[:total_discount] %>
|
||||||
|
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||||
|
<% grand_total += sale[:grand_total].to_f %>
|
||||||
|
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||||
|
<tr>
|
||||||
|
<td style='text-align:right;'><%= count %></td>
|
||||||
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
<% count = count + 1 %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="3" style='text-align:center;'>Total</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% total_tax = 0 %>
|
||||||
|
<% unless @tax.empty? %>
|
||||||
|
<% @tax.each do |tax| %>
|
||||||
|
<% total_tax += tax.tax_amount.to_f %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% net = total - total_tax %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= %>">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>
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ Rails.application.routes.draw do
|
|||||||
#--------- Reports Controller Sections ------------#
|
#--------- Reports Controller Sections ------------#
|
||||||
namespace :reports do
|
namespace :reports do
|
||||||
resources :receipt_no, :only => [:index, :show]
|
resources :receipt_no, :only => [:index, :show]
|
||||||
|
resources :daily_sale, :only => [:index, :show]
|
||||||
# resources :sales, :only => [:index, :show]
|
# resources :sales, :only => [:index, :show]
|
||||||
# resources :orders, :only => [:index, :show]
|
# resources :orders, :only => [:index, :show]
|
||||||
# resources :customers, :only => [:index, :show]
|
# resources :customers, :only => [:index, :show]
|
||||||
|
|||||||
Reference in New Issue
Block a user