D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreListarMovimentoCpCr.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GreListarMovimentoCpCr * * @copyright (c) year, Carlos Marques - CM */ class GreListarMovimentoCpCr { private $Resultado; private $PageId; private $LimiteResultado = 40; private $ResultadoPg; private $datafi; function getResultadoPg() { return $this->ResultadoPg; } 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); } $paginacao = new \App\adms\Models\helper\AdmsPaginacao(URLADM . 'list-movimento-cp-cr/listar'); $paginacao->condicao($this->PageId, $this->LimiteResultado); if($_SESSION['filial']== 0){ $paginacao->paginacao("SELECT COUNT(*) AS num_result FROM gre_cp_cr WHERE data_vencimento >= :datai and data_vencimento <= :dataf and gre_cp_cr_tipo_id = :tipo and gre_empr_princ_id = :empr_princ_id" , "datai={$this->Dados['datai']}&dataf={$this->Dados['dataf']}&tipo={$this->Dados['gre_cp_cr_tipo_id']}&empr_princ_id={$_SESSION['id_user']}"); }else{ $paginacao->paginacao("SELECT COUNT(*) AS num_result FROM gre_cp_cr WHERE data_vencimento >= :datai and data_vendimento <= :dataf and gre_cp_cr_tipo_id = :tipo and gre_filial_id = :filial and gre_status_fat_id = 1 and gre_empr_princ_id = :empr_princ_id" , "datai={$this->Dados['datai']}&dataf={$this->Dados['dataf']}&tipo={$this->Dados['gre_cp_cr_tipo_id']}&empr_princ_id={$_SESSION['id_user']}&filial={$_SESSION['filial']}"); } $this->ResultadoPg = $paginacao->getResultado(); $listMovCpCr = new \App\adms\Models\helper\AdmsRead(); $listMovCpCr->fullRead("SELECT mov.id, conta.nome conta_nome, mov.nome_titular, tipo.nome tipo_nome, mov.docto, mov.gre_cp_cr_tipo_id, mov.gre_empr_princ_id, mov.gre_filial_id, filial.nome_fantasia filial_nome, DATE_FORMAT(mov.data_emissao,'%d/%m/%Y') emissao, DATE_FORMAT(mov.data_vencimento,'%d/%m/%Y') vencimento, FORMAT(mov.valor, 2, 'de_DE') valor, mov.valor valor_fatura FROM gre_cp_cr mov join gre_filial filial on filial.id = mov.gre_filial_id join gre_cp_cr_tipo_conta tipo on tipo.id = mov.gre_cp_cr_tipo_id join gre_cp_cr_conta conta on conta.gre_tipo_id = mov.gre_cp_cr_tipo_id and conta.id = mov.gre_cp_cr_conta_id WHERE mov.gre_status_fat_id = 1 and mov.data_vencimento >= :datai and mov.data_vencimento <= :dataf and mov.gre_cp_cr_tipo_id = :tipo and mov.gre_empr_princ_id = :empr_princ_id and mov.gre_filial_id = :gre_filial_id order by mov.data_vencimento ASC LIMIT :limit OFFSET :offset", "limit={$this->LimiteResultado}&offset={$paginacao->getOffset()}&datai={$this->Dados['datai']}&dataf={$this->Dados['dataf']}&tipo={$this->Dados['gre_cp_cr_tipo_id']}&empr_princ_id={$_SESSION['id_user']}&gre_filial_id={$this->Dados['gre_filial_id']}"); $this->Resultado = $listMovCpCr->getResultado(); if (!empty( $this->Resultado)) { $this->Resultado[0]['datai'] = $this->Dados['datai']; $this->Resultado[0]['dataf'] = $this->Dados['dataf']; return $this->Resultado; } } }