diff --git a/app/Http/Controllers/Bpjs/BatalControlController.php b/app/Http/Controllers/Bpjs/BatalControlController.php index ad7459f13..575886cf0 100644 --- a/app/Http/Controllers/Bpjs/BatalControlController.php +++ b/app/Http/Controllers/Bpjs/BatalControlController.php @@ -135,4 +135,49 @@ public function filterByTime($filter) 'text' => $text, ]); } + + public function print(Request $request) + { + // Validasi input + $request->validate([ + 'dari_tanggal' => 'required|date', + 'sampai_tanggal' => 'required|date|after_or_equal:dari_tanggal', + ]); + + // Ambil nilai input + $dariTanggal = $request->input('dari_tanggal'); + $sampaiTanggal = $request->input('sampai_tanggal'); + $dariTanggal = Carbon::parse($dariTanggal)->format('Y-m-d H:i:s'); + $sampaiTanggal = Carbon::parse($sampaiTanggal)->endOfDay()->format('Y-m-d H:i:s'); + + $query = DB::connection('mysql6')->table('bpjs.rencana_kontrol as rekon') + ->select( + 'peserta.noKartu', + 'rekon.noSurat', + 'rekon.tglRencanaKontrol', + 'peserta.nama as namaPasien', + 'pasien.NORM as norm', + 'poli.nama as ruangan', + 'dpjp.nama as namaDokter' + ) + ->leftJoin('monitoring_rencana_kontrol as monitor', 'monitor.noSuratKontrol', '=', 'rekon.noSurat') + ->leftJoin('bpjs.dpjp as dpjp', 'dpjp.kode', '=', 'rekon.kodeDokter') + ->leftJoin('bpjs.poli as poli', 'poli.kode', '=', 'rekon.poliKontrol') + ->leftJoin('bpjs.kunjungan as kunjunganBpjs', 'kunjunganBpjs.noSEP', '=', 'rekon.nomor') + ->leftJoin('bpjs.peserta as peserta', 'peserta.noKartu', '=', 'kunjunganBpjs.noKartu') + ->leftJoin('master.kartu_asuransi_pasien as asuransi', 'asuransi.NOMOR', '=', 'peserta.noKartu') + ->leftJoin('master.pasien as pasien', 'pasien.NORM', '=', 'asuransi.NORM') + ->whereNull('monitor.noSuratKontrol') + ->whereBetween('rekon.tglRencanaKontrol', [$dariTanggal, $sampaiTanggal]) + ->orderByDesc('rekon.tglRencanaKontrol') + ->orderBy('peserta.nama') + ->get(); + + // Kirim data ke frontend menggunakan Inertia + return inertia("Bpjs/BatalKontrol/Print", [ + 'data' => $query, + 'dariTanggal' => $dariTanggal, + 'sampaiTanggal' => $sampaiTanggal, + ]); + } } \ No newline at end of file diff --git a/app/Http/Controllers/Bpjs/MonitoringRekonController.php b/app/Http/Controllers/Bpjs/MonitoringRekonController.php index 1a3e4b08a..852b19199 100755 --- a/app/Http/Controllers/Bpjs/MonitoringRekonController.php +++ b/app/Http/Controllers/Bpjs/MonitoringRekonController.php @@ -2,9 +2,11 @@ namespace App\Http\Controllers\Bpjs; +use Carbon\Carbon; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; use App\Http\Controllers\Controller; use App\Models\BpjsMonitorRekonModel; -use Illuminate\Http\Request; class MonitoringRekonController extends Controller { @@ -144,4 +146,41 @@ public function detail($id) 'detail' => $query, ]); } + + public function print(Request $request) + { + // Validasi input + $request->validate([ + 'dari_tanggal' => 'required|date', + 'sampai_tanggal' => 'required|date|after_or_equal:dari_tanggal', + ]); + + // Ambil nilai input + $dariTanggal = $request->input('dari_tanggal'); + $sampaiTanggal = $request->input('sampai_tanggal'); + $dariTanggal = Carbon::parse($dariTanggal)->format('Y-m-d H:i:s'); + $sampaiTanggal = Carbon::parse($sampaiTanggal)->endOfDay()->format('Y-m-d H:i:s'); + + $query = DB::connection('mysql6')->table('bpjs.monitoring_rencana_kontrol as monitoring') + ->select( + 'monitoring.noSuratKontrol', + 'monitoring.tglRencanaKontrol as tanggal', + 'monitoring.noKartu', + 'monitoring.nama as namaPasien', + 'monitoring.namaPoliAsal', + 'monitoring.namaDokter', + ) + ->leftJoin('bpjs.poli as poli', 'poli.kode', '=', 'monitoring.poliTujuan') + ->whereBetween('monitoring.tglRencanaKontrol', [$dariTanggal, $sampaiTanggal]) + ->orderBy('monitoring.tglRencanaKontrol') + ->orderBy('monitoring.nama') + ->get(); + + // Kirim data ke frontend menggunakan Inertia + return inertia("Bpjs/Monitoring/Print", [ + 'data' => $query, + 'dariTanggal' => $dariTanggal, + 'sampaiTanggal' => $sampaiTanggal, + ]); + } } \ No newline at end of file diff --git a/app/Http/Controllers/Bpjs/RencanaKontrolController.php b/app/Http/Controllers/Bpjs/RencanaKontrolController.php index 3a7447981..b2b541327 100755 --- a/app/Http/Controllers/Bpjs/RencanaKontrolController.php +++ b/app/Http/Controllers/Bpjs/RencanaKontrolController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Bpjs; +use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use App\Http\Controllers\Controller; @@ -16,17 +17,29 @@ public function index() // Start building the query using the query builder $query = DB::connection('mysql6')->table('bpjs.rencana_kontrol as rekon') ->select( + 'pasien.NORM as norm', + 'peserta.nama as namaPasien', 'rekon.noSurat', - 'rekon.nomor as noSep', 'rekon.tglRencanaKontrol as tanggal', 'poli.nama as poliTujuan', - 'pasien.NORM as norm', - 'peserta.nama' + 'dpjp.nama as namaDokter', + 'pasienBpjs.nama as pasienNama', ) ->leftJoin('bpjs.kunjungan as kunjungan', 'kunjungan.noSEP', '=', 'rekon.nomor') ->leftJoin('bpjs.poli as poli', 'poli.kode', '=', 'rekon.poliKontrol') + ->leftJoin('bpjs.dpjp as dpjp', 'dpjp.kode', '=', 'rekon.kodeDokter') ->leftJoin('bpjs.peserta as peserta', 'peserta.noKartu', '=', 'kunjungan.noKartu') - ->leftJoin('master.kartu_identitas_pasien as pasien', 'pasien.NOMOR', '=', 'peserta.nik'); + ->leftJoin('bpjs.peserta as pasienBpjs', 'pasienBpjs.noKartu', '=', 'rekon.nomor') + ->leftJoin('master.kartu_identitas_pasien as pasien', 'pasien.NOMOR', '=', 'peserta.nik') + ->groupBy( + 'rekon.noSurat', + 'pasien.NORM', + 'peserta.nama', + 'rekon.tglRencanaKontrol', + 'poli.nama', + 'dpjp.nama', + 'pasienBpjs.nama' + ); // Add search filter if provided if ($searchSubject) { @@ -39,7 +52,9 @@ public function index() } // Paginate the results - $data = $query->orderByDesc('rekon.tglRencanaKontrol')->paginate(10)->appends(request()->query()); + $data = $query + ->orderByDesc('rekon.tglRencanaKontrol') + ->paginate(10)->appends(request()->query()); // Convert data to array $dataArray = $data->toArray(); @@ -157,4 +172,56 @@ public function filterByTime($filter) 'text' => $text, ]); } + + public function print(Request $request) + { + // Validasi input + $request->validate([ + 'dari_tanggal' => 'required|date', + 'sampai_tanggal' => 'required|date|after_or_equal:dari_tanggal', + ]); + + // Ambil nilai input + $dariTanggal = $request->input('dari_tanggal'); + $sampaiTanggal = $request->input('sampai_tanggal'); + $dariTanggal = Carbon::parse($dariTanggal)->format('Y-m-d H:i:s'); + $sampaiTanggal = Carbon::parse($sampaiTanggal)->endOfDay()->format('Y-m-d H:i:s'); + + $query = DB::connection('mysql6')->table('bpjs.rencana_kontrol as rekon') + ->select( + 'pasien.NORM as norm', + 'peserta.nama as namaPasien', + 'rekon.noSurat', + 'rekon.tglRencanaKontrol as tanggal', + 'poli.nama as poliTujuan', + 'dpjp.nama as namaDokter', + 'pasienBpjs.nama as pasienNama', + ) + ->leftJoin('bpjs.kunjungan as kunjungan', 'kunjungan.noSEP', '=', 'rekon.nomor') + ->leftJoin('bpjs.poli as poli', 'poli.kode', '=', 'rekon.poliKontrol') + ->leftJoin('bpjs.dpjp as dpjp', 'dpjp.kode', '=', 'rekon.kodeDokter') + ->leftJoin('bpjs.peserta as peserta', 'peserta.noKartu', '=', 'kunjungan.noKartu') + ->leftJoin('bpjs.peserta as pasienBpjs', 'pasienBpjs.noKartu', '=', 'rekon.nomor') + ->leftJoin('master.kartu_identitas_pasien as pasien', 'pasien.NOMOR', '=', 'peserta.nik') + ->whereBetween('rekon.tglRencanaKontrol', [$dariTanggal, $sampaiTanggal]) + ->groupBy( + 'rekon.noSurat', + 'pasien.NORM', + 'peserta.nama', + 'rekon.tglRencanaKontrol', + 'poli.nama', + 'dpjp.nama', + 'pasienBpjs.nama' + ) + ->orderBy('peserta.nama') + ->orderBy('pasienBpjs.nama') + ->get(); + + // Kirim data ke frontend menggunakan Inertia + return inertia("Bpjs/Rekon/Print", [ + 'data' => $query, + 'dariTanggal' => $dariTanggal, + 'sampaiTanggal' => $sampaiTanggal, + ]); + } } \ No newline at end of file diff --git a/resources/js/Components/NavigationMaster.jsx b/resources/js/Components/NavigationMaster.jsx index 4931b4a16..23f424061 100755 --- a/resources/js/Components/NavigationMaster.jsx +++ b/resources/js/Components/NavigationMaster.jsx @@ -35,7 +35,8 @@ export default function NavigationMaster() { route().current('referensi.index') || route().current('ruangan.index') || route().current('tindakan.index') || - route().current('tindakanRuangan.index'); + route().current('tindakanRuangan.index') || + route().current('register'); }; return ( @@ -112,6 +113,12 @@ export default function NavigationMaster() { > Tindakan Ruangan + + Register + )} diff --git a/resources/js/Pages/Bpjs/BatalKontrol/Cetak.jsx b/resources/js/Pages/Bpjs/BatalKontrol/Cetak.jsx new file mode 100644 index 000000000..ffc81f99b --- /dev/null +++ b/resources/js/Pages/Bpjs/BatalKontrol/Cetak.jsx @@ -0,0 +1,101 @@ +import React, { useEffect } from "react"; +import { useForm } from "@inertiajs/react"; +import InputLabel from "@/Components/InputLabel"; +import TextInput from "@/Components/TextInput"; + +export default function Cetak() { + + const { data, setData } = useForm({ + dari_tanggal: '', + sampai_tanggal: '' + }); + + useEffect(() => { + const currentDate = new Date(); + const currentYear = currentDate.getFullYear(); + const currentMonth = (currentDate.getMonth() + 1).toString().padStart(2, '0'); + const firstDayOfMonth = `${currentYear}-${currentMonth}-01`; + const formattedCurrentDate = currentDate.toISOString().split("T")[0]; + + setData(prevData => ({ + ...prevData, + dari_tanggal: firstDayOfMonth, + sampai_tanggal: formattedCurrentDate + })); + }, []); + + const onJenisPenjaminChange = (selectedOption) => { + setData(prevData => ({ ...prevData, jenisPenjamin: selectedOption.value })); + }; + + const onJenisKunjunganChange = (selectedOption) => { + setData(prevData => ({ ...prevData, jenisKunjungan: selectedOption.value })); + }; + + const onSubmit = (e) => { + e.preventDefault(); + + // Filter out empty values + const filteredData = Object.fromEntries(Object.entries(data).filter(([_, v]) => v !== '')); + + const queryString = new URLSearchParams(filteredData).toString(); + window.open(route("batalKontrol.print") + "?" + queryString, "_blank"); + }; + + return ( +
+ {new Date(dariTanggal).toLocaleDateString() === new Date(sampaiTanggal).toLocaleDateString() + ? `Tanggal : ${formatDate(sampaiTanggal)}` + : `Selang Tanggal : ${formatDate(dariTanggal)} s.d ${formatDate(sampaiTanggal)}`} +
+ +NO | +NORM | +NAMA PASIEN | +NOMOR KONTROL | +TANGGAL KONTROL | +RUANGAN TUJUAN | +JADWAL DOKTER | +
---|---|---|---|---|---|---|
{key + 1} | ++ {item.norm} + | ++ {item.namaPasien || item.pasienNama} + | ++ {item.noSurat} + | ++ {item.tglRencanaKontrol} + | ++ {item.ruangan} + | ++ {item.namaDokter} + | +
+ {new Date(dariTanggal).toLocaleDateString() === new Date(sampaiTanggal).toLocaleDateString() + ? `Tanggal : ${formatDate(sampaiTanggal)}` + : `Selang Tanggal : ${formatDate(dariTanggal)} s.d ${formatDate(sampaiTanggal)}`} +
+ +NO | +NORM | +NAMA PASIEN | +NOMOR KONTROL | +TANGGAL KONTROL | +POLI ASAL | +JADWAL DOKTER | +
---|---|---|---|---|---|---|
{key + 1} | ++ {item.norm} + | ++ {item.namaPasien || item.pasienNama} + | ++ {item.noSuratKontrol} + | ++ {item.tanggal} + | ++ {item.namaPoliAsal} + | ++ {item.namaDokter} + | +
+ {new Date(dariTanggal).toLocaleDateString() === new Date(sampaiTanggal).toLocaleDateString() + ? `Tanggal : ${formatDate(sampaiTanggal)}` + : `Selang Tanggal : ${formatDate(dariTanggal)} s.d ${formatDate(sampaiTanggal)}`} +
+ +NO | +NORM | +NAMA PASIEN | +NOMOR KONTROL | +TANGGAL KONTROL | +RUANGAN TUJUAN | +JADWAL DOKTER | +
---|---|---|---|---|---|---|
{key + 1} | ++ {item.norm} + | ++ {item.namaPasien || item.pasienNama} + | ++ {item.noSurat} + | ++ {item.tanggal} + | ++ {item.poliTujuan} + | ++ {item.namaDokter} + | +