12_generate_custom_csv_file #58
11 changed files with 15 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
class ArticlesCsv < RenderCSV
|
||||
class ArticlesCsv < RenderCsv
|
||||
include ApplicationHelper
|
||||
|
||||
def header
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'csv'
|
||||
|
||||
class BankTransactionsCsv < RenderCSV
|
||||
class BankTransactionsCsv < RenderCsv
|
||||
include ApplicationHelper
|
||||
|
||||
def header
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'csv'
|
||||
|
||||
class FinancialTransactionsCsv < RenderCSV
|
||||
class FinancialTransactionsCsv < RenderCsv
|
||||
include ApplicationHelper
|
||||
|
||||
def header
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'csv'
|
||||
|
||||
class InvoicesCsv < RenderCSV
|
||||
class InvoicesCsv < RenderCsv
|
||||
include ApplicationHelper
|
||||
|
||||
def header
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'csv'
|
||||
|
||||
class OrderCsv < RenderCSV
|
||||
class OrderCsv < RenderCsv
|
||||
def header
|
||||
[
|
||||
OrderArticle.human_attribute_name(:units_to_order),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class OrderPDF < RenderPDF
|
||||
class OrderPdf < RenderPdf
|
||||
attr_reader :order
|
||||
|
||||
def initialize(order, options = {})
|
||||
|
@ -55,7 +55,7 @@ class OrderPDF < RenderPDF
|
|||
end
|
||||
|
||||
def group_order_article_quantity_with_tolerance(goa)
|
||||
goa.tolerance > 0 ? "#{goa.quantity} + #{goa.tolerance}" : goa.quantity.to_s
|
||||
goa.tolerance > 0 ? "#{goa.quantity} + #{goa.tolerance}" : "#{goa.quantity}"
|
||||
end
|
||||
|
||||
def group_order_article_result(goa)
|
||||
|
@ -88,7 +88,7 @@ class OrderPDF < RenderPDF
|
|||
.pluck('groups.name', 'SUM(group_orders.price)', 'ordergroup_id', 'SUM(group_orders.transport)')
|
||||
|
||||
result.map do |item|
|
||||
[item.first || stock_ordergroup_name] + item[1..]
|
||||
[item.first || stock_ordergroup_name] + item[1..-1]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -103,7 +103,7 @@ class OrderPDF < RenderPDF
|
|||
def each_ordergroup_batch(batch_size)
|
||||
offset = 0
|
||||
|
||||
loop do
|
||||
while true
|
||||
go_records = ordergroups(offset, batch_size)
|
||||
|
||||
break unless go_records.any?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class OrdergroupsCsv < RenderCSV
|
||||
class OrdergroupsCsv < RenderCsv
|
||||
include ApplicationHelper
|
||||
|
||||
def header
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'csv'
|
||||
|
||||
class RenderCSV
|
||||
class RenderCsv
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
def initialize(object, options = {})
|
||||
|
|
|
@ -52,7 +52,7 @@ class RotatedCell < Prawn::Table::Cell::Text
|
|||
end
|
||||
end
|
||||
|
||||
class RenderPDF < Prawn::Document
|
||||
class RenderPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include ApplicationHelper
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UsersCsv < RenderCSV
|
||||
class UsersCsv < RenderCsv
|
||||
include ApplicationHelper
|
||||
|
||||
def header
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# config/initializers/zeitwerk.rb
|
||||
ActiveSupport::Dependencies
|
||||
.autoload_paths
|
||||
.delete("#{Rails.root}/app/controllers/concerns")
|
||||
|
Loading…
Reference in a new issue