✏️ 正在编辑: PropostaEmprestimoPj.php
路径:
/srv/systems_dir/yuppiecred/application/forms/PropostaEmprestimoPj.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Form_PropostaEmprestimoPj extends Core_Form { public function init() { $ns = new Zend_Session_Namespace(); $params = $this->_getParams(); $this->setName('f_save_proposta'); $this->setAttrib('autocomplete', 'off'); $this->addElement('hidden', 'id', array( 'class' => 'invisivel' )); $this->addElement('hidden', 'token', array( 'class' => 'invisivel', 'value' => "proposta_" . md5(time()) )); $select = new Zend_Form_Element_Select('subestabelecido_id'); $select->setLabel('Subestabelecido:') ->addMultiOptions(Core_Combos::getSubestabelecidosOptions()); $this->addElement($select); $this->addElement('text', 'cpf', array( 'label' => 'CNPJ:', 'onkeypress' => 'mascara(this, soNumeros)', 'maxlength' => 14, 'required' => true, 'validators' => array( new Validators_Cnpj()), 'class' => 'load-data-client' )); $this->addElement('text', 'nome', array( 'label' => 'Razão Social:', 'required' => true, 'size' => 30, )); $this->addElement('text', 'endereco', array( 'label' => 'Endereço:', 'size' => 30, )); $this->addElement('text', 'complemento', array( 'label' => 'Complemento:', 'size' => 30, )); $this->addElement('text', 'bairro', array( 'label' => 'Bairro:', )); $this->addElement('text', 'cidade', array( 'label' => 'Cidade:', )); $this->addElement('text', 'uf', array( 'label' => 'UF:', 'maxlength' => 2, 'size' => 3, 'validators' => array( new Validators_Uf() ) )); $this->addElement('text', 'cep', array( 'label' => 'CEP:', 'maxlength' => 8 )); $this->addElement('text', 'email', array( 'label' => 'E-mail:', 'validators' => array( 'EmailAddress' ), 'size' => 30 )); $this->addElement('text', 'celular', array( 'label' => 'Celular:', 'onkeypress' => 'mascara(this, telefone)', 'maxlength' => 15, 'class' => 'consulta-fone-nao-perturbe', 'size' => 15 )); $this->addElement('text', 'telefone_comercial', array( 'label' => 'Fone Comercial:', 'onkeypress' => 'mascara(this, telefone)', 'maxlength' => 15, 'class' => 'consulta-fone-nao-perturbe', 'size' => 15 )); $this->addElement('text', 'nome_representante', [ 'label' => 'Nome Responsável:', 'size' => 30, ]); $this->addElement('text', 'cpf_representante', [ 'label' => 'CPF Responsável:', 'onkeypress' => 'mascara(this, fcpf)', 'maxlength' => 14, 'validators' => [new Validators_Cpf()], 'class' => 'load-data-client', ]); $select = new Zend_Form_Element_Select('banco_id'); $select->setLabel('Banco:') ->setRequired(true) ->addMultiOptions(Core_Combos::getBancosOptions()); $this->addElement($select); $select = new Zend_Form_Element_Select('convenio_id'); $select->setLabel('Convênio:') ->setRequired(true) ->addMultiOptions(Core_Combos::getConveniosOptions()) ->setAttrib('onchange', "populateComboTabelas(this.id, 'tabela_id', 'banco_id')") ->setAttrib('class', "comboautocomplete"); $this->addElement($select); $select = new Zend_Form_Element_Select('tabela_id'); $select->setLabel('Tabela:') ->setRegisterInArrayValidator(false); $this->addElement($select); $select = new Zend_Form_Element_Select('corretor_id'); $select->setLabel('Corretor:') ->setRequired(true) ->addMultiOptions(Core_Combos::getCorretoresOptions(true)); $this->addElement($select); $select = new Zend_Form_Element_Select('tipo'); $select->setLabel('Tipo:') ->addMultiOptions(Core_Combos::getTiposProdutosPropostasOptions()) ->setAttrib('onchange', "populateComboProdutos('banco_id', 'produto'); addCamposDigitacaoProposta()") ->setRequired(true); $this->addElement($select); $this->addElement(Form_DatePicker::getDatePicker('data_emissao', 'Data de Emissão:', date('d/m/Y'), true)); $this->getElement('data_emissao')->addValidator(new Validators_DataContrato()); $this->addElement('text', 'prazo', array( 'label' => 'Prazo:', 'required' => true, 'size' => 10, 'onkeypress' => 'mascara(this, soNumeros)' )); $select = new Zend_Form_Element_Select('forma_liberacao'); $select->setLabel('Forma de Liberação:') ->setAttrib('class', 'not_multiselect') ->addMultiOptions(Core_Combos::getFormasLiberacaoOptions()); $this->addElement($select); $select = new Zend_Form_Element_Select('produto'); $select->setLabel('Produto:') ->setRegisterInArrayValidator(false); $this->addElement($select); $this->addElement('text', 'digitador', array( 'label' => 'Digitador:', 'value' => Yuppie_Auth::getIdentity()->login, 'readonly' => true, 'size' => 30, )); $this->addElement('text', 'numero_contrato', array( 'label' => 'Nº Contrato:', 'size' => 20, 'onkeypress' => 'mascara(this, soNumeros)' )); $this->addElement('text', 'numero_ade', array( 'label' => 'Nº ADE:', 'size' => 20, 'onkeypress' => 'mascara(this, soNumeros)' )); $this->addElement('text', 'valor_bruto', array( 'label' => 'Valor Bruto (R$):', 'size' => 10, 'onkeypress' => 'mascara(this, mvalor)', 'required' => true, 'placeholder' => '0,00' )); $this->addElement('text', 'valor_liquido', array( 'label' => 'Valor Líquido (R$):', 'size' => 10, 'onkeypress' => 'mascara(this, mvalor)', 'required' => true, 'placeholder' => '0,00' )); $this->addElement('text', 'valor_prestacao', [ 'label' => 'Valor Parcela (R$):', 'size' => 10, 'onkeypress' => 'mascara(this, mvalor)', 'placeholder' => '0,00' ]); $select = new Zend_Form_Element_Select('banco_beneficiado'); $select->setLabel('Banco do Beneficiado:') ->addMultiOptions(Core_Combos::getBancosFebrabanOptions()); $this->addElement($select); $this->addElement('text', 'agencia_beneficiado', array( 'label' => 'Agência do Beneficiado:', 'size' => 10, )); $this->addElement('text', 'operacao_beneficiado', array( 'label' => 'Operação:', 'size' => 10, 'onkeypress' => 'mascara(this, soNumeros)' )); $this->addElement('text', 'conta_beneficiado', array( 'label' => 'Conta do Beneficiado:', 'size' => 10, )); $select = new Zend_Form_Element_Select('midia_origem_id'); $select->setLabel('Mídia de Origem:') ->addMultiOptions(Core_Combos::getMidiasOrigemOptions()); $this->addElement($select); if ($ns->acl->isAllowed(Yuppie_Auth::getIdentity()->grupo, "midia-origem-obrigatório")){ $this->getElement('midia_origem_id')->setRequired(); } $select = new Zend_Form_Element_Select('digitado_banco'); $select->setLabel('Situação:') ->addMultiOptions([''] + Core_Combos::getSituacaoDigitacaoProposta()); $this->addElement($select); $select = new Zend_Form_Element_Select('tipo_pix'); $select->setLabel('Tipo de Chave PIX:') ->addMultiOptions(['' => ''] + Core_Combos::getTipoPix()); $this->addElement($select); $this->getElement('tipo_pix')->setAttribs([ 'onchange' => 'changeKeyPix()' ]); $this->addElement('text', 'chave_pix', [ 'label' => 'Chave PIX:', 'size' => 30, ]); $this->addElement(Form_DatePicker::getDatePicker('data_agendamento_proposta', 'Formalização Agendada:')); $this->addElement('text', 'hora_agendada', array( 'label' => 'Hora agendada:', 'onkeypress' => 'mascara(this, hora)', 'maxlength' => 5, 'size' => 10 )); $multiOptions = array('' => '') + Core_Combos::getTipoContratoAnexoOptions(); $this->addElement('select', 'tipo_id', array( 'label' => 'Tipo anexo:', 'multiOptions' => $multiOptions )); $file = new Zend_Form_Element_File('arquivo'); $file->setLabel('Arquivo:'); $file->addValidator('Extension', false, 'jpg,pdf,png,bmp,wav,mp3,amr'); $file->addValidator('Size', false, '1MB'); $this->addElement($file); $this->addElement('button', 'adicionar', array( 'label' => 'Adicionar', 'class' => 'load-anexos', 'onClick' => 'addAnexoProposta()', 'style' => 'margin-left: 40px' )); $element = $this->getElement('adicionar'); $element->removeDecorator('DtDdWrapper'); $this->addElement('textarea', 'obs', array( 'label' => 'OBS:', 'cols' => 92, 'rows' => 5 )); $this->addElement('button', 'btn_back', array( 'label' => 'Voltar', 'class' => 'bt_back', 'onclick' => "window.location='" . $this->getView()->baseUrl() . "/emprestimo-pj'" )); $this->addElement('submit', 'btn_save', array( 'label' => 'Salvar', 'class' => 'bt_save', 'onClick' => 'cleanExit()' )); $this->addElement('button', 'btn_new', array( 'label' => 'Novo Cadastro', 'class' => 'bt_new', 'onclick' => "window.location='" . $this->getView()->baseUrl() . "/emprestimo-pj/save'" )); if( isset($params['id']) && $params['id'] > 0 ){ $this->addElement('button', 'btn_efetivar', array( 'label' => 'Efetivar', 'class' => 'bt_efetivar bt_apply', 'onclick' => "window.location='" . $this->getView()->baseUrl() . "/emprestimo-pj/efetivar/id/{$params['id']}'" )); } $this->_agruparCampos(); $this->_agruparBotoes(); $this->_setDefaultDecorators(); } protected function _setDefaultDecorators() { $this->setDecorators( array( 'FormElements', array( 'HtmlTag', array( 'tag' => 'dl', 'class' => 'zend_form form_proposta' ) ), 'Form' )); } protected function _agruparCampos() { $this->addDisplayGroup(array( 'cpf', 'nome', 'cep', 'endereco', 'complemento', 'bairro', 'cidade', 'uf', 'email', 'celular', 'telefone_comercial', 'representante_legal', 'nome_representante', 'cpf_representante', ), 'dados_tomador', array( 'legend' => 'Dados do tomador' )); $this->addDisplayGroup(array( 'corretor_id', 'subestabelecido_id', 'banco_id', 'tipo', 'convenio_id', 'tabela_id', 'data_emissao', 'prazo', 'forma_liberacao', 'produto', 'numero_contrato', 'numero_ade', 'valor_bruto', 'valor_liquido', 'valor_prestacao', 'digitador', 'banco_beneficiado', 'agencia_beneficiado', 'operacao_beneficiado', 'conta_beneficiado', 'captador_id', 'midia_origem_id', 'data_agendamento_proposta', 'hora_agendada', 'digitado_banco', 'tipo_pix', 'chave_pix', ), 'dados_liberacao', array( 'legend' => 'Dados para liberação' )); $this->addDisplayGroup(array( 'tipo_id', 'arquivo', 'adicionar', 'obs',), 'dados_agente', array( 'legend' => 'Anexos' )); $this->_pintarCamposObrigatorios(); } protected function _agruparBotoes() { $this->addDisplayGroup([ 'btn_back', 'btn_save', 'btn_new', 'btn_efetivar', ], 'buttons'); foreach ( $this->getDisplayGroups() as $displayGroup ) { $displayGroup->removeDecorator('DtDdWrapper'); $displayGroup->removeDecorator('HtmlTag'); if( $displayGroup->getName() == 'buttons' ){ foreach ( $displayGroup->getElements() as $element ) { $element->setDecorators(array( 'ViewHelper' )); } } } } public function populateSave($values){ return $this->populate($values); } public function populate(array $values) { $filter = new Core_FilterValor; $values['valor_bruto'] = number_format($filter->filter($values['valor_bruto']), 2, ',', '.'); $values['valor_liquido'] = number_format($filter->filter($values['valor_liquido']), 2, ',', '.'); $values['valor_prestacao'] = number_format($filter->filter($values['valor_prestacao']), 2, ',', '.'); $values['data_emissao'] = !empty($values['data_emissao']) && $values['data_emissao'] != '0000-00-00' ? date('d/m/Y', strtotime($values['data_emissao'])) : ''; $values['data_agendamento_proposta'] = !empty($values['data_agendamento_proposta']) && $values['data_agendamento_proposta'] != '0000-00-00' ? date('d/m/Y', strtotime($values['data_agendamento_proposta'])) : ''; $ns = new Zend_Session_Namespace(); $identity = Yuppie_Auth::getIdentity(); if (!empty($values['status']) && $values['status'] == 3) { $this->removeElement('btn_efetivar'); if ($ns->acl->isAllowed($identity->grupo, 'visualizar-motivo-anti-fraude')) { $alert = new Zend_Controller_Action_Helper_FlashMessenger(); $alert->addMessage(array('error' => "Proposta recusada na esteira anti-fraude. Motivo: {$values['descricao_pendencia']}")); } } if (!empty($values['banco_id']) && !empty($values['tipo']) && $this->getElement('produto') != null) { $this->getElement('produto') ->addMultiOptions(Core_Combos::getProdutosOptions($values)); } if (!empty($values['banco_id']) && !empty($values['convenio_id']) && $this->getElement('tabela_id') != null) { $this->getElement('tabela_id') ->addMultiOptions(Core_Combos::getTabelasOptions($values['convenio_id'], $values['banco_id'])); } return parent::populate($values); } public function _pintarCamposObrigatorios() { foreach ( $this->getElements() as $element ) { if( $element->isRequired() ){ $class = $element->getAttrib('class'); $element->setAttrib("class", $class . ' camp_required'); } } } public function _editElements() { $this->getElement('btn_back')->setAttrib('onclick', "window.close()"); $this->removeElement('btn_save'); $this->removeElement('btn_new'); $this->removeElement('btn_efetivar'); } }
💾 保存文件
← 返回文件管理器