diff --git a/Gemfile b/Gemfile index b59fd475..af709905 100755 --- a/Gemfile +++ b/Gemfile @@ -56,7 +56,7 @@ gem 'jquery-rails' gem 'jquery-ui-rails' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks' -gem 'jquery-turbolinks', '~> 2.1' +#gem 'jquery-turbolinks', '~> 2.1' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' # Use Redis adapter to run Action Cable in production diff --git a/Gemfile.lock b/Gemfile.lock index 99c2db6a..d7b3ea9d 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,39 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.1.3) - actionpack (= 5.1.3) + actioncable (5.1.4) + actionpack (= 5.1.4) nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.1.3) - actionpack (= 5.1.3) - actionview (= 5.1.3) - activejob (= 5.1.3) + actionmailer (5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.3) - actionview (= 5.1.3) - activesupport (= 5.1.3) + actionpack (5.1.4) + actionview (= 5.1.4) + activesupport (= 5.1.4) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.3) - activesupport (= 5.1.3) + actionview (5.1.4) + activesupport (= 5.1.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.3) - activesupport (= 5.1.3) + activejob (5.1.4) + activesupport (= 5.1.4) globalid (>= 0.3.6) - activemodel (5.1.3) - activesupport (= 5.1.3) - activerecord (5.1.3) - activemodel (= 5.1.3) - activesupport (= 5.1.3) + activemodel (5.1.4) + activesupport (= 5.1.4) + activerecord (5.1.4) + activemodel (= 5.1.4) + activesupport (= 5.1.4) arel (~> 8.0) - activesupport (5.1.3) + activesupport (5.1.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -43,9 +43,9 @@ GEM bcrypt (3.1.11) bindex (0.5.0) builder (3.2.3) - byebug (9.0.6) + byebug (9.1.0) cancancan (1.17.0) - carrierwave (1.1.0) + carrierwave (1.2.1) activemodel (>= 4.0.0) activesupport (>= 4.0.0) mime-types (>= 1.16) @@ -59,27 +59,29 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.0.5) connection_pool (2.2.1) + crass (1.0.2) cups (0.0.7) - database_cleaner (1.6.1) + database_cleaner (1.6.2) diff-lcs (1.3) - erubi (1.6.1) + erubi (1.7.0) execjs (2.7.0) - factory_girl (4.8.0) + factory_girl (4.9.0) activesupport (>= 3.0.0) - factory_girl_rails (4.8.0) - factory_girl (~> 4.8.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) railties (>= 3.0.0) - faker (1.7.3) + faker (1.8.4) i18n (~> 0.5) ffi (1.9.18) filterrific (2.1.2) font-awesome-rails (4.7.0.2) railties (>= 3.2, < 5.2) - globalid (0.4.0) + globalid (0.4.1) activesupport (>= 4.2.0) - httparty (0.15.5) + httparty (0.15.6) multi_xml (>= 0.5.2) - i18n (0.8.6) + i18n (0.9.0) + concurrent-ruby (~> 1.0) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) @@ -87,9 +89,6 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jquery-turbolinks (2.1.0) - railties (>= 3.1.0) - turbolinks jquery-ui-rails (6.0.1) railties (>= 3.2.16) kaminari (1.0.1) @@ -107,88 +106,94 @@ GEM listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - loofah (2.0.3) + loofah (2.1.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.6) - mime-types (>= 1.16, < 4) + mail (2.7.0) + mini_mime (>= 0.1.1) material_icons (2.2.1) railties (>= 3.2) - method_source (0.8.2) + method_source (0.9.0) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_portile2 (2.2.0) + mini_mime (0.1.4) + mini_portile2 (2.3.0) minitest (5.10.3) momentjs-rails (2.17.1) railties (>= 3.1) - multi_json (1.12.1) + multi_json (1.12.2) multi_xml (0.6.0) - mysql2 (0.4.6) + mysql2 (0.4.9) nested_form (0.3.2) nio4r (2.1.0) - nokogiri (1.8.0) - mini_portile2 (~> 2.2.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) pdf-core (0.7.0) - pg (0.20.0) + pg (0.21.0) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - puma (3.9.1) + puma (3.10.0) rack (2.0.3) - rack-cors (0.4.1) + rack-cors (1.0.2) rack-protection (2.0.0) rack - rack-test (0.6.3) - rack (>= 1.0) - rails (5.1.3) - actioncable (= 5.1.3) - actionmailer (= 5.1.3) - actionpack (= 5.1.3) - actionview (= 5.1.3) - activejob (= 5.1.3) - activemodel (= 5.1.3) - activerecord (= 5.1.3) - activesupport (= 5.1.3) + rack-test (0.7.0) + rack (>= 1.0, < 3) + rails (5.1.4) + actioncable (= 5.1.4) + actionmailer (= 5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) + activemodel (= 5.1.4) + activerecord (= 5.1.4) + activesupport (= 5.1.4) bundler (>= 1.3.0) - railties (= 5.1.3) + railties (= 5.1.4) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.1.3) - actionpack (= 5.1.3) - activesupport (= 5.1.3) + railties (5.1.4) + actionpack (= 5.1.4) + activesupport (= 5.1.4) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.0.0) - rb-fsevent (0.9.8) + rake (12.2.1) + rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) - redis (3.3.3) - rspec-core (3.6.0) - rspec-support (~> 3.6.0) - rspec-expectations (3.6.0) + redis (4.0.1) + rspec-core (3.7.0) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-mocks (3.6.0) + rspec-support (~> 3.7.0) + rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-rails (3.6.0) + rspec-support (~> 3.7.0) + rspec-rails (3.7.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.6.0) - rspec-expectations (~> 3.6.0) - rspec-mocks (~> 3.6.0) - rspec-support (~> 3.6.0) - rspec-support (3.6.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-support (~> 3.7.0) + rspec-support (3.7.0) ruby-ole (1.2.12.1) - sass (3.4.24) + sass (3.5.3) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) @@ -197,13 +202,13 @@ GEM tilt (>= 1.1, < 3) schema_to_scaffold (0.8.0) activesupport (>= 3.2.1) - shoulda-matchers (3.1.1) + shoulda-matchers (3.1.2) activesupport (>= 4.0.0) - sidekiq (5.0.3) + sidekiq (5.0.5) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) - redis (~> 3.3, >= 3.3.3) + redis (>= 3.3.4, < 5) simple_form (3.5.0) actionpack (> 4, < 5.2) activemodel (> 4, < 5.2) @@ -217,22 +222,22 @@ GEM sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) tether-rails (1.4.0) rails (>= 3.1) - thor (0.19.4) + thor (0.20.0) thread_safe (0.3.6) - tilt (2.0.7) + tilt (2.0.8) to_xls-rails (1.3.1) spreadsheet (>= 0.8.5) ttfunk (1.5.1) turbolinks (5.0.1) turbolinks-source (~> 5) turbolinks-source (5.0.3) - tzinfo (1.2.3) + tzinfo (1.2.4) thread_safe (~> 0.1) uglifier (3.2.0) execjs (>= 0.3.0, < 3) @@ -266,7 +271,6 @@ DEPENDENCIES httparty (~> 0.15.5) jbuilder (~> 2.5) jquery-rails - jquery-turbolinks (~> 2.1) jquery-ui-rails kaminari (~> 1.0.1) listen (~> 3.0.5) diff --git a/app/assets/images/SX-Logo-small.png b/app/assets/images/SX-Logo-small.png old mode 100755 new mode 100644 diff --git a/app/assets/images/SX-logo.png b/app/assets/images/SX-logo.png old mode 100755 new mode 100644 diff --git a/app/assets/javascripts/CRM.js b/app/assets/javascripts/CRM.js index da856a16..646bc195 100755 --- a/app/assets/javascripts/CRM.js +++ b/app/assets/javascripts/CRM.js @@ -27,12 +27,10 @@ //= require custom.js $(document).on('turbolinks:load', function() { - $('.datepicker').bootstrapMaterialDatePicker({ format: 'DD-MM-YYYY', clearButton: true, weekStart: 1, time: false }); - }); \ No newline at end of file diff --git a/public/js/Chart.js b/app/assets/javascripts/Chart.js similarity index 100% rename from public/js/Chart.js rename to app/assets/javascripts/Chart.js diff --git a/public/js/Chart.min.js b/app/assets/javascripts/Chart.min.js similarity index 100% rename from public/js/Chart.min.js rename to app/assets/javascripts/Chart.min.js diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index c8bb6be3..cbcd662c 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -79,7 +79,6 @@ $(function(){ $(".menu_category").on("click", function(){ var menu_id = $(this).find(".menu-id").text(); var url = "get_menu_category/"+menu_id; - console.log(url) show_menu_item_list(url); }); //End menu category Click diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c886fec3..f6005ebd 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -37,7 +37,6 @@ //= require BSBMaterial/demo.js //= require custom.js - $(document).ready(function() { $('.count-to').countTo(); @@ -120,5 +119,234 @@ function export_to(path) window.location = path+"?"+ form_params; } +/*Oqs Js file */ + + +$(document).ready(function(){ + + $(".nav-completed").on("click", function(){ + $("#completed").removeClass('hide') + $(".oqs_append").addClass('hide') + }); + + $(".oqs_click").on("click", function(){ + $(".oqs_click").removeClass('oqs_active'); + $(".queue_station").removeClass('queue_station_box'); + $("#completed").addClass('hide'); + $(".oqs_append").removeClass('hide'); + $(this).addClass('oqs_active'); + $(".queue_station").addClass('queue_station_box'); + var oqs_id = $(this).find(".oqs-id").text(); + var url = 'oqs/get_items/'+oqs_id; + + show_details(url); + + }); //End Click + + function show_details(url){ + var oqs_append = $('.oqs_append'); + oqs_append.empty(); + var filter = $('.filter').text(); + //Start Ajax + $.ajax({ + type: "GET", + url: url, + data: {'filter':filter}, + dataType: "json", + success: function(data) { + for(var field in data) { + var price = parseFloat(data[field].price).toFixed(2); + + if (data[field]["options"] == "[]" || data[field]["options"] == "") { + var options = ""; + }else{ + var options = data.options; + } + + var date = new Date(data[field]["created_at"]); + var show_date = date.getDate() + "-" + date.getMonth() + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); + + row ='
' + +'
' + +'

