chore: initial commit of existing codebase
This commit is contained in:
commit
11e94889b2
292 files changed
+38586
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SupplierInvoice extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['invoice_number', 'supplier_id', 'purchase_order_id', 'goods_receipt_note_id', 'invoice_date', 'due_date', 'subtotal', 'vat_amount', 'total_amount', 'paid_amount', 'status', 'notes'];
|
||||
|
||||
protected $casts = [
|
||||
'invoice_date' => 'date',
|
||||
'due_date' => 'date',
|
||||
'subtotal' => 'decimal:2',
|
||||
'vat_amount' => 'decimal:2',
|
||||
'total_amount' => 'decimal:2',
|
||||
'paid_amount' => 'decimal:2',
|
||||
];
|
||||
|
||||
public function supplier()
|
||||
{
|
||||
return $this->belongsTo(Supplier::class);
|
||||
}
|
||||
|
||||
public function purchaseOrder()
|
||||
{
|
||||
return $this->belongsTo(PurchaseOrder::class);
|
||||
}
|
||||
|
||||
public function goodsReceiptNote()
|
||||
{
|
||||
return $this->belongsTo(GoodsReceiptNote::class);
|
||||
}
|
||||
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasMany(SupplierPayment::class);
|
||||
}
|
||||
|
||||
public function getOutstandingAttribute()
|
||||
{
|
||||
return $this->total_amount - $this->paid_amount;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user