Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve the report #350

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/productions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ def payment_order_pdf
def unpaid_confirmed
@unpaid_confirmed_productions = Production.includes(:tailor, production_products: :product)
.where(confirmed: true, paid: false)
.order(cut_date: :desc, service_order_number: :desc)
.order(Arel.sql("COALESCE(payment_date, expected_delivery_date) ASC NULLS LAST"))

@paid_productions = Production.includes(:tailor, production_products: :product)
.where(confirmed: true, paid: true)
.order(payment_date: :desc, service_order_number: :desc)
.order(payment_date: :asc)

if params[:tailor_id].present?
@unpaid_confirmed_productions = @unpaid_confirmed_productions.where(tailor_id: params[:tailor_id])
Expand Down
11 changes: 10 additions & 1 deletion app/views/productions/_production_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
<div class="col-12 mb-4">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="card-title mb-0"><%= t('.service_order_number') %>: <%= production.service_order_number %></h5>
<h5 class="card-title mb-0">
<%= t('.service_order_number') %>: <%= production.service_order_number %>
<small class="text-muted ml-2">
<% if production.payment_date %>
<%= t('.payment_date') %>: <%= l(production.payment_date, format: :long) %>
<% elsif production.expected_delivery_date %>
<%= t('.expected_delivery_date') %>: <%= l(production.expected_delivery_date, format: :long) %>
<% end %>
</small>
</h5>
<div>
<%= link_to t('helpers.links.edit'), edit_production_path(production), class: 'btn btn-primary btn-sm mr-2' %>
<%= link_to t('helpers.links.show'), production_path(production), class: 'btn btn-info btn-sm' %>
Expand Down
49 changes: 25 additions & 24 deletions config/locales/pt-BR.models.productions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,31 @@ pt-BR:
all_statuses: "Todos os Status"
confirmed: "Confirmado"
not_confirmed: "Não Confirmado"
unpaid_confirmed:
title: "Cortes Concluídos"
filter_by_tailor: "Filtrar por Costureiro"
all_tailors: "Todos os Costureiros"
apply_filter: "Aplicar Filtro"
download_csv: "Baixar CSV"
total_productions: "Total de Produções"
total_value: "Valor Total"
products: "Produtos"
production_list:
service_order_number: "Número da Ordem de Serviço"
payment_date: "Data de Pagamento"
expected_delivery_date: "Data Prevista de Entrega"
product: "Produto"
quantity: "Quantidade"
pieces_delivered: "Peças Entregues"
unit_price: "Preço Un."
dirty: "Sujo"
error: "Erro"
discard: "Descarte"
returned: "Devolvido"
discount: "Desconto"
total: "Total"
total_discount: "Total de Desconto"
total_to_pay: "Total a Pagar"
missing_pieces:
title: "Produções com Peças Faltantes"
filter_by_tailor: "Filtrar por Costureiro"
Expand Down Expand Up @@ -117,29 +142,5 @@ pt-BR:
edit: "Editar %{model}"
actions:
remove: "Remover"
productions:
unpaid_confirmed:
title: "Cortes Concluídos"
filter_by_tailor: "Filtrar por Costureiro"
all_tailors: "Todos os Costureiros"
apply_filter: "Aplicar Filtro"
download_csv: "Baixar CSV"
total_productions: "Total de Produções"
total_value: "Valor Total"
products: "Produtos"
production_list:
service_order_number: "Número da Ordem de Serviço"
product: "Produto"
quantity: "Quantidade"
pieces_delivered: "Peças Entregues"
unit_price: "Preço Un."
dirty: "Sujo"
error: "Erro"
discard: "Descarte"
returned: "Devolvido"
discount: "Desconto"
total: "Total"
total_discount: "Total de Desconto"
total_to_pay: "Total a Pagar"
yes: "Sim"
no: "Não"
Loading