fixed conflict

This commit is contained in:
Aung Myo
2017-06-12 18:34:41 +06:30
25 changed files with 807 additions and 211 deletions

View File

@@ -12,7 +12,7 @@ gem 'rails', '~> 5.1.0'
gem 'mysql2', '>= 0.3.18', '< 0.5'
#Use PosgreSQL
gem 'pg'
# gem 'pg'
# redis server for cable
# gem 'redis', '~> 3.0'
@@ -93,4 +93,8 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'httparty', '~> 0.15.5'
# gem 'momentjs-rails', '>= 2.9.0'
# gem 'bootstrap-datepicker-rails'
# gem 'momentjs-rails', '>= 2.9.0'
# gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
gem 'bootstrap-datepicker-rails'

View File

@@ -110,7 +110,6 @@ GEM
nokogiri (1.7.2)
mini_portile2 (~> 2.1.0)
pdf-core (0.7.0)
pg (0.20.0)
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
@@ -247,7 +246,6 @@ DEPENDENCIES
kaminari (~> 0.16.3)
listen (~> 3.0.5)
mysql2 (>= 0.3.18, < 0.5)
pg
prawn
prawn-table
puma (~> 3.0)

View File

@@ -17,5 +17,11 @@
//= require turbolinks
//= require cable
//= require settings/processing_items
//= require bootstrap-datepicker
//= require bootstrap-datepicker/core
//= require bootstrap-datepicker/locales/bootstrap-datepicker.es
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
$('.dropdown-toggle').dropdown();
});

View File

@@ -5,9 +5,10 @@
//= require_self
//= require_tree ./channels
(function() {
this.App || (this.App = {});
// Temp Disable
// (function() {
// this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
// App.cable = ActionCable.createConsumer();
}).call(this);
// }).call(this);

View File

