Author: Hugo Melo <hugo@riseup.net>
Reorder spreadsheet field (payment method)
plugins/orders/lib/orders_plugin/report.rb | 11 ++++++----- plugins/orders/locales/pt-BR.yml | 1 +
diff --git a/plugins/orders/lib/orders_plugin/report.rb b/plugins/orders/lib/orders_plugin/report.rb index 36d0b3efec5405baf7db44f88a162e77de026dd0..b511bc0ee081bac277dff78390a154e96e52f039 100644 --- a/plugins/orders/lib/orders_plugin/report.rb +++ b/plugins/orders/lib/orders_plugin/report.rb @@ -194,7 +194,7 @@ sheet.add_row [order.code, order.consumer_data[:name], '',order.consumer_data[:contact_phone],'',order.consumer_data[:email],''], style: default ["B#{sbs}:C#{sbs}", "D#{sbs}:E#{sbs}", "F#{sbs}:G#{sbs}"].each{ |c| sheet.merge_cells c } sbs += 1 - sheet.add_row [t('lib.report.hub'), t('lib.report.payment_method'), t('lib.report.delivery_option'), '','',t('lib.report.created'), t('lib.report.modified')], + sheet.add_row [t('lib.report.payment_method'), t('lib.report.hub'), t('lib.report.delivery_option'), '','',t('lib.report.created'), t('lib.report.modified')], style: bluecell ["D#{sbs}:E#{sbs}"].each{ |c| sheet.merge_cells c } # sp = index of the start of the products list / ep = index of the end of the products list @@ -208,11 +208,11 @@ payment_method = order.payment_data[:method] payment_method = payment_method.nil? ? '' : t("payments_plugin.models.payment_methods."+payment_method) end - sheet.add_row [order.suppliers_consumer&.hub_name, payment_method, order.supplier_delivery_data[:name], '','',order.created_at, order.updated_at], + sheet.add_row [payment_method, order.suppliers_consumer&.hub_name, order.supplier_delivery_data[:name], '','',order.created_at, order.updated_at], style: [default, default, default, default, default, date, date] sbs += 1 sheet.add_row [t('lib.report.product_cod'), t('lib.report.supplier'), t('lib.report.product_name'), - t('lib.report.qty_ordered'),t('lib.report.un'),t('lib.report.price_un'), t('lib.report.value')], style: greencell + t('lib.report.qty_ordered'),t('lib.report.unit'),t('lib.report.price_un'), t('lib.report.value')], style: greencell ["D#{sbs}:E#{sbs}"].each{ |c| sheet.merge_cells c } sbe = sp @@ -245,8 +245,9 @@ sum += formula_value end # closes order.items.each sum = CurrencyFields.number_as_currency_number(sum) - sheet.add_row ['','','','',t('lib.report.total_value'),"=SUM(G#{sp}:G#{ep})", ''], style: [default]*4+[bluecell,currency, default], - formula_values: [nil,nil,nil,nil,nil,sum, nil] + formula = if sp <= ep then "=SUM(G#{sp}:G#{ep})" else "=0" end + sheet.add_row ['','','','','',t('lib.report.total_value'),formula], style: [default]*5+[bluecell,currency], + formula_values: [nil,nil,nil,nil,nil,nil, sum] sheet.add_row [""] sbs = sbe + 2 diff --git a/plugins/orders/locales/pt-BR.yml b/plugins/orders/locales/pt-BR.yml index 242f62d4923ce88f9a4c546b15c8d25556156dc5..efc0e035bc571084a07b99a19f8487de0aba2561 100644 --- a/plugins/orders/locales/pt-BR.yml +++ b/plugins/orders/locales/pt-BR.yml @@ -90,6 +90,7 @@ total_selled_value: "Valor total vendido" total_price_without_margin: "Valor total sem a margem" total_value: "total pago" un: un. + unit: unidade value: Valor value_parcel: "Valor usando estoque" phone: 'Telefone'