D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreIncluiBoletoCp.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GreCadastrarPreco * * @copyright (c) year,Carlos Marques CM */ class GreIncluiBoletoCp { private $Resultado; private $Dados; private $DadosFat; private $DadosFatiD; private $DadosCP; function getResultado() { return $this->Resultado; } public function incluiBol() { $lerFat = new \App\adms\Models\helper\AdmsRead(); $lerFat->fullRead("select 0, fat.id fat_id, fat.docto, fat.gre_banco_id, fat.nosso_numero, date_format(fat.data_emissao_boleto, '%Y-%m-%d') emissao, date_format(fat.vencimento, '%Y-%m-%d') vencimento, fat.valor_fatura, valor_juros_dia, valor_multa, 1, 1, fat.gre_empr_princ_id, fat.gre_filial_id, resid.gre_contratante_id, fat.gre_residente_id, 1, now() from gre_cab_fatura fat join gre_residente resid on resid.id = fat.gre_residente_id where fat.gre_status_fat_id = 7 and fat.gre_empr_princ_id = " . $_SESSION['id_user']); $this->Resultado= $lerFat->getResultado(); foreach ($this->Resultado as $cp) { extract($cp); $this->DadosCP['gre_cab_fat_id'] = $fat_id; $this->DadosCP['docto'] = $docto; $this->DadosCP['gre_banco_id'] = $gre_banco_id; $this->DadosCP['nosso_numero'] = $nosso_numero; $this->DadosCP['data_emissao'] = $emissao; $this->DadosCP['data_vencimento'] = $vencimento; $this->DadosCP['valor'] = $valor_fatura; $this->DadosCP['valor_juros_dia'] = $valor_juros_dia; $this->DadosCP['valor_multa'] = $valor_multa; $this->DadosCP['gre_cp_cr_tipo_conta_id'] = 1; $this->DadosCP['gre_cp_cr_conta_id'] = 1; $this->DadosCP['gre_empr_princ_id'] = $gre_empr_princ_id; $this->DadosCP['gre_filial_id'] = $gre_filial_id; $this->DadosCP['gre_contratante_id'] = $gre_contratante_id; $this->DadosCP['gre_residente_id'] = $gre_residente_id; $this->DadosCP['gre_status_fat_id'] = 1; $this->DadosCP['created'] = date("Y-m-d H:i:s"); var_dump($this->DadosCP); $cadCP = new \App\adms\Models\helper\AdmsCreate; $cadCP->exeCreate("gre_cp_cr", $this->DadosCP); if (!$cadCP->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Boleto gerado com sucesso! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = true; } else { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Boleto não foi gerado! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } } }