From 329d130a27303712e5a8e16d4ff9f8244db52ba4 Mon Sep 17 00:00:00 2001 From: Zoey Date: Thu, 30 May 2019 09:33:45 +0630 Subject: [PATCH 1/3] 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 b45c639631e0bc1557c140ad1b269c9a1f0016dc Mon Sep 17 00:00:00 2001 From: Zoey Date: Thu, 30 May 2019 13:28:24 +0630 Subject: [PATCH 2/3] 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 From 453435f8fa9e92dd7d296feefad6664fdc1f815f Mon Sep 17 00:00:00 2001 From: code2lab Date: Thu, 30 May 2019 14:00:39 +0630 Subject: [PATCH 3/3] Mobile Responsive for all reports --- app/assets/stylesheets/application.scss | 10 +++ ...hift_card_sale_tran_report_filter.html.erb | 60 +++++++------- .../reports/card_sale_tran/index.html.erb | 78 +++++++++---------- ...ft_card_settle_tran_report_filter.html.erb | 58 +++++++------- .../reports/card_settle_tran/index.html.erb | 66 ++++++++-------- .../_commission_report_filter.html.erb | 14 ++-- .../_shift_sale_report_filter.html.erb | 52 ++++++------- .../_shift_sale_report_filter.html.erb | 2 +- .../induty/_shift_sale_report_filter.html.erb | 34 ++++---- .../_shift_sale_report_filter.html.erb | 34 ++++---- .../_shift_sale_report_filter.html.erb | 42 +++++----- .../reports/payment_method/index.html.erb | 76 +++++++++--------- .../_shift_sale_report_filter.html.erb | 18 ++--- .../_shift_sale_report_filter.html.erb | 50 ++++++------ .../_shift_sale_report_filter.html.erb | 50 ++++++------ .../_shift_sale_report_filter.html.erb | 38 ++++----- .../_stock_check_report_filter.html.erb | 18 ++--- .../_shift_sale_report_filter.html.erb | 28 +++---- app/views/reports/void_sale/index.html.erb | 44 +++++------ 19 files changed, 391 insertions(+), 381 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index c7037f08..6d9f03e6 100755 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -204,4 +204,14 @@ i.logout_icon{ .mbl-right-btn{ text-align: right; } + + .mbl-table{ + display: block; + overflow: scroll; + } + + .mbl-table-card{ + overflow: scroll; + display: inline-block; + } } diff --git a/app/views/reports/card_sale_tran/_shift_card_sale_tran_report_filter.html.erb b/app/views/reports/card_sale_tran/_shift_card_sale_tran_report_filter.html.erb index 0d70fe4f..e46b8408 100644 --- a/app/views/reports/card_sale_tran/_shift_card_sale_tran_report_filter.html.erb +++ b/app/views/reports/card_sale_tran/_shift_card_sale_tran_report_filter.html.erb @@ -2,15 +2,15 @@ <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <% if period_type != false %>
- + <% if defined? @payment_method %> -
- - <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %> +
+ + <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %>
- <% end %> -
- + <% end %> +
+
<% if not defined? payments %> - -
- - + +
+ + -
+
<% end %> -
+
- +
-
- +
+
-
- +
+
-
+

-
-
+
+
<% end %> - <% end %> -
+ <% end %> +
\ No newline at end of file + diff --git a/app/views/reports/card_settle_tran/_shift_card_settle_tran_report_filter.html.erb b/app/views/reports/card_settle_tran/_shift_card_settle_tran_report_filter.html.erb index 0d70fe4f..fe2a7a62 100644 --- a/app/views/reports/card_settle_tran/_shift_card_settle_tran_report_filter.html.erb +++ b/app/views/reports/card_settle_tran/_shift_card_settle_tran_report_filter.html.erb @@ -2,15 +2,15 @@ <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <% if period_type != false %>
- + <% if defined? @payment_method %> -
- - <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %> +
+ + <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %>
- <% end %> -
- + <% end %> +
+
<% if not defined? payments %> - -
+ +
- + -
+
<% end %> -
+
- +
-
- +
+
-
- +
+
-
+

-
-
+
+
<% end %> - <% end %> -
+ <% end %> +
\ No newline at end of file + diff --git a/app/views/reports/commission/_commission_report_filter.html.erb b/app/views/reports/commission/_commission_report_filter.html.erb index d7d41eb6..a39915b9 100755 --- a/app/views/reports/commission/_commission_report_filter.html.erb +++ b/app/views/reports/commission/_commission_report_filter.html.erb @@ -11,17 +11,17 @@ <% end %>
--> -
+
- +
-
- +
+
- +
-
+

@@ -89,4 +89,4 @@ }); - --> \ No newline at end of file + --> diff --git a/app/views/reports/credit_payment/_shift_sale_report_filter.html.erb b/app/views/reports/credit_payment/_shift_sale_report_filter.html.erb index 22ae03ce..4f960e96 100755 --- a/app/views/reports/credit_payment/_shift_sale_report_filter.html.erb +++ b/app/views/reports/credit_payment/_shift_sale_report_filter.html.erb @@ -2,8 +2,8 @@ <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <% if period_type != false %>
-
- +
+
<% if defined? filter_for_credit %> -
- +
+ <%= select_tag "filter_check", options_for_select(@filter_for_credit, :selected => params[:filter_check]), :class => "form-control", :style => "height: 37px;" %>
<% end %> -
- - <%= select_tag "order_source", options_for_select(@sources, :selected => params[:order_source]), :class => "form-control" %> -
-
+
+ + <%= select_tag "order_source", options_for_select(@sources, :selected => params[:order_source]), :class => "form-control" %> +
+
- +
-
- +
+
-
- +
+ -
-
+
+
-
+

