<?php

class Sinistro2_ValoresvistoriaController extends Agro_Controller_Action {
	public $_columnList = array(
		'tipo_vistoria' => array('label' => 'Tipo Vistoria', 'align' => 'center'),
		'grupo_vistoria' => array('label' => 'Grupo Vistoria', 'align' => 'center'),
		'vl_area_minima' => array('label' => 'Área Mínima', 'align' => 'center'),
		'vl_area_maxima' => array('label' => 'Área Máxima', 'align' => 'center'),
		'vl_custo_vistoria' => array('label' => 'Custo Vistoria (R$)', 'align' => 'center', 'type' => 'currency')
	);
	
	public function setBack() {
		$this->view->back = '/sinistro2/valoresvistoria';
	}
	
	public function init() {
		$this->view->title = 'Sinistro » Cobrança » Configurações » Valores de Vistoria';
	}
	
	public function getModel() {
		return new Sinistro2_Model_Valoresvistoria();
	}
	
	public function getForm() {
		return new Sinistro2_Form_Valorvistoria();
	}
	
	public function getFilter() {
		$where = array();

		if ($this->getRequest()->getParam('id_tipo_vistoria')) {
			$where[] = array (
				'field' => 'id_tipo_vistoria',
				'operator' => '=',
				'value' => $this->getRequest()->getParam('id_tipo_vistoria')
			);
		}
				
		if ($this->getRequest()->getParam('id_grupo_vistoria')) {
			$where[] = array (
				'field' => 'id_grupo_vistoria',
				'operator' => '=',
				'value' => $this->getRequest()->getParam('id_grupo_vistoria')
			);
		}		
		
		if ($this->getRequest()->getParam('fl_ativo')) {
			$where[] = array (
				'field' => 'fl_ativo',
				'operator' => '=',
				'value' => $this->getRequest()->getParam('fl_ativo')
			);
		}
		
		return $where;
	}
	
}