Skip to content

Commit

Permalink
Update Project
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielzimbra committed Mar 20, 2023
1 parent be33f66 commit d56feaf
Show file tree
Hide file tree
Showing 2,867 changed files with 451,678 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
52 changes: 52 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
* text=auto

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.vscode
Binary file added .rnd
Binary file not shown.
12 changes: 12 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
js:
finder:
not-name:
- webpack.mix.js
css: true
32 changes: 32 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
50 changes: 50 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];

/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}
79 changes: 79 additions & 0 deletions app/Exports/MedicineExport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

namespace App\Exports;

use Carbon\Carbon;
use App\Models\Medicine;
use App\Models\MedicineInOut;
use Illuminate\Support\Facades\DB;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;

class MedicineExport implements FromView, WithEvents
{
public function __construct(string $date)
{
$this->date = $date;
}
public function view(): View
{
$medicines = Medicine::all();
$month = Carbon::parse($this->date)->month;
$year = Carbon::parse($this->date)->year;
$medicines = MedicineInOut::join('medicines', 'medicines.id', '=', 'medicine_in_outs.medicine_id')
->whereYear('medicine_in_outs.created_at', $year)
->whereMonth('medicine_in_outs.created_at', $month)
->selectRaw('medicines.id, medicines.name, SUM(medicine_in_outs.quantity_in) as quantity_in, SUM(medicine_in_outs.quantity_out) as quantity_out, quantity_remaining')
->groupBy('medicine_id')
->orderBy('medicine_id')
->get();
$date = $this->date;
return view('pages.medicine.excel', compact('medicines', 'date'));
}

public function registerEvents(): array
{
$start = 3;
$this->totalValue = MedicineInOut::whereYear('created_at', Carbon::parse($this->date)->year)
->whereMonth('created_at', Carbon::parse($this->date)->month)
->distinct('medicine_id')
->count();
$cellRange = 'A' . $start . ':F' . $start + $this->totalValue;
return [
AfterSheet::class => function (AfterSheet $event) use ($cellRange) {
$event->sheet->getDelegate()->getStyle('A1:W1')->getFont('Times New Roman', 16, true, false)->setBold(true)->setSize(16);
$event->sheet->getDelegate()->getStyle('A2:W2')->getFont('Times New Roman', 16, true, false)->setBold(true)->setSize(16);
$event->sheet->getDelegate()->getStyle('A3:F3')->applyFromArray([
'borders' => [
'outline' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => ['argb' => '000000'],
],
'vertical' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['argb' => '000000'],
],
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
],
]);
$event->sheet->getStyle($cellRange)->applyFromArray([
'borders' => [
'outline' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => ['argb' => '000000'],
],
'vertical' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['argb' => '000000'],
],
],
])->getAlignment()->setWrapText(true);
}
];
}
}
78 changes: 78 additions & 0 deletions app/Exports/PatientExport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

namespace App\Exports;

use Carbon\Carbon;
use App\Models\MedicalRecord;
use App\Models\MedicalRecordMedicine;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;

class PatientExport implements FromView, WithEvents
{
public $totalValue;
public function __construct($date)
{
$this->date = $date;
}

public function view(): View
{
$date = $this->date;


$medical_records = MedicalRecord::whereYear('medical_records.created_at', Carbon::parse($this->date)->year)
->whereMonth('medical_records.created_at', Carbon::parse($this->date)->month)
->groupByRaw('DATE_FORMAT(medical_records.created_at, "%d/%m/%Y")')
->get();

return view('pages.medicalRecord.excel', compact('medical_records', 'date'));
}

public function registerEvents(): array
{
$start = 6;
$this->totalValue = MedicalRecordMedicine::whereYear('created_at', Carbon::parse($this->date)->year)
->whereMonth('created_at', Carbon::parse($this->date)->month)
->groupByRaw('DATE_FORMAT(created_at, "%d/%m/%Y")')
->count();
$cellRange = 'A' . $start . ':L' . $start + $this->totalValue;
return [
AfterSheet::class => function (AfterSheet $event) use ($cellRange) {
$event->sheet->getDelegate()->getStyle('A1:W1')->getFont('Times New Roman', 16, true, false)->setBold(true)->setSize(16);
$event->sheet->getDelegate()->getStyle('A2:W2')->getFont('Times New Roman', 16, true, false)->setBold(true)->setSize(16);
$event->sheet->getDelegate()->getStyle('A3:W3')->getFont('Times New Roman', 12, true, false)->setBold(true)->setSize(12);
$event->sheet->getDelegate()->getStyle('A4:L5')->applyFromArray([
'borders' => [
'outline' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => ['argb' => '000000'],
],
'vertical' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['argb' => '000000'],
],
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
],
]);
$event->sheet->getStyle($cellRange)->applyFromArray([
'borders' => [
'outline' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => ['argb' => '000000'],
],
'vertical' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['argb' => '000000'],
],
],
])->getAlignment()->setWrapText(true);
},
];
}
}
Loading

0 comments on commit d56feaf

Please sign in to comment.