Revert "Merge branch 'dashboardReport' into 'master'"

This reverts merge request !5
This commit is contained in:
omair saleh
2019-03-19 09:57:38 +00:00
parent c6ca0a7816
commit 8a28eb1790
483 changed files with 28 additions and 587 deletions
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
@@ -1,45 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: ayen
* Date: 19/03/2019
* Time: 9:42 AM
*/
namespace App\Classes\Modules\ControllersLogic\Dashboard;
use App\Models\Company;
use App\Models\Order;
use Carbon\Carbon;
class ActiveCustomerReportLogic
{
/* @var Order */
private $orderRepository;
/* @var Company */
private $companiesRepository;
/**
* ActiveCustomerReportLogic constructor.
* @param Order $orderRepository
* @param Company $companiesRepository
*/
public function __construct(Order $orderRepository, Company $companiesRepository)
{
$this->orderRepository = $orderRepository;
$this->companiesRepository = $companiesRepository;
}
public function execute() {
$active = $this->orderRepository->whereYear('created_at', '=', Carbon::now()->year)->whereMonth('created_at', '=', Carbon::now()->month)->orderBy('company_id')->get()->groupBy('company_id');
$company = $this->companiesRepository->count();
if ($company > $active->count()) $company -= $active->count();
else $company = $active->count() - $company;
return [$active->count(), $company];
}
}
@@ -1,47 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: ayen
* Date: 18/03/2019
* Time: 10:16 AM
*/
namespace App\Classes\Modules\ControllersLogic\Dashboard;
use App\Models\Package;
use Carbon\Carbon;
class CbmReportLogic
{
/* @var Package */
private $repository;
/**
* CbmReportLogic constructor.
* @param Package $repository
*/
public function __construct(Package $repository)
{
$this->repository = $repository;
}
public function execute() {
$cbm = $this->repository->selectRaw('created_at, ((((width/100) * (length/100) * (height/100))) * quantity) as cbm')->whereYear('created_at', '=', Carbon::now()->year)->whereMonth('created_at', '=', Carbon::now()->month)->orderBy('created_at')->get();
$cbmGroup = $cbm->groupBy(function ($item) {
return Carbon::parse($item->created_at)->format('j');
});
$cbmMap = $cbmGroup->map(function ($item){
return collect($item)->sum("cbm");
})->toArray();
$report = [];
for($x = 1; $x <= Carbon::now()->daysInMonth; $x++){
$report[] = isset($cbmMap[$x]) ? $cbmMap[$x] : 0;
}
return $report;
}
}
@@ -1,54 +0,0 @@
<?php
namespace App\Classes\Modules\ControllersLogic\Dashboard;
use App\Models\Order;
use Carbon\Carbon;
class OrdersReportLogic
{
/** @var Order */
private $repository;
/**
* OrdersReportLogic constructor.
* @param Order $repository
*/
public function __construct(Order $repository)
{
$this->repository = $repository;
}
public function execute() {
//Get Warehouse Order
$Orders= $this->repository->whereYear('created_at', '=', Carbon::now()->year)
->whereMonth('created_at', '=', Carbon::now()->month)->orderBy('created_at')->get();
$group = $Orders->groupBy(function($item) {
return Carbon::parse($item->created_at)->format('j');
});
$groupCount = $group->map(function ($item) {
return collect($item)->count();
})->toArray();
$report = [];
for($x = 1; $x <= Carbon::now()->daysInMonth; $x++){
$report[] = isset($groupCount[$x]) ? $groupCount[$x] : 0;
//Undefined offset:
// if(array_key_exists($x, $groupCount)){
// $report[] = $groupCount[$x];
// } else {
// $report[] = 0;
// }
}
// dd(Carbon::now()->daysInMonth);
// dd($groupCount);
// dd($groupCount["01"]);
return $report;
}
}
@@ -1,46 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: ayen
* Date: 19/03/2019
* Time: 11:52 AM
*/
namespace App\Classes\Modules\ControllersLogic\Dashboard;
use App\Models\Order;
use Carbon\Carbon;
class OrdersStatusReportLogic
{
/* @var Order */
private $repository;
/**
* OrderTypeReportLogic constructor.
* @param Order $repository
*/
public function __construct(Order $repository)
{
$this->repository = $repository;
}
public function execute() {
$status = $this->repository->whereNotNull('current_step')->get()->groupBy('current_step');
$completed = $this->repository->whereNull('current_step')->where('complete', '=' , 1)->get();
$statusMap = $status->map(function ($item) {
return collect($item)->count();
})->toArray();
$completedArray = ["COMPLETED" => $completed->count()];
$combine = $statusMap + $completedArray;
return [
$combine['PS_PROCESSING'],
$combine['MS_WAREHOUSE_RECEIVING'],
$combine['PS_SHIPPING'],
$completedArray['COMPLETED']
];
}
}
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File

Some files were not shown because too many files have changed in this diff Show More