Merge branch 'adminbsb_material_ui' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -62,6 +62,9 @@ gem 'jbuilder', '~> 2.5'
|
||||
# Use ActiveModel has_secure_password
|
||||
gem 'bcrypt', '~> 3.1.7'
|
||||
|
||||
# Crypto
|
||||
gem 'aescrypt'
|
||||
|
||||
gem 'sidekiq'
|
||||
gem 'whenever', :require => false
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ GEM
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
aescrypt (1.0.0)
|
||||
arel (8.0.0)
|
||||
autoprefixer-rails (7.1.1.2)
|
||||
execjs
|
||||
@@ -257,6 +258,7 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
aescrypt
|
||||
bcrypt (~> 3.1.7)
|
||||
bootstrap (~> 4.0.0.alpha3)
|
||||
bootstrap-datepicker-rails
|
||||
|
||||
24
README.md
24
README.md
@@ -80,3 +80,27 @@ ruby 2.4.1p111
|
||||
|
||||
|
||||
6. Report
|
||||
|
||||
|
||||
* UI Standard
|
||||
|
||||
1. Layout
|
||||
|
||||
1. 2-Column => Main Content - col-9, Infomation - col-3
|
||||
2. 3-Column => Sub Lint - col-2, Main Content - col-7, Infomation - col-3
|
||||
|
||||
> Pixel
|
||||
|
||||
Main Header Bar - height => 50 px
|
||||
Side Navigation - Weight => 230 px
|
||||
Main Content Padding => 15 px
|
||||
|
||||
2. Color
|
||||
|
||||
> BUTTON
|
||||
|
||||
1. Submit/Add/Edit/Confirm buttons => btn-primary
|
||||
2. Show/Detail Buttons => btn-info
|
||||
3. Delete => btn-delete
|
||||
4. Cancel/Back => btn-default
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
}
|
||||
});
|
||||
|
||||
initRealTimeChart();
|
||||
initDonutChart();
|
||||
initSparkline();
|
||||
// initRealTimeChart();
|
||||
// initDonutChart();
|
||||
// initSparkline();
|
||||
});
|
||||
|
||||
var realtime = 'on';
|
||||
|
||||
@@ -61,7 +61,7 @@ $(document).ready(function(){
|
||||
var date = new Date(data[field]["created_at"]);
|
||||
var show_date = date.getDate() + "-" + date.getMonth() + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||
|
||||
row ='<div class="card queue_station" data-date="'+data[field]["order_id"]+'">'
|
||||
row ='<div class="card queue_station animated " data-date="'+data[field]["order_id"]+'">'
|
||||
+'<div class="card-block">'
|
||||
+'<h4 class="card-title">'
|
||||
+'<span class="order-zone-type">'+data[field]["table_type"]+'- </span>'
|
||||
|
||||
@@ -1,5 +1,81 @@
|
||||
$(function(){
|
||||
//click menu sidebar menu category
|
||||
$(".product").on("click", function(){
|
||||
var url = $(this).attr('data-ref');
|
||||
show_product_list(url);
|
||||
console.log(url)
|
||||
});
|
||||
//show menu item list when click menu category
|
||||
function show_product_list(url_item){
|
||||
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url_item,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
||||
var menu_items_list = $('.menu_items_list');
|
||||
menu_items_list.empty();
|
||||
product = data;
|
||||
|
||||
for(var field in product) {
|
||||
console.log(product[field].name);
|
||||
if (product[field].unit_price > 0) {
|
||||
console.log("hi");
|
||||
qty = 1;
|
||||
options = [];
|
||||
item_attributes = [];
|
||||
|
||||
if (product[field].image_path) {
|
||||
image_path = product[field].image_path.url;
|
||||
}else{
|
||||
image_path = "/image/logo.png";
|
||||
}
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">'
|
||||
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
||||
+'<small class="col-md-9">'+ product[field].name +'</small>'
|
||||
+"<div class='col-md-3 add_icon' data-item-code='"
|
||||
+ product[field].item_code +"' data-name='"
|
||||
+ product[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
|
||||
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"'>"
|
||||
+"<i class='fa fa-plus '"
|
||||
+ 'style="margin-top:4px;">'
|
||||
+'</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
|
||||
+"<div class='menu_item_box' data-item-code='"
|
||||
+ product[field].item_code +"' data-instance = '"
|
||||
+JSON.stringify(item_attributes)+"' data-id = '"
|
||||
+JSON.stringify(item_attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(item_attributes)+"' data-item-sets = '"
|
||||
+JSON.stringify(item_attributes)+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
|
||||
|
||||
+"<div class='card-block custom-card-block'>"
|
||||
+"<img id='logo' src='"+image_path+"'>"
|
||||
+"</div>"
|
||||
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+'<small>'+ product[field].unit_price +'</small>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
$('.menu_items_list').append(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
//end show list function
|
||||
//click menu sidebar menu category
|
||||
$(".menu_category").on("click", function(){
|
||||
var menu_id = $(this).find(".menu-id").text();
|
||||
@@ -69,38 +145,38 @@ $(function(){
|
||||
image_path = "/image/logo.png";
|
||||
}
|
||||
|
||||
row = '<div class="card custom-card">'
|
||||
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
||||
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
||||
+"<div class='col-md-3 add_icon' data-item-code='"
|
||||
+ menu_items[field].code +"' data-name='"
|
||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"'>"
|
||||
+"<i class='fa "+fa_plus+" '"
|
||||
+ 'style="margin-top:4px;">'
|
||||
+'</i></div>'
|
||||
+'</div>'
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">'
|
||||
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
||||
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
||||
+"<div class='col-md-3 add_icon' data-item-code='"
|
||||
+ menu_items[field].code +"' data-name='"
|
||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"'>"
|
||||
+"<i class='fa "+fa_plus+" '"
|
||||
+ 'style="margin-top:4px;">'
|
||||
+'</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
|
||||
+"<div class='"+menu_item_box+"' data-item-code='"
|
||||
+ menu_items[field].code +"' data-instance = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"'>"
|
||||
+"<div class='"+menu_item_box+"' data-item-code='"
|
||||
+ menu_items[field].code +"' data-instance = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"'>"
|
||||
|
||||
+"<div class='card-block custom-card-block'>"
|
||||
+"<img id='logo' src='"+image_path+"'>"
|
||||
+"<div class='card-block custom-card-block'>"
|
||||
+"<img id='logo' src='"+image_path+"'>"
|
||||
+"</div>"
|
||||
|
||||
+"</div>"
|
||||
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+'<small>'+ price +'</small>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+'<small>'+ price +'</small>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
$('.menu_items_list').append(row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,24 +19,21 @@
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
//= require settings/processing_items
|
||||
//= require bootstrap/js/bootstrap.js
|
||||
//= require bootstrap-select/js/bootstrap-select.js
|
||||
//= require momentjs/moment
|
||||
//= require bootstrap-material-datetimepicker/js/bootstrap-material-datetimepicker
|
||||
//= require bootstrap-select/js/bootstrap-select
|
||||
//= require jquery-slimscroll/jquery.slimscroll.js
|
||||
//= require node-waves/waves.js
|
||||
//= require autosize/autosize.js
|
||||
//= require momentjs/moment.js
|
||||
//= require bootstrap-material-datetimepicker/js/bootstrap-material-datetimepicker.js
|
||||
//= require jquery-countto/jquery.countTo.js
|
||||
//= require raphael/raphael.min
|
||||
//= require morrisjs/morris
|
||||
//= require jquery-sparkline/jquery.sparkline
|
||||
//= require chartjs/Chart.bundle.js
|
||||
//= require fileinput.min
|
||||
//= require BSBMaterial/admin.js
|
||||
//= require BSBMaterial/pages/index.js
|
||||
//= require BSBMaterial/demo.js
|
||||
|
||||
|
||||
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$(document).on('turbolinks:load', function() {
|
||||
// $(document).ready(function(){
|
||||
//Datetimepicker plugin
|
||||
$('.datetimepicker').bootstrapMaterialDatePicker({
|
||||
@@ -64,8 +61,9 @@
|
||||
});
|
||||
|
||||
|
||||
$(function(){
|
||||
var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight()));
|
||||
$(function(){
|
||||
var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight()));
|
||||
|
||||
$('#custom-slimscroll').slimScroll({
|
||||
height: height,
|
||||
size: '5px',
|
||||
@@ -74,6 +72,7 @@
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0'
|
||||
});
|
||||
|
||||
$('#order-detail-slimscroll').slimScroll({
|
||||
height: height-180,
|
||||
size: '5px',
|
||||
@@ -82,6 +81,47 @@
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0'
|
||||
});
|
||||
|
||||
// Image Upload
|
||||
$("#simple_menu_item_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
|
||||
$("#product_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
@@ -94,3 +134,5 @@ function export_to(path)
|
||||
var form_params = $("#frm_report").serialize();
|
||||
window.location = path+"?"+ form_params;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann
|
||||
|
||||
if (oqs_id == items[field]["order_queue_station_id"]) {
|
||||
|
||||
row ='<div class="card queue_station queue_station_box" data-date="'+items[field]["order_id"]+'">'
|
||||
row ='<div class="card queue_station animated shake queue_station_box" data-date="'+items[field]["order_id"]+'">'
|
||||
+'<strong class="hidden">'+items[field]["order_id"]+'</strong>'
|
||||
+'<div class="card-block">'
|
||||
+'<h4 class="card-title">'
|
||||
|
||||
5
app/assets/javascripts/popper.min.js
vendored
Normal file
5
app/assets/javascripts/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -9,6 +9,7 @@
|
||||
background-color: #54A5AF;
|
||||
padding:5px;
|
||||
color :#fff;
|
||||
|
||||
}
|
||||
|
||||
.custom-card {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
@import "bootstrap-material-datetimepicker/css/bootstrap-material-datetimepicker";
|
||||
@import "bootstrap-select/css/bootstrap-select";
|
||||
@import "morrisjs/morris";
|
||||
@import "fileinput.min";
|
||||
@import "BSBMaterial/style";
|
||||
@import "BSBMaterial/themes/all-themes";
|
||||
|
||||
@@ -19,6 +20,10 @@
|
||||
padding-right: 5px ;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
padding: 0.1rem 1rem;
|
||||
}
|
||||
|
||||
.navbar-header {
|
||||
padding: 0px;
|
||||
}
|
||||
@@ -57,18 +62,18 @@ section.content {
|
||||
|
||||
.sidebar {
|
||||
width: 210px;
|
||||
height: calc(100vh - 55px);
|
||||
height: calc(100vh - 50px);
|
||||
position: fixed;
|
||||
top: 55px;
|
||||
top: 50px;
|
||||
right: 250px;
|
||||
}
|
||||
|
||||
.right-sidebar {
|
||||
width: 240px;
|
||||
height: calc(100vh - 55px);
|
||||
height: calc(100vh - 50px);
|
||||
position: fixed;
|
||||
right: -260px;
|
||||
top: 55px;
|
||||
top: 50px;
|
||||
}
|
||||
|
||||
.nav-tabs li a.active {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
}
|
||||
|
||||
#wrapper.toggled {
|
||||
padding-left: 200px;
|
||||
padding-left: 210px;
|
||||
}
|
||||
|
||||
#sidebar-wrapper {
|
||||
@@ -41,13 +41,14 @@
|
||||
#page-content-wrapper {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
padding: 0px;
|
||||
padding-top: 20px;
|
||||
|
||||
}
|
||||
|
||||
#wrapper.toggled #page-content-wrapper {
|
||||
position: absolute;
|
||||
margin-right: -200px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +118,7 @@
|
||||
padding-left: 0;
|
||||
}
|
||||
#wrapper.toggled {
|
||||
padding-left: 210px;
|
||||
padding-left: 209px;
|
||||
}
|
||||
#sidebar-wrapper {
|
||||
width: 0;
|
||||
@@ -126,12 +127,13 @@
|
||||
width: 216px;
|
||||
}
|
||||
#page-content-wrapper {
|
||||
padding: 0px;
|
||||
padding-top: 20px;
|
||||
position: relative;
|
||||
}
|
||||
#wrapper.toggled #page-content-wrapper {
|
||||
position: relative;
|
||||
margin-right: 0;
|
||||
padding-top: 20px;
|
||||
}
|
||||
}
|
||||
.accordion {
|
||||
|
||||
@@ -3,6 +3,9 @@ class ApplicationController < ActionController::Base
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
# lookup domain for db from provision
|
||||
before_action :lookup_domain, :set_locale
|
||||
|
||||
helper_method :current_company,:current_login_employee,:current_user
|
||||
# alias_method :current_user, :current_login_employee,:current_user
|
||||
#this is base api base controller to need to inherit.
|
||||
@@ -14,6 +17,61 @@ class ApplicationController < ActionController::Base
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def set_locale
|
||||
I18n.locale = params[:locale] || I18n.default_locale
|
||||
end
|
||||
|
||||
# RESTful url for localize
|
||||
def default_url_options
|
||||
{ locale: I18n.locale }
|
||||
end
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
else
|
||||
# reconnect_default_db
|
||||
logger.info 'License is nil'
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url, key)
|
||||
@license = License.new(url, key)
|
||||
|
||||
##creating md5 hash
|
||||
md5_hostname = Digest::MD5.new
|
||||
md5key = md5_hostname.update(request.host)
|
||||
if (@license.detail_with_local_cache(key, md5key.to_s) == true)
|
||||
#if (@license.detail == true)
|
||||
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def website_connection(license)
|
||||
default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
|
||||
:username => license.dbusername, :password => license.dbpassword)
|
||||
|
||||
end
|
||||
|
||||
def reconnect_default_db
|
||||
ActiveRecord::Base.establish_connection(Rails.env)
|
||||
end
|
||||
|
||||
# Regular database.yml configuration hash
|
||||
def default_connection
|
||||
@default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
@@ -40,3 +98,6 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Crm::BookingsController < BaseCrmController
|
||||
class Crm::BookingsController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
def update_booking
|
||||
booking = Booking.find(params[:booking_id])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Crm::CustomersController < ApplicationController#BaseCrmController
|
||||
class Crm::CustomersController < ApplicationController #BaseCrmController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_crm_customer, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Crm::DiningQueuesController < ApplicationController#BaseCrmController
|
||||
class Crm::DiningQueuesController < ApplicationController #BaseCrmController
|
||||
load_and_authorize_resource
|
||||
before_action :set_dining_queue, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Crm::HomeController < BaseCrmController
|
||||
class Crm::HomeController < ApplicationController
|
||||
def index
|
||||
|
||||
@booking = Booking.all
|
||||
|
||||
@@ -62,6 +62,17 @@ class HomeController < ApplicationController
|
||||
|
||||
def dashboard
|
||||
@shop = Shop.first
|
||||
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
|
||||
@top_products = Sale.top_products(today)
|
||||
@hourly_sales = Sale.hourly_sales(today)
|
||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
||||
# .sum(:grand_total)
|
||||
@employee_sales = Sale.employee_sales(today).sum(:grand_total)
|
||||
@inventories = StockJournal.inventory_balances(today).sum(:balance)
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Oqs::EditController < BaseOqsController
|
||||
class Oqs::EditController < ApplicationController#BaseOqsController
|
||||
def index
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
|
||||
@@ -36,13 +36,16 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
if (params[:id])
|
||||
#Pull this menu
|
||||
@menu = MenuCategory.find_by_id(params[:id])
|
||||
puts @menu.menu_items[1].item_attributes.to_json
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
MenuCategory.current_menu
|
||||
end
|
||||
end
|
||||
|
||||
def get_all_product()
|
||||
@product = Product.all
|
||||
end
|
||||
|
||||
def create
|
||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
||||
@@ -53,6 +56,7 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class Origami::CardPaymentsController < ApplicationController#BaseOrigamiController
|
||||
|
||||
|
||||
class Origami::CardPaymentsController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@membership_rebate_balance = 0
|
||||
@membership_id = 0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::CashInsController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::CashInsController < ApplicationController #BaseOrigamiController
|
||||
def new
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::CashOutsController < ApplicationController#BaseOrigamiController
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class Origami::CreditPaymentsController < ApplicationController#BaseOrigamiController
|
||||
|
||||
|
||||
class Origami::CreditPaymentsController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::CustomersController < ApplicationController#BaseOrigamiController
|
||||
class Origami::CustomersController < ApplicationController #BaseOrigamiController
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::DiscountsController < ApplicationController#BaseOrigamiController
|
||||
class Origami::DiscountsController < ApplicationController #BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
#discount page show from origami index with selected order
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::HomeController < ApplicationController#BaseOrigamiController
|
||||
class Origami::HomeController < ApplicationController #BaseOrigamiController
|
||||
before_action :set_dining, only: [:show]
|
||||
|
||||
def index
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::HomeController < BaseOrigamiController
|
||||
class Origami::HomeController < ApplicationController
|
||||
def index
|
||||
if params[:booking_id] != nil
|
||||
type=params[:booking_id].split('-')[0];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::InDutiesController < ApplicationController#BaseOrigamiController
|
||||
class Origami::InDutiesController < ApplicationController #BaseOrigamiController
|
||||
before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty]
|
||||
|
||||
# GET /in_duties
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::JcbController < ApplicationController#BaseOrigamiController
|
||||
class Origami::JcbController < ApplicationController #BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::MasterController < ApplicationController#BaseOrigamiController
|
||||
class Origami::MasterController < ApplicationController #BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Origami::MoveroomController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::MoveroomController < ApplicationController #BaseOrigamiController
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Origami::MovetableController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::MovetableController < ApplicationController #BaseOrigamiController
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::MpuController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::MpuController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::OrdersController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::OrdersController < ApplicationController #BaseOrigamiController
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::OtherChargesController < ApplicationController#BaseOrigamiController
|
||||
class Origami::OtherChargesController < ApplicationController #BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
def index
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class Origami::OthersPaymentsController < ApplicationController#BaseOrigamiController
|
||||
|
||||
|
||||
class Origami::OthersPaymentsController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@membership_rebate_balance = 0
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::PaymentsController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::PaymentsController < ApplicationController #BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::ProductCommissionsController < ApplicationController#BaseOrigamiController
|
||||
class Origami::ProductCommissionsController < ApplicationController #BaseOrigamiController
|
||||
before_action :set_product_commission, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /product_commissions
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::RedeemPaymentsController < ApplicationController#BaseOrigamiController
|
||||
class Origami::RedeemPaymentsController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
payment_method = params[:payment_method]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
class Origami::RequestBillsController < ApplicationController
|
||||
|
||||
# Print Request Bill and add to sale tables
|
||||
def print
|
||||
@@ -24,6 +24,9 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
# Bind shift sale id to sale
|
||||
@sale_data.shift_sale_id = shift.id
|
||||
@sale_data.save
|
||||
|
||||
# Promotion Activation
|
||||
Promotion.promo_activate(@sale)
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift for This Employee"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::RoomInvoicesController < ApplicationController#BaseOrigamiController
|
||||
class Origami::RoomInvoicesController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
puts "room bookig lenght"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::RoomsController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::RoomsController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::SaleEditController < ApplicationController#BaseOrigamiController
|
||||
class Origami::SaleEditController < ApplicationController #BaseOrigamiController
|
||||
authorize_resource class: false
|
||||
# Index for sale item void OR edit
|
||||
def edit
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::SalesController < ApplicationController#BaseOrigamiController
|
||||
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::ShiftsController < ApplicationController#BaseOrigamiController
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::TableInvoicesController < ApplicationController#BaseOrigamiController
|
||||
class Origami::TableInvoicesController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
puts "table bookig lenght"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::VisaController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::VisaController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::VoidController < BaseOrigamiController
|
||||
class Origami::VoidController < ApplicationController
|
||||
authorize_resource :class => false
|
||||
def overall_void
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Origami::VoucherController < ApplicationController#BaseOrigamiController
|
||||
|
||||
class Origami::VoucherController < ApplicationController #BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
|
||||
@@ -70,6 +70,6 @@ class PrintSettingsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def print_setting_params
|
||||
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||
end
|
||||
end
|
||||
|
||||
192
app/models/license.rb
Executable file
192
app/models/license.rb
Executable file
@@ -0,0 +1,192 @@
|
||||
class License
|
||||
include HTTParty
|
||||
|
||||
base_uri "secure.smartsales.asia/api"
|
||||
|
||||
attr_accessor :name, :address_1, :address_2, :township, :city, :country, :email, :phone, :fax, :logo, :subdomain,
|
||||
:plan_activation_date, :plan_next_renewal_date, :plan_max_products,:plan_max_customers, :plan_active_connections,
|
||||
:dbhost, :dbschema, :dbusername, :dbpassword, :exchange_unqiue_id, :localqueue_host,:server_mode,:localhost_address,
|
||||
:localqueue_user, :localqueue_password, :remotequeue_host, :remotequeue_user, :remotequeue_password, :api_token, :app_token
|
||||
|
||||
@license = nil
|
||||
@secret = nil
|
||||
|
||||
def initialize(server = "", lookup = "")
|
||||
#this code is hard-code to reflect server mode - Very important.
|
||||
self.server_mode = "cloud"
|
||||
|
||||
if (server != "")
|
||||
self.class.base_uri server
|
||||
end
|
||||
|
||||
@secret = SecureRandom.hex(10)
|
||||
@params = { query: { device: "SXlite", token: SECRETS_CONFIG['provision_key'] } }
|
||||
end
|
||||
|
||||
def shop_code
|
||||
if ( self.subdomain.length > 3)
|
||||
return self.subdomain[0,3].upcase
|
||||
else
|
||||
return self.subdomain.upcase
|
||||
end
|
||||
end
|
||||
|
||||
def detail_with_local_cache(lookup, key)
|
||||
##Check from local redis - if available load local otherwise get from remote
|
||||
cache_key = "store:license:#{key}:hostname"
|
||||
|
||||
# No Needs for current
|
||||
# @secret = key
|
||||
|
||||
cache_license = nil
|
||||
|
||||
##Get redis connection from connection pool
|
||||
Redis.current do |conn|
|
||||
cache_license = conn.get(cache_key)
|
||||
end
|
||||
|
||||
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||
|
||||
if cache_license.nil?
|
||||
##change the d/e key
|
||||
# @options = { query: {device: "SXlite", lookup: lookup, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
@params = { query: { device: "SXlite", token: SECRETS_CONFIG['provision_key']} }
|
||||
|
||||
response = self.class.get("/request_license", @params)
|
||||
@license = response.parsed_response
|
||||
|
||||
if (@license["status"] == true)
|
||||
|
||||
assign()
|
||||
|
||||
Rails.logger.info "License - " + response.parsed_response.to_s
|
||||
|
||||
Redis.current do |conn|
|
||||
##Remote - store the remote response in local redis cache
|
||||
conn.set(cache_key, Marshal.dump(@license))
|
||||
##ADD to List to remove later
|
||||
conn.sadd("License:cache:keys", cache_key)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
Rails.logger.info 'API License'
|
||||
|
||||
else
|
||||
|
||||
@license = Marshal.load(cache_license) if cache_license
|
||||
|
||||
Rails.logger.info 'Cache License'
|
||||
|
||||
if (@license["status"] == true)
|
||||
assign()
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def detail
|
||||
|
||||
response = self.class.get("/subdomain", @options)
|
||||
@license = response.parsed_response
|
||||
|
||||
Rails.logger.debug "License - " + response.parsed_response.to_s
|
||||
|
||||
|
||||
if (@license["status"] == true)
|
||||
assign()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
def check_remote_license(license_key)
|
||||
# @options = { query: {device: "cloud", key: license_key, skey: @secret, token: Rails.application.secrets.provision_key} }
|
||||
@options = { query: {device: "SXlite", key: license_key, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
response = self.class.get("/license", @options)
|
||||
|
||||
@license = response.parsed_response
|
||||
|
||||
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||
if (@license["status"])
|
||||
assign()
|
||||
end
|
||||
return @license["status"]
|
||||
|
||||
end
|
||||
|
||||
def verify_by_api_token(api_token)
|
||||
@options = { query: {device: "SXlite", api_token: api_token, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
response = self.class.get("/verify", @options)
|
||||
|
||||
@license = response.parsed_response
|
||||
|
||||
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||
if (@license["status"])
|
||||
assign()
|
||||
end
|
||||
|
||||
return @license["status"]
|
||||
end
|
||||
#Load License is remove from the cloud license because - this license is must be validated against subdmain instead of license.data from file.
|
||||
|
||||
|
||||
def expired?
|
||||
if (self.plan_next_renewal_date < Date.today)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def assign
|
||||
# self.name = @license["name"]
|
||||
# self.address_1 = @license["address_1"]
|
||||
# self.address_2 = @license["address_2"]
|
||||
# self.township = @license["township"]
|
||||
# self.city = @license["city"]
|
||||
# self.country = @license["country"]
|
||||
# self.email = @license["email"]
|
||||
# self.phone = @license["phone"]
|
||||
# self.fax = @license["fax"]
|
||||
# self.logo = @license["logo"]
|
||||
# self.localhost_address = @license["localhost_address"]
|
||||
# self.subdomain = @license["subdomain"]
|
||||
# self.plan_activation_date = Date.parse(@license["plan_activation_date"])
|
||||
# self.plan_next_renewal_date = Date.parse(@license["plan_next_renewal_date"])
|
||||
|
||||
## self.plan_activation_date = Date.strptime(@license["plan_activation_date"], "%Y-%m-%d")
|
||||
## self.plan_next_renewal_date = Date.strptime(@license["plan_next_renewal_date"], "%Y-%m-%d")
|
||||
|
||||
|
||||
# self.plan_max_products = @license["plan_max_products"].to_i
|
||||
# self.plan_max_customers = @license["plan_max_customers"].to_i
|
||||
# self.plan_active_connections = @license["plan_active_connections"].to_i
|
||||
salt = @license["secret_key"]
|
||||
|
||||
if (@license["dbhost"] || @license["dbschema"] || @license["dbusername"] || @license["dbpassword"] )
|
||||
self.dbhost = AESCrypt.decrypt(@license["dbhost"], salt)
|
||||
self.dbschema = AESCrypt.decrypt(@license["dbschema"], salt)
|
||||
self.dbusername = AESCrypt.decrypt(@license["dbusername"], salt)
|
||||
self.dbpassword = AESCrypt.decrypt(@license["dbpassword"], salt)
|
||||
end
|
||||
|
||||
# self.exchange_unqiue_id = @license["exchange_unqiue_id"]
|
||||
|
||||
# self.localqueue_host= @license["localqueue_host"]
|
||||
# self.localqueue_user= @license["localqueue_user"]
|
||||
# self.localqueue_password= @license["localqueue_password"]
|
||||
|
||||
# self.remotequeue_host = @license["remotequeue_host"]
|
||||
# self.remotequeue_user = @license["remotequeue_user"]
|
||||
# self.remotequeue_password = @license["remotequeue_password"]
|
||||
|
||||
# self.api_token = @license["api_token"]
|
||||
# self.app_token = @license["app_token"]
|
||||
end
|
||||
end
|
||||
@@ -38,6 +38,41 @@ class Order < ApplicationRecord
|
||||
booking.save!
|
||||
self.default_values
|
||||
|
||||
# cashier already opened?
|
||||
if self.save!
|
||||
|
||||
self.adding_line_items
|
||||
#Add Order Table and Room relation afrer order creation
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
||||
|
||||
#Send order to queue one it done!
|
||||
process_order_queue
|
||||
|
||||
#send order to broadcast job
|
||||
send_order_broadcast(booking)
|
||||
|
||||
return true, booking
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def custom_generate
|
||||
booking = nil
|
||||
|
||||
if self.new_booking
|
||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
table = DiningFacility.find(self.table_id)
|
||||
table.status = "occupied"
|
||||
table.save
|
||||
else
|
||||
booking = Booking.find(self.booking_id)
|
||||
end
|
||||
|
||||
booking.save!
|
||||
self.default_values
|
||||
|
||||
# cashier already opened?
|
||||
if self.save!
|
||||
|
||||
@@ -58,7 +93,6 @@ class Order < ApplicationRecord
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
#Main Method - to update order / add items
|
||||
def modify
|
||||
|
||||
@@ -71,7 +105,12 @@ class Order < ApplicationRecord
|
||||
|
||||
#loop to add all items to order
|
||||
self.items.each do |item|
|
||||
|
||||
menu_item = MenuItem.search_by_item_code(item[:item_instance_code])
|
||||
|
||||
if menu_item.nil?
|
||||
menu_item = Product.search_by_product_code(item[:item_instance_code])
|
||||
end
|
||||
|
||||
#if (!menu_item.nil?)
|
||||
Rails.logger.debug menu_item
|
||||
|
||||
@@ -3,4 +3,24 @@ class Product < ApplicationRecord
|
||||
|
||||
# Product Image Uploader
|
||||
mount_uploader :image_path, ProductImageUploader
|
||||
|
||||
def self.search_by_product_code(item_code)
|
||||
menu_item_hash = Hash.new
|
||||
mt_instance = Product.find_by_item_code(item_code)
|
||||
if (!mt_instance.nil?)
|
||||
menu_item_hash[:type] = 'Product'
|
||||
menu_item_hash[:account_id] = 1
|
||||
menu_item_hash[:item_code] = mt_instance.item_code
|
||||
menu_item_hash[:item_instance_code] = mt_instance.item_code
|
||||
menu_item_hash[:name] = mt_instance.name.to_s
|
||||
menu_item_hash[:alt_name] = mt_instance.alt_name.to_s
|
||||
menu_item_hash[:price] = mt_instance.unit_price
|
||||
menu_item_hash[:promotion_price] = 0
|
||||
menu_item_hash[:is_on_promotion] = 0
|
||||
menu_item_hash[:is_available] = 0
|
||||
menu_item_hash[:taxable] = mt_instance.taxable
|
||||
|
||||
return menu_item_hash
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -843,6 +843,28 @@ end
|
||||
return tax
|
||||
end
|
||||
|
||||
def self.top_products(today)
|
||||
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
|
||||
" i.price as unit_price,mi.name as product_name")
|
||||
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code")
|
||||
.where("(i.qty > 0 ) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+
|
||||
"and payment_status='paid' and sale_status= 'completed'")
|
||||
.group('mi.name')
|
||||
.order("SUM(i.qty) DESC").limit(5)
|
||||
end
|
||||
|
||||
def self.hourly_sales(today)
|
||||
query= Sale.select("grand_total").where('payment_status="paid" and sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
|
||||
end
|
||||
|
||||
def self.employee_sales(today)
|
||||
query = Sale.select("e.name as employee_name,grand_total")
|
||||
.where('payment_status="paid" and sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
|
||||
.joins("join employees e on e.id=sales.cashier_id")
|
||||
.group('e.name')
|
||||
.order('e.name ASC')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
@@ -36,4 +36,12 @@ class StockJournal < ApplicationRecord
|
||||
journal.save
|
||||
end
|
||||
|
||||
def self.inventory_balances(today)
|
||||
query = StockJournal.select("mii.item_instance_name as item_instance_name,balance")
|
||||
.joins("join menu_item_instances mii on mii.item_instance_code=stock_journals.item_code")
|
||||
.where("DATE_FORMAT(stock_journals.created_at,'%Y-%m-%d') = '#{today}'")
|
||||
.group("mii.item_instance_name")
|
||||
.order("mii.item_instance_name ASC")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -21,7 +21,18 @@ class CloseCashierPdf < Prawn::Document
|
||||
#setting page margin and width
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||
})
|
||||
|
||||
font "#{printer_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 10
|
||||
@@ -198,7 +209,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.master_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
text "#{other.jcb_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -206,7 +217,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Master Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.jcb_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
text "#{other.master_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
|
||||
@@ -18,6 +18,20 @@ class CrmOrderPdf < Prawn::Document
|
||||
@half_qty = @qty_width / 2
|
||||
#setting page margin and width
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||
})
|
||||
|
||||
font "#{printer_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
|
||||
self.header_font_size = 10
|
||||
self.item_font_size = 9
|
||||
|
||||
|
||||
@@ -16,7 +16,18 @@ class OrderItemPdf < Prawn::Document
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# db font setup
|
||||
if print_settings.font != nil
|
||||
font_families.update("#{print_settings.font}" => {
|
||||
:normal => "public/fonts/#{print_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{print_settings.font}.ttf",
|
||||
:bold => "public/fonts/#{print_settings.font}.ttf",
|
||||
:bold_italic => "public/fonts/#{print_settings.font}.ttf"
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
|
||||
@@ -15,9 +15,20 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# db font setup
|
||||
if print_settings.font != nil
|
||||
font_families.update("#{print_settings.font}" => {
|
||||
:normal => "public/fonts/#{print_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{print_settings.font}.ttf",
|
||||
:bold => "public/fonts/#{print_settings.font}.ttf",
|
||||
:bold_italic => "public/fonts/#{print_settings.font}.ttf"
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
font "public/fonts/padauk.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
|
||||
|
||||
@@ -14,6 +14,19 @@ class QueueNoPdf < Prawn::Document
|
||||
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||
})
|
||||
|
||||
font "#{printer_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
|
||||
self.header_font_size = 10
|
||||
self.item_font_size = 8
|
||||
|
||||
|
||||
@@ -22,7 +22,18 @@ class ReceiptBillPdf < Prawn::Document
|
||||
#setting page margin and width
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||
})
|
||||
|
||||
font "#{printer_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 10
|
||||
@@ -226,7 +237,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
move_down 5
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
bounding_box([0,y_position], :width =>self.item_description_width) do
|
||||
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
@@ -453,8 +464,8 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{printed_status}",:style => :bold, :size => self.header_font_size,:align => :left
|
||||
bounding_box([0, y_position], :width =>self.label_width) do
|
||||
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
||||
|
||||
@@ -21,7 +21,19 @@ class StockResultPdf < Prawn::Document
|
||||
#setting page margin and width
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||
})
|
||||
|
||||
font "#{printer_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 10
|
||||
|
||||
@@ -102,6 +102,12 @@
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<div id="custom-slimscroll">
|
||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<a href="<%= dashboard_path%>" class="btn btn-primary">
|
||||
Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-lg-1 col-md-1 col-sm-1 ">
|
||||
|
||||
@@ -52,5 +52,235 @@
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<!-- CPU Usage -->
|
||||
|
||||
|
||||
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-heading"><h4>Top Products</h4></div>
|
||||
<div class="panel-body">
|
||||
<canvas id="top_products" class="col-md-12"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-heading"><h4>Inventory</h4></div>
|
||||
<div class="panel-body">
|
||||
<canvas id="inventory" class="col-md-12"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-heading"><h4>Hourly Sales</h4></div>
|
||||
<div class="panel-body">
|
||||
<canvas id="hourly_sales" class="col-md-12"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-heading"><h4>Employee Sales</h4></div>
|
||||
<div class="panel-body">
|
||||
<canvas id="employee_sales" class="col-md-12"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- <script src="js/Chart.js"></script> -->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var top_products = JSON.parse('<%= @top_products.to_json.html_safe %>');
|
||||
var hourly_sales = JSON.parse('<%= @hourly_sales.to_json.html_safe %>');
|
||||
var employee_sales = JSON.parse('<%= @employee_sales.to_json.html_safe %>');
|
||||
var inventories = JSON.parse('<%= @inventories.to_json.html_safe %>');
|
||||
showTopProductsChartData(top_products);
|
||||
showHourlySalesChartData(hourly_sales);
|
||||
showEmployeeSalesChartData(employee_sales);
|
||||
showInventoryChartData(inventories);
|
||||
});
|
||||
|
||||
function randomColorGenerator () {
|
||||
return '#' + (Math.random().toString(16) + '0000000').slice(2, 8);
|
||||
};
|
||||
|
||||
function showTopProductsChartData(top_products) {
|
||||
var labels = [];
|
||||
var datasets = [];
|
||||
var backgroundColor = [];
|
||||
|
||||
if(top_products!=undefined && top_products!=''){
|
||||
if(top_products.length>0){
|
||||
$.each(top_products,function(k,val){
|
||||
labels.push(val.product_name);
|
||||
datasets.push(val.total_item);
|
||||
backgroundColor.push(randomColorGenerator());
|
||||
});
|
||||
|
||||
var chart = new Chart("top_products", {
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
data: datasets,
|
||||
backgroundColor: backgroundColor
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
legend: {
|
||||
labels: {
|
||||
fontColor: 'black'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showHourlySalesChartData(hourly_sales) {
|
||||
var labels = [];
|
||||
var datasets = [];
|
||||
var backgroundColor = [];
|
||||
|
||||
if(hourly_sales!=undefined && hourly_sales!=''){
|
||||
if(Object.keys(hourly_sales).length > 0){
|
||||
$.each(hourly_sales,function(k,val){
|
||||
labels.push(k.toString());
|
||||
datasets.push(val);
|
||||
backgroundColor.push(randomColorGenerator());
|
||||
});
|
||||
|
||||
|
||||
var myChart = new Chart("hourly_sales", {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: '',
|
||||
data: datasets,
|
||||
backgroundColor: backgroundColor,
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
legend: {
|
||||
display:false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
stacked: true,
|
||||
categorySpacing: 0,
|
||||
barPercentage: 0.5
|
||||
}],
|
||||
yAxes: [{
|
||||
stacked: true,
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showEmployeeSalesChartData(employee_sales) {
|
||||
var labels = [];
|
||||
var datasets = [];
|
||||
var backgroundColor = [];
|
||||
|
||||
if(employee_sales!=undefined && employee_sales!=''){
|
||||
if(Object.keys(employee_sales).length > 0){
|
||||
$.each(employee_sales,function(k,val){
|
||||
labels.push(k.toString());
|
||||
datasets.push(val);
|
||||
backgroundColor.push(randomColorGenerator());
|
||||
});
|
||||
|
||||
var myChart = new Chart("employee_sales", {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: '',
|
||||
data: datasets,
|
||||
backgroundColor: backgroundColor,
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
legend: {
|
||||
display:false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
stacked: true,
|
||||
categorySpacing: 0,
|
||||
barPercentage: 0.5
|
||||
}],
|
||||
yAxes: [{
|
||||
stacked: true,
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showInventoryChartData(inventories) {
|
||||
var labels = [];
|
||||
var datasets = [];
|
||||
var borderColor = [];
|
||||
|
||||
if(inventories!=undefined && inventories!=''){
|
||||
if(Object.keys(inventories).length > 0){
|
||||
$.each(inventories,function(k,val){
|
||||
labels.push(k.toString());
|
||||
datasets.push(val);
|
||||
borderColor.push(randomColorGenerator());
|
||||
});
|
||||
|
||||
var myChart = new Chart("inventory", {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
fill: false,
|
||||
data: datasets,
|
||||
borderColor: borderColor
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
legend: {
|
||||
display:false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
stacked: true
|
||||
}],
|
||||
yAxes: [{
|
||||
stacked: false,
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -148,12 +148,13 @@
|
||||
console.log($(this).data("formid"));
|
||||
var item = $(this).data("formid");
|
||||
$(item).submit();
|
||||
|
||||
});
|
||||
|
||||
// Add minus icon for collapse element which is open by default
|
||||
$(".collapse.in").each(function () {
|
||||
$(this).siblings(".panel-heading").find(".glyphicon").addClass("glyphicon-minus").removeClass("glyphicon-plus");
|
||||
});
|
||||
|
||||
// Toggle plus minus icon on show hide of collapse element
|
||||
$(".collapse").on('show.bs.collapse', function () {
|
||||
$(this).parent().find(".glyphicon").removeClass("glyphicon-plus").addClass("glyphicon-minus");
|
||||
|
||||
@@ -39,18 +39,18 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('turbolinks:load', function () {
|
||||
$(".pin_pad").click(function (event) {
|
||||
event.preventDefault();
|
||||
console.log($(this).data("value"));
|
||||
$(document).ready(function() {
|
||||
$(".pin_pad").click(function(event) {
|
||||
event.preventDefault();
|
||||
var old_value = $("#login_form_password").val();
|
||||
var value = $(this).data("value");
|
||||
|
||||
console.log(old_value);
|
||||
console.log(value);
|
||||
if (value == "CLR") {
|
||||
$("#login_form_password").val("");
|
||||
} else if (value == "ENT") {
|
||||
$("#new_login_form").submit();
|
||||
} else {
|
||||
var old_value = $("#login_form_password").val();
|
||||
} else {
|
||||
$("#login_form_password").val(old_value + value);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render 'layouts/header_oqs' %>
|
||||
<%= render 'layouts/header' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<div class="alert fade in">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
|
||||
<a href="javascript:void(0);" class="bars"></a>
|
||||
<a class="navbar-brand" href="index.html">
|
||||
<img src="<%= asset_path('logo.png') %>" width="32" height="32" alt="Logo" />
|
||||
<img src="<%= asset_path('SX-logo.png') %>" width="40" height="40" alt="Logo" />
|
||||
<span class="navbar-brand-txt">SX Restaurant</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -31,8 +31,11 @@
|
||||
<!-- <a href="<%= logout_path %>"><i class="material-icons">input</i>Sign Out</a> -->
|
||||
</li>
|
||||
</ul>
|
||||
<a href="javascript:void(0);" class="js-right-sidebar" data-close="true"><i class="material-icons">more_vert</i></a>
|
||||
<a href="javascript:void(0);" class="js-right-sidebar" data-close="true">
|
||||
<i class="material-icons">more_vert</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<!-- #Top Bar
|
||||
|
||||
|
||||
36
app/views/layouts/_sidebar.html.erb
Normal file
36
app/views/layouts/_sidebar.html.erb
Normal file
@@ -0,0 +1,36 @@
|
||||
<div id="sidebar-wrapper">
|
||||
<ul id="accordion" class="accordion sidebar-nav">
|
||||
<li class="header"><a>Main Navigation</a></li>
|
||||
<li><%= link_to "Dashboard ", dashboard_path,:class =>"" %> </li>
|
||||
<li><%= link_to "OQS ", oqs_root_path,:class =>"" %></li>
|
||||
<li><%= link_to "Cashier ", origami_root_path,:class =>"" %></li>
|
||||
<li>
|
||||
<div class="link">CRM<i class="fa fa-chevron-down"></i>
|
||||
</div>
|
||||
<ul class="submenu">
|
||||
<li> <%= link_to "Customer ", crm_customers_path,:class =>"" %></li>
|
||||
<li> <%= link_to "Queue ", crm_dining_queues_path,:class =>"" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><%= link_to "Inventory ", inventory_path,:class =>"" %></li>
|
||||
<li class="header"><a>Settings</a></li>
|
||||
<li><%= link_to "Zones ", settings_zones_path,:class =>"" %></li>
|
||||
<li><%= link_to "Order Queue Station ", settings_order_queue_stations_path,:class =>"" %></li>
|
||||
<li><%= link_to "Menu ", settings_menus_path,:class =>"" %></li>
|
||||
<li>
|
||||
<div class="link">Transactions<i class="fa fa-chevron-down"></i>
|
||||
</div>
|
||||
<ul class="submenu">
|
||||
<li> <%= link_to "Orders ", transactions_orders_path,:class =>"" %></li>
|
||||
<li> <%= link_to "Sales ", transactions_sales_path,:class =>"" %></li>
|
||||
<li> <%= link_to "Credit Note ", transactions_credit_notes_path,:class =>"m" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><%= link_to "Cashier Terminal ", settings_cashier_terminals_path,:class =>"" %></li>
|
||||
<li><%= link_to "Print Settings ", print_settings_path,:class =>"" %></li>
|
||||
<li><%= link_to "Staff ", settings_employees_path,:class =>"" %></li>
|
||||
<li><%= link_to "Product ", settings_products_path,:class =>"" %></li>
|
||||
<li><%= link_to "Promotion ", settings_promotions_path,:class =>"" %></li>
|
||||
<li><%= link_to "Reports", reports_dailysale_index_path, :class =>"" %></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -3,13 +3,15 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<ul class="nav nav-tabs flex-column" role="tablist" >
|
||||
<% @menu.each do |menu| %>
|
||||
<li class="nav-item menu_category" data-ref="<%= origami_get_menu_category_path menu.id%>">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%></a>
|
||||
|
||||
</li>
|
||||
<% end %>
|
||||
<% @menu.each do |menu| %>
|
||||
<li class="nav-item menu_category" data-ref="<%= origami_get_menu_category_path menu.id%>">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-7 col-lg-7 col-sm-7">
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
json.array! @product, :id, :item_code, :name, :alt_name,:image_path,
|
||||
:description,:information,:taxable,:unit_price, :created_at,
|
||||
:updated_at, :created_by
|
||||
@@ -6,6 +6,7 @@
|
||||
<%= f.input :unique_code %>
|
||||
<%= f.input :template %>
|
||||
<%= f.input :printer_name %>
|
||||
<%= f.input :font %>
|
||||
<%= f.input :api_settings %>
|
||||
<%= f.input :page_width %>
|
||||
<%= f.input :page_height %>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
json.extract! print_setting, :id, :name,, :unique_code,, :template,, :db_name,, :db_type,, :db_username,, :db_password,, :printer_name,, :api_settings,, :page_width, :page_height, :print_copies, :created_at, :updated_at
|
||||
json.extract! print_setting, :id, :name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies, :created_at, :updated_at
|
||||
json.url print_setting_url(print_setting, format: :json)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<th>Unique code</th>
|
||||
<th>Template</th>
|
||||
<th>Printer name</th>
|
||||
<th>Font</th>
|
||||
<th>Api settings</th>
|
||||
<th>Page width</th>
|
||||
<th>Page height</th>
|
||||
@@ -36,6 +37,7 @@
|
||||
<td><%= print_setting.unique_code %></td>
|
||||
<td><%= print_setting.template %></td>
|
||||
<td><%= print_setting.printer_name %></td>
|
||||
<td><%= print_setting.font %></td>
|
||||
<td><%= print_setting.api_settings %></td>
|
||||
<td><%= print_setting.page_width %></td>
|
||||
<td><%= print_setting.page_height %></td>
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
<tr>
|
||||
<th>Printer name</th>
|
||||
<td><%= @print_setting.printer_name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Font</th>
|
||||
<td><%= @print_setting.font %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Api settings</th>
|
||||
|
||||
@@ -1,42 +1,39 @@
|
||||
<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-3">
|
||||
<label class="">Select Date Range</label>
|
||||
<% if @daterange %>
|
||||
<input class="form-control" name="daterange" id="daterange" value="<%= @daterange %>" type="text" placeholder="Date Range" readonly="true">
|
||||
<% else %>
|
||||
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="">Commissioner</label>
|
||||
<select class="form-control" name="commissioner" id="commissioner">
|
||||
<option value=""></option>
|
||||
<% @commissioner.each do |c| %>
|
||||
<% if @com_id == c.id %>
|
||||
<option value="<%= c.id %>" selected><%= c.name %></option>
|
||||
<% else %>
|
||||
<option value="<%= c.id %>"><%= c.name %></option>
|
||||
<% end %> %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
|
||||
</div>
|
||||
</div>
|
||||
<%= 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-3">
|
||||
<label class="">Select Date Range</label>
|
||||
<% if @daterange %>
|
||||
<input class="form-control" name="daterange" id="daterange" value="<%= @daterange %>" type="text" placeholder="Date Range" readonly="true">
|
||||
<% else %>
|
||||
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="">Commissioner</label>
|
||||
<select class="form-control" name="commissioner" id="commissioner">
|
||||
<option value=""></option>
|
||||
<% @commissioner.each do |c| %>
|
||||
<% if @com_id == c.id %>
|
||||
<option value="<%= c.id %>" selected><%= c.name %></option>
|
||||
<% else %>
|
||||
<option value="<%= c.id %>"><%= c.name %></option>
|
||||
<% end %> %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
@@ -5,23 +7,23 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial => 'commission_report_filter',
|
||||
:locals => {:period_type => true, :shift_name => true, :report_path => reports_commission_index_path} %>
|
||||
<hr/>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%= reports_commission_index_path %>.xls')" class="btn btn-default">Export to
|
||||
Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
||||
@@ -1,125 +1,121 @@
|
||||
<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="">Select Period</option>
|
||||
<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>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <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-2">
|
||||
<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-3">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= 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="">Select Period</option>
|
||||
<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>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <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-2">
|
||||
<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-3">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% 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();
|
||||
$(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');
|
||||
}
|
||||
});
|
||||
|
||||
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');
|
||||
}
|
||||
});
|
||||
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||
// shift = $(".shift-id").text()
|
||||
// if (shift.length>0) {
|
||||
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
||||
// }
|
||||
|
||||
<% 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");
|
||||
<% 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');
|
||||
$('#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();
|
||||
}
|
||||
}
|
||||
});
|
||||
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>
|
||||
|
||||
@@ -5,22 +5,22 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_credit_payment_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_credit_payment_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<div class="margin-top-20">
|
||||
<div class="card ">
|
||||
<% unless @sale_data.blank? %>
|
||||
|
||||
<table class="table table-striped" border="0">
|
||||
|
||||
@@ -1,144 +1,122 @@
|
||||
<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="">Select Period</option>
|
||||
<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-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 %>
|
||||
<%= 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="">Select Period</option>
|
||||
<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">
|
||||
|
||||
<% if defined? items %>
|
||||
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</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">
|
||||
<div class="col-md-12">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</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 %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% 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>
|
||||
|
||||
<% 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;
|
||||
$(function(){
|
||||
$('#custom_excel').hide();
|
||||
|
||||
$('#custom_excel').click(function(){
|
||||
var url = $('#custom_excel').attr('data-url');
|
||||
$('#frm_report').attr('action',url)
|
||||
$('#frm_report').submit();
|
||||
|
||||
});
|
||||
|
||||
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');
|
||||
}
|
||||
});
|
||||
|
||||
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]%>);
|
||||
@@ -156,9 +134,9 @@ $("#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");
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
<% else %>
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
<% end %>
|
||||
$(".btn-group button").removeClass("active");
|
||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||
|
||||
@@ -1,139 +1,152 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">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_dailysale_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_dailysale_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>
|
||||
<tr>
|
||||
<th colspan="15"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:center;'>Sr</th>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Void Amount</th>
|
||||
<th style='text-align:center;'>Mpu Sales</th>
|
||||
<th style='text-align:center;'>Master Sales</th>
|
||||
<th style='text-align:center;'>Visa Sales</th>
|
||||
<th style='text-align:center;'>Jcb Sales</th>
|
||||
<th style='text-align:center;'>Redeem Sales</th>
|
||||
<th style='text-align:center;'>Cash Sales</th>
|
||||
<th style='text-align:center;'>Credit Sales</th>
|
||||
<th style='text-align:center;'>FOC Sales</th>
|
||||
<th style='text-align:center;'>(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 %>
|
||||
<% old_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]-sale[:total_change_amount] %>
|
||||
<% credit += sale[:credit_amount] %>
|
||||
<% foc += sale[:foc_amount] %>
|
||||
<% discount += sale[:total_discount] %>
|
||||
<% total += sale[:old_grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||
<% grand_total += sale[:grand_total].to_f %>
|
||||
<% old_grand_total += sale[:old_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]-sale[:total_change_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[:old_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[:old_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), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar), :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",old_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 class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="page-header col-md-12 col-lg-12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Daily Sale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="row">
|
||||
<div class="col-md-12 col-lg-12"> -->
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
|
||||
<hr />
|
||||
<!-- </div> -->
|
||||
<!-- </div>
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="row"> -->
|
||||
<!-- <div class="container"> -->
|
||||
<div class=" text-right">
|
||||
<a href="javascript:export_to('<%=reports_dailysale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="card ">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="15"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:center;'>Sr</th>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Void Amount</th>
|
||||
<th style='text-align:center;'>Mpu Sales</th>
|
||||
<th style='text-align:center;'>Master Sales</th>
|
||||
<th style='text-align:center;'>Visa Sales</th>
|
||||
<th style='text-align:center;'>Jcb Sales</th>
|
||||
<th style='text-align:center;'>Redeem Sales</th>
|
||||
<th style='text-align:center;'>Cash Sales</th>
|
||||
<th style='text-align:center;'>Credit Sales</th>
|
||||
<th style='text-align:center;'>FOC Sales</th>
|
||||
<th style='text-align:center;'>(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 %>
|
||||
<% old_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]-sale[:total_change_amount] %>
|
||||
<% credit += sale[:credit_amount] %>
|
||||
<% foc += sale[:foc_amount] %>
|
||||
<% discount += sale[:total_discount] %>
|
||||
<% total += sale[:old_grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||
<% grand_total += sale[:grand_total].to_f %>
|
||||
<% old_grand_total += sale[:old_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]-sale[:total_change_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[:old_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[:old_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), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar), :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",old_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>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,130 +1,125 @@
|
||||
<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="">Select Period</option>
|
||||
<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>
|
||||
<% if defined? payments %>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Select Payments</label>
|
||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <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-2">
|
||||
<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">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<%= 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="">Select Period</option>
|
||||
<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>
|
||||
<% if defined? payments %>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Select Payments</label>
|
||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <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-2">
|
||||
<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">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% 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();
|
||||
$(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');
|
||||
}
|
||||
});
|
||||
|
||||
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');
|
||||
}
|
||||
});
|
||||
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||
// shift = $(".shift-id").text()
|
||||
// if (shift.length>0) {
|
||||
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
||||
// }
|
||||
|
||||
<% 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");
|
||||
<% 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');
|
||||
$('#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();
|
||||
}
|
||||
}
|
||||
});
|
||||
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>
|
||||
|
||||
@@ -1,121 +1,125 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Receipt List Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Receipt List Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %>
|
||||
<hr />
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th>Recipt No</th>
|
||||
<th>Cashier Name</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Discount Amount </th>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<th><%= tax.tax_name %></th>
|
||||
<% end %>
|
||||
<!-- <th>Other Amount</th> -->
|
||||
<th>Grand Total</th>
|
||||
<th>Rounding Adj.</th>
|
||||
<th>Grand Total +<br/>
|
||||
Rounding Adj.
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
<% discount_amt = 0 %>
|
||||
<% other_amt = 0 %>
|
||||
<% total_nett = 0 %>
|
||||
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
||||
<%if @sale_data %>
|
||||
<% @sale_data.each do |result| %>
|
||||
<tr>
|
||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<tr>
|
||||
<th>Recipt No</th>
|
||||
<th>Cashier Name</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Discount Amount </th>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<th><%= tax.tax_name %></th>
|
||||
<% end %>
|
||||
<!-- <th>Other Amount</th> -->
|
||||
<th>Grand Total</th>
|
||||
<th>Rounding Adj.</th>
|
||||
<th>Grand Total +<br/>
|
||||
Rounding Adj.
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
<% discount_amt = 0 %>
|
||||
<% other_amt = 0 %>
|
||||
<% total_nett = 0 %>
|
||||
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
||||
<%if @sale_data %>
|
||||
<% @sale_data.each do |result| %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
||||
<%end%>
|
||||
|
||||
<td><%= result.old_grand_total %></td>
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
<td><b><%= total_sum rescue '-'%></b></td>
|
||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<td><%= result.old_grand_total %></td>
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
<td><b><%= total_sum rescue '-'%></b></td>
|
||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<td><b><%= tax.st_amount.round(2) %></b></td>
|
||||
<% end %>
|
||||
<td><b><%= old_grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
<td>Total Amount</td>
|
||||
<td>Discount Amount</td>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<% end %>
|
||||
<td><b><%= old_grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
<td>Total Amount</td>
|
||||
<td>Discount Amount</td>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<td><%= tax.tax_name %></td>
|
||||
<% end %>
|
||||
<td>Grand Total</td>
|
||||
<td>Rounding Adj.</td>
|
||||
<td>Grand Total +<br/>
|
||||
Rounding Adj.
|
||||
</td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<td>Grand Total</td>
|
||||
<td>Rounding Adj.</td>
|
||||
<td>Grand Total +<br/>
|
||||
Rounding Adj.
|
||||
</td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<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">
|
||||
@@ -52,8 +51,7 @@
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('#custom_excel').hide();
|
||||
|
||||
@@ -1,175 +1,179 @@
|
||||
<div class="page-header">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Sale Item Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Sale Item Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_saleitem_index_path} %>
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_saleitem_index_path} %>
|
||||
|
||||
<hr />
|
||||
</div>
|
||||
<hr />
|
||||
<!-- /div> -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
|
||||
|
||||
<table class="table table-striped" id="items_table" border="0">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Menu Category</th>
|
||||
<th>Code</th>
|
||||
<th>Product</th>
|
||||
<th>Total Item</th>
|
||||
<th>Unit Price</th>
|
||||
<th>Revenue</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% unless @sale_data.blank? %>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
|
||||
<% sub_total = 0.0 %>
|
||||
<% count = 0%>
|
||||
<% total_price = 0.0 %>
|
||||
<% cate_count = 0 %>
|
||||
<% acc_count = 0%>
|
||||
<% grand_total = 0%>
|
||||
<% total_qty = 0%>
|
||||
<% total_amount = 0 %>
|
||||
<% discount = 0%>
|
||||
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% total_qty += sale.total_item %>
|
||||
|
||||
<% if !acc_arr.include?(sale.account_id) %>
|
||||
<tr>
|
||||
<td><b><%= sale.account_name %></b></td>
|
||||
<td colspan="4"> </td>
|
||||
<td>Total Price By <%= sale.account_name %></td>
|
||||
<td>
|
||||
<% @totalByAccount.each do |account, total| %>
|
||||
<% if sale.account_id == account %>
|
||||
<b><%= total %></b>
|
||||
<% grand_total += total %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% acc_arr.push(sale.account_id) %>
|
||||
|
||||
<% end %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<td><%= sale.menu_category_name %></td>
|
||||
<% cate_arr.push(sale.menu_category_id) %>
|
||||
<% else %>
|
||||
<td> </td>
|
||||
<% end %>
|
||||
<td><%= sale.item_code rescue '-' %></td>
|
||||
<td><%= sale.product_name rescue '-' %></td>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<td><%= sale.unit_price rescue '-' %></td>
|
||||
<td><%= sale.grand_total rescue '-' %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<!-- sub total -->
|
||||
<% @menu_cate_count.each do |key,value| %>
|
||||
<% if sale.menu_category_id == key %>
|
||||
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% if count == value %>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Sub Total</td>
|
||||
<td ><span class="underline"><%= sub_total %></span></td>
|
||||
|
||||
</tr>
|
||||
<% sub_total = 0.0%>
|
||||
<% count = 0%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- end sub total -->
|
||||
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top:2px solid grey;">
|
||||
<td colspan="3"> </td>
|
||||
<td>Total Item</td>
|
||||
<td><span><%= total_qty%></span></td>
|
||||
<td>Total Amount</td>
|
||||
<td><span><%= grand_total%></span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Cash Received</td>
|
||||
<td><span><%= @cash_data - @change_amount %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Card Sales</td>
|
||||
<td><span><%= @card_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Credit Sales</td>
|
||||
<td><span><%= @credit_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>FOC Sales</td>
|
||||
<td><span><%= @foc_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Discount Amount</td>
|
||||
<td><span><%= @discount_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Grand Total</td>
|
||||
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
|
||||
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
|
||||
|
||||
<table class="table table-striped" id="items_table" border="0">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Menu Category</th>
|
||||
<th>Code</th>
|
||||
<th>Product</th>
|
||||
<th>Total Item</th>
|
||||
<th>Unit Price</th>
|
||||
<th>Revenue</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% unless @sale_data.blank? %>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
|
||||
<% sub_total = 0.0 %>
|
||||
<% count = 0%>
|
||||
<% total_price = 0.0 %>
|
||||
<% cate_count = 0 %>
|
||||
<% acc_count = 0%>
|
||||
<% grand_total = 0%>
|
||||
<% total_qty = 0%>
|
||||
<% total_amount = 0 %>
|
||||
<% discount = 0%>
|
||||
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% total_qty += sale.total_item %>
|
||||
|
||||
<% if !acc_arr.include?(sale.account_id) %>
|
||||
<tr>
|
||||
<td><b><%= sale.account_name %></b></td>
|
||||
<td colspan="4"> </td>
|
||||
<td>Total Price By <%= sale.account_name %></td>
|
||||
<td>
|
||||
<% @totalByAccount.each do |account, total| %>
|
||||
<% if sale.account_id == account %>
|
||||
<b><%= total %></b>
|
||||
<% grand_total += total %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% acc_arr.push(sale.account_id) %>
|
||||
|
||||
<% end %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<td><%= sale.menu_category_name %></td>
|
||||
<% cate_arr.push(sale.menu_category_id) %>
|
||||
<% else %>
|
||||
<td> </td>
|
||||
<% end %>
|
||||
<td><%= sale.item_code rescue '-' %></td>
|
||||
<td><%= sale.product_name rescue '-' %></td>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<td><%= sale.unit_price rescue '-' %></td>
|
||||
<td><%= sale.grand_total rescue '-' %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<!-- sub total -->
|
||||
<% @menu_cate_count.each do |key,value| %>
|
||||
<% if sale.menu_category_id == key %>
|
||||
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% if count == value %>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Sub Total</td>
|
||||
<td ><span class="underline"><%= sub_total %></span></td>
|
||||
|
||||
</tr>
|
||||
<% sub_total = 0.0%>
|
||||
<% count = 0%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- end sub total -->
|
||||
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top:2px solid grey;">
|
||||
<td colspan="3"> </td>
|
||||
<td>Total Item</td>
|
||||
<td><span><%= total_qty%></span></td>
|
||||
<td>Total Amount</td>
|
||||
<td><span><%= grand_total%></span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Cash Received</td>
|
||||
<td><span><%= @cash_data - @change_amount %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Card Sales</td>
|
||||
<td><span><%= @card_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Credit Sales</td>
|
||||
<td><span><%= @credit_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>FOC Sales</td>
|
||||
<td><span><%= @foc_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Discount Amount</td>
|
||||
<td><span><%= @discount_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Grand Total</td>
|
||||
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
|
||||
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
@@ -273,5 +277,5 @@
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -1,87 +1,85 @@
|
||||
<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>
|
||||
|
||||
<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">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= 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>
|
||||
|
||||
<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">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% 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();
|
||||
$(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');
|
||||
}
|
||||
});
|
||||
|
||||
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
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") %>'
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") %>'
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
<% end %>
|
||||
$("#from").val("<%=params[:from]%>");
|
||||
$("#to").val("<%=params[:to]%>");
|
||||
@@ -89,9 +87,9 @@ $("#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");
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
<% else %>
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
<% end %>
|
||||
$(".btn-group button").removeClass("active");
|
||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||
|
||||
@@ -1,119 +1,121 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Shift Sale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Shift Sale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_shiftsale_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_shiftsale_index_path} %>
|
||||
<hr />
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_shiftsale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_shiftsale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="margin-top-20">
|
||||
<!-- <div class="span11">
|
||||
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
||||
</div> -->
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
|
||||
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
|
||||
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th>Cashier Station</th>
|
||||
<th>Cashier Name</th>
|
||||
<th>Shift Name</th>
|
||||
<!-- <th>Void Amount</th> -->
|
||||
<th>Cash Payment</th>
|
||||
<!-- <th>Credit Charges</th> -->
|
||||
<th>Credit Payment</th>
|
||||
<!-- <th>FOC Payment</th> -->
|
||||
<th>Other Payment</th>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th>Cashier Station</th>
|
||||
<th>Cashier Name</th>
|
||||
<th>Shift Name</th>
|
||||
<!-- <th>Void Amount</th> -->
|
||||
<th>Cash Payment</th>
|
||||
<!-- <th>Credit Charges</th> -->
|
||||
<th>Credit Payment</th>
|
||||
<!-- <th>FOC Payment</th> -->
|
||||
<th>Other Payment</th>
|
||||
<!-- <th>Grand Total
|
||||
<br/>Rounding Adj</th> -->
|
||||
<br/>Rounding Adj</th> -->
|
||||
<!-- <th>Rounding Adj</th> -->
|
||||
<th>Grand Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% void = 0%>
|
||||
<% cash = 0%>
|
||||
<% credit = 0%>
|
||||
<% accept_credit = 0%>
|
||||
<% foc = 0%>
|
||||
<% card = 0%>
|
||||
<% total = 0%>
|
||||
<% rounding_adj = 0%>
|
||||
<% g_total = 0 %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% void = 0%>
|
||||
<% cash = 0%>
|
||||
<% credit = 0%>
|
||||
<% accept_credit = 0%>
|
||||
<% foc = 0%>
|
||||
<% card = 0%>
|
||||
<% total = 0%>
|
||||
<% rounding_adj = 0%>
|
||||
<% g_total = 0 %>
|
||||
|
||||
<% @sale_data.each do |result|%>
|
||||
<tr>
|
||||
<td>
|
||||
<%= result.cashier_terminal.name rescue '-'%>
|
||||
</td>
|
||||
<td>
|
||||
<%= result.employee.name rescue '-'%>
|
||||
</td>
|
||||
<td><%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
|
||||
<%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
|
||||
</td>
|
||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||
<td><%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%></td>
|
||||
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<% @sale_data.each do |result|%>
|
||||
<tr>
|
||||
<td>
|
||||
<%= result.cashier_terminal.name rescue '-'%>
|
||||
</td>
|
||||
<td>
|
||||
<%= result.employee.name rescue '-'%>
|
||||
</td>
|
||||
<td><%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
|
||||
<%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
|
||||
</td>
|
||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||
<td><%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%></td>
|
||||
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<td><%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%></td>
|
||||
|
||||
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
||||
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
||||
<% grand_total = result.grand_total.to_f %>
|
||||
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
||||
</tr>
|
||||
<% cash += result.cash_sales.to_f %>
|
||||
<% credit += result.credit_sales.to_f %>
|
||||
<% card += result.other_sales.to_f %>
|
||||
|
||||
<% total += result.grand_total.to_f %>
|
||||
<% g_total += grand_total.to_f %>
|
||||
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
||||
</tr>
|
||||
<% cash += result.cash_sales.to_f %>
|
||||
<% credit += result.credit_sales.to_f %>
|
||||
<% card += result.other_sales.to_f %>
|
||||
|
||||
<% end %>
|
||||
<% total += result.grand_total.to_f %>
|
||||
<% g_total += grand_total.to_f %>
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
||||
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
||||
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<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">
|
||||
@@ -38,8 +37,7 @@
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
@@ -1,87 +1,89 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Stock Check Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Stock Check Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial => 'stock_check_report_filter',
|
||||
:locals => {:period_type => true, :shift_name => true, :report_path => reports_stock_check_index_path} %>
|
||||
<hr/>
|
||||
</div>
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial => 'stock_check_report_filter',
|
||||
:locals => {:period_type => true, :shift_name => true, :report_path => reports_stock_check_index_path} %>
|
||||
<hr/>
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%= reports_stock_check_index_path %>.xls')" class="btn btn-default">Export to
|
||||
Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="8"><i> From Date </i>: <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <i>To Date</i> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Stock Check Reason</th>
|
||||
<th>Checked By</th>
|
||||
<th>Item Name</th>
|
||||
<th>Stock Count</th>
|
||||
<th>Stock Balance</th>
|
||||
<th>Different</th>
|
||||
<th>Remark</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% total_stock_count = 0 %>
|
||||
<% total_stock_balance = 0 %>
|
||||
<% total_different = 0 %>
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="8"><i> From Date </i>: <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <i>To Date</i> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Stock Check Reason</th>
|
||||
<th>Checked By</th>
|
||||
<th>Item Name</th>
|
||||
<th>Stock Count</th>
|
||||
<th>Stock Balance</th>
|
||||
<th>Different</th>
|
||||
<th>Remark</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% total_stock_count = 0 %>
|
||||
<% total_stock_balance = 0 %>
|
||||
<% total_different = 0 %>
|
||||
|
||||
<% @transaction.each do |result| %>
|
||||
<tr>
|
||||
<td><%= result.stock_check.reason rescue '-' %></td>
|
||||
<td><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
|
||||
<td>
|
||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
|
||||
<% if menu_item.nil? %>
|
||||
<% @transaction.each do |result| %>
|
||||
<tr>
|
||||
<td><%= result.stock_check.reason rescue '-' %></td>
|
||||
<td><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
|
||||
<td>
|
||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
|
||||
<% if menu_item.nil? %>
|
||||
<%= Product.find_by_item_code(result.item_code).name rescue "-" %>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<%= menu_item.menu_item.name rescue "-" %>
|
||||
- <%= menu_item.item_instance_name rescue "-" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= result.stock_count rescue '-' %></td>
|
||||
<td><%= result.stock_balance rescue '-' %></td>
|
||||
<td><%= result.different rescue '-' %></td>
|
||||
<td><%= result.remark rescue '-' %></td>
|
||||
<td><%= result.created_at.strftime('%e %b %Y %I:%M %p') rescue '-' %></td>
|
||||
</tr>
|
||||
<% !result.stock_count.nil? ? total_stock_count += result.stock_count : total_stock_count += 0 %>
|
||||
<% !result.stock_balance.nil? ? total_stock_balance += result.stock_balance : total_stock_balance += 0 %>
|
||||
<% !result.different.nil? ? total_different += result.different : total_different += 0 %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= result.stock_count rescue '-' %></td>
|
||||
<td><%= result.stock_balance rescue '-' %></td>
|
||||
<td><%= result.different rescue '-' %></td>
|
||||
<td><%= result.remark rescue '-' %></td>
|
||||
<td><%= result.created_at.strftime('%e %b %Y %I:%M %p') rescue '-' %></td>
|
||||
</tr>
|
||||
<% !result.stock_count.nil? ? total_stock_count += result.stock_count : total_stock_count += 0 %>
|
||||
<% !result.stock_balance.nil? ? total_stock_balance += result.stock_balance : total_stock_balance += 0 %>
|
||||
<% !result.different.nil? ? total_different += result.different : total_different += 0 %>
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<td><b><%= total_stock_count rescue '-' %></b></td>
|
||||
<td><b><%= total_stock_balance rescue '-' %></b></td>
|
||||
<td><b><%= total_different rescue '-' %></b></td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<td><b><%= total_stock_count rescue '-' %></b></td>
|
||||
<td><b><%= total_stock_balance rescue '-' %></b></td>
|
||||
<td><b><%= total_different rescue '-' %></b></td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
@@ -1,125 +1,120 @@
|
||||
<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="">Select Period</option>
|
||||
<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>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <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-2">
|
||||
<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-3">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= 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="">Select Period</option>
|
||||
<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>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <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-2">
|
||||
<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-3">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% 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();
|
||||
$(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');
|
||||
}
|
||||
});
|
||||
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
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');
|
||||
}
|
||||
});
|
||||
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||
// shift = $(".shift-id").text()
|
||||
// if (shift.length>0) {
|
||||
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
||||
// }
|
||||
|
||||
<% 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");
|
||||
<% 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');
|
||||
$('#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();
|
||||
}
|
||||
}
|
||||
});
|
||||
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>
|
||||
|
||||
@@ -1,99 +1,97 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Void Sale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Void Sale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_void_sale_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_void_sale_index_path} %>
|
||||
<hr />
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_void_sale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<% if @sale_data.count > 0 %>
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
<% if !params[:from].blank?%>
|
||||
<tr>
|
||||
<th colspan="7">From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift %>
|
||||
<% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="3">Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th>Receipt No</th>
|
||||
<th>Sale Date</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Grand Total</th>
|
||||
<th>Rounding Adj.</th>
|
||||
<th>Grand Total + <br/>Rounding Adj.</th>
|
||||
<!-- <th>Sale Status</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% total_amount = 0.0 %>
|
||||
<% grand_total = 0.0 %>
|
||||
<% rounding_adjustment = 0.0 %>
|
||||
<% grand_rounding_adjustment = 0.0 %>
|
||||
<% @sale_data.each do |result| %>
|
||||
<% result[:items].each do |item| %>
|
||||
<tr>
|
||||
<td><%= item.receipt_no rescue '-' %> </td>
|
||||
<td><%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></td>
|
||||
<td><%= item.total_amount.to_f rescue '-'%> </td>
|
||||
<td><%= item.grand_total.to_f rescue '-'%> </td>
|
||||
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
|
||||
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
||||
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
||||
</tr>
|
||||
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
|
||||
<% grand_total = grand_total.to_f + item.grand_total.to_f %>
|
||||
<% rounding_adjustment = rounding_adjustment.to_f + item.rounding_adjustment.to_f %>
|
||||
<% grand_rounding_adjustment = grand_rounding_adjustment.to_f + item.grand_total.to_f + item.rounding_adjustment.to_f %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;font-weight:600;">
|
||||
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
||||
<td><%= total_amount rescue '-' %></td>
|
||||
<td><%= grand_total rescue '-' %></td>
|
||||
<td><%= rounding_adjustment rescue '-'%></td>
|
||||
<td colspan="3"><%= grand_rounding_adjustment rescue '-'%></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<% if @sale_data.count > 0 %>
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
<% if !params[:from].blank?%>
|
||||
<tr>
|
||||
<th colspan="7">From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift %>
|
||||
<% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="3">Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th>Receipt No</th>
|
||||
<th>Sale Date</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Grand Total</th>
|
||||
<th>Rounding Adj.</th>
|
||||
<th>Grand Total + <br/>Rounding Adj.</th>
|
||||
<!-- <th>Sale Status</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% total_amount = 0.0 %>
|
||||
<% grand_total = 0.0 %>
|
||||
<% rounding_adjustment = 0.0 %>
|
||||
<% grand_rounding_adjustment = 0.0 %>
|
||||
<% @sale_data.each do |result| %>
|
||||
<% result[:items].each do |item| %>
|
||||
<tr>
|
||||
<td><%= item.receipt_no rescue '-' %> </td>
|
||||
<td><%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></td>
|
||||
<td><%= item.total_amount.to_f rescue '-'%> </td>
|
||||
<td><%= item.grand_total.to_f rescue '-'%> </td>
|
||||
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
|
||||
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
||||
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
||||
</tr>
|
||||
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
|
||||
<% grand_total = grand_total.to_f + item.grand_total.to_f %>
|
||||
<% rounding_adjustment = rounding_adjustment.to_f + item.rounding_adjustment.to_f %>
|
||||
<% grand_rounding_adjustment = grand_rounding_adjustment.to_f + item.grand_total.to_f + item.rounding_adjustment.to_f %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;font-weight:600;">
|
||||
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
||||
<td><%= total_amount rescue '-' %></td>
|
||||
<td><%= grand_total rescue '-' %></td>
|
||||
<td><%= rounding_adjustment rescue '-'%></td>
|
||||
<td colspan="3"><%= grand_rounding_adjustment rescue '-'%></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
$(function(){
|
||||
var check_arr = [];
|
||||
|
||||
$('#sel_period').change(function(){
|
||||
|
||||
search_by_period();
|
||||
|
||||
});
|
||||
|
||||
|
||||
function search_by_period(){
|
||||
var period = $('#sel_period').val();
|
||||
var period_type = 0;
|
||||
@@ -102,15 +100,15 @@
|
||||
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
|
||||
|
||||
$('#from').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
|
||||
$('#to').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
|
||||
function search_by_date(){
|
||||
var from = $('#from').val();
|
||||
var to = $('#to').val();
|
||||
@@ -121,7 +119,7 @@
|
||||
shift_name = from + ',' + to;
|
||||
|
||||
check_arr.push(to);
|
||||
|
||||
|
||||
console.log(check_arr.length)
|
||||
if(check_arr.length == 1){
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
@@ -130,25 +128,25 @@
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
|
||||
shift.empty();
|
||||
|
||||
|
||||
var str = '';
|
||||
var param_shift = '';
|
||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||
|
||||
url = '<%= reports_get_shift_by_date_path %>';
|
||||
|
||||
|
||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||
|
||||
str = '<option value="0">--- All Shift ---</option>';
|
||||
$(data.message).each(function(index){
|
||||
|
||||
|
||||
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
|
||||
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
||||
var shift_id = data.message[index].shift_id ;
|
||||
@@ -163,7 +161,7 @@
|
||||
selected = '';
|
||||
}
|
||||
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
|
||||
|
||||
|
||||
// console.log(sh_date)
|
||||
})
|
||||
shift.append(str);
|
||||
|
||||
@@ -13,6 +13,8 @@ module SXRestaurants
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
config.i18n.default_locale = :'en'
|
||||
|
||||
config.active_record.time_zone_aware_types = [:datetime, :time]
|
||||
config.active_job.queue_adapter = :sidekiq
|
||||
config.time_zone = 'Asia/Rangoon'
|
||||
|
||||
@@ -42,6 +42,10 @@ Rails.application.config.assets.precompile += %w( fileinput.min.js )
|
||||
Rails.application.config.assets.precompile += %w( addorder.css )
|
||||
Rails.application.config.assets.precompile += %w( addorder.js )
|
||||
|
||||
# --- Custom SX Themem ----
|
||||
Rails.application.config.assets.precompile += %w( sx-sidebar.css )
|
||||
Rails.application.config.assets.precompile += %w( popper.min.js )
|
||||
|
||||
# --- Inventory Definition ----
|
||||
Rails.application.config.assets.precompile += %w( inventory_definitions.css )
|
||||
|
||||
|
||||
45
config/initializers/mysql2_adapter.rb
Executable file
45
config/initializers/mysql2_adapter.rb
Executable file
@@ -0,0 +1,45 @@
|
||||
module ActiveRecord
|
||||
class Base
|
||||
# Overriding ActiveRecord::Base.mysql2_connection
|
||||
# method to allow passing options from database.yml
|
||||
#
|
||||
# Example of database.yml
|
||||
#
|
||||
# login: &login
|
||||
# socket: /tmp/mysql.sock
|
||||
# adapter: mysql2
|
||||
# host: localhost
|
||||
# encoding: utf8
|
||||
# flags: 131072
|
||||
#
|
||||
# @param [Hash] config hash that you define in your
|
||||
# database.yml
|
||||
# @return [Mysql2Adapter] new MySQL adapter object
|
||||
#
|
||||
def self.mysql2_connection(config)
|
||||
config[:username] = 'root' if config[:username].nil?
|
||||
|
||||
if Mysql2::Client.const_defined? :FOUND_ROWS
|
||||
config[:flags] = config[:flags] ? config[:flags] | Mysql2::Client::FOUND_ROWS : Mysql2::Client::FOUND_ROWS
|
||||
end
|
||||
|
||||
client = Mysql2::Client.new(config.symbolize_keys)
|
||||
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
|
||||
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
|
||||
end
|
||||
end
|
||||
|
||||
# This method is for running stored procedures.
|
||||
#
|
||||
# @return [Hash]
|
||||
#
|
||||
def self.select_sp(sql, name = nil)
|
||||
connection = ActiveRecord::Base.connection
|
||||
begin
|
||||
connection.select_all(sql, name)
|
||||
rescue NoMethodError
|
||||
ensure
|
||||
connection.reconnect! unless connection.active?
|
||||
end
|
||||
end
|
||||
end
|
||||
6
config/initializers/secrets.rb
Executable file
6
config/initializers/secrets.rb
Executable file
@@ -0,0 +1,6 @@
|
||||
# config = YAML.load_file(Rails.root.join("config/smartsales.yml"))
|
||||
# config.fetch(Rails.env, {}).each do |key, value|
|
||||
# ENV[key.upcase] = value.to_s
|
||||
# end
|
||||
|
||||
SECRETS_CONFIG = YAML.load_file("#{Rails.root}/config/secrets.yml")[Rails.env]
|
||||
4
config/initializers/sx.rb
Normal file
4
config/initializers/sx.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
config = YAML.load_file(Rails.root.join("config/sx.yml"))
|
||||
config.fetch(Rails.env, {}).each do |key, value|
|
||||
ENV[key.upcase] = value.to_s
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
en:
|
||||
welcome: "Welcome"
|
||||
views:
|
||||
pagination:
|
||||
first: "« First"
|
||||
|
||||
18
config/locales/mm.yml
Normal file
18
config/locales/mm.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
mm:
|
||||
welcome: "လာပါ"
|
||||
views:
|
||||
pagination:
|
||||
first: "« ပထမ"
|
||||
last: "အဆံုး »"
|
||||
previous: "‹ ေနာက္သို့"
|
||||
next: "ေရ့သို့ ›"
|
||||
truncate: "…"
|
||||
helpers:
|
||||
page_entries_info:
|
||||
one_page:
|
||||
display_entries:
|
||||
zero: "No %{entry_name} found"
|
||||
one: "Displaying <b>1</b> %{entry_name}"
|
||||
other: "Displaying <b>all %{count}</b> %{entry_name}"
|
||||
more_pages:
|
||||
display_entries: "Displaying %{entry_name} <b>%{first} - %{last}</b> of <b>%{total}</b> in total"
|
||||
@@ -2,7 +2,7 @@ require 'sidekiq/web'
|
||||
|
||||
Rails.application.routes.draw do
|
||||
|
||||
|
||||
scope "(:locale)", locale: /en|mm/ do
|
||||
root 'home#index'
|
||||
mount Sidekiq::Web => '/kiq'
|
||||
|
||||
@@ -181,6 +181,7 @@ Rails.application.routes.draw do
|
||||
get '/:addorders/:id' => "addorders#detail"
|
||||
post '/:addorders/create' => "addorders#create", :defaults => { :format => 'json' }
|
||||
get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' }
|
||||
get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' }
|
||||
|
||||
resources :commissions
|
||||
resources :commissioners
|
||||
@@ -375,3 +376,4 @@ Rails.application.routes.draw do
|
||||
resources :commissioners
|
||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||
end
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user