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/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index b9811d02..07237ba3 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -52,3 +52,5 @@ function export_to(path) var form_params = $("#frm_report").serialize(); window.location = path+"?"+ form_params; } + + 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/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..8ac82280 100644 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -36,7 +36,7 @@ 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 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/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb index 34a9779c..1c4f52d5 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 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 ac9277e8..4616461a 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -101,6 +101,12 @@
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %> + + - - + 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 %> +
+