define producer_charges_sales_tax && product_tax_category as new hidden by default columns

This commit is contained in:
Mohamed ABDELLANI
2022-11-18 11:06:27 +01:00
parent 07c29df801
commit f7cd168f6d
3 changed files with 19 additions and 2 deletions

View File

@@ -2810,6 +2810,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
report_header_customer_code: Customer Code
report_header_product: Product
report_header_product_properties: Product Properties
report_header_product_tax_category: Product Tax Category
report_header_quantity: Quantity
report_header_max_quantity: Max Quantity
report_header_variant: Variant
@@ -2822,6 +2823,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
report_header_supplier: Supplier
report_header_producer: Producer
report_header_producer_suburb: Producer Suburb
report_header_producer_charges_sales_tax?: GST/VAT Registered
report_header_unit: Unit
report_header_group_buy_unit_quantity: Group Buy Unit Quantity
report_header_cost: Cost

View File

@@ -10,6 +10,7 @@ module Reporting
def default_params
{
fields_to_hide: [:producer_charges_sales_tax?, :product_tax_category],
q: {
completed_at_gt: 1.month.ago.beginning_of_day,
completed_at_lt: 1.day.from_now.beginning_of_day
@@ -51,10 +52,18 @@ module Reporting
proc { |line_items| line_items.first.variant.product.supplier.name }
end
def supplier_charges_sales_tax?
proc { |line_items| line_items.first.variant.product.supplier.charges_sales_tax }
end
def product_name
proc { |line_items| line_items.first.variant.product.name }
end
def product_tax_category
proc { |line_items| line_items.first.variant.product.tax_category&.name }
end
def hub_name
proc { |line_items| line_items.first.order.distributor.name }
end

View File

@@ -13,7 +13,9 @@ module Reporting
total_units: proc { |line_items| total_units(line_items) },
curr_cost_per_unit: proc { |line_items| line_items.first.price },
total_cost: proc { |line_items| line_items.sum(&:amount) },
sku: variant_sku
sku: variant_sku,
producer_charges_sales_tax?: supplier_charges_sales_tax?,
product_tax_category: product_tax_category
}
end
@@ -44,7 +46,11 @@ module Reporting
end
def default_params
super.merge({ fields_to_hide: ["sku"] })
super.merge({ fields_to_hide: [
:sku,
:producer_charges_sales_tax?,
:product_tax_category
] })
end
end
end