<?php

class Comercializacao_Form_Taxausuario extends Agro_Form {

	public function init() {
		$this->addElement('hidden', 'id', array('decorators' => $this->buttonDecorator));

        $this->addElement('text', 'id_taxa', array(
          'decorators' => $this->elementDecorator,
          'label' => 'ID_Taxa',
          'size' => 10
        ));

		$Safras = new Comercializacao_Model_Safras();
		$this->addElement('select', 'id_safra', array(
			'decorators' => $this->elementDecorator,
			'MultiOptions' => $Safras->getCombo(),
			'value' => $Safras->safraCurrent,
			'label' => 'Safra',
			'required' => true
		));

		$this->addElement('select', 'id_safra_search', array(
			'decorators' => $this->elementDecorator,
			'MultiOptions' => $Safras->getCombo(),
			'value' => $Safras->safraCurrent,
			'label' => 'Safra',
			'required' => false
		));

        $modelProdutoSafras = new Produto_Model_Safras();
		$this->addElement('select', 'id_produto', array(
			'decorators' => $this->elementDecorator,
			'MultiOptions' => $modelProdutoSafras->getComboProdutoSafraRequest($modelProdutoSafras->safraCurrent),
			'RegisterInArrayValidator' => false,
			'label' => 'Produto',
			'required' => true
		));

		$this->addElement('text', 'ds_nome_agrupamento_taxas', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Nome',
			'required' => true,
			'size' => 60
		));

		$this->addElement('text', 'vl_comissao', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Comissão',
			'required' => true,
			'size' => 20,
			'class' => 'decimal'
		));

		$this->addElement('select', 'cpf_cnpj_combo', array(
			'MultiOptions' => array( 0 => '', 1 => 'CPF', 2 => 'CNPJ'),
			'decorators' => $this->elementDecorator,
			'label' => 'CPF/CNPJ'
		));

		$this->addElement('text', 'cpf_cnpj_search', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Valor',
			'size' => 30
		));

		$this->addElement('select', 'fl_ativo', array(
			'MultiOptions' => array(0=>'Não',1=>'Sim'),
			'decorators' => $this->elementDecorator,
			'label' => 'Ativo'
		));
		
		$this->addElement('select', 'id_secao', array(
				'MultiOptions' => array(''=>'', 1=>'1', 2=>'2', 3=>'3'),
				'decorators' => $this->elementDecorator,
				'label' => 'Seção '
		));

		$Estados = new Sistema_Model_Estados();
		$this->id_estado_search = $this->createElement('select', 'id_estado_search');
		$this->id_estado_search->setDecorators($this->elementDecorator);
		$this->id_estado_search->addMultiOptions($Estados->getCombo());
		$this->id_estado_search->setLabel('Estado');
		$this->id_estado_search->setRequired(false);
		$this->addElement($this->id_estado_search);

        $this->addElement('select', 'id_estado', array(
          'decorators' => $this->elementDecorator,
          'MultiOptions' => $Estados->getCombo(),
          'RegisterInArrayValidator' => false,
          'label' => 'Estado',
          'required' => false
        ));

		$this->id_municipio_search = $this->createElement('select', 'id_municipio_search');
		$this->id_municipio_search->setDecorators($this->elementDecorator);
		$this->id_municipio_search->setRequired(false);
		$this->id_municipio_search->setLabel('Município');
		$this->id_municipio_search->setRegisterInArrayValidator(false);
		$this->addElement($this->id_municipio_search);

        $this->addElement('select', 'id_municipio', array(
          'decorators' => $this->elementDecorator,
          'RegisterInArrayValidator' => false,
          'label' => 'Município',
          'required' => false
        ));
	}
}
