diff --git a/Gemfile b/Gemfile index 93b245eb..b579dfdc 100644 --- a/Gemfile +++ b/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 diff --git a/Gemfile.lock b/Gemfile.lock index b2a6e59c..85bd8aa5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/README.md b/README.md index ee9eb1e6..9b67b65f 100644 --- a/README.md +++ b/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 + diff --git a/app/assets/javascripts/BSBMaterial/pages/index.js b/app/assets/javascripts/BSBMaterial/pages/index.js index 3d3749dc..5c544923 100644 --- a/app/assets/javascripts/BSBMaterial/pages/index.js +++ b/app/assets/javascripts/BSBMaterial/pages/index.js @@ -9,9 +9,9 @@ } }); - initRealTimeChart(); - initDonutChart(); - initSparkline(); + // initRealTimeChart(); + // initDonutChart(); + // initSparkline(); }); var realtime = 'on'; diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index 64ebc678..c48807b3 100644 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -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 ='
' + row ='
' +'
' +'

' +''+data[field]["table_type"]+'- ' diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 01d42309..28bbb7c6 100644 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -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 = '
' + +'
' + +''+ product[field].name +'' + +"
" + +"' + +'' + +'
' + +'
' + + +"'; + $('.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 = '
' - +'
' - +''+ menu_items[field].name +'' - +"
" - +"' - +'
' - +'
' + row = '
' + +'
' + +''+ menu_items[field].name +'' + +"
" + +"' + +'' + +'
' + +'
' - +"
" + +"
" - +"
" - +"" + +"
" + +"" + +"
" - +"
" - - +'' - +'
'; + +'' + +'
'; $('.menu_items_list').append(row); } } diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 7feea0c4..6cbe41b0 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -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: " ", + removeClass: "btn btn-danger", + removeLabel: "Delete", + removeIcon: " ", + showUpload: false, + // uploadClass: "btn btn-info", + // uploadLabel: "Upload", + // uploadIcon: " ", + previewTemplates: { + image: '
\n' + + ' {caption}\n' + + '
\n', + } + }); + + $("#product_image_path").fileinput({ + previewFileType: "image", + allowedFileExtensions: ["jpg", "gif", "png"], + browseClass: "btn btn-success", + browseLabel: "Pick Image", + browseIcon: " ", + removeClass: "btn btn-danger", + removeLabel: "Delete", + removeIcon: " ", + showUpload: false, + // uploadClass: "btn btn-info", + // uploadLabel: "Upload", + // uploadIcon: " ", + previewTemplates: { + image: '
\n' + + ' {caption}\n' + + '
\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; } + + diff --git a/app/assets/javascripts/channels/order_queue_station.js b/app/assets/javascripts/channels/order_queue_station.js index 1b9351cf..4fb7d214 100644 --- a/app/assets/javascripts/channels/order_queue_station.js +++ b/app/assets/javascripts/channels/order_queue_station.js @@ -34,7 +34,7 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann if (oqs_id == items[field]["order_queue_station_id"]) { - row ='
' + row ='
' +'' +'
' +'

' diff --git a/app/assets/javascripts/popper.min.js b/app/assets/javascripts/popper.min.js new file mode 100644 index 00000000..95e9ef5a --- /dev/null +++ b/app/assets/javascripts/popper.min.js @@ -0,0 +1,5 @@ +/* + Copyright (C) Federico Zivolo 2017 + Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT). + */(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=window.getComputedStyle(e,null);return t?o[t]:o}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e||-1!==['HTML','BODY','#document'].indexOf(e.nodeName))return window.document.body;var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll)/.test(r+s+p)?e:n(o(e))}function r(e){var o=e&&e.offsetParent,i=o&&o.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(o.nodeName)&&'static'===t(o,'position')?r(o):o:window.document.documentElement}function p(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||r(e.firstElementChild)===e)}function s(e){return null===e.parentNode?e:s(e.parentNode)}function d(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return window.document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=o?e:t,n=o?t:e,a=document.createRange();a.setStart(i,0),a.setEnd(n,0);var f=a.commonAncestorContainer;if(e!==f&&t!==f||i.contains(n))return p(f)?f:r(f);var l=s(e);return l.host?d(l.host,t):d(e,s(t).host)}function a(e){var t=1=o.clientWidth&&i>=o.clientHeight}),f=0i[e]&&!t.escapeWithReference&&(n=z(p[o],i[e]-('right'===e?p.width:p.height))),pe({},o,n)}};return n.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';p=se({},p,s[t](e))}),e.offsets.popper=p,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,i=t.reference,n=e.placement.split('-')[0],r=V,p=-1!==['top','bottom'].indexOf(n),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]r(i[s])&&(e.offsets.popper[d]=r(i[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){if(!F(e.instance.modifiers,'arrow','keepTogether'))return e;var o=t.element;if('string'==typeof o){if(o=e.instance.popper.querySelector(o),!o)return e;}else if(!e.instance.popper.contains(o))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var i=e.placement.split('-')[0],n=e.offsets,r=n.popper,p=n.reference,s=-1!==['left','right'].indexOf(i),d=s?'height':'width',a=s?'top':'left',f=s?'left':'top',l=s?'bottom':'right',m=O(o)[d];p[l]-mr[l]&&(e.offsets.popper[a]+=p[a]+m-r[l]);var h=p[a]+p[d]/2-m/2,g=h-c(e.offsets.popper)[a];return g=_(z(r[d]-m,g),0),e.arrowElement=o,e.offsets.arrow={},e.offsets.arrow[a]=Math.round(g),e.offsets.arrow[f]='',e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(W(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=w(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement),i=e.placement.split('-')[0],n=L(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case fe.FLIP:p=[i,n];break;case fe.CLOCKWISE:p=K(i);break;case fe.COUNTERCLOCKWISE:p=K(i,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(i!==s||p.length===d+1)return e;i=e.placement.split('-')[0],n=L(i);var a=e.offsets.popper,f=e.offsets.reference,l=V,m='left'===i&&l(a.right)>l(f.left)||'right'===i&&l(a.left)l(f.top)||'bottom'===i&&l(a.top)l(o.right),g=l(a.top)l(o.bottom),b='left'===i&&h||'right'===i&&c||'top'===i&&g||'bottom'===i&&u,y=-1!==['top','bottom'].indexOf(i),w=!!t.flipVariations&&(y&&'start'===r&&h||y&&'end'===r&&c||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),w&&(r=j(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=se({},e.offsets.popper,S(e.instance.popper,e.offsets.reference,e.placement)),e=N(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],i=e.offsets,n=i.popper,r=i.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return n[p?'left':'top']=r[t]-(s?n[p?'width':'height']:0),e.placement=L(t),e.offsets.popper=c(n),e}},hide:{order:800,enabled:!0,fn:function(e){if(!F(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=T(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottomo.right||t.top>o.bottom||t.right 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 + + + diff --git a/app/controllers/crm/bookings_controller.rb b/app/controllers/crm/bookings_controller.rb index efaa5419..d712f66f 100644 --- a/app/controllers/crm/bookings_controller.rb +++ b/app/controllers/crm/bookings_controller.rb @@ -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]) diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 8a6bb0f3..02ce9148 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -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] diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 9029bc6c..91e833bd 100644 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -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] diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index 012f2bc6..92b31261 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,4 +1,4 @@ -class Crm::HomeController < BaseCrmController +class Crm::HomeController < ApplicationController def index @booking = Booking.all diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 6c9d6ed2..73495c70 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -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 diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 3c087aa9..85733e8b 100644 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -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) diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 7f68eba3..35567356 100644 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -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] diff --git a/app/controllers/origami/card_payments_controller.rb b/app/controllers/origami/card_payments_controller.rb index e72c5139..8ea44d3f 100644 --- a/app/controllers/origami/card_payments_controller.rb +++ b/app/controllers/origami/card_payments_controller.rb @@ -1,6 +1,4 @@ -class Origami::CardPaymentsController < ApplicationController#BaseOrigamiController - - +class Origami::CardPaymentsController < ApplicationController #BaseOrigamiController def index @membership_rebate_balance = 0 @membership_id = 0 diff --git a/app/controllers/origami/cash_ins_controller.rb b/app/controllers/origami/cash_ins_controller.rb index 0155c223..4ea4f6de 100644 --- a/app/controllers/origami/cash_ins_controller.rb +++ b/app/controllers/origami/cash_ins_controller.rb @@ -1,5 +1,4 @@ -class Origami::CashInsController < ApplicationController#BaseOrigamiController - +class Origami::CashInsController < ApplicationController #BaseOrigamiController def new end diff --git a/app/controllers/origami/cash_outs_controller.rb b/app/controllers/origami/cash_outs_controller.rb index 26f2edb1..7f88f7e8 100644 --- a/app/controllers/origami/cash_outs_controller.rb +++ b/app/controllers/origami/cash_outs_controller.rb @@ -1,5 +1,4 @@ class Origami::CashOutsController < ApplicationController#BaseOrigamiController - def new end diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb index bf59f5da..43fe97f9 100644 --- a/app/controllers/origami/credit_payments_controller.rb +++ b/app/controllers/origami/credit_payments_controller.rb @@ -1,6 +1,4 @@ -class Origami::CreditPaymentsController < ApplicationController#BaseOrigamiController - - +class Origami::CreditPaymentsController < ApplicationController #BaseOrigamiController def index @sale_id = params[:sale_id] diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 6d404b96..4bd69c76 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -1,4 +1,4 @@ -class Origami::CustomersController < ApplicationController#BaseOrigamiController +class Origami::CustomersController < ApplicationController #BaseOrigamiController load_and_authorize_resource def index end diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index bf0d7c5a..db9eb9a6 100644 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -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 diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index b7c25773..c2356cae 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -1,4 +1,4 @@ -class Origami::HomeController < ApplicationController#BaseOrigamiController +class Origami::HomeController < ApplicationController #BaseOrigamiController before_action :set_dining, only: [:show] def index diff --git a/app/controllers/origami/home_controller_bk.rb b/app/controllers/origami/home_controller_bk.rb index 5496cca5..4839f15c 100644 --- a/app/controllers/origami/home_controller_bk.rb +++ b/app/controllers/origami/home_controller_bk.rb @@ -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]; diff --git a/app/controllers/origami/in_duties_controller.rb b/app/controllers/origami/in_duties_controller.rb index 56119e58..d26f4050 100644 --- a/app/controllers/origami/in_duties_controller.rb +++ b/app/controllers/origami/in_duties_controller.rb @@ -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 diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb index 90639b80..124a3837 100644 --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -1,4 +1,4 @@ -class Origami::JcbController < ApplicationController#BaseOrigamiController +class Origami::JcbController < ApplicationController #BaseOrigamiController def index @sale_id = params[:sale_id] diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb index b5619f12..5a1868bc 100644 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -1,4 +1,4 @@ -class Origami::MasterController < ApplicationController#BaseOrigamiController +class Origami::MasterController < ApplicationController #BaseOrigamiController def index @sale_id = params[:sale_id] diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb index c4e1b91d..60f476fd 100644 --- a/app/controllers/origami/moveroom_controller.rb +++ b/app/controllers/origami/moveroom_controller.rb @@ -1,5 +1,5 @@ -class Origami::MoveroomController < ApplicationController#BaseOrigamiController - +class Origami::MoveroomController < ApplicationController #BaseOrigamiController + authorize_resource :class => false def move_dining diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index baced1ab..ac5e8c88 100644 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -1,5 +1,5 @@ -class Origami::MovetableController < ApplicationController#BaseOrigamiController - +class Origami::MovetableController < ApplicationController #BaseOrigamiController + authorize_resource :class => false def move_dining diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb index 7b66b79a..42a67068 100644 --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -1,5 +1,4 @@ -class Origami::MpuController < ApplicationController#BaseOrigamiController - +class Origami::MpuController < ApplicationController #BaseOrigamiController def index @sale_id = params[:sale_id] diff --git a/app/controllers/origami/orders_controller.rb b/app/controllers/origami/orders_controller.rb index 10daeb71..71420c2b 100644 --- a/app/controllers/origami/orders_controller.rb +++ b/app/controllers/origami/orders_controller.rb @@ -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') diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index fe1cc18a..142a9dee 100644 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -1,4 +1,4 @@ -class Origami::OtherChargesController < ApplicationController#BaseOrigamiController +class Origami::OtherChargesController < ApplicationController #BaseOrigamiController authorize_resource :class => false def index diff --git a/app/controllers/origami/others_payments_controller.rb b/app/controllers/origami/others_payments_controller.rb index b4c8a7c7..e5a5b127 100644 --- a/app/controllers/origami/others_payments_controller.rb +++ b/app/controllers/origami/others_payments_controller.rb @@ -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] diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index c00a9178..7d3cdbd3 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -1,5 +1,4 @@ -class Origami::PaymentsController < ApplicationController#BaseOrigamiController - +class Origami::PaymentsController < ApplicationController #BaseOrigamiController authorize_resource :class => false def index end diff --git a/app/controllers/origami/product_commissions_controller.rb b/app/controllers/origami/product_commissions_controller.rb index 4e64c9c6..b236c44d 100644 --- a/app/controllers/origami/product_commissions_controller.rb +++ b/app/controllers/origami/product_commissions_controller.rb @@ -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 diff --git a/app/controllers/origami/redeem_payments_controller.rb b/app/controllers/origami/redeem_payments_controller.rb index 30eceb11..0cc3506f 100644 --- a/app/controllers/origami/redeem_payments_controller.rb +++ b/app/controllers/origami/redeem_payments_controller.rb @@ -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] diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 7fa51da4..d83e600d 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -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" diff --git a/app/controllers/origami/room_invoices_controller.rb b/app/controllers/origami/room_invoices_controller.rb index e884b433..2d50de5e 100644 --- a/app/controllers/origami/room_invoices_controller.rb +++ b/app/controllers/origami/room_invoices_controller.rb @@ -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" diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index 8d461435..b4a306d2 100644 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -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') diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb index 7e427cc8..aafaafe9 100644 --- a/app/controllers/origami/sale_edit_controller.rb +++ b/app/controllers/origami/sale_edit_controller.rb @@ -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 diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb index ce13aa8a..ceddcde7 100644 --- a/app/controllers/origami/sales_controller.rb +++ b/app/controllers/origami/sales_controller.rb @@ -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') diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 084a11d8..d175e36f 100644 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -1,5 +1,4 @@ class Origami::ShiftsController < ApplicationController#BaseOrigamiController - def index end diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 331d2843..5f77eb04 100644 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -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" diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb index b1e1890f..831dbf0f 100644 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -1,5 +1,4 @@ -class Origami::VisaController < ApplicationController#BaseOrigamiController - +class Origami::VisaController < ApplicationController #BaseOrigamiController def index @sale_id = params[:sale_id] diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index 1cf1ec65..15215279 100644 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -1,4 +1,4 @@ -class Origami::VoidController < BaseOrigamiController +class Origami::VoidController < ApplicationController authorize_resource :class => false def overall_void diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index 45c4d0d2..5dfed585 100644 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -1,5 +1,4 @@ -class Origami::VoucherController < ApplicationController#BaseOrigamiController - +class Origami::VoucherController < ApplicationController #BaseOrigamiController def index @sale_id = params[:sale_id] diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb index 5bf654ef..a72319b3 100644 --- a/app/controllers/print_settings_controller.rb +++ b/app/controllers/print_settings_controller.rb @@ -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 diff --git a/app/models/license.rb b/app/models/license.rb new file mode 100755 index 00000000..b2682213 --- /dev/null +++ b/app/models/license.rb @@ -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 diff --git a/app/models/order.rb b/app/models/order.rb index 1887585c..6bb97ed7 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -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 diff --git a/app/models/product.rb b/app/models/product.rb index 5aff41f5..3c915a38 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -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 diff --git a/app/models/sale.rb b/app/models/sale.rb index 78596b42..c3b9cb5a 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -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 diff --git a/app/models/stock_journal.rb b/app/models/stock_journal.rb index 22dceaa5..35bebca2 100644 --- a/app/models/stock_journal.rb +++ b/app/models/stock_journal.rb @@ -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 diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb index 34a9779c..71969440 100644 --- a/app/pdf/close_cashier_pdf.rb +++ b/app/pdf/close_cashier_pdf.rb @@ -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 diff --git a/app/pdf/crm_order_pdf.rb b/app/pdf/crm_order_pdf.rb index 22a381ca..dca0ab9b 100644 --- a/app/pdf/crm_order_pdf.rb +++ b/app/pdf/crm_order_pdf.rb @@ -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 diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 64df3adb..9f916853 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -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" diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index d23f2677..098718a2 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -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 diff --git a/app/pdf/queue_no_pdf.rb b/app/pdf/queue_no_pdf.rb index 49e13bd9..504f4b5e 100644 --- a/app/pdf/queue_no_pdf.rb +++ b/app/pdf/queue_no_pdf.rb @@ -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 diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 1d9b3f4d..28c33ba6 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -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 diff --git a/app/pdf/stock_result_pdf.rb b/app/pdf/stock_result_pdf.rb index ef615a9c..4787e9b1 100644 --- a/app/pdf/stock_result_pdf.rb +++ b/app/pdf/stock_result_pdf.rb @@ -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 diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 02e8a0f0..0c38fbf5 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -102,6 +102,12 @@
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %> + +
- + + <% if current_user.role == 'administrator' || current_user.role == 'manager' %> +
+
+
+

Top Products

+
+ +
+
+
+
+
+

Inventory

+
+ +
+
+
+
+

+
+
+
+

Hourly Sales

+
+ +
+
+
+
+
+

Employee Sales

+
+ +
+
+
+
+ <% end %>
+ + + \ No newline at end of file diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 83d43ea8..a8a6d85c 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -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"); diff --git a/app/views/home/show.html.erb b/app/views/home/show.html.erb index a6ffe486..4d1096c8 100644 --- a/app/views/home/show.html.erb +++ b/app/views/home/show.html.erb @@ -39,18 +39,18 @@

diff --git a/app/views/reports/credit_payment/index.html.erb b/app/views/reports/credit_payment/index.html.erb index 6e3e6a58..7cc0112c 100644 --- a/app/views/reports/credit_payment/index.html.erb +++ b/app/views/reports/credit_payment/index.html.erb @@ -5,22 +5,22 @@
-
+ <%= render :partial=>'shift_sale_report_filter', :locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_credit_payment_index_path} %>
-
+ -
-
-
+ + + -
-
+ + -
-
+
+
<% unless @sale_data.blank? %> diff --git a/app/views/reports/dailysale/_shift_sale_report_filter.html.erb b/app/views/reports/dailysale/_shift_sale_report_filter.html.erb index d49d2660..0208090f 100644 --- a/app/views/reports/dailysale/_shift_sale_report_filter.html.erb +++ b/app/views/reports/dailysale/_shift_sale_report_filter.html.erb @@ -1,144 +1,122 @@ -
-
- <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> - <% if period_type != false %> -
-
- - -
- - -
- - - -
-
- - -
-
- -
-
- <% end %> - - - -
-
- <% 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 %> - - <% 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 %> - <%= 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 %> +
+
+ + +
+ - <% if defined? items %> - <%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %> - <% end %> -
-
+
+ + + +
+
+ + +
+
+ +
+
+ <% end %> - - +
+
+ <% 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 %> + + <% 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 %> + <%= 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 %> +
+
+ +<% end %> diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index 5868d078..e847316e 100644 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -1,121 +1,125 @@ - +
+
+ -
- <%= render :partial=>'shift_sale_report_filter', - :locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %> -
-
+ + <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %> +
+ -
-
- -
-
+ + + + + -
-
-
- - - - - - <% if @shift_from %> - - <% if @shift_data.employee %> - <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> - <% end %> - - - <% end %> +
+
+
From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
+ - - - - - - <% @sale_taxes.each do |tax| %> - - <% end %> - - - - - - - - <% 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| %> + + + + <% if @shift_from %> + + <% if @shift_data.employee %> + <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> + <% end %> + + + <% 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 %> - - - - - - - - <% result.sale_taxes.each do |tax| %> + + + + + + <% @sale_taxes.each do |tax| %> + + <% end %> + + + + + + + + <% 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 %> + + + + + + + + <% result.sale_taxes.each do |tax| %> - <%end%> - - - - - + <%end%> - <% end %> - - - - - <% @sale_taxes.each do |tax| %> + + + + + + <% end %> + + + + + <% @sale_taxes.each do |tax| %> - <% end %> - - - - - - - - - <% @sale_taxes.each do |tax| %> + <% end %> + + + + + + + + + <% @sale_taxes.each do |tax| %> - <% end %> - - - - - <%end%> - -
Recipt NoCashier NameTotal AmountDiscount Amount <%= tax.tax_name %>Grand TotalRounding Adj.Grand Total +
- Rounding Adj. -
From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
<%= result.receipt_no rescue '-' %> <%= result.cashier_name rescue '-' %><%= result.total_amount rescue '-' %><%= result.total_discount rescue '-' %>
Recipt NoCashier NameTotal AmountDiscount Amount <%= tax.tax_name %>Grand TotalRounding Adj.Grand Total +
+ Rounding Adj. +
<%= result.receipt_no rescue '-' %> <%= result.cashier_name rescue '-' %><%= result.total_amount rescue '-' %><%= result.total_discount rescue '-' %><%= tax.tax_payable_amount rescue '-' %><%= result.old_grand_total %><%= result.rounding_adjustment.to_f rescue '-' %><%= result.grand_total_after_rounding() rescue '-'%>
 <%= total_sum rescue '-'%><%= discount_amt rescue '-'%><%= result.old_grand_total %><%= result.rounding_adjustment.to_f rescue '-' %><%= result.grand_total_after_rounding() rescue '-'%>
 <%= total_sum rescue '-'%><%= discount_amt rescue '-'%><%= tax.st_amount.round(2) %><%= old_grand_total.to_f.round(2) rescue '-'%><%= rounding_adj rescue '-'%><%= old_grand_total.to_f.round + rounding_adj %>
 Total AmountDiscount Amount<%= old_grand_total.to_f.round(2) rescue '-'%><%= rounding_adj rescue '-'%><%= old_grand_total.to_f.round + rounding_adj %>
 Total AmountDiscount Amount<%= tax.tax_name %>Grand TotalRounding Adj.Grand Total +
