mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-24 23:14:16 +00:00
service report
This commit is contained in:
@@ -61,21 +61,21 @@ class MonthlyReportController
|
||||
return (new ApiResponseObject('fetch service report Successful',
|
||||
'',
|
||||
HttpStatus::OK_WITH_MESSAGE, ['data' => [
|
||||
'received' => Package::warehouseReceiveList()->sum('quantity'),
|
||||
'pending_shipment' => Package::shippingList()->whereDoesntHave('shippingSchedules', function($schedule){
|
||||
'received' => (float) Package::warehouseReceiveList()->sum('quantity'),
|
||||
'pending_shipment' => (float) Package::shippingList()->whereDoesntHave('shippingSchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
'in_transit' => Package::shippingList()->Shipping()->whereHas('shippingSchedules', function($schedule){
|
||||
'in_transit' => (float) Package::shippingList()->Shipping()->whereHas('shippingSchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->whereDoesntHave('shippingSchedules', function($schedule){
|
||||
return $schedule->dropped()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
'pending_delivery' => Package::shippingList()->whereHas('shippingSchedules', function($schedule){
|
||||
'pending_delivery' => (float) Package::shippingList()->whereHas('shippingSchedules', function($schedule){
|
||||
return $schedule->dropped()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->whereDoesntHave('deliverySchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
'delivered' => Package::shippingList()->whereHas('deliverySchedules', function($schedule){
|
||||
'delivered' => (float) Package::shippingList()->whereHas('deliverySchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
]]))->handler();
|
||||
|
||||
+15
-6
@@ -7,7 +7,9 @@ use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasOneDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
@@ -26,19 +28,26 @@ class Package extends AbstractModel
|
||||
return $this->belongsTo(PackingList::class, 'packing_list_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return hasOneDeep
|
||||
*/
|
||||
public function order(): hasOneDeep
|
||||
{
|
||||
return $this->hasOneDeep(Order::class, [PackingList::class], ['id', ['owner_type', 'owner_id']], ['packing_list_id', null]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasManyThrough
|
||||
* @return hasManyDeep
|
||||
*/
|
||||
public function shippingTransports(): hasManyThrough
|
||||
public function shippingTransports(): hasManyDeep
|
||||
{
|
||||
return $this->hasManyDeep(Transport::class, [PackingList::class, ContainerPackingList::class, Container::class], ['id', 'packing_list_id', 'id', ['owner_type', 'owner_id']], ['packing_list_id', 'id', 'container_id', null]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasManyThrough
|
||||
* @return hasManyDeep
|
||||
*/
|
||||
public function shippingSchedules(): hasManyThrough
|
||||
public function shippingSchedules(): hasManyDeep
|
||||
{
|
||||
return $this->hasManyDeep(Schedule::class, [PackingList::class, ContainerPackingList::class, Container::class, Transport::class], ['id', 'packing_list_id', 'id', ['owner_type', 'owner_id'], ['owner_type', 'owner_id']], ['packing_list_id', 'id', 'container_id', null, null]);
|
||||
}
|
||||
@@ -52,9 +61,9 @@ class Package extends AbstractModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasManyThrough
|
||||
* @return hasManyDeep
|
||||
*/
|
||||
public function deliverySchedules(): hasManyThrough
|
||||
public function deliverySchedules(): hasManyDeep
|
||||
{
|
||||
return $this->hasManyDeep(Schedule::class, [PackingList::class, Transport::class], ['id', ['owner_type', 'owner_id'], ['owner_type', 'owner_id']], ['packing_list_id', null, null]);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,37 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card no-border bg-master-lightest widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Pending Packing List</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5">{{report.received - (report.pending_shipment + report.in_transit + report.pending_delivery + report.delivered)}} Packages</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-primary" style="width: 0"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card no-border bg-master-lightest widget-loader-bar m-b-10">
|
||||
|
||||
Reference in New Issue
Block a user