<?php

namespace App\Modelos;

use Core\Database;

class EmpleadoComisionDocumento extends Database
{
    protected $table = 'app_empleados_comision_doc';
    protected $id    = 'ecd_id';

    public function obtenerDocumentos(int $id_com_emp)
    {
        return $this->consultar("SELECT doc_id id, doc_prefijo prefijo, doc_descripcion descripcion
        FROM app_documentos 
        WHERE doc_id != 5 AND doc_id != 6 AND doc_id != 7 AND doc_id != 8 AND doc_id != 9 AND doc_id != 10 AND doc_id != 11
        AND doc_id NOT IN (SELECT ecd_docid FROM app_empleados_comision_doc WHERE ecd_empagentipoid = $id_com_emp)")->all();
    }

    public function obtenerComisionDocumentos(int $id_com_emp)
    {
        return $this->consultar("SELECT ecd_id id, doc_id id_documento, doc_prefijo prefijo, doc_descripcion descripcion, ecd_fijo fijo
        FROM app_empleados_comision_doc cd
        JOIN app_documentos d ON d.doc_id = cd.ecd_docid
        WHERE ecd_empagentipoid=$id_com_emp")->all();
    }
}