-
+
<% end %> - <% end %> -
+ <% end %> +
\ No newline at end of file + + diff --git a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb b/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb index a54afb7f..b2aeb16f 100755 --- a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb +++ b/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb @@ -2,8 +2,8 @@ <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <% if period_type != false %>
-
- +
+
<% end %> -
+
- +
-
- +
+
-
- +
+
-
+
diff --git a/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb b/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb index 1d7c2a94..89264e82 100755 --- a/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb +++ b/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb @@ -2,8 +2,8 @@ <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <% if period_type != false %>
-
- +
+
<% if defined? payments %> - -
- - + +
+ + -
+
<% end %> -
+
- +
-
- +
+
-
- +
+
-
+

-
-
+
+
<% end %> - <% end %> -
+ <% end %> +
\ No newline at end of file + diff --git a/app/views/reports/stock_check/_stock_check_report_filter.html.erb b/app/views/reports/stock_check/_stock_check_report_filter.html.erb index 32fcbf8f..485f9112 100755 --- a/app/views/reports/stock_check/_stock_check_report_filter.html.erb +++ b/app/views/reports/stock_check/_stock_check_report_filter.html.erb @@ -11,23 +11,23 @@ <% end %>
--> -
+
- +
-
- +
+
-
- +
+
-

+

- +
-
- +
+
-
- +
+
-
+

-
-
+
+
<% end %> <% end %>
@@ -60,7 +60,7 @@ $('#waiter').show(); if(payment_type){ $('#payment_type').hide(); - } + } } else if(item == 'sale'){ $('#waiter').hide(); @@ -68,7 +68,7 @@ } else{ $('#waiter').hide(); - $('#cashier').show(); + $('#cashier').show(); $("#item").val('sale'); } }); @@ -105,7 +105,7 @@ if(item == 'sale'){ $('#waiter').hide(); - $('#cashier').show(); + $('#cashier').show(); if(payment_type){ $('#payment_type').show(); } diff --git a/app/views/reports/void_sale/index.html.erb b/app/views/reports/void_sale/index.html.erb index d7b6ee10..e7ea05ea 100755 --- a/app/views/reports/void_sale/index.html.erb +++ b/app/views/reports/void_sale/index.html.erb @@ -19,12 +19,12 @@ +
-
-
+
+
<% if @sale_data.count > 0 %> @@ -35,19 +35,19 @@ <% end %> <% if @shift_from %> - <% if @shift %> + <% if @shift %> <% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %> - <% end %> + <% end %> - <% end %> + <% end %> - + @@ -63,7 +63,7 @@ else delimiter = "" end - %> + %> <% total_amount = 0.0 %> <% grand_total = 0.0 %> <% rounding_adjustment = 0.0 %> @@ -76,7 +76,7 @@ - + @@ -113,8 +113,8 @@ var from = ""; var to = ""; - show_shift_name(period,period_type,from,to,'shift_item'); - } + show_shift_name(period,period_type,from,to,'shift_item'); + } // OK button is clicked $('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){ @@ -130,13 +130,13 @@ to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear(); $('#to').val(to) search_by_date(); - }); + }); function search_by_date(){ from = $("#from").val(); to = $("#to").val(); var period = 0; - var period_type = 1; + var period_type = 1; if(to != '' && from != ''){ shift_name = from + ',' + to; @@ -145,7 +145,7 @@ console.log(check_arr.length) if(check_arr.length == 1){ - show_shift_name(period,period_type,from,to,'shift_item'); + show_shift_name(period,period_type,from,to,'shift_item'); } if(check_arr.length == 3){ check_arr = []; @@ -163,7 +163,7 @@ shift.empty(); var str = ''; - var param_shift = ''; + var param_shift = ''; var param_shift = '<%= params[:shift_name] rescue '-'%>'; url = '<%= reports_get_shift_by_date_path %>'; @@ -171,7 +171,7 @@ $.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){ str = ''; - $(data.message).each(function(index){ + $(data.message).each(function(index){ var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date; var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date; @@ -181,18 +181,18 @@ selected = 'selected = "selected"'; } else{ - selected = ''; - } + selected = ''; + } }else{ - selected = ''; - } + selected = ''; + } str += ''; // console.log(sh_date) - }) + }) shift.append(str); }); } }); - \ No newline at end of file +
<%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )
<%= t("views.right_panel.detail.receipt_no") %> <%= t("views.right_panel.detail.sale_date") %> <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> <%= t("views.right_panel.detail.grand_total") %> <%= t("views.right_panel.detail.rnd_adj_sh") %><%= t("views.right_panel.detail.grand_total") %> +
<%= t("views.right_panel.detail.rnd_adj_sh") %>
<%= t("views.right_panel.detail.grand_total") %> +
<%= t("views.right_panel.detail.rnd_adj_sh") %>
<%= number_with_precision(item.total_amount.to_f, precision: precision.to_i ,delimiter: delimiter) %> <%= number_with_precision(item.grand_total.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> <%= number_with_precision(item.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %><%= number_with_precision(item.grand_total.to_f + item.rounding_adjustment.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> <%= number_with_precision(item.grand_total.to_f + item.rounding_adjustment.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%>