This commit is contained in:
Abhishek Mali
2025-11-25 13:14:53 +05:30
parent a14fe614e5
commit bebe0711f4
18 changed files with 1105 additions and 623 deletions

View File

@@ -9,34 +9,41 @@ class Invoice extends Model
{
use HasFactory;
protected $fillable = [
'order_id',
'customer_id',
'mark_no',
protected $fillable = [
'order_id',
'customer_id',
'mark_no',
'invoice_number',
'invoice_date',
'due_date',
'invoice_number',
'invoice_date',
'due_date',
'payment_method',
'reference_no',
'status',
'payment_method',
'reference_no',
'status',
'final_amount',
'gst_percent',
'gst_amount',
'final_amount_with_gst',
'final_amount', // without tax
'customer_name',
'company_name',
'customer_email',
'customer_mobile',
'customer_address',
'pincode',
'tax_type', // gst / igst
'gst_percent', // only used for gst UI input
'cgst_percent',
'sgst_percent',
'igst_percent',
'gst_amount', // total tax amount
'final_amount_with_gst',
'customer_name',
'company_name',
'customer_email',
'customer_mobile',
'customer_address',
'pincode',
'pdf_path',
'notes',
];
'pdf_path',
'notes',
];
/****************************
* Relationships
@@ -74,4 +81,16 @@ class Invoice extends Model
{
return $this->status === 'pending' && now()->gt($this->due_date);
}
public function getShipment()
{
return $this->order?->shipments?->first();
}
public function installments()
{
return $this->hasMany(InvoiceInstallment::class);
}
}