Add Stargas supplier dashboard with performance analytics
This commit is contained in:
16
src/app/Models/Category.php
Normal file
16
src/app/Models/Category.php
Normal 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');
|
||||
}
|
||||
}
|
||||
16
src/app/Models/Customer.php
Normal file
16
src/app/Models/Customer.php
Normal 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');
|
||||
}
|
||||
}
|
||||
25
src/app/Models/CustomerInvoice.php
Normal file
25
src/app/Models/CustomerInvoice.php
Normal 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');
|
||||
}
|
||||
}
|
||||
27
src/app/Models/CustomerInvoiceLine.php
Normal file
27
src/app/Models/CustomerInvoiceLine.php
Normal 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');
|
||||
}
|
||||
}
|
||||
31
src/app/Models/Product.php
Normal file
31
src/app/Models/Product.php
Normal 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');
|
||||
}
|
||||
}
|
||||
16
src/app/Models/Supplier.php
Normal file
16
src/app/Models/Supplier.php
Normal 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');
|
||||
}
|
||||
}
|
||||
25
src/app/Models/SupplierInvoice.php
Normal file
25
src/app/Models/SupplierInvoice.php
Normal 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');
|
||||
}
|
||||
}
|
||||
26
src/app/Models/SupplierInvoiceLine.php
Normal file
26
src/app/Models/SupplierInvoiceLine.php
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user