@@ -28,7 +28,7 @@ $(document).ready(function(){
$("#order-Tax").text('');
$("#order-grand-total").text('');
var zone_name=$(this).find(".orders-table").text();
var zone_name=$(this).find(".orders-table").text();
var receipt_no=$(this).find(".orders-receipt-no").text();
var unique_id = $(this).find(".orders-id").text();
var order_status=$(this).find(".orders-order-status").text().trim();
@@ -38,11 +38,11 @@ $(document).ready(function(){
//for customer button
$("#customer").removeAttr('disabled');
var customer_id=$(this).find(".customer-id").text();
show_customer_details(customer_id);
var cashier="";
var receipt_date="";
@@ -60,7 +60,7 @@ $(document).ready(function(){
type: "POST",
url: "/origami/" + unique_id,
data: { 'booking_id' : unique_id },
success:function(result){
success:function(result){
for (i = 0; i < result.length; i++) {
var data = JSON.stringify(result[i]);
var parse_data = JSON.parse(data);
@@ -77,7 +77,7 @@ $(document).ready(function(){
//Receipt Charges
sub_total += (parse_data.qty*parse_data.price);
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
tax_amount = parse_data.tax_amount;
grand_total_amount = parse_data.grand_total_amount;
@@ -186,7 +186,7 @@ $(document).ready(function(){
return false;
});
function show_customer_details(customer_id){
function show_customer_details(customer_id){
if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
var url = customer_id+"/get_customer/"
@@ -218,7 +218,7 @@ $(document).ready(function(){
});
}
});
//End Ajax
//End Ajax
}
/* For Receipt - Calculate discount or tax */

View File

@@ -2,7 +2,7 @@
@import "bootstrap";
@import "font-awesome";
@import "theme";
@import "bootstrap-datepicker3";
@import 'bootstrap-datepicker';
/* Show it is fixed to the top */
// body {

View File

@@ -12,6 +12,7 @@ class Origami::HomeController < BaseOrigamiController
@selected_item_type="Order"
end
end
puts params[:booking_id]
@completed_orders = Order.get_completed_order()
@booking_orders = Order.get_booking_order_table()

View File

@@ -16,7 +16,8 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
if member_actions.gateway_url
@campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id)
merchant_uid= member_actions.merchant_account_id
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid)
if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"]
@out = true, @membership_rebate_balance,@membership_id

View File

@@ -30,7 +30,7 @@ class Origami::RequestBillsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
redirect_to origami_path(sale_order.sale_id)
redirect_to origami_path(@sale_data.sale_id)
end
end

View File

@@ -1,9 +1,85 @@
class Reports::ReceiptNoController < BaseReportController
class Reports::ReceiptNoController < ApplicationController
PERIOD = {
"today" => 0,
"yesterday" => 1,
"this_week" => 2,
"last_week" => 3,
"last_7" => 4,
"this_month" => 5,
"last_month" => 6,
"last_30" => 7,
"this_year" => 8,
"last_year" => 9
}
def index
@hi = "hi"
from, to = get_date_range_from_params
puts "from..."
puts from
puts "to..."
puts to
@sale_data = Sale.get_receipt_no_list(from,to)
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
end
def show
end
private
def get_date_range_from_params
period_type = params[:period_type]
period = params[:period]
from = params[:from]
to = params[:to]
day_ref = Time.now
if period_type.to_i == 1
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")
else
from = day_ref.beginning_of_day.utc
to = day_ref.end_of_day.utc
end
end
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
return from, to
end
end

View File

@@ -231,22 +231,33 @@ class Order < ApplicationRecord
.joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sales on sales.sale_id = bookings.sale_id")
.where("booking_orders.order_id IS NOT NULL 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")
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
end
#Origami: Cashier : to view booking order Table
def self.get_completed_order
completed_orders = Booking.select("sales.receipt_no,orders.status as order_status,
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
completed_orders = Booking.select("sales.receipt_no,orders.status as order_status,orders.order_id,
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id")
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
.joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sales on sales.sale_id = bookings.sale_id")
.where("sales.sale_status='completed'")
<<<<<<< HEAD
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
end
#Origami: Cashier : to view booking order Table
def self.get_booking_order_table
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
.joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sales on sales.sale_id = bookings.sale_id")
.where("sales.sale_status<>'completed' and booking_orders.order_id IS NOT NULL 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.customer_id,sales.customer_id,orders.order_id")
end
#Origami: Cashier : to view order type Room
@@ -260,9 +271,8 @@ class Order < ApplicationRecord
.joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
.where("sales.sale_status<>'complete' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
.where("sales.sale_status<>'completed' and sales.sale_status<>'complete' and booking_orders.order_id IS NOT NULL 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")
end
#Origami: Cashier : to view order type Room
@@ -291,7 +301,7 @@ class Order < ApplicationRecord
left join order_items on order_items.order_id = orders.order_id
left join sale_orders on sale_orders.order_id = orders.order_id
left join sales on sales.sale_id = sale_orders.sale_id")
.where("sales.sale_status<>'complete' and dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
.where("sales.sale_status<>'completed' and dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id,orders.customer_id")
end

View File

@@ -263,4 +263,8 @@ class Sale < ApplicationRecord
def generate_custom_id
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL")
end
def self.get_receipt_no_list(from,to)
sale = Sale.where("sale_status=? and receipt_date between ? and ?","completed",from,to)
end
end

View File

@@ -1,6 +1,6 @@
class SaleItem < ApplicationRecord
self.primary_key = "sale_item_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
@@ -12,17 +12,17 @@ class SaleItem < ApplicationRecord
def self.get_order_items_details(sale_id)
order_details = SaleItem.select("sales.total_tax as tax_amount, sales.grand_total as grand_total_amount , sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,
order_details = SaleItem.select("sales.total_tax as tax_amount, sales.grand_total as grand_total_amount , sales.total_discount as discount_amount,sales.receipt_date as receipt_date,
sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price")
.joins("left join sales on sales.sale_id = sale_items.sale_id")
.where("sale_items.sale_id=?",sale_id)
# sale_orders = SaleOrder.where("sale_id=?",sale_id)
# if sale_orders
# sale_orders.each do |sale_order|
# sale_orders.each do |sale_order|
# order_details = SaleItem.select("sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price")
# .joins("left join sales on sales.id = sale_items.sale_id")
# .where("sale_items.sale_id=?",sale_order.sale_id)
# .where("sale_items.sale_id=?",sale_order.sale_id)
# return order_details
# end
# else
@@ -35,28 +35,30 @@ class SaleItem < ApplicationRecord
beverage_prices=0
sale_items.each do |si|
food_price = self.get_food_price(si.sale_item_id)
beverage_price = self.get_beverage_price(si.sale_item_id)
food_price, beverage_price = self.get_price(si.sale_item_id)
food_prices = food_prices + food_price
beverage_prices = beverage_prices + beverage_price
end
return food_prices, beverage_prices
end
def self.get_food_price(sale_item_id)
food=SaleItem.select("sale_items.price")
def self.get_price(sale_item_id)
food_price=0
beverage_price=0
item=SaleItem.select("sale_items.price , menu_items.account_id")
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
.where("sale_items.sale_item_id=? and menu_items.account_id=1", sale_item_id.to_s)
food_price = food[0].price rescue 0
.where("sale_items.sale_item_id=?", sale_item_id.to_s)
if item[0].account_id == 1
food_price = item[0].price
else
beverage_price = item[0].price
end
return food_price, beverage_price
end
def self.get_beverage_price(sale_item_id)
beverage=SaleItem.select("sale_items.price")
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
.where("sale_items.sale_item_id=? and menu_items.account_id=2", sale_item_id.to_s)
beverage_price = beverage[0].price rescue 0
end
private
def generate_custom_id
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")

View File

@@ -60,15 +60,15 @@ class SalePayment < ApplicationRecord
#record an payment in sale-audit
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by)
return false, "No outstanding Amount"
end
end
def self.get_paypar_account(url,token,membership_id,campaign_type_id)
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid)
response = HTTParty.get(url,
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id}.to_json,
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
@@ -85,7 +85,7 @@ class SalePayment < ApplicationRecord
merchant_uid = membership_actions_data.merchant_account_id
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
response = HTTParty.post(url,
:body => { generic_customer_id:membership_id,total_amount:received_amount,receipet_no:sale_id,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid}.to_json,
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipet_no:sale_id,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'

View File

@@ -1,16 +1,16 @@
class ReceiptBillPdf < Prawn::Document
attr_accessor :receipt_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
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
def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total)
self.page_width = 300
self.page_width = 250
self.page_height = 1450
self.margin = 10
self.price_width = 50
self.qty_width = 30
self.total_width = 50
self.item_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.price_width = 40
self.qty_width = 20
self.total_width = 40
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width)+(self.margin*4))
self.item_height = 15
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.receipt_width=100
self.label_width=80
# @item_width = self.page_width.to_i / 2
# @qty_width = @item_width.to_i / 3
@@ -22,8 +22,8 @@ class ReceiptBillPdf < Prawn::Document
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
self.header_font_size = 12
self.item_font_size = 10
self.header_font_size = 11
self.item_font_size = 9
header( printer_settings.printer_name, printer_settings.name)
@@ -31,66 +31,64 @@ class ReceiptBillPdf < Prawn::Document
cashier_info(sale_data, customer_name)
line_items(sale_items, food_total, beverage_total)
all_total(sale_data)
all_total(sale_data)
footer
end
def header (printer_name, name)
text "#{printer_name}", :size => self.header_font_size,:align => :center
move_down 5
text "#{name}", :size => self.header_font_size,:align => :center
# move_down self.item_height
move_down 5
text "#{printer_name}", :left_margin => -10, :size => self.header_font_size,:align => :center
move_down 5
text "#{name}", :size => self.header_font_size,:align => :center
# move_down self.item_height
move_down 5
stroke_horizontal_rule
stroke_horizontal_rule
end
def cashier_info(sale_data, customer_name)
move_down 7
# move_down 2
y_position = cursor
bounding_box([0,y_position], :width =>self.receipt_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
end
bounding_box([self.receipt_width, y_position], :width =>self.receipt_width) do
bounding_box([self.label_width, y_position], :width =>self.item_width) do
text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left
end
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.receipt_width, :height => self.item_height) do
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "Customer:", :size => self.item_font_size,:align => :left
end
bounding_box([self.receipt_width,y_position], :width =>self.receipt_width) do
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.receipt_width, :height => self.item_height) do
text "Date:", :size => self.item_font_size,:align => :left
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "Date:", :size => self.item_font_size,:align => :left
end
bounding_box([self.receipt_width,y_position], :width =>self.receipt_width) do
text "#{sale_data.receipt_date.strftime('%Y %m %d %h:%m')}" , :size => self.item_font_size,:align => :left
bounding_box([self.label_width,y_position], :width => self.item_width) do
text "#{sale_data.receipt_date.strftime('%Y-%m-%d %I:%M %p')}" , :size => self.item_font_size,:align => :left
end
# stroke_horizontal_rule
move_down 5
stroke_horizontal_rule
move_down 5
end
def line_items(sale_items, food_total, beverage_total)
y_position = cursor
stroke_horizontal_rule
move_down 5
pad_top(15) {
# @item_width.to_i + @half_qty.to_i
text_box "Items", :at =>[0,y_position], :width => self.item_width - 20, :height =>self.item_height, :size => self.item_font_size
text_box "Price", :at =>[self.item_width-20,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
text_box "Qty", :at =>[self.item_width+self.price_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
text_box "Total", :at =>[self.item_width+self.price_width+self.qty_width,y_position], :width => self.total_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
text_box "Items", :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 "Qty", :at =>[(self.item_width+self.price_width),y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "Total", :at =>[(self.item_width+self.price_width+2),y_position], :width => self.total_width+2, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
}
@@ -99,88 +97,88 @@ class ReceiptBillPdf < Prawn::Document
add_line_item_row(sale_items, food_total, beverage_total)
end
def add_line_item_row(sale_items, food_total, beverage_total)
item_name_width = self.item_width-20
item_name_width = (self.item_width+self.price_width)
y_position = cursor
move_down 5
sub_total = 0.0
sale_items.each do |item|
sale_items.each do |item|
sub_total += (item.qty*item.unit_price)
qty = item.qty
total_price = item.qty*item.unit_price
price = item.unit_price
product_name = item.product_name
sub_total += item.qty*item.unit_price
qty = item.qty
total_price = item.qty*item.unit_price
price = item.unit_price
product_name = item.product_name
y_position = cursor
y_position = cursor
pad_top(15) {
# @item_width.to_i + @half_qty.to_i
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 "#{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.to_i}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{total_price}", :at =>[(item_name_width+2),y_position], :width =>self.total_width+2, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
pad_top(15) {
# @item_width.to_i + @half_qty.to_i
text_box "#{product_name}", :at =>[0,y_position], :width => item_name_width, :height =>self.item_height, :overflow => :shrink_to_fix, :size => self.item_font_size
text_box "#{price}", :at =>[item_name_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
text_box "#{qty.to_i}", :at =>[item_name_width+self.price_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
text_box "#{total_price}", :at =>[item_name_width+self.price_width+self.qty_width,y_position], :width =>self.total_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
}
move_down 3
end
}
move_down 3
end
stroke_horizontal_rule
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
bounding_box([0,y_position], :width =>item_name_width, :height => self.item_height) do
text "Sub Total", :size => self.item_font_size,:align => :left
end
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
text "#{sub_total}" , :size => self.item_font_size,:align => :right
bounding_box([item_name_width,y_position], :width =>self.total_width) do
text "#{ sub_total }" , :size => self.item_font_size,:align => :right
end
# Food and Beverage
food_beverage_total = food_total.to_s + '/' + beverage_total.to_s
food_beverage_total = food_total.to_s + "/" + beverage_total.to_s
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
bounding_box([0,y_position], :width =>(item_name_width), :height => self.item_height) do
text "Food/Beverage Total", :size => self.item_font_size,:align => :left
end
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
bounding_box([item_name_width,y_position], :width =>self.total_width) do
text "#{ food_beverage_total }" , :size => self.item_font_size,:align => :right
end
end
def all_total(sale_data)
item_name_width = self.item_width-20
item_name_width = self.item_width
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
bounding_box([0,y_position], :width =>(item_name_width+self.price_width), :height => self.item_height) do
text "Discount", :size => self.item_font_size,:align => :left
end
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
bounding_box([(item_name_width+self.price_width),y_position], :width =>self.total_width) do
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
end
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
bounding_box([0,y_position], :width =>(item_name_width+self.price_width), :height => self.item_height) do
text "Total Tax", :size => self.item_font_size,:align => :left
end
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
bounding_box([(item_name_width+self.price_width),y_position], :width =>self.total_width) do
text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
end
move_down 5
y_position = cursor
move_down 5
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
bounding_box([0,y_position], :width =>(item_name_width+self.price_width), :height => self.item_height) do
text "Grand Total", :size => self.item_font_size,:align => :left
end
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
bounding_box([(item_name_width+self.price_width),y_position], :width =>self.total_width) do
text "#{sale_data.grand_total}" , :size => self.item_font_size,:align => :right
end
move_down 5
@@ -188,4 +186,14 @@ class ReceiptBillPdf < Prawn::Document
end
def footer
move_down 5
stroke_horizontal_rule
move_down 5
text "*** Thank You ***", :left_margin => -10, :size => self.header_font_size,:align => :center
move_down 5
end
end

View File

@@ -36,7 +36,7 @@
<ul class="dropdown-menu">
<li><%= link_to "Daily Sale Report", origami_root_path, :tabindex =>"-1" %></li>
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
<li><%= link_to "Receipt Report", origami_root_path, :tabindex =>"-1" %></li>
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
</ul>
</li>
</ul>

View File

@@ -23,41 +23,44 @@
<!--- Panel 0 - Completed Orders -->
<div class="tab-pane" id="Completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@completed_orders.each do |cpo|
<%
@completed_orders.each do |cpo|
# ToDo no need check new
# Assigned Id for new Order? Sale?
unique_id=""
customer_id=""
unique_id = ""
customer_id = ""
# For CSS- Class for Order? Sale?
sale_status=""
if cpo.order_status == 'new'
if cpo.order_status == 'new'
unique_id=cpo.booking_id
customer_id=cpo.order_customer_id
# check selected item and assign
if @selected_item != nil
# check selected item and assign
if @selected_item != nil
if cpo.order_id == @selected_item.order_id
sale_status = sale_status + " selected-item"
end
end
else
else
unique_id=cpo.sale_id
customer_id=cpo.sale_customer_id
sale_status="paid"
# check selected item and assign
# check selected item and assign
if @selected_item != nil
if unique_id == @selected_item.sale_id
sale_status = sale_status + " selected-item"
end
end
end
end
%>
<div class="card orders <%= sale_status %>">
<div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= cpo.order_id %></p>
<h4 class="card-title orders-table"><%= cpo.table_name %></h4>
<p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= cpo.order_id %></p>
<h4 class="card-title orders-table"><%= cpo.table_name %></h4>
<p class="card-text">
Receipt No :
<span class="orders-receipt-no">
@@ -68,12 +71,12 @@
Order Status :
<span class="orders-order-status">
<%= cpo.order_status %>
</span>
</span>
</small>
</p>
</div>
</div>
<%
</p>
</div>
</div>
<%
end
%>
</div>
@@ -82,39 +85,39 @@
<!--- Panel 1 - Table Orders -->
<div class="tab-pane active" id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@booking_orders.each do |bko|
<%
@booking_orders.each do |bko|
# Assigned Id for new Order? Sale?
unique_id=""
customer_id=""
# For CSS- Class for Order? Sale?
sale_status=""
if bko.order_status == 'new'
if bko.order_status == 'new'
unique_id=bko.booking_id
customer_id=bko.order_customer_id
# check selected item and assign
if @selected_item != nil
# check selected item and assign
if @selected_item != nil
if bko.order_id == @selected_item.order_id
sale_status = sale_status + " selected-item"
end
end
else
else
unique_id=bko.sale_id
customer_id=bko.sale_customer_id
sale_status="sold"
# check selected item and assign
# check selected item and assign
if @selected_item != nil
if unique_id == @selected_item.sale_id
sale_status = sale_status + " selected-item"
end
end
end
end
%>
<div class="card orders <%= sale_status %>">
<div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= bko.order_id %></p>
<p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= bko.order_id %></p>
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
<p class="card-text">
Receipt No :
@@ -148,32 +151,32 @@
# For CSS- Class for Order? Sale?
sale_status=""
if rmo.order_status == 'new'
if rmo.order_status == 'new'
unique_id=rmo.booking_id
customer_id=rmo.order_customer_id
# check selected item and assign
if @selected_item != nil
# check selected item and assign
if @selected_item != nil
if rmo.order_id == @selected_item.order_id
sale_status = sale_status + " selected-item"
end
end
else
end
end
else
unique_id=rmo.sale_id
customer_id=rmo.sale_customer_id
sale_status="sold"
# check selected item and assign
# check selected item and assign
if @selected_item != nil
if unique_id == @selected_item.sale_id
sale_status = sale_status + " selected-item"
end
end
end
end
%>
<div class="card orders <%= sale_status %>">
<div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= rmo.order_id %></p>
<p class="hidden order-cid"><%= rmo.order_id %></p>
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
<p class="card-text">
Receipt No :
@@ -198,19 +201,19 @@
<!--- Panel 3 - Orders -->
<div class="tab-pane" id="orders" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@orders.each do |odr|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@orders.each do |odr|
# Assigned Id for new Order? Sale?
unique_id=""
customer_id=""
# For CSS- Class for Order? Sale?
sale_status=""
sale_status=""
if odr.order_status == 'new'
if odr.order_status == 'new'
unique_id=odr.booking_id
customer_id = odr.order_customer_id
if @selected_item != nil
if @selected_item != nil
if odr.order_id == @selected_item.order_id
sale_status = sale_status + " selected-item"
end
@@ -218,9 +221,9 @@
else
unique_id=odr.sale_id
customer_id = odr.sale_customer_id
sale_status="sold"
# check selected item and assign
if @selected_item != nil
sale_status="sold"
# check selected item and assign
if @selected_item != nil
if unique_id == @selected_item.sale_id
sale_status = sale_status + " selected-item"
end
@@ -229,9 +232,9 @@
%>
<div class="card orders <%= sale_status %>">
<div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= odr.order_id %></p>
<p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= odr.order_id %></p>
<h4 class="card-title orders-table"><%= odr.table_name %></h4
<p class="card-text">
Receipt No :
@@ -270,19 +273,19 @@
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Receipt No: <span id="receipt_no"><%=@selected_item.receipt_no rescue ' '%></span></p>
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p>Date: <span id="receipt_date"><%=@selected_item.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p>Amount : <span id="customer_amount"></span></p>
</div>
</div>
</div>
<div class="card-text">
<table class="table table-striped" id="order-items-table">
@@ -294,7 +297,7 @@
</tr>
</thead>
<tbody>
<%
<%
# For Sale Items
sub_total = 0
if @selected_item_type == "Sale"
@@ -302,16 +305,16 @@
sub_total += sale_item.qty*sale_item.unit_price
%>
<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*sale_item.price %></td>
</tr>
<%
<%
end
end
%>
<%
<%
# For Order Items
sub_total = 0
if @selected_item_type == "Order"
@@ -319,11 +322,11 @@
sub_total += order_item.qty*order_item.unit_price
%>
<tr>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
<%
end
end
%>

View File

@@ -6,8 +6,8 @@
<div id="order-title">
<table>
<tr>
<td style="width:60%;"><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></td>
<td style="width:40%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td>
<td style="width:55%;"><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></td>
<td style="width:45%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td>
</tr>
<tr>
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
@@ -232,7 +232,12 @@ $( document ).ready(function() {
url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id,
success:function(result){
alert("Thank you")
if($('#balance').text() < 0){
alert("Changed amount " + $('#balance').text() * (-1) )
}else{
alert("Thank you")
}
window.location.href = '/origami';
}
});

View File

@@ -1,7 +1,7 @@
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-3">
<div class="card">
<div class="card" style="margin-top:10px;padding-top:20px;">
<div class="rebate-form">
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
@@ -22,15 +22,15 @@
</div>
<div class="col-lg-7 col-md-7 col-sm-7">
<div class="row">
<div class="row" style="margin-top:10px;">
<div class="col-md-12">
<div class="row">
<div class="col-md-7">
<div class="row">
<div class="row bottom">
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
<div class="col-md-3 cashier_number" data-value="2" data-type="num">2</div>
<div class="col-md-3 cashier_number" data-value="3" data-type="num">3</div>
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
</div>
</div>
<div class="col-md-5">
@@ -39,10 +39,10 @@
</div>
<div class="row">
<div class="col-md-7">
<div class="row">
<div class="row bottom">
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
<div class="col-md-3 cashier_number" data-value="5" data-type="num">5</div>
<div class="col-md-3 cashier_number" data-value="6" data-type="num">6</div>
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
</div>
</div>
<div class="col-md-5">
@@ -51,10 +51,10 @@
</div>
<div class="row">
<div class="col-md-7">
<div class="row">
<div class="row bottom">
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
<div class="col-md-3 cashier_number" data-value="8" data-type="num">8</div>
<div class="col-md-3 cashier_number" data-value="9" data-type="num">9</div>
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
</div>
</div>
<div class="col-md-5">
@@ -63,10 +63,10 @@
</div>
<div class="row">
<div class="col-md-7">
<div class="row">
<div class="row bottom">
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
<div class="col-md-3 cashier_number" data-value="." data-type="num">.</div>
<div class="col-md-3 cashier_number" data-value="00" data-type="num">00</div>
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
</div>
</div>
<div class="col-md-5">
@@ -75,10 +75,10 @@
</div>
<div class="row">
<div class="col-md-7">
<div class="row">
<div class="row bottom">
<div class="col-md-3 cashier_number"></div>
<div class="col-md-3 cashier_number red" data-type="del">DEL</div>
<div class="col-md-3 cashier_number green" data-type="clr">CLR</div>
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
</div>
</div>
<div class="col-md-5">
@@ -140,13 +140,14 @@ $("#redeem").click(function(){
membership_id = $("#valid_amount").attr('data-member-value');
redeem_amount = parseInt($("#used_amount").text());
if(redeem_amount<=0 ){
alert(" Insufficient Amount!")
}else if(valid_amount< redeem_amount || redeem_amount == ""){
alert("Please type valid amount");
}else if(valid_amount< redeem_amount){
alert(" Insufficient Amount!")
}else{
$.ajax({
type: "POST",
url: "<%=origami_paypar_payment_process_path%>",
url: "<%=origami_payment_paypar_path%>",
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
success: function(result){
if(result.status == true){

View File

@@ -0,0 +1,246 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report" do %>
<div class="row">
<div class="span3">
<% if defined? product_account %>
<%= select_tag "account", options_from_collection_for_select(@accounts,"id","title", :selected => params[:account])%>
<% end %>
<% if defined? shift_product_account %>
<%= select_tag "account", options_from_collection_for_select(@accounts,"id","title", :selected => params[:account]), :prompt => 'All Group'%>
<% end %>
</div>
<div class="span3">
<% if period_type != false %>
<label class="radio inline top-valign">
<input type="radio" id="rd_period_type_0" name="period_type" value="0" checked></input>
</label>
<select name="period" id="sel_period">
<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>
<% end %>
</div>
<div class="span3">
<div class="btn-group">
<a href="javascript:export_to('<%=report_path%>.xls')" class = "btn" >Export to Excel</a>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<!-- <ul class="dropdown-menu">
<li>
<a href="javascript:export_to('<%=report_path%>.pdf')" class = "btn" >Export to Pdf</a>
</li>
</ul>
-->
</div>
<br>
<br>
</div>
<!-- <div class="span3">
<% url = url_for(:format => 'xls')%>
<div class="btn-group">
<div id="default_excel">
<a href="javascript:export_to('<%=report_path%>.xls')" class = "btn" >Export to Excel</a>
</div>
<div id="custom_excel" data-url="<%= url %>">
<a href="#" class="btn">Export to Excel</a>
</div>
</div>
<br>
<br>
</div> -->
</div>
<div class="row">
<div class="span3">
<% if defined? show_sale_type %>
<select name="sale_type" id="sel_sale_type">
<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>
<% end %>
<% if defined? promotions %>
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]) %>
<% end %>
<% if defined? menu_types %>
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]) %>
<% end %>
<% if defined? payments %>
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]) %>
<% end %>
<% if defined? shift_name %>
<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" %>
<% end %>
<% if defined? singer %>
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List" %>
<% end %>
<% if defined? bsm %>
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List" %>
<% end %>
<% if defined? guest_role %>
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List" %>
<% 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]) %>
<% end %>
<% if defined? products %>
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products" %>
<% end %>
<% if defined? items %>
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]) %>
<% end %>
</div>
<div class="span3">
<label class="radio inline top-valign">
<input type="radio" id="rd_period_type_1" name="period_type" value="1">
<div class="input-prepend margin-left-3">
<span class="add-on">From</span>
<input data-behaviour='datepicker' class="span2" name="from" id="from" type="text" placeholder="From date">
</div>
</label>
<div class="input-prepend margin-left-23">
<span class="add-on">To&nbsp&nbsp&nbsp&nbsp</span>
<input data-behaviour='datepicker' class="span2" name="to" id="to" type="text" placeholder="To date">
</div>
</div>
<% 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_0" onclick="$('#report_type').val(0)" type="button" class="btn btn-inverse active">Daily</button> -->
<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 class="span3">
<input type="submit" value="Generate Report" class='btn btn-primary'>
</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>
-->
<% end %>
<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>

View File

@@ -1,3 +1,95 @@
<div class="row">
<%= @hi %>
</div>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Receipt List Report</li>
<span style="float: center">
<%= render :partial=>'shift_sale_report_filter',:locals=>{ :period_type => true,
:shift_name => true, :report_path => reports_receipt_no_index_path} %>
</span>
</ul>
</div>
<div class="card">
<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>
<th style='text-align:center;'>CT</th>
<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;'><%=sale.cashier_id 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>
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_tax.to_f), :delimiter => ',') %></td>
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
</tr>
<% end %>
</tbody>
</table>
</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>

View File

@@ -0,0 +1,135 @@
<div class="span12">
<div class="table-responsive">
<% unless @sale_data.empty? %>
<h3 align="center"><%=current_active_location.name%></h3>
<h3 align="center">Sales Summary Report (BreadTalk)</h3>
<% if params[:from]%>
<h4>From Date : <%= params[:from] %> , To Date : <%= params[:to] %></h4>
<% end %>
<table class="table table-bordered" border="1">
<thead>
<tr>
<!-- <th style='text-align:center;'>Sr.no</th> -->
<th style='text-align:center;'>Location Name</th>
<th style='text-align:center;'>Date</th>
<th style='text-align:center;'>Cash Sales</th>
<th style='text-align:center;'>Credit Sales</th>
<th style='text-align:center;'>Credit Received</th>
<!-- <th style='text-align:center;'>Other Payment</th> -->
<th style='text-align:center;'>Card Payment</th>
<th style='text-align:center;'>Total Discount</th>
<th style='text-align:center;'>Total Taxes</th>
<th style='text-align:center;'>Total Other Charges</th>
<th style='text-align:center;'>FOC Sales</th>
<th style='text-align:center;'>Void Sales</th>
<th style='text-align:center;'>Grand Total</th>
</tr>
</thead>
<tbody>
<% void = 0 %>
<% card = 0 %>
<% credit_payment = 0 %>
<% cash = 0 %>
<% credit = 0 %>
<% foc = 0 %>
<% discount = 0 %>
<% total = 0 %>
<% count = 1 %>
<% discount_rev = 0 %>
<% total_rev = 0 %>
<% grand_rev = 0 %>
<% total_other_charges=0 %>
<% total_tax=0 %>
<% cash_received = 0 %>
<% total_cash_received = 0 %>
<% today_credit_payment_amount = 0 %>
<% old_location_id = 0%>
<% sub_total = 0 %>
<% count_of_void = 0 %>
<% flag = false %>
<% @sale_data.each do |sale| %>
<% credit_payment += sale[:credit_payment].to_f %>
<% card += sale[:card_amount].to_f %>
<% cash += sale[:cash_amount].to_f %>
<% credit += sale[:credit_amount].to_f %>
<% foc += sale[:foc_amount].to_f %>
<% discount += sale[:total_discount].to_f %>
<% total += sale[:grand_total].to_f %>
<% total_other_charges +=sale[:other_charges].to_f %>
<% total_tax +=sale[:total_tax].to_f %>
<% cash_received = sale[:cash_amount].to_f + sale[:credit_payment].to_f%>
<% total_cash_received = cash.to_f + credit_payment.to_f%>
<% today_credit_payment_amount += sale[:today_credit_payment].to_f %>
<tr>
<!-- <td style='text-align:right;'><%= count %></td> -->
<td style='text-align:right;'><%= sale[:location].to_s rescue '-' %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:total_discount].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:total_tax].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:other_charges].to_f), :delimiter => ',') %></td>
<td style='text-align:right;color: pink;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %></td>
<% total_void_amount = 0 %>
<% if !@daily_void.nil? %>
<% @daily_void.each do |d_v|%>
<% if d_v[:daily_void_amt].to_i > 0 %>
<% if d_v[:location_id] == sale[:location_id] %>
<% if d_v[:date].utc.getlocal.strftime("%Y-%m-%d").to_s == sale[:sale_date].to_s%>
<%count_of_void+=1%>
<%total_void_amount += d_v[:daily_void_amt].to_f%>
<% flag = true %>
<%end %>
<% end%>
<% end%>
<% end%>
<% end%>
<% if flag == true%>
<% void += total_void_amount.to_f %>
<td style='color:red;text-align:right;'> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %></td>
<% flag = false %>
<% end%>
<%if count_of_void == 0%>
<td style='color:red;text-align:right;'> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %></td>
<%end %>
<td style='text-align:right;'>
<%= number_with_delimiter(sprintf("%.2f",((sale[:cash_amount].to_f + sale[:credit_amount].to_f + sale[:card_amount].to_f + sale[:credit_payment].to_f) - sale[:today_credit_payment].to_f) ).to_f, :delimiter => ',') %>
</td>
</tr>
<%count_of_void= 0%>
<% count = count + 1 %>
<% end %>
<tr style="font-weight:600;">
<td colspan="2" style='text-align:center;'>Grand Total</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total_tax ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total_other_charges ), :delimiter => ',') %></td>
<td style='text-align:right;color: pink;'><%= number_with_delimiter(sprintf("%.2f",foc ), :delimiter => ',') %></td>
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f", (cash.to_f + credit.to_f + card.to_f + credit_payment.to_f) - today_credit_payment_amount.to_f ).to_f, :delimiter => ',') %></td>
</tr>
</tbody>
<% end %>
</table>
</div>
</div>

View File

@@ -9,7 +9,7 @@ Rails.application.routes.draw do
mount Sidekiq::Web => '/kiq'
# Action Cable Creation
mount ActionCable.server => "/cable"
# mount ActionCable.server => "/cable"
#--------- SmartSales Installation ------------#
get 'install' => 'install#index'
@@ -87,7 +87,7 @@ Rails.application.routes.draw do
#--------- Payment ------------#
get 'sale/:sale_id/payment' => 'payments#show'
post 'payment/cash' => 'payments#create'
post 'paypar_payment_process' => 'paypar_payments#create'
post 'payment/paypar' => 'paypar_payments#create'
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"

View File

@@ -155,11 +155,14 @@ member_actions= MembershipAction.create([{membership_type:"get_account_balance",
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS"},
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}
])
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http//192.168.1.47:3006"})
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http//192.168.1.47:3006"})
payment_methods = PaymentMethodSetting.create({payment_method:"REDEEMREBATE",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
# shop = Shop.create(
# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
# country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
# country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
# activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"}
# )

BIN
dump.rdb

Binary file not shown.