From 329d130a27303712e5a8e16d4ff9f8244db52ba4 Mon Sep 17 00:00:00 2001 From: Zoey Date: Thu, 30 May 2019 09:33:45 +0630 Subject: [PATCH 1/4] update --- dump.rdb | Bin 810 -> 883 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/dump.rdb b/dump.rdb index f639025a5a56f3c585e8307e72a4d68f02ac4960..f5a525467f8cf0157f915e4bb280d887dd931c1d 100644 GIT binary patch delta 339 zcmZ3*_L*&hp@ysK+n8S*rNyZ!y1A*jha^~e7=H02=BMcv6s0ESCgr3aVED)ITbg6? zLPn9v|CrdA4G%C(p24UN=JztmTN#-hVEB_9uy0F0BLf42SaC^WiB(!+W=?8~m63s= zrLKXgu93w71_nN`OhHk8a%wTqwu7e`Cl)IUGO-nwrk17_GqR_orX`lRB_vE>ZvP?!66E}*9TId>C0xND zkf|I%6M)V!JTQ3yqbMiTxC4xnFECn8W@eU{yoyPl*~kDa%MO$^*EO`59LS_8fyE(k TV}K#T$@zbmVXu~Sm0Aq|6Oe9s delta 264 zcmey&wu)_np@!Ry=P|!HN{drdbaPX44>36LG5q35%umxTC`wJtP0C3Cl`s5Ex;&K+cMwSQI82E}y5=*QKit>|Fi-C3@Jk9v$8{huI$rl-A z#SBdko?u{ND=bYdO)X|*Pf1NnEX^sIT*G9^WMBlcQy5|e12@=^w8YGu)Rf6{nIxEu zEGKg_Yfk>iBr$QD)a3I_vOp}&W}$0fbbt|L`{d0`Qv4RW#s&u%{;Qv|NtVdH%MAbn CW?eY| From d6d48bede109c8f75cb0ecaf54cce6b0dfb42c6a Mon Sep 17 00:00:00 2001 From: NyanLinHtut Date: Thu, 30 May 2019 09:38:44 +0630 Subject: [PATCH 2/4] - --- config/puma.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/puma.rb b/config/puma.rb index 363c65ba..fd89392f 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,5 +1,6 @@ application_path="#{File.expand_path("../..", __FILE__)}" directory application_path +#environment ENV.fetch("RAILS_ENV") { "production" } environment "production" pidfile "#{application_path}/tmp/puma/pid" state_path "#{application_path}/tmp/puma/state" From dfa58377eb56aac4600aef17982ddc9b0f8323f1 Mon Sep 17 00:00:00 2001 From: NyanLinHtut Date: Thu, 30 May 2019 12:00:29 +0630 Subject: [PATCH 3/4] change login dashboard --- app/assets/stylesheets/application.scss | 1 + app/assets/stylesheets/login.scss | 4 ++ app/views/layouts/login.html.erb | 2 - app/views/layouts/login_dashboard.html.erb | 77 +++++++++++----------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 6c5f0821..9c5fc64f 100755 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -129,6 +129,7 @@ i.logout_icon{ @media screen and (max-width: 785px) { #setting{ display: none;} .menu-up{ display: none;} + .card-btn{padding: 0px 35px;} } @media screen and (max-width: 785px) { diff --git a/app/assets/stylesheets/login.scss b/app/assets/stylesheets/login.scss index 3d2504d0..b9a3f0df 100755 --- a/app/assets/stylesheets/login.scss +++ b/app/assets/stylesheets/login.scss @@ -122,5 +122,9 @@ @media screen and (max-width: 785px) { .login_pwd{width: 90%;} .login_ent{width: 10%;} + // .card-btn{padding: 0px 35px;} + // .nav-tabs{padding: 0px 44px;} + .box{margin: unset;} + .mbl-btn-usrgp{width: 48%;} } diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index 46ccccde..08e2e6c6 100755 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -135,8 +135,6 @@
0
CLR
<% end %> - - diff --git a/app/views/layouts/login_dashboard.html.erb b/app/views/layouts/login_dashboard.html.erb index f203bd44..407b5952 100755 --- a/app/views/layouts/login_dashboard.html.erb +++ b/app/views/layouts/login_dashboard.html.erb @@ -15,10 +15,10 @@ --> <%= stylesheet_link_tag 'login', media: 'all', 'data-turbolinks-track': 'reload' %> - + - <%= javascript_include_tag 'login', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'login', 'data-turbolinks-track': 'reload' %> @@ -39,8 +39,8 @@ <% flash.each do |type, message| %> - <% - if type == "notice" + <% + if type == "notice" color = "alert-success" elsif type == "error" color = "alert-danger" @@ -49,11 +49,11 @@ else color = "bg-black" end %> - + - <% end %> + <% end %>
@@ -62,25 +62,25 @@

Version - 1.0.1 -

+

- <%= shop_detail.name %> + <%= shop_detail.name %>
-
-
-
+
+
+
-
+

-
+
1
@@ -103,14 +103,14 @@
ENT
-->
BACK
0
-
CLR
-
+
CLR
+
-
-
+
+
-
-
+
+
+ +
@@ -129,7 +129,7 @@
<% @employees.each do |employee| %> <%if employee.role == role %> -
+
<%if employee.image_path.present? %> @@ -138,20 +138,20 @@
<%= employee.name%>
- <% else %> + <% else %> - <% end %> + <% end %>
<% end %> <% end %> -
+
<% end %> <% end %> -
+
@@ -159,7 +159,7 @@ - - - - From b45c639631e0bc1557c140ad1b269c9a1f0016dc Mon Sep 17 00:00:00 2001 From: Zoey Date: Thu, 30 May 2019 13:28:24 +0630 Subject: [PATCH 4/4] sale items pdf --- .../reports/saleitem_controller.rb | 45 ++++++++++++------- app/models/printer/cashier_station_printer.rb | 4 +- app/pdf/sale_items_pdf.rb | 8 ++-- app/views/reports/saleitem/index.html.erb | 35 ++++++++++++--- 4 files changed, 65 insertions(+), 27 deletions(-) diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb index b12b45d7..a0569378 100755 --- a/app/controllers/reports/saleitem_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -87,31 +87,44 @@ class Reports::SaleitemController < BaseReportController end def print_sale_items - type = params[:type] - account = params[:account] - from_date = to_date = '-' - if !params[:from].nil? - from_date = Date.parse(params[:from]) - end - if !params[:to].nil? - to_date = Date.parse(params[:to]) - end + from, to = get_date_range_from_params - shift = params[:shift_name] - shift_name = "All Shifts" - if shift.to_i > 0 - shift_name = params[:shift_from].to_s+" - ".to_s+params[:shift_to].to_s - end + shift_sale_range = '' - period_name = get_period_name(params[:period]) + shift = '' + shift_name = 'All Shift' + if params[:shift_name].to_i != 0 + + shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) + + shift_sale = ShiftSale.find(params[:shift_name]) + if to.blank? + shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at) + else + if shift_sale.shift_closed_at.blank? + shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at) + else + shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at) + end + end + + sh_name = "#{shift_sale.shift_started_at.utc.getlocal.strftime('%d %B %l:%M%p')} - #{shift_sale.shift_closed_at.utc.getlocal.strftime('%d %B %l:%M%p')}" + employee = Employee.find(shift_sale.employee_id) + shift_name = employee.nil? ? sh_name : "#{sh_name} (#{employee.name})" + end shop_details = shop_detail + account_type = params[:account_type] + @type = params[:period_type] + period_name = get_period_name(params[:period]) + @sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type) + # get printer info print_settings = PrintSetting.find_by_unique_code('CloseCashierPdf') # SaleItemsPdf printer = Printer::CashierStationPrinter.new(print_settings) - printer.print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, params[:sale_items], params[:menu_cate_count]) + printer.print_sale_items_report(print_settings, shop_details, period_name, @type, account_type, from, to, shift_name, @sale_data) respond_to do |format| format.html { redirect_to '/en/reports/saleitem/', notice: 'Printing Completed.'} diff --git a/app/models/printer/cashier_station_printer.rb b/app/models/printer/cashier_station_printer.rb index 64c448c0..8fdbc6d2 100755 --- a/app/models/printer/cashier_station_printer.rb +++ b/app/models/printer/cashier_station_printer.rb @@ -81,10 +81,10 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker end end - def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, menu_cate_count) + def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items) filename = "tmp/reports_sale_items.pdf" - pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, menu_cate_count, nil) + pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, nil, nil) pdf.render_file filename diff --git a/app/pdf/sale_items_pdf.rb b/app/pdf/sale_items_pdf.rb index 30c6e835..99572923 100644 --- a/app/pdf/sale_items_pdf.rb +++ b/app/pdf/sale_items_pdf.rb @@ -105,7 +105,7 @@ class SaleItemsPdf < Prawn::Document text "From Date : ", :size => self.item_font_size,:align => :left end bounding_box([@label_name_width,y_position], :width => @label_item_width, :height => self.item_height) do - text "#{ from_date}" , :size => self.item_font_size,:align => :left + text "#{ from_date.utc.getlocal.strftime("%d-%m-%Y")}" , :size => self.item_font_size,:align => :left end y_position = cursor @@ -113,14 +113,14 @@ class SaleItemsPdf < Prawn::Document text "To Date : ", :size => self.item_font_size,:align => :left end bounding_box([@label_name_width,y_position], :width => @label_item_width, :height => self.item_height) do - text "#{ to_date}" , :size => self.item_font_size,:align => :left + text "#{ to_date.utc.getlocal.strftime("%d-%m-%Y")}" , :size => self.item_font_size,:align => :left end y_position = cursor bounding_box([0,y_position], :width =>@label_name_width, :height => self.item_height) do text "Shift : ", :size => self.item_font_size,:align => :left end - bounding_box([@label_name_width,y_position], :width => @label_item_width, :height => self.item_height) do + bounding_box([@label_name_width,y_position], :width => @label_item_width) do text "#{shift}" , :size => self.item_font_size,:align => :left end @@ -148,7 +148,7 @@ class SaleItemsPdf < Prawn::Document arr = Array.new unless sale_items.nil? - JSON.parse(sale_items).each do |item| + sale_items.each do |item| if !arr.include?(item['menu_category_id']) diff --git a/app/views/reports/saleitem/index.html.erb b/app/views/reports/saleitem/index.html.erb index b64076b0..971f9b44 100644 --- a/app/views/reports/saleitem/index.html.erb +++ b/app/views/reports/saleitem/index.html.erb @@ -15,7 +15,7 @@
- <%= link_to "Print", reports_print_sale_items_path(:type => params[:sale_type], :period => params[:period], :account => params[:account_type], :from => @from, :to => @to, :shift_name => params[:shift_name], :shift_from => @shift_from, :shift_to => @shift_to, :menu_cate_count => @menu_cate_count, :sale_items => @sale_data.to_json), :method => 'post', class:"btn btn-info wave-effects" %> + <%= t("views.btn.exp_to_excel") %>
@@ -66,6 +66,7 @@ <% other_sub_total = 0 %> <% product_sub_total = 0 %> <% count = 0 %> + <% row_count = 0 %> <% total_price = 0 %> <% cate_count = 0 %> <% acc_count = 0 %> @@ -78,6 +79,7 @@ <% total_tax = 0 %> <% unless @sale_data.blank? %> <% @sale_data.each do |sale| %> + <% row_count += 1 %> <% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion" @@ -285,6 +287,7 @@ <%end%> + @@ -293,10 +296,7 @@ \ No newline at end of file