Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Fixes for Process Command and Dashboard #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Console/Commands/processSoftCRM.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function handle(): void
$this->info('===============================================================');
$this->info('Everything looks perfect! Now you can start use SoftCRM!');
$this->info('If you have any question please contact with me by email: [email protected]');

$this->dispatchSync(new StoreSystemLogJob('First usage of process-softcrm command', 200, 1));
$user = \App\Models\Administrator::find(1);
$this->dispatchSync(new StoreSystemLogJob('First usage of process-softcrm command', 200, $user));
}
}
23 changes: 14 additions & 9 deletions app/Services/CalculateCashService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ class CalculateCashService
*/
public function loadCountCashTurnover(): mixed
{
$productSum = Product::sum(function ($product) {
return $product->price * $product->count;
});
$productSum = Product::get()
->sum(function ($product) {
return $product->price * $product->count;
});

$salesSum = Sale::sum(function ($sale) {
return $sale->price * $sale->quantity;
});
$salesSum = Sale::get()
->sum(function ($sale) {
return $sale->price * $sale->quantity;
});

$financesSum = Finance::sum('net');

Expand All @@ -39,11 +41,13 @@ public function loadCountCashTurnover(): mixed
public function loadCountTodayIncome(): mixed
{
$productSum = Product::whereDate('created_at', Carbon::today())
->get()
->sum(function ($product) {
return $product->price * $product->count;
});

$salesSum = Sale::whereDate('created_at', Carbon::today())
->get()
->sum(function ($sale) {
return $sale->price * $sale->quantity;
});
Expand All @@ -61,11 +65,13 @@ public function loadCountTodayIncome(): mixed
public function loadCountYesterdayIncome(): mixed
{
$productSum = Product::whereDate('created_at', Carbon::yesterday())
->get()
->sum(function ($product) {
return $product->price * $product->count;
});

$salesSum = Sale::whereDate('created_at', Carbon::yesterday())
->get()
->sum(function ($sale) {
return $sale->price * $sale->quantity;
});
Expand All @@ -83,11 +89,10 @@ public function loadCountYesterdayIncome(): mixed
public function loadCountAllRowsInDb(): int
{
$counter = 0;
$tables = DB::select('SHOW TABLES');
$databaseName = DB::connection()->getDatabaseName();
$tables = DB::select("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'");

foreach ($tables as $table) {
$tableName = $table->{'Tables_in_' . $databaseName};
$tableName = $table->name;
$counter += DB::table($tableName)->count();
}

Expand Down
10 changes: 5 additions & 5 deletions bootstrap/cache/packages.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php return array (
'barryvdh/laravel-dompdf' =>
array (
'providers' =>
array (
0 => 'Barryvdh\\DomPDF\\ServiceProvider',
),
'aliases' =>
array (
'Pdf' => 'Barryvdh\\DomPDF\\Facade\\Pdf',
'PDF' => 'Barryvdh\\DomPDF\\Facade\\Pdf',
'Pdf' => 'Barryvdh\\DomPDF\\Facade\\Pdf',
),
'providers' =>
array (
0 => 'Barryvdh\\DomPDF\\ServiceProvider',
),
),
'cknow/laravel-money' =>
Expand Down
38 changes: 19 additions & 19 deletions bootstrap/cache/services.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php return array (
'providers' =>
'providers' =>
array (
0 => 'Illuminate\\Auth\\AuthServiceProvider',
1 => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
Expand Down Expand Up @@ -33,7 +33,7 @@
29 => 'Termwind\\Laravel\\TermwindServiceProvider',
30 => 'App\\Providers\\AppServiceProvider',
),
'eager' =>
'eager' =>
array (
0 => 'Illuminate\\Auth\\AuthServiceProvider',
1 => 'Illuminate\\Cookie\\CookieServiceProvider',
Expand All @@ -53,7 +53,7 @@
15 => 'Termwind\\Laravel\\TermwindServiceProvider',
16 => 'App\\Providers\\AppServiceProvider',
),
'deferred' =>
'deferred' =>
array (
'Illuminate\\Broadcasting\\BroadcastManager' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
'Illuminate\\Contracts\\Broadcasting\\Factory' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
Expand Down Expand Up @@ -206,49 +206,49 @@
'Illuminate\\Contracts\\Validation\\UncompromisedVerifier' => 'Illuminate\\Validation\\ValidationServiceProvider',
'command.tinker' => 'Laravel\\Tinker\\TinkerServiceProvider',
),
'when' =>
'when' =>
array (
'Illuminate\\Broadcasting\\BroadcastServiceProvider' =>
'Illuminate\\Broadcasting\\BroadcastServiceProvider' =>
array (
),
'Illuminate\\Bus\\BusServiceProvider' =>
'Illuminate\\Bus\\BusServiceProvider' =>
array (
),
'Illuminate\\Cache\\CacheServiceProvider' =>
'Illuminate\\Cache\\CacheServiceProvider' =>
array (
),
'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' =>
'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' =>
array (
),
'Illuminate\\Concurrency\\ConcurrencyServiceProvider' =>
'Illuminate\\Concurrency\\ConcurrencyServiceProvider' =>
array (
),
'Illuminate\\Hashing\\HashServiceProvider' =>
'Illuminate\\Hashing\\HashServiceProvider' =>
array (
),
'Illuminate\\Mail\\MailServiceProvider' =>
'Illuminate\\Mail\\MailServiceProvider' =>
array (
),
'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' =>
'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' =>
array (
),
'Illuminate\\Pipeline\\PipelineServiceProvider' =>
'Illuminate\\Pipeline\\PipelineServiceProvider' =>
array (
),
'Illuminate\\Queue\\QueueServiceProvider' =>
'Illuminate\\Queue\\QueueServiceProvider' =>
array (
),
'Illuminate\\Redis\\RedisServiceProvider' =>
'Illuminate\\Redis\\RedisServiceProvider' =>
array (
),
'Illuminate\\Translation\\TranslationServiceProvider' =>
'Illuminate\\Translation\\TranslationServiceProvider' =>
array (
),
'Illuminate\\Validation\\ValidationServiceProvider' =>
'Illuminate\\Validation\\ValidationServiceProvider' =>
array (
),
'Laravel\\Tinker\\TinkerServiceProvider' =>
'Laravel\\Tinker\\TinkerServiceProvider' =>
array (
),
),
);
);
Loading