✏️ 正在编辑: EmprestimoPj.php
路径:
/srv/systems_dir/yuppiecred/application/forms/Filtro/EmprestimoPj.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Form_Filtro_EmprestimoPj extends Core_Form { public function init() { $this->setMethod('post'); $this->setName('f_filtro_proposta'); $this->setAttrib('autocomplete', 'off'); $this->addElement('select', 'banco_id', array( 'label' => 'Banco:', 'multiOptions' => Core_Combos::getBancosOptions() )); $this->addElement('select', 'convenio_id', array( 'label' => 'Convênio:', 'multiOptions' => Core_Combos::getConveniosOptions(), 'class' => 'comboautocomplete' )); $select = new Zend_Form_Element_Select('gerente_id'); $select->setLabel('Supervisor:') ->addMultiOptions(Core_Combos::getSupervisoresOptions()); $this->addElement($select); $this->addElement('text', 'numero_contrato', array( 'label' => 'Nº Contrato:', 'size' => 10, 'onkeypress' => 'mascara(this, soNumeros)' )); $this->addElement('text', 'numero_ade', array( 'label' => 'Nº ADE:', 'size' => 10, 'onkeypress' => 'mascara(this, soNumeros)' )); $select = new Zend_Form_Element_Select('empresa_id'); $select->setLabel('Empresa') ->addMultiOptions(Core_Combos::getEmpresasOptions()); $this->addElement($select); $this->addElement('text', 'cpf', array( 'label' => 'CNPJ Cliente:', 'maxlength' => 14, 'onkeypress' => 'mascara(this, soNumeros)', 'size' => 14 )); $this->addElement('text', 'digitador', array( 'label' => 'Digitador:' )); if( Yuppie_Auth::getIdentity()->grupo == 'Supervisor' ){ $corretores = Core_Combos::getCorretoresBySupervisorOptions(); $select = new Zend_Form_Element_Select('corretor_id'); $select->setLabel('Corretor:') ->addMultiOptions($corretores); $this->addElement($select); }else{ $corretores = Core_Combos::getCorretoresOptions(true); $select = new Zend_Form_Element_Select('corretor_id'); $select->setLabel('Corretor:') ->addMultiOptions($corretores); $this->addElement($select); } $this->addElement('select', 'usuario_impresso', array( 'label' => 'Impressos:', 'multiOptions' => array( '' => '', 'Sim' => 'Sim', 'Nao' => 'Nao' ) )); $this->addMultiOptionElement('impresso_por', 'Impresso por:', 'multiselect', array_filter(Core_Combos::getUsuariosLoginOptions())); $this->addSelect('captador_id', 'Captador:', $corretores); $this->getElement('captador_id') ->setAttrib("class", "comboautocomplete"); $this->addElement('select', 'digitado_banco', array( 'label' => 'Situação:', 'multiOptions' => ['' => ''] + Core_Combos::getSituacaoDigitacaoProposta(), 'value' => '0' )); $this->getElement('digitado_banco') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('select', 'anexo_formulario', array( 'label' => 'Reanexo formulário:', 'multiOptions' => array( '' => '', 'Sim' => 'Sim', 'Nao' => 'Nao' ))); $select = new Zend_Form_Element_Select('grupo_comissao'); $select->setLabel('Grupo Comissão:') ->addMultiOptions(Core_Combos::getGruposComissaoOptions()); $this->addElement($select); $select = new Zend_Form_Element_Select('tipo_produto'); $select->setLabel('Tipo Contrato:') ->addMultiOptions(Core_Combos::getTiposProdutosPropostasOptions()); $this->addElement($select); $select = new Zend_Form_Element_Select('midia_origem_id'); $select->setLabel('Mídia de Origem:') ->addMultiOptions(Core_Combos::getMidiasOrigemOptions()); $this->addElement($select); $this->addElement(Form_DatePicker::getDatePicker('data_emissao_de', 'Data Emissão de:')); $this->addElement(Form_DatePicker::getDatePicker('data_emissao_a', 'a:')); $this->getElement('data_emissao_de') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement(Form_DatePicker::getDatePicker('data_digitacao_de', 'Data Digitação de:', Zend_Date::now()->subDay(30)->get('dd/MM/yyyy'))); $this->addElement(Form_DatePicker::getDatePicker('data_digitacao_a', 'a:', Zend_Date::now()->get('dd/MM/yyyy'))); $this->getElement('data_digitacao_de') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('submit', 'btn_filter', array( 'label' => 'Buscar', 'class' => 'bt_find', )); $this->getElement('btn_filter')->removeDecorator('Label'); $this->addElement('button', 'btn_new', array( 'label' => 'Nova Digitação', 'class' => 'bt_new', 'onclick' => "window.location='" . $this->getView()->baseUrl() . "/emprestimo-pj/save'" )); $this->addDisplayGroup([ 'btn_filter', 'btn_new', ], 'buttons'); $this->_setDefaultDecorators(); if (Yuppie_Auth::getIdentity()->grupo == 'Corretor' || !empty(Yuppie_Auth::getIdentity()->corretor_id)) { $this->removeElement('gerente_id'); $this->removeElement('empresa_id'); $this->removeElement('grupo_comissao'); } } protected function _setDefaultDecorators() { $this->setDecorators( array( 'FormElements', array( 'HtmlTag', array( 'tag' => 'dl', 'class' => 'filtro_contrato' ) ), 'Form' )); } public function isValid($data) { if (!empty($data['numero_contrato']) || !empty($data['numero_ade']) || !empty($data['cpf']) ) { return parent::isValid($data); } if (!empty($data['data_emissao_de']) && !empty($data['data_emissao_a'])) { $dataInicial = new Zend_Date($data['data_emissao_de'], 'dd/MM/YYYY'); $dataFinal = new Zend_Date($data['data_emissao_a'], 'dd/MM/YYYY'); $intervalo = $dataFinal->sub($dataInicial)->toValue(); $dias = (int) ceil($intervalo/60/60/24); if ($dias > 30) { $this->getElement('data_emissao_a') ->addError("Atenção. O intervalo de emissão NÃO pode ser maior que 30 dias."); return false; } return parent::isValid($data); } if (!empty($data['data_digitacao_de']) && !empty($data['data_digitacao_a'])) { try { $dataInicial = new Zend_Date($data['data_digitacao_de'], 'dd/MM/YYYY'); $dataFinal = new Zend_Date($data['data_digitacao_a'], 'dd/MM/YYYY'); } catch (Zend_Date_Exception $e) { $this->getElement('data_digitacao_a') ->addError("Data de digitação inválida. Favor verificar e preencher com uma data correta"); return false; } $intervalo = $dataFinal->sub($dataInicial)->toValue(); $dias = (int) ceil($intervalo/60/60/24); if ($dias > 30) { $this->getElement('data_digitacao_a') ->addError("Atenção. O intervalo de digitação NÃO pode ser maior que 30 dias."); return false; } return parent::isValid($data); } $this->getElement('data_digitacao_a') ->addError("Atenção. É preciso informar datas de Emissão ou Digitação."); } }
💾 保存文件
← 返回文件管理器