<?php

namespace App;

use App\Traits\ModelTimeFormat;
use Illuminate\Database\Eloquent\Model;

use App\Traits\ModelLogChanging;

class OracleDOCASNHeader extends Model
{
    use ModelLogChanging;

    use ModelTimeFormat;
    protected $connection="oracle";
    protected $table="Doc_ASN_Header";

    public function asnType()
    {
        return $this->hasOne(OracleBasCode::class,'code','asntype')
            ->where('codeid','ASN_TYP');
    }

    public function asnStatus()
    {
        return $this->hasOne(OracleBasCode::class,'code','asnstatus')
            ->where('codeid','ASN_STS');
    }

    public function asnDetails()
    {
        return $this->hasMany(OracleDOCASNDetail::class,'asnno','asnno')
            ->select('asnno','asnlineno','customerid','sku','skudescrc','linestatus','lotatt08','lotatt05','receivedqty','expectedqty','addtime','edittime');
    }
}
