<?php

namespace App\Modelos;

use Core\Database;

class NotasdeentregaArticulos extends Database
{
    protected $table = 'app_notas_de_entrega_articulos';
    protected $id = 'neart_id';

    public function articulos($id_factura)
    {
        return $this->consultar("SELECT * FROM app_notas_de_entrega_articulos neart 
         LEFT JOIN app_productos p ON p.pro_id=neart.neart_proid 
        LEFT JOIN app_impuestos imp ON imp.imp_id=neart.neart_idiva  
        WHERE neart_neid=$id_factura")->all();
    }

    public function obtenerDetalleProductoFacturado($id_factura, $id_producto, $id_alamcen)
    {
        return $this->consultar("SELECT * FROM app_notas_de_entrega_articulos WHERE neart_neid=$id_factura AND (neart_proid=$id_producto AND neart_almid=$id_alamcen)")->row();
    }
}