- Rounding Adj. -
-
+ <% end %> + Grand Total + Rounding Adj. + Grand Total +
+ Rounding Adj. + + + <%end%> + + +
+
+
\ No newline at end of file diff --git a/app/views/reports/shiftsale/_shift_sale_report_filter.html.erb b/app/views/reports/shiftsale/_shift_sale_report_filter.html.erb index 1ccf99ad..5e5ae1bb 100644 --- a/app/views/reports/shiftsale/_shift_sale_report_filter.html.erb +++ b/app/views/reports/shiftsale/_shift_sale_report_filter.html.erb @@ -1,87 +1,85 @@ -
-
- <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> - <% if period_type != false %> -
-
- - -
- -
- - - -
-
- - -
-
- - -
-
- -
-
- <% end %> - - <% end %> -
-
+ +<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
+
+ + +
+ +
+ + + +
+
+ + +
+
+ + +
+
+ +
+
+ <% end %> + +<% end %> + \ No newline at end of file + }); + \ No newline at end of file diff --git a/app/views/reports/void_sale/_shift_sale_report_filter.html.erb b/app/views/reports/void_sale/_shift_sale_report_filter.html.erb index 5313e61d..3c03a537 100644 --- a/app/views/reports/void_sale/_shift_sale_report_filter.html.erb +++ b/app/views/reports/void_sale/_shift_sale_report_filter.html.erb @@ -1,125 +1,120 @@ -
-
- <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> - <% if period_type != false %> -
-
- - -
- -
- - - -
-
- - -
-
- - -
-
- -
-
- <% end %> - - <% end %> -
-
+<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
+
+ + +
+ +
+ + + +
+
+ + +
+
+ + +
+
+ +
+
+ <% end %> +<% end %> diff --git a/app/views/reports/void_sale/index.html.erb b/app/views/reports/void_sale/index.html.erb index 53f8ff46..5f2557cc 100644 --- a/app/views/reports/void_sale/index.html.erb +++ b/app/views/reports/void_sale/index.html.erb @@ -1,99 +1,97 @@ - +
+
+ -
- <%= render :partial=>'shift_sale_report_filter', - :locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_void_sale_index_path} %> -
-
+ + <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_void_sale_index_path} %> +
+ -
- -
+ + -
-
- <% if @sale_data.count > 0 %> - - - <% if !params[:from].blank?%> - - - - <% end %> - <% if @shift_from %> - - <% if @shift %> - <% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %> - <% end %> - - - <% end %> - - - - - - - - - - - - <% 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| %> - - - - - - - - - - - <% 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 %> - - - - - - - - -
From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%>
Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )
Receipt NoSale DateTotal AmountGrand TotalRounding Adj.Grand Total +
Rounding Adj.
<%= item.receipt_no rescue '-' %> <%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %><%= item.total_amount.to_f rescue '-'%> <%= item.grand_total.to_f rescue '-'%> <%= item.rounding_adjustment.to_f rescue '-' %><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%>
Total Void Amount :<%= total_amount rescue '-' %><%= grand_total rescue '-' %><%= rounding_adjustment rescue '-'%><%= grand_rounding_adjustment rescue '-'%>
-<% end %> -
-
+
+
+ <% if @sale_data.count > 0 %> + + + <% if !params[:from].blank?%> + + + + <% end %> + <% if @shift_from %> + + <% if @shift %> + <% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %> + <% end %> + + + <% end %> + + + + + + + + + + + + <% 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| %> + + + + + + + + + + + <% 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 %> + + + + + + + + +
From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%>
Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )
Receipt NoSale DateTotal AmountGrand TotalRounding Adj.Grand Total +
Rounding Adj.
<%= item.receipt_no rescue '-' %> <%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %><%= item.total_amount.to_f rescue '-'%> <%= item.grand_total.to_f rescue '-'%> <%= item.rounding_adjustment.to_f rescue '-' %><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%>
Total Void Amount :<%= total_amount rescue '-' %><%= grand_total rescue '-' %><%= rounding_adjustment rescue '-'%><%= grand_rounding_adjustment rescue '-'%>
+ <% end %> +
+