Add Stargas supplier dashboard with performance analytics

This commit is contained in:
2026-03-05 21:37:37 +02:00
parent a9a1263501
commit 23357e09f5
19 changed files with 9625 additions and 43 deletions

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
protected $table = 'STK_STOCKCATEGORY';
public $timestamps = false;
public function products()
{
return $this->hasMany(Product::class, 'CATEGORY', 'STCKCTGRYCDE');
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
protected $table = 'SL_CUSTOMERACCOUNT';
public $timestamps = false;
public function invoices()
{
return $this->hasMany(CustomerInvoice::class, 'ACCNO', 'DBTRCDE');
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CustomerInvoice extends Model
{
protected $table = 'SL_SALESINVOICE';
public $timestamps = false;
protected $casts = [
'DOCDTETME' => 'datetime',
];
public function customer()
{
return $this->belongsTo(Customer::class, 'ACCNO', 'DBTRCDE');
}
public function lines()
{
return $this->hasMany(CustomerInvoiceLine::class, 'REFNO', 'REFNO');
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CustomerInvoiceLine extends Model
{
protected $table = 'SL_SALESINVOICETRAN';
public $timestamps = false;
protected $casts = [
'QTYTOINVOICE' => 'decimal:2',
'SELLINGPRICE' => 'decimal:2',
'COSTPRICE' => 'decimal:2',
];
public function invoice()
{
return $this->belongsTo(CustomerInvoice::class, 'REFNO', 'REFNO');
}
public function product()
{
return $this->belongsTo(Product::class, 'STOCKCODE', 'STOCKCODE');
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected $table = 'STK_STOCKITEM';
public $timestamps = false;
protected $casts = [
'COSTPRICE' => 'decimal:2',
'SELLINGPRICE1' => 'decimal:2',
];
public function category()
{
return $this->belongsTo(Category::class, 'CATEGORY', 'STCKCTGRYCDE');
}
public function supplierInvoiceLines()
{
return $this->hasMany(SupplierInvoiceLine::class, 'STOCKCODE', 'STOCKCODE');
}
public function customerInvoiceLines()
{
return $this->hasMany(CustomerInvoiceLine::class, 'STOCKCODE', 'STOCKCODE');
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Supplier extends Model
{
protected $table = 'PL_SUPPLIERACCOUNT';
public $timestamps = false;
public function invoices()
{
return $this->hasMany(SupplierInvoice::class, 'ACCNO', 'SUPLCDE');
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SupplierInvoice extends Model
{
protected $table = 'PL_BILL';
public $timestamps = false;
protected $casts = [
'DOCDTETME' => 'datetime',
];
public function supplier()
{
return $this->belongsTo(Supplier::class, 'ACCNO', 'SUPLCDE');
}
public function lines()
{
return $this->hasMany(SupplierInvoiceLine::class, 'REFNO', 'REFNO');
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SupplierInvoiceLine extends Model
{
protected $table = 'PL_BILLTRAN';
public $timestamps = false;
protected $casts = [
'QTYTOINVOICE' => 'decimal:2',
'COSTPRICE' => 'decimal:2',
];
public function invoice()
{
return $this->belongsTo(SupplierInvoice::class, 'REFNO', 'REFNO');
}
public function product()
{
return $this->belongsTo(Product::class, 'STOCKCODE', 'STOCKCODE');
}
}