diff --git a/vendor/model/Documents.class.php b/vendor/model/Documents.class.php index e8f246f..42a379f 100644 --- a/vendor/model/Documents.class.php +++ b/vendor/model/Documents.class.php @@ -107,7 +107,7 @@ class Documents } /** Lista todos os egistros do banco com ou sem paginação*/ - public function All(? int $start, ? int $max, ? int $documentsCategorysId, ? string $tag, ? string $label, ? int $companyId) + public function All(? int $start, ? int $max, ? int $documentsCategorysId, ? string $tag, ? string $label, ? bolean $companyId) { /** Parametros de entrada */ $this->start = $start; @@ -131,9 +131,13 @@ class Documents } /** Se houver um cliente informado, crio o filtro de consulta */ - if($this->companyId > 0){ + if($this->companyId === true){ - $this->and = " and d.company_id = {$this->companyId}"; + $this->and = " and company_id is not null"; + + } elseif ($this->companyId === false) { + + $this->and = " and company_id is null"; } /** Consulta SQL */ @@ -153,7 +157,7 @@ class Documents from documents d left join companies c on d.company_id = c.company_id left join documents_categorys dc on d.documents_categorys_id = dc.documents_categorys_id - where d.company_id is not null '; + where d.documents_id is not null '; $this->sql .= $this->and; @@ -172,7 +176,7 @@ class Documents } /** Conta a quantidades de registros */ - public function Count(? int $documentsCategorysId, ? string $tag, ? string $label, ? int $companyId) + public function Count(? int $documentsCategorysId, ? string $tag, ? string $label, ? bolean $companyId) { /** Parametros de entraa */ $this->documentsCategorysId = $documentsCategorysId; @@ -189,15 +193,19 @@ class Documents } /** Se houver um cliente informado, crio o filtro de consulta */ - if($this->companyId > 0){ + if($this->companyId === true){ - $this->and = " and company_id = {$this->companyId}"; + $this->and = " and company_id is not null"; + + } elseif ($this->companyId === false) { + + $this->and = " and company_id is null"; } /** Consulta SQL */ $this->sql = 'select count(documents_id) as qtde from documents - where company_id is not null + where documents_id is not null '.$this->and; /** Preparo o SQL para execução */ diff --git a/vendor/view/documents/documents_datagrid.php b/vendor/view/documents/documents_datagrid.php index 4132740..844499e 100644 --- a/vendor/view/documents/documents_datagrid.php +++ b/vendor/view/documents/documents_datagrid.php @@ -6,9 +6,6 @@ use vendor\model\Documents; use vendor\model\DocumentsCategorys; use vendor\controller\documents\DocumentsValidate; -error_reporting(E_ALL); -ini_set('display_errors', 'On'); - /** Verifica se o token de acesso é válido */ if($Main->verifyToken()){ @@ -33,7 +30,8 @@ if($Main->verifyToken()){ $max = isset($settings->{'app'}->{'datagrid'}->{'rows'}) ? $settings->{'app'}->{'datagrid'}->{'rows'} : 20; /** Consulta a quantidade de registros */ - $NumberRecords = $Documents->Count((int)$documentsCategorysId, (string)$tag, (string)$label, null); + $NumberRecords = $Documents->Count((int)$documentsCategorysId, (string)$tag, (string)$label, true); + $NumberRecords += $Documents->Count((int)$documentsCategorysId, (string)$tag, (string)$label, false); /** Cores do card */ $colors = [ 'success', 'info', 'warning', 'danger', 'secondary']; @@ -120,7 +118,7 @@ if($Main->verifyToken()){ All($start, $max, (int)$documentsCategorysId, (string)$tag, (string)$label, null); + $DocumentsResult = $Documents->All($start, $max, (int)$documentsCategorysId, (string)$tag, (string)$label, true); foreach($DocumentsResult as $DocumentsKey => $Result){ ?> @@ -153,7 +151,60 @@ if($Main->verifyToken()){
- kkkkk + +
+ + + + + + + + + + + + + + + + + + All($start, $max, (int)$documentsCategorysId, (string)$tag, (string)$label, false); + foreach($DocumentsResult as $DocumentsKey => $Result){ + ?> + + + + + + + + + + + + + + + + + + + + + +
DataDescriçãoCliente
setZeros($Result->documents_id, 3);?>date_register));?>description;?>name_fantasy;?>
+ + pagination($NumberRecords, $start, $max, $page, 'FOLDER=view&ACTION=documents_datagrid&TABLE=documents', 'Aguarde'); ?> + +
+ +
+