' + +''+data[field]["table_type"]+'- ' + +''+ data[field]["zone"] +'' + +''+ data[field]["order_id"] +'- ' + +'

' + + +'

' + +''+ data[field]["item_name"] +'- ' + +''+ data[field]["qty"] +'- ' + +'

' + + +'

'+ options +'

' + + +'

' + +'Order at' + +''+ show_date +' - ' + + +''+ data[field]["item_order_by"] +' ' + +' ' + +'

' + + +' ' + +' ' + +'
' + + +'' + + +'
'; + + + + $('.oqs_append').append(row); + } + + } + }); + //end Ajax + + } + + $(document).on('click', '.queue_station', function(event){ + var orderZone=$(this).children().children().children('.order-zone').text().trim(); + // var orderItem=$(this).children().children().children('.order-item').text(); + var assigned_item_id = $(this).children().find(".assigned-order-item").text(); + var orderQty = $(this).children().children().children('.order-qty').text(); + var orderBy = $(this).children().children().children().children('.order-by').text(); + var orderAt = $(this).children().children().children().children('.order-at').text(); + var orderCustomer = $(this).children().children('.order-customer').text(); + var order_status = $(this).children().children('.order-status').text(); + + $('#order-title').text("ORDER DETAILS - " + orderZone); + $('#order-by').text(orderBy); + $('#order-at').text(orderAt); + $('#order-customer').text(orderCustomer); + $('#order-from').text(orderZone); + // clear order items + $("#oqs-order-details-table").children("tbody").empty(); + // Call get_order_items() for Order Items by dining + $.ajax({ + type: 'GET', + url: '/oqs/' + orderZone, + data: { 'status' : order_status }, + success: function(res){ + for (i = 0; i < res.length; i++) { + var data = JSON.stringify(res[i]); + var parse_data = JSON.parse(data); + + var order_item_row = "" + + "" + parse_data.item_name + "" + + "" + parse_data.qty + "" + + ""; + $("#oqs-order-details-table").children("tbody").append(order_item_row); + } + } + }) + + // $('#order-items').text(orderItem); + // $('#order-qty').text(orderQty); + + $('.queue_station').removeClass('selected-item'); + $(this).addClass('selected-item'); + }); + + $(document).on('click', '.order-item-edit', function(event){ + var _self = $(this); // To know in ajax return + var assigned_item_id=$(this).attr('id').substr(5); + window.location.href = '/oqs/'+ assigned_item_id + "/edit" + }); + + // complete for queue item + + $(document).on('click', '.order-complete', function(event){ + //e.preventDefault(); + var _self = $(this); // To know in ajax return + var assigned_item_id=$(this).attr('id').substr(15); + var params = { 'id':assigned_item_id }; + + // Call update_delivery_status() for changed delivery and move to delivery + $.ajax({ + type: 'POST', + url: '/oqs/update_delivery', + data: params, + dataType: 'json', + success: function(data){ + for (i = 0; i < data.length; i++) { + var queue_station = $('#assigned_queue_' + data[i]).parent().parent(".queue_station"); + var station = queue_station.parent().parent().attr('id'); + + // Remove a queue card from current station + queue_station.remove(); + + // Remove a queue card from current station + queue_station.children('.card-footer').remove(); + + // Add removed queue card from station to completed + $("#completed").children('.card-columns').append(queue_station); + + // update queue item count in each station + var station_count=parseInt($("#"+station+"_count").text()) - 1; + $("#"+station+"_count").text(station_count); + } + + // update queue item count in completed station + $("#completed_count").text(parseInt($("#completed_count").text()) + data.length); + + alert("updated!"); + // Page reload + location.reload(); + } + }); + }); + + // Print Order Item + $(document).on('click', '#print_order_item', function(event){ + var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text(); + var options = $('.selected-item').children('.card-block').find('.item-options').text(); + var params = { 'options':options }; + + $.ajax({ + type: 'GET', + url: '/oqs/print/print/'+assigned_item_id, + success: function(data){ } + }); + }); + + // Print Order Summary + // $('#print_order_summary').on('click',function(){ + $(document).on('click', '#print_order_summary', function(event){ + var table_name=$('.selected-item').children().children().children('.order-zone').text().trim(); + var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text(); + var params = { 'table_name':table_name }; + $.ajax({ + type: 'GET', + url: '/oqs/print/print_order_summary/'+assigned_item_id, + data: params, + success: function(data){ } + }); + }); + + // Qty update for OQS Edit Controller + $('#qty-update').on('click', function(){ + var qty_weight = $("input[name='qty_weight']").val(); + var remarks = $("textarea[name='remarks']").val(); + var order_items_id = $(this).attr('data-id'); + var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks } + $.ajax({ + type: 'POST', + url: '/oqs/' + order_items_id, + data: params, + success: function(result){ + alert("Updated!"); + window.location.href = '/oqs'; + } + }); + }); +}); + diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss index 1a0496f9..50529aea 100755 --- a/app/assets/stylesheets/CRM.scss +++ b/app/assets/stylesheets/CRM.scss @@ -46,7 +46,6 @@ margin-left:-40px !important } - #sxModal { display: none; overflow: auto; diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss index 91976f41..b14895df 100755 --- a/app/assets/stylesheets/addorder.scss +++ b/app/assets/stylesheets/addorder.scss @@ -150,4 +150,8 @@ section.content{ filter: alpha(opacity=100); /* ie */ -moz-opacity: 1; /* mozilla */ +} + +#count { + text-align: center; } \ No newline at end of file diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index d52d07f2..4126bf81 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -13,6 +13,24 @@ /* Reset */ +.col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col-auto, .col-lg, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-auto, .col-md, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md-auto, .col-sm, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-auto { + padding-left: 5px; + padding-right: 5px; +} + +.col-lg-1, .col-md-1, .col-sm-1,col-xl-1{ + padding-left: 1px ; + padding-right: 1px ; +} + +.ls-closed section.content { + margin-left: 5px; +} + +section.content { + margin: 70px 5px 0 225px; +} + .table { margin-bottom: 0px; } @@ -29,8 +47,18 @@ select.form-control { font-size: 18px !important; } +@media (min-width:769px) and (max-width:1024px) { + .btn-block { + font-size: 11px !important; + } +} + /* End Reset */ +#back { + padding: 0px 0px 7px 0px; +} + .order-info { min-height:300px; max-height:500px; diff --git a/app/assets/stylesheets/settings.scss b/app/assets/stylesheets/settings.scss index e4d15f06..964b2476 100755 --- a/app/assets/stylesheets/settings.scss +++ b/app/assets/stylesheets/settings.scss @@ -1,8 +1,8 @@ /* Show it is fixed to the top */ -// body { -// min-height: 75rem; -// padding-top: 4.5rem; -// } +/* body { + min-height: 75rem; + padding-top: 4.5rem; + }*/ .setting_nav{ background-color: #2f5663; @@ -14,8 +14,8 @@ ul.navbar-nav li a{ } ul.dropdown-menu li a{ - text-decoration :none; - color :#525252; + text-decoration:none; + color:#525252; } .setting_breadcrumb{ @@ -181,16 +181,16 @@ ul.dropdown-menu li a{ @media (min-width: 62em) { .card-columns { - -webkit-column-count: 4; - -moz-column-count: 4; - column-count: 4; + -webkit-column-count: 3; + -moz-column-count: 3; + column-count: 3; } } @media (min-width: 75em) { .card-columns { - -webkit-column-count: 5; - -moz-column-count: 5; - column-count: 5; + -webkit-column-count: 4; + -moz-column-count: 4; + column-count: 4; } } \ No newline at end of file diff --git a/app/assets/stylesheets/theme.scss b/app/assets/stylesheets/theme.scss index b633b55e..5ad2cb5b 100755 --- a/app/assets/stylesheets/theme.scss +++ b/app/assets/stylesheets/theme.scss @@ -3666,7 +3666,7 @@ textarea.input-group-sm > .input-group-btn > .btn { } .navbar-brand { float: left; - padding: 15px 15px; + padding: 0px 0px; font-size: 18px; line-height: 20px; } diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 9e096a04..ff917887 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -1,4 +1,4 @@ -class Origami::AddordersController < BaseOrigamiController +class Origami::AddordersController < ApplicationController#BaseOrigamiController # before_action :set_dining, only: [:detail] def index diff --git a/app/models/sale.rb b/app/models/sale.rb index 35762674..ff10a3f2 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -614,8 +614,8 @@ def self.get_item_query() " JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id" + " JOIN menu_categories mc ON mc.id = mi.menu_category_id ") # "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ") - query = query.where("i.unit_price > 0") query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id") + query = query.where("i.unit_price > 0") query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id") end diff --git a/app/models/seed_generator.rb b/app/models/seed_generator.rb index 0748edf1..97f2083f 100755 --- a/app/models/seed_generator.rb +++ b/app/models/seed_generator.rb @@ -12,16 +12,24 @@ class SeedGenerator < ApplicationRecord return saleOrderId end - # Generate Receipt No + # Generate Receipt No for number order (1,2,3) Don't touch def self.new_receipt_no - # Only return seed no - cur_val, next_val = self.update_seed("sale") + seed = SeedGenerator.find_by_model("sale") + new_receipt_no = 0 + if (seed.nil?) + seed = SeedGenerator.new() + seed.model = "sale" + new_receipt_no = seed.next + seed.save - if (cur_val == 0) - cur_val, next_val = self.execute_query("sale") - end + else + current_no = seed.next + seed.next = seed.next + seed.current = current_no + seed.save + end - return cur_val + return seed.current end # Generate for 4 digit Code diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 80749528..cb53c5f6 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -91,7 +91,7 @@ class ReceiptBillPdf < Prawn::Document bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left end - bounding_box([self.description_width,y_position], :width => self.price_num_width, :height => self.item_height) do + bounding_box([self.description_width - 2,y_position], :width => self.price_num_width, :height => self.item_height) do text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right end move_down 5 @@ -100,7 +100,7 @@ class ReceiptBillPdf < Prawn::Document bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left end - bounding_box([self.label_width,y_position], :width =>self.label_width, :height => self.item_height) do + bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right end move_down 5 diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index 9d144ba0..f26d9e07 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -95,7 +95,6 @@ <% end %> -