D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreListarVencimentoCpCr.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GreListarVencimentoCpCr * * @copyright (c) year, Carlos Marques - CM */ class GreListarVencimentoCpCr { private $Resultado; private $PageId; private $datafi; public function listMovCpCr($PageId = null, $Dados = null) { $this->PageId = (int) $PageId; if(!empty( filter_input_array(INPUT_POST, FILTER_DEFAULT))) { $this->Dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); }else{ $this->Dados = filter_input_array(INPUT_GET, FILTER_DEFAULT); } $listMovCpCr = new \App\adms\Models\helper\AdmsRead(); $listMovCpCr->fullRead("SELECT cp.data_vencimento vencimento, max(cp.gre_cp_cr_tipo_id) gre_cp_cr_tipo_id, max(tipo.nome) tipo_nome, max(cp.gre_filial_id) gre_filial_id, max(filial.nome_fantasia) filial_nome, max(cp.gre_empr_princ_id) gre_empr_princ_id, cp.gre_cp_cr_conta_id, max(conta.nome) conta_nome, sum(cp.valor) valor_original, case when cp.data_vencimento < curdate() THEN round(max(cp.valor_juros_dia) * datediff(curdate(), cp.data_vencimento),2) else 0 end valor_juros, case when cp.data_vencimento < curdate() THEN max(cp.valor_multa) else 0 end valor_multa FROM gre_cp_cr cp join gre_cp_cr_tipo_conta tipo on tipo.id = cp.gre_cp_cr_tipo_id join gre_cp_cr_conta conta on conta.id = cp.gre_cp_cr_conta_id and conta.gre_tipo_id = tipo.id join gre_filial filial on cp.gre_filial_id = filial.id WHERE cp.gre_status_fat_id = 1 and cp.data_vencimento >= :datai and cp.data_vencimento <= :dataf and cp.gre_cp_cr_tipo_id = :tipo and cp.gre_empr_princ_id = :empr_princ_id group by cp.data_vencimento, cp.gre_cp_cr_conta_id order by cp.gre_cp_cr_conta_id, cp.data_vencimento", "datai={$this->Dados['datai']}&dataf={$this->Dados['dataf']}&tipo={$this->Dados['gre_cp_cr_tipo_id']}&empr_princ_id={$_SESSION['id_user']}"); $this->Resultado = $listMovCpCr->getResultado(); if (!empty( $this->Resultado)) { $this->Resultado[0]['datai'] = $this->Dados['datai']; $this->Resultado[0]['dataf'] = $this->Dados['dataf']; //var_dump($this->Resultado); return $this->Resultado; } } }