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,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SalesInvoice extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['invoice_number', 'sales_order_id', 'customer_id', 'invoice_date', 'due_date', 'subtotal', 'vat_rate', 'vat_amount', 'total_amount', 'paid_amount', 'status', 'notes', 'created_by'];
|
||||
|
||||
protected $casts = [
|
||||
'invoice_date' => 'date',
|
||||
'due_date' => 'date',
|
||||
'subtotal' => 'decimal:2',
|
||||
'vat_rate' => 'decimal:2',
|
||||
'vat_amount' => 'decimal:2',
|
||||
'total_amount' => 'decimal:2',
|
||||
'paid_amount' => 'decimal:2',
|
||||
];
|
||||
|
||||
public function salesOrder()
|
||||
{
|
||||
return $this->belongsTo(SalesOrder::class);
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function paymentReceipts()
|
||||
{
|
||||
return $this->hasMany(PaymentReceipt::class);
|
||||
}
|
||||
|
||||
public function createdBy()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function getOutstandingAttribute()
|
||||
{
|
||||
return $this->total_amount - $this->paid_amount;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user