Consulta de Clientes

<% javascript 'dynamic_cidades_pesquisa' %> <% form_tag :action => "list" do %> <% usuario = Goldberg.user %> <% colaborador = Colaborador.find(:all, :conditions => "goldberg_users_id = #{usuario.id}") %> <% isVendedor = usuario.role.name == 'Vendedor' %>
Código: <%= text_field 'form', 'id', :size => 4 %> Razão Social: <%= text_field 'form', 'razao_social', :size => 30 %>
CNPJ: <%= text_field 'form', 'cnpj', :size => 17 %> Nome Fantasia: <%= text_field 'form', 'nome_fantasia', :size => 30 %>
UF: <%= collection_select 'form', 'uf', Uf.find(:all, :order => "sigla"), :id, :sigla, :prompt => '' %> Cidade: <%= collection_select 'form', 'cidade', Cidade.find(:all, :order => "nome"), :id, :nome, :prompt => '' %>
Representante: <% if isVendedor %> <%= select 'form', 'colaborador', [[colaborador[0].nome, colaborador[0].id]], :include_blank => false %> <% else %> <%= collection_select 'form', 'colaborador', Colaborador.find(:all, :order => "nome"), :id, :nome, :prompt => '' %> <% end %> Grupo: <%= collection_select 'form', 'grupo', GrupoCliente.find(:all, :order => "descricao"), :id, :descricao, :prompt => '' %>
Ordem: <%= select 'form', 'ordem', Cliente::ORDENACAO_RELATORIO_ANALITICO %> Status: <%= select 'form', 'status', Cliente::OPCOES_STATUS, :include_blank => true %>
Fornecedor: <%= collection_select 'form', 'fornecedor', Fornecedor.find(:all, :order => "razao_social", :conditions => "ativo = 1"), :id, :razao_social, {}, :multiple => true, :size => 10 %>
Produto: <%= collection_select 'form', 'produto', Produto.find(:all, :order => "nome"), :id, :nome, {}, :multiple => true, :size => 10 %>
<%= submit_tag 'Buscar', :name => "submit" %><%= submit_tag 'Rel. Sintético', :name => "submit" %><%= submit_tag 'Rel. Analítico', :name => "submit" %>
<% end %>