diff --git a/app/Http/Controllers/TransaksiController.php b/app/Http/Controllers/TransaksiController.php index a80036c..89e4170 100644 --- a/app/Http/Controllers/TransaksiController.php +++ b/app/Http/Controllers/TransaksiController.php @@ -4,6 +4,8 @@ namespace App\Http\Controllers; use App\Http\Controllers\helper\helperController; use App\Models\transaksi; +use Barryvdh\DomPDF\Facade\Pdf as FacadePdf; +use Barryvdh\DomPDF\PDF; use Illuminate\Http\Request; class TransaksiController extends Controller @@ -108,4 +110,14 @@ class TransaksiController extends Controller public function datatable(){ return transaksi::where('is_delete', false)->get(); } + + public function invoice(string $uid){ + $transaksi = transaksi::where('uid', $uid)->first(); + $data = [ + 'transaksi' => $transaksi + ]; + $pdf = FacadePdf::loadview('transaksi.invoice', $data); + return $pdf->stream('Invoice-'.$transaksi->uid.'.pdf'); + + } } diff --git a/app/Http/Controllers/dashboardController.php b/app/Http/Controllers/dashboardController.php index dfd02c9..fbae38d 100644 --- a/app/Http/Controllers/dashboardController.php +++ b/app/Http/Controllers/dashboardController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\asuransi; use App\Models\patient; use App\Models\roomService; use App\Models\transaksi; @@ -11,24 +12,56 @@ use Spatie\FlareClient\View; class dashboardController extends Controller { - public function index(){ - $now = Carbon::now(); - $pasien = patient::where('is_delete', false)->count(); - $totalRuangan_pelayanan = roomService::where('is_delete', false)->count(); - $data = transaksi::selectRaw('COUNT(*) as total_transaksi, SUM(price) as total_harga') - ->whereDate('created_at', $now)->where('is_delete', false) - ->first(); + public function index(Request $request){ + $filter = $request->filter ?? 'today'; // default hari ini + $startDate = null; + $endDate = null; - $jumlahTransaksiHariIni = $data->total_transaksi; - $totalHargaTransaksiHariIni = $data->total_harga; + if ($filter == 'today') { + $startDate = Carbon::today(); + $endDate = Carbon::today(); + } elseif ($filter == 'yesterday') { + $startDate = Carbon::yesterday(); + $endDate = Carbon::yesterday(); + } elseif ($filter == '7days') { + $startDate = Carbon::now()->subDays(6); + $endDate = Carbon::today(); + } elseif ($filter == '30days') { + $startDate = Carbon::now()->subDays(29); + $endDate = Carbon::today(); + } elseif ($filter == 'this_month') { + $startDate = Carbon::now()->startOfMonth(); + $endDate = Carbon::now()->endOfMonth(); + } elseif ($filter == 'custom' && $request->start_date && $request->end_date) { + $startDate = Carbon::parse($request->start_date); + $endDate = Carbon::parse($request->end_date); + } - $data = [ - 'title' => 'Dashboard', - 'total_pasien' => $pasien, - 'total_rp' => $totalRuangan_pelayanan, - 'trx_today' => $jumlahTransaksiHariIni, - 'trx_nominal' => $totalHargaTransaksiHariIni, - ]; - return view('dashboard.index', $data); + // Query transaksi berdasarkan range tanggal + $query = Transaksi::where('is_delete', false); + if ($startDate && $endDate) { + $query->whereBetween('created_at', [$startDate->startOfDay(), $endDate->endOfDay()]); + } + + $trx_today = $query->count(); + $trx_nominal = $query->sum('price'); + + $transaksi = $query->limit(5)->get(); + + // Data tambahan + $total_rp = RoomService::where('is_delete', false)->count(); + $asuransi = Asuransi::where('is_delete', false)->count(); + $pasien = Patient::where('is_delete', false)->count(); + $data =[ + 'title' => 'Dashboard', + 'trx_today' => $trx_today, + 'trx_nominal' => $trx_nominal, + 'asuransi' => $asuransi, + 'pasien' => $pasien, + 'total_rp'=>$total_rp, + 'transaksi' => $transaksi + ]; + + return view('dashboard.index', $data); } } diff --git a/composer.json b/composer.json index 5b40f87..94c05c0 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^8.1", + "barryvdh/laravel-dompdf": "^3.1", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.0", "laravel/sanctum": "^3.2", diff --git a/composer.lock b/composer.lock index ad69872..d5dbda0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,85 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bfe12996eeecb6fdc8713a9fd9d431f8", + "content-hash": "86a14aa92091a590b7523b8dfa7ba6d0", "packages": [ + { + "name": "barryvdh/laravel-dompdf", + "version": "v3.1.1", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-dompdf.git", + "reference": "8e71b99fc53bb8eb77f316c3c452dd74ab7cb25d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/8e71b99fc53bb8eb77f316c3c452dd74ab7cb25d", + "reference": "8e71b99fc53bb8eb77f316c3c452dd74ab7cb25d", + "shasum": "" + }, + "require": { + "dompdf/dompdf": "^3.0", + "illuminate/support": "^9|^10|^11|^12", + "php": "^8.1" + }, + "require-dev": { + "larastan/larastan": "^2.7|^3.0", + "orchestra/testbench": "^7|^8|^9|^10", + "phpro/grumphp": "^2.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "PDF": "Barryvdh\\DomPDF\\Facade\\Pdf", + "Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf" + }, + "providers": [ + "Barryvdh\\DomPDF\\ServiceProvider" + ] + }, + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Barryvdh\\DomPDF\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "A DOMPDF Wrapper for Laravel", + "keywords": [ + "dompdf", + "laravel", + "pdf" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-dompdf/issues", + "source": "https://github.com/barryvdh/laravel-dompdf/tree/v3.1.1" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2025-02-13T15:07:54+00:00" + }, { "name": "brick/math", "version": "0.12.3", @@ -378,6 +455,161 @@ ], "time": "2024-02-05T11:56:58+00:00" }, + { + "name": "dompdf/dompdf", + "version": "v3.1.0", + "source": { + "type": "git", + "url": "https://github.com/dompdf/dompdf.git", + "reference": "a51bd7a063a65499446919286fb18b518177155a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/a51bd7a063a65499446919286fb18b518177155a", + "reference": "a51bd7a063a65499446919286fb18b518177155a", + "shasum": "" + }, + "require": { + "dompdf/php-font-lib": "^1.0.0", + "dompdf/php-svg-lib": "^1.0.0", + "ext-dom": "*", + "ext-mbstring": "*", + "masterminds/html5": "^2.0", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "ext-gd": "*", + "ext-json": "*", + "ext-zip": "*", + "mockery/mockery": "^1.3", + "phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11", + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0" + }, + "suggest": { + "ext-gd": "Needed to process images", + "ext-gmagick": "Improves image processing performance", + "ext-imagick": "Improves image processing performance", + "ext-zlib": "Needed for pdf stream compression" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dompdf\\": "src/" + }, + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "The Dompdf Community", + "homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md" + } + ], + "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", + "homepage": "https://github.com/dompdf/dompdf", + "support": { + "issues": "https://github.com/dompdf/dompdf/issues", + "source": "https://github.com/dompdf/dompdf/tree/v3.1.0" + }, + "time": "2025-01-15T14:09:04+00:00" + }, + { + "name": "dompdf/php-font-lib", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/dompdf/php-font-lib.git", + "reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d", + "reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3 || ^4 || ^5 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "FontLib\\": "src/FontLib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-or-later" + ], + "authors": [ + { + "name": "The FontLib Community", + "homepage": "https://github.com/dompdf/php-font-lib/blob/master/AUTHORS.md" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/dompdf/php-font-lib", + "support": { + "issues": "https://github.com/dompdf/php-font-lib/issues", + "source": "https://github.com/dompdf/php-font-lib/tree/1.0.1" + }, + "time": "2024-12-02T14:37:59+00:00" + }, + { + "name": "dompdf/php-svg-lib", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/dompdf/php-svg-lib.git", + "reference": "eb045e518185298eb6ff8d80d0d0c6b17aecd9af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/eb045e518185298eb6ff8d80d0d0c6b17aecd9af", + "reference": "eb045e518185298eb6ff8d80d0d0c6b17aecd9af", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0", + "sabberworm/php-css-parser": "^8.4" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Svg\\": "src/Svg" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "The SvgLib Community", + "homepage": "https://github.com/dompdf/php-svg-lib/blob/master/AUTHORS.md" + } + ], + "description": "A library to read, parse and export to PDF SVG files.", + "homepage": "https://github.com/dompdf/php-svg-lib", + "support": { + "issues": "https://github.com/dompdf/php-svg-lib/issues", + "source": "https://github.com/dompdf/php-svg-lib/tree/1.0.0" + }, + "time": "2024-04-29T13:26:35+00:00" + }, { "name": "dragonmantank/cron-expression", "version": "v3.4.0", @@ -1889,6 +2121,73 @@ ], "time": "2024-09-21T08:32:55+00:00" }, + { + "name": "masterminds/html5", + "version": "2.9.0", + "source": { + "type": "git", + "url": "https://github.com/Masterminds/html5-php.git", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Masterminds\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Butcher", + "email": "technosophos@gmail.com" + }, + { + "name": "Matt Farina", + "email": "matt@mattfarina.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + } + ], + "description": "An HTML5 parser and serializer.", + "homepage": "http://masterminds.github.io/html5-php", + "keywords": [ + "HTML5", + "dom", + "html", + "parser", + "querypath", + "serializer", + "xml" + ], + "support": { + "issues": "https://github.com/Masterminds/html5-php/issues", + "source": "https://github.com/Masterminds/html5-php/tree/2.9.0" + }, + "time": "2024-03-31T07:05:07+00:00" + }, { "name": "monolog/monolog", "version": "3.9.0", @@ -3168,6 +3467,71 @@ ], "time": "2024-04-27T21:32:50+00:00" }, + { + "name": "sabberworm/php-css-parser", + "version": "v8.8.0", + "source": { + "type": "git", + "url": "https://github.com/MyIntervals/PHP-CSS-Parser.git", + "reference": "3de493bdddfd1f051249af725c7e0d2c38fed740" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/3de493bdddfd1f051249af725c7e0d2c38fed740", + "reference": "3de493bdddfd1f051249af725c7e0d2c38fed740", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": "^5.6.20 || ^7.0.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0" + }, + "require-dev": { + "phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.41" + }, + "suggest": { + "ext-mbstring": "for parsing UTF-8 CSS" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "9.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sabberworm\\CSS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Raphael Schweikert" + }, + { + "name": "Oliver Klee", + "email": "github@oliverklee.de" + }, + { + "name": "Jake Hotson", + "email": "jake.github@qzdesign.co.uk" + } + ], + "description": "Parser for CSS Files written in PHP", + "homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "keywords": [ + "css", + "parser", + "stylesheet" + ], + "support": { + "issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues", + "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.8.0" + }, + "time": "2025-03-23T17:59:05+00:00" + }, { "name": "symfony/console", "version": "v6.4.20", diff --git a/database_results.sql b/database_results.sql new file mode 100644 index 0000000..06407c3 --- /dev/null +++ b/database_results.sql @@ -0,0 +1,254 @@ +-- -------------------------------------------------------- +-- Host: 127.0.0.1 +-- Server version: 8.0.30 - MySQL Community Server - GPL +-- Server OS: Win64 +-- HeidiSQL Version: 12.1.0.6537 +-- -------------------------------------------------------- + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8 */; +/*!50503 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + + +-- Dumping database structure for task_rsbhak +CREATE DATABASE IF NOT EXISTS `task_rsbhak` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; +USE `task_rsbhak`; + +-- Dumping structure for table task_rsbhak.asuransis +CREATE TABLE IF NOT EXISTS `asuransis` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_delete` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `asuransis_uid_unique` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.asuransis: ~9 rows (approximately) +INSERT IGNORE INTO `asuransis` (`id`, `uid`, `name`, `is_delete`, `created_at`, `updated_at`) VALUES + (1, 'KedISANwDmhQ4A', 'BPJS', 0, '2025-04-27 00:36:13', '2025-04-27 04:25:33'), + (22, 'eVw2L9fkyP-ZXg', 'AIA', 0, '2025-04-27 04:31:13', '2025-04-27 04:31:13'), + (23, '0uNEhkYLfPEv6g', 'test', 1, '2025-04-27 06:01:41', '2025-04-27 06:01:43'); + +-- Dumping structure for table task_rsbhak.failed_jobs +CREATE TABLE IF NOT EXISTS `failed_jobs` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, + `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.failed_jobs: ~0 rows (approximately) + +-- Dumping structure for table task_rsbhak.migrations +CREATE TABLE IF NOT EXISTS `migrations` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `batch` int NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.migrations: ~0 rows (approximately) +INSERT IGNORE INTO `migrations` (`id`, `migration`, `batch`) VALUES + (2, '2014_10_12_100000_create_password_reset_tokens_table', 1), + (3, '2019_08_19_000000_create_failed_jobs_table', 1), + (4, '2019_12_14_000001_create_personal_access_tokens_table', 1), + (5, '2014_10_12_000000_create_users_table', 2), + (6, '2025_04_27_072551_create_asuransis_table', 3), + (7, '2025_04_27_075631_create_room_services_table', 4), + (8, '2025_04_27_085339_create_services_table', 5), + (10, '2025_04_27_094307_create_patients_table', 6), + (12, '2025_04_27_124513_create_registrasi_pasiens_table', 7), + (15, '2025_04_27_142732_create_transaksis_table', 8); + +-- Dumping structure for table task_rsbhak.password_reset_tokens +CREATE TABLE IF NOT EXISTS `password_reset_tokens` ( + `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.password_reset_tokens: ~0 rows (approximately) + +-- Dumping structure for table task_rsbhak.patients +CREATE TABLE IF NOT EXISTS `patients` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `birth` date NOT NULL, + `gender` enum('Laki-Laki','Perempuan') COLLATE utf8mb4_unicode_ci NOT NULL, + `is_delete` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `patients_uid_unique` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.patients: ~3 rows (approximately) +INSERT IGNORE INTO `patients` (`id`, `uid`, `name`, `birth`, `gender`, `is_delete`, `created_at`, `updated_at`) VALUES + (1, 'pHvvkA-0jYATHA', 'pasien 2', '1998-03-12', 'Perempuan', 0, '2025-04-27 03:41:17', '2025-04-27 06:05:07'), + (2, 'b4vySdqXcTYmWw', 'Pasien 2', '2000-12-12', 'Laki-Laki', 1, '2025-04-27 03:41:33', '2025-04-27 03:44:44'), + (3, 'Xi0_S5LCE1vsAg', 'Pasien 3', '2025-04-12', 'Perempuan', 1, '2025-04-27 03:41:47', '2025-04-27 03:44:41'), + (4, 'UdspOTiN33l_ng', 'Tio', '1998-08-12', 'Laki-Laki', 0, '2025-04-27 05:42:55', '2025-04-27 05:42:55'), + (5, 'Zs6volqlJ-VW4g', 'Pasien 3', '2000-02-12', 'Laki-Laki', 0, '2025-04-27 06:02:29', '2025-04-27 06:02:29'); + +-- Dumping structure for table task_rsbhak.personal_access_tokens +CREATE TABLE IF NOT EXISTS `personal_access_tokens` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `tokenable_id` bigint unsigned NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, + `abilities` text COLLATE utf8mb4_unicode_ci, + `last_used_at` timestamp NULL DEFAULT NULL, + `expires_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `personal_access_tokens_token_unique` (`token`), + KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.personal_access_tokens: ~0 rows (approximately) + +-- Dumping structure for table task_rsbhak.registrasi_pasiens +CREATE TABLE IF NOT EXISTS `registrasi_pasiens` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `pasien_uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `asuransi_uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `no_card_asuransi` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `pegawai_uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `date_regist` datetime DEFAULT NULL, + `ruang_pelayanan_uid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `is_delete` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `registrasi_pasiens_uid_unique` (`uid`), + KEY `registrasi_pasiens_pasien_uid_foreign` (`pasien_uid`), + KEY `registrasi_pasiens_asuransi_uid_foreign` (`asuransi_uid`), + KEY `registrasi_pasiens_pegawai_uid_foreign` (`pegawai_uid`), + KEY `registrasi_pasiens_ruang_pelayanan_uid_foreign` (`ruang_pelayanan_uid`), + CONSTRAINT `registrasi_pasiens_asuransi_uid_foreign` FOREIGN KEY (`asuransi_uid`) REFERENCES `asuransis` (`uid`) ON DELETE CASCADE, + CONSTRAINT `registrasi_pasiens_pasien_uid_foreign` FOREIGN KEY (`pasien_uid`) REFERENCES `patients` (`uid`) ON DELETE CASCADE, + CONSTRAINT `registrasi_pasiens_pegawai_uid_foreign` FOREIGN KEY (`pegawai_uid`) REFERENCES `users` (`uid`) ON DELETE CASCADE, + CONSTRAINT `registrasi_pasiens_ruang_pelayanan_uid_foreign` FOREIGN KEY (`ruang_pelayanan_uid`) REFERENCES `room_services` (`uid`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.registrasi_pasiens: ~0 rows (approximately) +INSERT IGNORE INTO `registrasi_pasiens` (`id`, `uid`, `pasien_uid`, `asuransi_uid`, `no_card_asuransi`, `pegawai_uid`, `date_regist`, `ruang_pelayanan_uid`, `is_delete`, `created_at`, `updated_at`) VALUES + (1, 'bqwXdVAbLYYlDA', 'pHvvkA-0jYATHA', 'KedISANwDmhQ4A', 'sadf', 'Da5sqbcopPFZCQ', NULL, 'T_pPy_MoCu_c8g', 0, '2025-04-27 06:56:13', '2025-04-27 07:26:53'), + (2, 'ukI1-3XN2YOR2Q', 'Zs6volqlJ-VW4g', 'KedISANwDmhQ4A', '1234567', 'Da5sqbcopPFZCQ', NULL, 'J18nY_QqEwjY8w', 0, '2025-04-27 07:38:55', '2025-04-27 07:38:55'); + +-- Dumping structure for table task_rsbhak.room_services +CREATE TABLE IF NOT EXISTS `room_services` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_delete` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `room_services_uid_unique` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.room_services: ~9 rows (approximately) +INSERT IGNORE INTO `room_services` (`id`, `uid`, `name`, `is_delete`, `created_at`, `updated_at`) VALUES + (1, 'MJuDzk8QFrHNKA', 'test', 1, '2025-04-27 01:12:40', '2025-04-27 01:20:31'), + (2, 'jqbeJUPnQmbWUQ', 'teadfsadf', 1, '2025-04-27 01:12:40', '2025-04-27 01:20:28'), + (3, 'wRXtMmPlIb8s1g', 'asdfasdfasfdsa', 1, '2025-04-27 01:12:40', '2025-04-27 01:20:25'), + (4, 'x5b4Qp24K-rnGQ', 'Ruangan Dokter Gigi', 0, '2025-04-27 01:13:37', '2025-04-27 01:19:06'), + (5, 'EoFMagnFPrFlRA', 'asdfafdasd', 1, '2025-04-27 01:13:37', '2025-04-27 01:19:10'), + (6, 'I3zKdpiI87Bt6A', 'adfasdf', 1, '2025-04-27 01:13:37', '2025-04-27 01:20:22'), + (7, 'J18nY_QqEwjY8w', 'Ruangan Dokter Anak', 0, '2025-04-27 01:13:37', '2025-04-27 01:20:17'), + (8, 'T_pPy_MoCu_c8g', 'Ruangan Radiologi', 0, '2025-04-27 01:13:50', '2025-04-27 01:19:55'), + (9, 'Pajky6cguQnYJw', 'test', 1, '2025-04-27 01:20:44', '2025-04-27 01:20:49'), + (10, 'IA4fljdqxJXxRg', 'Ruangan Dokter Umum', 0, '2025-04-27 04:25:50', '2025-04-27 04:25:50'), + (11, '9D8gqB8XXdnrKQ', 'teasdfasfasf', 1, '2025-04-27 06:01:48', '2025-04-27 06:01:53'); + +-- Dumping structure for table task_rsbhak.services +CREATE TABLE IF NOT EXISTS `services` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `tarif` bigint unsigned NOT NULL, + `is_delete` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `services_uid_unique` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.services: ~5 rows (approximately) +INSERT IGNORE INTO `services` (`id`, `uid`, `name`, `tarif`, `is_delete`, `created_at`, `updated_at`) VALUES + (1, 'G3HmhGeag4JwFA', 'data 1', 20000, 1, '2025-04-27 02:30:58', '2025-04-27 04:26:48'), + (2, '8Jk-P910QSEZvw', 'Surat Sehat', 20000, 0, '2025-04-27 02:31:18', '2025-04-27 02:40:28'), + (3, 'JGZ9tjN_mFE91Q', 'data 12323', 12323232, 1, '2025-04-27 02:31:18', '2025-04-27 04:26:45'), + (4, 'UVIl7qqzEdie3Q', 'data 232', 23123213, 1, '2025-04-27 02:31:18', '2025-04-27 02:35:59'), + (5, '3lAY1upDm6gFNg', 'DATA 12323', 222222, 1, '2025-04-27 02:32:14', '2025-04-27 02:35:56'), + (6, '5xOF5ApXhbuybQ', 'General practitioner', 50000, 0, '2025-04-27 04:30:54', '2025-04-27 04:30:54'), + (7, '81E_LXkxK2psLg', 'Cabut Kuku', 150000, 0, '2025-04-27 04:30:54', '2025-04-27 04:30:54'), + (8, 'Lj-vpXeJ5iI6XA', 'Suntik Vitamin C', 150000, 0, '2025-04-27 04:30:54', '2025-04-27 04:30:54'), + (9, '3Zb8gUk2JwXh_g', 'Sunat', 500000, 0, '2025-04-27 04:30:54', '2025-04-27 04:30:54'), + (10, 'O2ZJop5n7tH-_A', 'testeas', 123232, 1, '2025-04-27 06:02:00', '2025-04-27 06:02:04'); + +-- Dumping structure for table task_rsbhak.transaksis +CREATE TABLE IF NOT EXISTS `transaksis` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `reg_uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `services_uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `pegawai_uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `price` bigint unsigned DEFAULT NULL, + `is_delete` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `transaksis_uid_unique` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.transaksis: ~2 rows (approximately) +INSERT IGNORE INTO `transaksis` (`id`, `uid`, `reg_uid`, `services_uid`, `pegawai_uid`, `price`, `is_delete`, `created_at`, `updated_at`) VALUES + (1, 'CXXR7J5PSQgCyA', 'ukI1-3XN2YOR2Q', '5xOF5ApXhbuybQ', 'Da5sqbcopPFZCQ', 0, 1, '2025-04-27 08:04:39', '2025-04-27 08:17:21'), + (2, 'TNs_p318NyHkdQ', 'bqwXdVAbLYYlDA', '8Jk-P910QSEZvw', 'Da5sqbcopPFZCQ', 20000, 0, '2025-04-27 08:09:19', '2025-04-27 08:17:02'); + +-- Dumping structure for table task_rsbhak.users +CREATE TABLE IF NOT EXISTS `users` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_delete` tinyint(1) NOT NULL DEFAULT '0', + `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `users_uid_unique` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table task_rsbhak.users: ~1 rows (approximately) +INSERT IGNORE INTO `users` (`id`, `uid`, `name`, `email`, `password`, `is_delete`, `remember_token`, `created_at`, `updated_at`) VALUES + (1, 'Da5sqbcopPFZCQ', 'Joko', 'joko12prasetio@gmail.com', '$2y$10$OYttHxXsvtarfjI38alwIeSCqtXGqoIuK95C5yljT4xJKbCQC.Y16', 0, NULL, '2025-04-27 00:06:27', '2025-04-27 04:24:55'), + (2, 'v_zEQBpj5pTFeQ', 'Data 1', 'data@gmail.com', '$2y$10$PG8.qxtiFdLs6.BFmB6S6.om8wyCaauzW8hW3hyQi3myRP6owqMeq', 1, NULL, '2025-04-27 00:20:04', '2025-04-27 04:24:58'), + (5, 'NBpFcicOdHaJNg', 'testee', 'admwh12@gmail.com', '$2y$10$GGrFw2wF6RH7R5QxmwY1uOCpb1AgpaaqhefqMjgnBKOMqzGezxoIO', 1, NULL, '2025-04-27 06:01:33', '2025-04-27 06:01:36'); + +/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */; +/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; +/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */; diff --git a/public/js/transaksi/dt.js b/public/js/transaksi/dt.js index c485ea5..64bc53f 100644 --- a/public/js/transaksi/dt.js +++ b/public/js/transaksi/dt.js @@ -27,6 +27,11 @@ dataTable.bootstrapTable({ ` + buttons += ` + + + + ` return `
${buttons} diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index 525ae68..09f1dd9 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -1,464 +1,128 @@ @extends('main') + @section('body_section')
-
-
-
-
-
-
-
-
-
{{ $total_pasien ?? 0 }}
-
Total Pasien
-
-
-
{{ $total_rp }}
-
Ruangan Pelayanan
-
-
-
{{ $trx_today }}
-
Transaksi Hari Ini
-
-
-
-
- -
-
-
-

Pendapatan Hari ini

-
-
- Rp {{ number_format($trx_nominal ?? 0, 0, ',', '.') }} -
-
-
-
-
-
-
- -
-
- -
-
-
-

Balance

-
-
- $187,13 -
-
-
-
-
-
-
- -
-
- -
-
-
-

Sales

-
-
- 4,732 -
-
-
-
-
-
-
-
-
-

Budget vs Sales

-
-
- -
-
-
-
-
-
-

Top 5 Products

- -
-
-
    -
  • - product -
    -
    86 Sales
    -
    oPhone S9 Limited
    -
    -
    -
    -
    $68,714
    -
    -
    -
    -
    $38,700
    -
    -
    -
    -
  • -
  • - product -
    -
    67 Sales
    -
    iBook Pro 2018
    -
    -
    -
    -
    $107,133
    -
    -
    -
    -
    $91,455
    -
    -
    -
    -
  • -
  • - product -
    -
    63 Sales
    -
    Headphone Blitz
    -
    -
    -
    -
    $3,717
    -
    -
    -
    -
    $2,835
    -
    -
    -
    -
  • -
  • - product -
    -
    28 Sales
    -
    oPhone X Lite
    -
    -
    -
    -
    $13,972
    -
    -
    -
    -
    $9,660
    -
    -
    -
    -
  • -
  • - product -
    -
    19 Sales
    -
    Old Camera
    -
    -
    -
    -
    $7,391
    -
    -
    -
    -
    $5,472
    -
    -
    -
    -
  • -
-
- -
-
-
-
-
-
-
-

Best Products

-
-
- -
-
-
-
-
-
-

Top Countries

-
-
-
-
-
July
-
    -
  • - image -
    -
    Indonesia
    -
    3,282
    -
    -
  • -
  • - image -
    -
    Malaysia
    -
    2,976
    -
    -
  • -
  • - image -
    -
    United States
    -
    1,576
    -
    -
  • -
-
-
-
August
-
    -
  • - image -
    -
    Indonesia
    -
    3,486
    -
    -
  • -
  • - image -
    -
    Palestine
    -
    3,182
    -
    -
  • -
  • - image -
    -
    Germany
    -
    2,317
    -
    -
  • -
-
-
-
-
-
-
-
-
-
-
-

Invoices

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Invoice IDCustomerStatusDue DateAction
INV-87239Kusnadi
Unpaid
July 19, 2018 - Detail -
INV-48574Hasan Basri
Paid
July 21, 2018 - Detail -
INV-76824Muhamad Nuruzzaki
Unpaid
July 22, 2018 - Detail -
INV-84990Agung Ardiansyah
Unpaid
July 22, 2018 - Detail -
INV-87320Ardian Rahardiansyah
Paid
July 28, 2018 - Detail -
-
-
-
-
+ + {{-- FORM FILTER --}} +
+
-
-
-
- -
-

14

-
Customers need help
+ +
+ + + + {{-- KONTEN --}} +
+ + {{-- KOLOM KIRI: TABEL INVOICE --}} +
+
+
+

Transaksi

+ +
+
+
+ + + + + + + + + + + {{-- Contoh Data --}} + @foreach ($transaksi as $item) + + + + + + + @endforeach + + {{-- Tambah looping data invoice kalau mau dynamic --}} + +
Nama PasienTanggal LahirTindakanTarif
{{ $item->register?->patient->name ?? '-' }}{{ $item->register?->patient->birth ?? '-' }}{{ $item->tindakan?->name ?? '-' }}
{{ number_format($item->price ?? 0, 0, ',', '.') }}
-
+ {{-- KOLOM KANAN: CARD STATISTIK --}} +
+
+
+
+ +
+

{{ $trx_today }} (Rp {{ number_format($trx_nominal ?? 0, 0, ',', '.') }})

+
Total Pasien dan Pendapatan Hari Ini
+
+ +
+
+ +
{{-- End Row --}} + + + @endsection - - diff --git a/resources/views/transaksi/invoice.blade.php b/resources/views/transaksi/invoice.blade.php new file mode 100644 index 0000000..185f1ca --- /dev/null +++ b/resources/views/transaksi/invoice.blade.php @@ -0,0 +1,42 @@ + + + + + Invoice #{{ $transaksi->id }} + + + + +

INVOICE

+ +

No Invoice: {{ $transaksi->id }}

+

Tanggal: {{ $transaksi->created_at->format('d/m/Y') }}

+

Pasien: {{ $transaksi->register->patient->name }}

+ + + + + + + + + + + + + + +
TindakanHarga
{{ $transaksi->tindakan?->name }}Rp {{ number_format($transaksi->price, 0, ',', '.') }}
+ +
+ Total: Rp {{ number_format($transaksi->price, 0, ',', '.') }} +
+ + + diff --git a/routes/web.php b/routes/web.php index d1ecb4d..2a2c8b9 100644 --- a/routes/web.php +++ b/routes/web.php @@ -41,6 +41,7 @@ Route::group(['middleware' => ['auth']], function(){ Route::resource('/registrasi', RegistrasiPasienController::class); Route::get('/datatable/registrasi', [RegistrasiPasienController::class, 'datatable']); Route::resource('/transaksi', TransaksiController::class); + Route::get('/invoice/{uid}', [TransaksiController::class, 'invoice']); Route::get('/datatable/transaksi', [TransaksiController::class, 'datatable']); });